RESOLVED INVALID 261137
text-box-trim leading radically different results from Figma
https://bugs.webkit.org/show_bug.cgi?id=261137
Summary text-box-trim leading radically different results from Figma
mic.gallego
Reported 2023-09-05 00:50:54 PDT
Created attachment 467549 [details] comparison Hi, We are currently considering using text-box-trim as a progressive enhancement, to ensure the spacing looks consistent across a wide range of fonts. Figma recently introduced support for text-box-trim/text-box-edge, unfortunately there is a big discrepancy between what Figma renders and what Safari TP renders. I have no idea which one is incorrect, but the Safari result is unfortunately unusable (so I hope Safari is wrong). Figma internally uses "cap" for text-box-edge and "both" for text-box-trim. I think the choice to use cap instead of cap alphabetic is to ensure it works best even when all the text is in uppercase. I have attached a screenshot of the differences. I also set a minimum test case that reproduce the odd alignment on Safari: https://codepen.io/bakura10/pen/jOXVNpj
Attachments
comparison (31.04 KB, image/jpeg)
2023-09-05 00:50 PDT, mic.gallego
no flags
fantasai
Comment 1 2023-09-05 14:43:33 PDT
If you want to trim to the cap height on the top and alphabetic baseline on the bottom, you need to specify those metrics. Trimming to the cap height and alphabetic baseline only works in some writing systems--it works fine for English, for example, but not for Chinese. So the default behavior doesn't cut into the space reserved by the font, it only removes the half-leading added by 'line-height'.
fantasai
Comment 2 2023-09-05 14:44:29 PDT
The spec for text-box-trim is here, btw: https://www.w3.org/TR/css-inline-3/ If Figma is defaulting to the cap height and alphabetic baseline, then it's not following the spec.
Radar WebKit Bug Importer
Comment 3 2023-09-12 00:51:12 PDT
fantasai
Comment 4 2024-10-16 11:41:53 PDT
Also, if you're trimming the span that won't have any effect on the paragraph. You need to trim the paragraph to affect the paragraph.
Note You need to log in before you can comment on or make changes to this bug.