From 4add295bfa84291414bdfbfb34e4b9d7c9d001fe Mon Sep 17 00:00:00 2001 From: Developer Date: Fri, 15 May 2026 23:35:50 +0800 Subject: [PATCH] tweak(pagination): safety_h=1.0 to reduce underfill --- src/reader.rs | 2 +- src/style.rs | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/reader.rs b/src/reader.rs index c1afb5a..cb6e163 100644 --- a/src/reader.rs +++ b/src/reader.rs @@ -6,7 +6,7 @@ use crate::theme::{self, BgType, Theme}; pub fn recalculate_pages(book: &mut Book, font_size: f32, line_height: f32, panel_width: f32, panel_height: f32, style: &StyleProfile) { let char_width = font_size * 1.0; let safety_w = 0.95; - let safety_h = 0.96; + let safety_h = 1.0; let chars_per_line = if char_width > 0.0 { ((panel_width / char_width) * safety_w).max(1.0) as usize } else { diff --git a/src/style.rs b/src/style.rs index 75b6463..20a7b60 100644 --- a/src/style.rs +++ b/src/style.rs @@ -56,8 +56,6 @@ impl StyleProfile { } pub fn line_height(&self) -> f32 { - // egui actual line height is approximately font_size * 1.1 - // line_spacing adds extra (line_spacing - 1.0) * font_size * 0.5 as extra gap self.font_size * 1.1 + self.font_size * (self.line_spacing - 1.0).max(0.0) * 0.5 }