bevy_fontmesh
A simple and focused Bevy plugin for generating 3D text meshes from fonts. Powered by fontmesh.
Philosophy
This plugin does one thing only: generating mesh geometry from fonts. It intentionally leaves materials, lighting, transforms, and rendering to Bevy's standard systems.
Quick Start
Add to your Cargo.toml:
[]
= "0.17"
= "0.1"
Basic usage:
use *;
use *;
Text Anchoring
Control where the text is positioned relative to its transform:
TextMeshStyle
Available anchors: TopLeft, TopCenter, TopRight, CenterLeft, Center, CenterRight, BottomLeft, BottomCenter, BottomRight, Custom(Vec2).
Text Justification
Control alignment for multiline text:
TextMesh
Styling Parameters
TextMeshStyle
- depth: Controls the Z-depth of the extruded mesh. Use
0.0for flat 2D-style text. - subdivision: Number of segments used to approximate curves. Higher values produce smoother glyphs but increase vertex count.
Examples
Run the included examples:
# Basic 3D text
# Multiline text with anchoring
# Text justification demo
# All anchor points visualized
# Performance stress test (100 text meshes)
Supported Font Formats
- TrueType (
.ttf)
Note: OpenType fonts (.otf) with TrueType outlines are supported, but OpenType fonts with CFF/PostScript outlines are not currently supported (this is a limitation of the underlying ttf-parser library used by fontmesh).
Place your fonts in an assets/fonts/ directory and load them with asset_server.load("fonts/yourfont.ttf").
Limitations
This plugin is intentionally simple. It does not provide:
- Text kerning or ligatures (uses basic glyph advances)
- Right-to-left (RTL) text layout
- Dynamic text effects (shadows, outlines)
- 2D text rendering
- Text wrapping by width
For advanced typography needs, consider implementing additional logic on top of the generated meshes.
Performance
The plugin regenerates meshes only when TextMesh components change. For static text, there's no per-frame overhead beyond normal Bevy rendering.
Bevy Version Compatibility
| bevy_fontmesh | Bevy |
|---|---|
| 0.1 | 0.17 |
License
MIT License - see LICENSE for details.