Adjust antialiasing on macOS 10.14, programmatically

203 views Asked by At

I'm looking for a way to adjust text stroke weight in programmatically drawn text macOS Mojave with the default configuration of no subpixel antialiasing.

You used to be able to tweak the subpixel antialiasing algorithm with a private API: CGContextSetFontSmoothingStyle. When subpixel antialiasing is turned off that API does nothing. While undocumented, it was used by webkit in publicly released code: https://opensource.apple.com/source/WebCore/WebCore-351.9/platform/graphics/mac/FontMac.mm.auto.html

I know it's possible because System Prefs>General has "Use font smoothing when available" which does have an effect when subpixel antialiasing is off. But it does not seem to affect text that I render with CTFontDrawGlyphs or CGContextShowGlyphsAtPositions.

From disassembling system prefs it seems to change the AppleFontSmoothing user default (https://i.stack.imgur.com/zLis6.jpg). Changing that user default in my app does not seem to have any effect.

0

There are 0 answers