Skip to content

Add Text Effects such as border and shadow #17076

Open
@deavid

Description

@deavid

What problem does this solve or what need does it fill?

When drawing text over an unknown background it can get into situations of lack of contrast. For example drawing a score directly over the game with no UI, or where the UI background is fully transparent.

Having the ability to add effects to the text such an outline/border, a shadow or other kinds of effects allows us to place the text anywhere and keep the contrast so it can be read easily without the need of adding a rectangle with a background which in some cases it might be seen ugly or not fitting the game vision.

Text effects could be more things, for example applying a vertical gradient to the font face - these would be aimed for some decorations and fancy stuff. However the most important ones are outline and/or shadow because they make the text more readable.

What solution would you like?

Ideally something that precomputes the glyphs after the effect is applied so that rendering is fast.

However, duplicating the text in a different color and offsetting it is also good enough as long as this is automated and reliable.

If we need to pre-bake this into a font on the app start, that is also fine. But it should be handled by Bevy entirely.

What alternative(s) have you considered?

Duplicating the text myself manually in the game to create the appearance of an outline or shadow. The problem is that making this of texts that are in an UI that has dynamic size, and given the amount of texts (that also are dynamically changed) would create a huge amount of clutter in the code and potential bugs that it is not worth the hassle.

Duplicating the text for emulating a shadow is feasible when there are a few cases and the text is guaranteed not to react to UI changes.

Additional context

For ideas on what kind of text effects could be possible, take a look to:

https://www.textstudio.com/logo/video-game-3d-text-34

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-RenderingDrawing game state to the screenA-TextRendering and layout for charactersC-FeatureA new feature, making something new possibleD-ComplexQuite challenging from either a design or technical perspective. Ask for help!S-Ready-For-ImplementationThis issue is ready for an implementation PR. Go for it!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions