X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=lib%2Fmodules%2Fswfalignzones.c;h=36ddd341ec60e8675ccb2dbbc8368695a8a1d665;hb=2c719855eac434f01d47ba0717d76de65939d74e;hp=f05cad81a173d4aa4d3166c12636d9c4e23ede15;hpb=e633c982297e1728e8373f80d25533776a9b92b0;p=swftools.git diff --git a/lib/modules/swfalignzones.c b/lib/modules/swfalignzones.c index f05cad8..36ddd34 100644 --- a/lib/modules/swfalignzones.c +++ b/lib/modules/swfalignzones.c @@ -156,6 +156,8 @@ static void draw_char(SWFFONT * f, int nr, float*row, float*column, SRECT b) y = l->y; l = l->next; } + swf_Shape2Free(s); + free(s); } static ALIGNZONE detect_for_char(SWFFONT * f, int nr, float*row, float*column, SRECT font_bbox, SRECT char_bbox) @@ -235,15 +237,15 @@ void swf_FontCreateAlignZones(SWFFONT * f) memset(column, 0, sizeof(float)*(height+1)); int s; int drawn = 0; - printf("[font %d] pairing %c with ", f->id, f->glyph2ascii[t]); for(s=0;suse->num_neighbors;s++) { - if(f->use->neighbors[s].char2 == t) { - printf("%c ", f->glyph2ascii[f->use->neighbors[s].char1]); - draw_char(f, f->use->neighbors[s].char1, row, column, bounds); + int char1 = f->use->neighbors[s].char1; + int char2 = f->use->neighbors[s].char2; + if(char1 == t || char2 == t) { + int other = t==char1?char2:char1; + draw_char(f, other, row, column, bounds); drawn++; } } - printf("\n"); for(s=0;s<=height;s++) { column[t] /= drawn*2; @@ -262,6 +264,26 @@ void swf_FontCreateAlignZones(SWFFONT * f) } } +void swf_FontPostprocess(SWF*swf) +{ + TAG*tag = swf->firstTag; + while(tag) { + TAG*next = tag->next; + if(tag->id == ST_DEFINEFONT3) { + U16 id = swf_GetDefineID(tag); + SWFFONT*font = 0; + swf_FontExtract(swf, id, &font); + if(!font->alignzones) { + swf_FontCreateAlignZones(font); + tag = swf_InsertTag(tag, ST_DEFINEFONTALIGNZONES); + swf_FontSetAlignZones(tag, font); + } + swf_FontFree(font); + } + tag = next; + } +} + void swf_FontSetAlignZones(TAG*t, SWFFONT *f) { swf_SetU16(t, f->id); @@ -288,4 +310,3 @@ void swf_FontSetAlignZones(TAG*t, SWFFONT *f) } } -