|
|
@@ -3,9 +3,10 @@
|
|
|
//
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
+
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::freeze
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description: Freezes the TextNode in its current state, so that
|
|
|
// updates will not immediately be displayed. A series
|
|
|
// of state changes may then be applied in succession,
|
|
|
@@ -36,7 +37,7 @@ freeze() {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::get_freeze_level
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description: Returns the current freeze level. The TextNode will
|
|
|
// not be updated visually unless this number is zero.
|
|
|
// See freeze().
|
|
|
@@ -48,7 +49,7 @@ get_freeze_level() const {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::thaw
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description: Allows changes made since the last freeze() to be
|
|
|
// visible. Strictly speaking, this actually decrements
|
|
|
// the freeze level, and updates the TextNode if the
|
|
|
@@ -74,45 +75,49 @@ thaw() {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::set_font
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description: Sets the font that will be used when making text.
|
|
|
-// This is a model generated via egg-mkfont.
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
INLINE void TextNode::
|
|
|
set_font(Node *font_def) {
|
|
|
- nassertv(font_def != (Node *)NULL);
|
|
|
- _font = font_def;
|
|
|
- _defs.clear();
|
|
|
- _font_height = 1.0;
|
|
|
+ set_font(new TextFont(font_def));
|
|
|
+}
|
|
|
|
|
|
- find_characters(font_def);
|
|
|
+////////////////////////////////////////////////////////////////////
|
|
|
+// Function: TextNode::set_font
|
|
|
+// Access: Published
|
|
|
+// Description: Sets the font that will be used when making text.
|
|
|
+////////////////////////////////////////////////////////////////////
|
|
|
+INLINE void TextNode::
|
|
|
+set_font(TextFont *font) {
|
|
|
+ _font = font;
|
|
|
rebuild(true);
|
|
|
}
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::get_font
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description: Returns the font currently in use.
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
-INLINE Node *TextNode::
|
|
|
+INLINE TextFont *TextNode::
|
|
|
get_font() const {
|
|
|
return _font;
|
|
|
}
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::get_line_height
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description: Returns the number of units high each line of text
|
|
|
// is. This is based on the font.
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
INLINE float TextNode::
|
|
|
get_line_height() const {
|
|
|
- return _font_height;
|
|
|
+ return (_font == (TextFont *)NULL) ? 0.0 : _font->get_line_height();
|
|
|
}
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::set_slant
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description:
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
INLINE void TextNode::
|
|
|
@@ -123,7 +128,7 @@ set_slant(float slant) {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::get_slant
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description:
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
INLINE float TextNode::
|
|
|
@@ -133,7 +138,7 @@ get_slant() const {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::set_align
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description:
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
INLINE void TextNode::
|
|
|
@@ -144,7 +149,7 @@ set_align(int align_type) {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::get_align
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description:
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
INLINE int TextNode::
|
|
|
@@ -154,7 +159,7 @@ get_align() const {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::set_wordwrap
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description: Sets the TextNode up to automatically wordwrap text
|
|
|
// that exceeds the indicated width.
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
@@ -167,7 +172,7 @@ set_wordwrap(float wordwrap) {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::clear_wordwrap
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description: Removes the wordwrap setting from the TextNode. Text
|
|
|
// will be as wide as it is.
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
@@ -179,7 +184,7 @@ clear_wordwrap() {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::has_wordwrap
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description:
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
INLINE bool TextNode::
|
|
|
@@ -189,7 +194,7 @@ has_wordwrap() const {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::get_wordwrap
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description:
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
INLINE float TextNode::
|
|
|
@@ -199,7 +204,7 @@ get_wordwrap() const {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::set_text_color
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description:
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
INLINE void TextNode::
|
|
|
@@ -209,7 +214,7 @@ set_text_color(float r, float g, float b, float a) {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::set_text_color
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description:
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
INLINE void TextNode::
|
|
|
@@ -221,7 +226,7 @@ set_text_color(const Colorf &text_color) {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::clear_text_color
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description: Removes the text color specification; the text will
|
|
|
// be colored whatever it was in the source font file.
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
@@ -232,7 +237,7 @@ clear_text_color() {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::has_text_color
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description:
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
INLINE bool TextNode::
|
|
|
@@ -242,7 +247,7 @@ has_text_color() const {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::get_text_color
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description:
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
INLINE Colorf TextNode::
|
|
|
@@ -252,7 +257,7 @@ get_text_color() const {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::set_frame_color
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description:
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
INLINE void TextNode::
|
|
|
@@ -262,7 +267,7 @@ set_frame_color(float r, float g, float b, float a) {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::set_frame_color
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description:
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
INLINE void TextNode::
|
|
|
@@ -273,7 +278,7 @@ set_frame_color(const Colorf &frame_color) {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::get_frame_color
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description:
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
INLINE Colorf TextNode::
|
|
|
@@ -283,7 +288,7 @@ get_frame_color() const {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::set_card_border
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description:
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
INLINE void TextNode::
|
|
|
@@ -296,7 +301,7 @@ set_card_border(float size, float uv_portion) {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::clear_card_border
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description:
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
INLINE void TextNode::
|
|
|
@@ -307,7 +312,7 @@ clear_card_border() {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::get_card_border_size
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description:
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
INLINE float TextNode::
|
|
|
@@ -317,7 +322,7 @@ get_card_border_size() const {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::get_card_border_uv_portion
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description:
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
INLINE float TextNode::
|
|
|
@@ -327,7 +332,7 @@ get_card_border_uv_portion() const {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::has_card_border
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description:
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
INLINE bool TextNode::
|
|
|
@@ -337,7 +342,7 @@ has_card_border() const {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::set_card_color
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description:
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
INLINE void TextNode::
|
|
|
@@ -347,7 +352,7 @@ set_card_color(float r, float g, float b, float a) {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::set_card_color
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description:
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
INLINE void TextNode::
|
|
|
@@ -358,7 +363,7 @@ set_card_color(const Colorf &card_color) {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::get_card_color
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description:
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
INLINE Colorf TextNode::
|
|
|
@@ -368,7 +373,7 @@ get_card_color() const {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::set_card_texture
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description:
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
INLINE void TextNode::
|
|
|
@@ -380,7 +385,7 @@ set_card_texture(Texture *card_texture) {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::clear_card_texture
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description:
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
INLINE void TextNode::
|
|
|
@@ -392,7 +397,7 @@ clear_card_texture() {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::has_card_texture
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description:
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
INLINE bool TextNode::
|
|
|
@@ -402,7 +407,7 @@ has_card_texture() const {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::get_card_texture
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description:
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
INLINE Texture *TextNode::
|
|
|
@@ -412,7 +417,7 @@ get_card_texture() const {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::set_shadow_color
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description:
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
INLINE void TextNode::
|
|
|
@@ -422,7 +427,7 @@ set_shadow_color(float r, float g, float b, float a) {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::set_shadow_color
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description:
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
INLINE void TextNode::
|
|
|
@@ -433,7 +438,7 @@ set_shadow_color(const Colorf &shadow_color) {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::get_shadow_color
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description:
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
INLINE Colorf TextNode::
|
|
|
@@ -443,7 +448,7 @@ get_shadow_color() const {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::set_frame_as_margin
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description: Specifies that a border will be drawn around the text
|
|
|
// when it is next created. The parameters are the
|
|
|
// amount of additional padding to insert between the
|
|
|
@@ -460,7 +465,7 @@ set_frame_as_margin(float left, float right, float bottom, float top) {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::set_frame_actual
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description: Similar to set_frame_as_margin, except the frame is
|
|
|
// specified in actual coordinate units (relative to
|
|
|
// the text's origin), irrespective of the size of the
|
|
|
@@ -479,7 +484,7 @@ set_frame_actual(float left, float right, float bottom, float top) {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::clear_frame
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description: Specifies that a border will not be drawn around the
|
|
|
// text.
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
@@ -491,7 +496,7 @@ clear_frame() {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::has_frame
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description:
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
INLINE bool TextNode::
|
|
|
@@ -501,7 +506,7 @@ has_frame() const {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::is_frame_as_margin
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description: If this is true, the frame was set via a call to
|
|
|
// set_frame_as_margin(), and the dimension of the frame
|
|
|
// as returned by get_frame_as_set() represent a margin
|
|
|
@@ -518,7 +523,7 @@ is_frame_as_margin() const {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::get_frame_as_set
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description: Returns the dimensions of the frame as set by
|
|
|
// set_frame_as_margin() or set_frame_actual(). Use
|
|
|
// is_frame_actual() to determine how to interpret the
|
|
|
@@ -533,7 +538,7 @@ get_frame_as_set() const {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::get_frame_actual
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description: Returns the actual dimensions of the frame around the
|
|
|
// text. If the frame was set via set_frame_as_margin(),
|
|
|
// the result returned by this function reflects the
|
|
|
@@ -556,7 +561,7 @@ get_frame_actual() const {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::set_frame_line_width
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description: Specifies the thickness of the lines that will be
|
|
|
// used to draw the frame.
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
@@ -567,7 +572,7 @@ set_frame_line_width(float frame_width) {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::get_frame_line_width
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description: Returns the thickness of the lines that will be
|
|
|
// used to draw the frame.
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
@@ -578,7 +583,7 @@ get_frame_line_width() const {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::set_frame_corners
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description: Enables or disables the drawing of corners for the
|
|
|
// frame. These are extra points drawn at each of the
|
|
|
// four corners, to soften the ugly edges generated when
|
|
|
@@ -595,7 +600,7 @@ set_frame_corners(bool corners) {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::get_frame_corners
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description:
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
INLINE bool TextNode::
|
|
|
@@ -605,7 +610,7 @@ get_frame_corners() const {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::set_card_as_margin
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description: Specifies that a (possibly opaque or semitransparent)
|
|
|
// card will be held behind the text when it is next
|
|
|
// created. Like set_frame_as_margin, the parameters are
|
|
|
@@ -623,7 +628,7 @@ set_card_as_margin(float left, float right, float bottom, float top) {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::set_card_actual
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description: Similar to set_card_as_margin, except the card is
|
|
|
// specified in actual coordinate units (relative to
|
|
|
// the text's origin), irrespective of the size of the
|
|
|
@@ -642,7 +647,7 @@ set_card_actual(float left, float right, float bottom, float top) {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::clear_card
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description: Specifies that a card will not be drawn behind the
|
|
|
// text.
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
@@ -654,7 +659,7 @@ clear_card() {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::has_card
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description:
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
INLINE bool TextNode::
|
|
|
@@ -664,7 +669,7 @@ has_card() const {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::is_card_as_margin
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description: If this is true, the card was set via a call to
|
|
|
// set_card_as_margin(), and the dimension of the card
|
|
|
// as returned by get_card_as_set() represent a margin
|
|
|
@@ -681,7 +686,7 @@ is_card_as_margin() const {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::get_card_as_set
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description: Returns the dimensions of the card as set by
|
|
|
// set_card_as_margin() or set_card_actual(). Use
|
|
|
// is_card_actual() to determine how to interpret the
|
|
|
@@ -696,7 +701,7 @@ get_card_as_set() const {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::get_card_actual
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description: Returns the actual dimensions of the card around the
|
|
|
// text. If the card was set via set_card_as_margin(),
|
|
|
// the result returned by this function reflects the
|
|
|
@@ -725,7 +730,7 @@ get_card_actual() const {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::get_card_transformed
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description: Returns the actual card dimensions, transformed by
|
|
|
// the matrix set by set_transform(). This returns the
|
|
|
// card dimensions in actual coordinates as seen by the
|
|
|
@@ -743,7 +748,7 @@ get_card_transformed() const {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::set_shadow
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description: Specifies that the text should be drawn with a
|
|
|
// shadow, by creating a second copy of the text and
|
|
|
// offsetting it slightly behind the first.
|
|
|
@@ -757,7 +762,7 @@ set_shadow(float xoffset, float yoffset) {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::clear_shadow
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description: Specifies that a shadow will not be drawn behind the
|
|
|
// text.
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
@@ -769,7 +774,7 @@ clear_shadow() {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::has_shadow
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description:
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
INLINE bool TextNode::
|
|
|
@@ -779,7 +784,7 @@ has_shadow() const {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::get_shadow
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description: Returns the offset of the shadow as set by
|
|
|
// set_shadow(). It is an error to call this if
|
|
|
// has_shadow() is false.
|
|
|
@@ -792,7 +797,7 @@ get_shadow() const {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::set_bin
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description: Names the GeomBin that the TextNode geometry should
|
|
|
// be assigned to. If this is set, then a
|
|
|
// GeomBinTransition will be created to explicitly place
|
|
|
@@ -811,7 +816,7 @@ set_bin(const string &bin) {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::clear_bin
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description: Removes the effect of a previous call to
|
|
|
// set_bin(). Text will be drawn in whatever bin
|
|
|
// it would like to be drawn in, with no explicit
|
|
|
@@ -824,7 +829,7 @@ clear_bin() {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::has_bin
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description: Returns true if an explicit drawing bin has been
|
|
|
// set via set_bin(), false otherwise.
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
@@ -835,7 +840,7 @@ has_bin() const {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::get_bin
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description: Returns the drawing bin set with set_bin(), or empty
|
|
|
// string if no bin has been set.
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
@@ -846,7 +851,7 @@ get_bin() const {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::set_draw_order
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description: Sets the drawing order of text created by the
|
|
|
// TextMaker. This is actually the draw order of the
|
|
|
// card and frame. The shadow is drawn at
|
|
|
@@ -868,7 +873,7 @@ set_draw_order(int draw_order) {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::get_draw_order
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description: Returns the drawing order set with set_draw_order().
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
INLINE int TextNode::
|
|
|
@@ -878,7 +883,7 @@ get_draw_order() const {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::set_billboard
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description: Sets the flag indicating whether the text should be
|
|
|
// generated as a billboard object or not. If this is
|
|
|
// true, the text will automatically billboard.
|
|
|
@@ -895,7 +900,7 @@ set_billboard(bool billboard) {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::get_billboard
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description:
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
INLINE bool TextNode::
|
|
|
@@ -905,7 +910,7 @@ get_billboard() const {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::set_transform
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description: Sets an additional transform that is applied to the
|
|
|
// entire text paragraph.
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
@@ -917,7 +922,7 @@ set_transform(const LMatrix4f &transform) {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::get_transform
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description:
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
INLINE LMatrix4f TextNode::
|
|
|
@@ -927,7 +932,7 @@ get_transform() const {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::set_coordinate_system
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description: Specifies the coordinate system in which the text
|
|
|
// will be generated.
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
@@ -939,7 +944,7 @@ set_coordinate_system(CoordinateSystem coordinate_system) {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::get_coordinate_system
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description:
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
INLINE CoordinateSystem TextNode::
|
|
|
@@ -949,7 +954,7 @@ get_coordinate_system() const {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::set_text
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description: Changes the text that is displayed under the
|
|
|
// TextNode.
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
@@ -961,7 +966,7 @@ set_text(const string &text) {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::clear_text
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description: Removes the text from the TextNode.
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
INLINE void TextNode::
|
|
|
@@ -972,7 +977,7 @@ clear_text() {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::has_text
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description:
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
INLINE bool TextNode::
|
|
|
@@ -982,7 +987,7 @@ has_text() const {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::get_text
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description:
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
INLINE string TextNode::
|
|
|
@@ -990,9 +995,49 @@ get_text() const {
|
|
|
return _text;
|
|
|
}
|
|
|
|
|
|
+////////////////////////////////////////////////////////////////////
|
|
|
+// Function: TextNode::calc_width
|
|
|
+// Access: Published
|
|
|
+// Description: Returns the width of a single character of the font,
|
|
|
+// or 0.0 if the character is not known.
|
|
|
+////////////////////////////////////////////////////////////////////
|
|
|
+INLINE float TextNode::
|
|
|
+calc_width(char ch) const {
|
|
|
+ nassertr(_font != (TextFont *)NULL, 0.0);
|
|
|
+ return _font->calc_width(ch);
|
|
|
+}
|
|
|
+
|
|
|
+////////////////////////////////////////////////////////////////////
|
|
|
+// Function: TextNode::calc_width
|
|
|
+// Access: Published
|
|
|
+// Description: Returns the width of a line of text of arbitrary
|
|
|
+// characters. The line should not include the newline
|
|
|
+// character.
|
|
|
+////////////////////////////////////////////////////////////////////
|
|
|
+INLINE float TextNode::
|
|
|
+calc_width(const string &line) const {
|
|
|
+ nassertr(_font != (TextFont *)NULL, 0.0);
|
|
|
+ return _font->calc_width(line);
|
|
|
+}
|
|
|
+
|
|
|
+////////////////////////////////////////////////////////////////////
|
|
|
+// Function: TextNode::wordwrap_to
|
|
|
+// Access: Published
|
|
|
+// Description: Inserts newlines into the given text at the
|
|
|
+// appropriate places in order to make each line be the
|
|
|
+// longest possible line that is not longer than
|
|
|
+// wordwrap_width (and does not break any words, if
|
|
|
+// possible). Returns the new string.
|
|
|
+////////////////////////////////////////////////////////////////////
|
|
|
+INLINE string TextNode::
|
|
|
+wordwrap_to(const string &text, float wordwrap_width) const {
|
|
|
+ nassertr(_font != (TextFont *)NULL, text);
|
|
|
+ return _font->wordwrap_to(text, wordwrap_width);
|
|
|
+}
|
|
|
+
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::rebuild
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description: Updates the TextNode, if it is not frozen, or marks
|
|
|
// the TextNode as requiring an update if it is. If the
|
|
|
// text is currently frozen, nothing will be done until
|
|
|
@@ -1020,7 +1065,7 @@ rebuild(bool needs_measure) {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::measure
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description: Measures the extent of the text as it will be placed,
|
|
|
// without actually placing it. Normally, this function
|
|
|
// is called automatically whenever any of the
|
|
|
@@ -1034,7 +1079,7 @@ measure() {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::get_left
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description: Returns the leftmost extent of the text in local 2-d
|
|
|
// coordinates, unmodified by the set_transform()
|
|
|
// matrix.
|
|
|
@@ -1046,7 +1091,7 @@ get_left() const {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::get_right
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description: Returns the rightmost extent of the text in local 2-d
|
|
|
// coordinates, unmodified by the set_transform()
|
|
|
// matrix.
|
|
|
@@ -1058,7 +1103,7 @@ get_right() const {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::get_bottom
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description: Returns the bottommost extent of the text in local
|
|
|
// 2-d coordinates, unmodified by the set_transform()
|
|
|
// matrix.
|
|
|
@@ -1070,7 +1115,7 @@ get_bottom() const {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::get_top
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description: Returns the topmost extent of the text in local 2-d
|
|
|
// coordinates, unmodified by the set_transform()
|
|
|
// matrix.
|
|
|
@@ -1082,7 +1127,7 @@ get_top() const {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::get_height
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description: Returns the net height of the text in local 2-d
|
|
|
// coordinates.
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
@@ -1093,7 +1138,7 @@ get_height() const {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::get_width
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description: Returns the net width of the text in local 2-d
|
|
|
// coordinates.
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
@@ -1104,7 +1149,7 @@ get_width() const {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::get_upper_left_3d
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description: Returns the upper-left extent of the text object,
|
|
|
// after it has been transformed into 3-d space by
|
|
|
// applying the set_transform() matrix.
|
|
|
@@ -1116,7 +1161,7 @@ get_upper_left_3d() const {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::get_lower_right_3d
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description: Returns the lower-right extent of the text object,
|
|
|
// after it has been transformed into 3-d space by
|
|
|
// applying the set_transform() matrix.
|
|
|
@@ -1128,7 +1173,7 @@ get_lower_right_3d() const {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: TextNode::get_num_rows
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description: Returns the number of rows of text that were
|
|
|
// generated. This counts word-wrapped rows as well as
|
|
|
// rows generated due to embedded newlines.
|