mirror of
https://github.com/emilk/egui.git
synced 2026-09-02 23:00:04 -04:00
Respect LayoutJob::round_output_size_to_nearest_ui_point
This commit is contained in:
@@ -841,6 +841,13 @@ impl GalleyCache {
|
||||
}
|
||||
}
|
||||
|
||||
if merged_galley.job.round_output_size_to_nearest_ui_point {
|
||||
super::round_output_size_to_nearest_ui_point(
|
||||
&mut merged_galley.rect,
|
||||
&merged_galley.job,
|
||||
);
|
||||
}
|
||||
|
||||
merged_galley
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ pub use {
|
||||
FontData, FontDefinitions, FontFamily, FontId, FontInsert, FontPriority, FontTweak, Fonts,
|
||||
FontsImpl, InsertFontFamily,
|
||||
},
|
||||
text_layout::layout,
|
||||
text_layout::*,
|
||||
text_layout_types::*,
|
||||
};
|
||||
|
||||
|
||||
@@ -679,6 +679,22 @@ fn galley_from_rows(
|
||||
let mut rect = Rect::from_min_max(pos2(min_x, 0.0), pos2(max_x, cursor_y));
|
||||
|
||||
if job.round_output_size_to_nearest_ui_point {
|
||||
round_output_size_to_nearest_ui_point(&mut rect, &job);
|
||||
}
|
||||
|
||||
Galley {
|
||||
job,
|
||||
rows,
|
||||
elided,
|
||||
rect,
|
||||
mesh_bounds,
|
||||
num_vertices,
|
||||
num_indices,
|
||||
pixels_per_point: point_scale.pixels_per_point,
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn round_output_size_to_nearest_ui_point(rect: &mut Rect, job: &LayoutJob) {
|
||||
let did_exceed_wrap_width_by_a_lot = rect.width() > job.wrap.max_width + 1.0;
|
||||
|
||||
// We round the size to whole ui points here (not pixels!) so that the egui layout code
|
||||
@@ -695,18 +711,6 @@ fn galley_from_rows(
|
||||
}
|
||||
}
|
||||
|
||||
Galley {
|
||||
job,
|
||||
rows,
|
||||
elided,
|
||||
rect,
|
||||
mesh_bounds,
|
||||
num_vertices,
|
||||
num_indices,
|
||||
pixels_per_point: point_scale.pixels_per_point,
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
struct FormatSummary {
|
||||
any_background: bool,
|
||||
|
||||
Reference in New Issue
Block a user