Closed josh-hadley closed 1 year ago
Can reproduce. The relevant code is here:
It looks pretty innocent.
I wonder if somehow PyObjC does something wrong when converting the characters
argument.
After trying a few things, I think it's a PyObjC bug with CTFontGetGlyphsForCharacters
. I suspect it has to encode the string as UTF-16, but doesn't.
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:db.font('NotoSansDeseret-Regular', 48) fontpath = db.fontFilePath() ttfont = TTFont(fontpath) umap = ttfont['cmap'].getBestCmap() u = 0x10400 c = chr(u) dbFontContains = db.fontContainsCharacters(c) inFontCmap = u in umap print(f'{dbFontContains=}, {inFontCmap=}')