From db2a09f2408728871ed9e26eb1197cad6585a15d Mon Sep 17 00:00:00 2001 From: "reed@google.com" Date: Fri, 1 Jul 2011 14:35:40 +0000 Subject: [PATCH] fix chrome build, check OSX version before referencing 10.6 APIs git-svn-id: http://skia.googlecode.com/svn/trunk@1776 2bbb7eff-a529-9590-31e7-b0007b416f81 --- src/ports/SkFontHost_mac_coretext.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/ports/SkFontHost_mac_coretext.cpp b/src/ports/SkFontHost_mac_coretext.cpp index 8ee3d44..397eaa2 100644 --- a/src/ports/SkFontHost_mac_coretext.cpp +++ b/src/ports/SkFontHost_mac_coretext.cpp @@ -36,6 +36,10 @@ #include "SkUtils.h" #include "SkTypefaceCache.h" +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 + #define SK_SUPPORT_MAC_FONT_SUBPIXEL +#endif + using namespace skia_advanced_typeface_metrics_utils; static const size_t FONT_CACHE_MEMORY_BUDGET = 1024 * 1024; @@ -521,10 +525,11 @@ void SkScalerContext_Mac::generateImage(const SkGlyph& glyph) { // Draw the glyph if (cgFont != NULL && cgContext != NULL) { - CGContextSetAllowsFontSmoothing(cgContext, doLCD); CGContextSetShouldSmoothFonts(cgContext, doLCD); -#ifdef WE_ARE_RUNNING_ON_10_5_OR_LATER +#ifdef SK_SUPPORT_MAC_FONT_SUBPIXEL + CGContextSetAllowsFontSmoothing(cgContext, doLCD); + // need to pass the fractional part of our position to cg... bool doSubPosition = SkToBool(fRec.fFlags & kSubpixelPositioning_Flag); CGContextSetAllowsFontSubpixelPositioning(cgContext, doSubPosition); @@ -956,6 +961,14 @@ SkFontID SkFontHost::NextLogicalFont(SkFontID currFontID, SkFontID origFontID) { } void SkFontHost::FilterRec(SkScalerContext::Rec* rec) { + unsigned flagsWeDontSupport = SkScalerContext::kDevKernText_Flag | + SkScalerContext::kAutohinting_Flag; +#ifndef SK_SUPPORT_MAC_FONT_SUBPIXEL + flagsWeDontSupport |= SkScalerContext::kSubpixelPositioning_Flag; +#endif + + rec->fFlags &= ~flagsWeDontSupport; + // we only support 2 levels of hinting SkPaint::Hinting h = rec->getHinting(); if (SkPaint::kSlight_Hinting == h) { -- 2.7.4