8137106: EUDC (End User Defined Characters) are not displayed on Windows with Java 8u60+
Reviewed-by: serb, jgodinez
--- a/jdk/src/java.desktop/share/classes/sun/font/TrueTypeFont.java Wed Dec 09 13:59:45 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/sun/font/TrueTypeFont.java Wed Dec 09 15:20:39 2015 -0800
@@ -176,6 +176,13 @@
private String localeFamilyName;
private String localeFullName;
+ public TrueTypeFont(String platname, Object nativeNames, int fIndex,
+ boolean javaRasterizer)
+ throws FontFormatException
+ {
+ this(platname, nativeNames, fIndex, javaRasterizer, true);
+ }
+
/**
* - does basic verification of the file
* - reads the header table for this font (within a collection)
@@ -186,14 +193,17 @@
* or fails verification, or there's no usable cmap
*/
public TrueTypeFont(String platname, Object nativeNames, int fIndex,
- boolean javaRasterizer)
+ boolean javaRasterizer, boolean useFilePool)
throws FontFormatException {
super(platname, nativeNames);
useJavaRasterizer = javaRasterizer;
fontRank = Font2D.TTF_RANK;
try {
- verify();
+ verify(useFilePool);
init(fIndex);
+ if (!useFilePool) {
+ close();
+ }
} catch (Throwable t) {
close();
if (t instanceof FontFormatException) {
@@ -280,6 +290,10 @@
}
+ private synchronized FileChannel open() throws FontFormatException {
+ return open(true);
+ }
+
/* This is intended to be called, and the returned value used,
* from within a block synchronized on this font object.
* ie the channel returned may be nulled out at any time by "close()"
@@ -287,7 +301,8 @@
* Deadlock warning: FontManager.addToPool(..) acquires a global lock,
* which means nested locks may be in effect.
*/
- private synchronized FileChannel open() throws FontFormatException {
+ private synchronized FileChannel open(boolean usePool)
+ throws FontFormatException {
if (disposerRecord.channel == null) {
if (FontUtilities.isLogging()) {
FontUtilities.getLogger().info("open TTF: " + platName);
@@ -306,9 +321,11 @@
});
disposerRecord.channel = raf.getChannel();
fileSize = (int)disposerRecord.channel.size();
- FontManager fm = FontManagerFactory.getInstance();
- if (fm instanceof SunFontManager) {
- ((SunFontManager) fm).addToPool(this);
+ if (usePool) {
+ FontManager fm = FontManagerFactory.getInstance();
+ if (fm instanceof SunFontManager) {
+ ((SunFontManager) fm).addToPool(this);
+ }
}
} catch (NullPointerException e) {
close();
@@ -492,8 +509,8 @@
}
}
- private void verify() throws FontFormatException {
- open();
+ private void verify(boolean usePool) throws FontFormatException {
+ open(usePool);
}
/* sizes, in bytes, of TT/TTC header records */
--- a/jdk/src/java.desktop/windows/classes/sun/awt/Win32FontManager.java Wed Dec 09 13:59:45 2015 -0800
+++ b/jdk/src/java.desktop/windows/classes/sun/awt/Win32FontManager.java Wed Dec 09 15:20:39 2015 -0800
@@ -61,7 +61,7 @@
* enumerate (allow direct use) of EUDC fonts.
*/
eudcFont = new TrueTypeFont(eudcFile, null, 0,
- true);
+ true, false);
} catch (FontFormatException e) {
}
}