1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
//! A Bevy plugin for generating 3D text meshes from fonts.
//!
//! Starting with 0.4 the plugin uses Bevy's standard [`bevy::text::Font`] asset
//! for font loading and `cosmic-text` for shaping, so the same `Handle<Font>`
//! you use for 2D UI text also drives 3D text meshes. This brings real text
//! shaping (kerning, ligatures, BiDi, complex scripts) and full OpenType/CFF
//! support.
//!
//! # Quick Start
//!
//! ```no_run
//! use bevy::prelude::*;
//! use bevy_fontmesh::prelude::*;
//!
//! fn main() {
//! App::new()
//! .add_plugins(DefaultPlugins)
//! .add_plugins(FontMeshPlugin::<StandardMaterial>::default())
//! .add_systems(Startup, setup)
//! .run();
//! }
//!
//! fn setup(
//! mut commands: Commands,
//! asset_server: Res<AssetServer>,
//! mut materials: ResMut<Assets<StandardMaterial>>,
//! ) {
//! commands.spawn(TextMeshBundle {
//! text_mesh: TextMesh {
//! text: "Hello!".to_string(),
//! font: asset_server.load("fonts/font.ttf"),
//! ..default()
//! },
//! material: MeshMaterial3d(materials.add(StandardMaterial::default())),
//! ..default()
//! });
//! }
//! ```
//!
//! # Custom Materials
//!
//! Add `FontMeshPlugin` a second time with your material type:
//!
//! ```no_run
//! use bevy::prelude::*;
//! use bevy_fontmesh::FontMeshPlugin;
//!
//! # use bevy::render::render_resource::AsBindGroup;
//! # #[derive(Asset, TypePath, AsBindGroup, Clone)]
//! # struct MyCustomMaterial {}
//! # impl Material for MyCustomMaterial {}
//! App::new()
//! .add_plugins(DefaultPlugins)
//! .add_plugins(FontMeshPlugin::<StandardMaterial>::default())
//! .add_plugins(FontMeshPlugin::<MyCustomMaterial>::default())
//! .run();
//! ```
//!
//! # Font Format Support
//!
//! Both TrueType (`.ttf`) and OpenType (`.otf`, including CFF/PostScript
//! outlines) are supported via `skrifa`. Loading is handled by Bevy's
//! standard font loader.
pub use ;
pub use ;
use *;
use PhantomData;
use update_text_meshes;
/// Shared one-time setup so that multiple [`FontMeshPlugin`] instances with
/// different material types don't double-register systems and resources.
;
/// Plugin that enables 3D text mesh generation from fonts.
///
/// Generic over the material type `M`. Defaults to [`StandardMaterial`].
;