Browse Source

extend public interfaces

David Rose 23 years ago
parent
commit
80d45b4eb2
3 changed files with 27 additions and 3 deletions
  1. 1 1
      panda/src/text/config_text.cxx
  2. 22 1
      panda/src/text/textFont.I
  3. 4 1
      panda/src/text/textFont.h

+ 1 - 1
panda/src/text/config_text.cxx

@@ -36,7 +36,7 @@ ConfigureFn(config_text) {
 const bool text_flatten = config_text.GetBool("text-flatten", true);
 const bool text_update_cleared_glyphs = config_text.GetBool("text-update-cleared-glyphs", false);
 const int text_anisotropic_degree = config_text.GetInt("text-anisotropic-degree", 1);
-const int text_texture_margin = config_text.GetInt("text-texture-margin", 2);
+const int text_texture_margin = config_text.GetInt("text-texture-margin", 3);
 const float text_poly_margin = config_text.GetFloat("text-poly-margin", 1.0f);
 const int text_page_x_size = config_text.GetInt("text-page-x-size", 256);
 const int text_page_y_size = config_text.GetInt("text-page-y-size", 256);

+ 22 - 1
panda/src/text/textFont.I

@@ -39,12 +39,33 @@ get_line_height() const {
   return _line_height;
 }
 
+////////////////////////////////////////////////////////////////////
+//     Function: TextFont::set_line_height
+//       Access: Published
+//  Description: Changes the number of units high each line of text
+//               is.
+////////////////////////////////////////////////////////////////////
+INLINE void TextFont::
+set_line_height(float line_height) {
+  _line_height = line_height;
+}
+
 ////////////////////////////////////////////////////////////////////
 //     Function: TextFont::get_space_advance
-//       Access: Public
+//       Access: Published
 //  Description: Returns the number of units wide a space is.
 ////////////////////////////////////////////////////////////////////
 INLINE float TextFont::
 get_space_advance() const {
   return _space_advance;
 }
+
+////////////////////////////////////////////////////////////////////
+//     Function: TextFont::set_space_advance
+//       Access: Published
+//  Description: Changes the number of units wide a space is.
+////////////////////////////////////////////////////////////////////
+INLINE void TextFont::
+set_space_advance(float space_advance) {
+  _space_advance = space_advance;
+}

+ 4 - 1
panda/src/text/textFont.h

@@ -53,6 +53,10 @@ PUBLISHED:
 
   INLINE bool is_valid() const;
   INLINE float get_line_height() const;
+  INLINE void set_line_height(float line_height);
+
+  INLINE float get_space_advance() const;
+  INLINE void set_space_advance(float space_advance);
 
   float calc_width(int character);
   float calc_width(const string &line);
@@ -66,7 +70,6 @@ public:
   wstring wordwrap_to(const wstring &text, float wordwrap_width,
                      bool preserve_trailing_whitespace);
 
-  INLINE float get_space_advance() const;
   virtual bool get_glyph(int character, const TextGlyph *&glyph,
                          float &glyph_scale)=0;