Panda3D
geomTextGlyph.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 geomTextGlyph.h
10  * @author drose
11  * @date 2005-03-31
12  */
13 
14 #ifndef GEOMTEXTGLYPH_H
15 #define GEOMTEXTGLYPH_H
16 
17 #include "pandabase.h"
18 #include "geom.h"
19 #include "textGlyph.h"
20 
21 /**
22  * This is a specialization on Geom for containing a primitive intended to
23  * represent a TextGlyph. Its sole purpose is to maintain the geom count on
24  * the glyph, so we can determine the actual usage count on a dynamic glyph
25  * (and thus know when it is safe to recycle the glyph).
26  */
27 class EXPCL_PANDA_TEXT GeomTextGlyph : public Geom {
28 public:
29  GeomTextGlyph(const TextGlyph *glyph, const GeomVertexData *data);
30  GeomTextGlyph(const GeomVertexData *data);
31  GeomTextGlyph(const GeomTextGlyph &copy);
32  GeomTextGlyph(const Geom &copy, const TextGlyph *glyph);
33  void operator = (const GeomTextGlyph &copy);
34  virtual ~GeomTextGlyph();
35  ALLOC_DELETED_CHAIN(GeomTextGlyph);
36 
37  virtual Geom *make_copy() const;
38  virtual bool copy_primitives_from(const Geom *other);
39  void count_geom(const Geom *other);
40 
41  virtual void output(std::ostream &out) const;
42  virtual void write(std::ostream &out, int indent_level = 0) const;
43 
44  void add_glyph(const TextGlyph *glyph);
45 
46  friend class TextAssembler;
47 
48 private:
49  typedef pvector< CPT(TextGlyph) > Glyphs;
50  Glyphs _glyphs;
51 
52 public:
53  static void register_with_read_factory();
54  static TypedWritable *make_GeomTextGlyph(const FactoryParams &params);
55 
56 PUBLISHED:
57  static TypeHandle get_class_type() {
58  return _type_handle;
59  }
60 public:
61  static void init_type() {
62  Geom::init_type();
63  register_type(_type_handle, "GeomTextGlyph",
64  Geom::get_class_type());
65  }
66  virtual TypeHandle get_type() const {
67  return get_class_type();
68  }
69  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
70 
71 private:
72  static TypeHandle _type_handle;
73 };
74 
75 #include "geomTextGlyph.I"
76 
77 #endif // GEOMTEXTGLYPH_H
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Base class for objects that can be written to and read from Bam files.
Definition: typedWritable.h:35
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
Definition: register_type.I:22
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is our own Panda specialization on the default STL vector.
Definition: pvector.h:42
virtual Geom * make_copy() const
Returns a newly-allocated Geom that is a shallow copy of this one.
Definition: geom.cxx:100
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This defines the actual numeric vertex data stored in a Geom, in the structure defined by a particula...
A container for geometry primitives.
Definition: geom.h:54
An instance of this class is passed to the Factory when requesting it to do its business and construc...
Definition: factoryParams.h:36
This class is not normally used directly by user code, but is used by the TextNode to lay out a block...
Definition: textAssembler.h:43
A representation of a single glyph (character) from a font.
Definition: textGlyph.h:28
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
virtual bool copy_primitives_from(const Geom *other)
Copies the primitives from the indicated Geom into this one.
Definition: geom.cxx:941
void operator=(const Geom &copy)
The copy assignment operator is not pipeline-safe.
Definition: geom.cxx:71
static void register_with_read_factory()
Tells the BamReader how to create objects of type Geom.
Definition: geom.cxx:1643
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
This is a specialization on Geom for containing a primitive intended to represent a TextGlyph.
Definition: geomTextGlyph.h:27