Closed anthrotype closed 4 years ago
AFAIK, if the font does not use 1000 UPEM, FontMatrix must be used otherwise the glyphs will be incorrectly scaled.
As for CFF2, why is tx adding a FontMatrix to the FontDict (it wasn't there to begin with, it was only in the TopDict of the original CFF 1.0 input table), but then fonttools is dropping from it with a warning?
This looks like a bug indeed, the only operator allowed in CFF2 FontDict is Private, but may be tx
was following an old version of the spec (see the note in Font DICT Operator Entries).
may be tx was following and old version of the spec (see the note in Font DICT Operator Entries).
thanks @khaledhosny, now it makes sense. For now, i'll just strip it (#14), but will revise if/when this will be fixed upstream in afdko. /cc @josh-hadley
Thanks @anthrotype . We should definitely address this upstream. From discussions with @cjchapman that should be pretty straightforward.
@anthrotype & @khaledhosny Josh has fixed this issue in tx
in https://github.com/adobe-type-tools/afdko/pull/1165
Take an OTF with CFF 1.0 and a non-standard UPEM (i.e. not 1000), and convert it to CFF2 using cffsubr (which uses
tx
).You will see a warning upon compiling the OTF from fontTools.cffLib::L2409, saying that:
The CFF2 table that is generated by tx seem to contain an extra
FontMatrix
operator in theFDArray[0].FontDict
which fonttools doesn't expect it to be there and removes it while issuing the warning. This is weird sinceFontMatrix
is a TopDict operator, so it should not be there.I suspect this could be a bug in
tx
code or some support library elsewhere in afdko which is responsible for the CFF1 to 2 conversion.Note the warning only happens when FontMatrix is different form the default
[0.001 0 0 0.001 0 0]
, which for CFF is quite rare given most fonts are drawn at 1000 UPEM.To reproduce, take a UFO, change its
unitsPerEm
in fontinfo.plist to something different from 1000, compile the font to OTF with CFF 1.0 e.g. with fontmake or ufo2ft. Then pass it throughpython -m cffsubr --cff-version 2
to convert it to CFF, and you should see the above mentioned warning appear.To be honest, I actually am not sure what
FontMatrix
is used for when CFF/CFF2 are embedded in an OpenType font..