diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog index f3f9284c9b84247eb8aa5838be6a5c8d2bec69b6..f292d8709dd2809656c5bbef7120ecea29f5d0f7 100644 --- a/LayoutTests/ChangeLog +++ b/LayoutTests/ChangeLog @@ -1,3 +1,17 @@ +2012-10-05 Xianzhu Wang + + OpenTypeVerticalData issue with DroidSansFallback.ttf on chromium-android and chromium-linux + https://bugs.webkit.org/show_bug.cgi?id=97824 + + Reviewed by Tony Chang. + + Ref test for the change. The punctuations in the vertical text are expected to + be substituted with the corresponding vertical forms. + + * fast/writing-mode/vertical-subst-font-vert-no-dflt-expected.html: Added. + * fast/writing-mode/vertical-subst-font-vert-no-dflt.html: Added. + * platform/mac/TestExpectations: Added the new test as it fails on Mac because of https://bugs.webkit.org/show_bug.cgi?id=98560. + 2012-10-05 Tony Chang Form controls should always be horizontal diff --git a/LayoutTests/fast/writing-mode/resources/DroidSansFallback-reduced.ttf b/LayoutTests/fast/writing-mode/resources/DroidSansFallback-reduced.ttf index 9d7f9d89d6dc471c4b0644ed6939f816cbe37b0c..2f62ee878852c94052f29a6953957983ad224acf 100644 Binary files a/LayoutTests/fast/writing-mode/resources/DroidSansFallback-reduced.ttf and b/LayoutTests/fast/writing-mode/resources/DroidSansFallback-reduced.ttf differ diff --git a/LayoutTests/fast/writing-mode/vertical-subst-font-vert-no-dflt-expected.html b/LayoutTests/fast/writing-mode/vertical-subst-font-vert-no-dflt-expected.html new file mode 100644 index 0000000000000000000000000000000000000000..48bfe6467fd03b5f09a7d51c16a1707c08dd420a --- /dev/null +++ b/LayoutTests/fast/writing-mode/vertical-subst-font-vert-no-dflt-expected.html @@ -0,0 +1,37 @@ + + + + +Vertical punctuations using font with GSUB/vert table not under dflt script + + + + +Puctuations should be properly rotated and positioned. +
+ +︵一︶ +︹丁︺ +︷丂︸ +
+ diff --git a/LayoutTests/fast/writing-mode/vertical-subst-font-vert-no-dflt.html b/LayoutTests/fast/writing-mode/vertical-subst-font-vert-no-dflt.html new file mode 100644 index 0000000000000000000000000000000000000000..73afcf1c21b0c4c18e70772e625e9532326cfa5f --- /dev/null +++ b/LayoutTests/fast/writing-mode/vertical-subst-font-vert-no-dflt.html @@ -0,0 +1,31 @@ + + + +Vertical punctuations using font with GSUB/vert table not under dflt script + + + + +Puctuations should be properly rotated and positioned. +
+(一) +〔丁〕 +{丂} +
+ diff --git a/LayoutTests/platform/mac/TestExpectations b/LayoutTests/platform/mac/TestExpectations index d33054fee7bf6bf8b700f1243eace5685ece4b91..cd0e2437d495edb8f012cd08e8d5882d935a6c26 100644 --- a/LayoutTests/platform/mac/TestExpectations +++ b/LayoutTests/platform/mac/TestExpectations @@ -1311,3 +1311,6 @@ webkit.org/b/95707 http/tests/images/png-partial-load-no-alpha.html [ ImageOnlyF # Requires TestRunner displayInvalidatedRegion() support. webkit.org/b/98523 fast/images/repaint-subrect-grid.html [ Failure ] + +# Rendering/Layout issue of CJK vertical text with some font. +webkit.org/b/98560 fast/writing-mode/vertical-subst-font-vert-no-dflt.html [ ImageOnlyFailure ] diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index 34dc5576caf1842b3e5271de7f1e9517acf6a906..1088740a3a85bdb43aa401851f536edf29094b78 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,21 @@ +2012-10-05 Xianzhu Wang + + OpenTypeVerticalData issue with DroidSansFallback.ttf on chromium-android and chromium-linux + https://bugs.webkit.org/show_bug.cgi?id=97824 + + Reviewed by Tony Chang. + + The issue occurred when a font that contains vert GSUB table but doesn't have + a DFLT script and the first script doesn't have vert feature. Added logic to + handle the case. + + Test: fast/writing-mode/vertical-subst-font-vert-no-dflt.html + + * platform/graphics/opentype/OpenTypeVerticalData.cpp: + (FeatureList): + (WebCore::OpenType::FeatureList::findFeature): Added to find the matching feature in FeatureList. + (WebCore::OpenType::GSUBTable::feature): Added logic to handle the case of no DFLT script and no vert feature under the first script. + 2012-10-05 Tony Chang Form controls should always be horizontal diff --git a/Source/WebCore/platform/graphics/opentype/OpenTypeVerticalData.cpp b/Source/WebCore/platform/graphics/opentype/OpenTypeVerticalData.cpp index 584d78ff8c378a1f9637665c6d74cf6e439963fb..67013b1ac6f6063e6b3a8f290ab988e1f8284410 100644 --- a/Source/WebCore/platform/graphics/opentype/OpenTypeVerticalData.cpp +++ b/Source/WebCore/platform/graphics/opentype/OpenTypeVerticalData.cpp @@ -256,6 +256,15 @@ struct FeatureList : TableBase { return validateOffset(buffer, features[index].featureOffset); return 0; } + + const FeatureTable* findFeature(OpenType::Tag tag, const SharedBuffer& buffer) const + { + for (uint16_t i = 0; i < featureCount; ++i) { + if (isValidEnd(buffer, &features[i]) && features[i].featureTag == tag) + return validateOffset(buffer, features[i].featureOffset); + } + return 0; + } }; struct LangSysTable : TableBase { @@ -361,9 +370,17 @@ struct GSUBTable : TableBase { { const LangSysTable* langSys = defaultLangSys(buffer); const FeatureList* features = featureList(buffer); - if (!langSys || !features) + if (!features) return 0; - return langSys->feature(featureTag, features, buffer); + const FeatureTable* feature = 0; + if (langSys) + feature = langSys->feature(featureTag, features, buffer); + if (!feature) { + // If the font has no langSys table, or has no default script and the first script doesn't + // have the requested feature, then use the first matching feature directly. + feature = features->findFeature(featureTag, buffer); + } + return feature; } bool getVerticalGlyphSubstitutions(HashMap* map, const SharedBuffer& buffer) const