You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
mattzque opened this issue
Jun 7, 2023
· 3 comments
Labels
A-TextRendering and layout for charactersA-UIGraphical user interfaces, styles, layouts, and widgetsC-FeatureA new feature, making something new possible
What problem does this solve or what need does it fill?
There seems to be no way to adjust the line spacing and letter spacing / glyph spacing. To make text more readable I'd like to increase the line height to 1.5, which is typically used to make longer paragraphs more readable.
What solution would you like?
Something similar to line-height(mdn) and letter-spacing (mdn) in CSS would be great. Ideally it should take the font size into account instead of just an absolute (logical) pixel value, but any way to adjust it would already be great.
Letter spacing would most likely be more challenging than line height, since it might affect line breaking and should be calculated before the line breaking occurs, but since they seem related I thought I make an issue about both.
What alternative(s) have you considered?
I don't see any way to achieve this myself since TextSection already implements line breaking I think it should handle this.
But perhaps there is a way to do this already?
I'm not sure if this is something we can adjust in bevy, given the calculated glyph information provided by glyph-brush or if this has to be added upstream first.
The text was updated successfully, but these errors were encountered:
It's not hard at all to implement a basic version that just adds absolute space between lines.
I'm not quite sure what to do about a version that takes font size into account because a TextBundle can have multiple fonts. Perhaps it should just use the size of the largest font in the TextBundle.
Character spacing shouldn't be difficult either but might be better left until after the switch to Cosmic Text.
I just noticed #7616 mentions implementing support for line height, which would be great. Hopefully letter-spacing can follow soon after, since it's practically impossible to implement designs using custom letter-spacing now.
A-TextRendering and layout for charactersA-UIGraphical user interfaces, styles, layouts, and widgetsC-FeatureA new feature, making something new possible
What problem does this solve or what need does it fill?
There seems to be no way to adjust the line spacing and letter spacing / glyph spacing. To make text more readable I'd like to increase the line height to 1.5, which is typically used to make longer paragraphs more readable.
What solution would you like?
Something similar to
line-height
(mdn) andletter-spacing
(mdn) in CSS would be great. Ideally it should take the font size into account instead of just an absolute (logical) pixel value, but any way to adjust it would already be great.Letter spacing would most likely be more challenging than line height, since it might affect line breaking and should be calculated before the line breaking occurs, but since they seem related I thought I make an issue about both.
What alternative(s) have you considered?
I don't see any way to achieve this myself since TextSection already implements line breaking I think it should handle this.
But perhaps there is a way to do this already?
Additional context
I believe the glyph positioning is calculated here:
https://github.com/bevyengine/bevy/blob/main/crates/bevy_text/src/glyph_brush.rs#L34
using the glyph_brush crate:
https://github.com/alexheretic/glyph-brush/blob/main/layout/src/builtin.rs#L135
There is also a related issue I found:
alexheretic/glyph-brush#132
I'm not sure if this is something we can adjust in bevy, given the calculated glyph information provided by glyph-brush or if this has to be added upstream first.
The text was updated successfully, but these errors were encountered: