From 5403113c5aa5d55a05ea001f562829e907632178 Mon Sep 17 00:00:00 2001 From: claireho Date: Tue, 20 Sep 2011 13:56:32 -0700 Subject: 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 --- .../graphics/android/FontPlatformDataAndroid.cpp | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'Source/WebCore/platform/graphics/android/FontPlatformDataAndroid.cpp') 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(&mTextSize); - h ^= 0x01010101 * (((int)mFakeBold << 1) | (int)mFakeItalic); + h ^= 0x01010101 * ((static_cast(mTextOrientation) << 3) | (static_cast(mOrientation) << 2) | + ((int)mFakeBold << 1) | (int)mFakeItalic); h ^= sizeAsInt; return h; } -- cgit v1.1