pub struct TextBuilder { /* private fields */ }
Expand description
Builder for creating models from a slice of TextRef
’s.
Implementations§
Source§impl TextBuilder
impl TextBuilder
Sourcepub fn new(
font_bytes: &[u8],
settings: TextBuilderSettings,
) -> Result<Self, Box<dyn Error>>
pub fn new( font_bytes: &[u8], settings: TextBuilderSettings, ) -> Result<Self, Box<dyn Error>>
Create a new builder from the given TrueType Font bytes and settings.
§Errors
See fontdue::Font::from_bytes
for possible error return values.
Sourcepub fn get_glyph_cache(
&mut self,
font_render_size: f32,
) -> Option<&mut GlyphCache>
pub fn get_glyph_cache( &mut self, font_render_size: f32, ) -> Option<&mut GlyphCache>
Gets the underlying glyph cache for the given font size.
Sourcepub fn set_viewport(&mut self, viewport: Viewport)
pub fn set_viewport(&mut self, viewport: Viewport)
Sets the viewport used by crate::TextAlign::Viewport
and crate::TextAlign::Scene
.
Sourcepub fn set_projection_view(&mut self, matrix: Mat4)
pub fn set_projection_view(&mut self, matrix: Mat4)
Sets the projection matrix used by crate::TextAlign::Scene
.
Sourcepub fn set_edge_color(&mut self, color: Option<Srgba>)
pub fn set_edge_color(&mut self, color: Option<Srgba>)
Sets the color used for rendering debug edges of glyphs quads and text meshes.
This is mostly useful for debugging purposes e.g. verifying text and character alignments.
Sourcepub fn clear_caches(&mut self)
pub fn clear_caches(&mut self)
Clears all underlying glyph caches and their corresponding CPU textures.
Note: GPU materials of any models created via [
TextBuilder::build
] will not be invalided by this.
Sourcepub fn compute_pixel_size(&mut self, text: &TextRef<'_>) -> Vec2
pub fn compute_pixel_size(&mut self, text: &TextRef<'_>) -> Vec2
Computes the pixel size of a given TextRef
.