-
-
Notifications
You must be signed in to change notification settings - Fork 62
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
fontContainsCharacters() returns False for characters > U+FFFF even though the font actually maps them #524
Comments
Can reproduce. The relevant code is here: drawbot/drawBot/context/baseContext.py Lines 1796 to 1805 in 100dbdf
It looks pretty innocent. I wonder if somehow PyObjC does something wrong when converting the |
After trying a few things, I think it's a PyObjC bug with https://developer.apple.com/documentation/coretext/1510813-ctfontgetglyphsforcharacters?language=objc, and UniChar is a 16bit type. |
Thanks @justvanrossum and @typemytype for the quick fix! |
What the title says. I suspect the root cause is in
CoreText.CTFontGetGlyphsForCharacters
possibly not supporting SMP or possibly the call to that function needs different treatment when SMP characters are in the string passed tofontContainsCharacters()
.Steps to repro:
drawBot.fontContainsCharacters()
for a character in that range and compare to the font's cmap (e.g. fontToolsgetBestCmap()
), something like this:dbFontContains=False
andinFontCmap=True
(for U+10400; both areTrue
for BMP characters present in the font such as U+0020 or U+00A0)Expected behavior:
fontContainsCharacters()
should returnTrue
for any character that is mapped in the font's most comprehensive Unicode cmap subtable.The text was updated successfully, but these errors were encountered: