View Javadoc

1   /* ========================================================================
2    * JFiglet, a free open source java implementation of figlet and the
3    * figfont specification (see http://www.figlet.org)
4    * Copyright (C) 2004 Sebastien Brunot
5    *
6    * This library is free software; you can redistribute it and/or
7    * modify it under the terms of the GNU Lesser General Public
8    * License as published by the Free Software Foundation; either
9    * version 2.1 of the License, or (at your option) any later version.
10   *
11   * This library is distributed in the hope that it will be useful,
12   * but WITHOUT ANY WARRANTY; without even the implied warranty of
13   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14   * Lesser General Public License for more details.
15   *
16   * You should have received a copy of the GNU Lesser General Public
17   * License along with this library; if not, write to the Free Software
18   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19   * ========================================================================
20   */
21  package org.gnu.jfiglet;
22  
23  import java.io.IOException;
24  
25  import org.gnu.jfiglet.core.FIGFont;
26  import org.gnu.jfiglet.core.FIGure;
27  import org.gnu.jfiglet.core.IllegalFIGFontFileException;
28  import org.gnu.jfiglet.utils.FIGUtils;
29  
30  /***
31   * @TODO : DOCUMENT ME !
32   * 
33   * @version $Id: JFiglet.java,v 1.6 2004/05/11 19:23:00 sbrunot Exp $
34   *
35   * @author <a href="mailto:sebastien.brunot@club-internet.fr">Sebastien Brunot</a>
36   * 
37   */
38  public class JFiglet
39  {
40      /***
41       * Draws some examples of FIGures on standard output
42       * @param args none
43       * @throws IOException
44       */
45      public static void main(String[] args) throws IOException, IllegalFIGFontFileException
46      {
47          JFiglet test = new JFiglet();
48          test.run();
49      }
50  
51      private void run() throws IOException, IllegalFIGFontFileException
52      {
53          FIGFont standardFont = new FIGFont("standard");
54          standardFont.loadFromFile();
55          FIGFont nipplesFont = new FIGFont("nipples");
56          nipplesFont.loadFromFile();
57          FIGDriver figDriver = new FIGDriver();
58          FIGure figure = figDriver.getBannerFIGure("JFiglet", standardFont);
59          FIGUtils.renderFIGureToOutputStream(figure, System.out, System.getProperty("line.separator"));
60          figure = figDriver.getBannerFIGure("FAAC", standardFont);
61          FIGUtils.renderFIGureToOutputStream(figure, System.out, System.getProperty("line.separator"));
62          figure = figDriver.getBannerFIGure("LT", standardFont);
63          FIGUtils.renderFIGureToOutputStream(figure, System.out, System.getProperty("line.separator"));
64          figure = figDriver.getBannerFIGure("DOOM", nipplesFont);
65          FIGUtils.renderFIGureToOutputStream(figure, System.out, System.getProperty("line.separator"));
66      }
67  }