diff --git a/Userland/Libraries/LibGfx/Font/ScaledFont.cpp b/Userland/Libraries/LibGfx/Font/ScaledFont.cpp index 84f3bfc5c5..a528dcff25 100644 --- a/Userland/Libraries/LibGfx/Font/ScaledFont.cpp +++ b/Userland/Libraries/LibGfx/Font/ScaledFont.cpp @@ -153,13 +153,18 @@ u8 ScaledFont::glyph_fixed_width() const return glyph_metrics(glyph_id_for_code_point(' ')).advance_width; } -RefPtr ScaledFont::with_size(float point_size) const +NonnullRefPtr ScaledFont::scaled_with_size(float point_size) const { if (point_size == m_point_height && point_size == m_point_width) - return const_cast(this); + return *const_cast(this); return m_font->scaled_font(point_size); } +RefPtr ScaledFont::with_size(float point_size) const +{ + return scaled_with_size(point_size); +} + Gfx::FontPixelMetrics ScaledFont::pixel_metrics() const { return m_pixel_metrics; diff --git a/Userland/Libraries/LibGfx/Font/ScaledFont.h b/Userland/Libraries/LibGfx/Font/ScaledFont.h index e15e83a781..d2c09fa0a7 100644 --- a/Userland/Libraries/LibGfx/Font/ScaledFont.h +++ b/Userland/Libraries/LibGfx/Font/ScaledFont.h @@ -69,6 +69,7 @@ public: virtual String qualified_name() const override { return MUST(String::formatted("{} {} {} {}", family(), presentation_size(), weight(), slope())); } virtual String human_readable_name() const override { return MUST(String::formatted("{} {} {}", family(), variant(), presentation_size())); } + virtual NonnullRefPtr scaled_with_size(float point_size) const; virtual RefPtr with_size(float point_size) const override; virtual bool has_color_bitmaps() const override { return m_font->has_color_bitmaps(); }