Panda3D
 All Classes Functions Variables Enumerations
dynamicTextGlyph.h
1 // Filename: dynamicTextGlyph.h
2 // Created by: drose (09Feb02)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef DYNAMICTEXTGLYPH_H
16 #define DYNAMICTEXTGLYPH_H
17 
18 #include "pandabase.h"
19 
20 #ifdef HAVE_FREETYPE
21 
22 #include "textGlyph.h"
23 
24 class DynamicTextPage;
25 class DynamicTextFont;
26 
27 ////////////////////////////////////////////////////////////////////
28 // Class : DynamicTextGlyph
29 // Description : A specialization on TextGlyph that is generated and
30 // stored by a DynamicTextFont. This keeps some
31 // additional information, such as where the glyph
32 // appears on a texture map.
33 ////////////////////////////////////////////////////////////////////
34 class EXPCL_PANDA_TEXT DynamicTextGlyph : public TextGlyph {
35 public:
36  INLINE DynamicTextGlyph(int character, DynamicTextPage *page,
37  int x, int y, int x_size, int y_size,
38  int margin);
39  INLINE DynamicTextGlyph(int character, PN_stdfloat advance);
40 private:
41  INLINE DynamicTextGlyph(const DynamicTextGlyph &copy);
42  INLINE void operator = (const DynamicTextGlyph &copy);
43 
44 PUBLISHED:
45  virtual ~DynamicTextGlyph();
46 
47  INLINE DynamicTextPage *get_page() const;
48 
49  INLINE bool intersects(int x, int y, int x_size, int y_size) const;
50 
51  INLINE PN_stdfloat get_top() const;
52  INLINE PN_stdfloat get_left() const;
53  INLINE PN_stdfloat get_bottom() const;
54  INLINE PN_stdfloat get_right() const;
55 
56  INLINE PN_stdfloat get_uv_top() const;
57  INLINE PN_stdfloat get_uv_left() const;
58  INLINE PN_stdfloat get_uv_bottom() const;
59  INLINE PN_stdfloat get_uv_right() const;
60 
61 public:
62  unsigned char *get_row(int y);
63  void erase(DynamicTextFont *font);
64  void make_geom(int top, int left, PN_stdfloat advance, PN_stdfloat poly_margin,
65  PN_stdfloat tex_x_size, PN_stdfloat tex_y_size,
66  PN_stdfloat font_pixels_per_unit, PN_stdfloat tex_pixels_per_unit);
67  void set_geom(GeomVertexData *vdata, GeomPrimitive *prim,
68  const RenderState *state);
69  virtual bool is_whitespace() const;
70 
71  DynamicTextPage *_page;
72  int _geom_count;
73 
74  int _x, _y;
75  int _x_size, _y_size;
76  int _margin;
77  PN_stdfloat _top, _left, _bottom, _right;
78  PN_stdfloat _uv_top, _uv_left, _uv_bottom, _uv_right;
79 
80 public:
81  static TypeHandle get_class_type() {
82  return _type_handle;
83  }
84  static void init_type() {
85  TextGlyph::init_type();
86  register_type(_type_handle, "DynamicTextGlyph",
87  TextGlyph::get_class_type());
88  }
89  virtual TypeHandle get_type() const {
90  return get_class_type();
91  }
92  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
93 
94 private:
95  static TypeHandle _type_handle;
96 };
97 
98 #include "dynamicTextGlyph.I"
99 
100 #endif // HAVE_FREETYPE
101 
102 #endif
This is an abstract base class for a family of classes that represent the fundamental geometry primit...
Definition: geomPrimitive.h:63
This defines the actual numeric vertex data stored in a Geom, in the structure defined by a particula...
A representation of a single glyph (character) from a font.
Definition: textGlyph.h:31
This represents a unique collection of RenderAttrib objects that correspond to a particular renderabl...
Definition: renderState.h:53
virtual bool is_whitespace() const
Returns true if this glyph represents invisible whitespace, or false if it corresponds to some visibl...
Definition: textGlyph.cxx:36
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85