thanks, jk
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

26 lines
608 B

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!();
}
}