mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 14:47:34 +00:00
LibGfx: Make Font::width() return a float
This commit is contained in:
parent
b9d2b8f7b2
commit
3407ab0fd1
25 changed files with 40 additions and 40 deletions
|
@ -499,7 +499,7 @@ void BrickGame::paint_cell(GUI::Painter& painter, Gfx::IntRect rect, bool is_on)
|
|||
|
||||
void BrickGame::paint_text(GUI::Painter& painter, int row, DeprecatedString const& text)
|
||||
{
|
||||
auto const text_width { font().width(text) };
|
||||
auto const text_width = static_cast<int>(ceilf(font().width(text)));
|
||||
auto const entire_area_rect { frame_inner_rect() };
|
||||
auto const margin = 4;
|
||||
auto const glyph_height = font().glyph_height();
|
||||
|
|
|
@ -211,7 +211,7 @@ void ColorLines::paint_event(GUI::PaintEvent& event)
|
|||
|
||||
// Draw score
|
||||
auto const score_text = MUST(String::formatted("{:05}"sv, m_score));
|
||||
auto text_width { m_score_font->width(score_text) };
|
||||
auto text_width = static_cast<int>(ceilf(m_score_font->width(score_text)));
|
||||
auto const glyph_height = m_score_font->glyph_height();
|
||||
auto const score_text_rect = Gfx::IntRect {
|
||||
frame_inner_rect().top_left().translated(text_margin),
|
||||
|
|
|
@ -71,7 +71,7 @@ void ScoreCard::paint_event(GUI::PaintEvent& event)
|
|||
for (int score_index = 0; score_index < (int)player.scores.size(); score_index++) {
|
||||
auto text_rect = cell_rect(player_index, 1 + score_index);
|
||||
auto score_text = DeprecatedString::formatted("{}", player.scores[score_index]);
|
||||
auto score_text_width = font.width(score_text);
|
||||
auto score_text_width = static_cast<int>(ceilf(font.width(score_text)));
|
||||
if (score_index != (int)player.scores.size() - 1) {
|
||||
painter.draw_line(
|
||||
{ text_rect.left() + text_rect.width() / 2 - score_text_width / 2 - 3, text_rect.top() + font.glyph_height() / 2 },
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue