Title: [189087] trunk/Source/WebCore
Revision
189087
Author
[email protected]
Date
2015-08-27 23:03:48 -0700 (Thu, 27 Aug 2015)

Log Message

[Cocoa] Draw fonts at their native sizes instead of scaling a 1pt font
https://bugs.webkit.org/show_bug.cgi?id=146045

Reviewed by Darin Adler.

In his WWDC talk[1], Antonio Cavedoni describes how painting a font at a particular point size
may yield different visual results than painting a font at a 1pt size into a scaled context.
However, this is something that we currently do in WebKit. This patch migrates from this
behavior to instead drawing text at the appropriate point size.

[1] https://developer.apple.com/videos/wwdc/2015/?id=804

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

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (189086 => 189087)


--- trunk/Source/WebCore/ChangeLog	2015-08-28 05:59:44 UTC (rev 189086)
+++ trunk/Source/WebCore/ChangeLog	2015-08-28 06:03:48 UTC (rev 189087)
@@ -1,3 +1,20 @@
+2015-08-27  Myles C. Maxfield  <[email protected]>
+
+        [Cocoa] Draw fonts at their native sizes instead of scaling a 1pt font
+        https://bugs.webkit.org/show_bug.cgi?id=146045
+
+        Reviewed by Darin Adler.
+
+        In his WWDC talk[1], Antonio Cavedoni describes how painting a font at a particular point size
+        may yield different visual results than painting a font at a 1pt size into a scaled context.
+        However, this is something that we currently do in WebKit. This patch migrates from this
+        behavior to instead drawing text at the appropriate point size.
+
+        [1] https://developer.apple.com/videos/wwdc/2015/?id=804
+
+        * platform/graphics/cocoa/FontCascadeCocoa.mm:
+        (WebCore::FontCascade::drawGlyphs):
+
 2015-08-27  Zalan Bujtas  <[email protected]>
 
         Tiny cleanup in RenderLayer::enclosingCompositingLayerForRepaint()

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


--- trunk/Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm	2015-08-28 05:59:44 UTC (rev 189086)
+++ trunk/Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm	2015-08-28 06:03:48 UTC (rev 189087)
@@ -322,13 +322,10 @@
     bool useLetterpressEffect = shouldUseLetterpressEffect(*context);
     FloatPoint point = anchorPoint;
 
-#if PLATFORM(IOS)
-    float fontSize = platformData.size();
-    CGAffineTransform matrix = useLetterpressEffect || platformData.isColorBitmapFont() ? CGAffineTransformIdentity : CGAffineTransformMakeScale(fontSize, fontSize);
-#else
     CGAffineTransform matrix = CGAffineTransformIdentity;
+#if !PLATFORM(IOS)
     if (drawFont && !platformData.isColorBitmapFont())
-        memcpy(&matrix, [drawFont matrix], sizeof(matrix));
+        matrix = CTFontGetMatrix(reinterpret_cast<CTFontRef>(drawFont));
 #endif
     matrix.b = -matrix.b;
     matrix.d = -matrix.d;
@@ -342,15 +339,11 @@
     CGContextSetTextMatrix(cgContext, matrix);
 
 #if PLATFORM(IOS)
-    CGContextSetFontSize(cgContext, 1);
     CGContextSetShouldSubpixelQuantizeFonts(cgContext, context->shouldSubpixelQuantizeFonts());
 #else
     setCGFontRenderingMode(cgContext, [drawFont renderingMode], context->shouldSubpixelQuantizeFonts());
-    if (drawFont)
-        CGContextSetFontSize(cgContext, 1);
-    else
-        CGContextSetFontSize(cgContext, platformData.m_size);
 #endif
+    CGContextSetFontSize(cgContext, platformData.size());
 
 
     FloatSize shadowOffset;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to