< prev index next >

src/share/native/sun/font/FontInstanceAdapter.cpp

Print this page

        

@@ -134,16 +134,22 @@
     if (mappedChar == 0x200C || mappedChar == 0x200D) {
         return 1;
     }
 
     LEGlyphID id = (LEGlyphID)env->CallIntMethod(font2D, sunFontIDs.f2dCharToGlyphMID, (jint)mappedChar);
+    if ((int)id < 0) {
+        id = 0;
+    }
     return id;
 }
 
 LEGlyphID FontInstanceAdapter::mapCharToGlyph(LEUnicode32 ch) const
 {
     LEGlyphID id = (LEGlyphID)env->CallIntMethod(font2D, sunFontIDs.f2dCharToGlyphMID, ch);
+    if ((int)id < 0) {
+        id = 0;
+    }
     return id;
 }
 
 void FontInstanceAdapter::mapCharsToWideGlyphs(const LEUnicode chars[],
     le_int32 offset, le_int32 count, le_bool reverse,

@@ -187,12 +193,16 @@
 
     if (mappedChar == 0x200C || mappedChar == 0x200D) {
         return 1;
     }
 
-    return (LEGlyphID)env->CallIntMethod(font2D, sunFontIDs.charToGlyphMID,
+    LEGlyphID id = (LEGlyphID)env->CallIntMethod(font2D, sunFontIDs.charToGlyphMID,
                                          mappedChar);
+    if ((int)id < 0) {
+       id = 0;
+    }
+   return id;
 }
 
 void FontInstanceAdapter::getGlyphAdvance(LEGlyphID glyph, LEPoint &advance) const
 {
     getWideGlyphAdvance((le_uint32)glyph, advance);
< prev index next >