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. |
nicoburns
left a comment
There was a problem hiding this comment.
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::sizeisn'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::sizeby the reciprocal of the window's scale factor after generating the text layout inupdate_text2d_layoutandbevy_ui::widget::text_system.fixes: #7787
Changelog
TextLayoutInfo::sizeby the reciprocal of the scale factor after text computation to reflect the actual size of the text as drawn.extract_text2d_spriteto apply the alignment offset before the scale factor scaling.Migration Guide
The
sizevalue ofTextLayoutInfois 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.