extern crate textium;
|
|
extern crate rusttype;
|
|
|
|
use rusttype::{FontCollection};
|
|
|
|
fn main() {
|
|
let font_data = include_bytes!("Gudea-Regular.ttf");
|
|
let font = FontCollection::from_bytes(font_data as &[u8])
|
|
.into_font().unwrap();
|
|
let font = textium::Font::new(font);
|
|
|
|
let (metadata, bitmap) = font.rasterize_char('A', 40.0).unwrap();
|
|
|
|
println!("{:?}", metadata);
|
|
|
|
for line in bitmap.lines() {
|
|
for &pixel in line {
|
|
if pixel == 0 {
|
|
print!(" ");
|
|
} else {
|
|
print!("#");
|
|
}
|
|
}
|
|
println!();
|
|
}
|
|
}
|