Changeset 217272 in webkit
- Timestamp:
- May 23, 2017 12:37:42 AM (7 years ago)
- Location:
- trunk
- Files:
-
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r217268 r217272 1 2017-05-22 Myles C. Maxfield <mmaxfield@apple.com> 2 3 Update font-style's implementation in the font selection algorithm 4 https://bugs.webkit.org/show_bug.cgi?id=169453 5 6 Reviewed by Simon Fraser. 7 8 * fast/text/font-style-parse-expected.txt: 9 * fast/text/font-style-parse.html: 10 * platform/mac-elcapitan/fast/text/font-style-parse-expected.txt: 11 1 12 2017-05-22 Per Arne Vollan <pvollan@apple.com> 2 13 -
trunk/LayoutTests/fast/text/font-style-parse-expected.txt
r214507 r217272 7 7 PASS window.getComputedStyle(document.getElementById('test7')).fontStyle is "normal" 8 8 PASS window.getComputedStyle(document.getElementById('test8')).fontStyle is "italic" 9 PASS window.getComputedStyle(document.getElementById('test9')).fontStyle is " italic"9 PASS window.getComputedStyle(document.getElementById('test9')).fontStyle is "oblique" 10 10 PASS window.getComputedStyle(document.getElementById('test10')).fontStyle is "normal" 11 11 PASS window.getComputedStyle(document.getElementById('test11')).fontStyle is "normal" … … 20 20 PASS window.getComputedStyle(document.getElementById('test20')).fontStyle is "normal" 21 21 PASS window.getComputedStyle(document.getElementById('test21')).fontStyle is "oblique 14deg" 22 PASS window.getComputedStyle(document.getElementById('test22')).fontStyle is "oblique" 22 23 PASS window.getComputedStyle(document.getElementById('test1')).font is "normal normal normal normal 16px/18px Times" 23 24 PASS window.getComputedStyle(document.getElementById('test2')).font is "16px/18px Times" … … 28 29 PASS window.getComputedStyle(document.getElementById('test7')).font is "normal normal normal normal 16px/18px Times" 29 30 PASS window.getComputedStyle(document.getElementById('test8')).font is "italic normal normal normal 16px/18px Times" 30 PASS window.getComputedStyle(document.getElementById('test9')).font is " italicnormal normal normal 16px/18px Times"31 PASS window.getComputedStyle(document.getElementById('test9')).font is "oblique normal normal normal 16px/18px Times" 31 32 PASS window.getComputedStyle(document.getElementById('test10')).font is "normal normal normal normal 16px/18px Times" 32 33 PASS window.getComputedStyle(document.getElementById('test11')).font is "normal normal normal normal 16px/18px Times" … … 41 42 PASS window.getComputedStyle(document.getElementById('test20')).font is "normal normal normal normal 16px/18px Times" 42 43 PASS window.getComputedStyle(document.getElementById('test21')).font is "48px/49px 'Helvetica Neue'" 44 PASS window.getComputedStyle(document.getElementById('test22')).font is "oblique normal normal normal 16px/18px Times" 43 45 PASS document.getElementById('test1').style.font is "" 44 46 PASS document.getElementById('test15').style.font is "italic 100 48px/49px 'Helvetica Neue'" -
trunk/LayoutTests/fast/text/font-style-parse.html
r214507 r217272 27 27 <div id="test20" style="font: 13deg small-caps 123 extra-expanded 48px/49px 'Helvetica Neue';"></div> 28 28 <div id="test21" style="font: oblique 14deg small-caps 123 extra-expanded 48px/49px 'Helvetica Neue';"></div> 29 <div id="test22" style="font-style: oblique 20deg;"></div> 29 30 </div> 30 31 <script> … … 37 38 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test7')).fontStyle", "normal"); 38 39 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test8')).fontStyle", "italic"); 39 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test9')).fontStyle", " italic");40 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test9')).fontStyle", "oblique"); 40 41 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test10')).fontStyle", "normal"); 41 42 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test11')).fontStyle", "normal"); … … 50 51 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test20')).fontStyle", "normal"); 51 52 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test21')).fontStyle", "oblique 14deg"); 53 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test22')).fontStyle", "oblique"); 52 54 53 55 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test1')).font", "normal normal normal normal 16px/18px Times"); … … 59 61 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test7')).font", "normal normal normal normal 16px/18px Times"); 60 62 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test8')).font", "italic normal normal normal 16px/18px Times"); 61 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test9')).font", " italicnormal normal normal 16px/18px Times");63 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test9')).font", "oblique normal normal normal 16px/18px Times"); 62 64 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test10')).font", "normal normal normal normal 16px/18px Times"); 63 65 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test11')).font", "normal normal normal normal 16px/18px Times"); … … 72 74 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test20')).font", "normal normal normal normal 16px/18px Times"); 73 75 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test21')).font", "48px/49px 'Helvetica Neue'"); 76 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test22')).font", "oblique normal normal normal 16px/18px Times"); 74 77 75 78 shouldBeEqualToString("document.getElementById('test1').style.font", ""); -
trunk/LayoutTests/platform/mac-elcapitan/fast/text/font-style-parse-expected.txt
r214552 r217272 7 7 PASS window.getComputedStyle(document.getElementById('test7')).fontStyle is "normal" 8 8 PASS window.getComputedStyle(document.getElementById('test8')).fontStyle is "italic" 9 PASS window.getComputedStyle(document.getElementById('test9')).fontStyle is " italic"9 PASS window.getComputedStyle(document.getElementById('test9')).fontStyle is "oblique" 10 10 PASS window.getComputedStyle(document.getElementById('test10')).fontStyle is "normal" 11 11 PASS window.getComputedStyle(document.getElementById('test11')).fontStyle is "normal" … … 20 20 PASS window.getComputedStyle(document.getElementById('test20')).fontStyle is "normal" 21 21 FAIL window.getComputedStyle(document.getElementById('test21')).fontStyle should be oblique 14deg. Was normal. 22 FAIL window.getComputedStyle(document.getElementById('test22')).fontStyle should be oblique. Was normal. 22 23 PASS window.getComputedStyle(document.getElementById('test1')).font is "normal normal normal normal 16px/18px Times" 23 24 FAIL window.getComputedStyle(document.getElementById('test2')).font should be 16px/18px Times. Was normal normal normal normal 16px/18px Times. … … 28 29 PASS window.getComputedStyle(document.getElementById('test7')).font is "normal normal normal normal 16px/18px Times" 29 30 PASS window.getComputedStyle(document.getElementById('test8')).font is "italic normal normal normal 16px/18px Times" 30 PASS window.getComputedStyle(document.getElementById('test9')).font is " italicnormal normal normal 16px/18px Times"31 PASS window.getComputedStyle(document.getElementById('test9')).font is "oblique normal normal normal 16px/18px Times" 31 32 PASS window.getComputedStyle(document.getElementById('test10')).font is "normal normal normal normal 16px/18px Times" 32 33 PASS window.getComputedStyle(document.getElementById('test11')).font is "normal normal normal normal 16px/18px Times" … … 41 42 PASS window.getComputedStyle(document.getElementById('test20')).font is "normal normal normal normal 16px/18px Times" 42 43 FAIL window.getComputedStyle(document.getElementById('test21')).font should be 48px/49px 'Helvetica Neue'. Was normal normal normal normal 16px/18px Times. 44 FAIL window.getComputedStyle(document.getElementById('test22')).font should be oblique normal normal normal 16px/18px Times. Was normal normal normal normal 16px/18px Times. 43 45 PASS document.getElementById('test1').style.font is "" 44 46 PASS document.getElementById('test15').style.font is "italic 100 48px/49px 'Helvetica Neue'" -
trunk/Source/WebCore/ChangeLog
r217267 r217272 1 2017-05-22 Myles C. Maxfield <mmaxfield@apple.com> 2 3 Update font-style's implementation in the font selection algorithm 4 https://bugs.webkit.org/show_bug.cgi?id=169453 5 6 Reviewed by Simon Fraser. 7 8 Previously, we were treating "font-style: oblique" exactly the same as "font-style: italic". 9 These values were parsed to the same internal data type. However, variation fonts may have two 10 distinct axes: 'slnt' and 'ital'. Therefore, we need to keep a bool of state which represents 11 which of these two axes we should be setting when we apply font variations. We can do this by 12 making the "font-style" parser a "custom" parser. The implementation of these custom functions 13 will set both the italic value on the FontDescription as well as this extra bool. 14 15 We don't, however, want to treat these values as distinct for the purposese of font selection. 16 The fact that we treat oblique fonts the same as italic fonts is a feature, not a bug. Therefore, 17 the font selection algorithm is not made aware of this distinction. This is why we don't want to 18 package up the bool and FontSelectionValue into a class: font selection only cares about the 19 FontSelectionValue, so conceptually they shouldn't be joined. (The FontSelectionValue already 20 exists within a collection of all the things font selection needs to know about.) 21 22 Now that there is this extra bit of state on the FontDescription, we can do a little better when 23 computing the result of getComputedStyle(). Previously, we were always returning "italic" even 24 when "oblique" was specified. Now, we can return the correct one. However, this extra bit of 25 state is not kept on the CSSFontFace (because it doesn't need to be), which means we can only 26 improve the computed style of an element, rather than the cssText of an @font-face rule. 27 28 Test: fast/text/font-style-parse.html 29 30 * css/CSSComputedStyleDeclaration.cpp: 31 (WebCore::ComputedStyleExtractor::fontStyleFromStyleValue): 32 (WebCore::fontStyleFromStyle): 33 (WebCore::fontShorthandValueForSelectionProperties): 34 * css/CSSComputedStyleDeclaration.h: 35 * css/CSSFontFaceSet.h: 36 * css/CSSProperties.json: 37 * css/FontFace.cpp: 38 (WebCore::FontFace::style): 39 * css/FontSelectionValueInlines.h: 40 (WebCore::fontStyleKeyword): 41 * css/StyleBuilderConverter.h: 42 (WebCore::StyleBuilderConverter::convertFontStyle): Deleted. 43 * css/StyleBuilderCustom.h: 44 (WebCore::StyleBuilderCustom::applyInitialFontStyle): 45 (WebCore::StyleBuilderCustom::applyInheritFontStyle): 46 (WebCore::StyleBuilderCustom::applyValueFontStyle): 47 * platform/graphics/FontCache.h: 48 (WebCore::FontDescriptionKey::makeFlagsKey): 49 * platform/graphics/FontDescription.cpp: 50 (WebCore::FontDescription::FontDescription): 51 * platform/graphics/FontDescription.h: 52 (WebCore::FontDescription::shouldUseItalicVariationAxis): 53 (WebCore::FontDescription::setShouldUseItalicVariationAxis): 54 (WebCore::FontDescription::operator==): 55 (WebCore::FontCascadeDescription::initialShouldUseItalicVariationAxis): 56 * platform/graphics/cocoa/FontCacheCoreText.cpp: 57 (WebCore::preparePlatformFont): 58 (WebCore::fontWithFamily): 59 (WebCore::FontCache::createFontPlatformData): 60 (WebCore::FontCache::systemFallbackForCharacters): 61 * platform/graphics/mac/FontCustomPlatformData.cpp: 62 (WebCore::FontCustomPlatformData::fontPlatformData): 63 1 64 2017-05-22 Myles C. Maxfield <mmaxfield@apple.com> 2 65 -
trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp
r217236 r217272 1968 1968 } 1969 1969 1970 Ref<CSSFontStyleValue> ComputedStyleExtractor::fontStyleFromStyleValue(FontSelectionValue italic )1971 { 1972 if (auto keyword = fontStyleKeyword(italic ))1970 Ref<CSSFontStyleValue> ComputedStyleExtractor::fontStyleFromStyleValue(FontSelectionValue italic, FontStyleAxis fontStyleAxis) 1971 { 1972 if (auto keyword = fontStyleKeyword(italic, fontStyleAxis)) 1973 1973 return CSSFontStyleValue::create(CSSValuePool::singleton().createIdentifierValue(keyword.value())); 1974 1974 return fontNonKeywordStyleFromStyleValue(italic); … … 1977 1977 static Ref<CSSFontStyleValue> fontStyleFromStyle(const RenderStyle& style) 1978 1978 { 1979 return ComputedStyleExtractor::fontStyleFromStyleValue(style.fontDescription().italic() );1979 return ComputedStyleExtractor::fontStyleFromStyleValue(style.fontDescription().italic(), style.fontDescription().fontStyleAxis()); 1980 1980 } 1981 1981 … … 2611 2611 return CSSFontValue::create(); 2612 2612 2613 if (auto italic = fontStyleKeyword(fontDescription.italic() ))2613 if (auto italic = fontStyleKeyword(fontDescription.italic(), fontDescription.fontStyleAxis())) 2614 2614 computedFont->style = CSSFontStyleValue::create(CSSValuePool::singleton().createIdentifierValue(italic.value())); 2615 2615 else -
trunk/Source/WebCore/css/CSSComputedStyleDeclaration.h
r214433 r217272 22 22 23 23 #include "CSSStyleDeclaration.h" 24 #include "FontDescription.h" 24 25 #include "RenderStyleConstants.h" 25 26 #include "SVGRenderStyleDefs.h" … … 72 73 static Ref<CSSPrimitiveValue> fontStretchFromStyleValue(FontSelectionValue); 73 74 static Ref<CSSFontStyleValue> fontNonKeywordStyleFromStyleValue(FontSelectionValue); 74 static Ref<CSSFontStyleValue> fontStyleFromStyleValue(FontSelectionValue );75 static Ref<CSSFontStyleValue> fontStyleFromStyleValue(FontSelectionValue, FontStyleAxis); 75 76 76 77 private: -
trunk/Source/WebCore/css/CSSFontFaceSet.h
r214359 r217272 52 52 } 53 53 ~CSSFontFaceSet(); 54 55 static FontSelectionValue convertFontWeightFromValue(const CSSValue&);56 static FontSelectionValue convertFontStretchFromValue(const CSSValue&);57 static FontSelectionValue convertFontStyleFromValue(const CSSValue&);58 54 59 55 void addClient(CSSFontFaceSetClient&); -
trunk/Source/WebCore/css/CSSProperties.json
r217236 r217272 308 308 ], 309 309 "codegen-properties": { 310 " name-for-methods": "Italic",310 "custom": "All", 311 311 "font-property": true, 312 "high-priority": true, 313 "converter": "FontStyle" 312 "high-priority": true 314 313 }, 315 314 "specification": { -
trunk/Source/WebCore/css/FontFace.cpp
r216079 r217272 290 290 auto style = m_backing->italic(); 291 291 292 auto minimum = ComputedStyleExtractor::fontStyleFromStyleValue(style.minimum );293 auto maximum = ComputedStyleExtractor::fontStyleFromStyleValue(style.maximum );292 auto minimum = ComputedStyleExtractor::fontStyleFromStyleValue(style.minimum, FontStyleAxis::ital); 293 auto maximum = ComputedStyleExtractor::fontStyleFromStyleValue(style.maximum, FontStyleAxis::ital); 294 294 295 295 if (minimum.get().equals(maximum.get())) -
trunk/Source/WebCore/css/FontSelectionValueInlines.h
r213464 r217272 122 122 } 123 123 124 inline std::optional<CSSValueID> fontStyleKeyword(FontSelectionValue style )124 inline std::optional<CSSValueID> fontStyleKeyword(FontSelectionValue style, FontStyleAxis axis) 125 125 { 126 126 if (style == normalItalicValue()) 127 127 return CSSValueNormal; 128 128 if (style == italicValue()) 129 return CSSValueItalic;129 return axis == FontStyleAxis::ital ? CSSValueItalic : CSSValueOblique; 130 130 return std::nullopt; 131 131 } -
trunk/Source/WebCore/css/StyleBuilderConverter.h
r214564 r217272 1239 1239 } 1240 1240 1241 inline FontSelectionValue StyleBuilderConverter::convertFontStyle(StyleResolver&, const CSSValue& value)1242 {1243 return convertFontStyleFromValue(value);1244 }1245 1246 1241 #if ENABLE(VARIATION_FONTS) 1247 1242 inline FontVariationSettings StyleBuilderConverter::convertFontVariationSettings(StyleResolver&, const CSSValue& value) -
trunk/Source/WebCore/css/StyleBuilderCustom.h
r215375 r217272 82 82 DECLARE_PROPERTY_CUSTOM_HANDLERS(FontFamily); 83 83 DECLARE_PROPERTY_CUSTOM_HANDLERS(FontSize); 84 DECLARE_PROPERTY_CUSTOM_HANDLERS(FontStyle); 84 85 #if ENABLE(CSS_IMAGE_RESOLUTION) 85 86 DECLARE_PROPERTY_CUSTOM_HANDLERS(ImageResolution); … … 1583 1584 } 1584 1585 1586 inline void StyleBuilderCustom::applyInitialFontStyle(StyleResolver& styleResolver) 1587 { 1588 auto fontDescription = styleResolver.fontDescription(); 1589 fontDescription.setItalic(FontCascadeDescription::initialItalic()); 1590 fontDescription.setFontStyleAxis(FontCascadeDescription::initialFontStyleAxis()); 1591 styleResolver.setFontDescription(fontDescription); 1592 } 1593 1594 inline void StyleBuilderCustom::applyInheritFontStyle(StyleResolver& styleResolver) 1595 { 1596 auto fontDescription = styleResolver.fontDescription(); 1597 fontDescription.setItalic(styleResolver.parentFontDescription().italic()); 1598 fontDescription.setFontStyleAxis(styleResolver.parentFontDescription().fontStyleAxis()); 1599 styleResolver.setFontDescription(fontDescription); 1600 } 1601 1602 inline void StyleBuilderCustom::applyValueFontStyle(StyleResolver& styleResolver, CSSValue& value) 1603 { 1604 auto& fontStyleValue = downcast<CSSFontStyleValue>(value); 1605 auto fontDescription = styleResolver.fontDescription(); 1606 fontDescription.setItalic(StyleBuilderConverter::convertFontStyleFromValue(fontStyleValue)); 1607 fontDescription.setFontStyleAxis(fontStyleValue.fontStyleValue->valueID() == CSSValueItalic ? FontStyleAxis::ital : FontStyleAxis::slnt); 1608 styleResolver.setFontDescription(fontDescription); 1609 } 1610 1585 1611 inline void StyleBuilderCustom::applyValueFontSize(StyleResolver& styleResolver, CSSValue& value) 1586 1612 { -
trunk/Source/WebCore/platform/graphics/FontCache.h
r216944 r217272 123 123 { 124 124 static_assert(USCRIPT_CODE_LIMIT < 0x1000, "Script code must fit in an unsigned along with the other flags"); 125 unsigned first = static_cast<unsigned>(description.script()) << 12 125 unsigned first = static_cast<unsigned>(description.script()) << 13 126 | static_cast<unsigned>(description.fontStyleAxis() == FontStyleAxis::slnt) << 12 126 127 | static_cast<unsigned>(description.opticalSizing()) << 11 127 128 | static_cast<unsigned>(description.textRenderingMode()) << 9 … … 276 277 }; 277 278 278 RetainPtr<CTFontRef> preparePlatformFont(CTFontRef, TextRenderingMode, const FontFeatureSettings* fontFaceFeatures, const FontVariantSettings* fontFaceVariantSettings, FontSelectionSpecifiedCapabilities fontFaceCapabilities, const FontFeatureSettings& features, const FontVariantSettings&, FontSelectionRequest, const FontVariationSettings&, FontOpticalSizing, float size );279 RetainPtr<CTFontRef> preparePlatformFont(CTFontRef, TextRenderingMode, const FontFeatureSettings* fontFaceFeatures, const FontVariantSettings* fontFaceVariantSettings, FontSelectionSpecifiedCapabilities fontFaceCapabilities, const FontFeatureSettings& features, const FontVariantSettings&, FontSelectionRequest, const FontVariationSettings&, FontOpticalSizing, float size, FontStyleAxis); 279 280 SynthesisPair computeNecessarySynthesis(CTFontRef, const FontDescription&, bool isPlatformFont = false); 280 281 RetainPtr<CTFontRef> platformFontWithFamilySpecialCase(const AtomicString& family, FontSelectionRequest, float size); -
trunk/Source/WebCore/platform/graphics/FontDescription.cpp
r214467 r217272 79 79 , m_variantEastAsianRuby(static_cast<unsigned>(FontVariantEastAsianRuby::Normal)) 80 80 , m_opticalSizing(static_cast<unsigned>(FontOpticalSizing::Enabled)) 81 , m_fontStyleAxis(FontCascadeDescription::initialFontStyleAxis() == FontStyleAxis::ital) 81 82 { 82 83 } -
trunk/Source/WebCore/platform/graphics/FontDescription.h
r214364 r217272 97 97 } 98 98 FontOpticalSizing opticalSizing() const { return static_cast<FontOpticalSizing>(m_opticalSizing); } 99 FontStyleAxis fontStyleAxis() const { return m_fontStyleAxis ? FontStyleAxis::ital : FontStyleAxis::slnt; } 99 100 100 101 void setComputedSize(float s) { m_computedSize = clampToFloat(s); } … … 130 131 void setVariantEastAsianRuby(FontVariantEastAsianRuby variant) { m_variantEastAsianRuby = static_cast<unsigned>(variant); } 131 132 void setOpticalSizing(FontOpticalSizing sizing) { m_opticalSizing = static_cast<unsigned>(sizing); } 133 void setFontStyleAxis(FontStyleAxis axis) { m_fontStyleAxis = axis == FontStyleAxis::ital; } 132 134 133 135 private: … … 162 164 unsigned m_variantEastAsianRuby : 1; // FontVariantEastAsianRuby 163 165 unsigned m_opticalSizing : 1; // FontOpticalSizing 166 unsigned m_fontStyleAxis : 1; // Whether "font-style: italic" or "font-style: oblique 20deg" was specified 164 167 }; 165 168 … … 194 197 && m_variantEastAsianWidth == other.m_variantEastAsianWidth 195 198 && m_variantEastAsianRuby == other.m_variantEastAsianRuby 196 && m_opticalSizing == other.m_opticalSizing; 199 && m_opticalSizing == other.m_opticalSizing 200 && m_fontStyleAxis == other.m_fontStyleAxis; 197 201 } 198 202 … … 266 270 // Initial values for font properties. 267 271 static FontSelectionValue initialItalic() { return normalItalicValue(); } 272 static FontStyleAxis initialFontStyleAxis() { return FontStyleAxis::slnt; } 268 273 static FontSelectionValue initialWeight() { return normalWeightValue(); } 269 274 static FontSelectionValue initialStretch() { return normalStretchValue(); } -
trunk/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp
r216217 r217272 498 498 #endif 499 499 500 RetainPtr<CTFontRef> preparePlatformFont(CTFontRef originalFont, TextRenderingMode textRenderingMode, const FontFeatureSettings* fontFaceFeatures, const FontVariantSettings* fontFaceVariantSettings, FontSelectionSpecifiedCapabilities fontFaceCapabilities, const FontFeatureSettings& features, const FontVariantSettings& variantSettings, FontSelectionRequest fontSelectionRequest, const FontVariationSettings& variations, FontOpticalSizing fontOpticalSizing, float size )500 RetainPtr<CTFontRef> preparePlatformFont(CTFontRef originalFont, TextRenderingMode textRenderingMode, const FontFeatureSettings* fontFaceFeatures, const FontVariantSettings* fontFaceVariantSettings, FontSelectionSpecifiedCapabilities fontFaceCapabilities, const FontFeatureSettings& features, const FontVariantSettings& variantSettings, FontSelectionRequest fontSelectionRequest, const FontVariationSettings& variations, FontOpticalSizing fontOpticalSizing, float size, FontStyleAxis axis) 501 501 { 502 502 bool alwaysAddVariations = false; … … 511 511 UNUSED_PARAM(fontFaceCapabilities); 512 512 UNUSED_PARAM(size); 513 UNUSED_PARAM(axis); 513 514 #endif 514 515 … … 593 594 applyVariation({{'w', 'g', 'h', 't'}}, weight); 594 595 applyVariation({{'w', 'd', 't', 'h'}}, width); 595 applyVariation({{'s', 'l', 'n', 't'}}, slope); 596 if (axis == FontStyleAxis::ital) 597 applyVariation({{'i', 't', 'a', 'l'}}, 1); 598 else 599 applyVariation({{'s', 'l', 'n', 't'}}, slope); 596 600 } 597 601 … … 1163 1167 } 1164 1168 1165 static RetainPtr<CTFontRef> fontWithFamily(const AtomicString& family, FontSelectionRequest request, const FontFeatureSettings& featureSettings, const FontVariantSettings& variantSettings, const FontVariationSettings& variationSettings, const FontFeatureSettings* fontFaceFeatures, const FontVariantSettings* fontFaceVariantSettings, FontSelectionSpecifiedCapabilities fontFaceCapabilities, const TextRenderingMode& textRenderingMode, FontSelectionRequest fontSelectionRequest, FontOpticalSizing fontOpticalSizing, float size )1169 static RetainPtr<CTFontRef> fontWithFamily(const AtomicString& family, FontSelectionRequest request, const FontFeatureSettings& featureSettings, const FontVariantSettings& variantSettings, const FontVariationSettings& variationSettings, const FontFeatureSettings* fontFaceFeatures, const FontVariantSettings* fontFaceVariantSettings, FontSelectionSpecifiedCapabilities fontFaceCapabilities, const TextRenderingMode& textRenderingMode, FontSelectionRequest fontSelectionRequest, FontOpticalSizing fontOpticalSizing, float size, FontStyleAxis axis) 1166 1170 { 1167 1171 if (family.isEmpty()) … … 1171 1175 if (!foundFont) 1172 1176 foundFont = platformFontLookupWithFamily(family, request, size); 1173 return preparePlatformFont(foundFont.get(), textRenderingMode, fontFaceFeatures, fontFaceVariantSettings, fontFaceCapabilities, featureSettings, variantSettings, fontSelectionRequest, variationSettings, fontOpticalSizing, size );1177 return preparePlatformFont(foundFont.get(), textRenderingMode, fontFaceFeatures, fontFaceVariantSettings, fontFaceCapabilities, featureSettings, variantSettings, fontSelectionRequest, variationSettings, fontOpticalSizing, size, axis); 1174 1178 } 1175 1179 … … 1210 1214 float size = fontDescription.computedPixelSize(); 1211 1215 1212 auto font = fontWithFamily(family, fontDescription.fontSelectionRequest(), fontDescription.featureSettings(), fontDescription.variantSettings(), fontDescription.variationSettings(), fontFaceFeatures, fontFaceVariantSettings, fontFaceCapabilities, fontDescription.textRenderingMode(), fontDescription.fontSelectionRequest(), fontDescription.opticalSizing(), size );1216 auto font = fontWithFamily(family, fontDescription.fontSelectionRequest(), fontDescription.featureSettings(), fontDescription.variantSettings(), fontDescription.variationSettings(), fontFaceFeatures, fontFaceVariantSettings, fontFaceCapabilities, fontDescription.textRenderingMode(), fontDescription.fontSelectionRequest(), fontDescription.opticalSizing(), size, fontDescription.fontStyleAxis()); 1213 1217 1214 1218 #if PLATFORM(MAC) … … 1221 1225 autoActivateFont(family.string(), size); 1222 1226 1223 font = fontWithFamily(family, fontDescription.fontSelectionRequest(), fontDescription.featureSettings(), fontDescription.variantSettings(), fontDescription.variationSettings(), fontFaceFeatures, fontFaceVariantSettings, fontFaceCapabilities, fontDescription.textRenderingMode(), fontDescription.fontSelectionRequest(), fontDescription.opticalSizing(), size );1227 font = fontWithFamily(family, fontDescription.fontSelectionRequest(), fontDescription.featureSettings(), fontDescription.variantSettings(), fontDescription.variationSettings(), fontFaceFeatures, fontFaceVariantSettings, fontFaceCapabilities, fontDescription.textRenderingMode(), fontDescription.fontSelectionRequest(), fontDescription.opticalSizing(), size, fontDescription.fontStyleAxis()); 1224 1228 } 1225 1229 #endif … … 1309 1313 const FontPlatformData& platformData = originalFontData->platformData(); 1310 1314 auto result = lookupFallbackFont(platformData.font(), description.weight(), description.locale(), characters, length); 1311 result = preparePlatformFont(result.get(), description.textRenderingMode(), nullptr, nullptr, { }, description.featureSettings(), description.variantSettings(), description.fontSelectionRequest(), description.variationSettings(), description.opticalSizing(), description.computedSize() );1315 result = preparePlatformFont(result.get(), description.textRenderingMode(), nullptr, nullptr, { }, description.featureSettings(), description.variantSettings(), description.fontSelectionRequest(), description.variationSettings(), description.opticalSizing(), description.computedSize(), description.fontStyleAxis()); 1312 1316 if (!result) 1313 1317 return lastResortFallbackFont(description); -
trunk/Source/WebCore/platform/graphics/mac/FontCustomPlatformData.cpp
r217241 r217272 41 41 FontWidthVariant widthVariant = fontDescription.widthVariant(); 42 42 RetainPtr<CTFontRef> font = adoptCF(CTFontCreateWithFontDescriptor(m_fontDescriptor.get(), size, nullptr)); 43 font = preparePlatformFont(font.get(), fontDescription.textRenderingMode(), &fontFaceFeatures, &fontFaceVariantSettings, fontFaceCapabilities, fontDescription.featureSettings(), fontDescription.variantSettings(), fontDescription.fontSelectionRequest(), fontDescription.variationSettings(), fontDescription.opticalSizing(), fontDescription.computedSize() );43 font = preparePlatformFont(font.get(), fontDescription.textRenderingMode(), &fontFaceFeatures, &fontFaceVariantSettings, fontFaceCapabilities, fontDescription.featureSettings(), fontDescription.variantSettings(), fontDescription.fontSelectionRequest(), fontDescription.variationSettings(), fontDescription.opticalSizing(), fontDescription.computedSize(), fontDescription.fontStyleAxis()); 44 44 ASSERT(font); 45 45 return FontPlatformData(font.get(), size, bold, italic, orientation, widthVariant, fontDescription.textRenderingMode()); -
trunk/Source/WebCore/platform/text/TextFlags.h
r214364 r217272 357 357 }; 358 358 359 // https://www.microsoft.com/typography/otspec/fvar.htm#VAT 360 enum class FontStyleAxis { 361 slnt, 362 ital 363 }; 364 359 365 }
Note: See TracChangeset
for help on using the changeset viewer.