changeset 7305:3097457689ba ppc-aix-port-b02 ppc-aix-port-b03

Enable AWT/Swing on AIX This changes provides basic font handling based on Fontconfig and a basic fontconfig.properties configuration for AIX based on the standard Postscripts Type1 fonts. It expects to find libfontconfig.so from the standard shared library path or inside /opt/freeware/lib/libfontconfig.so at runtime and the standard Type1 Postscript fonts under /usr/lib/X11/fonts/Type1. If these prerequisites are fulfilled, the SwingSet2 demo from the standard Oracle JDK demo directory can be executed successfully.
author simonis
date Mon, 29 Oct 2012 21:25:55 +0100
parents 72b9744943c7
children 00221efd3960
files make/sun/awt/Makefile src/solaris/classes/sun/awt/fontconfigs/aix.fontconfig.properties src/solaris/native/sun/awt/fontpath.c
diffstat 3 files changed, 129 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/make/sun/awt/Makefile	Tue Oct 23 09:43:53 2012 +0200
+++ b/make/sun/awt/Makefile	Mon Oct 29 21:25:55 2012 +0100
@@ -446,6 +446,25 @@
 # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ MAC OS X
 endif # PLATFORM
 
+ifeq ($(PLATFORM), aix)
+# vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv AIX
+
+ifdef OPENJDK
+
+FONTCONFIGS_SRC	= $(PLATFORM_SRC)/classes/sun/awt/fontconfigs
+_FONTCONFIGS	= \
+	fontconfig.properties
+else
+
+$(error "Currently we only support the 'OPENJDK' configuration for AIX")
+
+endif
+
+FONTCONFIGS_SRC_PREFIX = $(PLATFORM).
+
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AIX
+endif # PLATFORM
+
 FONTCONFIGS     = $(_FONTCONFIGS:%=$(LIBDIR)/%.src)
 BINARYFONTCONFIGS = $(_FONTCONFIGS:%.properties=$(LIBDIR)/%.bfc)
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/solaris/classes/sun/awt/fontconfigs/aix.fontconfig.properties	Mon Oct 29 21:25:55 2012 +0100
@@ -0,0 +1,75 @@
+#
+#
+# Copyright 2012 SAP AG. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+# Minimal version for AIX using the standard Latin Type1 Fonts.
+
+# Version
+
+version=1
+
+# Component Font Mappings
+
+dialog.plain.latin-1=-*-helvetica-medium-r-normal--*-%d-100-100-p-*-iso10646-1
+dialog.bold.latin-1=-*-helvetica-bold-r-normal--*-%d-100-100-p-*-iso10646-1
+dialog.italic.latin-1=-*-helvetica-medium-o-normal--*-%d-100-100-p-*-iso10646-1
+dialog.bolditalic.latin-1=-*-helvetica-bold-o-normal--*-%d-100-100-p-*-iso10646-1
+
+dialoginput.plain.latin-1=-*-courier-medium-r-normal--*-%d-100-100-m-*-iso10646-1
+dialoginput.bold.latin-1=-*-courier-bold-r-normal--*-%d-100-100-m-*-iso10646-1
+dialoginput.italic.latin-1=-*-courier-medium-o-normal--*-%d-100-100-m-*-iso10646-1
+dialoginput.bolditalic.latin-1=-*-courier-bold-o-normal--*-%d-100-100-m-*-iso10646-1
+
+sansserif.plain.latin-1=-*-helvetica-medium-r-normal--*-%d-100-100-p-*-iso10646-1
+sansserif.bold.latin-1=-*-helvetica-bold-r-normal--*-%d-100-100-p-*-iso10646-1
+sansserif.italic.latin-1=-*-helvetica-medium-o-normal--*-%d-100-100-p-*-iso10646-1
+sansserif.bolditalic.latin-1=-*-helvetica-bold-o-normal--*-%d-100-100-p-*-iso10646-1
+
+serif.plain.latin-1=-*-times new roman-medium-r-normal--*-%d-100-100-p-*-iso10646-1
+serif.bold.latin-1=-*-times new roman-bold-r-normal--*-%d-100-100-p-*-iso10646-1
+serif.italic.latin-1=-*-times new roman-medium-i-normal--*-%d-100-100-p-*-iso10646-1
+serif.bolditalic.latin-1=-*-times new roman-bold-i-normal--*-%d-100-100-p-*-iso10646-1
+
+monospaced.plain.latin-1=-*-courier-medium-r-normal--*-%d-100-100-m-*-iso10646-1
+monospaced.bold.latin-1=-*-courier-bold-r-normal--*-%d-100-100-m-*-iso10646-1
+monospaced.italic.latin-1=-*-courier-medium-o-normal--*-%d-100-100-m-*-iso10646-1
+monospaced.bolditalic.latin-1=-*-courier-bold-o-normal--*-%d-100-100-m-*-iso10646-1
+
+# Search Sequences
+
+sequence.allfonts=latin-1
+
+filename.-*-courier-medium-r-normal--*-%d-100-100-m-*-iso10646-1=/usr/lib/X11/fonts/Type1/cour.pfa
+filename.-*-courier-bold-r-normal--*-%d-100-100-m-*-iso10646-1=/usr/lib/X11/fonts/Type1/courb.pfa
+filename.-*-courier-medium-o-normal--*-%d-100-100-m-*-iso10646-1=/usr/lib/X11/fonts/Type1/couri.pfa
+filename.-*-courier-bold-o-normal--*-%d-100-100-m-*-iso10646-1=/usr/lib/X11/fonts/Type1/courbi.pfa
+filename.-*-helvetica-medium-r-normal--*-%d-100-100-p-*-iso10646-1=/usr/lib/X11/fonts/Type1/helv.pfa
+filename.-*-helvetica-bold-r-normal--*-%d-100-100-p-*-iso10646-1=/usr/lib/X11/fonts/Type1/helvb.pfa
+filename.-*-helvetica-medium-o-normal--*-%d-100-100-p-*-iso10646-1=/usr/lib/X11/fonts/Type1/helvi.pfa
+filename.-*-helvetica-bold-o-normal--*-%d-100-100-p-*-iso10646-1=/usr/lib/X11/fonts/Type1/helvbi.pfa
+filename.-*-times_new_roman-medium-r-normal--*-%d-100-100-p-*-iso10646-1=/usr/lib/X11/fonts/Type1/tnr.pfa
+filename.-*-times_new_roman-bold-r-normal--*-%d-100-100-p-*-iso10646-1=/usr/lib/X11/fonts/Type1/tnrb.pfa
+filename.-*-times_new_roman-medium-i-normal--*-%d-100-100-p-*-iso10646-1=/usr/lib/X11/fonts/Type1/tnri.pfa
+filename.-*-times_new_roman-bold-i-normal--*-%d-100-100-p-*-iso10646-1=/usr/lib/X11/fonts/Type1/tnrbi.pfa
--- a/src/solaris/native/sun/awt/fontpath.c	Tue Oct 23 09:43:53 2012 +0200
+++ b/src/solaris/native/sun/awt/fontpath.c	Mon Oct 29 21:25:55 2012 +0100
@@ -78,7 +78,7 @@
 
 #define MAXFDIRS 512    /* Max number of directories that contain fonts */
 
