Diff
Modified: trunk/LayoutTests/ChangeLog (151692 => 151693)
--- trunk/LayoutTests/ChangeLog 2013-06-18 20:28:26 UTC (rev 151692)
+++ trunk/LayoutTests/ChangeLog 2013-06-18 20:28:58 UTC (rev 151693)
@@ -1,3 +1,25 @@
+2013-06-18 Dean Jackson <[email protected]>
+
+ Synthesized vertical italics on rotated glyphs are transformed incorrectly
+ https://bugs.webkit.org/show_bug.cgi?id=117726
+
+ Reviewed by Enrica Casucci.
+
+ Two new tests. One ensures that CJK characters do not get italics
+ when vertical. The other ensures that Latin text does get italics in
+ a font that is not synthesized, but unfortunately has to be a pixel test.
+ The latter is skipped on non-Mac since they don't support
+ synthesized obliques in FontPlatformData.
+
+ * fast/text/international/synthesized-italic-vertical-expected.html: Added.
+ * fast/text/international/synthesized-italic-vertical-latin.html: Added.
+ * fast/text/international/synthesized-italic-vertical.html: Added.
+ * platform/efl/TestExpectations:
+ * platform/gtk/TestExpectations:
+ * platform/mac/fast/text/international/synthesized-italic-vertical-latin-expected.txt: Added.
+ * platform/qt/TestExpectations:
+ * platform/win/TestExpectations:
+
2013-06-18 Commit Queue <[email protected]>
Unreviewed, rolling out r151549.
Added: trunk/LayoutTests/fast/text/international/synthesized-italic-vertical-expected.html (0 => 151693)
--- trunk/LayoutTests/fast/text/international/synthesized-italic-vertical-expected.html (rev 0)
+++ trunk/LayoutTests/fast/text/international/synthesized-italic-vertical-expected.html 2013-06-18 20:28:58 UTC (rev 151693)
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html lang="ja">
+<head>
+ <meta charset="UTF-8">
+ <style>
+ html {
+ -webkit-writing-mode: vertical-lr;
+ }
+ p {
+ font-size: 40px;
+ }
+ </style>
+</head>
+<body>
+ <p>丹羽 亮介</p>
+</body>
+</html>
Property changes on: trunk/LayoutTests/fast/text/international/synthesized-italic-vertical-expected.html
___________________________________________________________________
Added: svn:mime-type
Added: svn:keywords
Added: svn:eol-style
Added: trunk/LayoutTests/fast/text/international/synthesized-italic-vertical-latin.html (0 => 151693)
--- trunk/LayoutTests/fast/text/international/synthesized-italic-vertical-latin.html (rev 0)
+++ trunk/LayoutTests/fast/text/international/synthesized-italic-vertical-latin.html 2013-06-18 20:28:58 UTC (rev 151693)
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="UTF-8">
+ <style>
+ html {
+ -webkit-writing-mode: vertical-lr;
+ }
+ p {
+ font-size: 30px;
+ font-style: italic;
+ }
+ </style>
+</head>
+<body>
+ <p>ABC丹羽 亮介ABC丹羽 亮介</p>
+</body>
+</html>
Property changes on: trunk/LayoutTests/fast/text/international/synthesized-italic-vertical-latin.html
___________________________________________________________________
Added: svn:mime-type
Added: svn:keywords
Added: svn:eol-style
Added: trunk/LayoutTests/fast/text/international/synthesized-italic-vertical.html (0 => 151693)
--- trunk/LayoutTests/fast/text/international/synthesized-italic-vertical.html (rev 0)
+++ trunk/LayoutTests/fast/text/international/synthesized-italic-vertical.html 2013-06-18 20:28:58 UTC (rev 151693)
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html lang="ja">
+<head>
+ <meta charset="UTF-8">
+ <style>
+ html {
+ -webkit-writing-mode: vertical-lr;
+ }
+ p {
+ font-size: 40px;
+ font-style: italic;
+ }
+ </style>
+</head>
+<body>
+ <p>丹羽 亮介</p>
+</body>
+</html>
Property changes on: trunk/LayoutTests/fast/text/international/synthesized-italic-vertical.html
___________________________________________________________________
Added: svn:mime-type
Added: svn:keywords
Added: svn:eol-style
Modified: trunk/LayoutTests/platform/efl/TestExpectations (151692 => 151693)
--- trunk/LayoutTests/platform/efl/TestExpectations 2013-06-18 20:28:26 UTC (rev 151692)
+++ trunk/LayoutTests/platform/efl/TestExpectations 2013-06-18 20:28:58 UTC (rev 151693)
@@ -1780,3 +1780,6 @@
webkit.org/b/116587 http/tests/websocket/tests/hybi/reload-crash.html [ Skip ]
webkit.org/b/117706 accessibility/box-styled-lists.html [ Failure ]
+
+# Synthesized italics not supported
+fast/text/international/synthesized-italic-vertical-latin.html [ Skip ]
Modified: trunk/LayoutTests/platform/gtk/TestExpectations (151692 => 151693)
--- trunk/LayoutTests/platform/gtk/TestExpectations 2013-06-18 20:28:26 UTC (rev 151692)
+++ trunk/LayoutTests/platform/gtk/TestExpectations 2013-06-18 20:28:58 UTC (rev 151693)
@@ -413,6 +413,9 @@
# No concept of secure text input
Bug(GTK) editing/secure-input [ Failure ]
+# Synthesized italics not supported
+fast/text/international/synthesized-italic-vertical-latin.html [ Skip ]
+
#////////////////////////////////////////////////////////////////////////////////////////
# End of Expected failures
#////////////////////////////////////////////////////////////////////////////////////////
Added: trunk/LayoutTests/platform/mac/fast/text/international/synthesized-italic-vertical-latin-expected.png
(Binary files differ)
Property changes on: trunk/LayoutTests/platform/mac/fast/text/international/synthesized-italic-vertical-latin-expected.png
___________________________________________________________________
Added: svn:mime-type
Added: trunk/LayoutTests/platform/mac/fast/text/international/synthesized-italic-vertical-latin-expected.txt (0 => 151693)
--- trunk/LayoutTests/platform/mac/fast/text/international/synthesized-italic-vertical-latin-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/mac/fast/text/international/synthesized-italic-vertical-latin-expected.txt 2013-06-18 20:28:58 UTC (rev 151693)
@@ -0,0 +1,8 @@
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 105x600
+ RenderBlock {HTML} at (0,0) size 105x600
+ RenderBody {BODY} at (30,8) size 45x584
+ RenderBlock {P} at (0,0) size 45x584
+ RenderText {#text} at (4,0) size 36x368
+ text run at (4,0) width 368: "ABC\x{4E39}\x{7FBD} \x{4EAE}\x{4ECB}ABC\x{4E39}\x{7FBD} \x{4EAE}\x{4ECB}"
Property changes on: trunk/LayoutTests/platform/mac/fast/text/international/synthesized-italic-vertical-latin-expected.txt
___________________________________________________________________
Added: svn:mime-type
Added: svn:keywords
Added: svn:eol-style
Modified: trunk/LayoutTests/platform/qt/TestExpectations (151692 => 151693)
--- trunk/LayoutTests/platform/qt/TestExpectations 2013-06-18 20:28:26 UTC (rev 151692)
+++ trunk/LayoutTests/platform/qt/TestExpectations 2013-06-18 20:28:58 UTC (rev 151693)
@@ -2660,3 +2660,7 @@
# REGRESSION(r151146) fast/forms/control-clip-overflow.html fails
webkit.org/b/117185 fast/forms/control-clip-overflow.html [ Skip ]
+
+# Synthesized italics not supported
+fast/text/international/synthesized-italic-vertical-latin.html [ Skip ]
+
Modified: trunk/LayoutTests/platform/win/TestExpectations (151692 => 151693)
--- trunk/LayoutTests/platform/win/TestExpectations 2013-06-18 20:28:26 UTC (rev 151692)
+++ trunk/LayoutTests/platform/win/TestExpectations 2013-06-18 20:28:58 UTC (rev 151693)
@@ -2787,3 +2787,7 @@
webkit.org/b/117324 fast/css/fontloader-download-error.html
webkit.org/b/117325 svg/as-image/svg-nested.html
webkit.org/b/117325 svg/css/font-face-crash.html
+
+# Synthesized italics not supported
+fast/text/international/synthesized-italic-vertical-latin.html [ Skip ]
+
Modified: trunk/Source/WebCore/ChangeLog (151692 => 151693)
--- trunk/Source/WebCore/ChangeLog 2013-06-18 20:28:26 UTC (rev 151692)
+++ trunk/Source/WebCore/ChangeLog 2013-06-18 20:28:58 UTC (rev 151693)
@@ -1,3 +1,39 @@
+2013-06-18 Dean Jackson <[email protected]>
+
+ Synthesized vertical italics on rotated glyphs are transformed incorrectly
+ https://bugs.webkit.org/show_bug.cgi?id=117726
+
+ Reviewed by Enrica Casucci.
+
+ If a font does not have italic glyphs, and is in a vertical flow, then
+ the synthesis of italics was skewing in the wrong direction. While here,
+ ensure that no CJK text will get italics in vertical layout.
+
+ This is a topic under discussion in the CSS Working Group. The resolution
+ at the June 2013 face-to-face was that:
+ - italics in Japanese (and Chinese) text are rare in vertical layout
+ - most people wanted Latin text to italicize in the direction of the line flow
+
+ The final behaviour was left undefined, but we consider the change here
+ to be sufficient for now. In all cases, the best solution is to avoid
+ synthesized italics by specifying a font that includes such forms.
+
+ Tests: fast/text/international/synthesized-italic-vertical-latin.html
+ fast/text/international/synthesized-italic-vertical.html
+
+ * platform/graphics/FontGlyphs.cpp:
+ (WebCore::glyphDataAndPageForCJKCharacterWithoutSyntheticItalic): New function
+ that makes a new glyph data pair that is marked as NOT using a synthesized italic.
+ (WebCore::FontGlyphs::glyphDataAndPageForCharacter): If this is a CJK character and
+ has a synthesized oblique, then run it through the function above to make a new glyph data pair.
+ * platform/graphics/SimpleFontData.cpp:
+ (WebCore::SimpleFontData::nonSyntheticItalicFontData): Creates/returns a new SimpleFontData that will
+ not synthesize italics.
+ * platform/graphics/SimpleFontData.h: New method nonSyntheticItalicFontData.
+ * platform/graphics/mac/FontMac.mm:
+ (WebCore::Font::drawGlyphs): This is the actual bug fix. If you are in a vertical flow, the
+ skew direction should be downwards, not leftwards.
+
2013-06-18 Commit Queue <[email protected]>
Unreviewed, rolling out r151549.
Modified: trunk/Source/WebCore/platform/graphics/FontGlyphs.cpp (151692 => 151693)
--- trunk/Source/WebCore/platform/graphics/FontGlyphs.cpp 2013-06-18 20:28:26 UTC (rev 151692)
+++ trunk/Source/WebCore/platform/graphics/FontGlyphs.cpp 2013-06-18 20:28:58 UTC (rev 151693)
@@ -199,6 +199,19 @@
return false;
}
+
+static inline std::pair<GlyphData, GlyphPage*> glyphDataAndPageForCJKCharacterWithoutSyntheticItalic(UChar32 character, GlyphData& data, GlyphPage* page, unsigned pageNumber)
+{
+ RefPtr<SimpleFontData> nonItalicFontData = data.fontData->nonSyntheticItalicFontData();
+ GlyphPageTreeNode* nonItalicNode = GlyphPageTreeNode::getRootChild(nonItalicFontData.get(), pageNumber);
+ GlyphPage* nonItalicPage = nonItalicNode->page();
+ if (nonItalicPage) {
+ GlyphData nonItalicData = nonItalicPage->glyphDataForCharacter(character);
+ if (nonItalicData.fontData)
+ return std::make_pair(nonItalicData, nonItalicPage);
+ }
+ return std::make_pair(data, page);
+}
static inline std::pair<GlyphData, GlyphPage*> glyphDataAndPageForNonCJKCharacterWithGlyphOrientation(UChar32 character, NonCJKGlyphOrientation orientation, GlyphData& data, GlyphPage* page, unsigned pageNumber)
{
@@ -282,6 +295,10 @@
variant = BrokenIdeographVariant;
break;
}
+#if PLATFORM(MAC)
+ else if (data.fontData->platformData().syntheticOblique())
+ return glyphDataAndPageForCJKCharacterWithoutSyntheticItalic(c, data, page, pageNumber);
+#endif
} else
return glyphDataAndPageForNonCJKCharacterWithGlyphOrientation(c, description.nonCJKGlyphOrientation(), data, page, pageNumber);
Modified: trunk/Source/WebCore/platform/graphics/SimpleFontData.cpp (151692 => 151693)
--- trunk/Source/WebCore/platform/graphics/SimpleFontData.cpp 2013-06-18 20:28:26 UTC (rev 151692)
+++ trunk/Source/WebCore/platform/graphics/SimpleFontData.cpp 2013-06-18 20:28:58 UTC (rev 151693)
@@ -229,6 +229,18 @@
return m_derivedFontData->brokenIdeograph;
}
+PassRefPtr<SimpleFontData> SimpleFontData::nonSyntheticItalicFontData() const
+{
+ if (!m_derivedFontData)
+ m_derivedFontData = DerivedFontData::create(isCustomFont());
+ if (!m_derivedFontData->nonSyntheticItalic) {
+ FontPlatformData nonSyntheticItalicFontPlatformData(m_platformData);
+ nonSyntheticItalicFontPlatformData.m_syntheticOblique = false;
+ m_derivedFontData->nonSyntheticItalic = create(nonSyntheticItalicFontPlatformData, isCustomFont(), false, true);
+ }
+ return m_derivedFontData->nonSyntheticItalic;
+}
+
#ifndef NDEBUG
String SimpleFontData::description() const
{
Modified: trunk/Source/WebCore/platform/graphics/SimpleFontData.h (151692 => 151693)
--- trunk/Source/WebCore/platform/graphics/SimpleFontData.h 2013-06-18 20:28:26 UTC (rev 151692)
+++ trunk/Source/WebCore/platform/graphics/SimpleFontData.h 2013-06-18 20:28:58 UTC (rev 151693)
@@ -106,6 +106,7 @@
PassRefPtr<SimpleFontData> smallCapsFontData(const FontDescription&) const;
PassRefPtr<SimpleFontData> emphasisMarkFontData(const FontDescription&) const;
PassRefPtr<SimpleFontData> brokenIdeographFontData() const;
+ PassRefPtr<SimpleFontData> nonSyntheticItalicFontData() const;
PassRefPtr<SimpleFontData> variantFontData(const FontDescription& description, FontDataVariant variant) const
{
@@ -292,6 +293,7 @@
RefPtr<SimpleFontData> brokenIdeograph;
RefPtr<SimpleFontData> verticalRightOrientation;
RefPtr<SimpleFontData> uprightOrientation;
+ RefPtr<SimpleFontData> nonSyntheticItalic;
#if PLATFORM(MAC)
mutable RetainPtr<CFMutableDictionaryRef> compositeFontReferences;
#endif
Modified: trunk/Source/WebCore/platform/graphics/mac/FontMac.mm (151692 => 151693)
--- trunk/Source/WebCore/platform/graphics/mac/FontMac.mm 2013-06-18 20:28:26 UTC (rev 151692)
+++ trunk/Source/WebCore/platform/graphics/mac/FontMac.mm 2013-06-18 20:28:58 UTC (rev 151693)
@@ -29,6 +29,7 @@
#import "SimpleFontData.h"
#import "WebCoreSystemInterface.h"
#import <AppKit/AppKit.h>
+#import <wtf/MathExtras.h>
#define SYNTHETIC_OBLIQUE_ANGLE 14
@@ -201,8 +202,13 @@
memcpy(&matrix, [drawFont matrix], sizeof(matrix));
matrix.b = -matrix.b;
matrix.d = -matrix.d;
- if (platformData.m_syntheticOblique)
- matrix = CGAffineTransformConcat(matrix, CGAffineTransformMake(1, 0, -tanf(SYNTHETIC_OBLIQUE_ANGLE * acosf(0) / 90), 1, 0, 0));
+ if (platformData.m_syntheticOblique) {
+ static float obliqueSkew = tanf(SYNTHETIC_OBLIQUE_ANGLE * piFloat / 180);
+ if (font->platformData().orientation() == Vertical)
+ matrix = CGAffineTransformConcat(matrix, CGAffineTransformMake(1, obliqueSkew, 0, 1, 0, 0));
+ else
+ matrix = CGAffineTransformConcat(matrix, CGAffineTransformMake(1, 0, -obliqueSkew, 1, 0, 0));
+ }
CGContextSetTextMatrix(cgContext, matrix);
#if PLATFORM(MAC)