source: libcaca/trunk/caca-php/examples/www/unicode.php @ 4148

Last change on this file since 4148 was 4148, checked in by Sam Hocevar, 10 years ago

Update my e-mail address everywhere.

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