fixed graphics bug
[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 program is free software; you can redistribute it and/or modify
10    it under the terms of the GNU General Public License as published by
11    the Free Software Foundation; either version 2 of the License, or
12    (at your option) any later version.
13
14    This program is distributed in the hope that it will be useful,
15    but WITHOUT ANY WARRANTY; without even the implied warranty of
16    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17    GNU General Public License for more details.
18
19    You should have received a copy of the GNU General Public License
20    along with this program; if not, write to the Free Software
21    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
22
23 #define addGlyph fn3711
24
25 void fn3711(SWFFONT * f,int i,U16 ascii,U16 advance,U8 * data,U32 bitlen)
26 { SHAPE * s;
27   U32 l = (bitlen+7)/8;
28
29   if (FAILED(swf_ShapeNew(&s))) return;
30   s->data = malloc(l);
31   if (!s->data) { swf_ShapeFree(s); return; }
32
33   f->glyph2ascii[i]     = ascii;
34   f->ascii2glyph[ascii] = i;
35   f->glyph[i].advance   = advance;
36   f->glyph[i].shape     = s;
37   s->bitlen             = bitlen;
38   s->bits.fill          = 1;
39   memcpy(s->data,data,l);
40 }
41
42 U8 Glyphs_Demo_Font[] = {
43           0x35, 0x66, 0xc2, 0xd5, 0xe3, 0x9b, 0x62, 0x08, 
44           0xea, 0x09, 0xe2, 0x4c, 0xf8, 0xba, 0x59, 0x2d, 
45           0x93, 0x1d, 0xe4, 0xc3, 0x6b, 0x40, 0x92, 0x90, 
46           0x30, 0x36, 0x4c, 0x0c, 0xe5, 0xa9, 0xbe, 0x46, 
47           0x40, 0x1a, 0xf5, 0x50, 0xec, 0x3b, 0x6a, 0xa4, 
48           0xd8, 0x8a, 0xe1, 0x4b, 0x66, 0x00, 0x40, 0x0e, 
49           0x11, 0x91, 0x35, 0x9f, 0x03, 0x51, 0x4e, 0x8a, 
50           0x5c, 0x17, 0x7e, 0x8d, 0xda, 0x0a, 0x48, 0xa0, 
51           0x08, 0xed, 0x22, 0x1b, 0x0f, 0x7c, 0xa1, 0xb7, 
52           0x80, 0x9f, 0xc3, 0x69, 0xec, 0x53, 0xea, 0xdc, 
53           0xd8, 0x59, 0xd1, 0x8a, 0x60, 0x0b, 0xc1, 0x6d, 
54           0x09, 0x4b, 0x51, 0x5b, 0x8e, 0x55, 0xb8, 0x9c, 
55           0x80, 0x95, 0xa0, 0x05, 0x88, 0xa4, 0x75, 0x70, 
56           0x1c, 0x8c, 0x0f, 0x9b, 0x40, 0x35, 0x62, 0xfa, 
57           0x9c, 0xf9, 0x53, 0x04, 0xa0, 0x15, 0x86, 0x1d, 
58           0x19, 0x9c, 0xd3, 0xca, 0x34, 0x3a, 0x40, 0x1a, 
59           0x29, 0x6e, 0x47, 0xf4, 0x6e, 0xd6, 0xaf, 0xd4, 
60           0x6c, 0xc9, 0xa3, 0x28, 0x7e, 0x20, 0x2b, 0x70, 
61           0xcc, 0x13, 0x00, 0x59, 0x7e, 0x77, 0xe9, 0xd6, 
62           0x7d, 0x36, 0x75, 0xae, 0xf8, 0x8d, 0x3c, 0x5d, 
63           0xbd, 0x11, 0xc8, 0xd0, 0x5c, 0x00, 0x35, 0x47, 
64           0x8c, 0x93, 0x92, 0x50, 0x26, 0x42, 0x5c, 0xa4, 
65           0x37, 0xa7, 0x97, 0x82, 0x80, 0x0f, 0xa6, 0x00, 
66           0x64, 0x28, 0x48, 0x98, 0x9d, 0x25, 0x04, 0x02, 
67           0x56, 0x20, 0x0f, 0xd8, 0x98, 0x83, 0x60, 0x02, 
68           0x7a, 0x60, 0x08, 0x6c, 0xbb, 0xa9, 0x6e, 0xd0, 
69           0x92, 0x00, 0x15, 0x12, 0x92, 0x3c, 0xac, 0xf1, 
70           0x39, 0x01, 0x33, 0x40, 0x01, 0xfa, 0x7c, 0xc6, 
71           0xc8, 0x60, 0x0b, 0x12, 0x80, 0x7b, 0x89, 0xfc, 
72           0xb8, 0xdf, 0xcc, 0x41, 0x2c, 0xc4, 0x10, 0x40, 
73           0x4d, 0x30, 0x01, 0x87, 0x5d, 0x36, 0x6d, 0xd0, 
74           0x05, 0x54, 0xa0, 0x20, 0x9f, 0x85, 0x29, 0xf8, 
75           0x2c, 0xf1, 0x80, 0x35, 0x4a, 0x44, 0x53, 0xdd, 
76           0x4e, 0x68, 0x61, 0x37, 0x6d, 0xb7, 0x17, 0x34, 
77           0xb8, 0xb2, 0xd2, 0x01, 0x2d, 0xd0, 0x1a, 0xc9, 
78           0xc9, 0x52, 0x40, 0x2f, 0x20, 0x0e, 0x20, 0xa4, 
79           0xa4, 0x0a, 0x2f, 0x2f, 0xb5, 0x24, 0x92, 0x66, 
80           0x63, 0x10, 0x05, 0x19, 0x40, 0x3f, 0xa2, 0x9a, 
81           0x5a, 0x09, 0xa3, 0x00, 0xdb, 0x41, 0xe3, 0xa6, 
82           0x5e, 0xe3, 0xa0, 0x34, 0xdd, 0x0b, 0xf7, 0x6b, 
83           0xba, 0x08, 0xcc, 0x1c, 0x8c, 0x4e, 0x47, 0x2a, 
84           0x84, 0x8c, 0x40, 0x4a, 0x88, 0x01, 0x6d, 0x92, 
85           0x2d, 0x58, 0x12, 0x4a, 0x02, 0xee, 0x8d, 0x33, 
86           0x73, 0xf4, 0x5c, 0x6e, 0x4d, 0x6f, 0xb9, 0xd5, 
87           0xc7, 0x2e, 0x9c, 0x80, 0x2a, 0x4a, 0x02, 0x42, 
88           0x7b, 0x52, 0xa7, 0xb4, 0xf4, 0x06, 0xd4, 0x20, 
89           0xbd, 0x68, 0x84, 0x67, 0x67, 0x33, 0xae, 0x3a, 
90           0x08, 0x00, 0x35, 0x62, 0x96, 0xd0, 0x77, 0x52, 
91           0xdb, 0x0d, 0x7a, 0xa8, 0xf6, 0x25, 0x78, 0x52, 
92           0x99, 0x40, 0x2d, 0x1a, 0x3e, 0x43, 0x50, 0x50, 
93           0x09, 0x10, 0x01, 0x0d, 0xa4, 0x3f, 0x52, 0x6c, 
94           0xd0, 0x4e, 0x5d, 0xec, 0x70, 0x19, 0x97, 0x01, 
95           0x9b, 0xc0, 0x24, 0xa4, 0x0a, 0xb3, 0x92, 0xac, 
96           0xf5, 0xa6, 0x5e, 0xda, 0x00, 0x4e, 0xe1, 0xb3, 
97           0x36, 0x2d, 0xf4, 0x70, 0x91, 0xcd, 0x5d, 0x9a, 
98           0x53, 0x99, 0x4b, 0xdc, 0xda, 0x41, 0x77, 0x98, 
99           0xf0, 0x00, 0x35, 0x48, 0x34, 0x6d, 0xdc, 0x6d, 
100           0x68, 0xa7, 0x2d, 0xc0, 0x3c, 0x46, 0x49, 0xb1, 
101           0x00, 0x23, 0xa4, 0x45, 0x78, 0x8d, 0x08, 0x3e, 
102           0xf3, 0x0c, 0x0b, 0x58, 0xaa, 0xba, 0x76, 0xbf, 
103           0x5d, 0xaf, 0x1a, 0x36, 0xee, 0x24, 0x34, 0x53, 
104           0x96, 0xa8, 0x6d, 0x6d, 0x78, 0xec, 0xec, 0x56, 
105           0x85, 0x9c, 0x78, 0xdb, 0x73, 0x8e, 0xf6, 0x92, 
106           0x68, 0x5b, 0xc7, 0x6d, 0x9f, 0xe5, 0xe5, 0x73, 
107           0x97, 0x39, 0x32, 0xce, 0x2e, 0xb4, 0x6d, 0xdc, 
108           0x60, 0x68, 0xa7, 0xae, 0xe8, 0x98, 0xf0, 0x80, 
109           0x3a, 0x40, 0x0f, 0x21, 0x6e, 0x23, 0x12, 0x11, 
110           0xbc, 0xc7, 0x29, 0xdb, 0xcd, 0x7b, 0x26, 0x91, 
111           0x59, 0xa6, 0xba, 0xfe, 0x34, 0x6d, 0x00, 0x00 };
112
113 SWFFONT * Font_Demo_Font(U16 id)
114 { SWFFONT * f;
115   int i;
116
117   if (!(f=malloc(sizeof(SWFFONT)))) return NULL;
118   memset(f,0x00,sizeof(SWFFONT));
119   f->id       = id;
120   f->version  = 1;
121   f->name     = strdup("Demo Font");
122   f->style    = 0x00;
123   f->encoding = 0x00;
124   f->numchars = 6;
125   f->maxascii = 256;
126   f->glyph    = (SWFGLYPH*)malloc(sizeof(SWFGLYPH)*6);
127   f->glyph2ascii = (U16*)malloc(sizeof(U16)*6);
128   f->ascii2glyph = (int*)malloc(sizeof(int)*256);
129   memset(f->ascii2glyph, -1, sizeof(int)*256);
130
131   addGlyph(f, 0, 102,  64, &Glyphs_Demo_Font[0x0000], 872); // f
132   addGlyph(f, 1, 108,  53, &Glyphs_Demo_Font[0x006d], 452); // l
133   addGlyph(f, 2, 111,  96, &Glyphs_Demo_Font[0x00a6], 743); // o
134   addGlyph(f, 3, 115,  74, &Glyphs_Demo_Font[0x0103], 951); // s
135   addGlyph(f, 4, 116,  53, &Glyphs_Demo_Font[0x017a], 570); // t
136   addGlyph(f, 5, 119, 138, &Glyphs_Demo_Font[0x01c2], 806); // w
137   return f;
138 }
139
140 #undef addGlyph