summaryrefslogtreecommitdiffstats
path: root/src/font.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/font.c')
-rw-r--r--src/font.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/font.c b/src/font.c
index 719d7ff..d333189 100644
--- a/src/font.c
+++ b/src/font.c
@@ -21,6 +21,7 @@
#include "font.h"
+#include <assert.h>
#include <limits.h>
#include <stdio.h>
#include <string.h>
@@ -53,6 +54,8 @@ font_list(FILE *stream)
{
size_t i;
+ assert(stream);
+
for (i = 0; i < *(&fonts + 1) - fonts; ++i) {
fprintf(stream, "%s\n", fonts[i]->name);
}
@@ -81,6 +84,8 @@ font_find(const char *name)
{
size_t i;
+ assert(name);
+
if (!name) {
return NULL;
}
@@ -96,12 +101,16 @@ font_find(const char *name)
int
font_get_width(const struct font *font)
{
+ assert(font);
+
return font->desc.width;
}
int
font_get_height(const struct font *font)
{
+ assert(font);
+
return font->desc.height;
}
@@ -116,6 +125,11 @@ font_render(const struct font *font, png_const_colorp fg, png_const_colorp bg,
size_t byte;
unsigned char font_ch;
+ assert(font);
+ assert(fg);
+ assert(bg);
+ assert(rows && *rows);
+
for (y = 0, r = row * FONT_H(font); y < FONT_H(font); ++y, ++r) {
for (x = 0, c = col * FONT_W(font); x < FONT_W(font); ++x, ++c){
byte = ((ch * FONT_H(font)) + y) * FONT_W_BYTES(font) +