<?php header("Content-Type: text/html; charset=utf-8"); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
       "http://www.w3.org/TR/xhtml1/DTD/xhtml11.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">

<head>
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
   <meta name="GENERATOR" content="vim" />
   <meta name="Author" content="sam@zoy.org (Sam Hocevar)" />
   <meta name="Description" content="libcaca - TOIlet" />
   <meta name="Keywords" content="libcaca, ASCII, ASCII ART, console, text mode, ncurses, slang, AAlib" />
   <title>libcaca - TOIlet</title>
   <link rel="icon" type="image/x-icon" href="/favicon.ico" />
   <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
   <link rel="stylesheet" type="text/css" href="/main.css" />
</head>

<body>

<?php include($_SERVER["DOCUMENT_ROOT"]."/header.inc"); ?>

<h2> TOIlet </h2>

<p> The TOIlet project attempts to create a free replacement for the <a
href="http://www.figlet.org/">FIGlet</a> utility. TOIlet stands for “The
Other Implementation’s letters”, coined after FIGlet’s “Frank, Ian and
Glen’s letters”. </p>

<p> TOIlet is in its very early development phase. It uses the powerful
<i>libcucul</i> library to achieve various text-based effects. TOIlet
implements or plans to implement the following features: </p>

<ul>
  <li> The ability to load FIGlet fonts </li>
  <li> Support for Unicode input and output </li>
  <li> Support for colour output </li>
  <li> Support for various output formats: HTML, IRC, ANSI... </li>
</ul>

<p> TOIlet also aims for full FIGlet compatibility. It is currently able
to load FIGlet fonts and perform horizontal smushing. </p>

<h2> Live test </h2>

<? $submit = $_POST['submit'];
   $text = substr(stripslashes($_POST['text']), 0, 1024);
   $font = $_POST['font'];
   $fontlist = array('emboss' => 'Emboss',
                     'emboss2' => 'Emboss 2',
                     'future' => 'Future',
                     'smblock' => 'Small Block',
                     'smbraille' => 'Small Braille',
                     'circle' => 'Circle',
                     'term' => 'Terminal');
   if(!isset($fontlist[$font])) $font = 'smblock';
   $filter = $_POST['filter'];
   $filterlist = array('""' => 'No filter',
                       'flip' => 'Flip',
                       'flop' => 'Flop',
                       'rotate' => 'Rotate');
   if(!isset($filterlist[$filter])) $filter = '""'; ?>

<form method="post" action="toilet.html">
  <p>
    <select name="font">
      <? foreach($fontlist as $name => $desc) { ?>
        <option value="<?php echo $name; ?>"<? if($name == $font) echo ' selected="selected"';?>><?php echo $desc; ?></option>
      <? } ?>
    </select> 
    <select name="filter">
      <? foreach($filterlist as $name => $desc) { ?>
        <option value="<?php echo $name; ?>"<? if($name == $filter) echo ' selected="selected"';?>><?php echo $desc; ?></option>
      <? } ?>
    </select> 
    <input type="text" size="50" name="text"
           value="<? if($text) echo htmlspecialchars($text); ?>" />
    <input type="submit" name="submit" value="Generate" />
  </p>
</form>

<? if($submit) { ?>
  <div class="toilet">
    <p class="toilet"><pre><?
         exec('toilet -f '.$font.' -F '.$filter.' '.escapeshellarg($text),
              &$result);
         foreach($result as $line)
             echo htmlspecialchars($line)."\n";
      ?></pre></p>
  </div>
<? } ?>

<h2> Download </h2>

<p> The latest TOIlet version is <a
href="/files/toilet/toilet-0.1.tar.gz">toilet-0.1.tar.gz</a>. </p>

<h2> Screenshot </h2>

<p style="text-align: center;"><img src="toilet-sample.png" width="570"
height="386" alt="TOIlet sample" /></p>

<?php $rev = '$Id$';
      include($_SERVER['DOCUMENT_ROOT'].'/footer.inc'); ?>

</body>
</html>
