unicode-range and falling off the end of the font-family list
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
- Issue type
- Documentation
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- css
- Domain
- documentation
Research direction
Start with the CSS Fonts 4 sections on cluster matching, system fonts, and installed fonts linked in the issue. Compare the three proposed interpretations with current browser behavior and the specification terminology. Done means reaching a resolved normative direction and identifying the corresponding spec wording to update.
Written by the indexing model from the issue text.
Description
Consider content like this:
@font-face {
font-family: MyCoolWebFont;
src: url("someFontThatActuallySupportsTheLetterE.ttf");
unicode-range: something that doesn't contain the letter e;
}
...
<div style="font-family: 'MyCoolWebFont';">e</div>
The relevant section of the spec is this: https://drafts.csswg.org/css-fonts-4/#cluster-matching
- For each family in the font list, a face is chosen using the style selection rules defined in the previous section.
....- If no font was found in the font list in step 1:
1. If c1 is a variation selector, ...
2. Otherwise, the user agent may optionally use system font fallback ...- If no font is found in step 2, use the matching sequence from step 1 to determine the longest sequence that is completely supported by a font ...
Step 1 clearly shouldn't select any fonts. The only one listed in the font-family list has a unicode-range that doesn't include the character being rendered. Okay.
Step 2.1 is clearly irrelevant.
Step 2.2 uses the term "system font" which is clearly wrong. "System font" is defined in section 10.4 as "the font which is used by the system-ui generic font family name."
Is step 2.2 allowed to use someFontThatActuallySupportsTheLetterE.ttf? It supports the letter e, and we fell off the end of the fallback list, where we're ostensibly allowed to use any font at this point.
When browsers have fallen off the end of the fallback list and they're trying to find some font to use, it's fairly common practice for browsers to use the first font in the font-family list as a hint, to try to find a used font that's as "close" to the hint font as possible. If the hint font itself supports the target character, then it seems not totally unreasonable to just use the hint font itself to render the character.
Options
There are probably 3 options here:
- Say normatively that a
@font-facewithunicode-rangemust never, in any circumstances, be used to render a character outside of itsunicode-rangecharacter set. - Say normatively that step 2 must only be allowed to return an installed font.
- Add no restrictions; once the browser falls off the end of the
font-familylist, all bets are off, it can use any font accessible to the document, including web fonts.
I'm not super sure, but it might be true that options 1 and 2 are behaviorally identical to each other.
- Dominant language
- Bikeshed
- Stars
- 4.9k
- Forks
- 816
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 24
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from w3c/csswg-drafts
-
Agenda+ css-sizing-4 css-values-5
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
w3c/csswg-drafts#14502 · 1 reaction ·
-
css-values-5 editorial Needs Edits
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
w3c/csswg-drafts#14498 · 2 comments ·
-
css-overflow-4 topic: line-clamp
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
w3c/csswg-drafts#14485 · 1 comment ·
-
Administrative Tracker css-values-4
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
w3c/csswg-drafts#14482 · 4 comments · 1 reaction ·
-
css-values-5 Needs Edits
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
w3c/csswg-drafts#14466 ·
All issues in w3c/csswg-drafts
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
bancolombia/sentinel#22 ·
-
test md OpenCI
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
optimization optimization:agents-md-curator
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
githubnext/gh-aw-cao#13143 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 94/100
objectionary/hone-maven-plugin#1061 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
redhat-developer/rhdh-plugins#4887 · 2 comments ·