Changeset 106551 in webkit
- Timestamp:
- Feb 2, 2012 6:27:10 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 9 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r106548 r106551 1 2012-02-02 Philip Rogers <pdr@google.com> 2 3 Fix mirroring with SVG fonts 4 https://bugs.webkit.org/show_bug.cgi?id=77067 5 6 Reviewed by Nikolas Zimmermann. 7 8 SVG fonts were incorrectly handling mirrored characters in bidi text. 9 In this change I added the function createStringWithMirroredCharacters 10 which handles mirroring the characters when selecting glyphs for SVG 11 fonts. I also made a small cosmetic change in the function 12 charactersWithArabicForm, changing the bool parameter "mirror" to "rtl" 13 which better reflects what it actually does. 14 15 Several new tests were added to test mirroring with SVG fonts in the 16 presence of Arabic forms and non-BMP characters. 17 18 * svg/custom/glyph-selection-arabic-forms-expected.txt: Added. 19 * svg/custom/glyph-selection-arabic-forms.svg: Added. 20 * svg/custom/glyph-selection-bidi-mirror-expected.txt: Added. 21 * svg/custom/glyph-selection-bidi-mirror.svg: Added. 22 * svg/custom/glyph-selection-non-bmp-expected.txt: Added. 23 * svg/custom/glyph-selection-non-bmp.svg: Added. 24 1 25 2012-02-02 Philippe Normand <pnormand@igalia.com> 2 26 -
trunk/Source/WebCore/ChangeLog
r106550 r106551 1 2012-02-02 Philip Rogers <pdr@google.com> 2 3 Fix mirroring with SVG fonts 4 https://bugs.webkit.org/show_bug.cgi?id=77067 5 6 Reviewed by Nikolas Zimmermann. 7 8 SVG fonts were incorrectly handling mirrored characters in bidi text. 9 In this change I added the function createStringWithMirroredCharacters 10 which handles mirroring the characters when selecting glyphs for SVG 11 fonts. I also made a small cosmetic change in the function 12 charactersWithArabicForm, changing the bool parameter "mirror" to "rtl" 13 which better reflects what it actually does. 14 15 Several new tests were added to test mirroring with SVG fonts in the 16 presence of Arabic forms and non-BMP characters. 17 18 Tests: svg/custom/glyph-selection-arabic-forms.svg 19 svg/custom/glyph-selection-bidi-mirror.svg 20 svg/custom/glyph-selection-non-bmp.svg 21 22 * platform/graphics/SVGGlyph.cpp: 23 (WebCore::charactersWithArabicForm): 24 * svg/SVGFontData.cpp: 25 (WebCore::SVGFontData::applySVGGlyphSelection): 26 (WebCore::SVGFontData::createStringWithMirroredCharacters): 27 * svg/SVGFontData.h: 28 (SVGFontData): 29 1 30 2012-02-02 Pavel Feldman <pfeldman@google.com> 2 31 -
trunk/Source/WebCore/platform/graphics/SVGGlyph.cpp
r84498 r106551 81 81 } 82 82 83 Vector<SVGGlyph::ArabicForm> charactersWithArabicForm(const String& input, bool mirror)83 Vector<SVGGlyph::ArabicForm> charactersWithArabicForm(const String& input, bool rtl) 84 84 { 85 85 Vector<SVGGlyph::ArabicForm> forms; … … 100 100 101 101 // Start identifying arabic forms 102 if ( mirror) {102 if (rtl) { 103 103 for (int i = length - 1; i >= 0; --i) 104 104 forms.prepend(processArabicFormDetection(input[i], lastCharShapesRight, forms.isEmpty() ? 0 : &forms.first())); -
trunk/Source/WebCore/svg/SVGFontData.cpp
r103155 r106551 32 32 #include "WidthIterator.h" 33 33 #include "XMLNames.h" 34 #include <wtf/text/StringBuilder.h> 35 #include <wtf/unicode/CharacterNames.h> 36 #include <wtf/unicode/Unicode.h> 37 38 using namespace WTF; 39 using namespace Unicode; 34 40 35 41 namespace WebCore { … … 131 137 String remainingTextInRun(run.data(currentCharacter), run.charactersLength() - currentCharacter); 132 138 remainingTextInRun = Font::normalizeSpaces(remainingTextInRun.characters(), remainingTextInRun.length()); 139 if (mirror) 140 remainingTextInRun = createStringWithMirroredCharacters(remainingTextInRun.characters(), remainingTextInRun.length()); 133 141 if (!currentCharacter && arabicForms.isEmpty()) 134 142 arabicForms = charactersWithArabicForm(remainingTextInRun, mirror); … … 261 269 } 262 270 271 String SVGFontData::createStringWithMirroredCharacters(const UChar* characters, unsigned length) const 272 { 273 StringBuilder mirroredCharacters; 274 mirroredCharacters.reserveCapacity(length); 275 276 UChar32 character; 277 unsigned i = 0; 278 while (i < length) { 279 U16_NEXT(characters, i, length, character); 280 character = mirroredChar(character); 281 282 if (U16_LENGTH(character) == 1) 283 mirroredCharacters.append(static_cast<UChar>(character)); 284 else { 285 mirroredCharacters.append(U16_LEAD(character)); 286 mirroredCharacters.append(U16_TRAIL(character)); 287 } 288 } 289 290 return mirroredCharacters.toString(); 291 } 263 292 264 293 } // namespace WebCore -
trunk/Source/WebCore/svg/SVGFontData.h
r95901 r106551 57 57 bool fillNonBMPGlyphs(SVGFontElement*, GlyphPage* , unsigned offset, unsigned length, UChar* buffer, const SimpleFontData*) const; 58 58 59 String createStringWithMirroredCharacters(const UChar* characters, unsigned length) const; 60 59 61 // Ths SVGFontFaceElement is kept alive -- 60 62 // 1) in the external font case: by the CSSFontFaceSource, which holds a reference to the external SVG document
Note: See TracChangeset
for help on using the changeset viewer.