summaryrefslogtreecommitdiffstats
path: root/src/text.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/text.c')
-rw-r--r--src/text.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/text.c b/src/text.c
index b7b569a..dea3259 100644
--- a/src/text.c
+++ b/src/text.c
@@ -96,6 +96,18 @@ text_get_height(struct text *text)
return text->height;
}
+size_t
+text_set_width(struct text *text, size_t width)
+{
+ return text->width = MAX(text->width, width);
+}
+
+size_t
+text_set_height(struct text *text, size_t height)
+{
+ return text->height = MAX(text->height, height);
+}
+
void
text_render(struct text *text, struct font *font, png_bytepp rows)
{
@@ -142,8 +154,11 @@ text_render(struct text *text, struct font *font, png_bytepp rows)
++string;
}
}
- for (; col < text->width; ++col) {
- font_render(font, &fg, &bg, ' ', rows, row, col);
+ for (; row < text->height; ++row) {
+ for (; col < text->width; ++col) {
+ font_render(font, &fg, &bg, ' ', rows, row, col);
+ }
+ col = 0;
}
free(string_start);