X-Git-Url: http://git.asbjorn.biz/?p=swftools.git;a=blobdiff_plain;f=lib%2Ffilters%2Fremove_font_transforms.c;h=06b6300a707802c8573b2078479264050618dfae;hp=748ba224d65e163c6abbecc17e20792a8975c509;hb=5244627ce001a4b2c49595fe38042628856be1d3;hpb=b2c998ea7f4c97fd0640967fe5fee0e8789cf761 diff --git a/lib/filters/remove_font_transforms.c b/lib/filters/remove_font_transforms.c index 748ba22..06b6300 100644 --- a/lib/filters/remove_font_transforms.c +++ b/lib/filters/remove_font_transforms.c @@ -99,7 +99,7 @@ void matrix_convert(gfxmatrix_t*in, const char*id, mymatrix_t*out, gfxmatrix_t*s { double l1 = sqrt(in->m00 * in->m00 + in->m01 * in->m01); double l2 = sqrt(in->m10 * in->m10 + in->m11 * in->m11); - double l = l1+l2; + double l = (l1+l2)/2.0; if(l < 1e-10) { memset(out, 0, sizeof(*out)); return; @@ -137,7 +137,12 @@ static transformedfont_t* transformedfont_new(gfxfont_t*orig, mymatrix_t*m) transformedfont_t*f = rfx_calloc(sizeof(transformedfont_t)); f->orig = orig; f->matrix = *m; - f->used = malloc(sizeof(f->used[0])*orig->num_glyphs); + f->used = rfx_calloc(sizeof(f->used[0])*orig->num_glyphs); + int t; + for(t=0;tnum_glyphs;t++) { + if(orig->glyphs[t].unicode==32) + f->used[t]=1; //always preserve the space char in fonts + } return f; } @@ -212,7 +217,7 @@ static gfxresult_t* pass1_finish(gfxfilter_t*f, gfxdevice_t*out) fd->dx = -total.xmin; font->ascent = total.ymax; - font->descent = total.ymin; + font->descent = -total.ymin; for(t=0;tglyphs[t].line;