#font #ttf #truetype #luminance #text

luminance-glyph

A fast text renderer for luminance, powered by glyph_brush

5 releases (breaking)

0.5.0 Jan 23, 2023
0.4.0 Dec 14, 2021
0.3.0 Nov 26, 2021
0.2.0 Nov 29, 2020
0.1.0 Jul 8, 2020

#55 in Visualization

Download history 12/week @ 2022-11-27 23/week @ 2022-12-04 33/week @ 2022-12-11 30/week @ 2022-12-18 18/week @ 2022-12-25 9/week @ 2023-01-01 20/week @ 2023-01-08 12/week @ 2023-01-15 59/week @ 2023-01-22 44/week @ 2023-01-29 23/week @ 2023-02-05 21/week @ 2023-02-12 38/week @ 2023-02-19 8/week @ 2023-02-26 38/week @ 2023-03-05 12/week @ 2023-03-12

102 downloads per month
Used in 4 crates (2 directly)

MIT license

72KB
614 lines

luminance-glyph

Integration status crates.io Documentation License

A fast text renderer for luminance, powered by glyph_brush. Initially forked and modified from glow_glyph by hecrj. Many thanks to hecrj for his work on glow_glyph!

let mut glyph_brush = GlyphBrushBuilder::using_font(ab_glyph::FontArc::try_from_slice(
        include_bytes!("Inconsolata-Regular.ttf"),
    )?)
    .build(&mut surface);
    
glyph_brush.queue(
    Section::default().add_text(
        Text::new("Hello Luminance Glyph")
            .with_color([1.0, 1.0, 1.0, 1.0])
            .with_scale(80.0),
    ),
);

glyph_brush.process_queued(&mut surface);

surface.pipeline_builder().pipeline(
    &back_buffer,
    &PipelineState::default().set_clear_color([0.2, 0.2, 0.2, 1.0]),
    |mut pipeline, mut shd_gate| {
        glyph_brush
            .draw_queued(&mut pipeline, &mut shd_gate, 1024, 720)
            .expect("failed to render glyphs");
    },
);

Dependencies

~2.5MB
~45K SLoC