Panda3D
 All Classes Functions Variables Enumerations
staticTextFont.h
1 // Filename: staticTextFont.h
2 // Created by: drose (03May01)
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 STATICTEXTFONT_H
16 #define STATICTEXTFONT_H
17 
18 #include "pandabase.h"
19 
20 #include "config_text.h"
21 #include "coordinateSystem.h"
22 #include "textFont.h"
23 #include "textGlyph.h"
24 #include "pandaNode.h"
25 #include "geom.h"
26 #include "geom.h"
27 #include "pointerTo.h"
28 #include "pmap.h"
29 
30 class Node;
31 class GeomPoint;
32 
33 ////////////////////////////////////////////////////////////////////
34 // Class : StaticTextFont
35 // Description : A StaticTextFont is loaded up from a model that was
36 // previously generated via egg-mkfont, and contains all
37 // of its glyphs already generated and available for
38 // use. It doesn't require linking with any external
39 // libraries like FreeType.
40 ////////////////////////////////////////////////////////////////////
41 class EXPCL_PANDA_TEXT StaticTextFont : public TextFont {
42 PUBLISHED:
43  StaticTextFont(PandaNode *font_def, CoordinateSystem cs = CS_default);
44 
45  virtual PT(TextFont) make_copy() const;
46 
47  virtual void write(ostream &out, int indent_level) const;
48 
49 public:
50  virtual bool get_glyph(int character, const TextGlyph *&glyph);
51 
52 private:
53  void find_character_gsets(PandaNode *root, CPT(Geom) &ch, CPT(Geom) &dot,
54  const RenderState *&state,
55  const RenderState *net_state);
56  void find_characters(PandaNode *root,
57  const RenderState *net_state);
58 
60  Glyphs _glyphs;
61  PN_stdfloat _font_height;
62  PT(PandaNode) _font;
63  CoordinateSystem _cs;
64 
65 public:
66  static TypeHandle get_class_type() {
67  return _type_handle;
68  }
69  static void init_type() {
70  TextFont::init_type();
71  register_type(_type_handle, "StaticTextFont",
72  TextFont::get_class_type());
73  }
74  virtual TypeHandle get_type() const {
75  return get_class_type();
76  }
77  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
78 
79 private:
80  static TypeHandle _type_handle;
81 };
82 
83 #include "staticTextFont.I"
84 
85 #endif
A basic node of the scene graph or data graph.
Definition: pandaNode.h:72
This class is used to assign the nodes on the mesh.
Definition: meshNode.h:18
An encapsulation of a font; i.e.
Definition: textFont.h:36
A StaticTextFont is loaded up from a model that was previously generated via egg-mkfont, and contains all of its glyphs already generated and available for use.
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
const TextGlyph * get_glyph(int character)
Gets the glyph associated with the given character code, as well as an optional scaling parameter tha...
Definition: textFont.I:91