--- src/utils/mac/SkCTFont.cpp.orig 2025-01-01 00:00:00.000000000 +0000 +++ src/utils/mac/SkCTFont.cpp 2025-01-01 00:00:00.000000000 +0000 @@ -215,6 +215,7 @@ * font smoothing will be applied if we request it. The main issue is that if * smoothing is applied a gamma of 2.0 will be used, if not a gamma of 1.0. */ +#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 SkCTFontSmoothBehavior SkCTFontGetSmoothBehavior() { static SkCTFontSmoothBehavior gSmoothBehavior = []{ uint32_t noSmoothBitmap[16][16] = {}; @@ -274,6 +275,14 @@ SkCTFontSmoothBehavior SkCTFontGetSmooth }(); return gSmoothBehavior; } +#else +// CTFontDrawGlyphs and CTFontManagerCreateFontDescriptorFromData are 10.7+ +// On 10.6 and earlier, assume some smoothing behavior +SkCTFontSmoothBehavior SkCTFontGetSmoothBehavior() { + // Default to "some" smoothing on older systems + return SkCTFontSmoothBehavior::some; +} +#endif SkCTFontWeightMapping& SkCTFontGetNSFontWeightMapping() { // In the event something goes wrong finding the real values, use this mapping. @@ -371,7 +380,17 @@ SkCTFontWeightMapping& SkCTFontGetNSFont if (!cfData) { return; } +#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 SkUniqueCFRef desc( CTFontManagerCreateFontDescriptorFromData(cfData.get())); +#else + // Use CGFont approach for 10.6 + SkUniqueCFRef provider( + CGDataProviderCreateWithCFData(cfData.get())); + SkUniqueCFRef cgFont(CGFontCreateWithDataProvider(provider.get())); + SkUniqueCFRef tmpFont( + CTFontCreateWithGraphicsFont(cgFont.get(), 0, nullptr, nullptr)); + SkUniqueCFRef desc(CTFontCopyFontDescriptor(tmpFont.get())); +#endif if (!desc) { return; }