Panda3D
Loading...
Searching...
No Matches
staticTextFont.h
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file staticTextFont.h
10 * @author drose
11 * @date 2001-05-03
12 */
13
14#ifndef STATICTEXTFONT_H
15#define STATICTEXTFONT_H
16
17#include "pandabase.h"
18
19#include "config_text.h"
20#include "coordinateSystem.h"
21#include "textFont.h"
22#include "textGlyph.h"
23#include "pandaNode.h"
24#include "geom.h"
25#include "geom.h"
26#include "pointerTo.h"
27#include "pmap.h"
28
29class Node;
30class GeomPoint;
31
32/**
33 * A StaticTextFont is loaded up from a model that was previously generated
34 * via egg-mkfont, and contains all of its glyphs already generated and
35 * available for use. It doesn't require linking with any external libraries
36 * like FreeType.
37 */
38class EXPCL_PANDA_TEXT StaticTextFont : public TextFont {
39PUBLISHED:
40 StaticTextFont(PandaNode *font_def, CoordinateSystem cs = CS_default);
41
42 virtual PT(TextFont) make_copy() const;
43
44 virtual void write(std::ostream &out, int indent_level) const;
45
46public:
47 virtual bool get_glyph(int character, CPT(TextGlyph) &glyph);
48
49private:
50 void find_character_gsets(PandaNode *root, CPT(Geom) &ch, CPT(Geom) &dot,
51 const RenderState *&state,
52 const RenderState *net_state);
53 void find_characters(PandaNode *root,
54 const RenderState *net_state);
55
56 typedef pmap<int, PT(TextGlyph)> Glyphs;
57 Glyphs _glyphs;
58 PT(PandaNode) _font;
59 CoordinateSystem _cs;
60
61public:
62 static TypeHandle get_class_type() {
63 return _type_handle;
64 }
65 static void init_type() {
66 TextFont::init_type();
67 register_type(_type_handle, "StaticTextFont",
68 TextFont::get_class_type());
69 }
70 virtual TypeHandle get_type() const {
71 return get_class_type();
72 }
73 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
74
75private:
76 static TypeHandle _type_handle;
77};
78
79#include "staticTextFont.I"
80
81#endif
A container for geometry primitives.
Definition geom.h:54
This class is used to assign the nodes on the mesh.
Definition meshNode.h:16
A basic node of the scene graph or data graph.
Definition pandaNode.h:65
This represents a unique collection of RenderAttrib objects that correspond to a particular renderabl...
Definition renderState.h:47
A StaticTextFont is loaded up from a model that was previously generated via egg-mkfont,...
An encapsulation of a font; i.e.
Definition textFont.h:32
A representation of a single glyph (character) from a font.
Definition textGlyph.h:28
TypeHandle is the identifier used to differentiate C++ class types.
Definition typeHandle.h:81
This is our own Panda specialization on the default STL map.
Definition pmap.h:49
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.