[OSX] Replace FreeType by native glyph rasterization #8518
Motivation / Problem
On OSX, text layout for TrueType fonts and more complex languages is done by CoreText. Font rendering on the other hand is done by the FreeType library, which assumes these two components never disagree.
Font selection in CoreText has lots of fallbacks built-in; it is extremly hard to not get some font glyphs from CoreText. FreeType on the other hand needs a reference to an on-disk font file. We try hard to match the proper font, but might not always succeed if CoreText is applying some magic for exotic scripts. It is unlikely to ever be a problem for any kind of western script, though.
Letting CoreText render the font glyphs as well avoids any potential conflict or disagreement. It also removes an external dependency.
On average, CoreText appears to rasterize glyphs at least as fast as FreeType, often even faster. The implementation is similar to the Win32 implementation, as many concepts are analogue.
CoreText and FreeType make slightly different stylistic choices rasterizing glyphs. This is most apparent when anti-aliasing is activated, as CoreText has a tendency to render "thicker". CoreText appears to render best when using native (HiDPI) resolution (separate PR incoming).
Checklist for review
Some things are not automated, and forgotten often. This list is a reminder for the reviewers.
The text was updated successfully, but these errors were encountered:
Finally got this tested again - the rendering looks higher quality than FreeType for sure. Particularly noticeable with bold fonts I've found (e.g., Tahoma Bold) - FreeType is very 'squashed together', with the native rendering looking considerably better. Certainly from a visual point of view (plus getting rid of a dependency in the Mac builds!) I'd be keen for this to go in.
@orudge Got a personal taste question for you:
If you enable font anti-aliasing (config option only I'm afraid), which rendering is better: