src/share/classes/sun/font/TrueTypeGlyphMapper.java

Print this page




  92             }
  93         } catch(Exception e) {
  94             handleBadCMAP();
  95             return (char) missingGlyph;
  96         }
  97     }
  98 
  99     private void handleBadCMAP() {
 100         if (FontUtilities.isLogging()) {
 101             FontUtilities.getLogger().severe("Null Cmap for " + font +
 102                                       "substituting for this font");
 103         }
 104         SunFontManager.getInstance().deRegisterBadFont(font);
 105         /* The next line is not really a solution, but might
 106          * reduce the exceptions until references to this font2D
 107          * are gone.
 108          */
 109         cmap = CMap.theNullCmap;
 110     }
 111 

 112     private final char remapJAChar(char unicode) {
 113         switch (unicode) {
 114         case REVERSE_SOLIDUS:
 115             return JA_YEN;
 116             /* This is a workaround for bug 4533422.
 117              * Japanese wave dash missing from Solaris JA TrueType fonts.
 118              */
 119         case JA_WAVE_DASH_CHAR:
 120             if (remapJAWaveDash) {
 121                 return JA_FULLWIDTH_TILDE_CHAR;
 122             }

 123         default: return unicode;
 124         }
 125     }

 126     private final int remapJAIntChar(int unicode) {
 127         switch (unicode) {
 128         case REVERSE_SOLIDUS:
 129             return JA_YEN;
 130             /* This is a workaround for bug 4533422.
 131              * Japanese wave dash missing from Solaris JA TrueType fonts.
 132              */
 133         case JA_WAVE_DASH_CHAR:
 134             if (remapJAWaveDash) {
 135                 return JA_FULLWIDTH_TILDE_CHAR;
 136             }

 137         default: return unicode;
 138         }
 139     }
 140 
 141     public int charToGlyph(char unicode) {
 142         if (needsJAremapping) {
 143             unicode = remapJAChar(unicode);
 144         }
 145         int glyph = getGlyphFromCMAP(unicode);
 146         if (font.checkUseNatives() && glyph < font.glyphToCharMap.length) {
 147             font.glyphToCharMap[glyph] = unicode;
 148         }
 149         return glyph;
 150     }
 151 
 152     public int charToGlyph(int unicode) {
 153         if (needsJAremapping) {
 154             unicode = remapJAIntChar(unicode);
 155         }
 156         int glyph = getGlyphFromCMAP(unicode);




  92             }
  93         } catch(Exception e) {
  94             handleBadCMAP();
  95             return (char) missingGlyph;
  96         }
  97     }
  98 
  99     private void handleBadCMAP() {
 100         if (FontUtilities.isLogging()) {
 101             FontUtilities.getLogger().severe("Null Cmap for " + font +
 102                                       "substituting for this font");
 103         }
 104         SunFontManager.getInstance().deRegisterBadFont(font);
 105         /* The next line is not really a solution, but might
 106          * reduce the exceptions until references to this font2D
 107          * are gone.
 108          */
 109         cmap = CMap.theNullCmap;
 110     }
 111 
 112     @SuppressWarnings("fallthrough")
 113     private final char remapJAChar(char unicode) {
 114         switch (unicode) {
 115         case REVERSE_SOLIDUS:
 116             return JA_YEN;
 117             /* This is a workaround for bug 4533422.
 118              * Japanese wave dash missing from Solaris JA TrueType fonts.
 119              */
 120         case JA_WAVE_DASH_CHAR:
 121             if (remapJAWaveDash) {
 122                 return JA_FULLWIDTH_TILDE_CHAR;
 123             }
 124             // Fall through okay?
 125         default: return unicode;
 126         }
 127     }
 128     @SuppressWarnings("fallthrough")
 129     private final int remapJAIntChar(int unicode) {
 130         switch (unicode) {
 131         case REVERSE_SOLIDUS:
 132             return JA_YEN;
 133             /* This is a workaround for bug 4533422.
 134              * Japanese wave dash missing from Solaris JA TrueType fonts.
 135              */
 136         case JA_WAVE_DASH_CHAR:
 137             if (remapJAWaveDash) {
 138                 return JA_FULLWIDTH_TILDE_CHAR;
 139             }
 140             // Fall through okay?
 141         default: return unicode;
 142         }
 143     }
 144 
 145     public int charToGlyph(char unicode) {
 146         if (needsJAremapping) {
 147             unicode = remapJAChar(unicode);
 148         }
 149         int glyph = getGlyphFromCMAP(unicode);
 150         if (font.checkUseNatives() && glyph < font.glyphToCharMap.length) {
 151             font.glyphToCharMap[glyph] = unicode;
 152         }
 153         return glyph;
 154     }
 155 
 156     public int charToGlyph(int unicode) {
 157         if (needsJAremapping) {
 158             unicode = remapJAIntChar(unicode);
 159         }
 160         int glyph = getGlyphFromCMAP(unicode);