source: libcaca/trunk/caca-php/examples/figfont.php @ 3132

Last change on this file since 3132 was 3132, checked in by nico, 12 years ago
  • Change type of the last argument of drawing function (from string to long)
  • Adapt sample programs
  • Property svn:executable set to *
File size: 446 bytes
Line 
1#!/usr/bin/php5
2<?php
3
4if ($argc < 3) {
5        die("Too few arguments.\nUsage: cmd <path of font> <string>\n");
6}
7
8$cv = caca_create_canvas(0, 0);
9
10if (!caca_canvas_set_figfont($cv, $argv[1])) {
11        die("Could not open font\n");
12}
13
14$str = $argv[2];
15$color = 0;
16for ($i = 0; $i < strlen($str); $i++) {
17        caca_set_color_ansi($cv, 1 + (($color += 4) % 15), CACA_TRANSPARENT);
18        caca_put_figchar($cv, ord($str[$i]));
19}
20
21echo caca_export_string($cv, "utf8");
22
23
24
Note: See TracBrowser for help on using the repository browser.