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

  1. extern crate textium;
  2. extern crate rusttype;
  3. use rusttype::{FontCollection};
  4. fn main() {
  5. let font_data = include_bytes!("Gudea-Regular.ttf");
  6. let font = FontCollection::from_bytes(font_data as &[u8])
  7. .into_font().unwrap();
  8. let font = textium::Font::new(font);
  9. let (metadata, bitmap) = font.rasterize_char('A', 40.0).unwrap();
  10. println!("{:?}", metadata);
  11. for line in bitmap.lines() {
  12. for &pixel in line {
  13. if pixel == 0 {
  14. print!(" ");
  15. } else {
  16. print!("#");
  17. }
  18. }
  19. println!();
  20. }
  21. }