summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/platform/graphics/android/FontAndroid.cpp
diff options
context:
space:
mode:
authorclaireho <chinglanho@gmail.com>2011-11-10 16:00:55 -0800
committerclaireho <chinglanho@gmail.com>2011-11-10 17:17:57 -0800
commitb5adac2453b428ee1e9386919a89a395dc507bd6 (patch)
treeb279de53ede817c5e47d147474ced9e61eb63abf /Source/WebCore/platform/graphics/android/FontAndroid.cpp
parent53e0d336e8ff86f5e8a487fef8e16544dabcca1a (diff)
downloadexternal_webkit-b5adac2453b428ee1e9386919a89a395dc507bd6.zip
external_webkit-b5adac2453b428ee1e9386919a89a395dc507bd6.tar.gz
external_webkit-b5adac2453b428ee1e9386919a89a395dc507bd6.tar.bz2
Fix the scale for complex script fonts and re-ajust y position.
Bug 5445861 : complex joining characters positioned in wrong place. 1. Set font size and scale for harfbuzz object based on Chrome's CL:http://trac.webkit.org/changeset/77504. 2. Truncate harfbuzz value to pixels for y position. 3. Ran through the page_cycler/intl2 tests with 5 iterations. Change-Id: I38dcb07b2d23042e40781ea914c8c6e73f33c220
Diffstat (limited to 'Source/WebCore/platform/graphics/android/FontAndroid.cpp')
-rw-r--r--Source/WebCore/platform/graphics/android/FontAndroid.cpp21
1 files changed, 13 insertions, 8 deletions
diff --git a/Source/WebCore/platform/graphics/android/FontAndroid.cpp b/Source/WebCore/platform/graphics/android/FontAndroid.cpp
index d435ad7..852413f 100644
--- a/Source/WebCore/platform/graphics/android/FontAndroid.cpp
+++ b/Source/WebCore/platform/graphics/android/FontAndroid.cpp
@@ -735,6 +735,16 @@ void TextRunWalker::setupFontForScriptRun()
}
m_item.face = complexPlatformData->harfbuzzFace();
m_item.font->userData = const_cast<FontPlatformData*>(complexPlatformData);
+
+ int size = complexPlatformData->size();
+ m_item.font->x_ppem = size;
+ m_item.font->y_ppem = size;
+ // x_ and y_scale are the conversion factors from font design space (fEmSize) to 1/64th of device pixels in 16.16 format.
+ const int devicePixelFraction = 64;
+ const int multiplyFor16Dot16 = 1 << 16;
+ int scale = devicePixelFraction * size * multiplyFor16Dot16 / complexPlatformData->emSizeInFontUnits();
+ m_item.font->x_scale = scale;
+ m_item.font->y_scale = scale;
}
HB_FontRec* TextRunWalker::allocHarfbuzzFont()
@@ -743,13 +753,6 @@ HB_FontRec* TextRunWalker::allocHarfbuzzFont()
memset(font, 0, sizeof(HB_FontRec));
font->klass = &harfbuzzSkiaClass;
font->userData = 0;
- // The values which harfbuzzSkiaClass returns are already scaled to
- // pixel units, so we just set all these to one to disable further
- // scaling.
- font->x_ppem = 1;
- font->y_ppem = 1;
- font->x_scale = 1;
- font->y_scale = 1;
return font;
}
@@ -823,7 +826,9 @@ void TextRunWalker::setGlyphPositions(bool isRTL)
int i = isRTL ? m_item.num_glyphs - iter - 1 : iter;
m_glyphs16[i] = m_item.glyphs[i];
- m_positions[i].set(SkIntToScalar(m_offsetX + position), m_startingY + SkIntToScalar(m_item.offsets[i].y));
+ int offsetX = truncateFixedPointToInteger(m_item.offsets[i].x);
+ int offsetY = truncateFixedPointToInteger(m_item.offsets[i].y);
+ m_positions[i].set(SkIntToScalar(m_offsetX + position) + offsetX, m_startingY + offsetY);
int advance = truncateFixedPointToInteger(m_item.advances[i]);
// The first half of the conjunction works around the case where