Panda3D
textFont.I
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 textFont.I
10  * @author drose
11  * @date 2002-02-08
12  */
13 
14 /**
15  * Returns true if the font is valid and ready to use, false otherwise.
16  */
17 INLINE bool TextFont::
18 is_valid() const {
19  return _is_valid;
20 }
21 
22 /**
23  * Returns true if the font is valid and ready to use, false otherwise.
24  */
25 INLINE TextFont::
26 operator bool () const {
27  return is_valid();
28 }
29 
30 /**
31  * Returns the number of units high each line of text is.
32  */
33 INLINE PN_stdfloat TextFont::
34 get_line_height() const {
35  return _line_height;
36 }
37 
38 /**
39  * Changes the number of units high each line of text is.
40  */
41 INLINE void TextFont::
42 set_line_height(PN_stdfloat line_height) {
43  _line_height = line_height;
44 }
45 
46 /**
47  * Returns the number of units wide a space is.
48  */
49 INLINE PN_stdfloat TextFont::
50 get_space_advance() const {
51  return _space_advance;
52 }
53 
54 /**
55  * Changes the number of units wide a space is.
56  */
57 INLINE void TextFont::
58 set_space_advance(PN_stdfloat space_advance) {
59  _space_advance = space_advance;
60 }
61 
62 /**
63  * Returns the total margin between the edge of the glyph and the edge of the
64  * cards. This includes _poly_margin and any additional outline.
65  */
66 INLINE PN_stdfloat TextFont::
68  return _total_poly_margin;
69 }
70 
71 /**
72  * Gets the glyph associated with the given character code, as well as an
73  * optional scaling parameter that should be applied to the glyph's geometry
74  * and advance parameters. Returns the glyph on success. On failure, it may
75  * still return a printable glyph, or it may return NULL.
76  */
77 INLINE CPT(TextGlyph) TextFont::
78 get_glyph(int character) {
79  CPT(TextGlyph) glyph;
80  get_glyph(character, glyph);
81  return glyph;
82 }
CPT(TextGlyph) TextFont
Gets the glyph associated with the given character code, as well as an optional scaling parameter tha...
Definition: textFont.I:77
PN_stdfloat get_total_poly_margin() const
Returns the total margin between the edge of the glyph and the edge of the cards.
Definition: textFont.I:67
set_line_height
Changes the number of units high each line of text is.
Definition: textFont.h:69
A representation of a single glyph (character) from a font.
Definition: textGlyph.h:28
set_space_advance
Changes the number of units wide a space is.
Definition: textFont.h:73