Ignore:
Timestamp:
Nov 4, 2007, 12:27:54 AM (13 years ago)
Author:
Sam Hocevar
Message:
  • Add a lookback table in the output. Will be handy later.
  • Now sortchars’s output can be directly saved to a C header file.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/tools/sortchars.c

    r1842 r1871  
    4040{
    4141    0, 4, 6, 8, 9, 10, 11, 12, 12, 13, 13, 14, 14, 15, 15, 15, 15
     42    //0, 3, 5, 7, 8, 9, 10, 11, 12, 13, 13, 14, 14, 15, 15, 15, 15
    4243    //0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 15
    4344};
     
    164165    /* Print results */
    165166    printf("/* Generated by sortchars.c */\n");
    166     printf("static char const lookup_ascii[%i] =\n{\n    ", FULLRANGE);
     167    printf("static char const cells_to_ascii[%i] =\n{\n    ", FULLRANGE);
    167168    for(i = 0; i < FULLRANGE; i++)
    168169    {
     
    171172        printf("%i, ", bestchar[i]);
    172173        if((i % 16) == 15 && i != FULLRANGE - 1)
     174            printf("\n    ");
     175    }
     176    printf("\n};\n\n");
     177    printf("static uint16_t const ascii_to_cells[%i] =\n{\n    ", GLYPHS);
     178    for(i = 0; i < GLYPHS; i++)
     179    {
     180        ret = cucul_utf32_to_utf8(utf8, bestchar[i]);
     181        utf8[ret] = '\0';
     182        printf("0x%03x, ", allbits[i]);
     183        if((i % 8) == 7 && i != GLYPHS - 1)
    173184            printf("\n    ");
    174185    }
     
    230241            dst[y * WIDTH * DX + x] = (int)buf[(y * 256 / (HEIGHT * DY)) * 256 + (x * 256 / (WIDTH * DX))] * RANGE / 256;
    231242
     243    printf("/* example:\n");
    232244    for(y = 0; y < HEIGHT; y++)
    233245    {
     
    250262        printf("\n");
    251263    }
     264    printf("*/\n");
    252265}
    253266
Note: See TracChangeset for help on using the changeset viewer.