-#if !defined(__linux__) && !defined(MACOSX)
+#if defined(__solaris__)
 /*
  * This can be set in the makefile to "/usr/X11" if so desired.
  */
@@ -128,7 +128,7 @@
     NULL, /* terminates the list */
 };
 
-#elif MACOSX
+#elif defined(MACOSX)
 static char *full_MACOSX_X11FontPath[] = {
     X11_PATH "/lib/X11/fonts/TrueType",
     X11_PATH "/lib/X11/fonts/truetype",
@@ -144,7 +144,7 @@
     PACKAGE_PATH "/share/fonts/Type1",
     NULL, /* terminates the list */
 };
-#else /* __linux */
+#elif defined( __linux__)
 /* All the known interesting locations we have discovered on
  * various flavors of Linux
  */
@@ -164,6 +164,14 @@
     "/usr/share/fonts/default/Type1",     /* RH 9.0 */
     NULL, /* terminates the list */
 };
+#elif defined(AIX)
+/* Very basic start for AIX -  feel free to complete ..
+ */
+static char *fullAixFontPath[] = {
+    "/usr/lib/X11/fonts/TrueType",  /* */
+    "/usr/lib/X11/fonts/Type1",     /* */
+    NULL, /* terminates the list */
+};
 #endif
 
 static char **getFontConfigLocations();
@@ -524,8 +532,10 @@
     knowndirs = fullLinuxFontPath;
 #elif defined(MACOSX)
     knowndirs = full_MACOSX_X11FontPath;
-#else /* IF SOLARIS */
+#elif defined(__solaris__)
     knowndirs = fullSolarisFontPath;
+#elif defined(AIX)
+    knowndirs = fullAixFontPath;
 #endif
 
     /* REMIND: this code requires to be executed when the GraphicsEnvironment
@@ -622,6 +632,25 @@
         }
     }
 #endif
+
+#if defined(AIX)
+    /* On AIX, fontconfig is not a standard package supported by IBM.
+     * insted it has to be installed from the "AIX Toolbox for Linux Applications" 
+     * site http://www-03.ibm.com/systems/power/software/aix/linux/toolbox/alpha.html
+     * and will be installed under /opt/freeware/lib/libfontconfig.a.
+     * Notice that the archive contains the real 32- and 64-bit shared libraries.
+     * We first try to load 'libfontconfig.so' from the default library path in the 
+     * case the user has installed a private version of the library and if that 
+     * doesn't succeed, we try the version from /opt/freeware/lib/libfontconfig.a
+     */
+    libfontconfig = dlopen("libfontconfig.so", RTLD_LOCAL|RTLD_LAZY);
+    if (libfontconfig == NULL) {
+        libfontconfig = dlopen("/opt/freeware/lib/libfontconfig.a(libfontconfig.so.1)", RTLD_MEMBER|RTLD_LOCAL|RTLD_LAZY);
+        if (libfontconfig == NULL) {
+            return NULL;
+        }
+    }
+#else
     /* 64 bit sparc should pick up the right version from the lib path.
      * New features may be added to libfontconfig, this is expected to
      * be compatible with old features, but we may need to start
@@ -636,6 +665,7 @@
             return NULL;
         }
     }
+#endif
 
     /* Version 1.0 of libfontconfig crashes if HOME isn't defined in
      * the environment. This should generally never happen, but we can't
@@ -1233,7 +1263,7 @@
              */
             if (fontformat != NULL
                 && (strcmp((char*)fontformat, "TrueType") != 0)
-#ifdef __linux__
+#if defined(__linux__) || defined(AIX)
                 && (strcmp((char*)fontformat, "Type 1") != 0)
 #endif
              ) {