Fix mirroring with SVG fonts
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 2 Feb 2012 14:27:10 +0000 (14:27 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 2 Feb 2012 14:27:10 +0000 (14:27 +0000)
commit809923272975601b51a577580b260ea2e141253d
tree3c62a3ee59d44d2a8b26d8a702a08c95e11916fa
parentba15fa2c272a73a80a675bdd9f0f9cf4983da9a0
Fix mirroring with SVG fonts
https://bugs.webkit.org/show_bug.cgi?id=77067

Patch by Philip Rogers <pdr@google.com> on 2012-02-02
Reviewed by Nikolas Zimmermann.

Source/WebCore:

SVG fonts were incorrectly handling mirrored characters in bidi text.
In this change I added the function createStringWithMirroredCharacters
which handles mirroring the characters when selecting glyphs for SVG
fonts. I also made a small cosmetic change in the function
charactersWithArabicForm, changing the bool parameter "mirror" to "rtl"
which better reflects what it actually does.

Several new tests were added to test mirroring with SVG fonts in the
presence of Arabic forms and non-BMP characters.

Tests: svg/custom/glyph-selection-arabic-forms.svg
       svg/custom/glyph-selection-bidi-mirror.svg
       svg/custom/glyph-selection-non-bmp.svg

* platform/graphics/SVGGlyph.cpp:
(WebCore::charactersWithArabicForm):
* svg/SVGFontData.cpp:
(WebCore::SVGFontData::applySVGGlyphSelection):
(WebCore::SVGFontData::createStringWithMirroredCharacters):
* svg/SVGFontData.h:
(SVGFontData):

LayoutTests:

SVG fonts were incorrectly handling mirrored characters in bidi text.
In this change I added the function createStringWithMirroredCharacters
which handles mirroring the characters when selecting glyphs for SVG
fonts. I also made a small cosmetic change in the function
charactersWithArabicForm, changing the bool parameter "mirror" to "rtl"
which better reflects what it actually does.

Several new tests were added to test mirroring with SVG fonts in the
presence of Arabic forms and non-BMP characters.

* svg/custom/glyph-selection-arabic-forms-expected.txt: Added.
* svg/custom/glyph-selection-arabic-forms.svg: Added.
* svg/custom/glyph-selection-bidi-mirror-expected.txt: Added.
* svg/custom/glyph-selection-bidi-mirror.svg: Added.
* svg/custom/glyph-selection-non-bmp-expected.txt: Added.
* svg/custom/glyph-selection-non-bmp.svg: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@106551 268f45cc-cd09-0410-ab3c-d52691b4dbfc
14 files changed:
LayoutTests/ChangeLog
LayoutTests/svg/custom/glyph-selection-arabic-forms-expected.png [new file with mode: 0644]
LayoutTests/svg/custom/glyph-selection-arabic-forms-expected.txt [new file with mode: 0644]
LayoutTests/svg/custom/glyph-selection-arabic-forms.svg [new file with mode: 0644]
LayoutTests/svg/custom/glyph-selection-bidi-mirror-expected.png [new file with mode: 0644]
LayoutTests/svg/custom/glyph-selection-bidi-mirror-expected.txt [new file with mode: 0644]
LayoutTests/svg/custom/glyph-selection-bidi-mirror.svg [new file with mode: 0644]
LayoutTests/svg/custom/glyph-selection-non-bmp-expected.png [new file with mode: 0644]
LayoutTests/svg/custom/glyph-selection-non-bmp-expected.txt [new file with mode: 0644]
LayoutTests/svg/custom/glyph-selection-non-bmp.svg [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/SVGGlyph.cpp
Source/WebCore/svg/SVGFontData.cpp
Source/WebCore/svg/SVGFontData.h