mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-08 12:19:37 +03:00
SharedGraphics: Font::width() shouldn't add spacing to the very last glyph.
This commit is contained in:
parent
838a06096a
commit
08085f48a0
Notes:
sideshowbarker
2024-07-19 14:56:43 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/08085f48a09
@ -177,11 +177,15 @@ bool Font::write_to_file(const String& path)
|
||||
|
||||
int Font::width(const String& string) const
|
||||
{
|
||||
if (string.is_empty())
|
||||
return 0;
|
||||
|
||||
if (m_fixed_width)
|
||||
return string.length() * m_glyph_width;
|
||||
|
||||
int width = 0;
|
||||
for (int i = 0; i < string.length(); ++i)
|
||||
width += glyph_width(string[i]) + 1;
|
||||
return width;
|
||||
|
||||
return width - 1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user