mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 04:07:44 +00:00
Userland: Use Font::pixel_size_rounded_up() instead of glyph_height()
The only remaining clients of this API are specific to bitmap fonts and editing thereof.
This commit is contained in:
parent
93c9344e35
commit
b71c7a6e44
32 changed files with 63 additions and 65 deletions
|
@ -24,7 +24,7 @@ GroupBox::GroupBox(StringView title)
|
|||
Margins GroupBox::content_margins() const
|
||||
{
|
||||
return {
|
||||
(!m_title.is_empty() ? static_cast<int>(ceilf(font().glyph_height())) + 1 /*room for the focus rect*/ : 2),
|
||||
(!m_title.is_empty() ? font().pixel_size_rounded_up() + 1 /*room for the focus rect*/ : 2),
|
||||
2,
|
||||
2,
|
||||
2
|
||||
|
@ -37,13 +37,13 @@ void GroupBox::paint_event(PaintEvent& event)
|
|||
painter.add_clip_rect(event.rect());
|
||||
|
||||
Gfx::IntRect frame_rect {
|
||||
0, (!m_title.is_empty() ? font().glyph_height() / 2 : 0),
|
||||
width(), height() - (!m_title.is_empty() ? static_cast<int>(ceilf(font().glyph_height())) / 2 : 0)
|
||||
0, (!m_title.is_empty() ? font().pixel_size_rounded_up() / 2 : 0),
|
||||
width(), height() - (!m_title.is_empty() ? font().pixel_size_rounded_up() / 2 : 0)
|
||||
};
|
||||
Gfx::StylePainter::paint_frame(painter, frame_rect, palette(), Gfx::FrameShape::Box, Gfx::FrameShadow::Sunken, 2);
|
||||
|
||||
if (!m_title.is_empty()) {
|
||||
Gfx::IntRect text_rect { 6, 1, static_cast<int>(ceilf(font().width(m_title) + 6)), font().glyph_height() };
|
||||
Gfx::IntRect text_rect { 6, 1, static_cast<int>(ceilf(font().width(m_title) + 6)), font().pixel_size_rounded_up() };
|
||||
painter.fill_rect(text_rect, palette().button());
|
||||
painter.draw_text(text_rect, m_title, Gfx::TextAlignment::CenterLeft, palette().button_text());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue