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

Last change on this file since 3129 was 3129, checked in by nico, 12 years ago
  • Add php binding for caca_load_font, caca_get_font_blocks, caca_put_figchar
  • Add a working sample file examples/figfont.php
  • Rename sample programs:

examples1.php > cacapig.php
drivers.php > cacainfo.php

  • 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.