diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/ascii_generator.iml b/.idea/ascii_generator.iml new file mode 100644 index 0000000..9b4cf84 --- /dev/null +++ b/.idea/ascii_generator.iml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..639900d --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..0e3fec9 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index ed120fa..2ba6514 100644 --- a/src/main.rs +++ b/src/main.rs @@ -4,30 +4,29 @@ use std::io; use fontdue; use std::collections::HashMap; use std::ops::Add; +use std::fs::File; fn main() { let args: Vec = env::args().collect(); - //let path = &args[1]; - //let path2 = &String::from("/Users/beppe/Git/asciiGenerator/fonts/Lucida Console.ttf"); - let data = include_bytes!("/Users/beppe/Git/asciiGenerator/fonts/Lucida Console.ttf") as &[u8]; + //let mut currentPath = env::current_dir().expect("what").as_path(); + let data = fs::read("./font/Lucida Console.ttf").expect("it didnt work"); let font = fontdue::Font::from_bytes(data, fontdue::FontSettings::default()).expect("yessir"); - let mut output: HashMap = HashMap::new(); //todo Second value should be bitmap type??? + let mut output: HashMap>> = HashMap::new(); //todo Second value should be bitmap type??? let mut char_index:u32 = 0; //NOTE this starts at 0 const RASTER_FACTOR: f32 = 15.0; - while char_index < 1000000 { - let char = std::char::from_u32(char_index).expect("yessiiiiiir"); + while char_index < 10000 { + let char = std::char::from_u32(char_index).expect("error converting u32 to char"); char_index += 1; let (metrics, mut unsorted_raster) = font.rasterize(char, RASTER_FACTOR); if (unsorted_raster.len() > 0) { - (chunks, remainder) = unsorted_raster.as_chunks(RASTER_FACTOR as usize); - output.insert(char, chunks.clone()); + //(chunks, remainder) = unsorted_raster.as_chunks(RASTER_FACTOR as usize); + //output.insert(char, chunks.clone()); } } - //println!("{}", convertData(data)); } //returns remainder, chunk