`canvas.measureText` disagrees with DOM on `Shantell Sans weight 700` in Chrome and Firefox
Author: arnaud-secondlayerCreated Jun 3, 2026Updated Sep 13, 2026
For Shantell Sans at weight 700, `prepareWithSegments` + `layoutWithLines` chooses a different break position than the browser's `` wrap in Chrome and Firefox.
The DOM shows 3 rows of 15 characters and the last row is 11 characters.
Pretext returns a different layout with 3 rows of 16 characters and the last row is 8 characters.
== macOS Chrome ==
```
xxxxxxxxxxxxxxx
xxxxxxxxxxxxxxx
xxxxxxxxxxxxxxx
xxxxxxxxxxx
DOM
0: width=134.04
1: width=134.04
2: width=134.04
3: width=98.20
Pretext
0: width=137.28 for 16 chars
1: width=137.28 for 16 chars
2: width=137.28 for 16 chars
3: width=68.64 for 8 chars
```
== macOS Firefox ==
```
xxxxxxxxxxxxxxx
xxxxxxxxxxxxxxx
xxxxxxxxxxxxxxx
xxxxxxxxxxx
DOM
0: width=134.50
1: width=134.50
2: width=134.50
3: width=98.25
Pretext
0: width=137.33 for 16 chars
1: width=137.33 for 16 chars
2: width=137.33 for 16 chars
3: width=68.67 for 8 chars
```
HTML file:
```
DOM
Pretext
```Source: chenglou/pretext