[GTK] Glyphs in vertical text tests are rotated 90 degrees clockwise
authormario@webkit.org <mario@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 7 Nov 2013 15:18:43 +0000 (15:18 +0000)
committermario@webkit.org <mario@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 7 Nov 2013 15:18:43 +0000 (15:18 +0000)
commitcfc3199969dab7f5dda263f2859a962e177e22c5
tree01ed57e628e0599eae6a5ce2f2c889725414727f
parent8e16df74f51fcb98a5e1ff2c30b676ded875bbdf
[GTK] Glyphs in vertical text tests are rotated 90 degrees clockwise
https://bugs.webkit.org/show_bug.cgi?id=50619

Patch by Denis Nomiyama <d.nomiyama@samsung.com> on 2013-11-07
Reviewed by Martin Robinson.

Source/WebCore:

Implemented the OPENTYPE_VERTICAL feature for the GTK+ port. It resolves
the 90 degrees rotation problem of CJK characters when displaying
vertical text.

New tests are not required as the existing tests for vertical text will
work properly now.

* GNUmakefile.list.am: Added OpenTypeVerticalData.cpp and
OpenTypeVerticalData.h to platformgtk_sources.
* PlatformEfl.cmake: Added OpenTypeVerticalData.cpp.
* PlatformGTK.cmake: Added OpenTypeVerticalData.cpp.
* platform/graphics/FontCache.cpp: Originally the HashMap for
OpenTypeVerticalData was designed with FontFileKey as integer in the
Chromium port, which was an unique number provided by Skia. Since other
ports use FontFileKey as string, new generic hash functions had to be
implemented instead of using the specific ones for integers.
(WebCore::FontVerticalDataCacheKeyHash::hash): New hash function for
HashMap of OpenTypeVerticalData.
(WebCore::FontVerticalDataCacheKeyHash::equal): New function for
comparing hash indexes in the HashMap of OpenTypeVerticalData.
(WebCore::FontVerticalDataCacheKeyTraits::emptyValue): New function for
giving an empty FontFileKey.
(WebCore::FontVerticalDataCacheKeyTraits::constructDeletedValue): New
function to create a FontFileKey for deleted values.
(WebCore::FontVerticalDataCacheKeyTraits::isDeletedValue): New function
to check if a HashMap entry is available.
* platform/graphics/freetype/FontCustomPlatformDataFreeType.cpp:
(WebCore::FontCustomPlatformData::fontPlatformData): Added font
orientation as a parameter to the FontPlatformData constructor.
* platform/graphics/freetype/FontPlatformData.h: Added m_orientation to
store the font orientation and m_horizontalOrientationMatrix to store
the Cairo matrix for horizontal orientation, which can be restored in
setOrientation().
(WebCore::FontPlatformData::FontPlatformData): Added font orientation as
a parameter.
(WebCore::FontPlatformData::orientation): Implemented this function
based on m_orientation.
* platform/graphics/freetype/FontPlatformDataFreeType.cpp: Added new
helper function rotateCairoMatrixForVerticalOrientation() to rotate the
Cairo matrix in case of vertical orientation.
(WebCore::FontPlatformData::FontPlatformData): Initialized
m_orientation.
(WebCore::FontPlatformData::operator=): Added m_orientation and
m_horizontalOrientationMatrix to the assignment operator.
(WebCore::FontPlatformData::operator==): Added m_orientation to the
equal operator.
(WebCore::FontPlatformData::initializeWithFontFace): Rotated and
translated fonts if orientation is vertical. Also stored the horizontal
Cairo matrix.
(WebCore::FontPlatformData::verticalData): Returned the vertical data
from the font cache.
(WebCore::FontPlatformData::openTypeTable): Loaded the font table into
a shared buffer.
(WebCore::FontPlatformData::setOrientation): Replaced the scaled font
data by rotating fonts according to the new orientation.
* platform/graphics/freetype/SimpleFontDataFreeType.cpp:
(WebCore::SimpleFontData::platformInit): Set the glyph's height and
width according to the font orientation. It also sets EM.
(WebCore::SimpleFontData::platformCreateScaledFontData): Added
orientation to the FontPlatformData constructor.
(WebCore::SimpleFontData::platformWidthForGlyph): Returned the glyph's
width according the orientation.
* platform/graphics/harfbuzz/HarfBuzzFaceCairo.cpp:
(WebCore::CairoGetGlyphWidthAndExtents): Obtained the character advance
and extents according to the font orientation.

