Title: [190491] branches/safari-601-branch

Diff

Modified: branches/safari-601-branch/LayoutTests/ChangeLog (190490 => 190491)


--- branches/safari-601-branch/LayoutTests/ChangeLog	2015-10-02 13:56:34 UTC (rev 190490)
+++ branches/safari-601-branch/LayoutTests/ChangeLog	2015-10-02 13:56:41 UTC (rev 190491)
@@ -1,5 +1,26 @@
 2015-10-02  Matthew Hanson  <[email protected]>
 
+        Merge r188634. rdar://problem/22802013
+
+    2015-08-18  Myles C. Maxfield  <[email protected]>
+
+            [Cocoa] Punctuation near Hindi text is garbled when styled with the system font
+            https://bugs.webkit.org/show_bug.cgi?id=148164
+
+            Reviewed by Brian Burg.
+
+            This test is only relevant when the system font is set to Japanese or Simplified Chinese. In these
+            languages, the system font doesn't support punctuation, but CG will erroneously say that it does.
+
+            I intend to implement testing infrastructure which will allow us to mock the system language,
+            thereby allowing this test to be valid on all machines. The tracking bug for this effort is
+            https://bugs.webkit.org/show_bug.cgi?id=148168
+
+            * fast/text/hindi-system-font-punctuation-expected.html: Added.
+            * fast/text/hindi-system-font-punctuation.html: Added.
+
+2015-10-02  Matthew Hanson  <[email protected]>
+
         Merge r187921. rdar://problem/22801988
 
     2015-08-04  Chris Dumez  <[email protected]>

Added: branches/safari-601-branch/LayoutTests/fast/text/hindi-system-font-punctuation-expected.html (0 => 190491)


