summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick McDermott <patrick.mcdermott@libiquity.com>2019-07-17 17:55:58 (EDT)
committer Patrick McDermott <patrick.mcdermott@libiquity.com>2019-07-17 17:55:58 (EDT)
commit3077a5e0c9079d329dd08a5ffb6a75670d78dc4e (patch)
treef3b60d22e40c48015f5603bdac64e9f304678704
parentee6f735ac7b6c3122412c09d1514b7b2f7b80141 (diff)
image_render(): Use font dimensions
-rw-r--r--src/image.c7
-rw-r--r--src/image.h4
-rw-r--r--src/main.c2
3 files changed, 8 insertions, 5 deletions
diff --git a/src/image.c b/src/image.c
index c96ffcd..d059192 100644
--- a/src/image.c
+++ b/src/image.c
@@ -26,6 +26,7 @@
#include <png.h>
+#include "font.h"
#include "i18n.h"
#include "text.h"
@@ -74,15 +75,15 @@ image_new(const char *file_name)
}
void
-image_render(struct image *image, struct text *text)
+image_render(struct image *image, struct text *text, struct font *font)
{
size_t width;
size_t height;
png_bytepp rows;
size_t i;
- width = text_get_width(text);
- height = text_get_height(text);
+ width = text_get_width(text) * font_get_width(font);
+ height = text_get_height(text) * font_get_height(font);
png_set_IHDR(image->png_ptr, image->info_ptr, width, height,
BIT_DEPTH, PNG_COLOR_TYPE_PALETTE, PNG_INTERLACE_NONE,
diff --git a/src/image.h b/src/image.h
index c9ab567..361296e 100644
--- a/src/image.h
+++ b/src/image.h
@@ -24,13 +24,15 @@
#include "text.h"
+#include "font.h"
+
struct image;
struct image *
image_new(const char *file_name);
void
-image_render(struct image *image, struct text *text);
+image_render(struct image *image, struct text *text, struct font *font);
struct image *
image_destroy(struct image **image);
diff --git a/src/main.c b/src/main.c
index c82c5de..a48fd67 100644
--- a/src/main.c
+++ b/src/main.c
@@ -37,7 +37,7 @@ main(int argc, char **argv)
font = font_find(argv[1]);
text = text_new(argv[2]);
image = image_new("test.png");
- image_render(image, text);
+ image_render(image, text, font);
text_destroy(&text);
image_destroy(&image);