From 9b1f176a45fe932b0ed924e2851ab23114696be7 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sat, 5 May 2018 22:32:02 +0300 Subject: [PATCH] Use the bool type for the used glyph array in render_packed Also change the typedef to unsigned char to save space. --- ttf2png.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ttf2png.c b/ttf2png.c index f8db322..98a40ec 100644 --- a/ttf2png.c +++ b/ttf2png.c @@ -68,7 +68,7 @@ typedef struct sRange unsigned last; } Range; -typedef int bool; +typedef unsigned char bool; void usage(void); int convert_numeric_option(char, int); @@ -878,7 +878,7 @@ int render_packed(Font *font, unsigned margin, unsigned padding) { unsigned i; size_t area = 0; - char *used_glyphs; + bool *used_glyphs; unsigned *used_pixels; unsigned cx = margin, cy; unsigned used_h = 0; @@ -917,7 +917,7 @@ int render_packed(Font *font, unsigned margin, unsigned padding) memset(font->image.data, 0, font->image.w*font->image.h); used_pixels = (unsigned *)malloc(font->image.w*sizeof(unsigned)); memset(used_pixels, 0, font->image.w*sizeof(unsigned)); - used_glyphs = (char *)malloc(font->n_glyphs); + used_glyphs = (bool *)malloc(font->n_glyphs); memset(used_glyphs, 0, font->n_glyphs); for(cy=margin; cy+marginimage.h;) -- 2.43.0