Open
Description
Describe the bug
Text underlines are drawn a pixel or two too low--which is both odd looking and outside the galley's bounding box, so it collides with neighboring text.
To Reproduce
Steps to reproduce the behavior:
- Run code like the below
- Observe that the "Shortcuts" underline is visually too low, and the "Filters" underline is drawn over by the next row.
Screenshots
Expected behavior
An underline that's in the galley's bounding box; meaning at or above the font descender line and below the baseline, something like:
Desktop (please complete the following information):
egui: 0.31
Code
fn display_help_row(ui: &mut Ui, keys: impl Into<WidgetText>, desc: impl Into<WidgetText>) {
ui.label(keys);
ui.label(desc);
ui.end_row();
}
fn display_filter_help_row(ui: &mut Ui, code: &str, desc: impl Into<WidgetText>) {
ui.label(RichText::new(code).background_color(CODE_BG_COLOR).color(CODE_COLOR));
ui.label(desc);
ui.end_row();
}
Grid::new("help")
.spacing(vec2(3.0, 1.0))
.show(ui, |ui| {
ui.heading(RichText::new("Shortcuts").underline());
ui.end_row();
display_help_row(ui, "Ctrl+N", "[N]ew filter");
...
ui.end_row(); // spacer
ui.heading(RichText::new("Filters").underline());
ui.end_row();
display_filter_help_row(ui, "/foo|bar/", "Match regular expression" );
...
});