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 */
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
56PUBLISHED:
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
FactoryParams
An instance of this class is passed to the Factory when requesting it to do its business and construc...
Definition factoryParams.h:36
GeomTextGlyph::add_glyph
void add_glyph(const TextGlyph *glyph)
Adds a glyph to the list of glyphs referenced by this Geom.
Definition geomTextGlyph.cxx:178
GeomTextGlyph::make_GeomTextGlyph
static TypedWritable * make_GeomTextGlyph(const FactoryParams &params)
Factory method to generate a GeomTextGlyph object.
Definition geomTextGlyph.cxx:194
GeomTextGlyph::count_geom
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...
Definition geomTextGlyph.cxx:131
GeomVertexData
This defines the actual numeric vertex data stored in a Geom, in the structure defined by a particula...
Definition geomVertexData.h:68
Geom::copy_primitives_from
virtual bool copy_primitives_from(const Geom *other)
Copies the primitives from the indicated Geom into this one.
Definition geom.cxx:954
Geom::operator=
void operator=(const Geom &copy)
The copy assignment operator is not pipeline-safe.
Definition geom.cxx:71
Geom::register_with_read_factory
static void register_with_read_factory()
Tells the BamReader how to create objects of type Geom.
Definition geom.cxx:1675
Geom::make_copy
virtual Geom * make_copy() const
Returns a newly-allocated Geom that is a shallow copy of this one.
Definition geom.cxx:100
TextGlyph
A representation of a single glyph (character) from a font.
Definition textGlyph.h:28
TypeHandle
TypeHandle is the identifier used to differentiate C++ class types.
Definition typeHandle.h:81
TypedWritable
Base class for objects that can be written to and read from Bam files.
Definition typedWritable.h:35
geomTextGlyph.I
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
geom.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pandabase.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
register_type
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
textGlyph.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.