-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Fix for vertical text bounds and alignment #9133
Commits on Jul 12, 2023
-
Update
GlobalTransform
on insertion (bevyengine#9081)# Objective `GlobalTransform` after insertion will be updated only on `Transform` or hierarchy change. Fixes bevyengine#9075 ## Solution Update `GlobalTransform` after insertion too. --- ## Changelog - `GlobalTransform` is now updated not only on `Transform` or hierarchy change, but also on insertion.
Configuration menu - View commit details
-
Copy full SHA for b2492d6 - Browse repository at this point
Copy the full SHA b2492d6View commit details -
TextPipeline::queue_text
, `TextMeasureInfo::compute_size_from_secti……on_texts` and `GlyphBrush::process_glyphs` each have a section of code that calculates the minimum bounds around a list of text sections. The first two functions don't apply any rounding, but `process_glyphs` also floors all the values. It seems like this can cause conflicts where the text gets incorrectly shaped. Also when Bevy computes the text bounds it chooses the smallest possible rect that fits all the glyphs, ignoring white space. The glyphs are then realigned vertically so the first glyph is on the top line. Leading empty lines are missed off. This PR adds a function `compute_text_bounds` that replaces the duplicate code, so the text bounds are rounded the same way by each function. Also, since Bevy doen't use ab_glyph to control vertical alignment, the min y bound is just always set to 0 which ensures no leading empty lines will be will missed. There is another problem in that trailing empty lines are also ignored, but that's more difficult to deal with and much less important than the other issues.
Configuration menu - View commit details
-
Copy full SHA for e40349d - Browse repository at this point
Copy the full SHA e40349dView commit details -
Configuration menu - View commit details
-
Copy full SHA for b1ecd0e - Browse repository at this point
Copy the full SHA b1ecd0eView commit details -
TextPipeline::queue_text
, `TextMeasureInfo::compute_size_from_secti……on_texts` and `GlyphBrush::process_glyphs` each have a section of code that calculates the minimum bounds around a list of text sections. The first two functions don't apply any rounding, but `process_glyphs` also floors all the values. It seems like this can cause conflicts where the text gets incorrectly shaped. Also when Bevy computes the text bounds it chooses the smallest possible rect that fits all the glyphs, ignoring white space. The glyphs are then realigned vertically so the first glyph is on the top line. Leading empty lines are missed off. This PR adds a function `compute_text_bounds` that replaces the duplicate code, so the text bounds are rounded the same way by each function. Also, since Bevy doen't use ab_glyph to control vertical alignment, the min y bound is just always set to 0 which ensures no leading empty lines will be will missed. There is another problem in that trailing empty lines are also ignored, but that's more difficult to deal with and much less important than the other issues.
Configuration menu - View commit details
-
Copy full SHA for bb4229e - Browse repository at this point
Copy the full SHA bb4229eView commit details -
Configuration menu - View commit details
-
Copy full SHA for 6838c7d - Browse repository at this point
Copy the full SHA 6838c7dView commit details -
Configuration menu - View commit details
-
Copy full SHA for f7cca69 - Browse repository at this point
Copy the full SHA f7cca69View commit details -
Configuration menu - View commit details
-
Copy full SHA for 2b33ecb - Browse repository at this point
Copy the full SHA 2b33ecbView commit details -
Configuration menu - View commit details
-
Copy full SHA for b7db366 - Browse repository at this point
Copy the full SHA b7db366View commit details -
Configuration menu - View commit details
-
Copy full SHA for dcaf0c9 - Browse repository at this point
Copy the full SHA dcaf0c9View commit details
Commits on Jul 13, 2023
-
Changed the visibility of
bevy_ui::glyph_brush::compute_text_bounds
…… to `pub (crate)` and added some doc comments.
Configuration menu - View commit details
-
Copy full SHA for 0ed18d8 - Browse repository at this point
Copy the full SHA 0ed18d8View commit details -
Configuration menu - View commit details
-
Copy full SHA for 01f6788 - Browse repository at this point
Copy the full SHA 01f6788View commit details -
Configuration menu - View commit details
-
Copy full SHA for 93011f5 - Browse repository at this point
Copy the full SHA 93011f5View commit details