changeset 11641:9e6c76d365aa

8137106: EUDC (End User Defined Characters) are not displayed on Windows with Java 8u60+ Reviewed-by: serb, jgodinez
author dbuck
date Thu, 10 Dec 2015 08:00:33 +0000
parents 661cdd57ac8d
children d841d3fdae44
files src/share/classes/sun/font/TrueTypeFont.java src/windows/classes/sun/awt/Win32FontManager.java
diffstat 2 files changed, 26 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/sun/font/TrueTypeFont.java	Wed Dec 09 15:59:20 2015 +0000
+++ b/src/share/classes/sun/font/TrueTypeFont.java	Thu Dec 10 08:00:33 2015 +0000
@@ -171,6 +171,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)
@@ -181,14 +188,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) {
@@ -275,6 +285,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()"
@@ -282,7 +296,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);
@@ -301,9 +316,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();
@@ -487,8 +504,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/src/windows/classes/sun/awt/Win32FontManager.java	Wed Dec 09 15:59:20 2015 +0000
+++ b/src/windows/classes/sun/awt/Win32FontManager.java	Thu Dec 10 08:00:33 2015 +0000
@@ -63,7 +63,7 @@
                              * enumerate (allow direct use) of EUDC fonts.
                              */
                             eudcFont = new TrueTypeFont(eudcFile, null, 0,
-                                                        true);
+                                                        true, false);
                         } catch (FontFormatException e) {
                         }
                     }