< prev index next >

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

Print this page
rev 60042 : 8248802: Add log helper methods to FontUtilities.java


  66     protected static Locale startupLocale = null;
  67     protected static Hashtable<String, String> localeMap = null;
  68     private static FontConfiguration fontConfig;
  69     private static PlatformLogger logger;
  70     protected static boolean isProperties = true;
  71 
  72     protected SunFontManager fontManager;
  73     protected boolean preferLocaleFonts;
  74     protected boolean preferPropFonts;
  75 
  76     private File fontConfigFile;
  77     private boolean foundOsSpecificFile;
  78     private boolean inited;
  79     private String javaLib;
  80 
  81     /* A default FontConfiguration must be created before an alternate
  82      * one to ensure proper static initialisation takes place.
  83      */
  84     public FontConfiguration(SunFontManager fm) {
  85         if (FontUtilities.debugFonts()) {
  86             FontUtilities.getLogger()
  87                 .info("Creating standard Font Configuration");
  88         }
  89         if (FontUtilities.debugFonts() && logger == null) {
  90             logger = PlatformLogger.getLogger("sun.awt.FontConfiguration");
  91         }
  92         fontManager = fm;
  93         setOsNameAndVersion();  /* static initialization */
  94         setEncoding();          /* static initialization */
  95         /* Separating out the file location from the rest of the
  96          * initialisation, so the caller has the option of doing
  97          * something else if a suitable file isn't found.
  98          */
  99         findFontConfigFile();
 100     }
 101 
 102     public synchronized boolean init() {
 103         if (!inited) {
 104             this.preferLocaleFonts = false;
 105             this.preferPropFonts = false;
 106             setFontConfiguration();
 107             readFontConfigFile(fontConfigFile);
 108             initFontConfig();
 109             inited = true;
 110         }
 111         return true;
 112     }
 113 
 114     public FontConfiguration(SunFontManager fm,
 115                              boolean preferLocaleFonts,
 116                              boolean preferPropFonts) {
 117         fontManager = fm;
 118         if (FontUtilities.debugFonts()) {
 119             FontUtilities.getLogger()
 120                 .info("Creating alternate Font Configuration");
 121         }
 122         this.preferLocaleFonts = preferLocaleFonts;
 123         this.preferPropFonts = preferPropFonts;
 124         /* fontConfig should be initialised by default constructor, and
 125          * its data tables can be shared, since readFontConfigFile doesn't
 126          * update any other state. Also avoid a doPrivileged block.
 127          */
 128         initFontConfig();
 129     }
 130 
 131     /**
 132      * Fills in this instance's osVersion and osName members. By
 133      * default uses the system properties os.name and os.version;
 134      * subclasses may override.
 135      */
 136     protected void setOsNameAndVersion() {
 137         osName = System.getProperty("os.name");
 138         osVersion = System.getProperty("os.version");
 139     }
 140 




  66     protected static Locale startupLocale = null;
  67     protected static Hashtable<String, String> localeMap = null;
  68     private static FontConfiguration fontConfig;
  69     private static PlatformLogger logger;
  70     protected static boolean isProperties = true;
  71 
  72     protected SunFontManager fontManager;
  73     protected boolean preferLocaleFonts;
  74     protected boolean preferPropFonts;
  75 
  76     private File fontConfigFile;
  77     private boolean foundOsSpecificFile;
  78     private boolean inited;
  79     private String javaLib;
  80 
  81     /* A default FontConfiguration must be created before an alternate
  82      * one to ensure proper static initialisation takes place.
  83      */
  84     public FontConfiguration(SunFontManager fm) {
  85         if (FontUtilities.debugFonts()) {
  86             FontUtilities.logInfo("Creating standard Font Configuration");

  87         }
  88         if (FontUtilities.debugFonts() && logger == null) {
  89             logger = PlatformLogger.getLogger("sun.awt.FontConfiguration");
  90         }
  91         fontManager = fm;
  92         setOsNameAndVersion();  /* static initialization */
  93         setEncoding();          /* static initialization */
  94         /* Separating out the file location from the rest of the
  95          * initialisation, so the caller has the option of doing
  96          * something else if a suitable file isn't found.
  97          */
  98         findFontConfigFile();
  99     }
 100 
 101     public synchronized boolean init() {
 102         if (!inited) {
 103             this.preferLocaleFonts = false;
 104             this.preferPropFonts = false;
 105             setFontConfiguration();
 106             readFontConfigFile(fontConfigFile);
 107             initFontConfig();
 108             inited = true;
 109         }
 110         return true;
 111     }
 112 
 113     public FontConfiguration(SunFontManager fm,
 114                              boolean preferLocaleFonts,
 115                              boolean preferPropFonts) {
 116         fontManager = fm;
 117         if (FontUtilities.debugFonts()) {
 118             FontUtilities.logInfo("Creating alternate Font Configuration");

 119         }
 120         this.preferLocaleFonts = preferLocaleFonts;
 121         this.preferPropFonts = preferPropFonts;
 122         /* fontConfig should be initialised by default constructor, and
 123          * its data tables can be shared, since readFontConfigFile doesn't
 124          * update any other state. Also avoid a doPrivileged block.
 125          */
 126         initFontConfig();
 127     }
 128 
 129     /**
 130      * Fills in this instance's osVersion and osName members. By
 131      * default uses the system properties os.name and os.version;
 132      * subclasses may override.
 133      */
 134     protected void setOsNameAndVersion() {
 135         osName = System.getProperty("os.name");
 136         osVersion = System.getProperty("os.version");
 137     }
 138 


< prev index next >