basic_atlas/
basic_atlas.rs

1extern crate font_atlas;
2use font_atlas::*;
3
4fn main() {
5    let bytes = include_bytes!("Gudea-Regular.ttf");
6    let font = load_font_from_bytes(bytes.to_vec());
7    let chars = font_atlas::ASCII.iter().cloned().chain(font_atlas::ASCII.iter().cloned());
8    let (_, bitmap, _) = font.make_atlas(chars, 20.0, 1, 128, 128);
9    for line in bitmap.lines() {
10        print!("{:03} ", line.len());
11        for &pixel in line {
12            if pixel == 0 {
13                print!(" ");
14            } else {
15                print!("#");
16            }
17        }
18        println!("");
19    }
20}