# Use ch-width \(\`0\`\) instead of em-width \(\`m\`\) for gutter width calculation \(\#32548\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/242af863f56220ea6b8fd28d17353ee01bd53a14)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 242af863f56220ea6b8fd28d17353ee01bd53a14

Requested commit: 242af863f56220ea6b8fd28d17353ee01bd53a14

Commit: 242af863f56220ea6b8fd28d17353ee01bd53a14

Tree: be4bf1dbbaa6413001eb257a3b9bd8f47af72316

Author: Max Mynter

Committer: GitHub

## Message

```
Use ch-width (`0`) instead of em-width (`m`) for gutter width calculation (#32548)

Closes #21860

Release Notes:

- Added `ch_width` and `ch_advance` function alongside their `em_*`
counterparts
- Use `ch_*` version to calculate gutter layouts
- Update a stale comment from changes in #31959

The ch units refer to the width of the number `0` whereas em is the
width of `m` and the actual font size (e.g. 16px means 16 px width of
`m`).

This change has no effect for monospaced fonts but can be drastic for
proportional ones as seen below for "Zed Plex Sans" with a
`"min_line_number_width" = 4`.

<img width="726" alt="Screenshot 2025-06-11 at 15 47 35"
src="https://github.com/user-attachments/assets/aa73f4d4-32bc-42cf-a9f6-7e25fee68c9a"
/>
```

## Parents

- [f428d54b74611dbd5f58b4239b4ddd96eeef7e33](https://git.cafe/gitcafe/zed/commit/f428d54b74611dbd5f58b4239b4ddd96eeef7e33?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/242af863f56220ea6b8fd28d17353ee01bd53a14?format=markdown)
