X-Git-Url: http://git.asbjorn.biz/?p=swftools.git;a=blobdiff_plain;f=lib%2Fgfxfont.c;h=7c71ca75177b2d27cc40ada5cb15b54513e5c64e;hp=c1b82eb17454122ba2272afd93eb3a3fb1816d0a;hb=e00b10147bcf64db3d6b052d911c9c2e76f98253;hpb=0d97c44e7f70eef1b199373ef7b586749eb409c8 diff --git a/lib/gfxfont.c b/lib/gfxfont.c index c1b82eb..7c71ca7 100644 --- a/lib/gfxfont.c +++ b/lib/gfxfont.c @@ -570,6 +570,7 @@ void gfxfont_fix_unicode(gfxfont_t*font) int u = font->glyphs[t].unicode; if(u>=0) { assert(font->unicode2glyph[u]<0); // we took care of duplicates, right? + assert(umax_unicode); font->unicode2glyph[u] = t; } } @@ -664,6 +665,19 @@ ttf_t* gfxfont_to_ttf(gfxfont_t*font) } } + /* make sure coordinates are always to the right of the origin */ + int xshift=0; + if(dest->xmin < 0) { + xshift = -dest->xmin; + for(s=0;spoints[s].x += xshift; + } + dest->xmin += xshift; + dest->xmax += xshift; + } + + dest->bearing = dest->xmin; + dest->xmin=0; dest->advance = src->advance*scale; int u = font->glyphs[t].unicode; @@ -691,7 +705,7 @@ ttf_t* gfxfont_to_ttf(gfxfont_t*font) } } else { int u; - for(u=1;uunicode_size;u++) { + for(u=1;umax_unicode;u++) { int g = font->unicode2glyph[u]; if(g>=0 && u<32) { msg(" gfxfont_to_ttf: Font contains an invalid unicode (%d)", u);