Title: [104578] trunk/Source/WebCore
Revision
104578
Author
[email protected]
Date
2012-01-10 08:03:44 -0800 (Tue, 10 Jan 2012)

Log Message

[Chromium] Use SkFontHost::GetUnitsPerEm instead of advanced type
metrics for Android in FontPlatformData
https://bugs.webkit.org/show_bug.cgi?id=75702

Reviewed by Stephen White.

Since Skia for Android doesn't implement advanced type metric routines,
use an alternative method to calculate the number of font units for an
em size. This will be exercized by existing layout tests, as it's being
used by the ComplexTextController.

* platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.cpp:
(WebCore::FontPlatformData::emSizeInFontUnits):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (104577 => 104578)


--- trunk/Source/WebCore/ChangeLog	2012-01-10 15:59:16 UTC (rev 104577)
+++ trunk/Source/WebCore/ChangeLog	2012-01-10 16:03:44 UTC (rev 104578)
@@ -1,3 +1,19 @@
+2012-01-10  Peter Beverloo  <[email protected]>
+
+        [Chromium] Use SkFontHost::GetUnitsPerEm instead of advanced type
+        metrics for Android in FontPlatformData
+        https://bugs.webkit.org/show_bug.cgi?id=75702
+
+        Reviewed by Stephen White.
+
+        Since Skia for Android doesn't implement advanced type metric routines,
+        use an alternative method to calculate the number of font units for an
+        em size. This will be exercized by existing layout tests, as it's being
+        used by the ComplexTextController.
+
+        * platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.cpp:
+        (WebCore::FontPlatformData::emSizeInFontUnits):
+
 2012-01-10  Vsevolod Vlasov  <[email protected]>
 
         Unreviewed, inspector style fix.

Modified: trunk/Source/WebCore/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.cpp (104577 => 104578)


--- trunk/Source/WebCore/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.cpp	2012-01-10 15:59:16 UTC (rev 104577)
+++ trunk/Source/WebCore/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.cpp	2012-01-10 16:03:44 UTC (rev 104578)
@@ -36,6 +36,7 @@
 #include "PlatformSupport.h"
 
 #include "SkAdvancedTypefaceMetrics.h"
+#include "SkFontHost.h"
 #include "SkPaint.h"
 #include "SkTypeface.h"
 
@@ -116,9 +117,17 @@
     if (m_emSizeInFontUnits)
         return m_emSizeInFontUnits;
 
+    // FIXME: Switch to the SkTypeface::GetUnitsPerEm API once this becomes available.
+    // https://bugs.webkit.org/show_bug.cgi?id=75961
+#if OS(ANDROID)
+    // Android doesn't currently support Skia's getAdvancedTypefaceMetrics(),
+    // but it has access to another method to replace this functionality.
+    m_emSizeInFontUnits = SkFontHost::GetUnitsPerEm(m_typeface->uniqueID());
+#else
     SkAdvancedTypefaceMetrics* metrics = m_typeface->getAdvancedTypefaceMetrics(SkAdvancedTypefaceMetrics::kNo_PerGlyphInfo);
     m_emSizeInFontUnits = metrics->fEmSize;
     metrics->unref();
+#endif
     return m_emSizeInFontUnits;
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to