Changeset 79169 in webkit


Ignore:
Timestamp:
Feb 20, 2011 7:28:22 PM (13 years ago)
Author:
tkent@chromium.org
Message:

2011-02-20 Chun-Lung Huang <alvincl.huang@gmail.com>

Reviewed by Kent Tamura.

On Chromium Windows, glyphs in vertical text tests are rotated 90
degrees clockwise. https://bugs.webkit.org/show_bug.cgi?id=51450

This platform dependent patch makes Chromium Windows show the
vertical writing text correctly. Job was done by adding a prefix '@'
in front of the font family name (Windows Only). No new tests added.

  • platform/graphics/chromium/FontCacheChromiumWin.cpp: (WebCore::FontCache::createFontPlatformData):
  • platform/graphics/chromium/FontPlatformDataChromiumWin.cpp: (WebCore::FontPlatformData::FontPlatformData): (WebCore::FontPlatformData::operator=):
  • platform/graphics/chromium/FontPlatformDataChromiumWin.h: (WebCore::FontPlatformData::orientation):
  • platform/graphics/skia/FontCustomPlatformData.cpp: (WebCore::FontCustomPlatformData::fontPlatformData):
Location:
trunk/Source/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r79168 r79169  
     12011-02-20  Chun-Lung Huang  <alvincl.huang@gmail.com>
     2
     3        Reviewed by Kent Tamura.
     4
     5        On Chromium Windows, glyphs in vertical text tests are rotated 90
     6        degrees clockwise. https://bugs.webkit.org/show_bug.cgi?id=51450
     7
     8        This platform dependent patch makes Chromium Windows show the
     9        vertical writing text correctly. Job was done by adding a prefix '@'
     10        in front of the font family name (Windows Only). No new tests added.
     11
     12        * platform/graphics/chromium/FontCacheChromiumWin.cpp:
     13        (WebCore::FontCache::createFontPlatformData):
     14        * platform/graphics/chromium/FontPlatformDataChromiumWin.cpp:
     15        (WebCore::FontPlatformData::FontPlatformData):
     16        (WebCore::FontPlatformData::operator=):
     17        * platform/graphics/chromium/FontPlatformDataChromiumWin.h:
     18        (WebCore::FontPlatformData::orientation):
     19        * platform/graphics/skia/FontCustomPlatformData.cpp:
     20        (WebCore::FontCustomPlatformData::fontPlatformData):
     21
    1222011-02-20  Simon Fraser  <simon.fraser@apple.com>
    223
  • trunk/Source/WebCore/platform/graphics/chromium/FontCacheChromiumWin.cpp

    r76679 r79169  
    613613    FillLogFont(fontDescription, &winfont);
    614614
     615    // Take the orientation into consideration. For vertical: add "@" in front of the family name.
     616    // "@" is a built-in behaviour for Windows platform. http://msdn.microsoft.com/en-us/goglobal/bb688137
     617    // Try to create hfont with family name "@font-family-name".
     618    AtomicString updatedFamilyName;
     619    if (fontDescription.orientation() == Vertical && !family.startsWith("@") && !family.isEmpty())
     620        updatedFamilyName = "@" + String(family);
     621    else
     622        updatedFamilyName = family;
     623
    615624    // Windows will always give us a valid pointer here, even if the face name
    616625    // is non-existent.  We have to double-check and see if the family name was
    617626    // really used.
    618627    String winName;
    619     HFONT hfont = createFontIndirectAndGetWinName(family, &winfont, &winName);
     628    HFONT hfont = createFontIndirectAndGetWinName(updatedFamilyName, &winfont, &winName);
    620629    if (!hfont)
    621630        return 0;
     
    623632    // FIXME: Do we need to use predefined fonts "guaranteed" to exist
    624633    // when we're running in layout-test mode?
    625     if (!equalIgnoringCase(family, winName)) {
     634    if (!equalIgnoringCase(updatedFamilyName, winName)) {
    626635        // For CJK fonts with both English and native names,
    627636        // GetTextFace returns a native name under the font's "locale"
     
    631640        // compare it with what's requested in the first place.
    632641        String altName;
    633         if (!LookupAltName(family, altName) ||
    634             !equalIgnoringCase(altName, winName)) {
    635             DeleteObject(hfont);
    636             return 0;
     642        if (fontDescription.orientation() == Vertical) {
     643            if (!LookupAltName(family, altName) || !equalIgnoringCase("@" + altName, winName)) {
     644                DeleteObject(hfont);
     645                return 0;
     646            }
     647        } else {
     648            if (!LookupAltName(updatedFamilyName, altName) || !equalIgnoringCase(altName, winName)) {
     649                DeleteObject(hfont);
     650                return 0;
     651            }
    637652        }
    638653    }
    639654
    640     return new FontPlatformData(hfont,
    641                                 fontDescription.computedPixelSize());
    642 }
    643 
    644 }
     655    return new FontPlatformData(hfont, fontDescription.computedPixelSize(), fontDescription.orientation());
     656}
     657
     658}
  • trunk/Source/WebCore/platform/graphics/chromium/FontPlatformDataChromiumWin.cpp

    r76340 r79169  
    4747    , m_scriptCache(0)
    4848    , m_scriptFontProperties(0)
     49    , m_orientation(Horizontal)
    4950{
    5051}
     
    5556    , m_scriptCache(0)
    5657    , m_scriptFontProperties(0)
     58    , m_orientation(Horizontal)
    5759{
    5860}
    5961
    60 FontPlatformData::FontPlatformData(HFONT font, float size)
     62FontPlatformData::FontPlatformData(HFONT font, float size, FontOrientation orientation)
    6163    : m_font(RefCountedHFONT::create(font))
    6264    , m_size(size)
    6365    , m_scriptCache(0)
    6466    , m_scriptFontProperties(0)
     67    , m_orientation(orientation)
    6568{
    6669}
     
    7275    , m_scriptCache(0)
    7376    , m_scriptFontProperties(0)
     77    , m_orientation(Horizontal)
    7478{
    7579}
     
    8084    , m_scriptCache(0)
    8185    , m_scriptFontProperties(0)
     86    , m_orientation(Horizontal)
    8287{
    8388}
     
    8893        m_font = data.m_font;
    8994        m_size = data.m_size;
     95        m_orientation = data.m_orientation;
    9096
    9197        // The following fields will get re-computed if necessary.
  • trunk/Source/WebCore/platform/graphics/chromium/FontPlatformDataChromiumWin.h

    r71970 r79169  
    5858    FontPlatformData(WTF::HashTableDeletedValueType);
    5959    FontPlatformData();
    60     FontPlatformData(HFONT, float size);
     60    FontPlatformData(HFONT, float size, FontOrientation = Horizontal);
    6161    FontPlatformData(float size, bool bold, bool oblique);
    6262    FontPlatformData(const FontPlatformData&);
     
    7171    float size() const { return m_size; }
    7272
    73     FontOrientation orientation() const { return Horizontal; } // FIXME: Implement.
     73    FontOrientation orientation() const { return m_orientation; }
    7474
    7575    unsigned hash() const
     
    128128    RefPtr<RefCountedHFONT> m_font;
    129129    float m_size;  // Point size of the font in pixels.
     130    FontOrientation m_orientation;
    130131
    131132    mutable SCRIPT_CACHE m_scriptCache;
  • trunk/Source/WebCore/platform/graphics/skia/FontCustomPlatformData.cpp

    r77153 r79169  
    7979        return FontPlatformData();
    8080    }
    81     memcpy(logFont.lfFaceName, m_name.charactersWithNullTermination(),
    82            sizeof(logFont.lfFaceName[0]) * (1 + m_name.length()));
     81
     82    String newName;
     83    if (orientation == Vertical && !m_name.startsWith("@"))
     84        newName = "@" + m_name;
     85    else
     86        newName = m_name;
     87
     88    memcpy(logFont.lfFaceName, newName.charactersWithNullTermination(), sizeof(logFont.lfFaceName[0]) * (1 + newName.length()));
    8389
    8490    // FIXME: almost identical to FillLogFont in FontCacheWin.cpp.
     
    100106
    101107    HFONT hfont = CreateFontIndirect(&logFont);
    102     return FontPlatformData(hfont, size);
     108    return FontPlatformData(hfont, size, orientation);
    103109#elif OS(LINUX) || OS(FREEBSD) || PLATFORM(BREWMP)
    104110    ASSERT(m_fontReference);
Note: See TracChangeset for help on using the changeset viewer.