Skip to content

Underline too low #5855

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
barries opened this issue Mar 28, 2025 · 0 comments
Open

Underline too low #5855

barries opened this issue Mar 28, 2025 · 0 comments
Labels
bug Something is broken

Comments

@barries
Copy link

barries commented Mar 28, 2025

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:

  1. Run code like the below
  2. Observe that the "Shortcuts" underline is visually too low, and the "Filters" underline is drawn over by the next row.

Screenshots

Image

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:

Image

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"                 );
        ...                                                                                                           
    });                                                                                                    
@barries barries added the bug Something is broken label Mar 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is broken
Projects
None yet
Development

No branches or pull requests

1 participant