8199789: Emit a warning message when t2k is selected via system property
Reviewed-by: serb, pnarayanan
--- a/src/java.desktop/share/classes/sun/font/FontScaler.java Thu Mar 22 14:02:20 2018 -0700
+++ b/src/java.desktop/share/classes/sun/font/FontScaler.java Thu Mar 22 14:10:30 2018 -0700
@@ -96,12 +96,23 @@
try {
@SuppressWarnings("unchecked")
Class<? extends FontScaler> tmp = (Class<? extends FontScaler>)
- (!FontUtilities.useT2K ?
+ ((!FontUtilities.useT2K && !FontUtilities.useLegacy) ?
Class.forName("sun.font.FreetypeFontScaler") :
Class.forName("sun.font.T2KFontScaler"));
scalerClass = tmp;
} catch (ClassNotFoundException e) {
+ try {
+ @SuppressWarnings("unchecked")
+ Class<? extends FontScaler> tmp = (Class<? extends FontScaler>)
+ Class.forName("sun.font.FreetypeFontScaler");
+ scalerClass = tmp;
+ } catch (ClassNotFoundException e1) {
scalerClass = NullFontScaler.class;
+ }
+ } finally {
+ if (FontUtilities.debugFonts()) {
+ System.out.println("Scaler class="+scalerClass);
+ }
}
//NB: rewrite using factory? constructor is ugly way
--- a/src/java.desktop/share/classes/sun/font/FontUtilities.java Thu Mar 22 14:02:20 2018 -0700
+++ b/src/java.desktop/share/classes/sun/font/FontUtilities.java Thu Mar 22 14:10:30 2018 -0700
@@ -53,6 +53,8 @@
public static boolean useJDKScaler;
public static boolean useT2K;
+ // useLegacy is a short-term debugging transition aid.
+ public static boolean useLegacy;
public static boolean isWindows;
@@ -94,9 +96,17 @@
String scalerStr = System.getProperty("sun.java2d.font.scaler");
if (scalerStr != null) {
useT2K = "t2k".equals(scalerStr);
+ if (useT2K) {
+ System.out.println("WARNING: t2k will be removed in JDK 11.");
+ }
+ useLegacy = "legacy".equals(scalerStr);
+ if (useLegacy) {
+ System.out.println("WARNING: legacy behavior will be removed in JDK 11.");
+ }
useJDKScaler = useT2K || "jdk".equals(scalerStr);
} else {
useT2K = false;
+ useLegacy = false;
useJDKScaler = false;
}
isWindows = osName.startsWith("Windows");