diff options
author | claireho <chinglanho@gmail.com> | 2012-03-30 14:29:06 -0700 |
---|---|---|
committer | claireho <chinglanho@gmail.com> | 2012-03-30 14:29:06 -0700 |
commit | 050a1e6d90f809761b30a3c926ec89bd44eba55d (patch) | |
tree | 638a9bb4396c725f52d96e0c39072408ac23b5c7 /Source | |
parent | 93198fb30cfc52edd8d616aa33586643547cb56c (diff) | |
download | external_webkit-050a1e6d90f809761b30a3c926ec89bd44eba55d.zip external_webkit-050a1e6d90f809761b30a3c926ec89bd44eba55d.tar.gz external_webkit-050a1e6d90f809761b30a3c926ec89bd44eba55d.tar.bz2 |
Line spacing for vertical writing mode.
Bug: 6081283 - Line spacing for Japanese (vertical writing) isn't aligned well.
1. The initial value for line-spacing should be ascent + decent + line gap.
2. If the line-gap is zero, we use the avgCharWidth for line gap to avoid the
no spaces between vertical lines.
Change-Id: I3d21d6d9a222e73d972f8c0ffb77eb420ac175e8
Diffstat (limited to 'Source')
-rw-r--r-- | Source/WebCore/platform/graphics/android/FontDataAndroid.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Source/WebCore/platform/graphics/android/FontDataAndroid.cpp b/Source/WebCore/platform/graphics/android/FontDataAndroid.cpp index c6dd174..88822df 100644 --- a/Source/WebCore/platform/graphics/android/FontDataAndroid.cpp +++ b/Source/WebCore/platform/graphics/android/FontDataAndroid.cpp @@ -56,8 +56,12 @@ void SimpleFontData::platformInit() m_fontMetrics.setAscent(a); m_fontMetrics.setDescent(d); m_fontMetrics.setXHeight(SkScalarToFloat(-skiaFontMetrics.fAscent) * 0.56f); // hack I stole from the window's port - m_fontMetrics.setLineSpacing(a + d); - m_fontMetrics.setLineGap(SkScalarToFloat(skiaFontMetrics.fLeading)); + float lineGap = SkScalarToFloat(skiaFontMetrics.fLeading); + if (platformData().orientation() == Vertical && lineGap == 0) { + lineGap = skiaFontMetrics.fAvgCharWidth * 0.56f; + } + m_fontMetrics.setLineGap(lineGap); + m_fontMetrics.setLineSpacing(a + d + lineGap); if (platformData().orientation() == Vertical && !isTextOrientationFallback()) { static const uint32_t vheaTag = SkSetFourByteTag('v', 'h', 'e', 'a'); |