diff --git a/make/mapfiles/libawt/mapfile-mawt-vers b/make/mapfiles/libawt/mapfile-mawt-vers index b8ea1636c88c47ad95c01011f43f352dd8892741..28ad3538d2342fa2e13a9c1c09545f82773f088a 100644 --- a/make/mapfiles/libawt/mapfile-mawt-vers +++ b/make/mapfiles/libawt/mapfile-mawt-vers @@ -242,7 +242,7 @@ SUNWprivate_1.1 { getDefaultConfig; Java_sun_font_FontConfigManager_getFontConfig; Java_sun_font_FontConfigManager_getFontConfigAASettings; - Java_sun_awt_X11FontManager_getFontPathNative; + Java_sun_awt_FcFontManager_getFontPathNative; Java_sun_font_SunFontManager_populateFontFileNameMap; # CDE private entry point diff --git a/make/mapfiles/libawt/mapfile-vers-linux b/make/mapfiles/libawt/mapfile-vers-linux index 922b015c68cf56cc030c07c31f819f918f5d2bf9..5624693fccaeb05fc680cea1b802eb1a941d0041 100644 --- a/make/mapfiles/libawt/mapfile-vers-linux +++ b/make/mapfiles/libawt/mapfile-vers-linux @@ -270,7 +270,7 @@ SUNWprivate_1.1 { getDefaultConfig; Java_sun_font_FontConfigManager_getFontConfig; Java_sun_font_FontConfigManager_getFontConfigAASettings; - Java_sun_awt_X11FontManager_getFontPathNative; + Java_sun_awt_FcFontManager_getFontPathNative; Java_sun_font_SunFontManager_populateFontFileNameMap; # CDE private entry point diff --git a/make/mapfiles/libawt_headless/mapfile-vers b/make/mapfiles/libawt_headless/mapfile-vers index c12d07d80fab00bdd32a4b23e3c108bd54ef8782..44efc298b916bb674171c52c83f4c4675ae1851e 100644 --- a/make/mapfiles/libawt_headless/mapfile-vers +++ b/make/mapfiles/libawt_headless/mapfile-vers @@ -65,7 +65,7 @@ SUNWprivate_1.1 { Java_sun_font_FontConfigManager_getFontConfig; Java_sun_font_FontConfigManager_getFontConfigAASettings; Java_sun_font_FontConfigManager_getFontConfigVersion; - Java_sun_awt_X11FontManager_getFontPathNative; + Java_sun_awt_FcFontManager_getFontPathNative; Java_sun_awt_FontDescriptor_initIDs; Java_sun_awt_PlatformFont_initIDs; diff --git a/make/mapfiles/libawt_xawt/mapfile-vers b/make/mapfiles/libawt_xawt/mapfile-vers index 3ae8af3ddbfbf3ac49494d3128ef99c686a88714..d24a527b03f3057b41073fc773f18f74b19e9843 100644 --- a/make/mapfiles/libawt_xawt/mapfile-vers +++ b/make/mapfiles/libawt_xawt/mapfile-vers @@ -188,7 +188,7 @@ SUNWprivate_1.1 { Java_sun_font_FontConfigManager_getFontConfig; Java_sun_font_FontConfigManager_getFontConfigAASettings; Java_sun_font_FontConfigManager_getFontConfigVersion; - Java_sun_awt_X11FontManager_getFontPathNative; + Java_sun_awt_FcFontManager_getFontPathNative; Java_sun_awt_X11GraphicsEnvironment_initDisplay; Java_sun_awt_X11GraphicsEnvironment_initGLX; Java_sun_awt_X11GraphicsEnvironment_initXRender; diff --git a/src/solaris/classes/sun/awt/FcFontManager.java b/src/solaris/classes/sun/awt/FcFontManager.java new file mode 100644 index 0000000000000000000000000000000000000000..0b3ef6a8fa2385ca3ce273638ba4dc004108e3ad --- /dev/null +++ b/src/solaris/classes/sun/awt/FcFontManager.java @@ -0,0 +1,108 @@ +/* + * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package sun.awt; + +import sun.font.FcFontConfiguration; +import sun.font.FontConfigManager; +import sun.font.SunFontManager; + +/** + * A {@link sun.font.FontManager} that uses fontconfig to find system fonts. + */ +public class FcFontManager extends SunFontManager { + + private FontConfigManager fcManager = null; + + public synchronized FontConfigManager getFontConfigManager() { + + if (fcManager == null) { + fcManager = new FontConfigManager(); + } + + return fcManager; + } + + @Override + protected FontConfiguration createFontConfiguration() { + FcFontConfiguration fcFontConfig = new FcFontConfiguration(this); + if (fcFontConfig.init()) { + return fcFontConfig; + } else { + throw new InternalError("failed to initialize fontconfig"); + } + } + + @Override + public FontConfiguration createFontConfiguration(boolean preferLocaleFonts, + boolean preferPropFonts) { + FcFontConfiguration fcFontConfig = + new FcFontConfiguration(this, preferLocaleFonts, preferPropFonts); + if (fcFontConfig.init()) { + return fcFontConfig; + } else { + throw new InternalError("failed to initialize fontconfig"); + } + } + + @Override + protected String[] getDefaultPlatformFont() { + final String[] info = new String[2]; + getFontConfigManager().initFontConfigFonts(false); + FontConfigManager.FcCompFont[] fontConfigFonts = + getFontConfigManager().getFontConfigFonts(); + for (int i=0; i 0 && + fontConfigFonts[0].firstFont.fontFile != null) { + info[0] = fontConfigFonts[0].firstFont.familyName; + info[1] = fontConfigFonts[0].firstFont.fontFile; + } else { + info[0] = "Dialog"; + info[1] = "/dialog.ttf"; + } + } + return info; + } + + protected native String getFontPathNative(boolean noType1Fonts, + boolean isX11GE); + + protected synchronized String getFontPath(boolean noType1Fonts) { + return getFontPathNative(noType1Fonts, false); + } + +} diff --git a/src/solaris/classes/sun/awt/X11FontManager.java b/src/solaris/classes/sun/awt/X11FontManager.java index b3a91df4905bc1866fbabfd68800b87dd836f34b..0b001b3231c23cca9e61ca8ca38af31a0bccd94c 100644 --- a/src/solaris/classes/sun/awt/X11FontManager.java +++ b/src/solaris/classes/sun/awt/X11FontManager.java @@ -54,7 +54,7 @@ import sun.util.logging.PlatformLogger; /** * The X11 implementation of {@link FontManager}. */ -public final class X11FontManager extends SunFontManager { +public final class X11FontManager extends FcFontManager { // constants identifying XLFD and font ID fields private static final int FOUNDRY_FIELD = 1; @@ -154,8 +154,6 @@ public final class X11FontManager extends SunFontManager { */ private static String[] fontdirs = null; - private FontConfigManager fcManager = null; - public static X11FontManager getInstance() { return (X11FontManager) SunFontManager.getInstance(); } @@ -784,51 +782,9 @@ public final class X11FontManager extends SunFontManager { preferLocaleFonts, preferPropFonts); } - public synchronized native String getFontPathNative(boolean noType1Fonts); - protected synchronized String getFontPath(boolean noType1Fonts) { isHeadless(); // make sure GE is inited, as its the X11 lock. - return getFontPathNative(noType1Fonts); - } - - @Override - protected String[] getDefaultPlatformFont() { - final String[] info = new String[2]; - getFontConfigManager().initFontConfigFonts(false); - FontConfigManager.FcCompFont[] fontConfigFonts = - getFontConfigManager().getFontConfigFonts(); - for (int i=0; i 0 && - fontConfigFonts[0].firstFont.fontFile != null) { - info[0] = fontConfigFonts[0].firstFont.familyName; - info[1] = fontConfigFonts[0].firstFont.fontFile; - } else { - info[0] = "Dialog"; - info[1] = "/dialog.ttf"; - } - } - return info; - } - - public synchronized FontConfigManager getFontConfigManager() { - - if (fcManager == null) { - fcManager = new FontConfigManager(); - } - - return fcManager; + return getFontPathNative(noType1Fonts, true); } @Override diff --git a/src/solaris/classes/sun/font/FcFontConfiguration.java b/src/solaris/classes/sun/font/FcFontConfiguration.java index 34d8b7cbd5417ff39ea6a76157209afe2b40d2e6..ecb813de507c87b0a4ba7132b0c7c734d7fe222c 100644 --- a/src/solaris/classes/sun/font/FcFontConfiguration.java +++ b/src/solaris/classes/sun/font/FcFontConfiguration.java @@ -39,10 +39,10 @@ import java.util.HashMap; import java.util.HashSet; import java.util.Properties; import java.util.Scanner; +import sun.awt.FcFontManager; import sun.awt.FontConfiguration; import sun.awt.FontDescriptor; import sun.awt.SunToolkit; -import sun.awt.X11FontManager; import sun.font.CompositeFontDescriptor; import sun.font.FontManager; import sun.font.FontConfigManager.FontConfigInfo; @@ -92,7 +92,7 @@ public class FcFontConfiguration extends FontConfiguration { setFontConfiguration(); readFcInfo(); - X11FontManager fm = (X11FontManager) fontManager; + FcFontManager fm = (FcFontManager) fontManager; FontConfigManager fcm = fm.getFontConfigManager(); if (fcCompFonts == null) { fcCompFonts = fcm.loadFontConfig(); @@ -194,7 +194,7 @@ public class FcFontConfiguration extends FontConfiguration { @Override public String[] getPlatformFontNames() { HashSet nameSet = new HashSet(); - X11FontManager fm = (X11FontManager) fontManager; + FcFontManager fm = (FcFontManager) fontManager; FontConfigManager fcm = fm.getFontConfigManager(); FcCompFont[] fcCompFonts = fcm.loadFontConfig(); for (int i=0; iNewStringUTF(env, ptr); return ret;