< prev index next >

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

Print this page




 939         if (fc != null) {
 940             return fc.newEncoder();
 941         }
 942 
 943         if (!charsetName.startsWith("sun.awt.") && !charsetName.equals("default")) {
 944             fc = Charset.forName(charsetName);
 945         } else {
 946             Class<?> fcc = AccessController.doPrivileged(new PrivilegedAction<Class<?>>() {
 947                     public Class<?> run() {
 948                         try {
 949                             return Class.forName(charsetName, true,
 950                                                  ClassLoader.getSystemClassLoader());
 951                         } catch (ClassNotFoundException e) {
 952                         }
 953                         return null;
 954                     }
 955                 });
 956 
 957             if (fcc != null) {
 958                 try {
 959                     fc = (Charset) fcc.newInstance();


 960                 } catch (Exception e) {
 961                 }
 962             }
 963         }
 964         if (fc == null) {
 965             fc = getDefaultFontCharset(fontName);
 966         }
 967 
 968         if (charsetName.equals("default")){
 969             charsetRegistry.put(fontName, fc);
 970         } else {
 971             charsetRegistry.put(charsetName, fc);
 972         }
 973         return fc.newEncoder();
 974     }
 975 
 976     protected abstract Charset getDefaultFontCharset(
 977             String fontName);
 978 
 979     /* This retrieves the platform font directories (path) calculated




 939         if (fc != null) {
 940             return fc.newEncoder();
 941         }
 942 
 943         if (!charsetName.startsWith("sun.awt.") && !charsetName.equals("default")) {
 944             fc = Charset.forName(charsetName);
 945         } else {
 946             Class<?> fcc = AccessController.doPrivileged(new PrivilegedAction<Class<?>>() {
 947                     public Class<?> run() {
 948                         try {
 949                             return Class.forName(charsetName, true,
 950                                                  ClassLoader.getSystemClassLoader());
 951                         } catch (ClassNotFoundException e) {
 952                         }
 953                         return null;
 954                     }
 955                 });
 956 
 957             if (fcc != null) {
 958                 try {
 959                     @SuppressWarnings("deprecation")
 960                     Object tmp = fcc.newInstance();
 961                     fc = (Charset) tmp;
 962                 } catch (Exception e) {
 963                 }
 964             }
 965         }
 966         if (fc == null) {
 967             fc = getDefaultFontCharset(fontName);
 968         }
 969 
 970         if (charsetName.equals("default")){
 971             charsetRegistry.put(fontName, fc);
 972         } else {
 973             charsetRegistry.put(charsetName, fc);
 974         }
 975         return fc.newEncoder();
 976     }
 977 
 978     protected abstract Charset getDefaultFontCharset(
 979             String fontName);
 980 
 981     /* This retrieves the platform font directories (path) calculated


< prev index next >