らんだむな記憶

blogというものを体験してみようか!的なー

CFFがよくわかんね

$ ttx -t "CFF " -o dumped.txt test.otf

とかで中身を見ると、

        <CharString name="a">
          -59 194 -12 rmoveto

とか。ん?

$ autohint -nb test.otf

してから ttx すると

        <CharString name="a">
          -59 -12 66 -33 -21 430 68 hstemhm
          52 80 218 83 hintmask 10111000
          194 -12 rmoveto

ほよよ~?出だしの「-59」がイミフメイ。
https://partners.adobe.com/public/developer/en/font/5177.Type2.pdfを何度読んでも

rmoveto |- dx1 dy1 rmoveto (21) |-
        moves the current point to a position at the relative coordinates
        (dx1, dy1).

とかで、引数は2個なんですがね...。しかもヒンティングすると「-59」がヒントオペレータの引数に移動するんですが、それは...。
これはやばいとこ来ちまったぞ感が...。

ISO/IEC 系の仕様書と比べてイラッとすることが多いが結局は以下:
p.11より抜粋

Type 2 charstrings must be structured with operators, or classes of operators, sequenced in the following specific order:

1)Width: If the charstring has a width other than that of defaultWidthX
(see Technical Note #5176, “The Compact Font Format Specification”), it must be specified as the first number in the charstring, and encoded as the difference from nominalWidthX.

おーーーっと全力でむかつくぞコレ?逆ポーランド記法オペランドとオペレータを解釈する領域の先頭に nominal(名ばかりの) width との差分を記載だとー?しかも defaultWidthX と一致するならコレ存在しないってことだろ?おい専用のフィールドを用意しろよ!

        <defaultWidthX value="200"/>
        <nominalWidthX value="563"/>

<?xml version="1.0" encoding="UTF-8"?>
<glyph name="a" format="1">
  <advance width="504"/>

で、504 != 200 なんで、 504 - 563 = -59 を最初の1バイト目に書きますよ、てへっ♪で辻褄が合うのがめちゃくちゃ腹立つーーー!\\\\٩(๑`^´๑)۶////