diff options
fix: format
Diffstat (limited to 'build.rs')
-rw-r--r-- | build.rs | 21 |
1 files changed, 14 insertions, 7 deletions
@@ -104,7 +104,7 @@ fn save_bits_to_file(font: &FontMetadata, char: u8, bits: &[u8]) -> io::Result<( fn to_upper_snake_with_first_upper_preceeded_by_underscore(str: String) -> String { let mut str = str; for char in "ABCDEFGHIJKLMNOPQRSTUVWXYZ".chars() { - str = str.replace(char,format!("_{char}").as_str()); + str = str.replace(char, format!("_{char}").as_str()); } str.to_uppercase() } @@ -131,7 +131,8 @@ impl BakedFont for {name}Struct {{ }} fn get_char_bytes(&self, c: char) -> &'static [u8] {{ match c as u8 {{ -"); +" + ); for char in font.unique_chars() { contents = format!( "{contents} {} => include_bytes!(\"../../assets/computed-fonts/{}/{}.bin\"), @@ -146,16 +147,19 @@ impl BakedFont for {name}Struct {{ }} pub const FONT{}: {name}Struct = {name}Struct{{ }}; -", to_upper_snake_with_first_upper_preceeded_by_underscore(name.to_string()) +", + to_upper_snake_with_first_upper_preceeded_by_underscore(name.to_string()) ); Ok(contents) } fn main() -> Result<(), Box<dyn std::error::Error>> { fs::create_dir_all("src/generated")?; - let mut modrs = format!("// Copyright is a sham this is a @generated file. + let mut modrs = format!( + "// Copyright is a sham this is a @generated file. use crate::font::BakedFont; -"); +" + ); let fonts = [ FontMetadata { name: "Galmuri", @@ -169,8 +173,11 @@ use crate::font::BakedFont; }, ]; for font in fonts { - modrs=format!("{modrs}{} -",generate_struct(&font)?); + modrs = format!( + "{modrs}{} +", + generate_struct(&font)? + ); exec(font)?; } File::create(&"src/generated/fonts.rs")?.write_all(modrs.as_bytes())?; |