Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Force disable kerning for monospace text #783

Merged
merged 1 commit into from
Mar 15, 2024

Conversation

CryZe
Copy link
Collaborator

@CryZe CryZe commented Mar 15, 2024

cosmic-text unfortunately has no way to turn off kerning yet. However, it's essential for our monospaced text to not have kerning. This implements a small workaround that simply looks up (and caches) the x advance for each glyph and uses it to advance the x coordinate instead of the x advance that comes out of the shaping.

This also improves performance because the times on the right side of the layout are all supposed to be monospaced. However, the fact that they didn't use kerning meant that their widths were constantly changing, changing the amount of space that is available on the left side for the text. This caused the text on the left to recalculate its ellipsis overflow state, which often forced the entire background layer to be rerendered.

`cosmic-text` unfortunately has no way to turn off kerning yet. However,
it's essential for our monospaced text to not have kerning. This
implements a small workaround that simply looks up (and caches) the x
advance for each glyph and uses it to advance the x coordinate instead
of the x advance that comes out of the shaping.

This also improves performance because the times on the right side of
the layout are all supposed to be monospaced. However, the fact that
they didn't use kerning meant that their widths were constantly
changing, changing the amount of space that is available on the left
side for the text. This caused the text on the left to recalculate its
ellipsis overflow state, which often forced the entire background layer
to be rerendered.
@CryZe CryZe added enhancement An improvement for livesplit-core. rendering The issue or pull request is affecting the rendering. feature A new user visible feature for livesplit-core. priority: high This is a high priority issue. performance Affects the performance of the code. text engine This is about the text engine implementation. labels Mar 15, 2024
@CryZe CryZe added this to the v0.14 milestone Mar 15, 2024
@CryZe CryZe merged commit 7a3c0aa into LiveSplit:master Mar 15, 2024
70 checks passed
@CryZe CryZe deleted the text-engine-monospace-kerning branch March 15, 2024 19:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An improvement for livesplit-core. feature A new user visible feature for livesplit-core. performance Affects the performance of the code. priority: high This is a high priority issue. rendering The issue or pull request is affecting the rendering. text engine This is about the text engine implementation.
Projects
Development

Successfully merging this pull request may close these issues.

1 participant