Title: [87201] trunk/Source/WebCore
Revision
87201
Author
[email protected]
Date
2011-05-24 14:01:47 -0700 (Tue, 24 May 2011)

Log Message

Move code to discover if a CTFont has vertical glyphs out of SimpleFontData::platformInit()
https://bugs.webkit.org/show_bug.cgi?id=61392

Reviewed by Dave Hyatt.

* platform/graphics/mac/SimpleFontDataMac.mm:
(WebCore::fontHasVerticalGlyphs): Moved code here...
(WebCore::SimpleFontData::platformInit): ...from here.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (87200 => 87201)


--- trunk/Source/WebCore/ChangeLog	2011-05-24 20:59:54 UTC (rev 87200)
+++ trunk/Source/WebCore/ChangeLog	2011-05-24 21:01:47 UTC (rev 87201)
@@ -1,3 +1,14 @@
+2011-05-24  Dan Bernstein  <[email protected]>
+
+        Reviewed by Dave Hyatt.
+
+        Move code to discover if a CTFont has vertical glyphs out of SimpleFontData::platformInit()
+        https://bugs.webkit.org/show_bug.cgi?id=61392
+
+        * platform/graphics/mac/SimpleFontDataMac.mm:
+        (WebCore::fontHasVerticalGlyphs): Moved code here...
+        (WebCore::SimpleFontData::platformInit): ...from here.
+
 2011-05-24  Kenneth Russell  <[email protected]>
 
         Reviewed by James Robinson.

Modified: trunk/Source/WebCore/platform/graphics/mac/SimpleFontDataMac.mm (87200 => 87201)


--- trunk/Source/WebCore/platform/graphics/mac/SimpleFontDataMac.mm	2011-05-24 20:59:54 UTC (rev 87200)
+++ trunk/Source/WebCore/platform/graphics/mac/SimpleFontDataMac.mm	2011-05-24 21:01:47 UTC (rev 87201)
@@ -58,6 +58,19 @@
 const float smallCapsFontSizeMultiplier = 0.7f;
 static inline float scaleEmToUnits(float x, unsigned unitsPerEm) { return x / unitsPerEm; }
 
+static bool fontHasVerticalGlyphs(CTFontRef ctFont)
+{
+    // The check doesn't look neat but this is what AppKit does for vertical writing...
+    RetainPtr<CFArrayRef> tableTags(AdoptCF, CTFontCopyAvailableTables(ctFont, kCTFontTableOptionExcludeSynthetic));
+    CFIndex numTables = CFArrayGetCount(tableTags.get());
+    for (CFIndex index = 0; index < numTables; ++index) {
+        CTFontTableTag tag = (CTFontTableTag)(uintptr_t)CFArrayGetValueAtIndex(tableTags.get(), index);
+        if (tag == kCTFontTableVhea || tag == kCTFontTableVORG)
+            return true;
+    }
+    return false;
+}
+
 static bool initFontData(SimpleFontData* fontData)
 {
     if (!fontData->platformData().cgFont())
@@ -212,18 +225,8 @@
         descent = 3;
     }
     
-    if (platformData().orientation() == Vertical && !isTextOrientationFallback()) {
-        // The check doesn't look neat but this is what AppKit does for vertical writing...
-        RetainPtr<CFArrayRef> tableTags(AdoptCF, CTFontCopyAvailableTables(m_platformData.ctFont(), kCTFontTableOptionExcludeSynthetic));
-        CFIndex numTables = CFArrayGetCount(tableTags.get());
-        for (CFIndex index = 0; index < numTables; ++index) {
-            CTFontTableTag tag = (CTFontTableTag)(uintptr_t)CFArrayGetValueAtIndex(tableTags.get(), index);
-            if (tag == kCTFontTableVhea || tag == kCTFontTableVORG) {
-                m_hasVerticalGlyphs = true;
-                break;
-            }
-        }
-    }
+    if (platformData().orientation() == Vertical && !isTextOrientationFallback())
+        m_hasVerticalGlyphs = fontHasVerticalGlyphs(m_platformData.ctFont());
 
     float xHeight;
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to