< prev index next >

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

Print this page




  33 import java.lang.ref.SoftReference;
  34 import java.util.concurrent.ConcurrentHashMap;
  35 import java.security.AccessController;
  36 
  37 import java.security.PrivilegedAction;
  38 import javax.swing.plaf.FontUIResource;
  39 
  40 import sun.util.logging.PlatformLogger;
  41 
  42 /**
  43  * A collection of utility methods.
  44  */
  45 public final class FontUtilities {
  46 
  47     public static boolean isSolaris;
  48 
  49     public static boolean isLinux;
  50 
  51     public static boolean isMacOSX;
  52 


  53     public static boolean useJDKScaler;
  54 
  55     public static boolean useT2K;
  56     // useLegacy is a short-term debugging transition aid.
  57     public static boolean useLegacy;
  58 
  59     public static boolean isWindows;
  60 
  61     public static boolean isOpenJDK;
  62 
  63     static final String LUCIDA_FILE_NAME = "LucidaSansRegular.ttf";
  64 
  65     private static boolean debugFonts = false;
  66     private static PlatformLogger logger = null;
  67     private static boolean logging;
  68 
  69     // This static initializer block figures out the OS constants.
  70     static {
  71 
  72         AccessController.doPrivileged(new PrivilegedAction<Object>() {
  73             @SuppressWarnings("deprecation") // PlatformLogger.setLevel is deprecated.
  74             @Override
  75             public Object run() {
  76                 String osName = System.getProperty("os.name", "unknownOS");
  77                 isSolaris = osName.startsWith("SunOS");
  78 
  79                 isLinux = osName.startsWith("Linux");
  80 
  81                 isMacOSX = osName.contains("OS X"); // TODO: MacOSX


  82 
  83                 /* Support a value of "t2k" as meaning use the JDK internal
  84                  * scaler over the platform scaler whether or not t2k is
  85                  * actually available.
  86                  * This can be considered transitional support for some
  87                  * level of compatibility, as in it avoids the native scaler
  88                  * as before but cannot guarantee rendering equivalence
  89                  * with T2K.
  90                  * It will also use t2k instead of freetype if t2k is
  91                  * available - this is the same as before.
  92                  * The new value of "jdk" means even if t2k is available,
  93                  * the decision as to whether to use that or freetype is
  94                  * not affected by this setting.
  95                  */
  96                 String scalerStr = System.getProperty("sun.java2d.font.scaler");
  97                 if (scalerStr != null) {
  98                     useT2K = "t2k".equals(scalerStr);
  99                     if (useT2K) {
 100                         System.out.println("WARNING: t2k will be removed in JDK 11.");
 101                     }




  33 import java.lang.ref.SoftReference;
  34 import java.util.concurrent.ConcurrentHashMap;
  35 import java.security.AccessController;
  36 
  37 import java.security.PrivilegedAction;
  38 import javax.swing.plaf.FontUIResource;
  39 
  40 import sun.util.logging.PlatformLogger;
  41 
  42 /**
  43  * A collection of utility methods.
  44  */
  45 public final class FontUtilities {
  46 
  47     public static boolean isSolaris;
  48 
  49     public static boolean isLinux;
  50 
  51     public static boolean isMacOSX;
  52 
  53     public static boolean isAIX;
  54 
  55     public static boolean useJDKScaler;
  56 
  57     public static boolean useT2K;
  58     // useLegacy is a short-term debugging transition aid.
  59     public static boolean useLegacy;
  60 
  61     public static boolean isWindows;
  62 
  63     public static boolean isOpenJDK;
  64 
  65     static final String LUCIDA_FILE_NAME = "LucidaSansRegular.ttf";
  66 
  67     private static boolean debugFonts = false;
  68     private static PlatformLogger logger = null;
  69     private static boolean logging;
  70 
  71     // This static initializer block figures out the OS constants.
  72     static {
  73 
  74         AccessController.doPrivileged(new PrivilegedAction<Object>() {
  75             @SuppressWarnings("deprecation") // PlatformLogger.setLevel is deprecated.
  76             @Override
  77             public Object run() {
  78                 String osName = System.getProperty("os.name", "unknownOS");
  79                 isSolaris = osName.startsWith("SunOS");
  80 
  81                 isLinux = osName.startsWith("Linux");
  82 
  83                 isMacOSX = osName.contains("OS X"); // TODO: MacOSX
  84 
  85                 isAIX = osName.startsWith("AIX");
  86 
  87                 /* Support a value of "t2k" as meaning use the JDK internal
  88                  * scaler over the platform scaler whether or not t2k is
  89                  * actually available.
  90                  * This can be considered transitional support for some
  91                  * level of compatibility, as in it avoids the native scaler
  92                  * as before but cannot guarantee rendering equivalence
  93                  * with T2K.
  94                  * It will also use t2k instead of freetype if t2k is
  95                  * available - this is the same as before.
  96                  * The new value of "jdk" means even if t2k is available,
  97                  * the decision as to whether to use that or freetype is
  98                  * not affected by this setting.
  99                  */
 100                 String scalerStr = System.getProperty("sun.java2d.font.scaler");
 101                 if (scalerStr != null) {
 102                     useT2K = "t2k".equals(scalerStr);
 103                     if (useT2K) {
 104                         System.out.println("WARNING: t2k will be removed in JDK 11.");
 105                     }


< prev index next >