Changeset 87201 in webkit


Ignore:
Timestamp:
May 24, 2011 2:01:47 PM (13 years ago)
Author:
mitz@apple.com
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.

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r87197 r87201  
     12011-05-24  Dan Bernstein  <mitz@apple.com>
     2
     3        Reviewed by Dave Hyatt.
     4
     5        Move code to discover if a CTFont has vertical glyphs out of SimpleFontData::platformInit()
     6        https://bugs.webkit.org/show_bug.cgi?id=61392
     7
     8        * platform/graphics/mac/SimpleFontDataMac.mm:
     9        (WebCore::fontHasVerticalGlyphs): Moved code here...
     10        (WebCore::SimpleFontData::platformInit): ...from here.
     11
    1122011-05-24  Kenneth Russell  <kbr@google.com>
    213
  • trunk/Source/WebCore/platform/graphics/mac/SimpleFontDataMac.mm

    r86401 r87201  
    5858const float smallCapsFontSizeMultiplier = 0.7f;
    5959static inline float scaleEmToUnits(float x, unsigned unitsPerEm) { return x / unitsPerEm; }
     60
     61static bool fontHasVerticalGlyphs(CTFontRef ctFont)
     62{
     63    // The check doesn't look neat but this is what AppKit does for vertical writing...
     64    RetainPtr<CFArrayRef> tableTags(AdoptCF, CTFontCopyAvailableTables(ctFont, kCTFontTableOptionExcludeSynthetic));
     65    CFIndex numTables = CFArrayGetCount(tableTags.get());
     66    for (CFIndex index = 0; index < numTables; ++index) {
     67        CTFontTableTag tag = (CTFontTableTag)(uintptr_t)CFArrayGetValueAtIndex(tableTags.get(), index);
     68        if (tag == kCTFontTableVhea || tag == kCTFontTableVORG)
     69            return true;
     70    }
     71    return false;
     72}
    6073
    6174static bool initFontData(SimpleFontData* fontData)
     
    213226    }
    214227   
    215     if (platformData().orientation() == Vertical && !isTextOrientationFallback()) {
    216         // The check doesn't look neat but this is what AppKit does for vertical writing...
    217         RetainPtr<CFArrayRef> tableTags(AdoptCF, CTFontCopyAvailableTables(m_platformData.ctFont(), kCTFontTableOptionExcludeSynthetic));
    218         CFIndex numTables = CFArrayGetCount(tableTags.get());
    219         for (CFIndex index = 0; index < numTables; ++index) {
    220             CTFontTableTag tag = (CTFontTableTag)(uintptr_t)CFArrayGetValueAtIndex(tableTags.get(), index);
    221             if (tag == kCTFontTableVhea || tag == kCTFontTableVORG) {
    222                 m_hasVerticalGlyphs = true;
    223                 break;
    224             }
    225         }
    226     }
     228    if (platformData().orientation() == Vertical && !isTextOrientationFallback())
     229        m_hasVerticalGlyphs = fontHasVerticalGlyphs(m_platformData.ctFont());
    227230
    228231    float xHeight;
Note: See TracChangeset for help on using the changeset viewer.