This avoids unnecessary work and fixes a memory leak:
the character set wasn't released when code == 0.
static bool check_glyph(void *priv, uint32_t code)
{
+ if (code == 0)
+ return true;
+
CTFontDescriptorRef fontd = priv;
CFCharacterSetRef set =
CTFontDescriptorCopyAttribute(fontd, kCTFontCharacterSetAttribute);
if (!set)
return true;
- if (code == 0)
- return true;
-
bool result = CFCharacterSetIsLongCharacterMember(set, code);
SAFE_CFRelease(set);
return result;