[−][src]Crate glyph_brush
use glyph_brush::{ab_glyph::FontArc, BrushAction, BrushError, GlyphBrushBuilder, Section, Text}; let dejavu = FontArc::try_from_slice(include_bytes!("../../fonts/DejaVuSans.ttf"))?; let mut glyph_brush = GlyphBrushBuilder::using_font(dejavu).build(); glyph_brush.queue(Section::default().add_text(Text::new("Hello glyph_brush"))); glyph_brush.queue(some_other_section); match glyph_brush.process_queued( |rect, tex_data| update_texture(rect, tex_data), |vertex_data| into_vertex(vertex_data), ) { Ok(BrushAction::Draw(vertices)) => { // Draw new vertices. } Ok(BrushAction::ReDraw) => { // Re-draw last frame's vertices unmodified. } Err(BrushError::TextureTooSmall { suggested }) => { // Enlarge texture + glyph_brush texture cache and retry. } }
Modules
ab_glyph | Re-exported ab_glyph types. |
legacy |
Macros
delegate_glyph_brush_builder_fns | Macro to delegate builder methods to an inner |
Structs
Extra | Default |
FontId | Id for a font. |
GlyphBrush | Object allowing glyph drawing, containing cache state. Manages glyph positioning cacheing, glyph draw caching & efficient GPU texture cache updating. |
GlyphBrushBuilder | Builder for a |
GlyphCalculator | Cut down version of a |
GlyphCalculatorBuilder | Builder for a |
GlyphCalculatorGuard |
|
GlyphVertex | Data used to generate vertex information for a single glyph |
OwnedSection | |
OwnedText | |
Rectangle | A rectangle, with top-left corner at min, and bottom-right corner at max. |
Section | An object that contains all the info to render a varied section of text. That is one including many parts with differing fonts/scales/colors bowing to a single layout. |
SectionGeometry | |
SectionGlyph | A positioned glyph with info relating to the |
SectionText | Text to layout together using a font & scale. |
Text |
|
Enums
BrushAction | Actions that should be taken after processing queue data |
BrushError | |
BuiltInLineBreaker | Built-in linebreaking logic. |
GlyphChange | |
HorizontalAlign | Describes horizontal alignment preference for positioning & bounds. |
Layout | Built-in |
LineBreak | Indicator that a character is a line break, soft or hard. Includes the offset (byte-index) position. |
VerticalAlign | Describes vertical alignment preference for positioning & bounds. Currently a placeholder for future functionality. |
Traits
GlyphCruncher | Common glyph layout logic. |
GlyphPositioner | Logic to calculate glyph positioning using |
LineBreaker | Producer of a |
ToSectionText |
Type Definitions
Color | |
DefaultSectionHasher | A "practically collision free" |
SectionGlyphIter |
|