Panda3D
textGlyph.h
1 // Filename: textGlyph.h
2 // Created by: drose (08Feb02)
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 TEXTGLYPH_H
16 #define TEXTGLYPH_H
17 
18 #include "pandabase.h"
19 #include "renderState.h"
20 #include "referenceCount.h"
21 #include "geom.h"
22 #include "pointerTo.h"
23 #include "dcast.h"
24 
25 ////////////////////////////////////////////////////////////////////
26 // Class : TextGlyph
27 // Description : A representation of a single glyph (character) from a
28 // font. This is a piece of renderable geometry of some
29 // kind.
30 ////////////////////////////////////////////////////////////////////
31 class EXPCL_PANDA_TEXT TextGlyph : public TypedReferenceCount {
32 public:
33  INLINE TextGlyph(int character);
34  INLINE TextGlyph(int character, const Geom *geom,
35  const RenderState *state, PN_stdfloat advance);
36  INLINE TextGlyph(const TextGlyph &copy);
37  INLINE void operator = (const TextGlyph &copy);
38  virtual ~TextGlyph();
39 
40 PUBLISHED:
41  INLINE int get_character() const;
42  INLINE PT(Geom) get_geom(Geom::UsageHint usage_hint) const;
43  INLINE const RenderState *get_state() const;
44  INLINE PN_stdfloat get_advance() const;
45 
46  virtual bool is_whitespace() const;
47 
48 protected:
49  int _character;
50  CPT(Geom) _geom;
51  CPT(RenderState) _state;
52  PN_stdfloat _advance;
53 
54 public:
55  static TypeHandle get_class_type() {
56  return _type_handle;
57  }
58  static void init_type() {
59  TypedReferenceCount::init_type();
60  register_type(_type_handle, "TextGlyph",
61  TypedReferenceCount::get_class_type());
62  }
63  virtual TypeHandle get_type() const {
64  return get_class_type();
65  }
66  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
67 
68 private:
69  static TypeHandle _type_handle;
70 };
71 
72 #include "textGlyph.I"
73 
74 #endif
A base class for things which need to inherit from both TypedObject and from ReferenceCount.
A container for geometry primitives.
Definition: geom.h:58
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
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85