Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

pandatool/src/egg-mkfont/eggMakeFont.h

Go to the documentation of this file.
00001 // Filename: eggMakeFont.h
00002 // Created by:  drose (16Feb01)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
00008 //
00009 // All use of this software is subject to the terms of the Panda 3d
00010 // Software license.  You should have received a copy of this license
00011 // along with this source code; you will also find a current copy of
00012 // the license at http://www.panda3d.org/license.txt .
00013 //
00014 // To contact the maintainers of this program write to
00015 // panda3d@yahoogroups.com .
00016 //
00017 ////////////////////////////////////////////////////////////////////
00018 
00019 #ifndef EGGMAKEFONT_H
00020 #define EGGMAKEFONT_H
00021 
00022 #include <pandatoolbase.h>
00023 
00024 #include "charLayout.h"
00025 
00026 #include <eggWriter.h>
00027 #include <luse.h>
00028 #include <pnmImage.h>
00029 
00030 class CharPlacement;
00031 class CharBitmap;
00032 class EggGroup;
00033 class EggTexture;
00034 class EggVertexPool;
00035 class EggVertex;
00036 class FontFile;
00037 
00038 ////////////////////////////////////////////////////////////////////
00039 //       Class : EggMakeFont
00040 // Description : This program reads a rasterized font stored in a
00041 //               Metafont/TeX pk file format, and generates an egg
00042 //               file and texture map that can be used with TextNode
00043 //               to render text using the font.
00044 ////////////////////////////////////////////////////////////////////
00045 class EggMakeFont : public EggWriter {
00046 public:
00047   EggMakeFont();
00048 
00049 protected:
00050   virtual bool handle_args(Args &args);
00051   static bool dispatch_dimensions(ProgramBase *self, const string &opt, const string &arg, void *);
00052   bool ns_dispatch_dimensions(const string &opt, const string &arg);
00053 
00054 private:
00055   TexCoordd get_uv(double x, double y);
00056   LPoint2d get_xy(double x, double y);
00057   EggVertex *make_vertex(const LPoint2d &xy);
00058 
00059   void copy_character(const CharPlacement &pl);
00060 
00061   bool consider_scale_factor(double scale_factor);
00062   void choose_scale_factor(double too_small, double too_large);
00063   bool choose_scale_factor();
00064   void choose_image_size();
00065 
00066   void unsmooth_rgb(PNMImage &image);
00067   string expand_hyphen(const string &str);
00068 
00069 public:
00070   void run();
00071 
00072 private:
00073   Filename _output_image_filename;
00074   Filename _input_font_filename;
00075   bool _got_output_size;
00076   Colorf _fg, _bg;
00077   bool _use_alpha;
00078   int _output_xsize, _output_ysize, _output_zsize;
00079   double _buffer_pixels;
00080   double _poly_pixels;
00081   bool _got_scale_factor;
00082   double _scale_factor;
00083   bool _no_reduce;
00084   double _gaussian_radius;
00085   double _ds;
00086   double _scale;
00087   double _ppu;
00088   bool _get_all;
00089   string _only_chars;
00090   bool _small_caps;
00091   double _small_caps_scale;
00092 
00093   FontFile *_font;
00094   typedef pmap<int, PT(EggGroup)> EggDefs;
00095   EggDefs _egg_defs;
00096 
00097   CharLayout _layout;
00098   int _working_xsize, _working_ysize;
00099   int _working_buffer_pixels;
00100   double _working_poly_pixels;
00101 
00102   PNMImage _output_image;
00103 
00104   EggVertexPool *_vpool;
00105   EggGroup *_group;
00106   EggTexture *_tref;
00107 };
00108 
00109 
00110 #endif
00111 

Generated on Fri May 2 03:17:08 2003 for Panda-Tool by doxygen1.3