From 955e678577ff180137b6b808829a2ccf3c576b56 Mon Sep 17 00:00:00 2001 From: valadaptive Date: Thu, 3 Jul 2025 19:18:59 -0400 Subject: [PATCH] Remove FontTweak::baseline_offset_factor Even testing this out *with* font fallback, which seems to be its intended purpose, this does exactly the same thing as y_offset_factor. It's likely that some subsequent change (perhaps https://github.com/emilk/egui/pull/2724) removed the code path that made it function differently. --- crates/egui/src/style.rs | 5 ----- crates/epaint/src/text/font.rs | 4 +--- crates/epaint/src/text/fonts.rs | 8 -------- 3 files changed, 1 insertion(+), 16 deletions(-) diff --git a/crates/egui/src/style.rs b/crates/egui/src/style.rs index ff8043beb..f43a549a3 100644 --- a/crates/egui/src/style.rs +++ b/crates/egui/src/style.rs @@ -2790,7 +2790,6 @@ impl Widget for &mut FontTweak { scale, y_offset_factor, y_offset, - baseline_offset_factor, } = self; ui.label("Scale"); @@ -2806,10 +2805,6 @@ impl Widget for &mut FontTweak { ui.add(DragValue::new(y_offset).speed(-0.02)); ui.end_row(); - ui.label("baseline_offset_factor"); - ui.add(DragValue::new(baseline_offset_factor).speed(-0.0025)); - ui.end_row(); - if ui.button("Reset").clicked() { *self = Default::default(); } diff --git a/crates/epaint/src/text/font.rs b/crates/epaint/src/text/font.rs index dd095c443..a8dde7b09 100644 --- a/crates/epaint/src/text/font.rs +++ b/crates/epaint/src/text/font.rs @@ -110,8 +110,6 @@ impl FontImpl { let scale_in_pixels = scale_in_pixels * tweak.scale; let scale_in_points = scale_in_pixels / pixels_per_point; - let baseline_offset = (scale_in_points * tweak.baseline_offset_factor).round_ui(); - let y_offset_points = ((scale_in_points * tweak.y_offset_factor) + tweak.y_offset).round_ui(); @@ -132,7 +130,7 @@ impl FontImpl { scale_in_pixels, height_in_points: ascent - descent + line_gap, y_offset_in_points, - ascent: ascent + baseline_offset, + ascent, pixels_per_point, glyph_info_cache: Default::default(), atlas, diff --git a/crates/epaint/src/text/fonts.rs b/crates/epaint/src/text/fonts.rs index ac56a0f4e..623baa9bf 100644 --- a/crates/epaint/src/text/fonts.rs +++ b/crates/epaint/src/text/fonts.rs @@ -179,13 +179,6 @@ pub struct FontTweak { /// /// Example value: `2.0`. pub y_offset: f32, - - /// When using this font's metrics to layout a row, - /// shift the entire row downwards by this fraction of the font size (in points). - /// - /// A positive value shifts the text downwards. - /// A negative value shifts it upwards. - pub baseline_offset_factor: f32, } impl Default for FontTweak { @@ -194,7 +187,6 @@ impl Default for FontTweak { scale: 1.0, y_offset_factor: 0.0, y_offset: 0.0, - baseline_offset_factor: 0.0, } } }