Ignore:
Timestamp:
Sep 27, 2008, 3:12:46 PM (12 years ago)
Author:
Sam Hocevar
Message:

Starting refactoring to get rid of libcucul. The initial reason for the
split is rendered moot by the plugin system: when enabled, binaries do
not link directly with libX11 or libGL. I hope this is a step towards
more consisteny and clarity.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/examples/font2tga.c

    r2304 r2821  
    11/*
    2  *  font2tga      libcucul font test program
     2 *  font2tga      libcaca font test program
    33 *  Copyright (c) 2006 Sam Hocevar <sam@zoy.org>
    44 *                All Rights Reserved
     
    2020#endif
    2121
    22 #include "cucul.h"
     22#include "caca.h"
    2323
    2424int main(int argc, char *argv[])
    2525{
    2626    uint32_t const *blocks;
    27     cucul_font_t *f;
     27    caca_font_t *f;
    2828    char const * const * fonts;
    29     cucul_canvas_t *cv;
     29    caca_canvas_t *cv;
    3030    void *buffer;
    3131    size_t len;
    3232    unsigned int i, j, x, y, cells, width;
    3333
    34     fonts = cucul_get_font_list();
    35     f = cucul_load_font(fonts[0], 0);
    36     blocks = cucul_get_font_blocks(f);
     34    fonts = caca_get_font_list();
     35    f = caca_load_font(fonts[0], 0);
     36    blocks = caca_get_font_blocks(f);
    3737
    3838    for(i = 0, cells = 0; blocks[i + 1]; i += 2)
     
    4040        cells += blocks[i + 1] - blocks[i];
    4141        for(j = blocks[i]; j < blocks[i + 1]; j++)
    42             if(cucul_utf32_is_fullwidth(j))
     42            if(caca_utf32_is_fullwidth(j))
    4343                cells++;
    4444    }
     
    4848
    4949    /* Create a canvas */
    50     cv = cucul_create_canvas(width, (cells + width - 1) / (width - 1));
    51     cucul_set_color_ansi(cv, CUCUL_RED, CUCUL_RED);
    52     cucul_clear_canvas(cv);
    53     cucul_set_color_ansi(cv, CUCUL_BLACK, CUCUL_WHITE);
     50    cv = caca_create_canvas(width, (cells + width - 1) / (width - 1));
     51    caca_set_color_ansi(cv, CACA_RED, CACA_RED);
     52    caca_clear_canvas(cv);
     53    caca_set_color_ansi(cv, CACA_BLACK, CACA_WHITE);
    5454
    5555    /* Put all glyphs on the canvas */
     
    6060        for(j = blocks[i]; j < blocks[i + 1]; j++)
    6161        {
    62             cucul_put_char(cv, x, y, j);
     62            caca_put_char(cv, x, y, j);
    6363
    64             if(cucul_utf32_is_fullwidth(j))
     64            if(caca_utf32_is_fullwidth(j))
    6565                ++x;
    6666
     
    7373    }
    7474
    75     cucul_free_font(f);
     75    caca_free_font(f);
    7676
    77     buffer = cucul_export_memory(cv, "tga", &len);
     77    buffer = caca_export_memory(cv, "tga", &len);
    7878    fwrite(buffer, len, 1, stdout);
    7979    free(buffer);
    8080
    8181    /* Free everything */
    82     cucul_free_canvas(cv);
     82    caca_free_canvas(cv);
    8383
    8484    return 0;
Note: See TracChangeset for help on using the changeset viewer.