changeset 6645:e4305995090b

8013514: Improve stability of cmap class Reviewed-by: mschoene, prr, bae
author vadim
date Mon, 13 May 2013 13:24:30 +0400
parents 2cc8437acff9
children 6f7486c48aa3
files src/share/classes/sun/font/FileFont.java src/share/classes/sun/font/StandardGlyphVector.java src/share/classes/sun/font/TrueTypeFont.java
diffstat 3 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/sun/font/FileFont.java	Fri May 10 16:36:06 2013 -0400
+++ b/src/share/classes/sun/font/FileFont.java	Mon May 13 13:24:30 2013 +0400
@@ -170,7 +170,9 @@
                 }
             }
         }
-        scaler.dispose();
+        if (scaler != null) {
+            scaler.dispose();
+        }
         scaler = FontScaler.getNullScaler();
     }
 
--- a/src/share/classes/sun/font/StandardGlyphVector.java	Fri May 10 16:36:06 2013 -0400
+++ b/src/share/classes/sun/font/StandardGlyphVector.java	Mon May 13 13:24:30 2013 +0400
@@ -1740,8 +1740,9 @@
                                                      tx,
                                                      sgv.font.getStyle(),
                                                      aa, fm);
-
-            FontStrike strike = sgv.font2D.getStrike(desc);  // !!! getStrike(desc, false)
+            // Get the strike via the handle. Shouldn't matter
+            // if we've invalidated the font but its an extra precaution.
+            FontStrike strike = sgv.font2D.handle.font2D.getStrike(desc);  // !!! getStrike(desc, false)
 
             return new GlyphStrike(sgv, strike, dx, dy);
         }
--- a/src/share/classes/sun/font/TrueTypeFont.java	Fri May 10 16:36:06 2013 -0400
+++ b/src/share/classes/sun/font/TrueTypeFont.java	Mon May 13 13:24:30 2013 +0400
@@ -1037,6 +1037,9 @@
             if (head_Table != null && head_Table.capacity() >= 18) {
                 ShortBuffer sb = head_Table.asShortBuffer();
                 upem = sb.get(9) & 0xffff;
+                if (upem < 16 || upem > 16384) {
+                    upem = 2048;
+                }
             }
 
             ByteBuffer os2_Table = getTableBuffer(os_2Tag);