From 4709d1e1e7da55da3215746fc07cffc6b6fe3c00 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Thu, 28 Nov 2013 12:11:11 +0200 Subject: [PATCH] Generate only as tall image as needed in sequantial grid mode --- ttf2png.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ttf2png.c b/ttf2png.c index a9896c3..8fc211e 100644 --- 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); - 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) -- 2.43.0