diff --git a/tools/sortchars.c b/tools/sortchars.c index 6897b01..a1b9755 100644 --- a/tools/sortchars.c +++ b/tools/sortchars.c @@ -39,6 +39,7 @@ int bestchar[FULLRANGE]; static int curve[17] = /* 17 instead of 16 */ { 0, 4, 6, 8, 9, 10, 11, 12, 12, 13, 13, 14, 14, 15, 15, 15, 15 + //0, 3, 5, 7, 8, 9, 10, 11, 12, 13, 13, 14, 14, 15, 15, 15, 15 //0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 15 }; @@ -163,7 +164,7 @@ int main(int argc, char *argv[]) /* Print results */ printf("/* Generated by sortchars.c */\n"); - printf("static char const lookup_ascii[%i] =\n{\n ", FULLRANGE); + printf("static char const cells_to_ascii[%i] =\n{\n ", FULLRANGE); for(i = 0; i < FULLRANGE; i++) { ret = cucul_utf32_to_utf8(utf8, bestchar[i]); @@ -172,6 +173,16 @@ int main(int argc, char *argv[]) if((i % 16) == 15 && i != FULLRANGE - 1) printf("\n "); } + printf("\n};\n\n"); + printf("static uint16_t const ascii_to_cells[%i] =\n{\n ", GLYPHS); + for(i = 0; i < GLYPHS; i++) + { + ret = cucul_utf32_to_utf8(utf8, bestchar[i]); + utf8[ret] = '\0'; + printf("0x%03x, ", allbits[i]); + if((i % 8) == 7 && i != GLYPHS - 1) + printf("\n "); + } printf("\n};\n"); cucul_free_canvas(cv); @@ -229,6 +240,7 @@ static void testcircle(void) for(x = 0; x < WIDTH * DX; x++) dst[y * WIDTH * DX + x] = (int)buf[(y * 256 / (HEIGHT * DY)) * 256 + (x * 256 / (WIDTH * DX))] * RANGE / 256; + printf("/* example:\n"); for(y = 0; y < HEIGHT; y++) { for(x = 0; x < WIDTH; x++) @@ -249,5 +261,6 @@ static void testcircle(void) printf("\n"); } + printf("*/\n"); }