< prev index next >

src/java.desktop/share/classes/sun/awt/FontConfiguration.java

Print this page




 954         if (fc != null) {
 955             return fc.newEncoder();
 956         }
 957 
 958         if (!charsetName.startsWith("sun.awt.") && !charsetName.equals("default")) {
 959             fc = Charset.forName(charsetName);
 960         } else {
 961             Class<?> fcc = AccessController.doPrivileged(new PrivilegedAction<Class<?>>() {
 962                     public Class<?> run() {
 963                         try {
 964                             return Class.forName(charsetName, true,
 965                                                  ClassLoader.getSystemClassLoader());
 966                         } catch (ClassNotFoundException e) {
 967                         }
 968                         return null;
 969                     }
 970                 });
 971 
 972             if (fcc != null) {
 973                 try {
 974                     fc = (Charset) fcc.newInstance();
 975                 } catch (Exception e) {
 976                 }
 977             }
 978         }
 979         if (fc == null) {
 980             fc = getDefaultFontCharset(fontName);
 981         }
 982 
 983         if (charsetName.equals("default")){
 984             charsetRegistry.put(fontName, fc);
 985         } else {
 986             charsetRegistry.put(charsetName, fc);
 987         }
 988         return fc.newEncoder();
 989     }
 990 
 991     protected abstract Charset getDefaultFontCharset(
 992             String fontName);
 993 
 994     /* This retrieves the platform font directories (path) calculated




 954         if (fc != null) {
 955             return fc.newEncoder();
 956         }
 957 
 958         if (!charsetName.startsWith("sun.awt.") && !charsetName.equals("default")) {
 959             fc = Charset.forName(charsetName);
 960         } else {
 961             Class<?> fcc = AccessController.doPrivileged(new PrivilegedAction<Class<?>>() {
 962                     public Class<?> run() {
 963                         try {
 964                             return Class.forName(charsetName, true,
 965                                                  ClassLoader.getSystemClassLoader());
 966                         } catch (ClassNotFoundException e) {
 967                         }
 968                         return null;
 969                     }
 970                 });
 971 
 972             if (fcc != null) {
 973                 try {
 974                     fc = (Charset) fcc.getDeclaredConstructor().newInstance();
 975                 } catch (Exception e) {
 976                 }
 977             }
 978         }
 979         if (fc == null) {
 980             fc = getDefaultFontCharset(fontName);
 981         }
 982 
 983         if (charsetName.equals("default")){
 984             charsetRegistry.put(fontName, fc);
 985         } else {
 986             charsetRegistry.put(charsetName, fc);
 987         }
 988         return fc.newEncoder();
 989     }
 990 
 991     protected abstract Charset getDefaultFontCharset(
 992             String fontName);
 993 
 994     /* This retrieves the platform font directories (path) calculated


< prev index next >