git.asbjorn.biz
/
swftools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
added gasp,fpgm,prep and cvt tables
[swftools.git]
/
lib
/
filters
/
remove_font_transforms.c
diff --git
a/lib/filters/remove_font_transforms.c
b/lib/filters/remove_font_transforms.c
index
2c7b1e5
..
748ba22
100644
(file)
--- a/
lib/filters/remove_font_transforms.c
+++ b/
lib/filters/remove_font_transforms.c
@@
-129,7
+129,7
@@
typedef struct _transformedfont {
gfxfont_t*font;
mymatrix_t matrix;
int*used;
gfxfont_t*font;
mymatrix_t matrix;
int*used;
- double dx,dy;
+ double dx;
} transformedfont_t;
static transformedfont_t* transformedfont_new(gfxfont_t*orig, mymatrix_t*m)
} transformedfont_t;
static transformedfont_t* transformedfont_new(gfxfont_t*orig, mymatrix_t*m)
@@
-210,15
+210,15
@@
static gfxresult_t* pass1_finish(gfxfilter_t*f, gfxdevice_t*out)
average_xmax /= count;
fd->dx = -total.xmin;
average_xmax /= count;
fd->dx = -total.xmin;
- fd->dy = 0;
+
+ font->ascent = total.ymax;
+ font->descent = total.ymin;
for(t=0;t<count;t++) {
gfxline_t*line = font->glyphs[t].line;
while(line) {
line->x += fd->dx;
for(t=0;t<count;t++) {
gfxline_t*line = font->glyphs[t].line;
while(line) {
line->x += fd->dx;
- line->y += fd->dy;
line->sx += fd->dx;
line->sx += fd->dx;
- line->sy += fd->dy;
line = line->next;
}
}
line = line->next;
}
}
@@
-227,6
+227,12
@@
static gfxresult_t* pass1_finish(gfxfilter_t*f, gfxdevice_t*out)
return out->finish(out);
}
return out->finish(out);
}
+static void pass2_addfont(gfxfilter_t*f, gfxfont_t*font, gfxdevice_t*out)
+{
+ /* we throw away original fonts, and do the addfont() for the transformed
+ fonts in the first drawchar() */
+}
+
static void pass2_drawchar(gfxfilter_t*f, gfxfont_t*font, int glyphnr, gfxcolor_t*color, gfxmatrix_t*matrix, gfxdevice_t*out)
{
internal_t*i = (internal_t*)f->internal;
static void pass2_drawchar(gfxfilter_t*f, gfxfont_t*font, int glyphnr, gfxcolor_t*color, gfxmatrix_t*matrix, gfxdevice_t*out)
{
internal_t*i = (internal_t*)f->internal;
@@
-242,8
+248,7
@@
static void pass2_drawchar(gfxfilter_t*f, gfxfont_t*font, int glyphnr, gfxcolor_
gfxmatrix_t scalematrix;
matrix_convert(matrix, font->id, &m, &scalematrix);
transformedfont_t*d = dict_lookup(i->matrices, &m);
gfxmatrix_t scalematrix;
matrix_convert(matrix, font->id, &m, &scalematrix);
transformedfont_t*d = dict_lookup(i->matrices, &m);
- scalematrix.tx -= d->dx;
- scalematrix.ty -= d->dy;
+ scalematrix.tx -= d->dx*scalematrix.m00;
out->drawchar(out, d->font, d->used[glyphnr], color, &scalematrix);
}
out->drawchar(out, d->font, d->used[glyphnr], color, &scalematrix);
}
@@
-260,6
+265,7
@@
void gfxtwopassfilter_remove_font_transforms_init(gfxtwopassfilter_t*f)
f->pass1.internal = i;
f->pass2.name = "remove font transforms pass 2";
f->pass1.internal = i;
f->pass2.name = "remove font transforms pass 2";
+ f->pass2.addfont = pass2_addfont;
f->pass2.drawchar = pass2_drawchar;
f->pass2.internal = i;
f->pass2.drawchar = pass2_drawchar;
f->pass2.internal = i;