mirror of
https://github.com/zed-industries/zed.git
synced 2026-12-02 05:20:29 +01:00
985bbf42e6
## Summary `CosmicTextSystem` built `ShapedGlyph` positions from `glyph.x` and `glyph.y` only, dropping cosmic-text's `x_offset` and `y_offset`. Those offsets are how the shaper stacks combining marks on their base glyph. As a result, GPOS mark-to-base positioning was lost: marks rendered at the pen position, to the right of the base. This uses `glyph.x + glyph.x_offset * font_size` and `glyph.y - glyph.y_offset * font_size`, matching `cosmic_text::LayoutGlyph::physical`. This also affects fonts that decompose precomposed characters through `ccmp`, such as Estedad, where `i`/`j` are separate base + mark glyphs. Closes #60387. Related: #61158 (same bug with Thai combining marks). ## Testing ```sh cargo test -p gpui_wgpu combining_marks_are_positioned_over_their_base --lib ``` Before the fix: ```text combining mark positioned after its base: mark.x=6.888px, next.x=6.888px ``` After: ```text 1 passed; 0 failed ``` The test shapes `v` + U+0304 with IBM Plex Sans, which has no precomposed `v`-macron glyph, and asserts the mark is positioned between the base and the next glyph. Manual test: verified in a GPUI app on Linux/Wayland with Estedad 8.5. Before, `i`/`j` dots were displaced; after, they stack correctly. I did not manually test the full Zed editor UI with JuliaMono. ## Self-review - [x] I've reviewed my diff for quality, security, reliability, and performance. - [x] UI changes follow the [checklist](https://zed.dev/docs/development/ui-checklist). This is text shaping, not layout chrome. - [x] Tests cover the new or changed behavior. Release Notes: - Fixed combining marks such as `v̄` rendering to the right of their base glyph on Linux. - [GPUI] Fixed combining marks such as `v̄` rendering to the right of their base glyph on Linux.