source: libcaca/trunk/examples/figfont.c @ 2111

Last change on this file since 2111 was 2111, checked in by Sam Hocevar, 12 years ago

=?utf-8?q?=20=20*=20Implement=20cucul=5Fput=5Ffigchar()=20to=20paste=20FIGlet/TOIlet=20characters=20in

=20=20=20=20=20=20=20=20=20=20=E2=96=8C=20=E2=96=8C=20=20=20=E2=96=9C=E2=96=9C=20=20=20=20=C2=A0=E2=96=8C=20=E2=96=8C=20=20=20=20=20=20=E2=96=9C=20=20=20=E2=96=8C=E2=96=90
=20=20=20=20=20=20=20=20=20=20=E2=96=99=E2=96=84=E2=96=8C=E2=96=9E=E2=96=80=E2=96=96=E2=96=90=E2=96=90=20=E2=96=9E=E2=96=80=E2=96=96=C2=A0=E2=96=8C=E2=96=96=E2=96=8C=E2=96=9E=E2=96=80=E2=96=96=E2=96=99=E2=96=80=E2=96=96=E2=96=90=20=E2=96=9E=E2=96=80=E2=96=8C=E2=96=90
=20=20=20=20=20=20=20=20=20=20=E2=96=8C=20=E2=96=8C=E2=96=9B=E2=96=80=20=E2=96=90=E2=96=90=20=E2=96=8C=20=E2=96=8C=C2=A0=E2=96=99=E2=96=9A=E2=96=8C=E2=96=8C=20=E2=96=8C=E2=96=8C=20=C2=A0=E2=96=90=20=E2=96=8C=20=E2=96=8C=E2=96=9D
=20=20=20=20=20=20=20=20=20=20=E2=96=98=20=E2=96=98=E2=96=9D=E2=96=80=E2=96=98=20=E2=96=98=E2=96=98=E2=96=9D=E2=96=80=20=C2=A0=E2=96=98=20=E2=96=98=E2=96=9D=E2=96=80=20=E2=96=98=20=20=20=E2=96=98=E2=96=9D=E2=96=80=E2=96=98=E2=96=9D?=
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit

File size: 1.3 KB
Line 
1/*
2 *  figfont       libcucul FIGfont test program
3 *  Copyright (c) 2007 Sam Hocevar <sam@zoy.org>
4 *                All Rights Reserved
5 *
6 *  $Id$
7 *
8 *  This program is free software. It comes without any warranty, to
9 *  the extent permitted by applicable law. You can redistribute it
10 *  and/or modify it under the terms of the Do What The Fuck You Want
11 *  To Public License, Version 2, as published by Sam Hocevar. See
12 *  http://sam.zoy.org/wtfpl/COPYING for more details.
13 */
14
15#include "config.h"
16#include "common.h"
17
18#if !defined(__KERNEL__)
19#   include <stdio.h>
20#   include <stdlib.h>
21#endif
22
23#include "cucul.h"
24
25int main(int argc, char *argv[])
26{
27    cucul_canvas_t *cv;
28    void *buffer;
29    unsigned long int len;
30    uint8_t color = 0;
31
32    if(argc < 3)
33    {
34        fprintf(stderr, "Too few arguments\n");
35        return -1;
36    }
37
38    cv = cucul_create_canvas(0, 0);
39    if(cucul_canvas_set_figfont(cv, argv[1]))
40    {
41        fprintf(stderr, "Could not open font\n");
42        return -1;
43    }
44
45    while(argv[2][0])
46    {
47        cucul_set_color_ansi(cv, 1 + ((color += 4) % 15), CUCUL_TRANSPARENT);
48        cucul_put_figchar(cv, argv[2]++[0]);
49    }
50
51    buffer = cucul_export_memory(cv, "utf8", &len);
52    fwrite(buffer, len, 1, stdout);
53    free(buffer);
54
55    cucul_free_canvas(cv);
56
57    return 0;
58}
59
Note: See TracBrowser for help on using the repository browser.