- Revision
- 218524
- Author
- mmaxfi...@apple.com
- Date
- 2017-06-19 19:28:18 -0700 (Mon, 19 Jun 2017)
Log Message
[Cocoa] The system Japanese font cannot be italicized
https://bugs.webkit.org/show_bug.cgi?id=173300
<rdar://problem/31805407>
Reviewed by Ryosuke Niwa.
Source/WebCore:
Items in the system font cascade list may lie about whether or not they support italics.
In order to get the truth, we need to use the physical font underlying the font in question,
because this one won't lie. Then, we can interrogate this physical font about its traits
in order to synthesize italics correctly.
Test: fast/text/system-font-japanese-synthetic-italic.html
* platform/graphics/cocoa/FontCacheCoreText.cpp:
(WebCore::lookupFallbackFont):
* platform/graphics/cocoa/FontFamilySpecificationCoreText.cpp:
(WebCore::FontFamilySpecificationCoreText::fontRanges):
LayoutTests:
* fast/text/system-font-japanese-synthetic-italic-expected-mismatch.html: Added.
* fast/text/system-font-japanese-synthetic-italic.html: Added.
* platform/mac/TestExpectations: This codepath doesn't work in El Capitan.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (218523 => 218524)
--- trunk/LayoutTests/ChangeLog 2017-06-20 01:47:00 UTC (rev 218523)
+++ trunk/LayoutTests/ChangeLog 2017-06-20 02:28:18 UTC (rev 218524)
@@ -1,3 +1,15 @@
+2017-06-19 Myles C. Maxfield <mmaxfi...@apple.com>
+
+ [Cocoa] The system Japanese font cannot be italicized
+ https://bugs.webkit.org/show_bug.cgi?id=173300
+ <rdar://problem/31805407>
+
+ Reviewed by Ryosuke Niwa.
+
+ * fast/text/system-font-japanese-synthetic-italic-expected-mismatch.html: Added.
+ * fast/text/system-font-japanese-synthetic-italic.html: Added.
+ * platform/mac/TestExpectations: This codepath doesn't work in El Capitan.
+
2017-06-19 Youenn Fablet <you...@apple.com>
Improve debugging ability of some webrtc tests
Added: trunk/LayoutTests/fast/text/system-font-japanese-synthetic-italic-expected-mismatch.html (0 => 218524)
--- trunk/LayoutTests/fast/text/system-font-japanese-synthetic-italic-expected-mismatch.html (rev 0)
+++ trunk/LayoutTests/fast/text/system-font-japanese-synthetic-italic-expected-mismatch.html 2017-06-20 02:28:18 UTC (rev 218524)
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+</head>
+<body>
+This test makes sure that the Japanese system font can be italicized. The test passes if the character below is oblique (either because the font supports it or because WebKit synthesizes the oblique).
+<div style="font: 100px 'system-ui';">の</div>
+</body>
+</html>
Added: trunk/LayoutTests/fast/text/system-font-japanese-synthetic-italic.html (0 => 218524)
--- trunk/LayoutTests/fast/text/system-font-japanese-synthetic-italic.html (rev 0)
+++ trunk/LayoutTests/fast/text/system-font-japanese-synthetic-italic.html 2017-06-20 02:28:18 UTC (rev 218524)
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+</head>
+<body>
+This test makes sure that the Japanese system font can be italicized. The test passes if the character below is oblique (either because the font supports it or because WebKit synthesizes the oblique).
+<div style="font: 100px 'system-ui'; font-style: italic;">の</div>
+</body>
+</html>
Modified: trunk/LayoutTests/platform/mac/TestExpectations (218523 => 218524)
--- trunk/LayoutTests/platform/mac/TestExpectations 2017-06-20 01:47:00 UTC (rev 218523)
+++ trunk/LayoutTests/platform/mac/TestExpectations 2017-06-20 02:28:18 UTC (rev 218524)
@@ -1605,3 +1605,4 @@
webkit.org/b/173487 imported/w3c/web-platform-tests/IndexedDB/large-nested-cloning.html [ Pass Failure ]
+webkit.org/b/313156 [ ElCapitan ] fast/text/system-font-japanese-synthetic-italic.html [ ImageOnlyFailure ]
Modified: trunk/Source/WebCore/ChangeLog (218523 => 218524)
--- trunk/Source/WebCore/ChangeLog 2017-06-20 01:47:00 UTC (rev 218523)
+++ trunk/Source/WebCore/ChangeLog 2017-06-20 02:28:18 UTC (rev 218524)
@@ -1,3 +1,23 @@
+2017-06-19 Myles C. Maxfield <mmaxfi...@apple.com>
+
+ [Cocoa] The system Japanese font cannot be italicized
+ https://bugs.webkit.org/show_bug.cgi?id=173300
+ <rdar://problem/31805407>
+
+ Reviewed by Ryosuke Niwa.
+
+ Items in the system font cascade list may lie about whether or not they support italics.
+ In order to get the truth, we need to use the physical font underlying the font in question,
+ because this one won't lie. Then, we can interrogate this physical font about its traits
+ in order to synthesize italics correctly.
+
+ Test: fast/text/system-font-japanese-synthetic-italic.html
+
+ * platform/graphics/cocoa/FontCacheCoreText.cpp:
+ (WebCore::lookupFallbackFont):
+ * platform/graphics/cocoa/FontFamilySpecificationCoreText.cpp:
+ (WebCore::FontFamilySpecificationCoreText::fontRanges):
+
2017-06-19 Daewoong Jang <daewoong.j...@navercorp.com>
[cURL] Move file scope static variables into function scopes
Modified: trunk/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp (218523 => 218524)
--- trunk/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp 2017-06-20 01:47:00 UTC (rev 218523)
+++ trunk/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp 2017-06-20 02:28:18 UTC (rev 218524)
@@ -1292,7 +1292,12 @@
#endif
CFIndex coveredLength = 0;
- auto result = adoptCF(CTFontCreateForCharactersWithLanguage(font, characters, length, localeString.get(), &coveredLength));
+ RetainPtr<CTFontRef> result;
+#if USE_PLATFORM_SYSTEM_FALLBACK_LIST || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101200)
+ result = adoptCF(CTFontCreateForCharactersWithLanguage(font, characters, length, localeString.get(), &coveredLength));
+#else
+ result = adoptCF(CTFontCreatePhysicalFontForCharactersWithLanguage(font, characters, length, localeString.get(), &coveredLength));
+#endif
#if PLATFORM(IOS)
// Callers of this function won't include multiple code points. "Length" is to know how many code units
Modified: trunk/Source/WebCore/platform/graphics/cocoa/FontFamilySpecificationCoreText.cpp (218523 => 218524)
--- trunk/Source/WebCore/platform/graphics/cocoa/FontFamilySpecificationCoreText.cpp 2017-06-20 01:47:00 UTC (rev 218523)
+++ trunk/Source/WebCore/platform/graphics/cocoa/FontFamilySpecificationCoreText.cpp 2017-06-20 02:28:18 UTC (rev 218524)
@@ -28,8 +28,14 @@
#include "FontCache.h"
#include "FontSelector.h"
+#include "SoftLinking.h"
#include <CoreText/CoreText.h>
+#if USE_PLATFORM_SYSTEM_FALLBACK_LIST
+SOFT_LINK_FRAMEWORK(CoreText);
+SOFT_LINK_MAY_FAIL(CoreText, CTFontCopyPhysicalFont, CTFontRef, (CTFontRef font), (font));
+#endif
+
namespace WebCore {
FontFamilySpecificationCoreText::FontFamilySpecificationCoreText(CTFontDescriptorRef fontDescriptor)
@@ -47,10 +53,18 @@
auto font = adoptCF(CTFontCreateWithFontDescriptor(m_fontDescriptor.get(), size, nullptr));
+ auto fontForSynthesisComputation = font;
+#if USE_PLATFORM_SYSTEM_FALLBACK_LIST
+ if (canLoadCTFontCopyPhysicalFont()) {
+ if (auto physicalFont = adoptCF(CTFontCopyPhysicalFont(font.get())))
+ fontForSynthesisComputation = physicalFont;
+ }
+#endif
+
font = preparePlatformFont(font.get(), fontDescription, nullptr, nullptr, { }, fontDescription.computedSize());
bool syntheticBold, syntheticOblique;
- std::tie(syntheticBold, syntheticOblique) = computeNecessarySynthesis(font.get(), fontDescription).boldObliquePair();
+ std::tie(syntheticBold, syntheticOblique) = computeNecessarySynthesis(fontForSynthesisComputation.get(), fontDescription).boldObliquePair();
FontPlatformData fontPlatformData(font.get(), size, syntheticBold, syntheticOblique, fontDescription.orientation(), fontDescription.widthVariant(), fontDescription.textRenderingMode());