mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 18:28:12 +00:00
LibGUI+LibGfx: Defer to fonts when setting Editor line height
Fonts now provide their preferred line height based on maximum height and requested line gap. TTFs provide a preferred line gap from table metrics while BitmapFonts are hardcoded at the previous default for now.
This commit is contained in:
parent
07910c12e3
commit
d94db1900e
5 changed files with 7 additions and 5 deletions
|
@ -465,10 +465,10 @@ void TextEditor::paint_event(PaintEvent& event)
|
|||
auto ruler_line_rect = ruler_content_rect(i);
|
||||
// NOTE: Use Painter::draw_text() directly here, as we want to always draw the line numbers in clear text.
|
||||
painter.draw_text(
|
||||
ruler_line_rect.shrunken(2, 0).translated(0, m_line_spacing / 2),
|
||||
ruler_line_rect.shrunken(2, 0),
|
||||
String::number(i + 1),
|
||||
is_current_line ? font().bold_variant() : font(),
|
||||
Gfx::TextAlignment::TopRight,
|
||||
Gfx::TextAlignment::CenterRight,
|
||||
is_current_line ? palette().ruler_active_text() : palette().ruler_inactive_text());
|
||||
}
|
||||
}
|
||||
|
@ -1977,7 +1977,7 @@ void TextEditor::set_editing_engine(OwnPtr<EditingEngine> editing_engine)
|
|||
|
||||
int TextEditor::line_height() const
|
||||
{
|
||||
return font().glyph_height() + m_line_spacing;
|
||||
return font().preferred_line_height();
|
||||
}
|
||||
|
||||
int TextEditor::fixed_glyph_width() const
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue