Panda3D
 All Classes Functions Variables Enumerations
textFont.I
1 // Filename: textFont.I
2 // Created by: drose (08Feb02)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 
16 ////////////////////////////////////////////////////////////////////
17 // Function: TextFont::is_valid
18 // Access: Published
19 // Description: Returns true if the font is valid and ready to use,
20 // false otherwise.
21 ////////////////////////////////////////////////////////////////////
22 INLINE bool TextFont::
23 is_valid() const {
24  return _is_valid;
25 }
26 
27 ////////////////////////////////////////////////////////////////////
28 // Function: TextFont::operator bool
29 // Access: Published
30 // Description: Returns true if the font is valid and ready to use,
31 // false otherwise.
32 ////////////////////////////////////////////////////////////////////
33 INLINE TextFont::
34 operator bool () const {
35  return is_valid();
36 }
37 
38 ////////////////////////////////////////////////////////////////////
39 // Function: TextFont::get_line_height
40 // Access: Published
41 // Description: Returns the number of units high each line of text
42 // is.
43 ////////////////////////////////////////////////////////////////////
44 INLINE PN_stdfloat TextFont::
45 get_line_height() const {
46  return _line_height;
47 }
48 
49 ////////////////////////////////////////////////////////////////////
50 // Function: TextFont::set_line_height
51 // Access: Published
52 // Description: Changes the number of units high each line of text
53 // is.
54 ////////////////////////////////////////////////////////////////////
55 INLINE void TextFont::
56 set_line_height(PN_stdfloat line_height) {
57  _line_height = line_height;
58 }
59 
60 ////////////////////////////////////////////////////////////////////
61 // Function: TextFont::get_space_advance
62 // Access: Published
63 // Description: Returns the number of units wide a space is.
64 ////////////////////////////////////////////////////////////////////
65 INLINE PN_stdfloat TextFont::
67  return _space_advance;
68 }
69 
70 ////////////////////////////////////////////////////////////////////
71 // Function: TextFont::set_space_advance
72 // Access: Published
73 // Description: Changes the number of units wide a space is.
74 ////////////////////////////////////////////////////////////////////
75 INLINE void TextFont::
76 set_space_advance(PN_stdfloat space_advance) {
77  _space_advance = space_advance;
78 }
79 
80 ////////////////////////////////////////////////////////////////////
81 // Function: DynamicTextFont::get_glyph
82 // Access: Public, Virtual
83 // Description: Gets the glyph associated with the given character
84 // code, as well as an optional scaling parameter that
85 // should be applied to the glyph's geometry and advance
86 // parameters. Returns the glyph on success. On failure,
87 // it may still return a printable glyph, or it may
88 // return NULL.
89 ////////////////////////////////////////////////////////////////////
90 INLINE const TextGlyph *TextFont::
91 get_glyph(int character) {
92  const TextGlyph *glyph = NULL;
93  get_glyph(character, glyph);
94  return glyph;
95 }
void set_space_advance(PN_stdfloat space_advance)
Changes the number of units wide a space is.
Definition: textFont.I:76
PN_stdfloat get_space_advance() const
Returns the number of units wide a space is.
Definition: textFont.I:66
A representation of a single glyph (character) from a font.
Definition: textGlyph.h:31
bool is_valid() const
Returns true if the font is valid and ready to use, false otherwise.
Definition: textFont.I:23
void set_line_height(PN_stdfloat line_height)
Changes the number of units high each line of text is.
Definition: textFont.I:56
PN_stdfloat get_line_height() const
Returns the number of units high each line of text is.
Definition: textFont.I:45
const TextGlyph * get_glyph(int character)
Gets the glyph associated with the given character code, as well as an optional scaling parameter tha...
Definition: textFont.I:91