summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/platform/graphics/android/FontPlatformDataAndroid.cpp
diff options
context:
space:
mode:
authorclaireho <chinglanho@gmail.com>2011-09-20 13:56:32 -0700
committerclaireho <chinglanho@gmail.com>2011-09-20 14:11:30 -0700
commit5403113c5aa5d55a05ea001f562829e907632178 (patch)
tree263c0b331c6cd80873cd3cd057fde6a44cc16ecb /Source/WebCore/platform/graphics/android/FontPlatformDataAndroid.cpp
parent2ab28e97ec8eac2a936562f659c055847724ffd7 (diff)
downloadexternal_webkit-5403113c5aa5d55a05ea001f562829e907632178.zip
external_webkit-5403113c5aa5d55a05ea001f562829e907632178.tar.gz
external_webkit-5403113c5aa5d55a05ea001f562829e907632178.tar.bz2
Support "Vertical Writing Mode".
Bug 5094208 - Browser does not handle Japanese text in vertical writing mode. This changeset syncs up with Chrome's implementation for vertical text rendering. It 1. Adds fontOrientation and textOrientation to FontPlatformData. 2. Re-layout the text in drawGlyphs for vertical writing mode. Change-Id: Icac88a464b4b25b05c758a4e24c1827e0a7a0c91
Diffstat (limited to 'Source/WebCore/platform/graphics/android/FontPlatformDataAndroid.cpp')
-rw-r--r--Source/WebCore/platform/graphics/android/FontPlatformDataAndroid.cpp22
1 files changed, 16 insertions, 6 deletions
diff --git a/Source/WebCore/platform/graphics/android/FontPlatformDataAndroid.cpp b/Source/WebCore/platform/graphics/android/FontPlatformDataAndroid.cpp
index 8e77b5b..1185fa7 100644
--- a/Source/WebCore/platform/graphics/android/FontPlatformDataAndroid.cpp
+++ b/Source/WebCore/platform/graphics/android/FontPlatformDataAndroid.cpp
@@ -92,13 +92,17 @@ FontPlatformData::FontPlatformData(const FontPlatformData& src)
mFakeBold = src.mFakeBold;
mFakeItalic = src.mFakeItalic;
m_harfbuzzFace = src.m_harfbuzzFace;
+ mOrientation = src.mOrientation;
+ mTextOrientation = src.mTextOrientation;
inc_count();
trace(2);
}
-FontPlatformData::FontPlatformData(SkTypeface* tf, float textSize, bool fakeBold, bool fakeItalic)
- : mTypeface(tf), mTextSize(textSize), mFakeBold(fakeBold), mFakeItalic(fakeItalic)
+FontPlatformData::FontPlatformData(SkTypeface* tf, float textSize, bool fakeBold, bool fakeItalic,
+ FontOrientation orientation, TextOrientation textOrientation)
+ : mTypeface(tf), mTextSize(textSize), mFakeBold(fakeBold), mFakeItalic(fakeItalic),
+ mOrientation(orientation), mTextOrientation(textOrientation)
{
if (hashTableDeletedFontValue() != mTypeface) {
SkSafeRef(mTypeface);
@@ -110,7 +114,7 @@ FontPlatformData::FontPlatformData(SkTypeface* tf, float textSize, bool fakeBold
FontPlatformData::FontPlatformData(const FontPlatformData& src, float textSize)
: mTypeface(src.mTypeface), mTextSize(textSize), mFakeBold(src.mFakeBold), mFakeItalic(src.mFakeItalic),
- m_harfbuzzFace(src.m_harfbuzzFace)
+ m_harfbuzzFace(src.m_harfbuzzFace), mOrientation(src.mOrientation), mTextOrientation(src.mTextOrientation)
{
if (hashTableDeletedFontValue() != mTypeface) {
SkSafeRef(mTypeface);
@@ -129,7 +133,8 @@ FontPlatformData::FontPlatformData(float size, bool bold, bool oblique)
FontPlatformData::FontPlatformData(const FontPlatformData& src, SkTypeface* tf)
: mTypeface(tf), mTextSize(src.mTextSize), mFakeBold(src.mFakeBold),
- mFakeItalic(src.mFakeItalic)
+ mFakeItalic(src.mFakeItalic), mOrientation(src.mOrientation),
+ mTextOrientation(src.mTextOrientation)
{
if (hashTableDeletedFontValue() != mTypeface) {
SkSafeRef(mTypeface);
@@ -165,6 +170,8 @@ FontPlatformData& FontPlatformData::operator=(const FontPlatformData& src)
mFakeBold = src.mFakeBold;
mFakeItalic = src.mFakeItalic;
m_harfbuzzFace = src.m_harfbuzzFace;
+ mOrientation = src.mOrientation;
+ mTextOrientation = src.mTextOrientation;
return *this;
}
@@ -204,7 +211,9 @@ bool FontPlatformData::operator==(const FontPlatformData& a) const
return mTypeface == a.mTypeface &&
mTextSize == a.mTextSize &&
mFakeBold == a.mFakeBold &&
- mFakeItalic == a.mFakeItalic;
+ mFakeItalic == a.mFakeItalic &&
+ mOrientation == a.mOrientation &&
+ mTextOrientation == a.mTextOrientation;
}
unsigned FontPlatformData::hash() const
@@ -219,7 +228,8 @@ unsigned FontPlatformData::hash() const
uint32_t sizeAsInt = *reinterpret_cast<const uint32_t*>(&mTextSize);
- h ^= 0x01010101 * (((int)mFakeBold << 1) | (int)mFakeItalic);
+ h ^= 0x01010101 * ((static_cast<int>(mTextOrientation) << 3) | (static_cast<int>(mOrientation) << 2) |
+ ((int)mFakeBold << 1) | (int)mFakeItalic);
h ^= sizeAsInt;
return h;
}