diff options
author | James Bursa <james@netsurf-browser.org> | 2005-11-20 20:08:55 +0000 |
---|---|---|
committer | James Bursa <james@netsurf-browser.org> | 2005-11-20 20:08:55 +0000 |
commit | 731b0520fd4584d0dc47e77b231ee55887820b5e (patch) | |
tree | 9c7162cf2af0590a90a5af0a9c1346d54ab58e75 /rufl_test.c | |
parent | 0ce184db11c3a566832f49eea010aa1424a37f43 (diff) | |
download | librufl-731b0520fd4584d0dc47e77b231ee55887820b5e.tar.gz librufl-731b0520fd4584d0dc47e77b231ee55887820b5e.tar.bz2 |
[project @ 2005-11-20 20:08:55 by bursa]
Implement rufl_paint_callback().
svn path=/import/rufl/; revision=2465
Diffstat (limited to 'rufl_test.c')
-rw-r--r-- | rufl_test.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/rufl_test.c b/rufl_test.c index b9a4319..f851832 100644 --- a/rufl_test.c +++ b/rufl_test.c @@ -12,6 +12,10 @@ static void try(rufl_code code, const char *context); +static void callback(void *context, + const char *font_name, unsigned int font_size, + const char *s8, unsigned short *s16, unsigned int n, + int x, int y); int main(void) @@ -46,6 +50,9 @@ int main(void) printf("split: %i -> %i %i \"%s\"\n", x, actual_x, char_offset, utf8_test + char_offset); } + try(rufl_paint_callback("NewHall", rufl_REGULAR, 240, + utf8_test, sizeof utf8_test - 1, + 1200, 1000, callback, 0), "rufl_paint_callback"); rufl_quit(); return 0; @@ -74,3 +81,21 @@ void try(rufl_code code, const char *context) rufl_quit(); exit(1); } + + +void callback(void *context, + const char *font_name, unsigned int font_size, + const char *s8, unsigned short *s16, unsigned int n, + int x, int y) +{ + printf("callback: \"%s\", %u, ", font_name, font_size); + if (s8) + printf("s8 \"%.*s\" ", n, s8); + else { + printf("s16 \""); + for (unsigned int i = 0; i != n; i++) + printf("%x ", (unsigned int) s16[i]); + printf("\" "); + } + printf("%i %i\n", x, y); +} |