]> git.tdb.fi Git - ttf2png.git/commitdiff
Generate only as tall image as needed in sequantial grid mode
authorMikko Rasa <tdb@tdb.fi>
Thu, 28 Nov 2013 10:11:11 +0000 (12:11 +0200)
committerMikko Rasa <tdb@tdb.fi>
Thu, 28 Nov 2013 10:11:11 +0000 (12:11 +0200)
ttf2png.c

index a9896c39f9e2c737d0f7d1576199f8a0fee0239c..8fc211e4900fd73b6f41711075a6162de8034663 100644 (file)
--- a/ttf2png.c
+++ b/ttf2png.c
@@ -511,7 +511,10 @@ int render_grid(Font *font, unsigned cellw, unsigned cellh, unsigned cpl, int se
        last = font->glyphs[font->n_glyphs-1].code;
 
        font->image.w = round_to_pot(cpl*cellw);
        last = font->glyphs[font->n_glyphs-1].code;
 
        font->image.w = round_to_pot(cpl*cellw);
-       font->image.h = round_to_pot((last-first+cpl)/cpl*cellh);
+       if(seq)
+               font->image.h = round_to_pot((font->n_glyphs+cpl-1)/cpl*cellh);
+       else
+               font->image.h = round_to_pot((last-first+cpl)/cpl*cellh);
 
        font->image.data = (char *)alloc_image_data(font->image.w, font->image.h);
        if(!font->image.data)
 
        font->image.data = (char *)alloc_image_data(font->image.w, font->image.h);
        if(!font->image.data)