1 | /* |
---|
2 | * unicode libcaca Unicode rendering test program |
---|
3 | * Copyright (c) 2006 Sam Hocevar <sam@zoy.org> |
---|
4 | * All Rights Reserved |
---|
5 | * |
---|
6 | * $Id: unicode.c 858 2006-04-24 19:57:23Z sam $ |
---|
7 | * |
---|
8 | * This program is free software; you can redistribute it and/or |
---|
9 | * modify it under the terms of the Do What The Fuck You Want To |
---|
10 | * Public License, Version 2, as published by Sam Hocevar. See |
---|
11 | * http://sam.zoy.org/wtfpl/COPYING for more details. |
---|
12 | */ |
---|
13 | |
---|
14 | #include "config.h" |
---|
15 | #include "common.h" |
---|
16 | |
---|
17 | #if defined(HAVE_INTTYPES_H) |
---|
18 | # include <inttypes.h> |
---|
19 | #endif |
---|
20 | |
---|
21 | #include <stdio.h> |
---|
22 | |
---|
23 | #include "cucul.h" |
---|
24 | #include "caca.h" |
---|
25 | |
---|
26 | int main(void) |
---|
27 | { |
---|
28 | cucul_canvas_t *cv; |
---|
29 | caca_display_t *dp; |
---|
30 | |
---|
31 | cv = cucul_create_canvas(0, 0); |
---|
32 | dp = caca_create_display(cv); |
---|
33 | |
---|
34 | cucul_set_color(cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLUE); |
---|
35 | cucul_putstr(cv, 1, 1, "Basic Unicode support"); |
---|
36 | |
---|
37 | cucul_set_color(cv, CUCUL_COLOR_LIGHTGRAY, CUCUL_COLOR_BLACK); |
---|
38 | cucul_putstr(cv, 1, 2, "This is ASCII: | abc DEF 123 !@# |"); |
---|
39 | cucul_putstr(cv, 1, 3, "This is Unicode: | äßç δεφ ☺♥♀ ╞╬╗ |"); |
---|
40 | cucul_putstr(cv, 1, 4, "And this is, too: | ἀβϛ ΔЗҒ ᚴᛒᛯ ♩♔✈ |"); |
---|
41 | |
---|
42 | cucul_putstr(cv, 1, 5, "If the three lines do not have the same length, there is a bug somewhere."); |
---|
43 | |
---|
44 | cucul_set_color(cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLUE); |
---|
45 | cucul_putstr(cv, 1, 7, "Gradient glyphs"); |
---|
46 | |
---|
47 | cucul_set_color(cv, CUCUL_COLOR_LIGHTGRAY, CUCUL_COLOR_BLACK); |
---|
48 | cucul_putstr(cv, 31, 8, " 0%"); |
---|
49 | cucul_putstr(cv, 31, 9, " 25%"); |
---|
50 | cucul_putstr(cv, 31, 10, " 50%"); |
---|
51 | cucul_putstr(cv, 31, 11, " 75%"); |
---|
52 | cucul_putstr(cv, 31, 12, "100%"); |
---|
53 | |
---|
54 | cucul_set_color(cv, CUCUL_COLOR_LIGHTRED, CUCUL_COLOR_LIGHTGREEN); |
---|
55 | cucul_putstr(cv, 1, 8, " "); |
---|
56 | cucul_putstr(cv, 1, 9, "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); |
---|
57 | cucul_putstr(cv, 1, 10, "▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒"); |
---|
58 | cucul_putstr(cv, 1, 11, "▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓"); |
---|
59 | cucul_putstr(cv, 1, 12, "█████████████████████████████"); |
---|
60 | |
---|
61 | cucul_set_color(cv, CUCUL_COLOR_LIGHTGREEN, CUCUL_COLOR_LIGHTRED); |
---|
62 | cucul_putstr(cv, 36, 8, "█████████████████████████████"); |
---|
63 | cucul_putstr(cv, 36, 9, "▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓"); |
---|
64 | cucul_putstr(cv, 36, 10, "▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒"); |
---|
65 | cucul_putstr(cv, 36, 11, "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); |
---|
66 | cucul_putstr(cv, 36, 12, " "); |
---|
67 | |
---|
68 | cucul_set_color(cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLUE); |
---|
69 | cucul_putstr(cv, 1, 14, "Double width characters"); |
---|
70 | |
---|
71 | cucul_set_color(cv, CUCUL_COLOR_LIGHTRED, CUCUL_COLOR_BLACK); |
---|
72 | cucul_putstr(cv, 1, 15, "| ドラゴン ボーレ |"); |
---|
73 | cucul_set_color(cv, CUCUL_COLOR_LIGHTGRAY, CUCUL_COLOR_BLACK); |
---|
74 | cucul_putstr(cv, 1, 16, "| ()()()() ()()() |"); |
---|
75 | cucul_set_color(cv, CUCUL_COLOR_YELLOW, CUCUL_COLOR_BLACK); |
---|
76 | cucul_putstr(cv, 1, 17, "| ドラゴン"); |
---|
77 | cucul_putstr(cv, 10, 17, "ボーレ |"); |
---|
78 | |
---|
79 | cucul_set_color(cv, CUCUL_COLOR_LIGHTGRAY, CUCUL_COLOR_BLACK); |
---|
80 | cucul_putstr(cv, 1, 18, "If the three lines do not have the same length, there is a bug somewhere."); |
---|
81 | |
---|
82 | cucul_putstr(cv, 1, 20, "CP437 glyphs: ☺ ☻ ♥ ♦ ♣ ♠ • ◘ ○ ◙ ♂ ♀ ♪ ♫ ☼ ► ◄ ↕ ‼ ¶ § ▬ ↨ ↑ ↓ → ← ∟ ↔ ▲ ▼"); |
---|
83 | cucul_putstr(cv, 1, 21, "more CP437: α ß Γ π Σ σ µ τ Φ Θ Ω δ ∞ φ ε ∩ ≡ ± ≥ ≤ ⌠ ⌡ ÷ ≈ ° ∙ · √ ⁿ ² ■"); |
---|
84 | cucul_putstr(cv, 1, 22, "drawing blocks: ███ ▓▓▓ ▒▒▒ ░░░ ▀ ▄ ▌ ▐ █ ▖ ▗ ▘ ▝ ▚ ▞ ▙ ▛ ▜ ▟"); |
---|
85 | |
---|
86 | caca_refresh_display(dp); |
---|
87 | |
---|
88 | caca_get_event(dp, CACA_EVENT_KEY_PRESS, NULL, -1); |
---|
89 | |
---|
90 | caca_free_display(dp); |
---|
91 | cucul_free_canvas(cv); |
---|
92 | |
---|
93 | return 0; |
---|
94 | } |
---|
95 | |
---|