--- branches/safari-601-branch/LayoutTests/fast/text/hindi-system-font-punctuation-expected.html	                        (rev 0)
+++ branches/safari-601-branch/LayoutTests/fast/text/hindi-system-font-punctuation-expected.html	2015-10-02 13:56:41 UTC (rev 190491)
@@ -0,0 +1,11 @@
+<html>
+<body style="font-family: -apple-system; text-rendering: optimizeSpeed;">
+This test makes sure that punctuation next to Hindi characters are rendered as expected when the system language is set to Japanese.
+The test passes when the character below looks like a "(" character.
+<div style="overflow: hidden; width: 40px; height: 400px;">
+<div style="width: 1000px; height: 1000px;">
+<div style="font-size: 200px;">(<span style="display: inline-block; height: 300px; width: 300px;"></span></div>
+</div>
+</div>
+</body>
+</html>

Added: branches/safari-601-branch/LayoutTests/fast/text/hindi-system-font-punctuation.html (0 => 190491)


--- branches/safari-601-branch/LayoutTests/fast/text/hindi-system-font-punctuation.html	                        (rev 0)
+++ branches/safari-601-branch/LayoutTests/fast/text/hindi-system-font-punctuation.html	2015-10-02 13:56:41 UTC (rev 190491)
@@ -0,0 +1,11 @@
+<html>
+<body style="font-family: -apple-system; text-rendering: optimizeSpeed;">
+This test makes sure that punctuation next to Hindi characters are rendered as expected when the system language is set to Japanese.
+The test passes when the character below looks like a "(" character.
+<div style="overflow: hidden; width: 40px; height: 400px;"><!-- Covers up the "&#x928;)" -->
+<div style="width: 1000px; height: 1000px;">
+<div style="font-size: 200px;">(&#x928;)<span style="display: inline-block; height: 300px; width: 300px;"></span></div>
+</div>
+</div>
+</body>
+</html>

Modified: branches/safari-601-branch/Source/WebCore/ChangeLog (190490 => 190491)


--- branches/safari-601-branch/Source/WebCore/ChangeLog	2015-10-02 13:56:34 UTC (rev 190490)
+++ branches/safari-601-branch/Source/WebCore/ChangeLog	2015-10-02 13:56:41 UTC (rev 190491)
@@ -1,5 +1,39 @@
 2015-10-02  Matthew Hanson  <[email protected]>
 
+        Merge r188634. rdar://problem/22802013
+
+    2015-08-18  Myles C. Maxfield  <[email protected]>
+
+            [Cocoa] Punctuation near Hindi text is garbled when styled with the system font
+            https://bugs.webkit.org/show_bug.cgi?id=148164
+
+            Reviewed by Brian Burg.
+
+            Fonts cache whether or not they are the system font. This caching took place at the end of Font::platformInit().
+            However, in the middle of Font::platformInit(), we look up a glyph, which calls GlyphPage::fill() which consults
+            with this cache. However, at this point, the cache has not been constructed yet. The solution is just to
+            construct the cache earlier (at the beginning of the function).
+
+            Consulting with the cache before it is populated causes it to erroneously say that no fonts are system fonts.
+            Then, we use Core Graphics to ask for glyphs instead of Core Text. Core Graphics, however, is incapable of
+            handling the system font, and returns us garbled results. In particular, when the system language is set to
+            Japanese, the system font does not support punctuation, and Core Text tells us so. However, Core Graphics
+            erroneously tells us that the system font does support punctuation.
+
+            Then, if text is near the punctuation which causes us to take the complex text codepath (such as Hindi text),
+            we tell Core Text to explicitly lay out the punctuation using the system font (which does not support
+            punctuation). Core Text then replies that the provided font doesn't support the punctuation, and that we should
+            use LastResort with some other glyphs instead. WebKit then disregards the font CoreText told us to use (because
+            we are oh-so-sure that the font in question supports punctuation) and uses the LastResort glyph IDs with our
+            font, which causes arbitrary glyphs to be shown.
+
+            Test: fast/text/hindi-system-font-punctuation.html
+
+            * platform/graphics/cocoa/FontCocoa.mm:
+            (WebCore::Font::platformInit):
+
+2015-10-02  Matthew Hanson  <[email protected]>
+
         Merge r188622. rdar://problem/22802016
 
     2015-08-18  Dean Jackson  <[email protected]>

Modified: branches/safari-601-branch/Source/WebCore/platform/graphics/cocoa/FontCocoa.mm (190490 => 190491)


--- branches/safari-601-branch/Source/WebCore/platform/graphics/cocoa/FontCocoa.mm	2015-10-02 13:56:34 UTC (rev 190490)
+++ branches/safari-601-branch/Source/WebCore/platform/graphics/cocoa/FontCocoa.mm	2015-10-02 13:56:41 UTC (rev 190491)
@@ -93,6 +93,7 @@
 
 void Font::platformInit()
 {
+    // FIXME: Unify these two codepaths
 #if USE(APPKIT)
     m_syntheticBoldOffset = m_platformData.m_syntheticBold ? 1.0f : 0.f;
 
@@ -149,6 +150,8 @@
         LOG_ERROR("failed to set up font, using system font %s", m_platformData.font());
     }
 
+    m_isSystemFont = CTFontDescriptorIsSystemUIFont(adoptCF(CTFontCopyFontDescriptor(m_platformData.font())).get());
+
     // Work around <rdar://problem/19433490>
     CGGlyph dummyGlyphs[] = {0, 0};
     CGSize dummySize[] = { CGSizeMake(0, 0), CGSizeMake(0, 0) };
@@ -215,7 +218,10 @@
     m_fontMetrics.setCapHeight(capHeight);
     m_fontMetrics.setLineGap(lineGap);
     m_fontMetrics.setXHeight(xHeight);
+
 #else
+
+    m_isSystemFont = CTFontDescriptorIsSystemUIFont(adoptCF(CTFontCopyFontDescriptor(m_platformData.font())).get());
     m_syntheticBoldOffset = m_platformData.m_syntheticBold ? ceilf(m_platformData.size()  / 24.0f) : 0.f;
     m_spaceGlyph = 0;
     m_spaceWidth = 0;
@@ -238,6 +244,7 @@
         unitsPerEm = fontService.unitsPerEm();
         familyName = adoptCF(CTFontCopyFamilyName(ctFont));
     } else {
+        // FIXME: This else block is dead code. Remove it.
         CGFontRef cgFont = m_platformData.cgFont();
 
         unitsPerEm = CGFontGetUnitsPerEm(cgFont);
@@ -272,8 +279,6 @@
         m_fontMetrics.setLineGap(thirdOfSize);
     }
 #endif
-
-    m_isSystemFont = CTFontDescriptorIsSystemUIFont(adoptCF(CTFontCopyFontDescriptor(m_platformData.font())).get());
 }
 
 void Font::platformCharWidthInit()
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to