Last change
on this file since 3404 was
2821,
checked in by Sam Hocevar, 12 years ago
|
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 size:
1.3 KB
|
Rev | Line | |
---|
[2110] | 1 | /* |
---|
[2821] | 2 | * figfont libcaca FIGfont test program |
---|
[2110] | 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 | |
---|
| 17 | #if !defined(__KERNEL__) |
---|
| 18 | # include <stdio.h> |
---|
[2111] | 19 | # include <stdlib.h> |
---|
[2110] | 20 | #endif |
---|
| 21 | |
---|
[2821] | 22 | #include "caca.h" |
---|
[2110] | 23 | |
---|
| 24 | int main(int argc, char *argv[]) |
---|
| 25 | { |
---|
[2821] | 26 | caca_canvas_t *cv; |
---|
[2111] | 27 | void *buffer; |
---|
[2313] | 28 | size_t len; |
---|
[2111] | 29 | uint8_t color = 0; |
---|
[2110] | 30 | |
---|
[2111] | 31 | if(argc < 3) |
---|
[2110] | 32 | { |
---|
| 33 | fprintf(stderr, "Too few arguments\n"); |
---|
| 34 | return -1; |
---|
| 35 | } |
---|
| 36 | |
---|
[2821] | 37 | cv = caca_create_canvas(0, 0); |
---|
| 38 | if(caca_canvas_set_figfont(cv, argv[1])) |
---|
[2110] | 39 | { |
---|
| 40 | fprintf(stderr, "Could not open font\n"); |
---|
| 41 | return -1; |
---|
| 42 | } |
---|
| 43 | |
---|
[2111] | 44 | while(argv[2][0]) |
---|
| 45 | { |
---|
[2821] | 46 | caca_set_color_ansi(cv, 1 + ((color += 4) % 15), CACA_TRANSPARENT); |
---|
| 47 | caca_put_figchar(cv, argv[2]++[0]); |
---|
[2111] | 48 | } |
---|
| 49 | |
---|
[2821] | 50 | buffer = caca_export_memory(cv, "utf8", &len); |
---|
[2111] | 51 | fwrite(buffer, len, 1, stdout); |
---|
| 52 | free(buffer); |
---|
| 53 | |
---|
[2821] | 54 | caca_free_canvas(cv); |
---|
[2110] | 55 | |
---|
| 56 | return 0; |
---|
| 57 | } |
---|
| 58 | |
---|
Note: See
TracBrowser
for help on using the repository browser.