summaryrefslogtreecommitdiffstats
path: root/src/text.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/text.c')
-rw-r--r--src/text.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/text.c b/src/text.c
index 995d10e..f5ddaba 100644
--- a/src/text.c
+++ b/src/text.c
@@ -28,6 +28,8 @@
#include <png.h>
#include "font.h"
+#include "i18n.h"
+#include "output.h"
#include "sgr.h"
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
@@ -70,6 +72,7 @@ text_new(FILE *stream)
}
text = calloc(1, sizeof(*text));
if (!text) {
+ error(_("Cannot allocate memory for text object"));
return NULL;
}
@@ -83,6 +86,10 @@ text_new(FILE *stream)
for (; c >= 0x20 && c <= 0x2F; _getc(text, stream, &c));
if (c >= 0x40 && c <= 0x7E) {
_getc(text, stream, &c);
+ } else {
+ error(_("Invalid control sequence at line %lu "
+ "column %lu"),
+ text->height + 1, width + 1);
}
eol = 0;
} else if (c == '\n') {
@@ -142,6 +149,7 @@ text_render(const struct text *text, const struct font *font, png_bytepp rows)
string_start = calloc(strlen((char *) text->string) + 1,
sizeof(*text->string));
if (!string_start) {
+ error(_("Cannot allocate memory for text rendering"));
return;
}
memcpy(string_start, text->string, strlen((char *) text->string) + 1);