From: Matthias Kramm Date: Tue, 23 Mar 2010 01:05:30 +0000 (-0700) Subject: fixed ascent/descent bug for ocr fonts X-Git-Tag: version-0-9-1~70 X-Git-Url: http://git.asbjorn.biz/?p=swftools.git;a=commitdiff_plain;h=5b19f36b91166b2016db3d9d363cbcb17276c136 fixed ascent/descent bug for ocr fonts --- diff --git a/lib/filters/remove_font_transforms.c b/lib/filters/remove_font_transforms.c index 91afb2c..bbe71f5 100644 --- a/lib/filters/remove_font_transforms.c +++ b/lib/filters/remove_font_transforms.c @@ -178,16 +178,8 @@ static void glyph_transform(gfxglyph_t*g, mymatrix_t*mm) m.ty = 0; if(m.m00>0) g->advance *= m.m00; - if(!mm->alpha) { - /* for OCR: remove the outlines of characters that are only - ever displayed with alpha=0 */ - g->line = (gfxline_t*)rfx_calloc(sizeof(gfxline_t)); - g->line->type = gfx_moveTo; - g->line->x = g->advance; - } else { - g->line = gfxline_clone(g->line); - gfxline_transform(g->line, &m); - } + g->line = gfxline_clone(g->line); + gfxline_transform(g->line, &m); } static gfxresult_t* pass1_finish(gfxfilter_t*f, gfxdevice_t*out) @@ -235,11 +227,22 @@ static gfxresult_t* pass1_finish(gfxfilter_t*f, gfxdevice_t*out) font->descent = -total.ymin; for(t=0;tglyphs[t]; gfxline_t*line = font->glyphs[t].line; - while(line) { - line->x += fd->dx; - line->sx += fd->dx; - line = line->next; + + if(fd->matrix.alpha) { + while(line) { + line->x += fd->dx; + line->sx += fd->dx; + line = line->next; + } + } else { + gfxline_free(g->line); + /* for OCR: remove the outlines of characters that are only + ever displayed with alpha=0 */ + g->line = (gfxline_t*)rfx_calloc(sizeof(gfxline_t)); + g->line->type = gfx_moveTo; + g->line->x = g->advance; } } gfxfont_fix_unicode(font);