1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 05:57:45 +00:00

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.
This commit is contained in:
LuK1337 2021-07-06 12:08:06 +02:00 committed by Andreas Kling
parent 6386c2d880
commit 6319796f58
2 changed files with 23 additions and 9 deletions

View file

@ -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;