Skip to content

gpui: Do not render ligatures between different styled text runs#37175

Merged
Veykril merged 3 commits intomainfrom
lw/gpui-ligatures
Sep 1, 2025
Merged

gpui: Do not render ligatures between different styled text runs#37175
Veykril merged 3 commits intomainfrom
lw/gpui-ligatures

Conversation

@Veykril
Copy link
Member

@Veykril Veykril commented Aug 29, 2025

Currently when we render text with differing styles adjacently we might form a ligature between the text, causing the ligature forming characters to take on one of the two styles. This can especially become confusing when a ligature is formed between actual text and inlay hints.

Annoyingly, the only ways to prevent this with core text is to either render each run separately, or to insert a zero-width non-joiner to force core text to break the ligatures apart, as it otherwise will merge subsequent font runs of the same fonts.

We currently do layouting on a per line basis and it is unlikely we want to change that as it would incur a lot of complexity and annoyances to merge things back into a line, so this goes with the other approach of inserting ZWNJ characters instead.

Note that neither linux nor windows seem to currently render ligatures, so this only concerns macOS rendering at the moment.

Release Notes:

  • Fixed ligatures forming between real text and inlay hints on macOS

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Aug 29, 2025
@Veykril Veykril force-pushed the lw/gpui-ligatures branch from a0a4067 to cafa38c Compare August 29, 2025 16:32
@Veykril Veykril changed the title gpui: Do not render ligatures between different text style gpui: Do not render ligatures between different styled text runs Aug 29, 2025
@Veykril Veykril force-pushed the lw/gpui-ligatures branch from b0a5f7d to 2ce2c92 Compare August 29, 2025 21:58
@Veykril Veykril force-pushed the lw/gpui-ligatures branch from 2ce2c92 to 0169535 Compare August 29, 2025 22:17
@Veykril Veykril marked this pull request as ready for review September 1, 2025 07:48
@Veykril Veykril merged commit 62083fe into main Sep 1, 2025
22 checks passed
@Veykril Veykril deleted the lw/gpui-ligatures branch September 1, 2025 07:49
maxdeviant added a commit that referenced this pull request Sep 2, 2025
maxdeviant added a commit that referenced this pull request Sep 2, 2025
…uns (#37175) (#37382)

This reverts commit 62083fe.

We're reverting this as it causes layout shift when typing/selecting
with ligatures:


https://github.com/user-attachments/assets/80b78909-62f5-404f-8cca-3535c5594ceb

Release Notes:

- Reverted #37175
tidely pushed a commit to tidely/zed that referenced this pull request Sep 10, 2025
…-industries#37175)

Currently when we render text with differing styles adjacently we might
form a ligature between the text, causing the ligature forming
characters to take on one of the two styles. This can especially become
confusing when a ligature is formed between actual text and inlay hints.

Annoyingly, the only ways to prevent this with core text is to either
render each run separately, or to insert a zero-width non-joiner to
force core text to break the ligatures apart, as it otherwise will merge
subsequent font runs of the same fonts.

We currently do layouting on a per line basis and it is unlikely we want
to change that as it would incur a lot of complexity and annoyances to
merge things back into a line, so this goes with the other approach of
inserting ZWNJ characters instead.

Note that neither linux nor windows seem to currently render ligatures,
so this only concerns macOS rendering at the moment.

Release Notes:

- Fixed ligatures forming between real text and inlay hints on macOS
tidely pushed a commit to tidely/zed that referenced this pull request Sep 10, 2025
…uns (zed-industries#37175) (zed-industries#37382)

This reverts commit 62083fe.

We're reverting this as it causes layout shift when typing/selecting
with ligatures:


https://github.com/user-attachments/assets/80b78909-62f5-404f-8cca-3535c5594ceb

Release Notes:

- Reverted zed-industries#37175
Veykril added a commit that referenced this pull request Oct 10, 2025
)

Currently when we render text with differing styles adjacently we might
form a ligature between the text, causing the ligature forming
characters to take on one of the two styles. This can especially become
confusing when a ligature is formed between actual text and inlay hints.

Annoyingly, the only ways to prevent this with core text is to either
render each run separately, or to insert a zero-width non-joiner to
force core text to break the ligatures apart, as it otherwise will merge
subsequent font runs of the same fonts.

We currently do layouting on a per line basis and it is unlikely we want
to change that as it would incur a lot of complexity and annoyances to
merge things back into a line, so this goes with the other approach of
inserting ZWNJ characters instead.

Note that neither linux nor windows seem to currently render ligatures,
so this only concerns macOS rendering at the moment.

Release Notes:

- Fixed ligatures forming between real text and inlay hints on macOS
Veykril added a commit that referenced this pull request Oct 11, 2025
)

Currently when we render text with differing styles adjacently we might
form a ligature between the text, causing the ligature forming
characters to take on one of the two styles. This can especially become
confusing when a ligature is formed between actual text and inlay hints.

Annoyingly, the only ways to prevent this with core text is to either
render each run separately, or to insert a zero-width non-joiner to
force core text to break the ligatures apart, as it otherwise will merge
subsequent font runs of the same fonts.

We currently do layouting on a per line basis and it is unlikely we want
to change that as it would incur a lot of complexity and annoyances to
merge things back into a line, so this goes with the other approach of
inserting ZWNJ characters instead.

Note that neither linux nor windows seem to currently render ligatures,
so this only concerns macOS rendering at the moment.

Release Notes:

- Fixed ligatures forming between real text and inlay hints on macOS
Veykril added a commit that referenced this pull request Oct 13, 2025
)

This relands #37175 as
#39886 fixed the jiggling
issue.

Currently when we render text with differing styles adjacently we might
form a ligature between the text, causing the ligature forming
characters to take on one of the two styles. This can especially become
confusing when a ligature is formed between actual text and inlay hints.

Annoyingly, the only ways to prevent this with core text is to either
render each run separately, or to insert a zero-width non-joiner to
force core text to break the ligatures apart, as it otherwise will merge
subsequent font runs of the same fonts.

We currently do layouting on a per line basis and it is unlikely we want
to change that as it would incur a lot of complexity and annoyances to
merge things back into a line, so this goes with the other approach of
inserting ZWNJ characters instead.

Note that neither linux nor windows seem to currently render ligatures,
so this only concerns macOS rendering at the moment.

Closes #23194

Release Notes:

- Fixed ligatures forming between real text and inlay hints on macOS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant