Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add Font face features #1644

Merged
merged 8 commits into from
Sep 6, 2024
Merged

Add Font face features #1644

merged 8 commits into from
Sep 6, 2024

Conversation

jamesnw
Copy link
Collaborator

@jamesnw jamesnw commented Aug 21, 2024

  • Adds api.CSSFontFaceRule to font-face
  • Adds font-display
    - Adds unicode-range

@github-actions github-actions bot added the feature definition Creating or defining new features or groups of features. label Aug 21, 2024
Copy link
Collaborator

@autonome autonome left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pre-review before @ddbeck.

Not a blocking comment, just an observation on feature composition that I'm sure we'll figure out over time: From a designer/developer POV, seems like font-display could be merged into font-face feature, vs disappearing in a sea of font group features. Would help with discovery.

features/unicode-range.yml Outdated Show resolved Hide resolved
@@ -0,0 +1,7 @@
name: font-display
description: The `font-display` CSS descriptor sets what is displayed while a font face loads.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
description: The `font-display` CSS descriptor sets what is displayed while a font face loads.
description: The `font-display` CSS descriptor sets whether to show a substitute font or nothing while a font face loads. The property manages what's known as a flash of unstyled text or flash of invisible text.

What do you think of an elaboration like this? The first bit is to avoid a circular description ("font-display … sets what is displayed"), while the second is address what this is for, though maybe it's being a bit too assertive.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like that, and adding that specific use case makes sense.

@@ -0,0 +1,7 @@
name: unicode-range
description: The `unicode-range` CSS descriptor specifies the characters to be used from a font face, using Unicode codepoints individually, in a range, or with a wildcard match. If the characters aren't present on the page, the font is not downloaded.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc: @autonome

I'm going to do something terrible here which is to lay down a lot of text on how to do something, then ask you to ignore it and throw it out—skip to HOWEVER if you find this unbearable. 😄

So I'm on a bit of a crusade against "specify" (and "determine") in place of "set", "pick", or "choose." They're a bit like "utilize" — they have a lot of bonus syllables that say the same thing as a more direct alternative ("use"). But this crusade is for a good cause: speaking directly to developers, in a direct and confident way.

Anyway, here's my attempt to revise this. I think not loading is the central point, so I tried to move it to the beginning of the description, where you're more likely to read/skim it.

Suggested change
description: The `unicode-range` CSS descriptor specifies the characters to be used from a font face, using Unicode codepoints individually, in a range, or with a wildcard match. If the characters aren't present on the page, the font is not downloaded.
description: The `unicode-range` CSS descriptor controls whether to load a font, if the characters picked by the descriptor appear in the page. You can choose characters by Unicode code point, code point range, or wildcard pattern.

HOWEVER—and I only noticed this after writing most of the above, so forgive me—I think this feature is somewhat needless. It's part of @font-face and doesn't meaningfully depart from its overall status. I think we should add the unicode-range key to font-face and the font-unicode-range to the caniuse array.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not unbearable at all! And I agree with the merge.

@jamesnw jamesnw requested a review from ddbeck September 6, 2024 13:09
@ddbeck ddbeck merged commit 8fa1500 into web-platform-dx:main Sep 6, 2024
3 checks passed
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
feature definition Creating or defining new features or groups of features.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants