X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=lib%2Fexample%2Fdemofont.c;h=e48b1684020caf6fb7afdb7a5894f03963484448;hb=d4af216aee2d07affc044ef8a9f7fb4c408c44cd;hp=3d2e19884fc8a4b536f17a1dfe7dffb9c394aebe;hpb=6075108fd5212c3d85daaa22e471a5805e9b304f;p=swftools.git diff --git a/lib/example/demofont.c b/lib/example/demofont.c index 3d2e198..e48b168 100644 --- a/lib/example/demofont.c +++ b/lib/example/demofont.c @@ -12,7 +12,7 @@ #define addGlyph fn3711 -void fn3711(SWFFONT * f,int i,U16 code,U16 advance,U16 gid,U8 * data,U32 bitlen) +void fn3711(SWFFONT * f,int i,U16 ascii,U16 advance,U8 * data,U32 bitlen) { SHAPE * s; U32 l = (bitlen+7)/8; @@ -20,12 +20,12 @@ void fn3711(SWFFONT * f,int i,U16 code,U16 advance,U16 gid,U8 * data,U32 bitlen) s->data = malloc(l); if (!s->data) { swf_ShapeFree(s); return; } - f->codes[i] = code; - f->glyph[i].advance = advance; - f->glyph[i].gid = gid; - f->glyph[i].shape = s; - s->bitlen = bitlen; - s->bits.fill = 1; + f->glyph2ascii[i] = ascii; + f->ascii2glyph[ascii] = i; + f->glyph[i].advance = advance; + f->glyph[i].shape = s; + s->bitlen = bitlen; + s->bits.fill = 1; memcpy(s->data,data,l); } @@ -109,17 +109,21 @@ SWFFONT * Font_Demo_Font(U16 id) f->id = id; f->version = 1; f->name = strdup("Demo Font"); - f->flags = 0x00; + f->style = 0x00; + f->encoding = 0x00; f->numchars = 6; - f->glyph = (SWFGLYPH*)malloc(sizeof(SWFGLYPH)*208); + f->maxascii = 256; + f->glyph = (SWFGLYPH*)malloc(sizeof(SWFGLYPH)*6); + f->glyph2ascii = (U16*)malloc(sizeof(U16)*6); + f->ascii2glyph = (int*)malloc(sizeof(int)*256); + memset(f->ascii2glyph, -1, sizeof(int)*256); - - addGlyph(f,102, 0x00, 64, 0, &Glyphs_Demo_Font[0x0000], 872); // f - addGlyph(f,108, 0x00, 53, 1, &Glyphs_Demo_Font[0x006d], 452); // l - addGlyph(f,111, 0x00, 96, 2, &Glyphs_Demo_Font[0x00a6], 743); // o - addGlyph(f,115, 0x00, 74, 3, &Glyphs_Demo_Font[0x0103], 951); // s - addGlyph(f,116, 0x00, 53, 4, &Glyphs_Demo_Font[0x017a], 570); // t - addGlyph(f,119, 0x00, 138, 5, &Glyphs_Demo_Font[0x01c2], 806); // w + addGlyph(f, 0, 102, 64, &Glyphs_Demo_Font[0x0000], 872); // f + addGlyph(f, 1, 108, 53, &Glyphs_Demo_Font[0x006d], 452); // l + addGlyph(f, 2, 111, 96, &Glyphs_Demo_Font[0x00a6], 743); // o + addGlyph(f, 3, 115, 74, &Glyphs_Demo_Font[0x0103], 951); // s + addGlyph(f, 4, 116, 53, &Glyphs_Demo_Font[0x017a], 570); // t + addGlyph(f, 5, 119, 138, &Glyphs_Demo_Font[0x01c2], 806); // w return f; }