Source/Platform:

Added WebCore/platform/graphics/opentype to the include path.

* GNUmakefile.am:

Source/WTF:

Enabled OPENTYPE_VERTICAL by default on GTK+ and EFL ports, which are
currently using Freetype.

* wtf/Platform.h:

Source/WebKit:

Added WebCore/platform/graphics/opentype to the include path.

* PlatformEfl.cmake:

Source/WebKit2:

Added WebCore/platform/graphics/opentype to the include path.

* PlatformEfl.cmake:
* PlatformGTK.cmake:

LayoutTests:

Updated existing test results that uses vertical texts.

* platform/gtk-wk1/fast/writing-mode/Kusa-Makura-background-canvas-expected.png: Added.
* platform/gtk-wk1/fast/writing-mode/Kusa-Makura-background-canvas-expected.txt: Updated.
* platform/gtk/editing/selection/vertical-lr-ltr-extend-line-backward-br-expected.png: Updated.
* platform/gtk/editing/selection/vertical-lr-ltr-extend-line-backward-br-expected.txt: Updated.
* platform/gtk/editing/selection/vertical-lr-ltr-extend-line-forward-br-expected.png: Updated.
* platform/gtk/editing/selection/vertical-lr-ltr-extend-line-forward-br-expected.txt: Updated.
* platform/gtk/editing/selection/vertical-rl-ltr-extend-line-backward-br-expected.png: Updated.
* platform/gtk/editing/selection/vertical-rl-ltr-extend-line-backward-br-expected.txt: Updated.
* platform/gtk/editing/selection/vertical-rl-ltr-extend-line-backward-p-expected.png: Updated.
* platform/gtk/editing/selection/vertical-rl-ltr-extend-line-backward-p-expected.txt: Updated.
* platform/gtk/editing/selection/vertical-rl-ltr-extend-line-backward-wrap-expected.png: Updated.
* platform/gtk/editing/selection/vertical-rl-ltr-extend-line-backward-wrap-expected.txt: Updated.
* platform/gtk/editing/selection/vertical-rl-ltr-extend-line-forward-br-expected.png: Updated.
* platform/gtk/editing/selection/vertical-rl-ltr-extend-line-forward-br-expected.txt: Updated.
* platform/gtk/editing/selection/vertical-rl-ltr-extend-line-forward-p-expected.png: Updated.
* platform/gtk/editing/selection/vertical-rl-ltr-extend-line-forward-p-expected.txt: Updated.
* platform/gtk/editing/selection/vertical-rl-ltr-extend-line-forward-wrap-expected.png: Updated.
* platform/gtk/editing/selection/vertical-rl-ltr-extend-line-forward-wrap-expected.txt: Updated.
* platform/gtk/fast/block/lineboxcontain/block-with-ideographs-expected.png: Updated.
* platform/gtk/fast/block/lineboxcontain/block-with-ideographs-expected.txt: Updated.
* platform/gtk/fast/css/relative-positioned-block-with-inline-ancestor-and-parent-dynamic-expected.png: Updated.
* platform/gtk/fast/dynamic/text-combine-expected.png: Updated.
* platform/gtk/fast/dynamic/text-combine-expected.txt: Updated.
* platform/gtk/fast/html/details-writing-mode-expected.png: Updated.
* platform/gtk/fast/repaint/japanese-rl-selection-clear-expected.png: Updated.
* platform/gtk/fast/repaint/japanese-rl-selection-clear-expected.txt: Added.
* platform/gtk/fast/repaint/japanese-rl-selection-repaint-expected.png: Updated.
* platform/gtk/fast/repaint/japanese-rl-selection-repaint-expected.txt: Added.
* platform/gtk/fast/repaint/japanese-rl-selection-repaint-in-regions-expected.png: Updated.
* platform/gtk/fast/repaint/japanese-rl-selection-repaint-in-regions-expected.txt: Updated.
* platform/gtk/fast/repaint/repaint-across-writing-mode-boundary-expected.png: Updated.
* platform/gtk/fast/repaint/repaint-across-writing-mode-boundary-expected.txt: Updated.
* platform/gtk/fast/ruby/base-shorter-than-text-expected.png: Updated.
* platform/gtk/fast/ruby/base-shorter-than-text-expected.txt: Updated.
* platform/gtk/fast/text/decorations-with-text-combine-expected.png: Updated.
* platform/gtk/fast/text/decorations-with-text-combine-expected.txt: Updated.
* platform/gtk/fast/text/emphasis-combined-text-expected.png: Updated.
* platform/gtk/fast/text/emphasis-combined-text-expected.txt: Updated.
* platform/gtk/fast/text/emphasis-vertical-expected.png: Updated.
* platform/gtk/fast/text/emphasis-vertical-expected.txt: Updated.
* platform/gtk/fast/text/international/text-combine-image-test-expected.png: Updated.
* platform/gtk/fast/text/international/text-combine-image-test-expected.txt: Updated.
* platform/gtk/fast/text/international/text-spliced-font-expected.png: Updated.
* platform/gtk/fast/text/international/text-spliced-font-expected.txt: Updated.
* platform/gtk/fast/text/international/vertical-text-glyph-test-expected.png: Updated.
* platform/gtk/fast/text/international/vertical-text-glyph-test-expected.txt: Added.
* platform/gtk/fast/text/justify-ideograph-vertical-expected.png: Updated.
* platform/gtk/fast/text/justify-ideograph-vertical-expected.txt: Added.
* platform/gtk/fast/text/orientation-sideways-expected.png: Updated.
* platform/gtk/fast/text/orientation-sideways-expected.txt: Updated.
* platform/gtk/fast/writing-mode/Kusa-Makura-background-canvas-expected.png: Updated.
* platform/gtk/fast/writing-mode/Kusa-Makura-background-canvas-expected.txt: Updated.
* platform/gtk/fast/writing-mode/border-vertical-lr-expected.png: Updated.
* platform/gtk/fast/writing-mode/border-vertical-lr-expected.txt: Updated.
* platform/gtk/fast/writing-mode/broken-ideograph-small-caps-expected.png: Updated.
* platform/gtk/fast/writing-mode/broken-ideograph-small-caps-expected.txt: Updated.
* platform/gtk/fast/writing-mode/broken-ideographic-font-expected.png: Updated.
* platform/gtk/fast/writing-mode/broken-ideographic-font-expected.txt: Updated.
* platform/gtk/fast/writing-mode/fallback-orientation-expected.png: Updated.
* platform/gtk/fast/writing-mode/fallback-orientation-expected.txt: Updated.
* platform/gtk/fast/writing-mode/japanese-lr-selection-expected.png: Updated.
* platform/gtk/fast/writing-mode/japanese-lr-selection-expected.txt: Updated.
* platform/gtk/fast/writing-mode/japanese-lr-text-expected.png: Updated.
* platform/gtk/fast/writing-mode/japanese-lr-text-expected.txt: Updated.
* platform/gtk/fast/writing-mode/japanese-rl-selection-expected.png: Updated.
* platform/gtk/fast/writing-mode/japanese-rl-selection-expected.txt: Updated.
* platform/gtk/fast/writing-mode/japanese-rl-text-expected.png: Updated.
* platform/gtk/fast/writing-mode/japanese-rl-text-expected.txt: Updated.
* platform/gtk/fast/writing-mode/japanese-rl-text-with-broken-font-expected.png: Updated.
* platform/gtk/fast/writing-mode/japanese-rl-text-with-broken-font-expected.txt: Updated.
* platform/gtk/fast/writing-mode/japanese-ruby-vertical-lr-expected.png: Updated.
* platform/gtk/fast/writing-mode/japanese-ruby-vertical-lr-expected.txt: Updated.
* platform/gtk/fast/writing-mode/japanese-ruby-vertical-rl-expected.png: Updated.
* platform/gtk/fast/writing-mode/japanese-ruby-vertical-rl-expected.txt: Updated.
* platform/gtk/fast/writing-mode/text-orientation-basic-expected.png: Updated.
* platform/gtk/fast/writing-mode/text-orientation-basic-expected.txt:
* platform/gtk/fast/writing-mode/vertical-align-table-baseline-expected.png: Updated.
* platform/gtk/fast/writing-mode/vertical-align-table-baseline-expected.txt: Updated.
* platform/gtk/fast/writing-mode/vertical-baseline-alignment-expected.png: Updated.
* platform/gtk/fast/writing-mode/vertical-baseline-alignment-expected.txt: Updated.
* platform/gtk/fast/writing-mode/vertical-font-fallback-expected.png: Updated.
* platform/gtk/fast/writing-mode/vertical-font-fallback-expected.txt: Updated.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@158848 268f45cc-cd09-0410-ab3c-d52691b4dbfc
92 files changed:
LayoutTests/ChangeLog
LayoutTests/platform/gtk-wk1/fast/writing-mode/Kusa-Makura-background-canvas-expected.txt
LayoutTests/platform/gtk/editing/selection/vertical-lr-ltr-extend-line-backward-br-expected.png
LayoutTests/platform/gtk/editing/selection/vertical-lr-ltr-extend-line-backward-br-expected.txt
LayoutTests/platform/gtk/editing/selection/vertical-lr-ltr-extend-line-forward-br-expected.png
LayoutTests/platform/gtk/editing/selection/vertical-lr-ltr-extend-line-forward-br-expected.txt
LayoutTests/platform/gtk/editing/selection/vertical-rl-ltr-extend-line-backward-br-expected.png
LayoutTests/platform/gtk/editing/selection/vertical-rl-ltr-extend-line-backward-br-expected.txt
LayoutTests/platform/gtk/editing/selection/vertical-rl-ltr-extend-line-backward-p-expected.png
LayoutTests/platform/gtk/editing/selection/vertical-rl-ltr-extend-line-backward-p-expected.txt
LayoutTests/platform/gtk/editing/selection/vertical-rl-ltr-extend-line-backward-wrap-expected.png
LayoutTests/platform/gtk/editing/selection/vertical-rl-ltr-extend-line-backward-wrap-expected.txt
LayoutTests/platform/gtk/editing/selection/vertical-rl-ltr-extend-line-forward-br-expected.png
LayoutTests/platform/gtk/editing/selection/vertical-rl-ltr-extend-line-forward-br-expected.txt
LayoutTests/platform/gtk/editing/selection/vertical-rl-ltr-extend-line-forward-p-expected.png
LayoutTests/platform/gtk/editing/selection/vertical-rl-ltr-extend-line-forward-p-expected.txt
LayoutTests/platform/gtk/editing/selection/vertical-rl-ltr-extend-line-forward-wrap-expected.png
LayoutTests/platform/gtk/editing/selection/vertical-rl-ltr-extend-line-forward-wrap-expected.txt
LayoutTests/platform/gtk/fast/css/relative-positioned-block-with-inline-ancestor-and-parent-dynamic-expected.png
LayoutTests/platform/gtk/fast/dynamic/text-combine-expected.png
LayoutTests/platform/gtk/fast/dynamic/text-combine-expected.txt
LayoutTests/platform/gtk/fast/html/details-writing-mode-expected.png
LayoutTests/platform/gtk/fast/repaint/japanese-rl-selection-clear-expected.png
LayoutTests/platform/gtk/fast/repaint/japanese-rl-selection-repaint-expected.png
LayoutTests/platform/gtk/fast/repaint/repaint-across-writing-mode-boundary-expected.png
LayoutTests/platform/gtk/fast/ruby/base-shorter-than-text-expected.png
LayoutTests/platform/gtk/fast/ruby/base-shorter-than-text-expected.txt
LayoutTests/platform/gtk/fast/text/decorations-with-text-combine-expected.png
LayoutTests/platform/gtk/fast/text/decorations-with-text-combine-expected.txt
LayoutTests/platform/gtk/fast/text/emphasis-combined-text-expected.png
LayoutTests/platform/gtk/fast/text/emphasis-combined-text-expected.txt
LayoutTests/platform/gtk/fast/text/emphasis-vertical-expected.png
LayoutTests/platform/gtk/fast/text/emphasis-vertical-expected.txt
LayoutTests/platform/gtk/fast/text/international/text-combine-image-test-expected.png
LayoutTests/platform/gtk/fast/text/international/text-combine-image-test-expected.txt
LayoutTests/platform/gtk/fast/text/international/text-spliced-font-expected.png
LayoutTests/platform/gtk/fast/text/international/text-spliced-font-expected.txt
LayoutTests/platform/gtk/fast/text/international/vertical-text-glyph-test-expected.png
LayoutTests/platform/gtk/fast/text/justify-ideograph-vertical-expected.png
LayoutTests/platform/gtk/fast/text/orientation-sideways-expected.png
LayoutTests/platform/gtk/fast/text/orientation-sideways-expected.txt
LayoutTests/platform/gtk/fast/writing-mode/Kusa-Makura-background-canvas-expected.png
LayoutTests/platform/gtk/fast/writing-mode/Kusa-Makura-background-canvas-expected.txt
LayoutTests/platform/gtk/fast/writing-mode/border-vertical-lr-expected.png
LayoutTests/platform/gtk/fast/writing-mode/border-vertical-lr-expected.txt
LayoutTests/platform/gtk/fast/writing-mode/broken-ideograph-small-caps-expected.png
LayoutTests/platform/gtk/fast/writing-mode/broken-ideograph-small-caps-expected.txt
LayoutTests/platform/gtk/fast/writing-mode/broken-ideographic-font-expected.png
LayoutTests/platform/gtk/fast/writing-mode/broken-ideographic-font-expected.txt
LayoutTests/platform/gtk/fast/writing-mode/fallback-orientation-expected.png
LayoutTests/platform/gtk/fast/writing-mode/fallback-orientation-expected.txt
LayoutTests/platform/gtk/fast/writing-mode/japanese-lr-selection-expected.png
LayoutTests/platform/gtk/fast/writing-mode/japanese-lr-selection-expected.txt
LayoutTests/platform/gtk/fast/writing-mode/japanese-lr-text-expected.png
LayoutTests/platform/gtk/fast/writing-mode/japanese-lr-text-expected.txt
LayoutTests/platform/gtk/fast/writing-mode/japanese-rl-selection-expected.png
LayoutTests/platform/gtk/fast/writing-mode/japanese-rl-selection-expected.txt
LayoutTests/platform/gtk/fast/writing-mode/japanese-rl-text-expected.png
LayoutTests/platform/gtk/fast/writing-mode/japanese-rl-text-expected.txt
LayoutTests/platform/gtk/fast/writing-mode/japanese-rl-text-with-broken-font-expected.png
LayoutTests/platform/gtk/fast/writing-mode/japanese-rl-text-with-broken-font-expected.txt
LayoutTests/platform/gtk/fast/writing-mode/japanese-ruby-vertical-lr-expected.png
LayoutTests/platform/gtk/fast/writing-mode/japanese-ruby-vertical-lr-expected.txt
LayoutTests/platform/gtk/fast/writing-mode/japanese-ruby-vertical-rl-expected.png
LayoutTests/platform/gtk/fast/writing-mode/japanese-ruby-vertical-rl-expected.txt
LayoutTests/platform/gtk/fast/writing-mode/text-orientation-basic-expected.png
LayoutTests/platform/gtk/fast/writing-mode/text-orientation-basic-expected.txt
LayoutTests/platform/gtk/fast/writing-mode/vertical-align-table-baseline-expected.png
LayoutTests/platform/gtk/fast/writing-mode/vertical-align-table-baseline-expected.txt
LayoutTests/platform/gtk/fast/writing-mode/vertical-baseline-alignment-expected.png
LayoutTests/platform/gtk/fast/writing-mode/vertical-baseline-alignment-expected.txt
LayoutTests/platform/gtk/fast/writing-mode/vertical-font-fallback-expected.png
LayoutTests/platform/gtk/fast/writing-mode/vertical-font-fallback-expected.txt
Source/Platform/ChangeLog
Source/Platform/GNUmakefile.am
Source/WTF/ChangeLog
Source/WTF/wtf/Platform.h
Source/WebCore/ChangeLog
Source/WebCore/GNUmakefile.list.am
Source/WebCore/PlatformEfl.cmake
Source/WebCore/PlatformGTK.cmake
Source/WebCore/platform/graphics/FontCache.cpp
Source/WebCore/platform/graphics/freetype/FontCustomPlatformDataFreeType.cpp
Source/WebCore/platform/graphics/freetype/FontPlatformData.h
Source/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp
Source/WebCore/platform/graphics/freetype/SimpleFontDataFreeType.cpp
Source/WebCore/platform/graphics/harfbuzz/HarfBuzzFaceCairo.cpp
Source/WebKit/ChangeLog
Source/WebKit/PlatformEfl.cmake
Source/WebKit2/ChangeLog
Source/WebKit2/PlatformEfl.cmake
Source/WebKit2/PlatformGTK.cmake