Skip to content

Commit

Permalink
Changed line height to be more readable
Browse files Browse the repository at this point in the history
  • Loading branch information
GamingGuy003 committed Oct 24, 2024
1 parent 0539ea9 commit 3b19e9d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
24 changes: 13 additions & 11 deletions src/backend/utils/pdf_gen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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()
));
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3b19e9d

Please sign in to comment.