bevy/examples/ui
TotalKrill 5986d5d309
Cosmic text (#10193)
# Replace ab_glyph with the more capable cosmic-text

Fixes #7616.

Cosmic-text is a more mature text-rendering library that handles scripts
and ligatures better than ab_glyph, it can also handle system fonts
which can be implemented in bevy in the future

Rebase of https://github.com/bevyengine/bevy/pull/8808

## Changelog

Replaces text renderer ab_glyph with cosmic-text

The definition of the font size has changed with the migration to cosmic
text. The behavior is now consistent with other platforms (e.g. the
web), where the font size in pixels measures the height of the font (the
distance between the top of the highest ascender and the bottom of the
lowest descender). Font sizes in your app need to be rescaled to
approximately 1.2x smaller; for example, if you were using a font size
of 60.0, you should now use a font size of 50.0.

## Migration guide

- `Text2dBounds` has been replaced with `TextBounds`, and it now accepts
`Option`s to the bounds, instead of using `f32::INFINITY` to inidicate
lack of bounds
- Textsizes should be changed, dividing the current size with 1.2 will
result in the same size as before.
- `TextSettings` struct is removed
- Feature `subpixel_alignment` has been removed since cosmic-text
already does this automatically
- TextBundles and things rendering texts requires the `CosmicBuffer`
Component on them as well

## Suggested followups:

- TextPipeline: reconstruct byte indices for keeping track of eventual
cursors in text input
- TextPipeline: (future work) split text entities into section entities
- TextPipeline: (future work) text editing
- Support line height as an option. Unitless `1.2` is the default used
in browsers (1.2x font size).
- Support System Fonts and font families
- Example showing of animated text styles. Eg. throbbing hyperlinks

---------

Co-authored-by: tigregalis <anak.harimau@gmail.com>
Co-authored-by: Nico Burns <nico@nicoburns.com>
Co-authored-by: sam edelsten <samedelsten1@gmail.com>
Co-authored-by: Dimchikkk <velo.app1@gmail.com>
Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
Co-authored-by: Rob Parrett <robparrett@gmail.com>
2024-07-04 20:41:08 +00:00
..
borders.rs Update borders example to match rounded_borders example (#12630) 2024-03-21 18:38:58 +00:00
button.rs fix remaining issues with background color in examples (#14115) 2024-07-03 01:13:55 +00:00
display_and_visibility.rs fix remaining issues with background color in examples (#14115) 2024-07-03 01:13:55 +00:00
flex_layout.rs Omit font size where it closely matches the default in examples (#13952) 2024-06-20 21:01:28 +00:00
font_atlas_debug.rs Adding explanation to seeded rng used in examples (#12593) 2024-03-26 19:40:18 +00:00
grid.rs Omit font size where it closely matches the default in examples (#13952) 2024-06-20 21:01:28 +00:00
overflow.rs Updates default Text font size to 24px (#13603) 2024-05-31 16:41:27 +00:00
overflow_debug.rs Updates default Text font size to 24px (#13603) 2024-05-31 16:41:27 +00:00
relative_cursor_position.rs Migrate from LegacyColor to bevy_color::Color (#12163) 2024-02-29 19:35:12 +00:00
render_ui_to_texture.rs Migrate from LegacyColor to bevy_color::Color (#12163) 2024-02-29 19:35:12 +00:00
rounded_borders.rs Add border radius to UI nodes (adopted) (#12500) 2024-03-19 22:44:00 +00:00
size_constraints.rs fix remaining issues with background color in examples (#14115) 2024-07-03 01:13:55 +00:00
text.rs Cosmic text (#10193) 2024-07-04 20:41:08 +00:00
text_debug.rs Cosmic text (#10193) 2024-07-04 20:41:08 +00:00
text_wrap_debug.rs Cosmic text (#10193) 2024-07-04 20:41:08 +00:00
transparency_ui.rs Make default behavior for BackgroundColor and BorderColor more intuitive (#14017) 2024-06-25 21:50:41 +00:00
ui.rs Updates default Text font size to 24px (#13603) 2024-05-31 16:41:27 +00:00
ui_material.rs Update ui_material example to be a slider instead (#14031) 2024-06-27 21:23:04 +00:00
ui_scaling.rs Cosmic text (#10193) 2024-07-04 20:41:08 +00:00
ui_texture_atlas.rs Make default behavior for BackgroundColor and BorderColor more intuitive (#14017) 2024-06-25 21:50:41 +00:00
ui_texture_atlas_slice.rs Fix border color in ui_texture_slice and ui_texture_atlas_slice examples. (#14121) 2024-07-03 13:51:44 +00:00
ui_texture_slice.rs Fix border color in ui_texture_slice and ui_texture_atlas_slice examples. (#14121) 2024-07-03 13:51:44 +00:00
viewport_debug.rs Fix green colors becoming darker in various examples (#12328) 2024-03-05 23:42:03 +00:00
window_fallthrough.rs Migrate from LegacyColor to bevy_color::Color (#12163) 2024-02-29 19:35:12 +00:00
z_index.rs Fix green colors becoming darker in various examples (#12328) 2024-03-05 23:42:03 +00:00