home *** CD-ROM | disk | FTP | other *** search
/ Cricao de Sites - 650 Layouts Prontos / WebMasters.iso / Servidores / xampp-win32-1.6.7-installer.exe / php / PEAR / Text / Wiki / Render / Latex / Font.php < prev    next >
Encoding:
PHP Script  |  2008-07-02  |  2.0 KB  |  74 lines

  1. <?php
  2. // vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
  3. /**
  4.  * BBCode: extra Font rules renderer to size the text
  5.  *
  6.  * PHP versions 4 and 5
  7.  *
  8.  * @category   Text
  9.  * @package    Text_Wiki
  10.  * @author     Bertrand Gugger <bertrand@toggg.com>
  11.  * @copyright  2005 bertrand Gugger
  12.  * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
  13.  * @version    CVS: $Id: Font.php,v 1.2 2006/03/11 11:14:23 toggg Exp $
  14.  * @link       http://pear.php.net/package/Text_Wiki
  15.  */
  16.  
  17. /**
  18.  * Font rule render class (used for BBCode)
  19.  * 
  20.  * @category   Text
  21.  * @package    Text_Wiki
  22.  * @author     Bertrand Gugger <bertrand@toggg.com>
  23.  * @copyright  2005 bertrand Gugger
  24.  * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
  25.  * @version    Release: @package_version@
  26.  * @link       http://pear.php.net/package/Text_Wiki
  27.  * @see        Text_Wiki::Text_Wiki_Render()
  28.  */
  29. class Text_Wiki_Render_Latex_Font extends Text_Wiki_Render {
  30.     
  31.     /**
  32.      * A table to translate the sizes
  33.      * 
  34.      * @access public
  35.      * @var array
  36.      */
  37.     var $sizes = array(
  38.         'tiny' => 5,
  39.         'scriptsize' => 7,
  40.         'footnotesize' => 8,
  41.         'small' => 9,
  42.         'normalsize' => 11,
  43.         'large' => 13,
  44.         'Large' => 16,
  45.         'LARGE' => 19,
  46.         'huge' => 22,
  47.         'Huge' => 9999);
  48.     
  49.     /**
  50.       * Renders a token into text matching the requested format.
  51.       * process the font size option 
  52.       *
  53.       * @access public
  54.       * @param array $options The "options" portion of the token (second element).
  55.       * @return string The text rendered from the token options.
  56.       */
  57.     function token($options)
  58.     {
  59.         if ($options['type'] == 'start') {
  60.             foreach ($this->sizes as $key => $lim) {
  61.                 if ($options['size'] < $lim) {
  62.                     break;
  63.                 }
  64.             }
  65.             return '\{' . $key . '}{';
  66.         }
  67.         
  68.         if ($options['type'] == 'end') {
  69.             return '}';
  70.         }
  71.     }
  72. }
  73. ?>
  74.