new examples: dumpfont and text
[swftools.git] / lib / example / demofont.c
1 /* demofont.c
2
3    Character data for some glyphs needed by text.c
4
5    Dumped with dumpfont.c
6    
7    Part of the swftools package.
8
9    This file is distributed under the GPL, see file COPYING for details 
10
11 */
12
13 #define addGlyph fn3711
14
15 void fn3711(SWFFONT * f,int i,U16 code,U16 advance,U16 gid,U8 * data,U32 bitlen)
16 { SHAPE * s;
17   U32 l = (bitlen+7)/8;
18
19   if (FAILED(swf_ShapeNew(&s))) return;
20   s->data = malloc(l);
21   if (!s->data) { swf_ShapeFree(s); return; }
22
23   f->codes[i]         = code;
24   f->glyph[i].advance = advance;
25   f->glyph[i].gid     = gid;
26   f->glyph[i].shape   = s;
27   s->bitlen           = bitlen;
28   s->bits.fill  = 1;
29   memcpy(s->data,data,l);
30 }
31
32 U8 Glyphs_Demo_Font[] = {
33           0x35, 0x66, 0xc2, 0xd5, 0xe3, 0x9b, 0x62, 0x08, 
34           0xea, 0x09, 0xe2, 0x4c, 0xf8, 0xba, 0x59, 0x2d, 
35           0x93, 0x1d, 0xe4, 0xc3, 0x6b, 0x40, 0x92, 0x90, 
36           0x30, 0x36, 0x4c, 0x0c, 0xe5, 0xa9, 0xbe, 0x46, 
37           0x40, 0x1a, 0xf5, 0x50, 0xec, 0x3b, 0x6a, 0xa4, 
38           0xd8, 0x8a, 0xe1, 0x4b, 0x66, 0x00, 0x40, 0x0e, 
39           0x11, 0x91, 0x35, 0x9f, 0x03, 0x51, 0x4e, 0x8a, 
40           0x5c, 0x17, 0x7e, 0x8d, 0xda, 0x0a, 0x48, 0xa0, 
41           0x08, 0xed, 0x22, 0x1b, 0x0f, 0x7c, 0xa1, 0xb7, 
42           0x80, 0x9f, 0xc3, 0x69, 0xec, 0x53, 0xea, 0xdc, 
43           0xd8, 0x59, 0xd1, 0x8a, 0x60, 0x0b, 0xc1, 0x6d, 
44           0x09, 0x4b, 0x51, 0x5b, 0x8e, 0x55, 0xb8, 0x9c, 
45           0x80, 0x95, 0xa0, 0x05, 0x88, 0xa4, 0x75, 0x70, 
46           0x1c, 0x8c, 0x0f, 0x9b, 0x40, 0x35, 0x62, 0xfa, 
47           0x9c, 0xf9, 0x53, 0x04, 0xa0, 0x15, 0x86, 0x1d, 
48           0x19, 0x9c, 0xd3, 0xca, 0x34, 0x3a, 0x40, 0x1a, 
49           0x29, 0x6e, 0x47, 0xf4, 0x6e, 0xd6, 0xaf, 0xd4, 
50           0x6c, 0xc9, 0xa3, 0x28, 0x7e, 0x20, 0x2b, 0x70, 
51           0xcc, 0x13, 0x00, 0x59, 0x7e, 0x77, 0xe9, 0xd6, 
52           0x7d, 0x36, 0x75, 0xae, 0xf8, 0x8d, 0x3c, 0x5d, 
53           0xbd, 0x11, 0xc8, 0xd0, 0x5c, 0x00, 0x35, 0x47, 
54           0x8c, 0x93, 0x92, 0x50, 0x26, 0x42, 0x5c, 0xa4, 
55           0x37, 0xa7, 0x97, 0x82, 0x80, 0x0f, 0xa6, 0x00, 
56           0x64, 0x28, 0x48, 0x98, 0x9d, 0x25, 0x04, 0x02, 
57           0x56, 0x20, 0x0f, 0xd8, 0x98, 0x83, 0x60, 0x02, 
58           0x7a, 0x60, 0x08, 0x6c, 0xbb, 0xa9, 0x6e, 0xd0, 
59           0x92, 0x00, 0x15, 0x12, 0x92, 0x3c, 0xac, 0xf1, 
60           0x39, 0x01, 0x33, 0x40, 0x01, 0xfa, 0x7c, 0xc6, 
61           0xc8, 0x60, 0x0b, 0x12, 0x80, 0x7b, 0x89, 0xfc, 
62           0xb8, 0xdf, 0xcc, 0x41, 0x2c, 0xc4, 0x10, 0x40, 
63           0x4d, 0x30, 0x01, 0x87, 0x5d, 0x36, 0x6d, 0xd0, 
64           0x05, 0x54, 0xa0, 0x20, 0x9f, 0x85, 0x29, 0xf8, 
65           0x2c, 0xf1, 0x80, 0x35, 0x4a, 0x44, 0x53, 0xdd, 
66           0x4e, 0x68, 0x61, 0x37, 0x6d, 0xb7, 0x17, 0x34, 
67           0xb8, 0xb2, 0xd2, 0x01, 0x2d, 0xd0, 0x1a, 0xc9, 
68           0xc9, 0x52, 0x40, 0x2f, 0x20, 0x0e, 0x20, 0xa4, 
69           0xa4, 0x0a, 0x2f, 0x2f, 0xb5, 0x24, 0x92, 0x66, 
70           0x63, 0x10, 0x05, 0x19, 0x40, 0x3f, 0xa2, 0x9a, 
71           0x5a, 0x09, 0xa3, 0x00, 0xdb, 0x41, 0xe3, 0xa6, 
72           0x5e, 0xe3, 0xa0, 0x34, 0xdd, 0x0b, 0xf7, 0x6b, 
73           0xba, 0x08, 0xcc, 0x1c, 0x8c, 0x4e, 0x47, 0x2a, 
74           0x84, 0x8c, 0x40, 0x4a, 0x88, 0x01, 0x6d, 0x92, 
75           0x2d, 0x58, 0x12, 0x4a, 0x02, 0xee, 0x8d, 0x33, 
76           0x73, 0xf4, 0x5c, 0x6e, 0x4d, 0x6f, 0xb9, 0xd5, 
77           0xc7, 0x2e, 0x9c, 0x80, 0x2a, 0x4a, 0x02, 0x42, 
78           0x7b, 0x52, 0xa7, 0xb4, 0xf4, 0x06, 0xd4, 0x20, 
79           0xbd, 0x68, 0x84, 0x67, 0x67, 0x33, 0xae, 0x3a, 
80           0x08, 0x00, 0x35, 0x62, 0x96, 0xd0, 0x77, 0x52, 
81           0xdb, 0x0d, 0x7a, 0xa8, 0xf6, 0x25, 0x78, 0x52, 
82           0x99, 0x40, 0x2d, 0x1a, 0x3e, 0x43, 0x50, 0x50, 
83           0x09, 0x10, 0x01, 0x0d, 0xa4, 0x3f, 0x52, 0x6c, 
84           0xd0, 0x4e, 0x5d, 0xec, 0x70, 0x19, 0x97, 0x01, 
85           0x9b, 0xc0, 0x24, 0xa4, 0x0a, 0xb3, 0x92, 0xac, 
86           0xf5, 0xa6, 0x5e, 0xda, 0x00, 0x4e, 0xe1, 0xb3, 
87           0x36, 0x2d, 0xf4, 0x70, 0x91, 0xcd, 0x5d, 0x9a, 
88           0x53, 0x99, 0x4b, 0xdc, 0xda, 0x41, 0x77, 0x98, 
89           0xf0, 0x00, 0x35, 0x48, 0x34, 0x6d, 0xdc, 0x6d, 
90           0x68, 0xa7, 0x2d, 0xc0, 0x3c, 0x46, 0x49, 0xb1, 
91           0x00, 0x23, 0xa4, 0x45, 0x78, 0x8d, 0x08, 0x3e, 
92           0xf3, 0x0c, 0x0b, 0x58, 0xaa, 0xba, 0x76, 0xbf, 
93           0x5d, 0xaf, 0x1a, 0x36, 0xee, 0x24, 0x34, 0x53, 
94           0x96, 0xa8, 0x6d, 0x6d, 0x78, 0xec, 0xec, 0x56, 
95           0x85, 0x9c, 0x78, 0xdb, 0x73, 0x8e, 0xf6, 0x92, 
96           0x68, 0x5b, 0xc7, 0x6d, 0x9f, 0xe5, 0xe5, 0x73, 
97           0x97, 0x39, 0x32, 0xce, 0x2e, 0xb4, 0x6d, 0xdc, 
98           0x60, 0x68, 0xa7, 0xae, 0xe8, 0x98, 0xf0, 0x80, 
99           0x3a, 0x40, 0x0f, 0x21, 0x6e, 0x23, 0x12, 0x11, 
100           0xbc, 0xc7, 0x29, 0xdb, 0xcd, 0x7b, 0x26, 0x91, 
101           0x59, 0xa6, 0xba, 0xfe, 0x34, 0x6d, 0x00, 0x00 };
102
103 SWFFONT * Font_Demo_Font(U16 id)
104 { SWFFONT * f;
105   int i;
106
107   if (!(f=malloc(sizeof(SWFFONT)))) return NULL;
108   memset(f,0x00,sizeof(SWFFONT));
109   f->id       = id;
110   f->name     = strdup("Demo Font");
111   f->flags    = 0x10;
112
113   addGlyph(f,102, 0x00,  64,  0, &Glyphs_Demo_Font[0x0000], 872); // f
114   addGlyph(f,108, 0x00,  53,  1, &Glyphs_Demo_Font[0x006d], 452); // l
115   addGlyph(f,111, 0x00,  96,  2, &Glyphs_Demo_Font[0x00a6], 743); // o
116   addGlyph(f,115, 0x00,  74,  3, &Glyphs_Demo_Font[0x0103], 951); // s
117   addGlyph(f,116, 0x00,  53,  4, &Glyphs_Demo_Font[0x017a], 570); // t
118   addGlyph(f,119, 0x00, 138,  5, &Glyphs_Demo_Font[0x01c2], 806); // w
119   return f;
120 }
121
122 #undef addGlyph