changeset 2641:c801686d91f4

6943487: NPE in makeMultiCharsetString while printing on linux Reviewed-by: igor, jgodinez
author prr
date Tue, 29 Jun 2010 09:48:15 -0700
parents 83c7768292d7
children 4da6837dd085
files src/share/classes/sun/awt/PlatformFont.java src/share/classes/sun/java2d/HeadlessGraphicsEnvironment.java
diffstat 2 files changed, 5 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/sun/awt/PlatformFont.java	Fri Jun 18 11:00:14 2010 -0700
+++ b/src/share/classes/sun/awt/PlatformFont.java	Tue Jun 29 09:48:15 2010 -0700
@@ -25,10 +25,10 @@
 
 package sun.awt;
 
-import java.awt.GraphicsEnvironment;
 import java.awt.peer.FontPeer;
 import java.util.Locale;
 import java.util.Vector;
+import sun.font.SunFontManager;
 import sun.java2d.FontSupport;
 import java.nio.CharBuffer;
 import java.nio.ByteBuffer;
@@ -57,9 +57,9 @@
     protected static String osVersion;
 
     public PlatformFont(String name, int style){
-        GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
-        if (ge instanceof FontSupport) {
-            fontConfig = ((FontSupport)ge).getFontConfiguration();
+        SunFontManager sfm = SunFontManager.getInstance();
+        if (sfm instanceof FontSupport) {
+            fontConfig = ((FontSupport)sfm).getFontConfiguration();
         }
         if (fontConfig == null) {
             return;
--- a/src/share/classes/sun/java2d/HeadlessGraphicsEnvironment.java	Fri Jun 18 11:00:14 2010 -0700
+++ b/src/share/classes/sun/java2d/HeadlessGraphicsEnvironment.java	Tue Jun 29 09:48:15 2010 -0700
@@ -59,17 +59,12 @@
  * Headless decorator implementation of a SunGraphicsEnvironment
  */
 
-public class HeadlessGraphicsEnvironment extends GraphicsEnvironment
-    implements FontSupport {
+public class HeadlessGraphicsEnvironment extends GraphicsEnvironment {
 
     private GraphicsEnvironment ge;
-    private FontSupport fontSupport;
 
     public HeadlessGraphicsEnvironment(GraphicsEnvironment ge) {
         this.ge = ge;
-        if (ge instanceof FontSupport) {
-            fontSupport = (FontSupport)ge;
-        }
     }
 
     public GraphicsDevice[] getScreenDevices()
@@ -101,13 +96,6 @@
     public String[] getAvailableFontFamilyNames(Locale l) {
         return ge.getAvailableFontFamilyNames(l); }
 
-    public FontConfiguration getFontConfiguration() {
-        if (fontSupport != null) {
-            return fontSupport.getFontConfiguration();
-        }
-        return null;
-    }
-
     /* Used by FontManager : internal API */
     public GraphicsEnvironment getSunGraphicsEnvironment() {
         return ge;