From 952999dcaf5ba7639a2c55b725ae18b33cace22a Mon Sep 17 00:00:00 2001 From: prr Date: Thu, 12 Jun 2008 13:17:33 -0700 Subject: 6378099: RFE: Use libfontconfig to create/synthesise a fontconfig.properties Reviewed-by: tdv, igor --- .../classes/sun/java2d/SunGraphicsEnvironment.java | 31 +++++++++++++++++----- 1 file changed, 25 insertions(+), 6 deletions(-) (limited to 'src/share/classes/sun/java2d') diff --git a/src/share/classes/sun/java2d/SunGraphicsEnvironment.java b/src/share/classes/sun/java2d/SunGraphicsEnvironment.java index 63b942bf4..d4f9424ef 100644 --- a/src/share/classes/sun/java2d/SunGraphicsEnvironment.java +++ b/src/share/classes/sun/java2d/SunGraphicsEnvironment.java @@ -78,6 +78,7 @@ public abstract class SunGraphicsEnvironment extends GraphicsEnvironment 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 @@ public abstract class SunGraphicsEnvironment extends GraphicsEnvironment 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 @@ public abstract class SunGraphicsEnvironment extends GraphicsEnvironment 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 @@ public abstract class SunGraphicsEnvironment extends GraphicsEnvironment * 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 @@ public abstract class SunGraphicsEnvironment extends GraphicsEnvironment 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. */ -- cgit v1.2.3