Changeset 53958 in webkit
- Timestamp:
- Jan 27, 2010 4:16:53 PM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r53957 r53958 1 2010-01-27 Evan Martin <evan@chromium.org> 2 3 Reviewed by David Levin. 4 5 [chromium] complex text draws newlines as bells 6 https://bugs.webkit.org/show_bug.cgi?id=34186 7 8 Revert r45496 -- once we've got a glyph array, it is too late to normalize 9 because we could have had multiple codepoints combine into one glyph. The 10 Uniscribe code it mentions it's duplicating uses the log cluster map to fix 11 this. 12 13 Instead, we just normalize the input text if it contains any non-ascii-space 14 whitespace. 15 16 This fixes fast/text/international/hindi-whitespace, which currently has an 17 incorrect baseline containing a square box glyph. 18 19 * platform/graphics/chromium/FontLinux.cpp: 20 (WebCore::TextRunWalker::getTextRun): 21 (WebCore::TextRunWalker::getNormalizedTextRun): 22 * platform/graphics/chromium/HarfbuzzSkia.cpp: 23 (WebCore::stringToGlyphs): 24 1 25 2010-01-27 Alexey Proskuryakov <ap@apple.com> 2 26 -
trunk/WebCore/platform/graphics/chromium/FontLinux.cpp
r49994 r53958 313 313 const TextRun& getTextRun(const TextRun& originalRun) 314 314 { 315 // Convert the |originalRun| to NFC normalized form if combining diacritical marks 315 // Normalize the text run in two ways: 316 // 1) Convert the |originalRun| to NFC normalized form if combining diacritical marks 316 317 // (U+0300..) are used in the run. This conversion is necessary since most OpenType 317 318 // fonts (e.g., Arial) don't have substitution rules for the diacritical marks in … … 322 323 // normalization (e.g., Arabic text). Unless the run contains the diacritical marks, 323 324 // Harfbuzz will do the same thing for us using the GSUB table. 325 // 2) Convert spacing characters into plain spaces, as some fonts will provide glyphs 326 // for characters like '\n' otherwise. 324 327 for (unsigned i = 0; i < originalRun.length(); ++i) { 325 UBlockCode block = ::ublock_getCode(originalRun[i]); 326 if (block == UBLOCK_COMBINING_DIACRITICAL_MARKS) { 328 UChar ch = originalRun[i]; 329 UBlockCode block = ::ublock_getCode(ch); 330 if (block == UBLOCK_COMBINING_DIACRITICAL_MARKS || (Font::treatAsSpace(ch) && ch != ' ')) { 327 331 return getNormalizedTextRun(originalRun); 328 332 } … … 342 346 normalizedString.extract(m_normalizedBuffer.get(), normalizedString.length() + 1, error); 343 347 ASSERT(U_SUCCESS(error)); 348 349 for (unsigned i = 0; i < normalizedString.length(); ++i) { 350 if (Font::treatAsSpace(m_normalizedBuffer[i])) 351 m_normalizedBuffer[i] = ' '; 352 } 344 353 345 354 m_normalizedRun.set(new TextRun(originalRun)); -
trunk/WebCore/platform/graphics/chromium/HarfbuzzSkia.cpp
r45496 r53958 31 31 #include "config.h" 32 32 33 #include "Font.h"34 33 #include "FontPlatformData.h" 35 34 #include "wtf/OwnArrayPtr.h" … … 43 42 extern "C" { 44 43 #include "harfbuzz-shaper.h" 45 #include "harfbuzz-unicode.h"46 44 } 47 45 … … 68 66 // HB_Glyph is 32-bit, but Skia outputs only 16-bit numbers. So our 69 67 // |glyphs| array needs to be converted. 70 // Additionally, if the CSS white-space property is inhibiting line71 // breaking, we might find end-of-line charactors rendered via the complex72 // text path. Fonts don't provide glyphs for these code points so, if we73 // find one, we simulate the space glyph being interposed in this case.74 // Because the input is variable-length per code point, we walk the input75 // in step with the output.76 // FIXME: it seems that this logic is duplicated in CoreTextController and UniscribeController77 ssize_t indexOfNextCodePoint = 0;78 uint16_t spaceGlyphNumber = 0;79 68 for (int i = numGlyphs - 1; i >= 0; --i) { 80 const uint32_t currentCodePoint = utf16_to_code_point(characters, length, &indexOfNextCodePoint);81 82 69 uint16_t value; 83 70 // We use a memcpy to avoid breaking strict aliasing rules. 84 71 memcpy(&value, reinterpret_cast<char*>(glyphs) + sizeof(uint16_t) * i, sizeof(uint16_t)); 85 86 if (!value && Font::treatAsSpace(currentCodePoint)) {87 static const uint16_t spaceUTF16 = ' ';88 if (!spaceGlyphNumber)89 paint.textToGlyphs(&spaceUTF16, sizeof(spaceUTF16), &spaceGlyphNumber);90 value = spaceGlyphNumber;91 }92 93 72 glyphs[i] = value; 94 73 }
Note: See TracChangeset
for help on using the changeset viewer.