Panda3D
Loading...
Searching...
No Matches
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 */
27class EXPCL_PANDA_TEXT GeomTextGlyph : public Geom {
28public:
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
48private:
49 typedef pvector< CPT(TextGlyph) > Glyphs;
50 Glyphs _glyphs;
51
52public:
53 static void register_with_read_factory();
54 static TypedWritable *make_GeomTextGlyph(const FactoryParams &params);
55
56PUBLISHED:
57 static TypeHandle get_class_type() {
58 return _type_handle;
59 }
60public:
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
71private:
72 static TypeHandle _type_handle;
73};
74
75#include "geomTextGlyph.I"
76
77#endif // GEOMTEXTGLYPH_H
An instance of this class is passed to the Factory when requesting it to do its business and construc...
void add_glyph(const TextGlyph *glyph)
Adds a glyph to the list of glyphs referenced by this Geom.
static TypedWritable * make_GeomTextGlyph(const FactoryParams &params)
Factory method to generate a GeomTextGlyph object.
void count_geom(const Geom *other)
Records the reference count of the other Geom within this Geom, as if the primitives were copied in v...
This defines the actual numeric vertex data stored in a Geom, in the structure defined by a particula...
virtual bool copy_primitives_from(const Geom *other)
Copies the primitives from the indicated Geom into this one.
Definition geom.cxx:954
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:1675
virtual Geom * make_copy() const
Returns a newly-allocated Geom that is a shallow copy of this one.
Definition geom.cxx:100
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
Base class for objects that can be written to and read from Bam files.
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.