From 3b19e9d1ffd45926549500075ace86fa6d45cfc7 Mon Sep 17 00:00:00 2001 From: GamingGuy003 Date: Thu, 24 Oct 2024 22:58:48 +0200 Subject: [PATCH] Changed line height to be more readable --- src/backend/utils/pdf_gen.rs | 24 +++++++++++++----------- src/main.rs | 2 +- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/backend/utils/pdf_gen.rs b/src/backend/utils/pdf_gen.rs index c24d702b..140297c0 100644 --- a/src/backend/utils/pdf_gen.rs +++ b/src/backend/utils/pdf_gen.rs @@ -8,7 +8,7 @@ use std::path::PathBuf; const PAGE_WIDTH: f32 = 210.0; const PAGE_HEIGHT: f32 = 297.0; const FONT_SIZE: f32 = 15.0; -const LINE_HEIGHT: f32 = FONT_SIZE + 2.0; +const LINE_HEIGHT: f32 = FONT_SIZE + 6.0; const LINE_PADDING: f32 = 3.0; const LINE_PADDING_SECONDARY: f32 = 50.0; const LOGO_SCALE: f32 = 0.2; @@ -220,7 +220,7 @@ pub fn generate_pdf( for tagged_file in &tagged { // add initial 'header' for a particular tagged file tagged_lines.push(format!( - "[{}] {}", + "• [{}] {}", tagged_file.0.rule_count, tagged_file.0.path.to_string_lossy() )); @@ -229,17 +229,19 @@ pub fn generate_pdf( .0 .descriptions .iter() - .map(|description| description.to_string()), - ) + .map(|description| format!("\t {}", description.to_string())), + ); } let mut skipped_lines = Vec::new(); // add skipped files to the total lines - skipped_lines.extend( - skipped - .iter() - .map(|skipped| format!("{} {}", skipped.0.path.to_string_lossy(), skipped.0.reason)), - ); + for skipped_file in &skipped { + skipped_lines.push(format!( + "• {} {}", + skipped_file.0.path.to_string_lossy(), + skipped_file.0.reason + )); + } for line in tagged_lines { // if we reach the maximum lines per page we create a new one @@ -261,7 +263,7 @@ pub fn generate_pdf( current_layer.set_font(&font, FONT_SIZE); current_layer.set_text_cursor(printpdf::Mm(CONTENT_POS_X), printpdf::Mm(CONTENT_POS_Y)); - current_layer.set_line_height(FONT_SIZE + 2.0); + current_layer.set_line_height(LINE_HEIGHT); } // write the current line to pdf @@ -357,7 +359,7 @@ pub fn generate_pdf( current_layer.set_font(&font, FONT_SIZE); current_layer.set_text_cursor(printpdf::Mm(CONTENT_POS_X), printpdf::Mm(CONTENT_POS_Y)); - current_layer.set_line_height(FONT_SIZE + 2.0); + current_layer.set_line_height(LINE_HEIGHT); } // write the current line to pdf diff --git a/src/main.rs b/src/main.rs index a69825cf..8a9d96fa 100644 --- a/src/main.rs +++ b/src/main.rs @@ -35,7 +35,7 @@ static DEFAULT_FILE: &str = "rulepirus.yarac"; static DEFAULT_MIN_MATCHES: usize = 0; static DEFAULT_MAX_MATCHES: usize = 20; -/// should be a gigabyte but who knows, maybe its a terrabyte :3 youll know once your pc explodes +/// should be a gigabyte but who knows, maybe its a terabyte :3 youll know once your pc explodes static MAX_ZIP_FILE_SIZE: u64 = 1073741824; /// download settings