- Timestamp:
- Nov 6, 2006, 12:04:37 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcaca/trunk/test/font2tga.c
r1267 r1294 27 27 #define WIDTH 64 28 28 29 /* Copied from makefont.c */30 static unsigned int const blocklist[] =31 {32 0x0000, 0x0080, /* Basic latin: A, B, C, a, b, c */33 0x0080, 0x0100, /* Latin-1 Supplement: Ä, Ç, å, ß */34 0x0100, 0x0180, /* Latin Extended-A: Ā č Ō œ */35 0x0180, 0x0250, /* Latin Extended-B: Ǝ Ƹ */36 0x0250, 0x02b0, /* IPA Extensions: ɐ ɔ ɘ ʌ ʍ */37 0x0370, 0x0400, /* Greek and Coptic: Λ α β */38 0x0400, 0x0500, /* Cyrillic: И Я */39 0x0530, 0x0590, /* Armenian: Ո */40 0x1d00, 0x1d80, /* Phonetic Extensions: ᴉ ᵷ */41 0x2000, 0x2070, /* General Punctuation: ‘’ “” */42 0x2100, 0x2150, /* Letterlike Symbols: Ⅎ */43 0x2200, 0x2300, /* Mathematical Operators: √ ∞ ∙ */44 0x2300, 0x2400, /* Miscellaneous Technical: ⌐ ⌂ ⌠ ⌡ */45 0x2500, 0x2580, /* Box Drawing: ═ ║ ╗ ╔ ╩ */46 0x2580, 0x25a0, /* Block Elements: ▛ ▞ ░ ▒ ▓ */47 0, 048 };49 50 29 int main(int argc, char *argv[]) 51 30 { 31 unsigned long int const *blocks; 32 cucul_font_t *f; 33 char const * const * fonts; 52 34 cucul_canvas_t *cv; 53 35 cucul_buffer_t *buffer; 54 36 unsigned int i, j, x, y, glyphs; 55 37 56 for(i = 0, glyphs = 0; blocklist[i + 1]; i += 2) 57 glyphs += blocklist[i + 1] - blocklist[i]; 38 fonts = cucul_get_font_list(); 39 f = cucul_load_font(fonts[0], 0); 40 blocks = cucul_get_font_blocks(f); 41 42 for(i = 0, glyphs = 0; blocks[i + 1]; i += 2) 43 glyphs += blocks[i + 1] - blocks[i]; 58 44 59 45 /* Create a canvas */ … … 64 50 x = y = 0; 65 51 66 for(i = 0; block list[i + 1]; i += 2)52 for(i = 0; blocks[i + 1]; i += 2) 67 53 { 68 for(j = block list[i]; j < blocklist[i + 1]; j++)54 for(j = blocks[i]; j < blocks[i + 1]; j++) 69 55 { 70 56 cucul_putchar(cv, x, y, j); … … 77 63 } 78 64 } 65 66 cucul_free_font(f); 79 67 80 68 buffer = cucul_export_canvas(cv, "tga");
Note: See TracChangeset
for help on using the changeset viewer.