Changeset 102915 in webkit
- Timestamp:
- Dec 15, 2011 3:57:05 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
- Property svn:executable deleted
r102913 r102915 1 2011-12-15 Kenichi Ishibashi <bashi@chromium.org> 2 3 Supports Unicode variation selector 4 https://bugs.webkit.org/show_bug.cgi?id=50999 5 6 Reviewed by Nikolas Zimmermann. 7 8 Add test for unicode variation selector support. 9 A tiny font (gw432047.ttf), which comes from glyphwiki.org and is used by Mozilla, is added for the test. 10 11 * fast/text/resources/gw432047-license.txt: Added. 12 * fast/text/resources/gw432047.ttf: Added. 13 * fast/text/unicode-variation-selector.html: Added. 14 * platform/chromium/test_expectations.txt: Added fast/text/unicode-variation-selector.html. This test need rebaseline. 15 1 16 2011-12-15 Alexander Pavlov <apavlov@chromium.org> 2 17 -
trunk/LayoutTests/platform/chromium/test_expectations.txt
r102896 r102915 4008 4008 4009 4009 BUGWK74555 : fast/images/move-image-to-new-document.html = TEXT TIMEOUT 4010 4011 // Need rebaseline on Mac. 4012 BUGWK50999 : fast/text/unicode-variation-selector.html = MISSING FAIL -
trunk/Source/WebCore/ChangeLog
- Property svn:executable deleted
r102913 r102915 1 2011-12-15 Kenichi Ishibashi <bashi@chromium.org> 2 3 Supports Unicode variation selector 4 https://bugs.webkit.org/show_bug.cgi?id=50999 5 6 Reviewed by Nikolas Zimmermann. 7 8 Adds SimpleFontData::updateGlyphWithVariationSelector() which substitutes the 9 glyph in question based on the selector. WidthIterator::advance() calls it 10 when an unicode variation selector follows the character. 11 12 Test: fast/text/unicode-variation-selector.html 13 14 * platform/graphics/SimpleFontData.h: Added updateGlyphWithVariationSelector(). 15 * platform/graphics/SurrogatePairAwareTextIterator.cpp: 16 (WebCore::isUnicodeBMPVariationSelector): Added. 17 (WebCore::isUnicodeSupplementaryVariationSelector): Added. 18 (WebCore::SurrogatePairAwareTextIterator::hasTrailingVariationSelector): Added. 19 * platform/graphics/SurrogatePairAwareTextIterator.h: 20 * platform/graphics/WidthIterator.cpp: 21 (WebCore::WidthIterator::advance): Changed to detect variation selectors. 22 * platform/graphics/chromium/SimpleFontDataChromiumWin.cpp: 23 (WebCore::SimpleFontData::updateGlyphWithVariationSelector): Added. 24 * platform/graphics/chromium/SimpleFontDataLinux.cpp: 25 (WebCore::SimpleFontData::updateGlyphWithVariationSelector): Ditto. 26 * platform/graphics/freetype/SimpleFontDataFreeType.cpp: 27 (WebCore::SimpleFontData::updateGlyphWithVariationSelector): Ditto. 28 * platform/graphics/mac/SimpleFontDataMac.mm: 29 (WebCore::decomposeToUTF16): Ditto. 30 (WebCore::SimpleFontData::updateGlyphWithVariationSelector): Ditto. 31 * platform/graphics/pango/SimpleFontDataPango.cpp: 32 (WebCore::SimpleFontData::updateGlyphWithVariationSelector): Ditto. 33 * platform/graphics/qt/SimpleFontDataQt.cpp: 34 (WebCore::SimpleFontData::updateGlyphWithVariationSelector): Ditto. 35 * platform/graphics/win/SimpleFontDataWin.cpp: 36 (WebCore::SimpleFontData::updateGlyphWithVariationSelector): Ditto. 37 * platform/graphics/wince/SimpleFontDataWinCE.cpp: 38 (WebCore::SimpleFontData::updateGlyphWithVariationSelector): Ditto. 39 * platform/graphics/wx/SimpleFontDataWx.cpp: 40 (WebCore::SimpleFontData::updateGlyphWithVariationSelector): Ditto. 41 1 42 2011-12-15 Alexander Pavlov <apavlov@chromium.org> 2 43 -
trunk/Source/WebCore/platform/graphics/SimpleFontData.h
r101554 r102915 159 159 const GlyphData& missingGlyphData() const { return m_missingGlyphData; } 160 160 void setMissingGlyphData(const GlyphData& glyphData) { m_missingGlyphData = glyphData; } 161 void updateGlyphWithVariationSelector(UChar32 character, UChar32 selector, Glyph&) const; 161 162 162 163 #ifndef NDEBUG -
trunk/Source/WebCore/platform/graphics/SurrogatePairAwareTextIterator.cpp
r89690 r102915 32 32 33 33 namespace WebCore { 34 35 inline static bool isUnicodeBMPVariationSelector(UChar character) 36 { 37 return (0x180B <= character && character <= 0x180D) || (0xFE00 <= character && character <= 0xFE0F); 38 } 39 40 inline static bool isUnicodeSupplementaryVariationSelector(UChar lead, UChar trail) 41 { 42 // A non-BMP variation selector character is in the range of U+E0100 to U+E01EF. 43 // It can be a surrogate pair in which the high surrogate is 0xDB40 and 44 // the low surrogate is in the range of U16_TRAIL(0xE0100 - 0x10000) to U16_TRAIL(0xE01EF - 0x10000). 45 static const UChar trailStart = U16_TRAIL(0xE0100 - 0x10000); 46 static const UChar trailEnd = U16_TRAIL(0xE01EF - 0x10000); 47 return lead == 0xDB40 && trailStart <= trail && trail <= trailEnd; 48 } 34 49 35 50 SurrogatePairAwareTextIterator::SurrogatePairAwareTextIterator(const UChar* characters, int currentCharacter, int lastCharacter, int endCharacter) … … 84 99 } 85 100 101 bool SurrogatePairAwareTextIterator::hasTrailingVariationSelector(UChar32& selector, unsigned& clusterLength) 102 { 103 if (static_cast<int>(m_currentCharacter + clusterLength) < m_endCharacter && isUnicodeBMPVariationSelector(m_characters[clusterLength])) { 104 selector = m_characters[clusterLength]; 105 clusterLength += 1; 106 return true; 107 } 108 if (static_cast<int>(m_currentCharacter + clusterLength + 1) < m_endCharacter && isUnicodeSupplementaryVariationSelector(m_characters[clusterLength], m_characters[clusterLength + 1])) { 109 selector = U16_GET_SUPPLEMENTARY(m_characters[clusterLength], m_characters[clusterLength + 1]); 110 clusterLength += 2; 111 return true; 112 } 113 return false; 114 } 115 86 116 void SurrogatePairAwareTextIterator::advance(unsigned advanceLength) 87 117 { -
trunk/Source/WebCore/platform/graphics/SurrogatePairAwareTextIterator.h
r95901 r102915 33 33 34 34 bool consume(UChar32& character, unsigned& clusterLength); 35 bool hasTrailingVariationSelector(UChar32& selector, unsigned& clusterLength); 35 36 void advance(unsigned advanceLength); 36 37 -
trunk/Source/WebCore/platform/graphics/WidthIterator.cpp
r90798 r102915 115 115 116 116 ASSERT(fontData); 117 118 // If a variation selector follows, update glyph with the selector if possible. 119 UChar32 selector = 0; 120 if (textIterator.hasTrailingVariationSelector(selector, clusterLength)) { 121 fontData->updateGlyphWithVariationSelector(character, selector, glyph); 122 advanceLength = clusterLength; 123 } 117 124 118 125 // Now that we have a glyph and font data, get its width. -
trunk/Source/WebCore/platform/graphics/chromium/SimpleFontDataChromiumWin.cpp
r95901 r102915 200 200 } 201 201 202 void SimpleFontData::updateGlyphWithVariationSelector(UChar32 character, UChar32 selector, Glyph& glyph) const 203 { 204 // FIXME: Implement. 205 } 206 202 207 } // namespace WebCore -
trunk/Source/WebCore/platform/graphics/chromium/SimpleFontDataLinux.cpp
r95901 r102915 238 238 } 239 239 240 void SimpleFontData::updateGlyphWithVariationSelector(UChar32 character, UChar32 selector, Glyph& glyph) const 241 { 242 // FIXME: Implement. 243 } 244 240 245 } // namespace WebCore -
trunk/Source/WebCore/platform/graphics/freetype/SimpleFontDataFreeType.cpp
r101343 r102915 163 163 } 164 164 165 void SimpleFontData::updateGlyphWithVariationSelector(UChar32 character, UChar32 selector, Glyph& glyph) const 166 { 167 // FIXME: Implement. 165 168 } 169 170 } -
trunk/Source/WebCore/platform/graphics/mac/SimpleFontDataMac.mm
r98774 r102915 468 468 } 469 469 470 static inline void decomposeToUTF16(UChar* buffer, unsigned& length, const UChar32 character) 471 { 472 if (U_IS_BMP(character)) { 473 buffer[length] = character; 474 ++length; 475 return; 476 } 477 478 buffer[length] = U16_LEAD(character); 479 buffer[length + 1] = U16_TRAIL(character); 480 length += 2; 481 } 482 483 void SimpleFontData::updateGlyphWithVariationSelector(UChar32 character, UChar32 selector, Glyph& glyph) const 484 { 485 unsigned length = 0; 486 UChar buffer[4]; 487 488 decomposeToUTF16(buffer, length, character); 489 decomposeToUTF16(buffer, length, selector); 490 ASSERT(length <= 4); 491 492 CGGlyph glyphs[4]; 493 wkGetGlyphsForCharacters(platformData().cgFont(), buffer, glyphs, length); 494 if (glyphs[0]) 495 glyph = glyphs[0]; 496 } 497 470 498 } // namespace WebCore -
trunk/Source/WebCore/platform/graphics/pango/SimpleFontDataPango.cpp
r95901 r102915 161 161 } 162 162 163 void SimpleFontData::updateGlyphWithVariationSelector(UChar32 character, UChar32 selector, Glyph& glyph) const 164 { 165 // FIXME: Implement. 163 166 } 167 168 } -
trunk/Source/WebCore/platform/graphics/qt/SimpleFontDataQt.cpp
r89733 r102915 190 190 } 191 191 192 void SimpleFontData::updateGlyphWithVariationSelector(UChar32 character, UChar32 selector, Glyph& glyph) const 193 { 194 // FIXME: Implement. 192 195 } 196 197 } -
trunk/Source/WebCore/platform/graphics/win/SimpleFontDataWin.cpp
r101554 r102915 283 283 } 284 284 285 } 285 void SimpleFontData::updateGlyphWithVariationSelector(UChar32 character, UChar32 selector, Glyph& glyph) const 286 { 287 // FIXME: Implement. 288 } 289 290 } -
trunk/Source/WebCore/platform/graphics/wince/SimpleFontDataWinCE.cpp
r95901 r102915 181 181 } 182 182 183 void SimpleFontData::updateGlyphWithVariationSelector(UChar32 character, UChar32 selector, Glyph& glyph) const 184 { 185 // FIXME: Implement. 186 } 187 183 188 } // namespace WebCore -
trunk/Source/WebCore/platform/graphics/wx/SimpleFontDataWx.cpp
r86401 r102915 195 195 #endif 196 196 197 } 197 void SimpleFontData::updateGlyphWithVariationSelector(UChar32 character, UChar32 selector, Glyph& glyph) const 198 { 199 // FIXME: Implement. 200 } 201 202 }
Note: See TracChangeset
for help on using the changeset viewer.