Changeset 1365 for libcaca/trunk/tools/makefont.c
- Timestamp:
- Nov 12, 2006, 6:30:08 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcaca/trunk/tools/makefont.c
r1361 r1365 91 91 92 92 FT_Bitmap img; 93 int width, height, blocks, glyphs, fullwidth;93 int stdwidth, fullwidth, height, blocks, glyphs, fullglyphs; 94 94 unsigned int n, b, i, index; 95 unsigned int glyph_size, control_size, data_size, current_offset;95 unsigned int stdsize, fullsize, control_size, data_size, current_offset; 96 96 uint8_t *glyph_data; 97 97 struct glyph *gtab; … … 149 149 pango_layout_set_markup(l, "@", -1); 150 150 pango_layout_get_extents(l, NULL, &r); 151 width = PANGO_PIXELS(r.width); 151 stdwidth = PANGO_PIXELS(r.width); 152 fullwidth = stdwidth * 2; 152 153 height = PANGO_PIXELS(r.height); 153 glyph_size = ((width * height) + (8 / bpp) - 1) / (8 / bpp); 154 stdsize = ((stdwidth * height) + (8 / bpp) - 1) / (8 / bpp); 155 fullsize = ((fullwidth * height) + (8 / bpp) - 1) / (8 / bpp); 154 156 155 157 /* Compute blocks and glyphs count */ 156 158 blocks = 0; 157 159 glyphs = 0; 158 full width= 0;160 fullglyphs = 0; 159 161 for(b = 0; blocklist[b + 1]; b += 2) 160 162 { … … 163 165 for(i = blocklist[b]; i < blocklist[b + 1]; i++) 164 166 if(cucul_utf32_is_fullwidth(i)) 165 full width++;166 } 167 168 control_size = 2 4+ 12 * blocks + 8 * glyphs;169 data_size = glyph_size * (glyphs + fullwidth);167 fullglyphs++; 168 } 169 170 control_size = 28 + 12 * blocks + 8 * glyphs; 171 data_size = stdsize * (glyphs - fullglyphs) + fullsize * fullglyphs; 170 172 171 173 gtab = malloc(glyphs * sizeof(struct glyph)); … … 174 176 /* Let's go! */ 175 177 printf("/* libcucul font file\n"); 176 printf(" * \"%s\": %i dpi, %i bpp, %ix%i glyphs\n",177 font, dpi, bpp, width, height);178 printf(" * \"%s\": %i dpi, %i bpp, %ix%i/%ix%i glyphs\n", 179 font, dpi, bpp, stdwidth, height, fullwidth, height); 178 180 printf(" * Automatically generated by tools/makefont.c:\n"); 179 181 printf(" * tools/makefont %s \"%s\" %i %i\n", prefix, font, dpi, bpp); … … 205 207 printf_u32("\"%s\" /* glyphs */\n", glyphs); 206 208 printf_u16("\"%s\" /* bpp */\n", bpp); 207 printf_u16("\"%s\" /* width */\n", width); 208 printf_u16("\"%s\" /* height */\n", height); 209 printf_u16("\"%s\" /* std width */\n", stdwidth); 210 printf_u16("\"%s\" /* std height */\n", height); 211 printf_u16("\"%s\" /* max width */\n", fullwidth); 212 printf_u16("\"%s\" /* max height */\n", height); 209 213 printf_u16("\"%s\" /* flags */\n", 1); 210 214 printf("\n"); … … 227 231 for(i = blocklist[b]; i < blocklist[b + 1]; i++) 228 232 { 229 int x, y, bytes, current_width = width;230 unsigned int k, current_size = glyph_size;233 int x, y, bytes, current_width = stdwidth; 234 unsigned int k, current_size = stdsize; 231 235 232 236 if(cucul_utf32_is_fullwidth(i)) 233 237 { 234 current_width *= 2;235 current_size *= 2;238 current_width = fullwidth; 239 current_size = fullsize; 236 240 } 237 241 gtab[n].unicode = i;
Note: See TracChangeset
for help on using the changeset viewer.