mirror of
https://github.com/emilk/egui.git
synced 2026-06-27 23:13:13 -04:00
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.
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user