Open
Description
What problem does this solve or what need does it fill?
from the display_and_visibility
example:
let bottom_frame = commands.spawn(NodeBundle {
style: Style {
flex_direction: FlexDirection::Row,
align_items: AlignItems::Start,
justify_content: JustifyContent::Start,
column_gap: Val::Px(10.),
..Default::default()
},
..default() })
.with_children(|builder| {
let text_style = TextStyle {
font: asset_server.load("fonts/FiraSans-Bold.ttf"),
font_size: 20.0,
color: Color::WHITE,
};
builder.spawn(TextBundle {
text: Text::from_section(
"Display::None\nVisibility::Hidden\nVisibility::Inherited",
TextStyle { color: HIDDEN_COLOR, ..text_style.clone() }
).with_alignment(TextAlignment::Center),
..Default::default()
});
builder.spawn(TextBundle {
text: Text::from_section(
"-\n-\n-",
TextStyle { color: Color::DARK_GRAY, ..text_style.clone() }
).with_alignment(TextAlignment::Center),
..Default::default()
});
builder.spawn(TextBundle::from_section(
"The UI Node and its descendants will not be visible and will not be allotted any space in the UI layout.\nThe UI Node will not be visible but will still occupy space in the UI layout.\nThe UI node will inherit the visibility property of its parent. If it has no parent it will be visible.",
text_style
));
}).id();
In order to format the text it is displayed in three vertical columns. It's extremely unclear what this code is meant to do without running the example to see the displayed output.
A more natural way to write this would be to use tab escape sequences:
commands.spawn(
TextBundle::from_section(
"Display::None\t-\tThe UI Node and its descendants will not be visible and will not be allotted any space in the UI layout.\n\
Visibility::Hidden\t-\tThe UI Node will not be visible but will still occupy space in the UI layout.\n\
Visibility::Inherited\t-\tThe UI node will inherit the visibility property of its parent. If it has no parent it will be visible.",
TextStyle {
font: asset_server.load("fonts/FiraSans-Bold.ttf"),
font_size: 20.0,
color: Color::WHITE,
}).with_alignment(TextAlignment::Center),
);
What solution would you like?
It seems tricky to add tabs from within bevy_text
itself and glyph_brush_layout
ignores \t
.
Maybe the cosmic text implementation will support tabs, I'm not sure.