-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Support dynamic text rasterization size #24120
Copy link
Copy link
Open
Labels
A-RenderingDrawing game state to the screenDrawing game state to the screenA-TextRendering and layout for charactersRendering and layout for charactersC-FeatureA new feature, making something new possibleA new feature, making something new possibleD-ComplexQuite challenging from either a design or technical perspective. Ask for help!Quite challenging from either a design or technical perspective. Ask for help!S-Needs-DesignThis issue requires design work to think about how it would best be accomplishedThis issue requires design work to think about how it would best be accomplished
Metadata
Metadata
Assignees
Labels
A-RenderingDrawing game state to the screenDrawing game state to the screenA-TextRendering and layout for charactersRendering and layout for charactersC-FeatureA new feature, making something new possibleA new feature, making something new possibleD-ComplexQuite challenging from either a design or technical perspective. Ask for help!Quite challenging from either a design or technical perspective. Ask for help!S-Needs-DesignThis issue requires design work to think about how it would best be accomplishedThis issue requires design work to think about how it would best be accomplished
Type
Projects
Status
Needs SME Triage
What problem does this solve or what need does it fill?
Bevy currently couples text rasterization size directly to font size, which is also used as a logical unit for UI layout. This makes it difficult to render high resolution text (e.g. for zoomable interfaces like node graphs or other editors) without also affecting layout size.
Existing workarounds such as increasing font size and scaling down via
UiTransform, or usingUiScaleare cumbersome, fragile, and can introduce layout inconsistencies. They also lack flexibility, because layout is calculated beforeUiTransformscale is applied.What solution would you like?
A solution that allows dynamic control, ideally hierarchical, over text rasterization resolution independently of layout size would be ideal and was implemented in #24061, however this added too much extra complexity for a relatively niche feature.
What alternative(s) have you considered?
An alternative solution, which scales the logical to physical pixel conversion was implemented by @ickshonpe as https://github.com/ickshonpe/bevy_ui_local_scale. This solution is hierarchical and has less downsides than the other current workarounds, however, you still need to inversely scale via
UiTransformfor the text to be the desired size on screen, making zoom implementations that want to dynamically change the text rasterization size based on zoom level tricky. Dynamically changing text rasterization size based on zoom level is required for text to maintain good legibility at all zoom level. Small rasterization size reads better when zoomed out, while high rasterization size reads better when zoomed in.Another possible solution is to support vector based text rendering, which is more expensive (and might look a little worse?), but would be perfect for this use case, but would introduce a completely separate text rendering path - high complexity.