⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 195403 in webkit


Ignore:
Timestamp:
Jan 20, 2016, 11:58:28 PM (11 years ago)
Author:
bshafiei@apple.com
Message:

Merged r188377. rdar://problem/24208102

Location:
branches/safari-601-branch
Files:
6 edited
2 copied

Legend:

Unmodified
Added
Removed
  • branches/safari-601-branch/LayoutTests/ChangeLog

    r195402 r195403  
     12016-01-20  Babak Shafiei  <bshafiei@apple.com>
     2
     3        Merge r188377.
     4
     5    2015-08-12  Myles C. Maxfield  <mmaxfield@apple.com>
     6
     7            [Cocoa] [CJK-configured device] System font has vertical punctuation
     8            https://bugs.webkit.org/show_bug.cgi?id=147964
     9            <rdar://problem/22256660>
     10
     11            Reviewed by Dean Jackson.
     12
     13            Make sure punctuation isn't vertical.
     14
     15            * fast/text/system-font-punctuation.html: Added.
     16            * platform/ios-simulator/fast/text/system-font-punctuation-expected.txt: Added
     17            * platform/mac/fast/text/system-font-punctuation-expected.txt: Added
     18
    1192016-01-20  Babak Shafiei  <bshafiei@apple.com>
    220
  • branches/safari-601-branch/Source/WebCore/ChangeLog

    r195402 r195403  
     12016-01-20  Babak Shafiei  <bshafiei@apple.com>
     2
     3        Merge r188377.
     4
     5    2015-08-12  Myles C. Maxfield  <mmaxfield@apple.com>
     6
     7            [Cocoa] [CJK-configured device] System font has vertical punctuation
     8            https://bugs.webkit.org/show_bug.cgi?id=147964
     9            <rdar://problem/22256660>
     10
     11            Reviewed by Dean Jackson.
     12
     13            GlyphPage::fill() has multiple code paths to accomplish its goal. It uses the shouldUseCoreText() helper
     14            function to determine which one of the paths should be taken. However, not all of the code paths in
     15            GlyphPage::fill() are able of handling all situations. Indeed, the CoreText code paths in GlyphPage::fill()
     16            are only able to handle the situations which shouldUseCoreText() returns true for. This happens in the
     17            following cases:
     18
     19            1. If the font is a composite font
     20            2. If the font is used for text-combine
     21            3. If the font has vertical glyphs
     22
     23            In r187693, I added one more case to this list: If the font is the system font. However, I failed to add
     24            the necessary support to GlyphPage::fill() for this case. Becasue of this, we just happened to fall into
     25            the case of vertical fonts (just by coincidence), which causes us to use
     26            CTFontGetVerticalGlyphsForCharacters() instead of CTFontGetGlyphsForCharacters().
     27
     28            The solution is to adopt the same behavior we were using before r187693. Back then, we were using
     29            CGFontGetGlyphsForUnichars(), which always returned horizontal glyphs. We should simply adopt this same
     30            behavior, except in the Core Text case. Therefore, this patch is just a simple check to see if we are
     31            using the system font when determining which Core Text function to use.
     32
     33            Test: fast/text/system-font-punctuation.html
     34
     35            * platform/graphics/FontDescription.h:
     36            (WebCore::FontDescription::setWidthVariant):
     37            * platform/graphics/FontPlatformData.h:
     38            (WebCore::FontPlatformData::isForTextCombine):
     39            * platform/graphics/mac/GlyphPageMac.cpp:
     40            (WebCore::shouldUseCoreText):
     41            (WebCore::GlyphPage::fill):
     42            * rendering/RenderCombineText.cpp:
     43            (WebCore::RenderCombineText::combineText):
     44
    1452016-01-20  Babak Shafiei  <bshafiei@apple.com>
    246
  • branches/safari-601-branch/Source/WebCore/platform/graphics/FontDescription.h

    r194287 r195403  
    178178    void setOrientation(FontOrientation orientation) { m_orientation = orientation; }
    179179    void setNonCJKGlyphOrientation(NonCJKGlyphOrientation orientation) { m_nonCJKGlyphOrientation = orientation; }
    180     void setWidthVariant(FontWidthVariant widthVariant) { m_widthVariant = widthVariant; }
     180    void setWidthVariant(FontWidthVariant widthVariant) { m_widthVariant = widthVariant; } // Make sure new callers of this sync with FontPlatformData::isForTextCombine()!
    181181    void setScript(UScriptCode s) { m_script = s; }
    182182    void setFeatureSettings(FontFeatureSettings&& settings) { m_featureSettings = WTF::move(settings); }
  • branches/safari-601-branch/Source/WebCore/platform/graphics/FontPlatformData.h

    r193671 r195403  
    136136    FontOrientation orientation() const { return m_orientation; }
    137137    FontWidthVariant widthVariant() const { return m_widthVariant; }
     138    bool isForTextCombine() const { return widthVariant() != RegularWidth; } // Keep in sync with callers of FontDescription::setWidthVariant().
    138139
    139140    void setOrientation(FontOrientation orientation) { m_orientation = orientation; }
  • branches/safari-601-branch/Source/WebCore/platform/graphics/mac/GlyphPageMac.cpp

    r195402 r195403  
    4343static bool shouldUseCoreText(const UChar* buffer, unsigned bufferLength, const Font* fontData)
    4444{
     45    // This needs to be kept in sync with GlyphPage::fill(). Currently, the CoreText paths are not able to handle
     46    // every situtation. Returning true from this function in a new situation will require you to explicitly add
     47    // handling for that situation in the CoreText paths of GlyphPage::fill().
    4548    if (fontData->platformData().isCompositeFontReference() || fontData->isSystemFont())
    4649        return true;
    47     if (fontData->platformData().widthVariant() != RegularWidth || fontData->hasVerticalGlyphs()) {
     50    if (fontData->platformData().isForTextCombine() || fontData->hasVerticalGlyphs()) {
    4851        // Ideographs don't have a vertical variant or width variants.
    4952        for (unsigned i = 0; i < bufferLength; ++i) {
     
    8992        }
    9093    } else if (!fontData->platformData().isCompositeFontReference()) {
    91         if (fontData->platformData().widthVariant() == RegularWidth)
     94        // Because we know the implementation of shouldUseCoreText(), if the font isn't for text combine and it isn't a system font,
     95        // we know it must have vertical glyphs.
     96        if (fontData->platformData().isForTextCombine() || fontData->isSystemFont())
     97            CTFontGetGlyphsForCharacters(fontData->platformData().ctFont(), buffer, glyphs.data(), bufferLength);
     98        else
    9299            CTFontGetVerticalGlyphsForCharacters(fontData->platformData().ctFont(), buffer, glyphs.data(), bufferLength);
    93         else
    94             CTFontGetGlyphsForCharacters(fontData->platformData().ctFont(), buffer, glyphs.data(), bufferLength);
    95100        // When buffer consists of surrogate pairs, CTFontGetVerticalGlyphsForCharacters and CTFontGetGlyphsForCharacters
    96101        // place the glyphs at indices corresponding to the first character of each pair.
  • branches/safari-601-branch/Source/WebCore/rendering/RenderCombineText.cpp

    r182609 r195403  
    118118        static const FontWidthVariant widthVariants[] = { HalfWidth, ThirdWidth, QuarterWidth };
    119119        for (size_t i = 0 ; i < WTF_ARRAY_LENGTH(widthVariants) ; ++i) {
    120             description.setWidthVariant(widthVariants[i]);
     120            description.setWidthVariant(widthVariants[i]); // When modifying this, make sure to keep it in sync with FontPlatformData::isForTextCombine()!
    121121
    122122            FontCascade compressedFont(description, style().fontCascade().letterSpacing(), style().fontCascade().wordSpacing());
Note: See TracChangeset for help on using the changeset viewer.