@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.)
hq.recaptime.dev/wiki/Phorge
phorge
phabricator
1<?php
2
3/* UTF-8 convert to FIGlet Unicode */
4/* iconv PHP module required */
5function utf8tofiglet($str)
6{
7 // escape %u
8 $str = str_replace('%u', sprintf('%%%%u%04X', ord('u')), $str);
9
10 if (function_exists('iconv')) {
11 $str = iconv('utf-8', 'ucs-2be', $str);
12 $out = '';
13
14 for ($i = 0, $len = strlen($str); $i<$len; $i++) {
15 $code = ord($str[$i++]) * 256 + ord($str[$i]);
16
17 $out .= $code < 128 ? $str[$i] : sprintf('%%u%04X', $code);
18 }
19
20 return $out;
21 }
22
23 return $str;
24}
25
26require_once 'Text/Figlet.php';
27
28$figlet = new Text_Figlet();
29$error = $figlet->LoadFont('makisupa.flf');
30if (PEAR::isError($error)) {
31 echo 'Error: ' . $error->getMessage() . "\n";
32} else {
33 echo $figlet->LineEcho(utf8tofiglet('Hello, world!')) . "\n";
34}
35?>