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

panda/src/text/dynamicTextPage.h

Go to the documentation of this file.
00001 // Filename: dynamicTextPage.h
00002 // Created by:  drose (09Feb02)
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 DYNAMICTEXTPAGE_H
00020 #define DYNAMICTEXTPAGE_H
00021 
00022 #include "pandabase.h"
00023 
00024 #ifdef HAVE_FREETYPE
00025 
00026 #include "texture.h"
00027 #include "dynamicTextGlyph.h"
00028 #include "pointerTo.h"
00029 #include "pvector.h"
00030 
00031 class DynamicTextFont;
00032 
00033 ////////////////////////////////////////////////////////////////////
00034 //       Class : DynamicTextPage
00035 // Description : A single "page" of a DynamicTextFont.  This is a
00036 //               single texture that holds a number of glyphs for
00037 //               rendering.  The font starts out with one page, and
00038 //               will add more as it needs them.
00039 ////////////////////////////////////////////////////////////////////
00040 class EXPCL_PANDA DynamicTextPage : public Texture {
00041 public:
00042   DynamicTextPage(DynamicTextFont *font);
00043 
00044   DynamicTextGlyph *slot_glyph(int x_size, int y_size, int margin);
00045 
00046   INLINE int get_x_size() const;
00047   INLINE int get_y_size() const;
00048 
00049 PUBLISHED:
00050   INLINE bool is_empty() const;
00051 
00052 private:
00053   int garbage_collect();
00054 
00055 private:
00056   bool find_hole(int &x, int &y, int x_size, int y_size) const;
00057   DynamicTextGlyph *find_overlap(int x, int y, int x_size, int y_size) const;
00058 
00059   typedef pvector< PT(DynamicTextGlyph) > Glyphs;
00060   Glyphs _glyphs;
00061 
00062   int _x_size, _y_size;
00063 
00064   DynamicTextFont *_font;
00065 
00066 public:
00067   static TypeHandle get_class_type() {
00068     return _type_handle;
00069   }
00070   static void init_type() {
00071     Texture::init_type();
00072     register_type(_type_handle, "DynamicTextPage",
00073                   Texture::get_class_type());
00074   }
00075   virtual TypeHandle get_type() const {
00076     return get_class_type();
00077   }
00078   virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00079 
00080 private:
00081   static TypeHandle _type_handle;
00082 
00083   friend class DynamicTextFont;
00084 };
00085 
00086 #include "dynamicTextPage.I"
00087 
00088 #endif  // HAVE_FREETYPE
00089 
00090 #endif

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