1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 05:08:13 +00:00

Implement basic support for variable-width fonts.

Also add a nice new font called Katica. It's not used anywhere yet but
I'm definitely itching to start using it. :^)
This commit is contained in:
Andreas Kling 2019-03-06 12:52:41 +01:00
parent 0a86366c71
commit 7f6c81d90f
8 changed files with 95 additions and 22 deletions

View file

@ -342,7 +342,7 @@ void Painter::draw_text(const Rect& rect, const String& text, TextAlignment alig
ASSERT_NOT_REACHED();
}
int space_width = font().glyph_width(' ');
int space_width = font().glyph_width(' ') + font().glyph_spacing();
for (ssize_t i = 0; i < text.length(); ++i) {
byte ch = text[i];
if (ch == ' ') {
@ -350,7 +350,7 @@ void Painter::draw_text(const Rect& rect, const String& text, TextAlignment alig
continue;
}
draw_glyph(point, ch, color);
point.move_by(font().glyph_width(ch), 0);
point.move_by(font().glyph_width(ch) + font().glyph_spacing(), 0);
}
}