Diff
Modified: branches/safari-601-branch/LayoutTests/ChangeLog (195402 => 195403)
--- branches/safari-601-branch/LayoutTests/ChangeLog 2016-01-21 07:57:07 UTC (rev 195402)
+++ branches/safari-601-branch/LayoutTests/ChangeLog 2016-01-21 07:58:28 UTC (rev 195403)
@@ -1,5 +1,23 @@
2016-01-20 Babak Shafiei <[email protected]>
+ Merge r188377.
+
+ 2015-08-12 Myles C. Maxfield <[email protected]>
+
+ [Cocoa] [CJK-configured device] System font has vertical punctuation
+ https://bugs.webkit.org/show_bug.cgi?id=147964
+ <rdar://problem/22256660>
+
+ Reviewed by Dean Jackson.
+
+ Make sure punctuation isn't vertical.
+
+ * fast/text/system-font-punctuation.html: Added.
+ * platform/ios-simulator/fast/text/system-font-punctuation-expected.txt: Added
+ * platform/mac/fast/text/system-font-punctuation-expected.txt: Added
+
+2016-01-20 Babak Shafiei <[email protected]>
+
Merge r188263.
2015-08-11 Myles C. Maxfield <[email protected]>
Copied: branches/safari-601-branch/LayoutTests/fast/text/system-font-punctuation.html (from rev 188377, trunk/LayoutTests/fast/text/system-font-punctuation.html) (0 => 195403)
--- branches/safari-601-branch/LayoutTests/fast/text/system-font-punctuation.html (rev 0)
+++ branches/safari-601-branch/LayoutTests/fast/text/system-font-punctuation.html 2016-01-21 07:58:28 UTC (rev 195403)
@@ -0,0 +1,7 @@
+<!DOCTYPE>
+<html>
+<body>
+This test makes sure punctuation laid out with the system font does not use vertical glyphs. The test passes if the semicolon below looks like a regular horizontal semicolon (;) and is not sideways.
+<div style="font: 50px UICTFontTextStyleBody;">;</div>
+</body>
+</html>
Copied: branches/safari-601-branch/LayoutTests/platform/ios-simulator/fast/text/system-font-punctuation-expected.txt (from rev 188377, trunk/LayoutTests/platform/ios-simulator/fast/text/system-font-punctuation-expected.txt) (0 => 195403)
--- branches/safari-601-branch/LayoutTests/platform/ios-simulator/fast/text/system-font-punctuation-expected.txt (rev 0)
+++ branches/safari-601-branch/LayoutTests/platform/ios-simulator/fast/text/system-font-punctuation-expected.txt 2016-01-21 07:58:28 UTC (rev 195403)
@@ -0,0 +1,12 @@
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+ RenderBlock {HTML} at (0,0) size 800x600
+ RenderBody {BODY} at (8,8) size 784x584
+ RenderBlock (anonymous) at (0,0) size 784x40
+ RenderText {#text} at (0,0) size 720x39
+ text run at (0,0) width 720: "This test makes sure punctuation laid out with the system font does not use vertical glyphs. The test passes if the"
+ text run at (0,20) width 527: "semicolon below looks like a regular horizontal semicolon (;) and is not sideways."
+ RenderBlock {DIV} at (0,40) size 784x62
+ RenderText {#text} at (0,0) size 14x61
+ text run at (0,0) width 14: ";"
Modified: branches/safari-601-branch/Source/WebCore/ChangeLog (195402 => 195403)
--- branches/safari-601-branch/Source/WebCore/ChangeLog 2016-01-21 07:57:07 UTC (rev 195402)
+++ branches/safari-601-branch/Source/WebCore/ChangeLog 2016-01-21 07:58:28 UTC (rev 195403)
@@ -1,5 +1,49 @@
2016-01-20 Babak Shafiei <[email protected]>
+ Merge r188377.
+
+ 2015-08-12 Myles C. Maxfield <[email protected]>
+
+ [Cocoa] [CJK-configured device] System font has vertical punctuation
+ https://bugs.webkit.org/show_bug.cgi?id=147964
+ <rdar://problem/22256660>
+
+ Reviewed by Dean Jackson.
+
+ GlyphPage::fill() has multiple code paths to accomplish its goal. It uses the shouldUseCoreText() helper
+ function to determine which one of the paths should be taken. However, not all of the code paths in
+ GlyphPage::fill() are able of handling all situations. Indeed, the CoreText code paths in GlyphPage::fill()
+ are only able to handle the situations which shouldUseCoreText() returns true for. This happens in the
+ following cases:
+
+ 1. If the font is a composite font
+ 2. If the font is used for text-combine
+ 3. If the font has vertical glyphs
+
+ In r187693, I added one more case to this list: If the font is the system font. However, I failed to add
+ the necessary support to GlyphPage::fill() for this case. Becasue of this, we just happened to fall into
+ the case of vertical fonts (just by coincidence), which causes us to use
+ CTFontGetVerticalGlyphsForCharacters() instead of CTFontGetGlyphsForCharacters().
+
+ The solution is to adopt the same behavior we were using before r187693. Back then, we were using
+ CGFontGetGlyphsForUnichars(), which always returned horizontal glyphs. We should simply adopt this same
+ behavior, except in the Core Text case. Therefore, this patch is just a simple check to see if we are
+ using the system font when determining which Core Text function to use.
+
+ Test: fast/text/system-font-punctuation.html
+
+ * platform/graphics/FontDescription.h:
+ (WebCore::FontDescription::setWidthVariant):
+ * platform/graphics/FontPlatformData.h:
+ (WebCore::FontPlatformData::isForTextCombine):
+ * platform/graphics/mac/GlyphPageMac.cpp:
+ (WebCore::shouldUseCoreText):
+ (WebCore::GlyphPage::fill):
+ * rendering/RenderCombineText.cpp:
+ (WebCore::RenderCombineText::combineText):
+
+2016-01-20 Babak Shafiei <[email protected]>
+
Merge r188263.
2015-08-11 Myles C. Maxfield <[email protected]>
Modified: branches/safari-601-branch/Source/WebCore/platform/graphics/FontDescription.h (195402 => 195403)
--- branches/safari-601-branch/Source/WebCore/platform/graphics/FontDescription.h 2016-01-21 07:57:07 UTC (rev 195402)
+++ branches/safari-601-branch/Source/WebCore/platform/graphics/FontDescription.h 2016-01-21 07:58:28 UTC (rev 195403)
@@ -177,7 +177,7 @@
void setIsSpecifiedFont(bool isSpecifiedFont) { m_isSpecifiedFont = isSpecifiedFont; }
void setOrientation(FontOrientation orientation) { m_orientation = orientation; }
void setNonCJKGlyphOrientation(NonCJKGlyphOrientation orientation) { m_nonCJKGlyphOrientation = orientation; }
- void setWidthVariant(FontWidthVariant widthVariant) { m_widthVariant = widthVariant; }
+ void setWidthVariant(FontWidthVariant widthVariant) { m_widthVariant = widthVariant; } // Make sure new callers of this sync with FontPlatformData::isForTextCombine()!
void setScript(UScriptCode s) { m_script = s; }
void setFeatureSettings(FontFeatureSettings&& settings) { m_featureSettings = WTF::move(settings); }
void setFontSynthesis(FontSynthesis fontSynthesis) { m_fontSynthesis = fontSynthesis; }
Modified: branches/safari-601-branch/Source/WebCore/platform/graphics/FontPlatformData.h (195402 => 195403)
--- branches/safari-601-branch/Source/WebCore/platform/graphics/FontPlatformData.h 2016-01-21 07:57:07 UTC (rev 195402)
+++ branches/safari-601-branch/Source/WebCore/platform/graphics/FontPlatformData.h 2016-01-21 07:58:28 UTC (rev 195403)
@@ -135,6 +135,7 @@
bool isCompositeFontReference() const { return m_isCompositeFontReference; }
FontOrientation orientation() const { return m_orientation; }
FontWidthVariant widthVariant() const { return m_widthVariant; }
+ bool isForTextCombine() const { return widthVariant() != RegularWidth; } // Keep in sync with callers of FontDescription::setWidthVariant().
void setOrientation(FontOrientation orientation) { m_orientation = orientation; }
void setSyntheticOblique(bool syntheticOblique) { m_syntheticOblique = syntheticOblique; }
Modified: branches/safari-601-branch/Source/WebCore/platform/graphics/mac/GlyphPageMac.cpp (195402 => 195403)
--- branches/safari-601-branch/Source/WebCore/platform/graphics/mac/GlyphPageMac.cpp 2016-01-21 07:57:07 UTC (rev 195402)
+++ branches/safari-601-branch/Source/WebCore/platform/graphics/mac/GlyphPageMac.cpp 2016-01-21 07:58:28 UTC (rev 195403)
@@ -42,9 +42,12 @@
static bool shouldUseCoreText(const UChar* buffer, unsigned bufferLength, const Font* fontData)
{
+ // This needs to be kept in sync with GlyphPage::fill(). Currently, the CoreText paths are not able to handle
+ // every situtation. Returning true from this function in a new situation will require you to explicitly add
+ // handling for that situation in the CoreText paths of GlyphPage::fill().
if (fontData->platformData().isCompositeFontReference() || fontData->isSystemFont())
return true;
- if (fontData->platformData().widthVariant() != RegularWidth || fontData->hasVerticalGlyphs()) {
+ if (fontData->platformData().isForTextCombine() || fontData->hasVerticalGlyphs()) {
// Ideographs don't have a vertical variant or width variants.
for (unsigned i = 0; i < bufferLength; ++i) {
if (!FontCascade::isCJKIdeograph(buffer[i]))
@@ -88,10 +91,12 @@
}
}
} else if (!fontData->platformData().isCompositeFontReference()) {
- if (fontData->platformData().widthVariant() == RegularWidth)
+ // Because we know the implementation of shouldUseCoreText(), if the font isn't for text combine and it isn't a system font,
+ // we know it must have vertical glyphs.
+ if (fontData->platformData().isForTextCombine() || fontData->isSystemFont())
+ CTFontGetGlyphsForCharacters(fontData->platformData().ctFont(), buffer, glyphs.data(), bufferLength);
+ else
CTFontGetVerticalGlyphsForCharacters(fontData->platformData().ctFont(), buffer, glyphs.data(), bufferLength);
- else
- CTFontGetGlyphsForCharacters(fontData->platformData().ctFont(), buffer, glyphs.data(), bufferLength);
// When buffer consists of surrogate pairs, CTFontGetVerticalGlyphsForCharacters and CTFontGetGlyphsForCharacters
// place the glyphs at indices corresponding to the first character of each pair.
ASSERT(!(bufferLength % length) && (bufferLength / length == 1 || bufferLength / length == 2));
Modified: branches/safari-601-branch/Source/WebCore/rendering/RenderCombineText.cpp (195402 => 195403)
--- branches/safari-601-branch/Source/WebCore/rendering/RenderCombineText.cpp 2016-01-21 07:57:07 UTC (rev 195402)
+++ branches/safari-601-branch/Source/WebCore/rendering/RenderCombineText.cpp 2016-01-21 07:58:28 UTC (rev 195403)
@@ -117,7 +117,7 @@
// Need to try compressed glyphs.
static const FontWidthVariant widthVariants[] = { HalfWidth, ThirdWidth, QuarterWidth };
for (size_t i = 0 ; i < WTF_ARRAY_LENGTH(widthVariants) ; ++i) {
- description.setWidthVariant(widthVariants[i]);
+ description.setWidthVariant(widthVariants[i]); // When modifying this, make sure to keep it in sync with FontPlatformData::isForTextCombine()!
FontCascade compressedFont(description, style().fontCascade().letterSpacing(), style().fontCascade().wordSpacing());
compressedFont.update(fontSelector);