1 /*
2 * Copyright (c) 2003, 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
204 return;
205 }
206 /* First, see if native code should be used to create the glyph.
207 * GDI will return the integer metrics, not fractional metrics, which
208 * may be requested for this strike, so we would require here that :
209 * desc.fmHint != INTVAL_FRACTIONALMETRICS_ON
210 * except that the advance returned by GDI is always overwritten by
211 * the JDK rasteriser supplied one (see getGlyphImageFromWindows()).
212 */
213 if (FontUtilities.isWindows && isXPorLater &&
214 !FontUtilities.useJDKScaler &&
215 !GraphicsEnvironment.isHeadless() &&
216 !fileFont.useJavaRasterizer &&
217 (desc.aaHint == INTVAL_TEXT_ANTIALIAS_LCD_HRGB ||
218 desc.aaHint == INTVAL_TEXT_ANTIALIAS_LCD_HBGR) &&
219 (matrix[1] == 0.0 && matrix[2] == 0.0 &&
220 matrix[0] == matrix[3] &&
221 matrix[0] >= 3.0 && matrix[0] <= 100.0) &&
222 !((TrueTypeFont)fileFont).useEmbeddedBitmapsForSize(intPtSize)) {
223 useNatives = true;
224 }
225 else if (fileFont.checkUseNatives() && desc.aaHint==0 && !algoStyle) {
226 /* Check its a simple scale of a pt size in the range
227 * where native bitmaps typically exist (6-36 pts) */
228 if (matrix[1] == 0.0 && matrix[2] == 0.0 &&
229 matrix[0] >= 6.0 && matrix[0] <= 36.0 &&
230 matrix[0] == matrix[3]) {
231 useNatives = true;
232 int numNatives = fileFont.nativeFonts.length;
233 nativeStrikes = new NativeStrike[numNatives];
234 /* Maybe initialise these strikes lazily?. But we
235 * know we need at least one
236 */
237 for (int i=0; i<numNatives; i++) {
238 nativeStrikes[i] =
239 new NativeStrike(fileFont.nativeFonts[i], desc, false);
240 }
241 }
242 }
243 if (FontUtilities.isLogging() && FontUtilities.isWindows) {
244 FontUtilities.getLogger().info
245 ("Strike for " + fileFont + " at size = " + intPtSize +
246 " use natives = " + useNatives +
247 " useJavaRasteriser = " + fileFont.useJavaRasterizer +
248 " AAHint = " + desc.aaHint +
249 " Has Embedded bitmaps = " +
250 ((TrueTypeFont)fileFont).
251 useEmbeddedBitmapsForSize(intPtSize));
252 }
253 this.disposer = new FontStrikeDisposer(fileFont, desc, pScalerContext);
254
255 /* Always get the image and the advance together for smaller sizes
256 * that are likely to be important to rendering performance.
257 * The pixel size of 48.0 can be thought of as
258 * "maximumSizeForGetImageWithAdvance".
259 * This should be no greater than OutlineTextRender.THRESHOLD.
260 */
261 double maxSz = 48.0;
|
1 /*
2 * Copyright (c) 2003, 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
204 return;
205 }
206 /* First, see if native code should be used to create the glyph.
207 * GDI will return the integer metrics, not fractional metrics, which
208 * may be requested for this strike, so we would require here that :
209 * desc.fmHint != INTVAL_FRACTIONALMETRICS_ON
210 * except that the advance returned by GDI is always overwritten by
211 * the JDK rasteriser supplied one (see getGlyphImageFromWindows()).
212 */
213 if (FontUtilities.isWindows && isXPorLater &&
214 !FontUtilities.useJDKScaler &&
215 !GraphicsEnvironment.isHeadless() &&
216 !fileFont.useJavaRasterizer &&
217 (desc.aaHint == INTVAL_TEXT_ANTIALIAS_LCD_HRGB ||
218 desc.aaHint == INTVAL_TEXT_ANTIALIAS_LCD_HBGR) &&
219 (matrix[1] == 0.0 && matrix[2] == 0.0 &&
220 matrix[0] == matrix[3] &&
221 matrix[0] >= 3.0 && matrix[0] <= 100.0) &&
222 !((TrueTypeFont)fileFont).useEmbeddedBitmapsForSize(intPtSize)) {
223 useNatives = true;
224 }
225 if (FontUtilities.isLogging() && FontUtilities.isWindows) {
226 FontUtilities.getLogger().info
227 ("Strike for " + fileFont + " at size = " + intPtSize +
228 " use natives = " + useNatives +
229 " useJavaRasteriser = " + fileFont.useJavaRasterizer +
230 " AAHint = " + desc.aaHint +
231 " Has Embedded bitmaps = " +
232 ((TrueTypeFont)fileFont).
233 useEmbeddedBitmapsForSize(intPtSize));
234 }
235 this.disposer = new FontStrikeDisposer(fileFont, desc, pScalerContext);
236
237 /* Always get the image and the advance together for smaller sizes
238 * that are likely to be important to rendering performance.
239 * The pixel size of 48.0 can be thought of as
240 * "maximumSizeForGetImageWithAdvance".
241 * This should be no greater than OutlineTextRender.THRESHOLD.
242 */
243 double maxSz = 48.0;
|