git.asbjorn.biz
/
swftools.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
8589e0d
)
fixed ascent/descent bug for ocr fonts
author
Matthias Kramm
<kramm@quiss.org>
Tue, 23 Mar 2010 01:05:30 +0000
(18:05 -0700)
committer
Matthias Kramm
<kramm@quiss.org>
Tue, 23 Mar 2010 01:05:30 +0000
(18:05 -0700)
lib/filters/remove_font_transforms.c
patch
|
blob
|
history
diff --git
a/lib/filters/remove_font_transforms.c
b/lib/filters/remove_font_transforms.c
index
91afb2c
..
bbe71f5
100644
(file)
--- 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;
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)
}
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;t<count;t++) {
font->descent = -total.ymin;
for(t=0;t<count;t++) {
+ gfxglyph_t*g = &font->glyphs[t];
gfxline_t*line = font->glyphs[t].line;
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);
}
}
gfxfont_fix_unicode(font);