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

Subpixel text positioning #1196

Merged
merged 2 commits into from
Jan 3, 2021
Merged

Conversation

blunted2night
Copy link
Contributor

This PR adds a feature to support sub-pixel glyph positioning. This requires creating multiple atlas sprites per glyph based on the sub-pixel offset of the glyph in its layout. As this will increase the amount of texture memory required I placed it behind a feature gate which is not enabled by default.

In the example below you can see several differences in the rendering of glyphs, in particular the final 'e' is different from the first one, and the spacing of the adjacent 'l' is better.

example-subpixel

By getting the placement correct, the glyphs in the right justified text in the text_debug example no longer jiggle.

wo-subpixel.mp4
w-subpixel.mp4

@cart
Copy link
Member

cart commented Jan 3, 2021

I agree with the decisions made here. Its nice to have the option if/when people care, but it will likely significantly affect gpu memory usage (and atlas rebinds).

@cart cart merged commit 60be998 into bevyengine:master Jan 3, 2021
@blunted2night blunted2night deleted the subpixel-positioning branch January 4, 2021 15:52
rparrett pushed a commit to rparrett/bevy that referenced this pull request Jan 27, 2021
* cleanup unnecessary changes from PR bevyengine#1171

* add feature to correctly render glyphs with sub-pixel positioning
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants