Changeset 141122 in webkit
- Timestamp:
- Jan 29, 2013 9:25:34 AM (11 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r141119 r141122 1 2013-01-29 Martin Robinson <mrobinson@igalia.com> 2 3 [Freetype] Cannot use characters outside the BMP 4 https://bugs.webkit.org/show_bug.cgi?id=108102 5 6 Reviewed by Carlos Garcia Campos. 7 8 Added a pixel test for rendering non-BMP characters. 9 10 * platform/gtk/fonts/non-bmp-characters.html: Added. 11 * platform/gtk/platform/gtk/fonts/non-bmp-characters-expected.png: Added. 12 * platform/gtk/platform/gtk/fonts/non-bmp-characters-expected.txt: Added. 13 1 14 2013-01-29 Alexis Menard <alexis@webkit.org> 2 15 -
trunk/Source/WebCore/ChangeLog
r141121 r141122 1 2013-01-29 Martin Robinson <mrobinson@igalia.com> 2 3 [Freetype] Cannot use characters outside the BMP 4 https://bugs.webkit.org/show_bug.cgi?id=108102 5 6 Reviewed by Carlos Garcia Campos. 7 8 Test: platform/gtk/fonts/non-bmp-characters.html 9 10 Instead of never handling surrogate pairs when dealing with UChar arrays, 11 abstract way the logic for this into UTF16UChar32Iterator and use it 12 everywhere in Freetype. This allows the Freetype backend to render 13 non-BMP characters which are always represented as surrogate pairs in 14 UTF-16. 15 16 * GNUmakefile.list.am: Added UTF16UChar32Iterator to the source list. 17 * platform/graphics/freetype/FontCacheFreeType.cpp: 18 (WebCore::createFontConfigPatternForCharacters): Use the new iterator. 19 (WebCore::FontCache::getFontDataForCharacters): Ditto. 20 * platform/graphics/freetype/GlyphPageTreeNodeFreeType.cpp: 21 (WebCore::GlyphPage::fill): Ditto. Remove the early return when dealing 22 with non-BMP data. 23 * platform/graphics/freetype/SimpleFontDataFreeType.cpp: 24 (WebCore::SimpleFontData::containsCharacters): Use the new iterator. 25 * platform/graphics/freetype/UTF16UChar32Iterator.h: Added. An iterator that 26 extracts UChar32 from UTF-16 UChar arrays. 27 28 * GNUmakefile.list.am: 29 * platform/graphics/freetype/FontCacheFreeType.cpp: 30 (WebCore::createFontConfigPatternForCharacters): 31 (WebCore::FontCache::getFontDataForCharacters): 32 * platform/graphics/freetype/GlyphPageTreeNodeFreeType.cpp: 33 (WebCore::GlyphPage::fill): 34 * platform/graphics/freetype/SimpleFontDataFreeType.cpp: 35 (WebCore::SimpleFontData::containsCharacters): 36 * platform/graphics/freetype/UTF16UChar32Iterator.h: Added. 37 (WebCore): 38 (UTF16UChar32Iterator): 39 (WebCore::UTF16UChar32Iterator::UTF16UChar32Iterator): 40 (WebCore::UTF16UChar32Iterator::end): 41 (WebCore::UTF16UChar32Iterator::next): 42 43 * GNUmakefile.list.am: 44 * platform/graphics/freetype/FontCacheFreeType.cpp: 45 (WebCore::createFontConfigPatternForCharacters): 46 * platform/graphics/freetype/GlyphPageTreeNodeFreeType.cpp: 47 (WebCore::GlyphPage::fill): 48 * platform/graphics/freetype/SimpleFontDataFreeType.cpp: 49 (WebCore::SimpleFontData::containsCharacters): 50 * platform/graphics/freetype/UTF16UChar32Iterator.h: Added. 51 (WebCore): 52 (UTF16UChar32Iterator): 53 (WebCore::UTF16UChar32Iterator::UTF16UChar32Iterator): 54 (WebCore::UTF16UChar32Iterator::end): 55 (WebCore::UTF16UChar32Iterator::next): 56 1 57 2013-01-29 Glenn Hartmann <hartmanng@chromium.org> 2 58 -
trunk/Source/WebCore/GNUmakefile.list.am
r141063 r141122 4235 4235 Source/WebCore/platform/graphics/freetype/GlyphPageTreeNodeFreeType.cpp \ 4236 4236 Source/WebCore/platform/graphics/freetype/SimpleFontDataFreeType.cpp \ 4237 Source/WebCore/platform/graphics/freetype/UTF16UChar32Iterator.h \ 4237 4238 Source/WebCore/platform/graphics/harfbuzz/HarfBuzzShaperBase.cpp \ 4238 4239 Source/WebCore/platform/graphics/harfbuzz/HarfBuzzShaperBase.h \ -
trunk/Source/WebCore/platform/graphics/freetype/FontCacheFreeType.cpp
r130160 r141122 27 27 #include "RefPtrCairo.h" 28 28 #include "SimpleFontData.h" 29 #include "UTF16UChar32Iterator.h" 29 30 #include <cairo-ft.h> 30 31 #include <cairo.h> … … 42 43 } 43 44 44 FcPattern* createFontConfigPatternForCharacters(const UChar* characters, int length)45 FcPattern* createFontConfigPatternForCharacters(const UChar* characters, int bufferLength) 45 46 { 46 47 FcPattern* pattern = FcPatternCreate(); 47 48 48 FcCharSet* fontConfigCharSet = FcCharSetCreate(); 49 for (int i = 0; i < length; ++i) { 50 if (U16_IS_SURROGATE(characters[i]) && U16_IS_SURROGATE_LEAD(characters[i])51 && i != length - 1 && U16_IS_TRAIL(characters[i + 1])) {52 FcCharSetAddChar(fontConfigCharSet, U16_GET_SUPPLEMENTARY(characters[i], characters[i+1]));53 i++;54 } else55 FcCharSetAddChar(fontConfigCharSet, characters[i]);56 } 49 50 UTF16UChar32Iterator iterator(characters, bufferLength); 51 UChar32 character = iterator.next(); 52 while (character != iterator.end()) { 53 FcCharSetAddChar(fontConfigCharSet, character); 54 character = iterator.next(); 55 } 56 57 57 FcPatternAddCharSet(pattern, FC_CHARSET, fontConfigCharSet); 58 58 FcCharSetDestroy(fontConfigCharSet); -
trunk/Source/WebCore/platform/graphics/freetype/GlyphPageTreeNodeFreeType.cpp
r90041 r141122 33 33 34 34 #include "SimpleFontData.h" 35 #include "UTF16UChar32Iterator.h" 35 36 #include <cairo-ft.h> 36 37 #include <cairo.h> … … 41 42 bool GlyphPage::fill(unsigned offset, unsigned length, UChar* buffer, unsigned bufferLength, const SimpleFontData* fontData) 42 43 { 43 // The bufferLength will be greater than the glyph page size if the buffer has Unicode supplementary characters.44 // We won't support this for now.45 if (bufferLength > GlyphPage::size)46 return false;47 48 44 cairo_scaled_font_t* scaledFont = fontData->platformData().scaledFont(); 49 45 ASSERT(scaledFont); … … 54 50 55 51 bool haveGlyphs = false; 52 UTF16UChar32Iterator iterator(buffer, bufferLength); 56 53 for (unsigned i = 0; i < length; i++) { 57 Glyph glyph = FcFreeTypeCharIndex(face, buffer[i]); 54 UChar32 character = iterator.next(); 55 if (character == iterator.end()) 56 break; 57 58 Glyph glyph = FcFreeTypeCharIndex(face, character); 58 59 if (!glyph) 59 60 setGlyphDataForIndex(offset + i, 0, 0); -
trunk/Source/WebCore/platform/graphics/freetype/SimpleFontDataFreeType.cpp
r140111 r141122 40 40 #include "FontDescription.h" 41 41 #include "GlyphBuffer.h" 42 #include "UTF16UChar32Iterator.h" 42 43 #include <cairo-ft.h> 43 44 #include <cairo.h> … … 103 104 } 104 105 105 bool SimpleFontData::containsCharacters(const UChar* characters, int length) const106 bool SimpleFontData::containsCharacters(const UChar* characters, int bufferLength) const 106 107 { 107 108 ASSERT(m_platformData.scaledFont()); … … 110 111 return false; 111 112 112 for (int i = 0; i < length; i++) { 113 if (FcFreeTypeCharIndex(face, characters[i]) == 0) { 113 UTF16UChar32Iterator iterator(characters, bufferLength); 114 UChar32 character = iterator.next(); 115 while (character != iterator.end()) { 116 if (!FcFreeTypeCharIndex(face, character)) { 114 117 cairo_ft_scaled_font_unlock_face(m_platformData.scaledFont()); 115 118 return false; 116 119 } 120 character = iterator.next(); 117 121 } 118 122
Note: See TracChangeset
for help on using the changeset viewer.