31 breaking releases

Uses old Rust 2015

0.31.0 Nov 16, 2022
0.29.0 Nov 28, 2021
0.28.0 Mar 15, 2021
0.27.0 May 30, 2020
0.4.1 Jun 25, 2015

#905 in Graphics APIs

Download history 106/week @ 2023-01-20 80/week @ 2023-01-27 112/week @ 2023-02-03 119/week @ 2023-02-10 216/week @ 2023-02-17 142/week @ 2023-02-24 99/week @ 2023-03-03 132/week @ 2023-03-10 68/week @ 2023-03-17 21/week @ 2023-03-24 95/week @ 2023-03-31 47/week @ 2023-04-07 57/week @ 2023-04-14 22/week @ 2023-04-21 111/week @ 2023-04-28 123/week @ 2023-05-05

313 downloads per month
Used in fewer than 6 crates

MIT license

385KB
608 lines

gfx_text Build Status crates.io

Library for drawing text for gfx-rs graphics API. Uses freetype-rs underneath.

Usage

Basic usage:

// Initialize text renderer.
let mut text = gfx_text::new(factory).build().unwrap();

// In render loop:

// Add some text 10 pixels down and right from the top left screen corner.
text.add(
    "The quick brown fox jumps over the lazy dog",  // Text to add
    [10, 10],                                       // Position
    [0.65, 0.16, 0.16, 1.0],                        // Text color
);

// Draw text.
text.draw(&mut stream);

See API documentation for overview of all available methods.

You can skip default font by disabling include-font feature:

[dependencies.gfx_text]
version = "*"
default-features = false

Examples

See this example on how to draw text in various styles: different sizes, colors, fonts, etc.

Output:

License

Dependencies

~7.5MB
~148K SLoC