source: libcaca/trunk/caca-php/examples/www/fullwidth.php @ 4333

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

Large source code cleanup, getting rid of spaces, tabs, and svn keywords.

  • Property svn:keywords set to Id
File size: 2.2 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 *  fullwidth     libcaca fullwidth Unicode characters test program
11 *  Copyright (c) 2008 Benjamin C. Wiley Sittler <bsittler@gmail.com>
12 *
13 *  This file is a Php port of "examples/fullwidth.c"
14 *  which is:
15 *  Copyright (c) 2006 Sam Hocevar <sam@hocevar.net>
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://sam.zoy.org/wtfpl/COPYING for more details.
23 */
24?>
25<head>
26<title>sample program for libcaca php binding</title>
27<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
28</head>
29<body text="silver" bgcolor="black">
30<?php
31
32define('CACA', "쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊");
33
34$cv = caca_create_canvas(36, 12);
35if(! $cv)
36{
37    die("Can't created canvas\n");
38}
39
40$caca = caca_create_canvas(6, 10);
41$line = caca_create_canvas(2, 1);
42
43/* Line of x's */
44for($i = 0; $i < 10; $i++)
45{
46    caca_set_color_ansi($caca, CACA_WHITE, CACA_BLUE);
47    caca_put_str($caca, 0, $i, CACA);
48    caca_set_color_ansi($caca, CACA_WHITE, CACA_RED);
49    caca_put_char($caca, $i - 2, $i, ord('x'));
50}
51
52caca_blit($cv, 1, 1, $caca);
53
54/* Line of ホ's */
55for($i = 0; $i < 10; $i++)
56{
57    caca_set_color_ansi($caca, CACA_WHITE, CACA_BLUE);
58    caca_put_str($caca, 0, $i, CACA);
59    caca_set_color_ansi($caca, CACA_WHITE, CACA_GREEN);
60    caca_put_str($caca, $i - 2, $i, "ホ");
61}
62
63caca_blit($cv, 15, 1, $caca);
64
65/* Line of canvas */
66caca_set_color_ansi($line, CACA_WHITE, CACA_MAGENTA);
67caca_put_str($line, 0, 0, "ほ");
68for($i = 0; $i < 10; $i++)
69{
70    caca_set_color_ansi($caca, CACA_WHITE, CACA_BLUE);
71    caca_put_str($caca, 0, $i, CACA);
72    caca_blit($caca, $i - 2, $i, $line);
73}
74
75caca_blit($cv, 29, 1, $caca);
76
77echo caca_export_string($cv, "html3");
78
79?>
80</body>
81</html>
Note: See TracBrowser for help on using the repository browser.