Title: [215159] trunk
- Revision
- 215159
- Author
- mmaxfi...@apple.com
- Date
- 2017-04-08 20:32:21 -0700 (Sat, 08 Apr 2017)
Log Message
[Variation Fonts] Width values of GX fonts are not mapped correctly
https://bugs.webkit.org/show_bug.cgi?id=170367
Reviewed by Simon Fraser.
Source/WebCore:
For some reason, when I performed my calculations for how to map the 'wdth' axis of GX-style
variation fonts, I thought that font-stretch: 100% should map to a variation value of 0.0.
Instead, this should map to 1.0.
Test: fast/text/variations/gx-width.html
* platform/graphics/cocoa/FontCacheCoreText.cpp:
(WebCore::denormalizeSlope):
(WebCore::denormalizeVariationWidth):
(WebCore::normalizeVariationWidth):
(WebCore::normalizeWidth):
(WebCore::preparePlatformFont):
(WebCore::variationCapabilitiesForFontDescriptor):
(WebCore::denormalizeWidth): Deleted.
LayoutTests:
* fast/text/variations/font-selection-properties-expected.html:
* fast/text/variations/gx-width-expected.html: Added.
* fast/text/variations/gx-width.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (215158 => 215159)
--- trunk/LayoutTests/ChangeLog 2017-04-09 02:51:19 UTC (rev 215158)
+++ trunk/LayoutTests/ChangeLog 2017-04-09 03:32:21 UTC (rev 215159)
@@ -1,3 +1,14 @@
+2017-04-08 Myles C. Maxfield <mmaxfi...@apple.com>
+
+ [Variation Fonts] Width values of GX fonts are not mapped correctly
+ https://bugs.webkit.org/show_bug.cgi?id=170367
+
+ Reviewed by Simon Fraser.
+
+ * fast/text/variations/font-selection-properties-expected.html:
+ * fast/text/variations/gx-width-expected.html: Added.
+ * fast/text/variations/gx-width.html: Added.
+
2017-04-08 Said Abou-Hallawa <sabouhall...@apple.com>
A synchronous DecodingOptions should be compatible with any asynchronous sizeForDrawing DecodingOptions
Modified: trunk/LayoutTests/fast/text/variations/font-selection-properties-expected.html (215158 => 215159)
--- trunk/LayoutTests/fast/text/variations/font-selection-properties-expected.html 2017-04-09 02:51:19 UTC (rev 215158)
+++ trunk/LayoutTests/fast/text/variations/font-selection-properties-expected.html 2017-04-09 03:32:21 UTC (rev 215159)
@@ -10,7 +10,7 @@
</head>
<body>
This test makes sure that the font selection properties affect font variations.
-<div style="font-family: Boxis; font-variation-settings: 'wdth' 5.6666;">Hello</div>
+<div style="font-family: Boxis; font-variation-settings: 'wdth' 3.25;">Hello</div>
<div style="font-family: Boxis; font-variation-settings: 'wdth' 100;">Hello</div>
</body>
</html>
Added: trunk/LayoutTests/fast/text/variations/gx-width-expected.html (0 => 215159)
--- trunk/LayoutTests/fast/text/variations/gx-width-expected.html (rev 0)
+++ trunk/LayoutTests/fast/text/variations/gx-width-expected.html 2017-04-09 03:32:21 UTC (rev 215159)
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+This test makes sure that the default width maps to a value of 1 on a GX-style variation font's 'wdth' axis.
+<div style="font: 100px 'Skia'; font-variation-settings: 'wdth' 1;">Hello</div>
+</body>
+</html>
\ No newline at end of file
Added: trunk/LayoutTests/fast/text/variations/gx-width.html (0 => 215159)
--- trunk/LayoutTests/fast/text/variations/gx-width.html (rev 0)
+++ trunk/LayoutTests/fast/text/variations/gx-width.html 2017-04-09 03:32:21 UTC (rev 215159)
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+This test makes sure that the default width maps to a value of 1 on a GX-style variation font's 'wdth' axis.
+<div style="font: 100px 'Skia';">Hello</div>
+</body>
+</html>
\ No newline at end of file
Modified: trunk/Source/WebCore/ChangeLog (215158 => 215159)
--- trunk/Source/WebCore/ChangeLog 2017-04-09 02:51:19 UTC (rev 215158)
+++ trunk/Source/WebCore/ChangeLog 2017-04-09 03:32:21 UTC (rev 215159)
@@ -1,3 +1,25 @@
+2017-04-08 Myles C. Maxfield <mmaxfi...@apple.com>
+
+ [Variation Fonts] Width values of GX fonts are not mapped correctly
+ https://bugs.webkit.org/show_bug.cgi?id=170367
+
+ Reviewed by Simon Fraser.
+
+ For some reason, when I performed my calculations for how to map the 'wdth' axis of GX-style
+ variation fonts, I thought that font-stretch: 100% should map to a variation value of 0.0.
+ Instead, this should map to 1.0.
+
+ Test: fast/text/variations/gx-width.html
+
+ * platform/graphics/cocoa/FontCacheCoreText.cpp:
+ (WebCore::denormalizeSlope):
+ (WebCore::denormalizeVariationWidth):
+ (WebCore::normalizeVariationWidth):
+ (WebCore::normalizeWidth):
+ (WebCore::preparePlatformFont):
+ (WebCore::variationCapabilitiesForFontDescriptor):
+ (WebCore::denormalizeWidth): Deleted.
+
2017-04-08 Eric Carlson <eric.carl...@apple.com>
[MediaStream Mac] Revert change of Mac video capture format
Modified: trunk/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp (215158 => 215159)
--- trunk/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp 2017-04-09 02:51:19 UTC (rev 215158)
+++ trunk/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp 2017-04-09 03:32:21 UTC (rev 215159)
@@ -464,25 +464,36 @@
return (value + 109.3) / 523.7;
}
-static inline float denormalizeWidth(float value)
+static inline float denormalizeSlope(float value)
{
- if (value < 125)
- return (value - 100) / 50;
- return (value - 50) / 150;
+ return value / 300;
}
-static inline float denormalizeSlope(float value)
+static inline float denormalizeVariationWidth(float value)
{
- return value / 300;
+ if (value <= 125)
+ return value / 100;
+ if (value <= 150)
+ return (value + 125) / 200;
+ return (value + 400) / 400;
}
#endif
-#if !HAS_CORE_TEXT_WIDTH_ATTRIBUTE || ENABLE(VARIATION_FONTS)
+#if ENABLE(VARIATION_FONTS) || !HAS_CORE_TEXT_WIDTH_ATTRIBUTE
+static inline float normalizeVariationWidth(float value)
+{
+ if (value <= 1.25)
+ return value * 100;
+ if (value <= 1.375)
+ return value * 200 - 125;
+ return value * 400 - 400;
+}
+#endif
+
+#if !HAS_CORE_TEXT_WIDTH_ATTRIBUTE
static inline float normalizeWidth(float value)
{
- if (value < 0.5)
- return value * 50 + 100;
- return value * 150 + 50;
+ return normalizeVariationWidth(value + 1);
}
#endif
@@ -569,7 +580,7 @@
float slope = fontSelectionRequest.slope;
if (needsConversion) {
weight = denormalizeWeight(weight);
- width = denormalizeWidth(width);
+ width = denormalizeVariationWidth(width);
slope = denormalizeSlope(slope);
}
applyVariation({{'w', 'g', 'h', 't'}}, weight);
@@ -964,7 +975,7 @@
if (result.weight)
result.weight = {{ normalizeWeight(result.weight.value().minimum), normalizeWeight(result.weight.value().maximum) }};
if (result.width)
- result.width = {{ normalizeWidth(result.width.value().minimum), normalizeWidth(result.width.value().maximum) }};
+ result.width = {{ normalizeVariationWidth(result.width.value().minimum), normalizeVariationWidth(result.width.value().maximum) }};
if (result.slope)
result.slope = {{ normalizeSlope(result.slope.value().minimum), normalizeSlope(result.slope.value().maximum) }};
}
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes