Bevy Pxtxt
Call it what you want — "pixel font," "image font," "texture font," etc. Either way, this library has it. bevy_pxtxt allows users to create fonts and render text based on images they draw themself.
The images by default are .png files, but .bmp, .jpeg, .gif, or .tiff can be used with their corresponding feature flags.
Example
assets/moonshock.ron
(
name: "Moonshock",
image: "moonshock.png",
glyph_width: Varied (
max: 5,
min: 1,
),
spacing: 1,
ascender: 7,
descender: 2,
)
examples/sections.rs
use *;
use ;
use ;
Result:

PxFontData Files
Fonts are loaded onto PxFonts, which uses PxFontData for deserialization. This is the struct that the .ron files write.
Required Fields:
name- the name of the fontimage- the path to the image of the font, relative to theassetsfolderglyph_width- width of each characterVaried- automatically detect the width of characters between amaxandminvalueMonospace- all characters are the same width
ascender- number of pixels above the base linedescender- number of pixels below the base line
Optional Fields:
char_layout- what characters are displayed on the imageStartingAt- the characters start at the given character and continue in order of ascending unicode valueRanges- the characters are given as a series of rangesListed- the characters are individually listed- default:
StartingAt(' ')
spacing- space between each character within a word- default:
1
- default:
padding- padding between characters in the image- default:
(0, 0)
- default:
Input
Sections with can receive events for left clicks, right clicks, and hovering. PickableText senses these events, when the child of an entity with PxText.
To receive these events, use EventReader<PxTextEvent> (read up on events).
Examples
See examples/bounded.rs for how bounding boxes can be used.
See examples/picking.rs for how input can be used.
See examples/sections.rs (above as well) for how different sections can be used.
Compatibility
Bevy Pxtxt version 0.1 is comptabile with Bevy version 0.13.
License
This library, including the examples and assets, is licensed under the MIT License.