OpenJDK / jdk / jdk10
changeset 40143:1f507552de19
7175487: Cannot customize font configuration on Linux
Reviewed-by: bpb
author | prr |
---|---|
date | Mon, 25 Jul 2016 11:03:53 -0700 |
parents | 59833102e41b |
children | daded2f82c2e |
files | jdk/src/java.desktop/share/classes/sun/awt/FontConfiguration.java jdk/src/java.desktop/unix/classes/sun/awt/X11FontManager.java |
diffstat | 2 files changed, 20 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/jdk/src/java.desktop/share/classes/sun/awt/FontConfiguration.java Mon Jul 25 10:36:12 2016 -0700 +++ b/jdk/src/java.desktop/share/classes/sun/awt/FontConfiguration.java Mon Jul 25 11:03:53 2016 -0700 @@ -251,12 +251,24 @@ private File findImpl(String fname) { File f = new File(fname + ".properties"); + if (FontUtilities.debugFonts()) { + logger.info("Looking for text fontconfig file : " + f); + } if (f.canRead()) { + if (FontUtilities.debugFonts()) { + logger.info("Found file : " + f); + } isProperties = true; return f; } f = new File(fname + ".bfc"); + if (FontUtilities.debugFonts()) { + logger.info("Looking for binary fontconfig file : " + f); + } if (f.canRead()) { + if (FontUtilities.debugFonts()) { + logger.info("Found file : " + f); + } isProperties = false; return f; } @@ -305,6 +317,9 @@ if (configFile != null) { return configFile; } + if (FontUtilities.debugFonts()) { + logger.info("Did not find a fontconfig file."); + } return null; }
--- a/jdk/src/java.desktop/unix/classes/sun/awt/X11FontManager.java Mon Jul 25 10:36:12 2016 -0700 +++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11FontManager.java Mon Jul 25 11:03:53 2016 -0700 @@ -742,28 +742,20 @@ protected FontConfiguration createFontConfiguration() { /* The logic here decides whether to use a preconfigured * fontconfig.properties file, or synthesise one using platform APIs. - * On Solaris (as opposed to OpenSolaris) we try to use the + * On Solaris we try to use the * pre-configured ones, but if the files it specifies are missing * we fail-safe to synthesising one. This might happen if Solaris * changes its fonts. - * For OpenSolaris I don't expect us to ever create fontconfig files, - * so it will always synthesise. Note that if we misidentify - * OpenSolaris as Solaris, then the test for the presence of - * Solaris-only font files will correct this. * For Linux we require an exact match of distro and version to - * use the preconfigured file, and also that it points to - * existent fonts. + * use the preconfigured file. * If synthesising fails, we fall back to any preconfigured file * and do the best we can. For the commercial JDK this will be * fine as it includes the Lucida fonts. OpenJDK should not hit * this as the synthesis should always work on its platforms. */ FontConfiguration mFontConfig = new MFontConfiguration(this); - if (FontUtilities.isOpenSolaris || - (FontUtilities.isLinux && - (!mFontConfig.foundOsSpecificFile() || - !mFontConfig.fontFilesArePresent()) || - (FontUtilities.isSolaris && !mFontConfig.fontFilesArePresent()))) { + if ((FontUtilities.isLinux && !mFontConfig.foundOsSpecificFile()) || + (FontUtilities.isSolaris && !mFontConfig.fontFilesArePresent())) { FcFontConfiguration fcFontConfig = new FcFontConfiguration(this); if (fcFontConfig.init()) { @@ -773,6 +765,7 @@ mFontConfig.init(); return mFontConfig; } + public FontConfiguration createFontConfiguration(boolean preferLocaleFonts, boolean preferPropFonts) {