summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-fonts
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/css/css-fonts')
-rw-r--r--testing/web-platform/tests/css/css-fonts/WEB_FEATURES.yml14
-rw-r--r--testing/web-platform/tests/css/css-fonts/font-size-adjust-reload.html3
-rw-r--r--testing/web-platform/tests/css/css-fonts/matching/font-unicode-PUA-primary-font-notref.html17
-rw-r--r--testing/web-platform/tests/css/css-fonts/matching/font-unicode-PUA-primary-font.html17
-rw-r--r--testing/web-platform/tests/css/css-fonts/parsing/WEB_FEATURES.yml16
-rw-r--r--testing/web-platform/tests/css/css-fonts/parsing/font-palette-values-invalid.html50
-rw-r--r--testing/web-platform/tests/css/css-fonts/parsing/font-palette-values-valid.html13
-rw-r--r--testing/web-platform/tests/css/css-fonts/resources/vs/MPLUS1-Regular_without-cmap14-subset.ttfbin0 -> 1280 bytes
-rw-r--r--testing/web-platform/tests/css/css-fonts/resources/vs/NotoColorEmoji-Regular_subset.ttfbin0 -> 31728 bytes
-rw-r--r--testing/web-platform/tests/css/css-fonts/resources/vs/NotoEmoji-Regular_subset.ttfbin0 -> 1776 bytes
-rw-r--r--testing/web-platform/tests/css/css-fonts/resources/vs/NotoEmoji-Regular_without-cmap14-subset.ttfbin0 -> 1736 bytes
-rw-r--r--testing/web-platform/tests/css/css-fonts/resources/vs/NotoSansJP-Regular_with-cmap14-subset.ttfbin0 -> 1688 bytes
-rw-r--r--testing/web-platform/tests/css/css-fonts/resources/vs/NotoSansMath-Regular_without-cmap14-subset.ttfbin0 -> 5308 bytes
-rw-r--r--testing/web-platform/tests/css/css-fonts/resources/vs/STIXTwoMath-Regular_with-cmap14-subset.ttfbin0 -> 5984 bytes
-rw-r--r--testing/web-platform/tests/css/css-fonts/support/css/variation-sequences.css38
-rw-r--r--testing/web-platform/tests/css/css-fonts/support/js/variation-sequences.js125
-rw-r--r--testing/web-platform/tests/css/css-fonts/variation-sequences-ref.html11
-rw-r--r--testing/web-platform/tests/css/css-fonts/variation-sequences.html18
18 files changed, 317 insertions, 5 deletions
diff --git a/testing/web-platform/tests/css/css-fonts/WEB_FEATURES.yml b/testing/web-platform/tests/css/css-fonts/WEB_FEATURES.yml
index 5e69c923ab..6739fa2d06 100644
--- a/testing/web-platform/tests/css/css-fonts/WEB_FEATURES.yml
+++ b/testing/web-platform/tests/css/css-fonts/WEB_FEATURES.yml
@@ -6,7 +6,19 @@ features:
- palette-values-rule-*
- name: font-synthesis
files:
- - font-synthesis-*
+ - font-synthesis-0*.html
+- name: font-synthesis-position
+ files:
+ - font-synthesis-position*
+- name: font-synthesis-small-caps
+ files:
+ - font-synthesis-small-caps*
+- name: font-synthesis-style
+ files:
+ - font-synthesis-style*
+- name: font-synthesis-weight
+ files:
+ - font-synthesis-weight*
- name: font-variant-alternates
files:
- alternates-order.html
diff --git a/testing/web-platform/tests/css/css-fonts/font-size-adjust-reload.html b/testing/web-platform/tests/css/css-fonts/font-size-adjust-reload.html
index 37d79a68bd..68ccba4398 100644
--- a/testing/web-platform/tests/css/css-fonts/font-size-adjust-reload.html
+++ b/testing/web-platform/tests/css/css-fonts/font-size-adjust-reload.html
@@ -16,8 +16,7 @@ body {
</body>
<script>
const iframe = document.getElementById('iframe');
- // Forcing reload
- iframe.src += '';
+ iframe.contentWindow.location.reload();
iframe.contentWindow.onload = function(){
document.documentElement.classList.remove("reftest-wait");
};
diff --git a/testing/web-platform/tests/css/css-fonts/matching/font-unicode-PUA-primary-font-notref.html b/testing/web-platform/tests/css/css-fonts/matching/font-unicode-PUA-primary-font-notref.html
new file mode 100644
index 0000000000..df9b829a41
--- /dev/null
+++ b/testing/web-platform/tests/css/css-fonts/matching/font-unicode-PUA-primary-font-notref.html
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html>
+<head>
+<link rel="author" title="Vitor Roriz" href="https://github.com/vitorroriz">
+<link rel="help" href="https://drafts.csswg.org/css-fonts-4/#char-handling-issues">
+<style>
+.target {
+ font-family: Times;
+ font-size: 60px;
+}
+</style>
+</head>
+<body>
+"If a given character is a Private-Use Area Unicode codepoint, user agents must only match font families named in the font-family list that are not generic families. If none of the families named in the font-family list contain a glyph for that codepoint, user agents must display some form of missing glyph symbol for that character rather than attempting installed font fallback for that codepoint." - <a href="https://drafts.csswg.org/css-fonts-4/#char-handling-issues">css-fonts-4</a>
+<p class="target">&#xE0AD;&#xE0AE;&#xE0AD;&#xE0AF;&#xE0B0;&#xE0B1;&#xE0C0;&#xE0C1;&#xE0D3;&#xE0D4;</p>
+</body>
+</html>
diff --git a/testing/web-platform/tests/css/css-fonts/matching/font-unicode-PUA-primary-font.html b/testing/web-platform/tests/css/css-fonts/matching/font-unicode-PUA-primary-font.html
new file mode 100644
index 0000000000..1b03c98e40
--- /dev/null
+++ b/testing/web-platform/tests/css/css-fonts/matching/font-unicode-PUA-primary-font.html
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html>
+<head>
+<link rel="author" title="Vitor Roriz" href="https://github.com/vitorroriz">
+<link rel="help" href="https://drafts.csswg.org/css-fonts-4/#char-handling-issues">
+<link rel="mismatch" href="./font-unicode-PUA-primary-font-notref.html">
+<style>
+.target {
+ font-family: Arial;
+ font-size: 60px;
+}
+</style>
+</head>
+<body>
+"If a given character is a Private-Use Area Unicode codepoint, user agents must only match font families named in the font-family list that are not generic families. If none of the families named in the font-family list contain a glyph for that codepoint, user agents must display some form of missing glyph symbol for that character rather than attempting installed font fallback for that codepoint." - <a href="https://drafts.csswg.org/css-fonts-4/#char-handling-issues">css-fonts-4</a>
+<p class="target">&#xE0AD;&#xE0AE;&#xE0AD;&#xE0AF;&#xE0B0;&#xE0B1;&#xE0C0;&#xE0C1;&#xE0D3;&#xE0D4;</p>
+</html>
diff --git a/testing/web-platform/tests/css/css-fonts/parsing/WEB_FEATURES.yml b/testing/web-platform/tests/css/css-fonts/parsing/WEB_FEATURES.yml
index 6a24d269b4..a3bc09cb1f 100644
--- a/testing/web-platform/tests/css/css-fonts/parsing/WEB_FEATURES.yml
+++ b/testing/web-platform/tests/css/css-fonts/parsing/WEB_FEATURES.yml
@@ -8,7 +8,21 @@ features:
- font-palette-values-*
- name: font-synthesis
files:
- - font-synthesis-*
+ - font-synthesis-computed.html
+ - font-synthesis-invalid.html
+ - font-synthesis-valid.html
+- name: font-synthesis-position
+ files:
+ - font-synthesis-position*
+- name: font-synthesis-small-caps
+ files:
+ - font-synthesis-small-caps*
+- name: font-synthesis-style
+ files:
+ - font-synthesis-style*
+- name: font-synthesis-weight
+ files:
+ - font-synthesis-weight*
- name: font-variant-alternates
files:
- font-variant-alternates-*
diff --git a/testing/web-platform/tests/css/css-fonts/parsing/font-palette-values-invalid.html b/testing/web-platform/tests/css/css-fonts/parsing/font-palette-values-invalid.html
index 2056055f34..b93a48fb37 100644
--- a/testing/web-platform/tests/css/css-fonts/parsing/font-palette-values-invalid.html
+++ b/testing/web-platform/tests/css/css-fonts/parsing/font-palette-values-invalid.html
@@ -115,13 +115,33 @@
@font-palette-values --A {
override-colors: 0 canvas;
}
+
+/* 19 */
+@font-palette-values --A {
+ override-colors: 0 currentcolor;
+}
+
+/* 20 */
+@font-palette-values --A {
+ override-colors: 0 light-dark(white, black);
+}
+
+/* 21 */
+@font-palette-values --A {
+ override-colors: 0 color-mix(in lch, red, canvas);
+}
+
+/* 22 */
+@font-palette-values --A {
+ override-colors: 0 light-dark(white, currentcolor);
+}
</style>
</head>
<body>
<script>
let rules = document.getElementById("style").sheet.cssRules;
test(function() {
- assert_equals(rules.length, 19);
+ assert_equals(rules.length, 23);
});
test(function() {
@@ -283,6 +303,34 @@ test(function() {
assert_equals(rule.basePalette, "");
assert_equals(rule.overrideColors, "");
});
+
+test(function() {
+ let text = rules[19].cssText;
+ let rule = rules[19];
+ assert_equals(text.indexOf("override-colors"), -1);
+ assert_equals(rule.overrideColors, "");
+});
+
+test(function() {
+ let text = rules[20].cssText;
+ let rule = rules[20];
+ assert_equals(text.indexOf("override-colors"), -1);
+ assert_equals(rule.overrideColors, "");
+});
+
+test(function() {
+ let text = rules[21].cssText;
+ let rule = rules[21];
+ assert_equals(text.indexOf("override-colors"), -1);
+ assert_equals(rule.overrideColors, "");
+});
+
+test(function() {
+ let text = rules[22].cssText;
+ let rule = rules[22];
+ assert_equals(text.indexOf("override-colors"), -1);
+ assert_equals(rule.overrideColors, "");
+});
</script>
</body>
</html>
diff --git a/testing/web-platform/tests/css/css-fonts/parsing/font-palette-values-valid.html b/testing/web-platform/tests/css/css-fonts/parsing/font-palette-values-valid.html
index 3c0c0626f5..99fceff234 100644
--- a/testing/web-platform/tests/css/css-fonts/parsing/font-palette-values-valid.html
+++ b/testing/web-platform/tests/css/css-fonts/parsing/font-palette-values-valid.html
@@ -103,6 +103,11 @@
@font-palette-values --P {
font-family: foo, bar, baz;
}
+
+/* 17 */
+@font-palette-values --Q {
+ override-colors: 0 color-mix(in lch, red, blue);
+}
</style>
</head>
<body>
@@ -385,6 +390,14 @@ test(function() {
assert_equals(rule.basePalette, "");
assert_equals(rule.overrideColors, "");
});
+
+test(function() {
+ let rule = rules[17];
+ assert_equals(rule.name, "--Q");
+ assert_equals(rule.fontFamily, "");
+ assert_equals(rule.basePalette, "");
+ assert_equals(rule.overrideColors, "0 color-mix(in lch, red, blue)");
+});
</script>
</body>
</html>
diff --git a/testing/web-platform/tests/css/css-fonts/resources/vs/MPLUS1-Regular_without-cmap14-subset.ttf b/testing/web-platform/tests/css/css-fonts/resources/vs/MPLUS1-Regular_without-cmap14-subset.ttf
new file mode 100644
index 0000000000..b77096690d
--- /dev/null
+++ b/testing/web-platform/tests/css/css-fonts/resources/vs/MPLUS1-Regular_without-cmap14-subset.ttf
Binary files differ
diff --git a/testing/web-platform/tests/css/css-fonts/resources/vs/NotoColorEmoji-Regular_subset.ttf b/testing/web-platform/tests/css/css-fonts/resources/vs/NotoColorEmoji-Regular_subset.ttf
new file mode 100644
index 0000000000..24ab79fd05
--- /dev/null
+++ b/testing/web-platform/tests/css/css-fonts/resources/vs/NotoColorEmoji-Regular_subset.ttf
Binary files differ
diff --git a/testing/web-platform/tests/css/css-fonts/resources/vs/NotoEmoji-Regular_subset.ttf b/testing/web-platform/tests/css/css-fonts/resources/vs/NotoEmoji-Regular_subset.ttf
new file mode 100644
index 0000000000..0b054c7c8d
--- /dev/null
+++ b/testing/web-platform/tests/css/css-fonts/resources/vs/NotoEmoji-Regular_subset.ttf
Binary files differ
diff --git a/testing/web-platform/tests/css/css-fonts/resources/vs/NotoEmoji-Regular_without-cmap14-subset.ttf b/testing/web-platform/tests/css/css-fonts/resources/vs/NotoEmoji-Regular_without-cmap14-subset.ttf
new file mode 100644
index 0000000000..3d00ef81de
--- /dev/null
+++ b/testing/web-platform/tests/css/css-fonts/resources/vs/NotoEmoji-Regular_without-cmap14-subset.ttf
Binary files differ
diff --git a/testing/web-platform/tests/css/css-fonts/resources/vs/NotoSansJP-Regular_with-cmap14-subset.ttf b/testing/web-platform/tests/css/css-fonts/resources/vs/NotoSansJP-Regular_with-cmap14-subset.ttf
new file mode 100644
index 0000000000..edcb98e374
--- /dev/null
+++ b/testing/web-platform/tests/css/css-fonts/resources/vs/NotoSansJP-Regular_with-cmap14-subset.ttf
Binary files differ
diff --git a/testing/web-platform/tests/css/css-fonts/resources/vs/NotoSansMath-Regular_without-cmap14-subset.ttf b/testing/web-platform/tests/css/css-fonts/resources/vs/NotoSansMath-Regular_without-cmap14-subset.ttf
new file mode 100644
index 0000000000..5436d06dae
--- /dev/null
+++ b/testing/web-platform/tests/css/css-fonts/resources/vs/NotoSansMath-Regular_without-cmap14-subset.ttf
Binary files differ
diff --git a/testing/web-platform/tests/css/css-fonts/resources/vs/STIXTwoMath-Regular_with-cmap14-subset.ttf b/testing/web-platform/tests/css/css-fonts/resources/vs/STIXTwoMath-Regular_with-cmap14-subset.ttf
new file mode 100644
index 0000000000..c9720cf9ce
--- /dev/null
+++ b/testing/web-platform/tests/css/css-fonts/resources/vs/STIXTwoMath-Regular_with-cmap14-subset.ttf
Binary files differ
diff --git a/testing/web-platform/tests/css/css-fonts/support/css/variation-sequences.css b/testing/web-platform/tests/css/css-fonts/support/css/variation-sequences.css
new file mode 100644
index 0000000000..5977f17b67
--- /dev/null
+++ b/testing/web-platform/tests/css/css-fonts/support/css/variation-sequences.css
@@ -0,0 +1,38 @@
+@font-face {
+ font-family: "MonoEmojiFont";
+ src: url(../../resources/vs/NotoEmoji-Regular_subset.ttf);
+}
+
+@font-face {
+ font-family: "ColorEmojiFont";
+ src: url(../../resources/vs/NotoColorEmoji-Regular_subset.ttf);
+}
+
+@font-face {
+ font-family: "EmojiFontWithBaseCharOnly";
+ src: url(../../resources/vs/NotoEmoji-Regular_without-cmap14-subset.ttf);
+}
+
+@font-face {
+ font-family: "CJKFontWithVS";
+ src: url(../../resources/vs/NotoSansJP-Regular_with-cmap14-subset.ttf);
+}
+
+@font-face {
+ font-family: "CJKFontWithBaseCharOnly";
+ src: url(../../resources/vs/MPLUS1-Regular_without-cmap14-subset.ttf);
+}
+
+@font-face {
+ font-family: "MathFontWithVS";
+ src: url(../../resources/vs/STIXTwoMath-Regular_with-cmap14-subset.ttf);
+}
+
+@font-face {
+ font-family: "MathFontWithBaseCharOnly";
+ src: url(../../resources/vs/NotoSansMath-Regular_without-cmap14-subset.ttf);
+}
+
+body {
+ font-size: 24px;
+} \ No newline at end of file
diff --git a/testing/web-platform/tests/css/css-fonts/support/js/variation-sequences.js b/testing/web-platform/tests/css/css-fonts/support/js/variation-sequences.js
new file mode 100644
index 0000000000..84c5a1a9c7
--- /dev/null
+++ b/testing/web-platform/tests/css/css-fonts/support/js/variation-sequences.js
@@ -0,0 +1,125 @@
+var baseChars = {
+ "emoji": "\u{1fae8}",
+ "cjk": "\u{8279}",
+ "math": "\u{2205}"
+};
+
+var variationSelectors = {
+ "emoji": ["\u{fe0e}", "\u{fe0f}"],
+ "cjk": ["", "\u{FE00}", "\u{FE01}", "\u{e0100}", "\u{e0101}",
+ "\u{e0102}"
+ ],
+ "math": ["", "\u{FE00}"]
+};
+
+var families = {
+ "emoji": ["ColorEmojiFont", "MonoEmojiFont",
+ "EmojiFontWithBaseCharOnly",
+ "sans-serif"
+ ],
+ "cjk": ["CJKFontWithVS", "CJKFontWithBaseCharOnly",
+ "sans-serif"
+ ],
+ "math": ["MathFontWithVS", "MathFontWithBaseCharOnly",
+ "sans-serif"
+ ]
+};
+
+var variationSequenceFamilies = new Map([
+ ["\u{1fae8}\u{fe0e}", "MonoEmojiFont"],
+ ["\u{1fae8}\u{fe0f}", "ColorEmojiFont"],
+ ["\u{8279}\u{fe00}", "CJKFontWithVS"],
+ ["\u{8279}\u{fe01}", "CJKFontWithVS"],
+ ["\u{8279}\u{e0100}", "CJKFontWithVS"],
+ ["\u{8279}\u{e0101}", "CJKFontWithVS"],
+ ["\u{8279}\u{e0102}", "CJKFontWithVS"],
+ ["\u{2205}\u{FE00}", "MathFontWithVS"]
+]);
+
+var baseCharFamilies = new Map([
+ ["\u{1fae8}", new Set(["MonoEmojiFont", "ColorEmojiFont",
+ "EmojiFontWithBaseCharOnly"
+ ])],
+ ["\u{8279}", new Set(["CJKFontWithVS",
+ "CJKFontWithBaseCharOnly"
+ ])],
+ ["\u{2205}", new Set(["MathFontWithVS",
+ "MathFontWithBaseCharOnly"
+ ])]
+]);
+
+const range = function*(l) {
+ for (let i = 0; i < l; i += 1) yield i;
+}
+const isEmpty = arr =>
+ arr.length === 0;
+
+const permutations =
+ function*(a) {
+ const r = arguments[1] || [];
+ if (isEmpty(a))
+ yield r;
+ for (let i of range(a.length)) {
+ const aa = [...a];
+ const rr = [...r, ...aa.splice(i, 1)];
+ yield* permutations(aa, rr);
+ }
+}
+
+function getMatchedFamilyForVariationSequence(
+ familyList, baseCharacter, variationSelector) {
+ const variationSequence = baseCharacter + variationSelector;
+ // First try to find a match for the whole variation sequence.
+ if (variationSequenceFamilies.has(variationSequence)) {
+ const matchedFamily = variationSequenceFamilies.get(variationSequence);
+ if (familyList.includes(matchedFamily)) {
+ return matchedFamily;
+ }
+ }
+ // If failed, try to match only the base character from the
+ // variation sequence.
+ if (baseCharFamilies.has(baseCharacter)) {
+ const eligibleFamilies = baseCharFamilies.get(baseCharacter);
+ const matchedFamilies =
+ familyList.filter(value => eligibleFamilies.has(value));
+ if (matchedFamilies.length) {
+ return matchedFamilies[0];
+ }
+ }
+ // We should not reach here, we should always match one of the
+ // specified web fonts in the tests.
+ return "";
+}
+
+function generateContent(
+ families, baseChar, variationSelectors, getFontFamilyValue) {
+ var rootElem = document.createElement('div');
+ // We want to test all possible combinations of variation
+ // selectors and font-family list values. For the refs,
+ // we explicitly specify the font that we expect to be
+ // matched from the maps at the beginning of the files.
+ const allFamiliesLists = permutations(families);
+ for (const familyList of allFamiliesLists) {
+ for (const variationSelector of variationSelectors) {
+ const contentSpan = document.createElement("span");
+ contentSpan.textContent = baseChar + variationSelector;
+ contentSpan.style.fontFamily =
+ getFontFamilyValue(familyList, baseChar, variationSelector);
+ rootElem.appendChild(contentSpan);
+ }
+ }
+ document.body.appendChild(rootElem);
+}
+
+function generateVariationSequenceTests(type) {
+ var getFontFamilyValue = (familyList, baseChar, variationSelector) => {
+ return familyList.join(', ');
+ }
+ generateContent(families[type], baseChars[type], variationSelectors[type], getFontFamilyValue);
+}
+
+function generateVariationSequenceRefs(type) {
+ generateContent(
+ families[type], baseChars[type], variationSelectors[type],
+ getMatchedFamilyForVariationSequence);
+}
diff --git a/testing/web-platform/tests/css/css-fonts/variation-sequences-ref.html b/testing/web-platform/tests/css/css-fonts/variation-sequences-ref.html
new file mode 100644
index 0000000000..a44f18bb3e
--- /dev/null
+++ b/testing/web-platform/tests/css/css-fonts/variation-sequences-ref.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<meta charset="UTF-8" />
+<title>CSS Test: Cluster Matching Variation Sequences</title>
+<link rel="stylesheet" type="text/css" href="support/css/variation-sequences.css" />
+<script type="text/javascript" src="support/js/variation-sequences.js"></script>
+<body></body>
+<script>
+ generateVariationSequenceRefs("emoji");
+ generateVariationSequenceRefs("cjk");
+ generateVariationSequenceRefs("math");
+</script> \ No newline at end of file
diff --git a/testing/web-platform/tests/css/css-fonts/variation-sequences.html b/testing/web-platform/tests/css/css-fonts/variation-sequences.html
new file mode 100644
index 0000000000..91e46a84d7
--- /dev/null
+++ b/testing/web-platform/tests/css/css-fonts/variation-sequences.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<meta charset="UTF-8" />
+<title>CSS Test: Cluster Matching Variation Sequences</title>
+<link rel="help" href="https://www.w3.org/TR/css-fonts-4/#cluster-matching" />
+<link rel="help" href="https://unicode.org/reports/tr51/" />
+<link rel="help" href="https://unicode.org/reports/tr37/" />
+<link rel="help" href="https://www.unicode.org/Public/UNIDATA/StandardizedVariants.txt" />
+<link rel="help" href="https://www.unicode.org/versions/Unicode15.1.0/ch23.pdf#G19053" />
+<link rel="match" href="variation-sequences-ref.html">
+<meta name="assert" content="Variation sequences should be taken into account during cluster matching.">
+<link rel="stylesheet" type="text/css" href="support/css/variation-sequences.css" />
+<script type="text/javascript" src="support/js/variation-sequences.js"></script>
+<body></body>
+<script>
+ generateVariationSequenceTests("emoji");
+ generateVariationSequenceTests("cjk");
+ generateVariationSequenceTests("math");
+</script> \ No newline at end of file