User:VladVukicevic/Mac Text Notes
From MozillaWiki
- Fastest way to draw text is through CGContextShowGlyphs/CGContextShowGlyphsWithAdvances
- it needs a font set with CGContextSetFont
- which needs a CGFontRef, which comes from CGFontCreateWithPlatformFont, which needs an ATSFontRef*
- needs either a size set with CGContextSetFontSize, or a size specified with CGContextSetTextMatrix
- an array of CGGlyph values
- it needs a font set with CGContextSetFont
- ATSUFontID = FMFont
- FMGetATSFontRefFromFont (FMFont) -> ATSFontRef
- To select a font, we can look through |fontManager availableFonts| for a name match
- We can try to obtain an exact match for our desired traits by using NSFontManager convertFont:toHaveTrait:.
- traits that are useful for us: Italic, Bold, FixedPitch; maybe useful: SmallCaps, Narrow, Expanded, Condensed, Poster, Compressed