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 flexpaper sourcecode
[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
d1673e5
..
c04d110
100644
(file)
--- a/
lib/filters/remove_font_transforms.c
+++ b/
lib/filters/remove_font_transforms.c
@@
-95,10
+95,10
@@
typedef struct _internal {
#ifdef __GNUC__
#ifdef __GNUC__
-void __attribute__((noinline))
+int __attribute__((noinline))
matrix_convert(gfxmatrix_t*in, const char*id, mymatrix_t*out, gfxmatrix_t*scalematrix, unsigned char alpha)
#else
matrix_convert(gfxmatrix_t*in, const char*id, mymatrix_t*out, gfxmatrix_t*scalematrix, unsigned char alpha)
#else
-void matrix_convert(gfxmatrix_t*in, const char*id, mymatrix_t*out, gfxmatrix_t*scalematrix, unsigned char alpha)
+int matrix_convert(gfxmatrix_t*in, const char*id, mymatrix_t*out, gfxmatrix_t*scalematrix, unsigned char alpha)
#endif
{
double l1 = sqrt(in->m00 * in->m00 + in->m01 * in->m01);
#endif
{
double l1 = sqrt(in->m00 * in->m00 + in->m01 * in->m01);
@@
-106,7
+106,7
@@
void matrix_convert(gfxmatrix_t*in, const char*id, mymatrix_t*out, gfxmatrix_t*s
double l = (l1+l2)/2.0;
if(l < 1e-10) {
memset(out, 0, sizeof(*out));
double l = (l1+l2)/2.0;
if(l < 1e-10) {
memset(out, 0, sizeof(*out));
- return;
+ return 0;
}
out->m00 = in->m00 / l;
out->m10 = in->m10 / l;
}
out->m00 = in->m00 / l;
out->m10 = in->m10 / l;
@@
-123,6
+123,7
@@
void matrix_convert(gfxmatrix_t*in, const char*id, mymatrix_t*out, gfxmatrix_t*s
scalematrix->tx = in->tx;
scalematrix->ty = in->ty;
}
scalematrix->tx = in->tx;
scalematrix->ty = in->ty;
}
+ return 1;
}
typedef struct _matrixdata {
}
typedef struct _matrixdata {
@@
-145,7
+146,10
@@
static transformedfont_t* transformedfont_new(gfxfont_t*orig, mymatrix_t*m)
f->used = rfx_calloc(sizeof(f->used[0])*orig->num_glyphs);
int t;
for(t=0;t<orig->num_glyphs;t++) {
f->used = rfx_calloc(sizeof(f->used[0])*orig->num_glyphs);
int t;
for(t=0;t<orig->num_glyphs;t++) {
- if(orig->glyphs[t].unicode==32)
+ if(orig->glyphs[t].unicode==32 &&
+ (!orig->glyphs[t].line ||
+ !orig->glyphs[t].line->next ||
+ !orig->glyphs[t].line->next->next))
f->used[t]=1; //always preserve the space char in fonts
}
return f;
f->used[t]=1; //always preserve the space char in fonts
}
return f;
@@
-157,7
+161,8
@@
static void pass1_drawchar(gfxfilter_t*f, gfxfont_t*font, int glyphnr, gfxcolor_
mymatrix_t m;
if(!font->id)
msg("<error> Font has no ID");
mymatrix_t m;
if(!font->id)
msg("<error> Font has no ID");
- matrix_convert(matrix, font->id?font->id:"unknown", &m, 0, color->a);
+ if(!matrix_convert(matrix, font->id?font->id:"unknown", &m, 0, color->a))
+ return;
transformedfont_t*fd = dict_lookup(i->matrices, &m);
if(!fd) {
fd = transformedfont_new(font, &m);
transformedfont_t*fd = dict_lookup(i->matrices, &m);
if(!fd) {
fd = transformedfont_new(font, &m);
@@
-221,7
+226,7
@@
static gfxresult_t* pass1_finish(gfxfilter_t*f, gfxdevice_t*out)
if(count)
average_xmax /= count;
if(count)
average_xmax /= count;
- fd->dx = -total.xmin;
+ fd->dx = 0;//-total.xmin;
font->ascent = total.ymax;
font->descent = -total.ymin;
font->ascent = total.ymax;
font->descent = -total.ymin;
@@
-265,7
+270,7
@@
static gfxresult_t* pass1_finish(gfxfilter_t*f, gfxdevice_t*out)
if(char1>=0 && char2>=0) {
font->kerning[count].c1 = char1;
font->kerning[count].c2 = char2;
if(char1>=0 && char2>=0) {
font->kerning[count].c1 = char1;
font->kerning[count].c2 = char2;
- font->kerning[count].advance = fd->orig->kerning[t].advance * fd->matrix.m00 * scale;
+ font->kerning[count].advance = fd->orig->kerning[t].advance * fd->matrix.m00;
count++;
}
}
count++;
}
}