X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=lib%2Fdevices%2Frecord.c;h=cf04db6a03a2b0975eda257ff9ec14dec9df76b1;hb=c0c888f0b10296435e89467b7a4157d463c9ae5b;hp=5ea7d1b98ca690204e612ed6fb2d61d83d08c7bc;hpb=31dbdcebf78cfaa7c2dd5bb025689d48960acb46;p=swftools.git diff --git a/lib/devices/record.c b/lib/devices/record.c index 5ea7d1b..cf04db6 100644 --- a/lib/devices/record.c +++ b/lib/devices/record.c @@ -241,6 +241,8 @@ static void dumpFont(writer_t*w, gfxfont_t*font) writer_writeString(w, font->id); writer_writeU32(w, font->num_glyphs); writer_writeU32(w, font->max_unicode); + writer_writeDouble(w, font->ascent); + writer_writeDouble(w, font->descent); int t; for(t=0;tnum_glyphs;t++) { dumpLine(w, font->glyphs[t].line); @@ -255,6 +257,12 @@ static void dumpFont(writer_t*w, gfxfont_t*font) for(t=0;tmax_unicode;t++) { writer_writeU32(w, font->unicode2glyph[t]); } + writer_writeU32(w, font->kerning_size); + for(t=0;tkerning_size;t++) { + writer_writeU32(w, font->kerning[t].c1); + writer_writeU32(w, font->kerning[t].c2); + writer_writeU32(w, font->kerning[t].advance); + } } static gfxfont_t*readFont(reader_t*r) { @@ -262,6 +270,8 @@ static gfxfont_t*readFont(reader_t*r) font->id = reader_readString(r); font->num_glyphs = reader_readU32(r); font->max_unicode = reader_readU32(r); + font->ascent = reader_readDouble(r); + font->descent = reader_readDouble(r); font->glyphs = (gfxglyph_t*)rfx_calloc(sizeof(gfxglyph_t)*font->num_glyphs); font->unicode2glyph = (int*)rfx_calloc(sizeof(font->unicode2glyph[0])*font->max_unicode); int t; @@ -278,6 +288,15 @@ static gfxfont_t*readFont(reader_t*r) for(t=0;tmax_unicode;t++) { font->unicode2glyph[t] = reader_readU32(r); } + font->kerning_size = reader_readU32(r); + if(font->kerning_size) { + font->kerning = malloc(sizeof(gfxkerning_t)*font->kerning_size); + for(t=0;tkerning_size;t++) { + font->kerning[t].c1 = reader_readU32(r); + font->kerning[t].c2 = reader_readU32(r); + font->kerning[t].advance = reader_readU32(r); + } + } return font; } @@ -348,7 +367,7 @@ static void record_fillgradient(struct _gfxdevice*dev, gfxline_t*line, gfxgradie static void record_addfont(struct _gfxdevice*dev, gfxfont_t*font) { internal_t*i = (internal_t*)dev->internal; - msg(" record: %08x ADDFONT %s\n", dev); + msg(" record: %08x ADDFONT %s\n", dev, font->id); if(font && !gfxfontlist_hasfont(i->fontlist, font)) { writer_writeU8(&i->w, OP_ADDFONT); dumpFont(&i->w, font); @@ -549,7 +568,11 @@ static void replay(struct _gfxdevice*dev, gfxdevice_t*out, void*data, int length } finish: r->dealloc(r); - gfxfontlist_free(fontlist, 1); + /* problem: if we just replayed into a device which stores the + font for later use (the record device itself is a nice example), + then we can't free it yet */ + //gfxfontlist_free(fontlist, 1); + gfxfontlist_free(fontlist, 0); } void gfxresult_record_replay(gfxresult_t*result, gfxdevice_t*device) {