-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
TextLayoutInfo::size
should hold the drawn size of the text, and not a scaled value.
#7794
TextLayoutInfo::size
should hold the drawn size of the text, and not a scaled value.
#7794
Conversation
TextLayoutInfo::size
holds the actual size of the text, and not a scaled value.TextLayoutInfo::size
holds the actual size of the text for Text2d, and not a scaled value.
TextLayoutInfo::size
holds the actual size of the text for Text2d, and not a scaled value.TextLayoutInfo::size
holds of the text as drawn, and not a scaled value.
TextLayoutInfo::size
holds of the text as drawn, and not a scaled value.TextLayoutInfo::size
holds the drawn size of the text, and not a scaled value.
I didn't make the same change in the UI, as it's much less useful and |
TextLayoutInfo::size
holds the drawn size of the text, and not a scaled value.TextLayoutInfo::size
should hold the drawn size of the text, and not a scaled value.
This no longer true about |
@ickshonpe are you happy with the state of this, or would you like to make additional changes in this PR? |
I'm just fixing it now. |
* convert `TextLayoutInfo` size to logical coords
* converted `TextLayoutInfo` size to logical coords
@alice-i-cecile should all be correct now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the name change. Have checked and it text still seems to be rendering correctly with this PR :)
Looks like this got two approvals but was forgotten about. Making a note here check on this PR after #9676 is resolved. |
@ickshonpe want to rebase this for us? |
Yep having a look now. |
…ling for the UI text widget.
…kshonpe/bevy into text2d-textlayoutinfo-scaling
Rebased and seems to be working correctly. Since Text2d isn't working atm I merged this and #9708 at https://github.com/ickshonpe/bevy/tree/text2d-visibility-fix-logical-text-layout-info |
…t a scaled value. (bevyengine#7794) # Objective `TextLayoutInfo::size` isn't the drawn size of the text, but a scaled value. This is fragile, counter-intuitive and makes it awkward to retrieve the correct value. ## Solution Multiply `TextLayoutInfo::size` by the reciprocal of the window's scale factor after generating the text layout in `update_text2d_layout` and `bevy_ui::widget::text_system`. --- fixes: bevyengine#7787 ## Changelog * Multiply `TextLayoutInfo::size` by the reciprocal of the scale factor after text computation to reflect the actual size of the text as drawn. * Reorder the operations in `extract_text2d_sprite` to apply the alignment offset before the scale factor scaling. ## Migration Guide The `size` value of `TextLayoutInfo` is stored in logical pixels and has been renamed to `logical_size`. There is no longer any need to divide by the window's scale factor to get the logical size.
Objective
TextLayoutInfo::size
isn't the drawn size of the text, but a scaled value. This is fragile, counter-intuitive and makes it awkward to retrieve the correct value.Solution
Multiply
TextLayoutInfo::size
by the reciprocal of the window's scale factor after generating the text layout inupdate_text2d_layout
andbevy_ui::widget::text_system
.fixes: #7787
Changelog
TextLayoutInfo::size
by the reciprocal of the scale factor after text computation to reflect the actual size of the text as drawn.extract_text2d_sprite
to apply the alignment offset before the scale factor scaling.Migration Guide
The
size
value ofTextLayoutInfo
is stored in logical pixels and has been renamed tological_size
. There is no longer any need to divide by the window's scale factor to get the logical size.