We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 838a060 commit 08085f4Copy full SHA for 08085f4
SharedGraphics/Font.cpp
@@ -177,11 +177,15 @@ bool Font::write_to_file(const String& path)
177
178
int Font::width(const String& string) const
179
{
180
+ if (string.is_empty())
181
+ return 0;
182
+
183
if (m_fixed_width)
184
return string.length() * m_glyph_width;
185
186
int width = 0;
187
for (int i = 0; i < string.length(); ++i)
188
width += glyph_width(string[i]) + 1;
- return width;
189
190
+ return width - 1;
191
}
0 commit comments