Skip to content

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

Merged
Veykril merged 1 commit intomainfrom
veykril/push-vtknumwlkktm
Oct 13, 2025
Merged

gpui: Do not render ligatures between different styled text runs#39928
Veykril merged 1 commit intomainfrom
veykril/push-vtknumwlkktm

Conversation

@Veykril
Copy link
Member

@Veykril Veykril commented Oct 10, 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

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label 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 Veykril force-pushed the veykril/push-vtknumwlkktm branch from 8a9b914 to 3b9dbf3 Compare October 11, 2025 17:53
@Veykril Veykril merged commit 3ea4b30 into main Oct 13, 2025
22 checks passed
@Veykril Veykril deleted the veykril/push-vtknumwlkktm branch October 13, 2025 13:35
mikayla-maki added a commit that referenced this pull request Oct 22, 2025
Fixes a bug in #39928

The bug caused all completions to appear in bold-face

Release Notes:

- Fixed a bug where bold-face font was applied to the wrong characters
in items in the autocomplete menu

Co-authored-by: Mikayla Maki <mikayla.c.maki@gmail.com>
mikayla-maki added a commit that referenced this pull request Oct 22, 2025
Fixes a bug in #39928

The bug caused all completions to appear in bold-face

Release Notes:

- Fixed a bug where bold-face font was applied to the wrong characters
in items in the autocomplete menu

Co-authored-by: Mikayla Maki <mikayla.c.maki@gmail.com>
Veykril added a commit that referenced this pull request Oct 23, 2025
Reverts parts of #39928
Closes #40987

Release Notes:

- Fixed some fonts rendering with absurd spacing on MacOS
@osiewicz
Copy link
Member

osiewicz commented Nov 3, 2025

Uh, I don't love that layout_line lost it's generic argument, as that means that we need to always create a SharedString, even if we have one ready at hand.

cyndis added a commit to cyndis/zed that referenced this pull request Nov 27, 2025
After zed-industries#39928, if a font's weight changes between text runs without
other decoration changing, the earlier weight continues to be used
for the subsequent run(s).

PR zed-industries#40840 fixes this in shape_text, but similar code exists also in
layout_text. The latter is used for text in the editor view itself,
so the issue continues to appear when using a highlighting theme
with varied font weights.

Fix the issue by applying the same fix in layout_text.
Veykril pushed a commit that referenced this pull request Dec 1, 2025
After #39928, if a font's weight changes between text runs without other
decoration changing, the earlier weight continues to be used for the
subsequent run(s).

PR #40840 fixes this in shape_text, but similar code exists also in
layout_text. The latter is used for text in the editor view itself, so
the issue continues to appear when using a highlighting theme with
varied font weights.

Fix the issue by applying the same fix in layout_text.

Closes #42297

Release Notes:

- Fixed incorrect font weights in editor view when using a highlighting
theme with varying font weights
github-actions bot pushed a commit that referenced this pull request Dec 5, 2025
After #39928, if a font's weight changes between text runs without other
decoration changing, the earlier weight continues to be used for the
subsequent run(s).

PR #40840 fixes this in shape_text, but similar code exists also in
layout_text. The latter is used for text in the editor view itself, so
the issue continues to appear when using a highlighting theme with
varied font weights.

Fix the issue by applying the same fix in layout_text.

Closes #42297

Release Notes:

- Fixed incorrect font weights in editor view when using a highlighting
theme with varying font weights
zed-zippy bot added a commit that referenced this pull request Dec 5, 2025
…erry-pick to stable) (#44197)

Cherry-pick of #43856 to stable

----
After #39928, if a font's weight changes between text runs without other
decoration changing, the earlier weight continues to be used for the
subsequent run(s).

PR #40840 fixes this in shape_text, but similar code exists also in
layout_text. The latter is used for text in the editor view itself, so
the issue continues to appear when using a highlighting theme with
varied font weights.

Fix the issue by applying the same fix in layout_text.

Closes #42297

Release Notes:

- Fixed incorrect font weights in editor view when using a highlighting
theme with varying font weights

Co-authored-by: Mikko Perttunen <cyndis@kapsi.fi>
someone13574 pushed a commit to someone13574/zed that referenced this pull request Dec 16, 2025
…ies#43856)

After zed-industries#39928, if a font's weight changes between text runs without other
decoration changing, the earlier weight continues to be used for the
subsequent run(s).

PR zed-industries#40840 fixes this in shape_text, but similar code exists also in
layout_text. The latter is used for text in the editor view itself, so
the issue continues to appear when using a highlighting theme with
varied font weights.

Fix the issue by applying the same fix in layout_text.

Closes zed-industries#42297

Release Notes:

- Fixed incorrect font weights in editor view when using a highlighting
theme with varying font weights
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.

Inlay hints affect rendering of non inlay hint characters

2 participants