1
0
mirror of https://github.com/emilk/egui.git synced 2026-09-01 22:30:03 -04:00

Round font row heights

This commit is contained in:
Emil Ernerfeldt
2024-09-30 16:46:08 +02:00
parent b7ea43f519
commit 6a33dab6e3
7 changed files with 9 additions and 6 deletions

View File

@@ -191,7 +191,7 @@ fn huge_content_painter(ui: &mut egui::Ui) {
ui.add_space(4.0);
let font_id = TextStyle::Body.resolve(ui.style());
let row_height = ui.fonts(|f| f.row_height(&font_id)) + ui.spacing().item_spacing.y;
let row_height = ui.fonts(|f| f.row_height(&font_id)).round() + ui.spacing().item_spacing.y;
let num_rows = 10_000;
ScrollArea::vertical()

View File

@@ -162,7 +162,7 @@ fn bullet_point(ui: &mut Ui, width: f32) -> Response {
fn numbered_point(ui: &mut Ui, width: f32, number: &str) -> Response {
let font_id = TextStyle::Body.resolve(ui.style());
let row_height = ui.fonts(|f| f.row_height(&font_id));
let row_height = ui.fonts(|f| f.row_height(&font_id)).round();
let (rect, response) = ui.allocate_exact_size(vec2(width, row_height), Sense::hover());
let text = format!("{number}.");
let text_color = ui.visuals().strong_text_color();