Commit 61985f74 authored by wangxianzhu@chromium.org's avatar wangxianzhu@chromium.org
Browse files

OpenTypeVerticalData issue with DroidSansFallback.ttf on chromium-android and chromium-linux

https://bugs.webkit.org/show_bug.cgi?id=97824

Reviewed by Tony Chang.

Source/WebCore:

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.

LayoutTests:

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.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@130570 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent c3459ef9
2012-10-05 Xianzhu Wang <wangxianzhu@chromium.org>
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 <tony@chromium.org>
Form controls should always be horizontal
......
<!DOCTYPE HTML>
<!--
The difference between the test file and this expectation file is that
the punctuations are replaced by the characters that they should be
substituted according to the vert GSUB table.
-->
<html>
<head>
<title>Vertical punctuations using font with GSUB/vert table not under dflt script</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
@font-face {
font-family: 'droid';
/* DroidSansFallback-reduced.ttf was generated based on Android's
DroidSansFallback.ttf by removing many glyphs to meet the size
requirement of web font face.
It contains GSUB and vert table but not under dflt script.
*/
src: url('resources/DroidSansFallback-reduced.ttf');
}
#test {
font-size: 25px;
font-family: droid;
-webkit-writing-mode: vertical-rl;
height: 500px;
}
</style>
</head>
<body>
Puctuations should be properly rotated and positioned.
<div id="test">
<!-- Punctuations are using the vertical substitution characters. -->
&#xfe35;&#x4e00;&#xfe36;
&#xfe39;&#x4e01;&#xfe3a;
&#xfe37;&#x4e02;&#xfe38;
</div>
</body>
<!DOCTYPE HTML>
<html>
<head>
<title>Vertical punctuations using font with GSUB/vert table not under dflt script</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
@font-face {
font-family: 'droid';
/* DroidSansFallback-reduced.ttf was generated based on Android's
DroidSansFallback.ttf by removing many glyphs to meet the size
requirement of web font face.
It contains GSUB and vert table but not under dflt script.
*/
src: url('resources/DroidSansFallback-reduced.ttf');
}
#test {
font-size: 25px;
font-family: droid;
-webkit-writing-mode: vertical-rl;
height: 500px;
}
</style>
</head>
<body>
Puctuations should be properly rotated and positioned.
<div id="test">
&#xff08;&#x4e00;&#xff09;
&#x3014;&#x4e01;&#x3015;
&#xff5b;&#x4e02;&#xff5d;
</div>
</body>
......@@ -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 ]
2012-10-05 Xianzhu Wang <wangxianzhu@chromium.org>
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 <tony@chromium.org>
Form controls should always be horizontal
......
......@@ -256,6 +256,15 @@ struct FeatureList : TableBase {
return validateOffset<FeatureTable>(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<FeatureTable>(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<Glyph, Glyph>* map, const SharedBuffer& buffer) const
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment