haikuwebkit/LayoutTests/css3/font-synthesis-small-caps-e...

108 lines
4.7 KiB
HTML
Raw Permalink Normal View History

[Cocoa] Implement font-synthesis: small-caps https://bugs.webkit.org/show_bug.cgi?id=165892 Reviewed by David Hyatt. Source/WebCore: The CSS Fonts level 4 spec adds a new value to the "font-synthesis" property which controls whether or not small-caps is allowed to be synthesized. Luckily, we already have an implementation of this straightforward, so the implementation is quite simple. Tests: css3/font-synthesis-small-caps.html fast/text/font-synthesis-parsing.html * css/CSSComputedStyleDeclaration.cpp: (WebCore::fontSynthesisFromStyle): * css/StyleBuilderConverter.h: (WebCore::StyleBuilderConverter::convertFontSynthesis): * css/parser/CSSPropertyParser.cpp: (WebCore::consumeFontSynthesis): * platform/graphics/FontCache.h: (WebCore::FontDescriptionKey::makeFlagsKey): * platform/graphics/FontDescription.cpp: (WebCore::FontDescription::FontDescription): * platform/graphics/FontDescription.h: (WebCore::FontCascadeDescription::initialFontSynthesis): * platform/graphics/mac/ComplexTextController.cpp: (WebCore::shouldSynthesize): (WebCore::ComplexTextController::collectComplexTextRuns): LayoutTests: * fast/text/font-synthesis-parsing-expected.txt: Added. * fast/text/font-synthesis-parsing.html: Added. * css3/font-synthesis-small-caps-expected.html: Added. * css3/font-synthesis-small-caps.html: Added. * fast/css/getComputedStyle/computed-style-expected.txt: * fast/css/getComputedStyle/computed-style-font-family-expected.txt: * fast/css/getComputedStyle/computed-style-without-renderer-expected.txt: * fast/css3-text/font-synthesis-parse-expected.txt: * fast/css3-text/font-synthesis-parse.html: * svg/css/getComputedStyle-basic-expected.txt: Canonical link: https://commits.webkit.org/183519@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@209875 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-12-15 22:12:21 +00:00
<!DOCTYPE html>
<html>
<head>
<style>
/* Only test OpenType fonts for now, because our TrueType font is busted when disabling features. */
@font-face {
/* Opentype. "J" responds to smcp; "K" responds to c2sc */
font-family: "testfontotf";
src: url("resources/FontWithFeatures.otf") format("opentype");
}
@font-face {
/* Truetype. "S" responds to smcp; "V" responds to c2sc */
font-family: "testfontttf";
src: url("resources/FontWithFeatures.ttf") format("truetype");
}
@font-face {
/* Opentype. "f" responds to smcp; "g" responds to c2sc */
font-family: "testfontlowercasesmallcapsotf";
src: url("resources/FontWithFeaturesLowercaseSmallCaps.otf") format("opentype");
}
@font-face {
/* Truetype. "r" responds to smcp; "u" responds to c2sc */
font-family: "testfontlowercasesmallcapsttf";
src: url("resources/FontWithFeaturesLowercaseSmallCaps.ttf") format("truetype");
}
.test {
font-size: 20px;
display: inline-block;
}
</style>
</head>
<body>
This test makes sure that the font-synthesis: none value gets correctly applied. The test passes when a particular pattern of Xs and checks appear below. Also note that the correct size of the character is required.
<div style="font-family: testfontotf; border: solid green 1px; margin: 5px; font-feature-settings: 'ntrl';">
<div class="test" style="">J</div>
<div class="test" style="">a</div>
<div class="test" style="font-variant: small-caps;">J</div>
<div class="test" style="font-variant: small-caps;">aJ</div>
<div class="test" style="font-variant: small-caps;">aJ</div>
<div class="test" style="">BA</div>
<div class="test" style="">BA</div>
</div>
<div style="font-family: testfontttf; border: solid green 1px; margin: 5px; font-feature-settings: 'ntrl';">
<div class="test" style="">S</div>
<div class="test" style="">a</div>
<div class="test" style="font-variant: small-caps;">S</div>
<div class="test" style="font-variant: small-caps;">aS</div>
<div class="test" style="font-variant: small-caps;">aS</div>
<div class="test" style="">BA</div>
<div class="test" style="">BA</div>
</div>
<div style="font-family: testfontlowercasesmallcapsotf; border: solid black 1px; margin: 5px; font-feature-settings: 'ntrl';">
<div class="test" style="">f</div>
<div class="test" style="">a</div>
<div class="test" style="font-variant: small-caps;">f</div>
<div class="test" style="font-variant: small-caps;">af</div>
<div class="test" style="font-variant: small-caps;">af</div>
<div class="test" style="">BA</div>
<div class="test" style="">BA</div>
</div>
<div style="font-family: testfontlowercasesmallcapsttf; border: solid blue 1px; margin: 5px; font-feature-settings: 'ntrl';">
<div class="test" style="">r</div>
<div class="test" style="">a</div>
<div class="test" style="font-variant: small-caps;">r</div>
<div class="test" style="font-variant: small-caps;">ar</div>
<div class="test" style="font-variant: small-caps;">ar</div>
<div class="test" style="">BA</div>
<div class="test" style="">BA</div>
</div>
<div style="font-family: testfontotf; border: solid green 1px; margin: 5px; font-feature-settings: 'ntrl';">
<div class="test" style="">K</div>
<div class="test" style="">a</div>
<div class="test" style="font-variant: small-caps;">K</div>
<div class="test" style="font-variant: small-caps;">aK</div>
<div class="test" style="font-variant: small-caps;">aK</div>
<div class="test" style="">BB</div>
<div class="test" style="">BB</div>
</div>
<div style="font-family: testfontttf; border: solid green 1px; margin: 5px; font-feature-settings: 'ntrl';">
<div class="test" style="">V</div>
<div class="test" style="">a</div>
<div class="test" style="font-variant: small-caps;">V</div>
<div class="test" style="font-variant: small-caps;">aV</div>
<div class="test" style="font-variant: small-caps;">aV</div>
<div class="test" style="">BB</div>
<div class="test" style="">BB</div>
</div>
<div style="font-family: testfontlowercasesmallcapsotf; border: solid black 1px; margin: 5px; font-feature-settings: 'ntrl';">
<div class="test" style="">g</div>
<div class="test" style="">a</div>
<div class="test" style="font-variant: small-caps;">g</div>
<div class="test" style="font-variant: small-caps;">ag</div>
<div class="test" style="font-variant: small-caps;">ag</div>
<div class="test" style="">BB</div>
<div class="test" style="">BB</div>
</div>
<div style="font-family: testfontlowercasesmallcapsttf; border: solid blue 1px; margin: 5px; font-feature-settings: 'ntrl';">
<div class="test" style="">u</div>
<div class="test" style="">a</div>
<div class="test" style="font-variant: small-caps;">u</div>
<div class="test" style="font-variant: small-caps;">au</div>
<div class="test" style="font-variant: small-caps;">au</div>
<div class="test" style="">BB</div>
<div class="test" style="">BB</div>
</div>
</body>
</html>