#include "../gfxtools.h"
#include "swf.h"
#include "../gfxpoly.h"
-#include "../png.h"
+#include "../gfximage.h"
#define CHARDATAMAX 1024
#define CHARMIDX 0
if(newsizex<sizex || newsizey<sizey) {
msg("<verbose> Scaling %dx%d image to %dx%d", sizex, sizey, newsizex, newsizey);
- newpic = swf_ImageScale(mem, sizex, sizey, newsizex, newsizey);
+ gfximage_t*ni = gfximage_rescale(img, newsizex, newsizey);
+ newpic = (RGBA*)ni->data;
+ free(ni);
*newwidth = sizex = newsizex;
*newheight = sizey = newsizey;
mem = newpic;
swffont->glyph2ascii = (U16*)rfx_calloc(sizeof(U16)*swffont->numchars);
swffont->glyph = (SWFGLYPH*)rfx_calloc(sizeof(SWFGLYPH)*swffont->numchars);
swffont->glyphnames = (char**)rfx_calloc(sizeof(char*)*swffont->numchars);
- for(t=0;t<font->max_unicode;t++) {
- swffont->ascii2glyph[t] = font->unicode2glyph[t];
- }
+
SRECT max = {0,0,0,0};
for(t=0;t<font->num_glyphs;t++) {
drawer_t draw;
gfxline_t*line;
double advance = 0;
- swffont->glyph2ascii[t] = font->glyphs[t].unicode;
- if(swffont->glyph2ascii[t] == 0xffff || swffont->glyph2ascii[t] == 0x0000) {
+ int u = font->glyphs[t].unicode;
+ int s;
+ char twice=0;
+ for(s=0;s<font->num_glyphs;s++) {
+ if(swffont->glyph2ascii[s]==u)
+ twice=1;
+ }
+ if(u >= 0xe000 || u == 0x0000 || twice) {
/* flash 8 flashtype requires unique unicode IDs for each character.
We use the Unicode private user area to assign characters, hoping that
the font doesn't contain more than 2048 glyphs */
- swffont->glyph2ascii[t] = 0xe000 + (t&0x1fff);
+ u = 0xe000 + (t&0x1fff);
}
+ swffont->glyph2ascii[t] = u;
if(font->glyphs[t].name) {
swffont->glyphnames[t] = strdup(font->glyphs[t].name);
c.x = line->sx * scale; c.y = -line->sy * scale;
//to.x = floor(line->x * scale); to.y = floor(-line->y * scale);
to.x = line->x * scale; to.y = -line->y * scale;
+
+ /*if(strstr(swffont->name, "BIRNU") && t==90) {
+ to.x += 1;
+ }*/
+
if(line->type == gfx_moveTo) {
draw.moveTo(&draw, &to);
} else if(line->type == gfx_lineTo) {
swf_ExpandRect2(&bounds, &swffont->layout->bounds[t]);
}
+
for(t=0;t<font->num_glyphs;t++) {
SRECT bbox = swffont->layout->bounds[t];
if(font->descent*20 > swffont->layout->descent)
swffont->layout->descent = font->descent*20;
+ swf_FontSort(swffont);
return swffont;
}
l->swffont->layout->bounds[iii].xmax/20.0,
l->swffont->layout->bounds[iii].ymax/20.0
);
- int t;
- for(t=0;t<l->swffont->maxascii;t++) {
- if(l->swffont->ascii2glyph[t] == iii)
- msg("<debug> | - maps to %d",t);
- }
}
}
}
msg("<warning> No character %d in font %s (%d chars)", glyph, FIXNULL((char*)i->swffont->name), i->swffont->numchars);
return;
}
+ glyph = i->swffont->glyph2glyph[glyph];
setfontscale(dev, matrix->m00, matrix->m01, matrix->m10, matrix->m11, matrix->tx, matrix->ty, 0);