Debian Codegraph @

caca-php/examples/www/unicode.php

raw
1 <?php
2 header('Content-Type: text/html; charset=UTF-8');
3 ?>
4 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
5 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
6
7 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
8 <?php
9 /*
10 * unicode libcaca Unicode rendering test program
11 * Copyright (c) 2008 Benjamin C. Wiley Sittler <[email protected]>
12 *
13 * This file is a Php port of "examples/unicode.c"
14 * which is:
15 * Copyright (c) 2006 Sam Hocevar <[email protected]>
16 * All Rights Reserved
17 *
18 * This program is free software. It comes without any warranty, to
19 * the extent permitted by applicable law. You can redistribute it
20 * and/or modify it under the terms of the Do What the Fuck You Want
21 * to Public License, Version 2, as published by Sam Hocevar. See
22 * http://www.wtfpl.net/ for more details.
23 */
24 ?>
25 <head>
26 <title>libcaca Unicode rendering test program</title>
27 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
28 </head>
29 <body text="silver" bgcolor="black">
30 <?php
31
32 $cv = caca_create_canvas(80, 25);
33 if(! $cv)
34 {
35 die("Can't created canvas\n");
36 }
37 caca_set_color_ansi($cv, CACA_WHITE, CACA_BLUE);
38 caca_put_str($cv, 1, 1, "Basic Unicode support");
39
40 caca_set_color_ansi($cv, CACA_DEFAULT, CACA_TRANSPARENT);
41 caca_put_str($cv, 1, 2, "This is ASCII: | abc DEF 123 !@# |");
42 caca_put_str($cv, 1, 3, "This is Unicode: | äßç δεφ ☺♥♀ ╞╬╗ |");
43 caca_put_str($cv, 1, 4, "And this is, too: | ἀβϛ ΔЗҒ ᚴᛒᛯ ♩♔✈ |");
44
45 caca_put_str($cv, 1, 5, "If the three lines do not have the same length, there is a bug somewhere.");
46
47 caca_set_color_ansi($cv, CACA_WHITE, CACA_BLUE);
48 caca_put_str($cv, 1, 7, "Gradient glyphs");
49
50 caca_set_color_ansi($cv, CACA_DEFAULT, CACA_TRANSPARENT);
51 caca_put_str($cv, 31, 8, " 0%");
52 caca_put_str($cv, 31, 9, " 25%");
53 caca_put_str($cv, 31, 10, " 50%");
54 caca_put_str($cv, 31, 11, " 75%");
55 caca_put_str($cv, 31, 12, "100%");
56
57 caca_set_color_ansi($cv, CACA_LIGHTRED, CACA_LIGHTGREEN);
58 caca_put_str($cv, 1, 8, " ");
59 caca_put_str($cv, 1, 9, "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░");
60 caca_put_str($cv, 1, 10, "▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒");
61 caca_put_str($cv, 1, 11, "▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓");
62 caca_put_str($cv, 1, 12, "█████████████████████████████");
63
64 caca_set_color_ansi($cv, CACA_LIGHTGREEN, CACA_LIGHTRED);
65 caca_put_str($cv, 36, 8, "█████████████████████████████");
66 caca_put_str($cv, 36, 9, "▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓");
67 caca_put_str($cv, 36, 10, "▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒");
68 caca_put_str($cv, 36, 11, "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░");
69 caca_put_str($cv, 36, 12, " ");
70
71 caca_set_color_ansi($cv, CACA_WHITE, CACA_BLUE);
72 caca_put_str($cv, 1, 14, "Double width characters");
73
74 caca_set_color_ansi($cv, CACA_LIGHTRED, CACA_TRANSPARENT);
75 caca_put_str($cv, 1, 15, "| ドラゴン ボーレ |");
76 caca_set_color_ansi($cv, CACA_DEFAULT, CACA_TRANSPARENT);
77 caca_put_str($cv, 1, 16, "| ()()()() ()()() |");
78 caca_set_color_ansi($cv, CACA_YELLOW, CACA_TRANSPARENT);
79 caca_put_str($cv, 1, 17, "| ドラゴン");
80 caca_put_str($cv, 12, 17, "ボーレ |");
81
82 caca_set_color_ansi($cv, CACA_DEFAULT, CACA_TRANSPARENT);
83 caca_put_str($cv, 1, 18, "If the three lines do not have the same length, there is a bug somewhere.");
84
85 caca_put_str($cv, 1, 20, "CP437 glyphs: ☺ ☻ ♥ ♦ ♣ ♠ • ◘ ○ ◙ ♂ ♀ ♪ ♫ ☼ ► ◄ ↕ ‼ ¶ § ▬ ↨ ↑ ↓ → ← ∟ ↔ ▲ ▼");
86 caca_put_str($cv, 1, 21, "more CP437: α ß Γ π Σ σ µ τ Φ Θ Ω δ ∞ φ ε ∩ ≡ ± ≥ ≤ ⌠ ⌡ ÷ ≈ ° ∙ · √ ⁿ ² ■");
87 caca_put_str($cv, 1, 22, "drawing blocks: ███ ▓▓▓ ▒▒▒ ░░░ ▀ ▄ ▌ ▐ █ ▖ ▗ ▘ ▝ ▚ ▞ ▙ ▛ ▜ ▟ ─ │ ┌ ┐ └ ┘ ├ ┤");
88 caca_put_str($cv, 1, 23, "more drawing: ┬ ┴ ┼ ═ ║ ╒ ╓ ╔ ╕ ╖ ╗ ╘ ╙ ╚ ╛ ╜ ╝ ╞ ╟ ╠ ╡ ╢ ╣ ╤ ╥ ╦ ╧ ╨ ╩ ╪ ╫ ╬");
89 caca_put_str($cv, 1, 24, "misc Unicode: ● ☭ ☮ ☯ ♔ ♛ ♙ ♞ ⚒ ⚓ ⚠");
90
91 echo caca_export_string($cv, "html3");
92
93 ?>
94 </body>
95 </html>