核心文本 CTFontGetBoundingRectsForGlyphs() 很慢

core text CTFontGetBoundingRectsForGlyphs() is to slow

我正在使用 CTFontGetBoundingRectsForGlyphs() 来查找单个字形宽度。 但是每行文本多次调用它太慢了。我问你有没有更快的方法来检查字形尺寸?

CTFontGetAdvancesForGlyphs() 可能是查找单个字形宽度的更快方法。

或者,如果您使用 CTLineCTRun,那么 CTRunGetAdvances() and CTRunGetAdvancesPtr() 应该会提供更快的结果,因为它们返回缓存值。