haikuwebkit/LayoutTests/css3/font-variant-font-face-over...

23 lines
658 B
HTML
Raw Permalink Normal View History

font-variant-* properties in @font-face declarations should be honored https://bugs.webkit.org/show_bug.cgi?id=149771 Reviewed by Simon Fraser. Source/WebCore: According to the CSS Fonts Level 3 spec, web authors are allowed to put font-feature-settings / font-variant-* inside @font-face blocks. These properties are supposed to be applied at a specific time during the font selection algorithm. This patch gives a FontFeatureSettings object and a FontVariantSettings object to CSSFontFace, and moves common parsing logic from StyleBuilderCustom to a shared location. Then, once the two properties are parsed from the @font-face block, the relevant data structures are passed down into the font selection algorithm. This algorithm then consults with these values at the correct time (inside preparePlatformFont()). Tests: css3/font-feature-settings-font-face-rendering.html css3/font-variant-font-face-all.html css3/font-variant-font-face-override.html * WebCore.xcodeproj/project.pbxproj: Add a header for the common location of parsing font-variant-ligatures, font-variant-numeric, and font-variant-east-asian. * css/CSSFontFace.cpp: (WebCore::CSSFontFace::font): Pass the relevant data structures into the font selection algorithm. * css/CSSFontFace.h: Add FontFeatureSettings and FontVariantSettings member variables. (WebCore::CSSFontFace::insertFeature): (WebCore::CSSFontFace::setVariantCommonLigatures): (WebCore::CSSFontFace::setVariantDiscretionaryLigatures): (WebCore::CSSFontFace::setVariantHistoricalLigatures): (WebCore::CSSFontFace::setVariantContextualAlternates): (WebCore::CSSFontFace::setVariantPosition): (WebCore::CSSFontFace::setVariantCaps): (WebCore::CSSFontFace::setVariantNumericFigure): (WebCore::CSSFontFace::setVariantNumericSpacing): (WebCore::CSSFontFace::setVariantNumericFraction): (WebCore::CSSFontFace::setVariantNumericOrdinal): (WebCore::CSSFontFace::setVariantNumericSlashedZero): (WebCore::CSSFontFace::setVariantAlternates): (WebCore::CSSFontFace::setVariantEastAsianVariant): (WebCore::CSSFontFace::setVariantEastAsianWidth): (WebCore::CSSFontFace::setVariantEastAsianRuby): * css/CSSFontFaceSource.cpp: (WebCore::CSSFontFaceSource::font): Pass the relevant data structures into the font selection algorithm. * css/CSSFontFaceSource.h: Ditto. * css/CSSFontSelector.cpp: (WebCore::CSSFontSelector::addFontFaceRule): Call the shared parsing logic to populate the FontFeatureSettings and FontVariantSettings members. * css/FontVariantBuilder.h: Added. Destination for shared parsing logic. (WebCore::applyValueFontVariantLigatures): (WebCore::applyValueFontVariantNumeric): (WebCore::applyValueFontVariantEastAsian): * css/StyleBuilderCustom.h: Source for shared parsing logic. (WebCore::StyleBuilderCustom::applyValueFontVariantLigatures): (WebCore::StyleBuilderCustom::applyValueFontVariantNumeric): (WebCore::StyleBuilderCustom::applyValueFontVariantEastAsian): * loader/cache/CachedFont.cpp: Pass the relevant data structures into the font selection algorithm. (WebCore::CachedFont::createFont): (WebCore::CachedFont::platformDataFromCustomData): * loader/cache/CachedFont.h: Ditto. * loader/cache/CachedSVGFont.cpp: Ditto. (WebCore::CachedSVGFont::createFont): (WebCore::CachedSVGFont::platformDataFromCustomData): * loader/cache/CachedSVGFont.h: Ditto. * platform/graphics/FontCache.h: Ditto. * platform/graphics/FontCascade.cpp: (WebCore::FontCascade::codePath): Adjust comment. * platform/graphics/cocoa/FontCacheCoreText.cpp: (WebCore::preparePlatformFont): Consult with the newly parsed values. (WebCore::fontWithFamily): Pass the relevant data structures into the font selection algorithm. (WebCore::FontCache::systemFallbackForCharacters): Ditto. * platform/graphics/mac/FontCustomPlatformData.cpp: (WebCore::FontCustomPlatformData::fontPlatformData): Ditto. * platform/graphics/mac/FontCustomPlatformData.h: Ditto. LayoutTests: * css3/font-variant-font-face-override-expected.html: Added * css3/font-variant-font-face-override.html: Added * css3/font-feature-settings-font-face-rendering-expected.html: Added. * css3/font-feature-settings-font-face-rendering.html: Added. * css3/font-variant-font-face-all-expected.html: Added. * css3/font-variant-font-face-all.html: Added. Canonical link: https://commits.webkit.org/169055@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@191968 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-11-03 20:31:33 +00:00
<!DOCTYPE html>
<html>
<head>
<style>
@font-face {
font-family: "FontFeaturesTestOTF";
src: url("resources/FontWithFeatures.otf") format("opentype");
}
@font-face {
font-family: "FontFeaturesTestTTF";
src: url("resources/FontWithFeatures.ttf") format("truetype");
}
</style>
</head>
<body>
This test makes sure that local font feature styles can override the font feature styles declared in @font-face blocks.
<div style="font: 40px FontFeaturesTestOTF;">AA</div>
<div style="font: 40px FontFeaturesTestOTF;">BB</div>
<div style="font: 40px FontFeaturesTestTTF;">AA</div>
<div style="font: 40px FontFeaturesTestTTF;">BB</div>
</body>
Remove font-variant @font-face descriptor https://bugs.webkit.org/show_bug.cgi?id=203179 Reviewed by Simon Fraser. Source/WebCore: As per https://github.com/w3c/csswg-drafts/issues/2531 Deleted relevant tests. * css/CSSFontFace.cpp: (WebCore::CSSFontFace::font): (WebCore::CSSFontFace::setVariantLigatures): Deleted. (WebCore::CSSFontFace::setVariantPosition): Deleted. (WebCore::CSSFontFace::setVariantCaps): Deleted. (WebCore::CSSFontFace::setVariantNumeric): Deleted. (WebCore::CSSFontFace::setVariantAlternates): Deleted. (WebCore::CSSFontFace::setVariantEastAsian): Deleted. * css/CSSFontFace.h: * css/CSSFontFaceSource.cpp: (WebCore::CSSFontFaceSource::load): (WebCore::CSSFontFaceSource::font): * css/CSSFontFaceSource.h: * css/CSSFontSelector.cpp: (WebCore::CSSFontSelector::addFontFaceRule): * css/FontFace.cpp: (WebCore::FontFace::create): (WebCore::FontFace::setVariant): Deleted. (WebCore::FontFace::variant const): Deleted. * css/FontFace.h: * css/FontFace.idl: * loader/cache/CachedFont.cpp: (WebCore::CachedFont::createFont): (WebCore::CachedFont::platformDataFromCustomData): * loader/cache/CachedFont.h: * loader/cache/CachedSVGFont.cpp: (WebCore::CachedSVGFont::createFont): (WebCore::CachedSVGFont::platformDataFromCustomData): * loader/cache/CachedSVGFont.h: * platform/graphics/FontCache.cpp: (WebCore::FontPlatformDataCacheKey::FontPlatformDataCacheKey): (WebCore::FontPlatformDataCacheKey::operator== const): (WebCore::FontPlatformDataCacheKeyHash::hash): (WebCore::FontCache::getCachedFontPlatformData): (WebCore::FontCache::fontForFamily): * platform/graphics/FontCache.h: (WebCore::FontCache::fontForFamily): (WebCore::FontCache::getCachedFontPlatformData): (WebCore::FontCache::createFontPlatformDataForTesting): * platform/graphics/cocoa/FontCacheCoreText.cpp: (WebCore::preparePlatformFont): (WebCore::fontWithFamily): (WebCore::FontCache::createFontPlatformData): (WebCore::FontCache::systemFallbackForCharacters): * platform/graphics/cocoa/FontCacheCoreText.h: * platform/graphics/cocoa/FontFamilySpecificationCoreText.cpp: (WebCore::FontFamilySpecificationCoreText::fontRanges const): * platform/graphics/mac/FontCustomPlatformData.cpp: (WebCore::FontCustomPlatformData::fontPlatformData): * platform/graphics/mac/FontCustomPlatformData.h: LayoutTests: Delete tests for the removed feature. * css3/font-variant-font-face-all-expected.html: Deleted. * css3/font-variant-font-face-all.html: Deleted. * css3/font-variant-font-face-override-expected.html: * css3/font-variant-font-face-override.html: * fast/text/font-face-empty-string-expected.txt: * fast/text/font-face-empty-string.html: * fast/text/font-face-javascript-expected.txt: * fast/text/font-face-javascript.html: Canonical link: https://commits.webkit.org/217740@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@252760 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-11-22 03:56:06 +00:00
</html>