Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

fonts: Add support for more @font-face features #32164

Merged
merged 1 commit into from Apr 29, 2024

Conversation

mrobinson
Copy link
Member

There are a couple major changes here:

  1. Support is added for the weight, style, stretch and
    unicode-range declarations in @font-face.
  2. Font matching in the font cache can return templates and
    FontGroupFamily can own mulitple templates. This is due to needing
    support for "composite fonts". These are @font-face declarations
    that only differ in their unicode-range definition.

This fixes a lot of non-determinism in font selection especially when
dealing with pages that define "composite faces." A notable example of
such a page is servo.org, which now consistently displays the correct
web font.

One test starts to fail due to an uncovered bug, but this will be fixed
in a followup change.

Fixes #20686.
Fixes #20684.

Co-authored-by: Mukilan Thiyagarajan mukilan@igalia.com


  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • There are tests for these changes

@mrobinson mrobinson force-pushed the better-css-font-face-matching branch from dfacc34 to c18f6d7 Compare April 27, 2024 15:39
@mrobinson mrobinson requested a review from mukilan April 27, 2024 15:49
@mrobinson mrobinson changed the title fonts: Add support for more @font-face features fonts: Add support for more @font-face features Apr 27, 2024
@@ -69,61 +62,69 @@ impl FontIdentifier {
}
}

impl fmt::Debug for FontIdentifier {
Copy link
Member

Choose a reason for hiding this comment

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

Should we add a comment noting why this is not simply derive(Debug)?

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh, good point. I've updated this to remove our custom version of the Debug. I think the real fix here is to not truncate URLs in ServoUrl Debug impl.

@mrobinson mrobinson force-pushed the better-css-font-face-matching branch from c18f6d7 to fdf8067 Compare April 29, 2024 14:36
@mrobinson mrobinson added this pull request to the merge queue Apr 29, 2024
There are a couple major changes here:

1. Support is added for the `weight`, `style`, `stretch` and
   `unicode-range` declarations in `@font-face`.
2. Font matching in the font cache can return templates and
   `FontGroupFamily` can own mulitple templates. This is due to needing
   support for "composite fonts". These are `@font-face` declarations
   that only differ in their `unicode-range` definition.

This fixes a lot of non-determinism in font selection especially when
dealing with pages that define "composite faces." A notable example of
such a page is servo.org, which now consistently displays the correct
web font.

One test starts to fail due to an uncovered bug, but this will be fixed
in a followup change.

Fixes servo#20686.
Fixes servo#20684.

Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
@mrobinson mrobinson force-pushed the better-css-font-face-matching branch from fdf8067 to baf4a9e Compare April 29, 2024 16:32
@mrobinson mrobinson removed this pull request from the merge queue due to a manual request Apr 29, 2024
@mrobinson mrobinson added this pull request to the merge queue Apr 29, 2024
Merged via the queue into servo:main with commit 4732da3 Apr 29, 2024
9 checks passed
@mrobinson mrobinson deleted the better-css-font-face-matching branch April 29, 2024 21:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants