8199789: Emit a warning message when t2k is selected via system property

Reviewed-by: serb, pnarayanan
This commit is contained in:
Phil Race 2018-03-22 14:10:30 -07:00
parent 1597645191
commit db4cc3fdf8
2 changed files with 22 additions and 1 deletions
src/java.desktop/share/classes/sun/font

@ -96,12 +96,23 @@ public abstract class FontScaler implements DisposerRecord {
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

@ -53,6 +53,8 @@ public final class FontUtilities {
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 @@ public final class FontUtilities {
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");