jdk/src/share/classes/sun/java2d/SunGraphicsEnvironment.java
changeset 883 c3e81f0acd3d
parent 2 90ce3da70b43
child 887 0aab8d3fa11a
--- a/jdk/src/share/classes/sun/java2d/SunGraphicsEnvironment.java	Thu Jun 05 14:18:37 2008 -0700
+++ b/jdk/src/share/classes/sun/java2d/SunGraphicsEnvironment.java	Thu Jun 12 13:17:33 2008 -0700
@@ -78,6 +78,7 @@
 
     public static boolean isLinux;
     public static boolean isSolaris;
+    public static boolean isOpenSolaris;
     public static boolean isWindows;
     public static boolean noType1Font;
     private static Font defaultFont;
@@ -167,6 +168,23 @@
                     isLinux = true;
                 } else if ("SunOS".equals(osName)) {
                     isSolaris = true;
+                    String version = System.getProperty("os.version", "0.0");
+                    try {
+                        float ver = Float.parseFloat(version);
+                        if (ver > 5.10f) {
+                            File f = new File("/etc/release");
+                            FileInputStream fis = new FileInputStream(f);
+                            InputStreamReader isr
+                                = new InputStreamReader(fis, "ISO-8859-1");
+                            BufferedReader br = new BufferedReader(isr);
+                            String line = br.readLine();
+                            if (line.indexOf("OpenSolaris") >= 0) {
+                                isOpenSolaris = true;
+                            }
+                            fis.close();
+                        }
+                    } catch (Exception e) {
+                    }
                 } else if ("Windows".equals(osName)) {
                     isWindows = true;
                 }
@@ -174,11 +192,7 @@
                 noType1Font = "true".
                     equals(System.getProperty("sun.java2d.noType1Font"));
 
-                if (isOpenJDK()) {
-                    String[] fontInfo = FontManager.getDefaultPlatformFont();
-                    defaultFontName = fontInfo[0];
-                    defaultFontFileName = fontInfo[1];
-                } else {
+                if (!isOpenJDK()) {
                     defaultFontName = lucidaFontName;
                     if (useAbsoluteFontFileNames()) {
                         defaultFontFileName =
@@ -244,6 +258,11 @@
                  * that might be specified.
                  */
                 fontConfig = createFontConfiguration();
+                if (isOpenJDK()) {
+                    String[] fontInfo = FontManager.getDefaultPlatformFont();
+                    defaultFontName = fontInfo[0];
+                    defaultFontFileName = fontInfo[1];
+                }
                 getPlatformFontPathFromFontConfig();
 
                 String extraFontPath = fontConfig.getExtraFontPath();
@@ -1069,7 +1088,7 @@
             String fontFileName =
                 getFileNameFromPlatformName(platformFontName);
             String[] nativeNames = null;
-            if (fontFileName == null) {
+            if (fontFileName == null || fontFileName.equals(platformFontName)){
                 /* No file located, so register using the platform name,
                  * i.e. as a native font.
                  */