mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-23 18:02:05 -05:00
LibGfx: Use float when calculating text width in ScaledFont
This fixes an issue where we'd truncate the fractional part of each glyph width, often making the returned width slightly too short.
This commit is contained in:
parent
80ed7d220c
commit
44025e837f
1 changed files with 2 additions and 2 deletions
|
@ -19,8 +19,8 @@ ALWAYS_INLINE int ScaledFont::unicode_view_width(T const& view) const
|
|||
{
|
||||
if (view.is_empty())
|
||||
return 0;
|
||||
int width = 0;
|
||||
int longest_width = 0;
|
||||
float width = 0;
|
||||
float longest_width = 0;
|
||||
u32 last_code_point = 0;
|
||||
for (auto code_point : view) {
|
||||
if (code_point == '\n' || code_point == '\r') {
|
||||
|
|
Loading…
Add table
Reference in a new issue