I have a string that I can paint in Core Text like so:
CGContextShowGlyphsAtPoint(context, 0, 0, glyphs, glyphCount);
Works great. Now I need to paint each of those glyphs individually, in the same spot as they would end up painted using that nice utility function above. And I'm not doing it in English, either...sometimes there is a glyph below a glyph below a glyph (diacritic).
Obviously I need something like this:
CGPoint pt = CGPointMakeZero;
for (int i = 0; i < glyphCount; i++) {
CGContextShowGlyphsAtPoint(context, pt.x, pt.y, glyphs[i], 1);
pt.x += <some quantity>
pt.y += <some quantity>
}
Unfortunately I haven't figured out what the "some quantities" are supposed to be yet...some combination of metrics fromCGContextGetAdvancesForGlyphs
and/or CTFontGetVerticalTranslationsForGlyphs
and/or CGContextGetGlyphBBoxes
have been my first guesses, but I haven't got it to work yet.
Anyone have a solution/other ideas?
If you want a test string, try అక్త్రిన్.
(Background: I need to do the painting of glyphs one by one because of customizations to appearances to individual glyphs that I want to make in my app).