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

panda/src/text/staticTextFont.h

Go to the documentation of this file.
00001 // Filename: staticTextFont.h
00002 // Created by:  drose (03May01)
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 STATICTEXTFONT_H
00020 #define STATICTEXTFONT_H
00021 
00022 #include "pandabase.h"
00023 
00024 #include "config_text.h"
00025 #include "textFont.h"
00026 #include "textGlyph.h"
00027 #include "pandaNode.h"
00028 #include "pointerTo.h"
00029 #include "pmap.h"
00030 
00031 class Node;
00032 class Geom;
00033 class GeomPoint;
00034 
00035 ////////////////////////////////////////////////////////////////////
00036 //       Class : StaticTextFont
00037 // Description : A StaticTextFont is loaded up from a model that was
00038 //               previously generated via egg-mkfont, and contains all
00039 //               of its glyphs already generated and available for
00040 //               use.  It doesn't require linking with any external
00041 //               libraries like FreeType.
00042 ////////////////////////////////////////////////////////////////////
00043 class EXPCL_PANDA StaticTextFont : public TextFont {
00044 PUBLISHED:
00045   StaticTextFont(PandaNode *font_def);
00046 
00047   virtual void write(ostream &out, int indent_level) const;
00048 
00049 public:
00050   virtual bool get_glyph(int character, const TextGlyph *&glyph);
00051 
00052 private:
00053   void find_character_gsets(PandaNode *root, Geom *&ch, GeomPoint *&dot,
00054                             const RenderState *&state, 
00055                             const RenderState *net_state);
00056   void find_characters(PandaNode *root,
00057                        const RenderState *net_state);
00058 
00059   typedef pmap<int, PT(TextGlyph)> Glyphs;
00060   Glyphs _glyphs;
00061   float _font_height;
00062   PT(PandaNode) _font;
00063 
00064 public:
00065   static TypeHandle get_class_type() {
00066     return _type_handle;
00067   }
00068   static void init_type() {
00069     TextFont::init_type();
00070     register_type(_type_handle, "StaticTextFont",
00071                   TextFont::get_class_type());
00072   }
00073   virtual TypeHandle get_type() const {
00074     return get_class_type();
00075   }
00076   virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00077 
00078 private:
00079   static TypeHandle _type_handle;
00080 };
00081 
00082 #include "staticTextFont.I"
00083 
00084 #endif

Generated on Fri May 2 00:44:18 2003 for Panda by doxygen1.3