<rdar://problem/10288006> Emoji characters are too close to each other in small font...
authormitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 28 Oct 2011 21:41:43 +0000 (21:41 +0000)
committermitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 28 Oct 2011 21:41:43 +0000 (21:41 +0000)
Reviewed by Sam Weinig.

Source/WebCore:

* platform/graphics/mac/SimpleFontDataMac.mm:
(WebCore::SimpleFontData::platformWidthForGlyph): If the font is a color bitmap font, use
-[NSFont advancementForGlyph:] instead of wkGetGlyphTransformedAdvances().

LayoutTests:

* platform/mac/fast/css/font-family-pictograph-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@98765 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/platform/mac/fast/css/font-family-pictograph-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/mac/SimpleFontDataMac.mm

index b4f5dcaf9e934c58a83c8a49009650f52435318a..1a3695c720f956010e02b1718480544f6a5f0b16 100755 (executable)
@@ -1,3 +1,11 @@
+2011-10-28  Dan Bernstein  <mitz@apple.com>
+
+        <rdar://problem/10288006> Emoji characters are too close to each other in small font size
+
+        Reviewed by Sam Weinig.
+
+        * platform/mac/fast/css/font-family-pictograph-expected.txt:
+
 2011-10-28  Ken Buchanan <kenrb@chromium.org>
 
         Crash when splitting inline flows with generated floats
index d2b60b27980504141ba29f41e0f03cc3bba60efc..12977a704c23e9fcb39e2c8c1054962b824e3363 100644 (file)
@@ -4,5 +4,5 @@ layer at (0,0) size 800x600
   RenderBlock {HTML} at (0,0) size 800x600
     RenderBody {BODY} at (8,8) size 784x584
       RenderBlock {DIV} at (0,0) size 784x95
-        RenderText {#text} at (0,0) size 72x95
-          text run at (0,0) width 72: "\x{2665}"
+        RenderText {#text} at (0,0) size 73x95
+          text run at (0,0) width 73: "\x{2665}"
index b18b547ff00fae27341ddd888529b37021bf0746..34dfee85fe70c655d21d803d4f700805545e9854 100755 (executable)
@@ -1,3 +1,13 @@
+2011-10-28  Dan Bernstein  <mitz@apple.com>
+
+        <rdar://problem/10288006> Emoji characters are too close to each other in small font size
+
+        Reviewed by Sam Weinig.
+
+        * platform/graphics/mac/SimpleFontDataMac.mm:
+        (WebCore::SimpleFontData::platformWidthForGlyph): If the font is a color bitmap font, use
+        -[NSFont advancementForGlyph:] instead of wkGetGlyphTransformedAdvances().
+
 2011-10-28  Adam Barth  <abarth@webkit.org>
 
         Remove unused default constructor
index e71eccdd14628be55ba7e0b2e101424c52ed0199..3a458c3fc5d3722d98e684cdd70a7c7ef58275bc 100644 (file)
@@ -400,12 +400,16 @@ float SimpleFontData::platformWidthForGlyph(Glyph glyph) const
 {
     CGSize advance = CGSizeZero;
     if (platformData().orientation() == Horizontal || m_isBrokenIdeographFallback) {
-        NSFont* font = platformData().font();
-        float pointSize = platformData().m_size;
-        CGAffineTransform m = CGAffineTransformMakeScale(pointSize, pointSize);
-        if (!wkGetGlyphTransformedAdvances(platformData().cgFont(), font, &m, &glyph, &advance)) {
-            LOG_ERROR("Unable to cache glyph widths for %@ %f", [font displayName], pointSize);
-            advance.width = 0;
+        NSFont *font = platformData().font();
+        if (font && platformData().isColorBitmapFont())
+            advance = [font advancementForGlyph:glyph];
+        else {
+            float pointSize = platformData().m_size;
+            CGAffineTransform m = CGAffineTransformMakeScale(pointSize, pointSize);
+            if (!wkGetGlyphTransformedAdvances(platformData().cgFont(), font, &m, &glyph, &advance)) {
+                LOG_ERROR("Unable to cache glyph widths for %@ %f", [font displayName], pointSize);
+                advance.width = 0;
+            }
         }
     } else
         CTFontGetAdvancesForGlyphs(m_platformData.ctFont(), kCTFontVerticalOrientation, &glyph, &advance, 1);