Closed chrisridd closed 2 years ago
The algorithm in ft2_font_id()
still uses family_name and style_name. Changing it to use TT_NAME_ID_UNIQUE_ID
might give more "unique" results, but it would break compatibility for documents which used the older font ids. Not worthwhile IMO.
Concatenating the family_name and style_name produces incorrect results for some fonts. We get better results by asking Freetype for the underlying TT_NAMEID names.
e.g.
Papyrus seems to do a better job with this patch than it does with NVDI. e.g. with NVDI you get one face called "Franklin Gothic" with styles "Regular" and "Regular". You get another face with the same name with styles "Italic" and "Italic". You get a face called "Palatino Linoty" and another face called "Palatino Linotype". Rather strange.
Querying TT_NAME_ID_PS_NAME gives us correct values for the
vqt_fontheader()
fh_sfntn
field. Thevqt_fontheader()
copyright etc fields can now be filled in using the new code, though they seem a bit inessential.Most TT_NAMEID values come back as Unicode even though they're generally
ASCII, so there's a quick and dirty conversion. macOS has some fonts from Apple
using Mac Roman encoded names, so convert those too. Note NVDI completely ignores
those Apple fonts.