Title: [189180] trunk/Source/WebCore
Revision
189180
Author
mmaxfi...@apple.com
Date
2015-08-31 13:32:29 -0700 (Mon, 31 Aug 2015)

Log Message

[Cocoa] Unify showGlyphsWithAdvances
https://bugs.webkit.org/show_bug.cgi?id=148565

Reviewed by Dean Jackson.

None of the fonts created for WebKit have the renderingMode of
NSFontAntialiasedIntegerAdvancementsRenderingMode and are already printer fonts.

No new tests because there is no behavior change.

* platform/graphics/cocoa/FontCascadeCocoa.mm:
(WebCore::setCGFontRenderingMode):
(WebCore::FontCascade::drawGlyphs):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (189179 => 189180)


--- trunk/Source/WebCore/ChangeLog	2015-08-31 20:28:13 UTC (rev 189179)
+++ trunk/Source/WebCore/ChangeLog	2015-08-31 20:32:29 UTC (rev 189180)
@@ -1,3 +1,19 @@
+2015-08-31  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        [Cocoa] Unify showGlyphsWithAdvances
+        https://bugs.webkit.org/show_bug.cgi?id=148565
+
+        Reviewed by Dean Jackson.
+
+        None of the fonts created for WebKit have the renderingMode of
+        NSFontAntialiasedIntegerAdvancementsRenderingMode and are already printer fonts.
+
+        No new tests because there is no behavior change.
+
+        * platform/graphics/cocoa/FontCascadeCocoa.mm:
+        (WebCore::setCGFontRenderingMode):
+        (WebCore::FontCascade::drawGlyphs):
+
 2015-08-31  Tim Horton  <timothy_hor...@apple.com>
 
         iOS WebKit2 find-in-page doesn't support multi-line results, is often blank

Modified: trunk/Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm (189179 => 189180)


--- trunk/Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm	2015-08-31 20:28:13 UTC (rev 189179)
+++ trunk/Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm	2015-08-31 20:32:29 UTC (rev 189180)
@@ -206,25 +206,19 @@
     }
 }
 
-#if PLATFORM(MAC)
-static void setCGFontRenderingMode(CGContextRef cgContext, NSFontRenderingMode renderingMode, BOOL shouldSubpixelQuantize)
+static void setCGFontRenderingMode(GraphicsContext& context)
 {
-    if (renderingMode == NSFontIntegerAdvancementsRenderingMode) {
-        CGContextSetShouldAntialiasFonts(cgContext, false);
-        return;
-    }
-
+    CGContextRef cgContext = context.platformContext();
     CGContextSetShouldAntialiasFonts(cgContext, true);
 
     CGAffineTransform contextTransform = CGContextGetCTM(cgContext);
-    BOOL isTranslationOrIntegralScale = WTF::isIntegral(contextTransform.a) && WTF::isIntegral(contextTransform.d) && contextTransform.b == 0.f && contextTransform.c == 0.f;
-    BOOL isRotated = ((contextTransform.b || contextTransform.c) && (contextTransform.a || contextTransform.d));
-    BOOL doSubpixelQuantization = isTranslationOrIntegralScale || (!isRotated && shouldSubpixelQuantize);
+    bool isTranslationOrIntegralScale = WTF::isIntegral(contextTransform.a) && WTF::isIntegral(contextTransform.d) && contextTransform.b == 0.f && contextTransform.c == 0.f;
+    bool isRotated = ((contextTransform.b || contextTransform.c) && (contextTransform.a || contextTransform.d));
+    bool doSubpixelQuantization = isTranslationOrIntegralScale || (!isRotated && context.shouldSubpixelQuantizeFonts());
 
-    CGContextSetShouldSubpixelPositionFonts(cgContext, renderingMode != NSFontAntialiasedIntegerAdvancementsRenderingMode || !isTranslationOrIntegralScale);
+    CGContextSetShouldSubpixelPositionFonts(cgContext, true);
     CGContextSetShouldSubpixelQuantizeFonts(cgContext, doSubpixelQuantization);
 }
-#endif
 
 #if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100
 static CGSize dilationSizeForTextColor(const Color& color)
@@ -313,20 +307,14 @@
 #endif
 #endif
 
-#if !PLATFORM(IOS)
-    NSFont* drawFont = [platformData.nsFont() printerFont];
-#endif
-    
     CGContextSetFont(cgContext, platformData.cgFont());
 
     bool useLetterpressEffect = shouldUseLetterpressEffect(context);
     FloatPoint point = anchorPoint;
 
     CGAffineTransform matrix = CGAffineTransformIdentity;
-#if !PLATFORM(IOS)
-    if (drawFont && !platformData.isColorBitmapFont())
-        matrix = CTFontGetMatrix(reinterpret_cast<CTFontRef>(drawFont));
-#endif
+    if (!platformData.isColorBitmapFont())
+        matrix = CTFontGetMatrix(platformData.font());
     matrix.b = -matrix.b;
     matrix.d = -matrix.d;
     if (platformData.m_syntheticOblique) {
@@ -338,11 +326,7 @@
     }
     CGContextSetTextMatrix(cgContext, matrix);
 
-#if PLATFORM(IOS)
-    CGContextSetShouldSubpixelQuantizeFonts(cgContext, context.shouldSubpixelQuantizeFonts());
-#else
-    setCGFontRenderingMode(cgContext, [drawFont renderingMode], context.shouldSubpixelQuantizeFonts());
-#endif
+    setCGFontRenderingMode(context);
     CGContextSetFontSize(cgContext, platformData.size());
 
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to