Browse Source

* Added a test program for the font renderer.

tags/v0.99.beta14
Sam Hocevar sam 19 years ago
parent
commit
e18b717e38
2 changed files with 53 additions and 1 deletions
  1. +4
    -1
      test/Makefile.am
  2. +49
    -0
      test/font.c

+ 4
- 1
test/Makefile.am View File

@@ -2,7 +2,7 @@

AM_CPPFLAGS = -I$(top_srcdir)/cucul -I$(top_srcdir)/caca -DDATADIR=\"$(pkgdatadir)\"

noinst_PROGRAMS = colors demo dithering event export gamma hsv spritedit transform unicode
noinst_PROGRAMS = colors demo dithering event export font gamma hsv spritedit transform unicode

colors_SOURCES = colors.c
colors_LDADD = ../caca/libcaca.la ../cucul/libcucul.la @CACA_LIBS@
@@ -19,6 +19,9 @@ event_LDADD = ../caca/libcaca.la ../cucul/libcucul.la @CACA_LIBS@
export_SOURCES = export.c
export_LDADD = ../cucul/libcucul.la @CUCUL_LIBS@

font_SOURCES = font.c
font_LDADD = ../cucul/libcucul.la @CUCUL_LIBS@

gamma_SOURCES = gamma.c
gamma_LDADD = ../caca/libcaca.la ../cucul/libcucul.la @CACA_LIBS@ @MATH_LIBS@



+ 49
- 0
test/font.c View File

@@ -0,0 +1,49 @@
/*
* font libcucul font test program
* Copyright (c) 2006 Sam Hocevar <sam@zoy.org>
* All Rights Reserved
*
* $Id$
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the Do What The Fuck You Want To
* Public License, Version 2, as published by Sam Hocevar. See
* http://sam.zoy.org/wtfpl/COPYING for more details.
*/

#include "config.h"

#if defined(HAVE_INTTYPES_H)
# include <inttypes.h>
#else
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned int uint32_t;
#endif

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "cucul.h"

extern uint8_t font_monospace9[];

int main(int argc, char *argv[])
{
cucul_t *qq;
struct cucul_font *f;

qq = cucul_create(5, 2);
cucul_putstr(qq, 0, 0, "ABcde");
cucul_putstr(qq, 0, 1, "&$âøÿ");

f = cucul_load_font(font_monospace9, 700000);
cucul_render_canvas(qq, f);
cucul_free_font(f);

cucul_free(qq);

return 0;
}


Loading…
Cancel
Save