Browse Source

improve handling of missing chars

David Rose 24 years ago
parent
commit
a8881ac142

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

@@ -270,7 +270,7 @@ get_glyph(int character, const TextGlyph *&glyph, float &glyph_scale) {
     glyph = dynamic_glyph;
   }
 
-  return (glyph != (DynamicTextGlyph *)NULL);
+  return (glyph_index != 0 && glyph != (DynamicTextGlyph *)NULL);
 }
  
 ////////////////////////////////////////////////////////////////////

+ 3 - 1
panda/src/text/staticTextFont.cxx

@@ -164,14 +164,16 @@ write(ostream &out, int indent_level) const {
 ////////////////////////////////////////////////////////////////////
 bool StaticTextFont::
 get_glyph(int character, const TextGlyph *&glyph, float &glyph_scale) {
+  glyph_scale = 1.0f;
+
   Glyphs::const_iterator gi = _glyphs.find(character);
   if (gi == _glyphs.end()) {
     // No definition for this character.
+    glyph = (TextGlyph *)NULL;
     return false;
   }
 
   glyph = (*gi).second;
-  glyph_scale = 1.0f;
   return true;
 }
 

+ 2 - 1
panda/src/text/textNode.cxx

@@ -460,8 +460,9 @@ assemble_row(const char *&source, Node *dest) {
         }
         text_cat.warning(false)
           << "\n";
+      }
 
-      } else {
+      if (glyph != (TextGlyph *)NULL) {
         PT(Geom) char_geom = glyph->get_geom();
         const AllTransitionsWrapper &trans = glyph->get_trans();