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 styles #1635

Merged
merged 24 commits into from
Sep 23, 2024
Merged

Add Font styles #1635

merged 24 commits into from
Sep 23, 2024

Conversation

jamesnw
Copy link
Collaborator

@jamesnw jamesnw commented Aug 20, 2024

Combines several font features-

  • font-weight
  • font-style
  • font-metric-overrides
  • font-size-adjust
  • font-stretch
  • font-size
  • font-family
    • math
    • system-ui
  • font shorthand

@github-actions github-actions bot added the feature definition Creating or defining new features or groups of features. label Aug 20, 2024
@jamesnw jamesnw changed the title Add Font features Add Font styles Aug 21, 2024
@jamesnw jamesnw marked this pull request as ready for review August 21, 2024 20:51
features/font-family-math.yml Outdated Show resolved Hide resolved
features/font-family-system.yml Outdated Show resolved Hide resolved
features/font-family.yml Outdated Show resolved Hide resolved
features/font-metric-overrides.yml Outdated Show resolved Hide resolved
features/font-style.yml Outdated Show resolved Hide resolved
Copy link
Collaborator

@ddbeck ddbeck left a comment

Choose a reason for hiding this comment

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

Leaving a note from our synchronous review

features/font-family-system.yml Outdated Show resolved Hide resolved
@jamesnw jamesnw requested a review from ddbeck September 18, 2024 16:25
Copy link
Collaborator

@ddbeck ddbeck left a comment

Choose a reason for hiding this comment

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

OK, one pass needed on descriptions but this is very close to done. Thank you!

@@ -0,0 +1,12 @@
name: font-stretch
description: The `font-stretch` CSS property selects a font face from a font family based on width, either by a keyword such as "condensed" or a percentage. The `font-stretch` property will be replaced by `font-width`.
Copy link
Collaborator

Choose a reason for hiding this comment

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

font-width exists in no implementations yet (AFAIK). Let's move that to a comment and return to this when there's something contemporary to reference.

Suggested change
description: The `font-stretch` CSS property selects a font face from a font family based on width, either by a keyword such as "condensed" or a percentage. The `font-stretch` property will be replaced by `font-width`.
description: The `font-stretch` CSS property selects a font face from a font family based on width, either by a keyword such as `condensed` or a percentage.
# Note: `font-stretch` will become an alias to `font-width`: https://drafts.csswg.org/css-fonts/#font-stretch-desc

@@ -0,0 +1,11 @@
name: font-size
description: The `font-size` CSS property sets the text size.
Copy link
Collaborator

Choose a reason for hiding this comment

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

The spec says height, which feels like a nice way to dodge the "size sets size" circularity here.

Suggested change
description: The `font-size` CSS property sets the text size.
description: The `font-size` CSS property sets the text height.

@@ -0,0 +1,11 @@
name: Font metric overrides
description: The `ascent-override`, `descent-override` and `line-gap-override` descriptors adjust the display of a font declared in an `@font-face`. This can help make fallback fonts look the same size.
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 `ascent-override`, `descent-override` and `line-gap-override` descriptors adjust the display of a font declared in an `@font-face`. This can help make fallback fonts look the same size.
description: The `ascent-override`, `descent-override`, and `line-gap-override` descriptors adjust the display of a font declared in an `@font-face` statement. This can help make fallback fonts look the same size.

@@ -0,0 +1,5 @@
name: Math font family
description: The `font-family:\ math` CSS declaration uses the browser default font face for displaying mathematical expressions.
Copy link
Collaborator

Choose a reason for hiding this comment

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

FYI, these slashes show up literally

Suggested change
description: The `font-family:\ math` CSS declaration uses the browser default font face for displaying mathematical expressions.
description: The `font-family: math` CSS declaration uses the browser default font face for displaying mathematical expressions.

You can "preview" the HTML for these with npx tsx -p 'import { features } from "./index.ts"; Object.values(features).forEach(f => console.l og(f.description_html));' | grep 'system-ui'

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Removing it breaks YAML, and gives the error-

YAMLParseError: Nested mappings are not allowed in compact mappings at line 2, column 14:

I'm able to fix it by wrapping in double quotes.

@@ -0,0 +1,6 @@
name: System font
description: The `font-family:\ system-ui` CSS declaration uses the operating system default font for text.
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-family:\ system-ui` CSS declaration uses the operating system default font for text.
description: The `font-family: system-ui` CSS declaration uses the operating system default font for text.

@jamesnw jamesnw requested a review from ddbeck September 23, 2024 14:01
@ddbeck ddbeck merged commit 0e4a403 into web-platform-dx:main Sep 23, 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