X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=ttf2png.c;fp=ttf2png.c;h=13e5a80489b0e5eb64976c9d595969931c24af65;hb=2894ee8a8f6d5852f3cbda1e5b6f64e03d2356e9;hp=a634b2b9def92998add21bd3e7ecfebf077db243;hpb=c7b77aeb1a478f53c47d2aa08e7cc7728aa0898b;p=ttf2png.git diff --git a/ttf2png.c b/ttf2png.c index a634b2b..13e5a80 100644 --- a/ttf2png.c +++ b/ttf2png.c @@ -919,18 +919,18 @@ int render_packed(Font *font, unsigned margin, unsigned padding, bool npot) area = a; } - /* Find an image size that's no higher than wide, allowing for some - imperfections in the packing. */ + /* Find an image size that's approximately square. */ for(font->image.w=1;; font->image.w<<=1) { if(font->image.w<=margin*2) continue; - font->image.h = (area*5/4)/(font->image.w-margin*2)+margin*2; + font->image.h = area/(font->image.w-margin*2)+margin*2; if(font->image.h<=font->image.w) break; } - if(!npot) - font->image.h = round_to_pot(font->image.h); + + /* Add some extra space to accommodate packing imperfections. */ + font->image.h = font->image.h*3/2; /* Allocate arrays for storing the image and keeping track of used pixels and glyphs. Since glyphs are rectangular and the image is filled starting from