1 /*
2 * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
691 if (FontUtilities.isLinux) {
692 fontConfigDirs.add(jreLibDirName+File.separator+"oblique-fonts");
693 }
694 fontdirs = fontConfigDirs.toArray(new String[0]);
695 }
696
697 // Implements SunGraphicsEnvironment.createFontConfiguration.
698 protected FontConfiguration createFontConfiguration() {
699 /* The logic here decides whether to use a preconfigured
700 * fontconfig.properties file, or synthesise one using platform APIs.
701 * On Solaris we try to use the
702 * pre-configured ones, but if the files it specifies are missing
703 * we fail-safe to synthesising one. This might happen if Solaris
704 * changes its fonts.
705 * For Linux we require an exact match of distro and version to
706 * use the preconfigured file.
707 * If synthesising fails, we fall back to any preconfigured file
708 * and do the best we can.
709 */
710 FontConfiguration mFontConfig = new MFontConfiguration(this);
711 if ((FontUtilities.isLinux && !mFontConfig.foundOsSpecificFile()) ||
712 (FontUtilities.isSolaris && !mFontConfig.fontFilesArePresent())) {
713 FcFontConfiguration fcFontConfig =
714 new FcFontConfiguration(this);
715 if (fcFontConfig.init()) {
716 return fcFontConfig;
717 }
718 }
719 mFontConfig.init();
720 return mFontConfig;
721 }
722
723 public FontConfiguration
724 createFontConfiguration(boolean preferLocaleFonts,
725 boolean preferPropFonts) {
726
727 return new MFontConfiguration(this,
728 preferLocaleFonts, preferPropFonts);
729 }
730
731 protected synchronized String getFontPath(boolean noType1Fonts) {
732 isHeadless(); // make sure GE is inited, as its the X11 lock.
|
1 /*
2 * Copyright (c) 2009, 2020, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
691 if (FontUtilities.isLinux) {
692 fontConfigDirs.add(jreLibDirName+File.separator+"oblique-fonts");
693 }
694 fontdirs = fontConfigDirs.toArray(new String[0]);
695 }
696
697 // Implements SunGraphicsEnvironment.createFontConfiguration.
698 protected FontConfiguration createFontConfiguration() {
699 /* The logic here decides whether to use a preconfigured
700 * fontconfig.properties file, or synthesise one using platform APIs.
701 * On Solaris we try to use the
702 * pre-configured ones, but if the files it specifies are missing
703 * we fail-safe to synthesising one. This might happen if Solaris
704 * changes its fonts.
705 * For Linux we require an exact match of distro and version to
706 * use the preconfigured file.
707 * If synthesising fails, we fall back to any preconfigured file
708 * and do the best we can.
709 */
710 FontConfiguration mFontConfig = new MFontConfiguration(this);
711 if ((FontUtilities.isLinux && !mFontConfig.foundOsSpecificFile())) {
712 FcFontConfiguration fcFontConfig =
713 new FcFontConfiguration(this);
714 if (fcFontConfig.init()) {
715 return fcFontConfig;
716 }
717 }
718 mFontConfig.init();
719 return mFontConfig;
720 }
721
722 public FontConfiguration
723 createFontConfiguration(boolean preferLocaleFonts,
724 boolean preferPropFonts) {
725
726 return new MFontConfiguration(this,
727 preferLocaleFonts, preferPropFonts);
728 }
729
730 protected synchronized String getFontPath(boolean noType1Fonts) {
731 isHeadless(); // make sure GE is inited, as its the X11 lock.
|