diff --git a/Libraries/LibGfx/Font.cpp b/Libraries/LibGfx/Font.cpp index cb3861474f..75488bda3d 100644 --- a/Libraries/LibGfx/Font.cpp +++ b/Libraries/LibGfx/Font.cpp @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -255,13 +256,13 @@ int Font::width(const Utf8View& utf8) const return width; } -int Font::width(const u32* codepoints, size_t length) const +int Font::width(const Utf32View& view) const { - if (length == 0) + if (view.length() == 0) return 0; - int width = (length - 1) * glyph_spacing(); - for (size_t i = 0; i < length; ++i) - width += glyph_or_emoji_width(codepoints[i]); + int width = (view.length() - 1) * glyph_spacing(); + for (size_t i = 0; i < view.length(); ++i) + width += glyph_or_emoji_width(view.codepoints()[i]); return width; } diff --git a/Libraries/LibGfx/Font.h b/Libraries/LibGfx/Font.h index b71c2519ab..8bbec4c830 100644 --- a/Libraries/LibGfx/Font.h +++ b/Libraries/LibGfx/Font.h @@ -95,7 +95,7 @@ public: int width(const StringView&) const; int width(const Utf8View&) const; - int width(const u32* codepoints, size_t) const; + int width(const Utf32View&) const; String name() const { return m_name; } void set_name(const StringView& name) { m_name = name; }