diff options
author | LuK1337 <priv.luk@gmail.com> | 2021-07-06 12:08:06 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-07-07 20:29:29 +0200 |
commit | 6319796f58714116b4db496dd73fd779128b8f85 (patch) | |
tree | 17ea037015b7a90b032bf2c69d2cf85b94d19e73 /Userland/Libraries/LibGfx/BitmapFont.h | |
parent | 6386c2d8805ed8634650d310937e9ea3cf3ecd2b (diff) | |
download | serenity-6319796f58714116b4db496dd73fd779128b8f85.zip |
LibGfx: BitmapFont: Handle '\r' and '\n' when calculating text width
Previously calculating multiline text width would return invalid value,
this change makes it so that we are returning the longest line width.
We are now also reusing same width() implementation for both UTF-8 and
UTF-32 strings.
Diffstat (limited to 'Userland/Libraries/LibGfx/BitmapFont.h')
-rw-r--r-- | Userland/Libraries/LibGfx/BitmapFont.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Userland/Libraries/LibGfx/BitmapFont.h b/Userland/Libraries/LibGfx/BitmapFont.h index 4a1508056f..845395343a 100644 --- a/Userland/Libraries/LibGfx/BitmapFont.h +++ b/Userland/Libraries/LibGfx/BitmapFont.h @@ -115,6 +115,9 @@ private: static RefPtr<BitmapFont> load_from_memory(const u8*); + template<typename T> + int unicode_view_width(T const& view) const; + void update_x_height() { m_x_height = m_baseline - m_mean_line; }; int glyph_or_emoji_width_for_variable_width_font(u32 code_point) const; |