New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fonts without Microsoft-platform cmaps use Mac NameRecord #679
Comments
It'll also fall back on the macStyle field in the head table when computing the bold and italic flags; I forget what it does for numeric weight. |
I just saw that when the bold bit is set, GDI considered it like 800 which is kinda strange. |
Yes, if the OS/2 table is absent, then as far as I can tell:
|
This isn’t because the font lacks an OS/2 table; it may well have one (and I’ve just verified this by adding one via TTX). This is because the font lacks a Microsoft-platform cmap, as detailed on our wiki. I should note that my debug-fonts branch does list a Microsoft-platform cmap, so I’m guessing FreeType must be synthesizing one—and doing it badly, judging by the screenshot. TTX confirms that the font only has a single MacRoman cmap. This also shows that DirectWrite, yet again, behaves differently from GDI and we have yet another reason to feed (I had thought there’s some other reason that makes GDI not actually support such fonts at all, because Zapfino is definitely not supported. But clearly, GDI does support this font, and there’s a specific problem with Zapfino instead. Now I can’t help but wonder what’s wrong with it—I don’t immediately see what it could be.) |
OK, looks like Windows only recognizes cmap format 0 for Macintosh-platform cmaps. (Brushstroke here uses format 0; Zapfino uses format 6.) And even for Microsoft-platform cmaps, not all formats seem to be recognized, e. g. format 6 fails. Weird. |
FreeType is indeed synthesizing a Unicode cmap, and it’s almost right in how it’s doing it… except it forgets the main law of fontology: if there is a chance for a font not to do the sensible thing, there will be a font that does not do the sensible thing. The Brushstroke font labels its glyphs with names that correspond to standard character names… but are offset by one starting from “A”, which is labelled |
Since you already know it, do I close the issue? |
Thanks for asking, but no! This is still something that we ideally want to add support for, and it’s always good to have an issue tracking it. (By the way, this was also mentioned in #643, but it’s good to keep this separate.) Here’s how we can detect the FreeType-synthesized cmap: FT_Get_CMap_Format(cmap) == -1 We should only use it as a last resort when we can’t find any actual cmaps that we understand. |
I am not 100% sure, but it seems GDI use
Edit: It use |
Not MacRoman? |
Run this code with the font I provided earlier: from fontTools.ttLib.ttFont import TTFont
font = TTFont("test.ttf")
font["name"].setName("Test®".encode("macroman"), 1, 1, 0, 0)
font.save("test - new.ttf") If it would use mac_roman, GDI would return |
GDI name lookup works like this:
|
Screenshots
VSFilter
Libass (With DirectWrite)
Description of the issue
This font.zip doens't contain an OS/2 table.
When it is the case, GDI seems to only use the name from the namerecord with the platformID 1 (mac platform)
Here is the font naming table (I removed anything that is not family or fullname):
libass version
0.16.0
Is it a regression?
No response
ASS Sample
Special Fonts
I uploaded or linked to the required font
System Information
OS: Windows
Log
It seems that the mpv log miss the Brushstroke font
Additional info
No response
The text was updated successfully, but these errors were encountered: