src/java.desktop/share/classes/sun/font/Font2D.java

Print this page




 140                 style = Font.BOLD|Font.ITALIC;
 141                 return;
 142             }
 143         }
 144 
 145         for (int i=0; i < italicNames.length; i++) {
 146             if (fName.indexOf(italicNames[i]) != -1) {
 147                 style = Font.ITALIC;
 148                 return;
 149             }
 150         }
 151 
 152         for (int i=0; i < boldNames.length; i++) {
 153             if (fName.indexOf(boldNames[i]) != -1 ) {
 154                 style = Font.BOLD;
 155                 return;
 156             }
 157         }
 158     }
 159 















 160 
 161     int getRank() {
 162         return fontRank;
 163     }
 164 
 165     void setRank(int rank) {
 166         fontRank = rank;
 167     }
 168 
 169     abstract CharToGlyphMapper getMapper();
 170 
 171 
 172 
 173     /* This isn't very efficient but its infrequently used.
 174      * StandardGlyphVector uses it when the client assigns the glyph codes.
 175      * These may not be valid. This validates them substituting the missing
 176      * glyph elsewhere.
 177      */
 178     protected int getValidatedGlyphCode(int glyphCode) {
 179         if (glyphCode < 0 || glyphCode >= getMapper().getNumGlyphs()) {




 140                 style = Font.BOLD|Font.ITALIC;
 141                 return;
 142             }
 143         }
 144 
 145         for (int i=0; i < italicNames.length; i++) {
 146             if (fName.indexOf(italicNames[i]) != -1) {
 147                 style = Font.ITALIC;
 148                 return;
 149             }
 150         }
 151 
 152         for (int i=0; i < boldNames.length; i++) {
 153             if (fName.indexOf(boldNames[i]) != -1 ) {
 154                 style = Font.BOLD;
 155                 return;
 156             }
 157         }
 158     }
 159 
 160     public static final int FWIDTH_NORMAL = 5;    // OS/2 usWidthClass
 161     public static final int FWEIGHT_NORMAL = 400; // OS/2 usWeightClass
 162     public static final int FWEIGHT_BOLD   = 700; // OS/2 usWeightClass
 163 
 164     public int getWidth() {
 165         return FWIDTH_NORMAL;
 166     }
 167 
 168     public int getWeight() {
 169         if ((style & Font.BOLD) !=0) {
 170             return FWEIGHT_BOLD;
 171         } else {
 172             return FWEIGHT_NORMAL;
 173         }
 174     }
 175 
 176     int getRank() {
 177         return fontRank;
 178     }
 179 
 180     void setRank(int rank) {
 181         fontRank = rank;
 182     }
 183 
 184     abstract CharToGlyphMapper getMapper();
 185 
 186 
 187 
 188     /* This isn't very efficient but its infrequently used.
 189      * StandardGlyphVector uses it when the client assigns the glyph codes.
 190      * These may not be valid. This validates them substituting the missing
 191      * glyph elsewhere.
 192      */
 193     protected int getValidatedGlyphCode(int glyphCode) {
 194         if (glyphCode < 0 || glyphCode >= getMapper().getNumGlyphs()) {