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

feat: Support font-relative ch and ic units #32171

Merged
merged 4 commits into from
May 2, 2024

Commits on May 1, 2024

  1. feat: Support font-relative ch and ic units

    After servo#31966, which made it possible for the first time to resolve
    font-relative CSS units, this change adds support for the `ch` and
    `ic` units.
    
    One difference with the `ex` unit that was added in that PR is that
    these units must reflect the advance width of a character (the zero
    digit in the case of `ch`, and the CJK water radical for `ic`) as it
    would be rendered by the current font group. This means that the size
    of these units don't only depend on the first available font, in the
    case where that font does not contain a glyph for that character.
    
    This is implemented by adding the advance width for these two
    characters as optional fields of `FontMetrics`, so the advance width
    computation happens in advance. Then, when the font metrics are
    queried as part of unit resolution, the font group is searched for the
    first font containing that character.
    
    This change only implements support for these units in upright
    typesetting modes, since Servo does not yet have support for vertical
    writing modes. This means that many of the WPT tests that test for the
    behavior of these units with vertical writing modes do not pass.
    
    This change also makes a number of WPT tests pass, which relied on the
    `ch` and `ic` units. It, however, also makes the test
    `/css/css-text/white-space/text-wrap-balance-overflow-002.html` fail,
    since it tests `text-wrap: balance`, which Servo does not yet
    implement, and it was only previously passing by chance due to the
    previous behavior of these units.
    andreubotella committed May 1, 2024
    Configuration menu
    Copy the full SHA
    6d436e1 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    9179dd0 View commit details
    Browse the repository at this point in the history
  3. Fix formatting

    andreubotella committed May 1, 2024
    Configuration menu
    Copy the full SHA
    145ca00 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    ad52618 View commit details
    Browse the repository at this point in the history