From 18c92a7b9532ccc8ad219fa4a2f83cdc651ec3e1 Mon Sep 17 00:00:00 2001 From: Matthias Kramm Date: Wed, 18 Nov 2009 21:12:26 -0800 Subject: [PATCH] added occurence counting to glyph pair tracker --- lib/modules/swfalignzones.c | 2 +- lib/modules/swftext.c | 6 ++++-- lib/rfxswf.h | 1 + 3 files changed, 6 insertions(+), 3 deletions(-) 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 -- 1.7.10.4