1 /*
2 * Copyright (c) 2011, 2017, 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
140 s = System.getProperty("prism.cacheLayoutSize");
141 if (s != null) {
142 try {
143 tempCacheLayoutSize[0] = Integer.parseInt(s);
144 if (tempCacheLayoutSize[0] < 0) {
145 tempCacheLayoutSize[0] = 0;
146 }
147 } catch (NumberFormatException nfe) {
148 System.err.println("Cannot parse cache layout size '"
149 + s + "'");
150 }
151 }
152
153 return debug;
154 }
155 );
156 cacheLayoutSize = tempCacheLayoutSize[0];
157 }
158
159 private static String getJDKFontDir() {
160 try {
161 Class<?> c = Class.forName("sun.font.lookup.JDKFontLookup");
162 Method m = c.getMethod("getJDKFontDir");
163 jreFontDir = (String)m.invoke(c);
164 return jreFontDir;
165 } catch (Throwable t) {
166 if (debugFonts) {
167 System.err.println("Could not get JRE font dir via API");
168 t.printStackTrace();
169 }
170 }
171 return
172 System.getProperty("java.home","") + File.separator +
173 "lib" + File.separator + "fonts" + File.separator;
174 }
175
176 private static String getNativeFactoryName() {
177 if (isWindows) return DW_FACTORY;
178 if (isMacOSX || isIOS) return CT_FACTORY;
179 if (isLinux || isAndroid) return FT_FACTORY;
180 return null;
181 }
182
183 public static float getFontSizeLimit() {
184 return fontSizeLimit;
185 }
186
187 private static PrismFontFactory theFontFactory = null;
188 public static synchronized PrismFontFactory getFontFactory() {
189 if (theFontFactory != null) {
190 return theFontFactory;
191 }
192 String factoryClass = getNativeFactoryName();
193 if (factoryClass == null) {
|
1 /*
2 * Copyright (c) 2011, 2018, 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
140 s = System.getProperty("prism.cacheLayoutSize");
141 if (s != null) {
142 try {
143 tempCacheLayoutSize[0] = Integer.parseInt(s);
144 if (tempCacheLayoutSize[0] < 0) {
145 tempCacheLayoutSize[0] = 0;
146 }
147 } catch (NumberFormatException nfe) {
148 System.err.println("Cannot parse cache layout size '"
149 + s + "'");
150 }
151 }
152
153 return debug;
154 }
155 );
156 cacheLayoutSize = tempCacheLayoutSize[0];
157 }
158
159 private static String getJDKFontDir() {
160 return System.getProperty("java.home","") + File.separator +
161 "lib" + File.separator + "fonts";
162 }
163
164 private static String getNativeFactoryName() {
165 if (isWindows) return DW_FACTORY;
166 if (isMacOSX || isIOS) return CT_FACTORY;
167 if (isLinux || isAndroid) return FT_FACTORY;
168 return null;
169 }
170
171 public static float getFontSizeLimit() {
172 return fontSizeLimit;
173 }
174
175 private static PrismFontFactory theFontFactory = null;
176 public static synchronized PrismFontFactory getFontFactory() {
177 if (theFontFactory != null) {
178 return theFontFactory;
179 }
180 String factoryClass = getNativeFactoryName();
181 if (factoryClass == null) {
|