From: Matthias Kramm Date: Thu, 19 Nov 2009 05:12:26 +0000 (-0800) Subject: added occurence counting to glyph pair tracker X-Git-Tag: version-0-9-1~239 X-Git-Url: http://git.asbjorn.biz/?p=swftools.git;a=commitdiff_plain;h=18c92a7b9532ccc8ad219fa4a2f83cdc651ec3e1 added occurence counting to glyph pair tracker --- diff --git a/lib/modules/swfalignzones.c b/lib/modules/swfalignzones.c index f05cad8..21780d3 100644 --- a/lib/modules/swfalignzones.c +++ b/lib/modules/swfalignzones.c @@ -238,7 +238,7 @@ void swf_FontCreateAlignZones(SWFFONT * f) 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]); + printf("%c (%d) ", f->glyph2ascii[f->use->neighbors[s].char1], f->use->neighbors[s].num); draw_char(f, f->use->neighbors[s].char1, row, column, bounds); drawn++; } diff --git a/lib/modules/swftext.c b/lib/modules/swftext.c index 2ce669a..c473211 100644 --- a/lib/modules/swftext.c +++ b/lib/modules/swftext.c @@ -967,17 +967,19 @@ void swf_FontUsePair(SWFFONT * f, int char1, int char2) } } - if(!swf_FontUseGetPair(f, char1, char2)) { + int nr = swf_FontUseGetPair(f, char1, char2); + if(!nr) { if(u->num_neighbors == u->neighbors_size) { u->neighbors_size += 4096; u->neighbors = rfx_realloc(u->neighbors, sizeof(SWFGLYPHPAIR)*u->neighbors_size); } u->neighbors[u->num_neighbors].char1 = char1; u->neighbors[u->num_neighbors].char2 = char2; + u->neighbors[u->num_neighbors].num = 1; hashadd(u, char1, char2, u->num_neighbors); u->num_neighbors++; } else { - // increase? + u->neighbors[nr-1].num++; } } diff --git a/lib/rfxswf.h b/lib/rfxswf.h index 4ca38a2..7f8eb1c 100644 --- a/lib/rfxswf.h +++ b/lib/rfxswf.h @@ -534,6 +534,7 @@ typedef struct _SWFGLYPHPAIR { U16 char1; U16 char2; + int num; } SWFGLYPHPAIR; typedef struct _FONTUSAGE