-
-
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
TextComponents - Position changes with length of text #401
Comments
The first shot is the normal |
Suggested labels: |
I agree with you this is definitely a bug thanks for letting us know :) If anyone is reading this can you confirm the bug repros on other platforms too 😊 |
This happens due to how the flexbox engine interacts with fixed size elements:
This then results in the behavior we see now: A smaller height divided by two makes for an 'upwards' growing text, when in actuality it should be shrinking to fit the available width. I am not sure what the ideal solution is here. Either the text overflows, or it gets smaller and smaller. Another option is to have it break into a new line (if there is space?) |
In my use-case I would like to wrap. From my naive standpoint of never having had to implement a text layout system, it seems like wrap vs. shrink vs. overflow should all be supported via some configurable option. I don't know how hard that is to do. |
I have this issue, my "fix" to have the expected placement is to set the TextComponents {
style: Style {
size: Size {
height: Val::Px(40.),
..Default::default()
},
..Default::default()
},
text: Text {
value: "Text example",
font,
style: TextStyle {
color: Color::WHITE,
font_size: 40.,
},
},
..Default::default()
} |
On macOS, just altering this string slice causes the vertical position of the text to change!
The text was updated successfully, but these errors were encountered: