Changeset 215159 in webkit
- Timestamp:
- Apr 8, 2017 8:32:21 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r215157 r215159 1 2017-04-08 Myles C. Maxfield <mmaxfield@apple.com> 2 3 [Variation Fonts] Width values of GX fonts are not mapped correctly 4 https://bugs.webkit.org/show_bug.cgi?id=170367 5 6 Reviewed by Simon Fraser. 7 8 * fast/text/variations/font-selection-properties-expected.html: 9 * fast/text/variations/gx-width-expected.html: Added. 10 * fast/text/variations/gx-width.html: Added. 11 1 12 2017-04-08 Said Abou-Hallawa <sabouhallawa@apple.com> 2 13 -
trunk/LayoutTests/fast/text/variations/font-selection-properties-expected.html
r214572 r215159 11 11 <body> 12 12 This test makes sure that the font selection properties affect font variations. 13 <div style="font-family: Boxis; font-variation-settings: 'wdth' 5.6666;">Hello</div>13 <div style="font-family: Boxis; font-variation-settings: 'wdth' 3.25;">Hello</div> 14 14 <div style="font-family: Boxis; font-variation-settings: 'wdth' 100;">Hello</div> 15 15 </body> -
trunk/Source/WebCore/ChangeLog
r215158 r215159 1 2017-04-08 Myles C. Maxfield <mmaxfield@apple.com> 2 3 [Variation Fonts] Width values of GX fonts are not mapped correctly 4 https://bugs.webkit.org/show_bug.cgi?id=170367 5 6 Reviewed by Simon Fraser. 7 8 For some reason, when I performed my calculations for how to map the 'wdth' axis of GX-style 9 variation fonts, I thought that font-stretch: 100% should map to a variation value of 0.0. 10 Instead, this should map to 1.0. 11 12 Test: fast/text/variations/gx-width.html 13 14 * platform/graphics/cocoa/FontCacheCoreText.cpp: 15 (WebCore::denormalizeSlope): 16 (WebCore::denormalizeVariationWidth): 17 (WebCore::normalizeVariationWidth): 18 (WebCore::normalizeWidth): 19 (WebCore::preparePlatformFont): 20 (WebCore::variationCapabilitiesForFontDescriptor): 21 (WebCore::denormalizeWidth): Deleted. 22 1 23 2017-04-08 Eric Carlson <eric.carlson@apple.com> 2 24 -
trunk/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp
r214594 r215159 465 465 } 466 466 467 static inline float denormalizeWidth(float value)468 {469 if (value < 125)470 return (value - 100) / 50;471 return (value - 50) / 150;472 }473 474 467 static inline float denormalizeSlope(float value) 475 468 { 476 469 return value / 300; 477 470 } 478 #endif 479 480 #if !HAS_CORE_TEXT_WIDTH_ATTRIBUTE || ENABLE(VARIATION_FONTS) 471 472 static inline float denormalizeVariationWidth(float value) 473 { 474 if (value <= 125) 475 return value / 100; 476 if (value <= 150) 477 return (value + 125) / 200; 478 return (value + 400) / 400; 479 } 480 #endif 481 482 #if ENABLE(VARIATION_FONTS) || !HAS_CORE_TEXT_WIDTH_ATTRIBUTE 483 static inline float normalizeVariationWidth(float value) 484 { 485 if (value <= 1.25) 486 return value * 100; 487 if (value <= 1.375) 488 return value * 200 - 125; 489 return value * 400 - 400; 490 } 491 #endif 492 493 #if !HAS_CORE_TEXT_WIDTH_ATTRIBUTE 481 494 static inline float normalizeWidth(float value) 482 495 { 483 if (value < 0.5) 484 return value * 50 + 100; 485 return value * 150 + 50; 496 return normalizeVariationWidth(value + 1); 486 497 } 487 498 #endif … … 570 581 if (needsConversion) { 571 582 weight = denormalizeWeight(weight); 572 width = denormalize Width(width);583 width = denormalizeVariationWidth(width); 573 584 slope = denormalizeSlope(slope); 574 585 } … … 965 976 result.weight = {{ normalizeWeight(result.weight.value().minimum), normalizeWeight(result.weight.value().maximum) }}; 966 977 if (result.width) 967 result.width = {{ normalize Width(result.width.value().minimum), normalizeWidth(result.width.value().maximum) }};978 result.width = {{ normalizeVariationWidth(result.width.value().minimum), normalizeVariationWidth(result.width.value().maximum) }}; 968 979 if (result.slope) 969 980 result.slope = {{ normalizeSlope(result.slope.value().minimum), normalizeSlope(result.slope.value().maximum) }};
Note: See TracChangeset
for help on using the changeset viewer.