]> git.tdb.fi Git - ttf2png.git/commitdiff
Use the bool type for the used glyph array in render_packed
authorMikko Rasa <tdb@tdb.fi>
Sat, 5 May 2018 19:32:02 +0000 (22:32 +0300)
committerMikko Rasa <tdb@tdb.fi>
Sat, 5 May 2018 19:32:02 +0000 (22:32 +0300)
Also change the typedef to unsigned char to save space.

ttf2png.c

index f8db322032d725f88b646b329b7cf42753c44fc4..98a40ecb4175ef8c8689968a3dad79e567b23263 100644 (file)
--- 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+margin<font->image.h;)