Panda3D
 All Classes Functions Variables Enumerations
dynamicTextGlyph.h
00001 // Filename: dynamicTextGlyph.h
00002 // Created by:  drose (09Feb02)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 #ifndef DYNAMICTEXTGLYPH_H
00016 #define DYNAMICTEXTGLYPH_H
00017 
00018 #include "pandabase.h"
00019 
00020 #ifdef HAVE_FREETYPE
00021 
00022 #include "textGlyph.h"
00023 
00024 class DynamicTextPage;
00025 class DynamicTextFont;
00026 
00027 ////////////////////////////////////////////////////////////////////
00028 //       Class : DynamicTextGlyph
00029 // Description : A specialization on TextGlyph that is generated and
00030 //               stored by a DynamicTextFont.  This keeps some
00031 //               additional information, such as where the glyph
00032 //               appears on a texture map.
00033 ////////////////////////////////////////////////////////////////////
00034 class EXPCL_PANDA_TEXT DynamicTextGlyph : public TextGlyph {
00035 public:
00036   INLINE DynamicTextGlyph(int character, DynamicTextPage *page,
00037                           int x, int y, int x_size, int y_size, 
00038                           int margin);
00039   INLINE DynamicTextGlyph(int character, PN_stdfloat advance);
00040 private:
00041   INLINE DynamicTextGlyph(const DynamicTextGlyph &copy);
00042   INLINE void operator = (const DynamicTextGlyph &copy);
00043 
00044 public:
00045   virtual ~DynamicTextGlyph();
00046 
00047   INLINE bool intersects(int x, int y, int x_size, int y_size) const;
00048   unsigned char *get_row(int y);
00049   void erase(DynamicTextFont *font);
00050   void make_geom(int top, int left, PN_stdfloat advance, PN_stdfloat poly_margin,
00051                  PN_stdfloat tex_x_size, PN_stdfloat tex_y_size,
00052                  PN_stdfloat font_pixels_per_unit, PN_stdfloat tex_pixels_per_unit);
00053   void set_geom(GeomVertexData *vdata, GeomPrimitive *prim, 
00054                 const RenderState *state);
00055   virtual bool is_whitespace() const;
00056 
00057   DynamicTextPage *_page;
00058   int _geom_count;
00059 
00060   int _x, _y;
00061   int _x_size, _y_size;
00062   int _margin;
00063 };
00064 
00065 #include "dynamicTextGlyph.I"
00066 
00067 #endif  // HAVE_FREETYPE
00068 
00069 #endif
 All Classes Functions Variables Enumerations