Skip to content

[css-viewport][css-fonts] Effect of the zoom property on font metrics as applied to length units #14260

Open

Description

@weinig

Consider the following scenario:

.test {
    font-size: 10px;
    zoom: 2;
    tab-size: 1ex;
}

In this scenario, the computed value for tab-size depends on how / when font metrics get computed.

Option 1 would be for the engine to perform font resolution using the computed value of font-size 10px, and then at use time, scaling all metrics by the zoom.

Option 2 (and what at least WebKit is currently doing) would be for the engine to perform font resolution using the used value of the font-size 20px and using it directly.

With this option, the naive computed value for tab-size would be way too big, as it would be using the x-height for a 20px font-size. What WebKit does to compensate is that it unscales the x-height by the zoom to bring it back into proportion. This is problematic as, unless x-height scales exactly linearly with font-size, the value can be distinct from the equivalent example without zoom:

.test {
    font-size: 10px;
    tab-size: 1ex;
}

Option 3 would be perform font resolution for both the computed and used font sizes, stashing the metrics for the unzoomed value away for use by units.

--

So, the questions are:

  • Does CSS Fonts define which font-size to use for font resolution when zoom is in play? (I wasn't able to find anything, but most things don't specify custom behavior with zoom, so this isn't unexpected).
  • If not, is there consensus on which option above is correct?

cc @emilio @svgeesus

Activity

  1. changed the title [-][css-viewport][css-fonts] Effect of the `zoom` property on font metrics[/-] [+][css-viewport][css-fonts] Effect of the `zoom` property on font metrics as applied to length units[/+] on Aug 4, 2026
  2. weinig commented on Aug 27, 2026

    @weinig
    ContributorAuthor

    One additional piece of information here is this text from CSS Fonts about the font-size-adjust property:

    The value of font-size-adjust affects the used value of font-size but does not affect the computed value. It affects the size of relative units that are based on font metrics such as ex and ch but does not affect the size of em units.

    (link)

    This implies / states that font metrics and font metric based units like ex and ch are affected by the used value of font-size.

    That still doesn't quite answer the question here though, as zoom is applied on top of the used value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions