gpui: Add dynamic padding to prevent glyph clipping in text rendering on macOS (#45957)
Jony Lab
,
Claude Sonnet 4.5
, and
Jason Lee
created
Here may caused by [font-kit](https://github.com/servo/font-kit), I was
tried to use
[render-glyph](https://github.com/servo/font-kit/blob/main/examples/render-glyph.rs)
example and also use the same option with `Transform2F::from_scale(2.0)`
for `raster_bounds`.
Then the `raster_bounds` will result same issue like the GPUI's font
rendering issue.
| Transform2F::default() | Transform2F::from_scale(2.) |
| --- | -- |
| <img width="943" height="638" alt="image"
src="https://github.com/user-attachments/assets/9b827c63-2cbb-45d3-bd62-b0e058a46614"
/> | <img width="943" height="638" alt="image"
src="https://github.com/user-attachments/assets/ee977a9b-2a7b-4b78-873b-146b2953c0db"
/> |
## Before
<img width="1032" height="1398" alt="SCR-20260105-pgcp-2"
src="https://github.com/user-attachments/assets/ebeb04cc-3a92-4333-99fc-8733a63b2553"
/>
## After
<img width="1032" height="1414" alt="SCR-20260105-pfny-1"
src="https://github.com/user-attachments/assets/063d0452-56d7-447c-810b-fee7c891235b"
/>
Release Notes:
- Fixed incorrect rendering of characters at large font sizes on macOS
---------
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
Co-authored-by: Jason Lee <huacnlee@gmail.com>