From 56980cf411680ca905c6eaab892df334f1b0e817 Mon Sep 17 00:00:00 2001 From: Phil Race Date: Fri, 1 Apr 2011 20:21:14 -0700 Subject: [PATCH] 7032930: A way to specify MS Mincho to be used in dialoginput on windows JA locale Reviewed-by: igor, jgodinez --- .../classes/sun/awt/FontConfiguration.java | 8 ++ .../classes/sun/font/FontManagerForSGE.java | 7 ++ .../classes/sun/font/SunFontManager.java | 19 +++- .../sun/java2d/SunGraphicsEnvironment.java | 12 +++ .../sun/awt/Win32GraphicsEnvironment.java | 18 ---- .../TestSGEuseAlternateFontforJALocales.java | 99 +++++++++++++++++++ 6 files changed, 142 insertions(+), 21 deletions(-) create mode 100644 jdk/test/sun/java2d/SunGraphicsEnvironment/TestSGEuseAlternateFontforJALocales.java diff --git a/jdk/src/share/classes/sun/awt/FontConfiguration.java b/jdk/src/share/classes/sun/awt/FontConfiguration.java index ba8f6e56a01..231f6a46779 100644 --- a/jdk/src/share/classes/sun/awt/FontConfiguration.java +++ b/jdk/src/share/classes/sun/awt/FontConfiguration.java @@ -82,6 +82,10 @@ public abstract class FontConfiguration { * one to ensure proper static initialisation takes place. */ public FontConfiguration(SunFontManager fm) { + if (FontUtilities.debugFonts()) { + FontUtilities.getLogger() + .info("Creating standard Font Configuration"); + } if (FontUtilities.debugFonts() && logger == null) { logger = PlatformLogger.getLogger("sun.awt.FontConfiguration"); } @@ -111,6 +115,10 @@ public abstract class FontConfiguration { boolean preferLocaleFonts, boolean preferPropFonts) { fontManager = fm; + if (FontUtilities.debugFonts()) { + FontUtilities.getLogger() + .info("Creating alternate Font Configuration"); + } this.preferLocaleFonts = preferLocaleFonts; this.preferPropFonts = preferPropFonts; /* fontConfig should be initialised by default constructor, and diff --git a/jdk/src/share/classes/sun/font/FontManagerForSGE.java b/jdk/src/share/classes/sun/font/FontManagerForSGE.java index 7290a9efa69..b12128463eb 100644 --- a/jdk/src/share/classes/sun/font/FontManagerForSGE.java +++ b/jdk/src/share/classes/sun/font/FontManagerForSGE.java @@ -54,4 +54,11 @@ public interface FontManagerForSGE extends FontManager { public Font[] getAllInstalledFonts(); public String[] getInstalledFontFamilyNames(Locale requestedLocale); + + /* Modifies the behaviour of a subsequent call to preferLocaleFonts() + * to use Mincho instead of Gothic for dialoginput in JA locales + * on windows. Not needed on other platforms. + */ + public void useAlternateFontforJALocales(); + } diff --git a/jdk/src/share/classes/sun/font/SunFontManager.java b/jdk/src/share/classes/sun/font/SunFontManager.java index e9b3bf171d0..a80bcddb0e2 100644 --- a/jdk/src/share/classes/sun/font/SunFontManager.java +++ b/jdk/src/share/classes/sun/font/SunFontManager.java @@ -2874,7 +2874,10 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE { * on windows. Not needed on other platforms. */ public synchronized void useAlternateFontforJALocales() { - + if (FontUtilities.isLogging()) { + FontUtilities.getLogger() + .info("Entered useAlternateFontforJALocales()."); + } if (!FontUtilities.isWindows) { return; } @@ -2897,7 +2900,9 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE { } public synchronized void preferLocaleFonts() { - + if (FontUtilities.isLogging()) { + FontUtilities.getLogger().info("Entered preferLocaleFonts()."); + } /* Test if re-ordering will have any effect */ if (!FontConfiguration.willReorderForStartupLocale()) { return; @@ -2928,7 +2933,10 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE { } public synchronized void preferProportionalFonts() { - + if (FontUtilities.isLogging()) { + FontUtilities.getLogger() + .info("Entered preferProportionalFonts()."); + } /* If no proportional fonts are configured, there's no need * to take any action. */ @@ -3456,6 +3464,11 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE { initCompositeFonts(FontConfiguration fontConfig, ConcurrentHashMap altNameCache) { + if (FontUtilities.isLogging()) { + FontUtilities.getLogger() + .info("Initialising composite fonts"); + } + int numCoreFonts = fontConfig.getNumberCoreFonts(); String[] fcFonts = fontConfig.getPlatformFontNames(); for (int f=0; f