|
|
@@ -26,35 +26,21 @@ |
|
|
|
|
|
|
|
#define WIDTH 64 |
|
|
|
|
|
|
|
/* Copied from makefont.c */ |
|
|
|
static unsigned int const blocklist[] = |
|
|
|
{ |
|
|
|
0x0000, 0x0080, /* Basic latin: A, B, C, a, b, c */ |
|
|
|
0x0080, 0x0100, /* Latin-1 Supplement: Ä, Ç, å, ß */ |
|
|
|
0x0100, 0x0180, /* Latin Extended-A: Ā č Ō œ */ |
|
|
|
0x0180, 0x0250, /* Latin Extended-B: Ǝ Ƹ */ |
|
|
|
0x0250, 0x02b0, /* IPA Extensions: ɐ ɔ ɘ ʌ ʍ */ |
|
|
|
0x0370, 0x0400, /* Greek and Coptic: Λ α β */ |
|
|
|
0x0400, 0x0500, /* Cyrillic: И Я */ |
|
|
|
0x0530, 0x0590, /* Armenian: Ո */ |
|
|
|
0x1d00, 0x1d80, /* Phonetic Extensions: ᴉ ᵷ */ |
|
|
|
0x2000, 0x2070, /* General Punctuation: ‘’ “” */ |
|
|
|
0x2100, 0x2150, /* Letterlike Symbols: Ⅎ */ |
|
|
|
0x2200, 0x2300, /* Mathematical Operators: √ ∞ ∙ */ |
|
|
|
0x2300, 0x2400, /* Miscellaneous Technical: ⌐ ⌂ ⌠ ⌡ */ |
|
|
|
0x2500, 0x2580, /* Box Drawing: ═ ║ ╗ ╔ ╩ */ |
|
|
|
0x2580, 0x25a0, /* Block Elements: ▛ ▞ ░ ▒ ▓ */ |
|
|
|
0, 0 |
|
|
|
}; |
|
|
|
|
|
|
|
int main(int argc, char *argv[]) |
|
|
|
{ |
|
|
|
unsigned long int const *blocks; |
|
|
|
cucul_font_t *f; |
|
|
|
char const * const * fonts; |
|
|
|
cucul_canvas_t *cv; |
|
|
|
cucul_buffer_t *buffer; |
|
|
|
unsigned int i, j, x, y, glyphs; |
|
|
|
|
|
|
|
for(i = 0, glyphs = 0; blocklist[i + 1]; i += 2) |
|
|
|
glyphs += blocklist[i + 1] - blocklist[i]; |
|
|
|
fonts = cucul_get_font_list(); |
|
|
|
f = cucul_load_font(fonts[0], 0); |
|
|
|
blocks = cucul_get_font_blocks(f); |
|
|
|
|
|
|
|
for(i = 0, glyphs = 0; blocks[i + 1]; i += 2) |
|
|
|
glyphs += blocks[i + 1] - blocks[i]; |
|
|
|
|
|
|
|
/* Create a canvas */ |
|
|
|
cv = cucul_create_canvas(WIDTH, (glyphs + WIDTH - 1) / WIDTH); |
|
|
@@ -63,9 +49,9 @@ int main(int argc, char *argv[]) |
|
|
|
/* Put all glyphs on the canvas */ |
|
|
|
x = y = 0; |
|
|
|
|
|
|
|
for(i = 0; blocklist[i + 1]; i += 2) |
|
|
|
for(i = 0; blocks[i + 1]; i += 2) |
|
|
|
{ |
|
|
|
for(j = blocklist[i]; j < blocklist[i + 1]; j++) |
|
|
|
for(j = blocks[i]; j < blocks[i + 1]; j++) |
|
|
|
{ |
|
|
|
cucul_putchar(cv, x, y, j); |
|
|
|
|
|
|
@@ -77,6 +63,8 @@ int main(int argc, char *argv[]) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
cucul_free_font(f); |
|
|
|
|
|
|
|
buffer = cucul_export_canvas(cv, "tga"); |
|
|
|
fwrite(cucul_get_buffer_data(buffer), |
|
|
|
cucul_get_buffer_size(buffer), 1, stdout); |
|
|
|