Index: trunk/openjdk/jdk/make/sun/font/FILES_c.gmk
===================================================================
--- trunk/openjdk/jdk/make/sun/font/FILES_c.gmk	(revision 212)
+++ trunk/openjdk/jdk/make/sun/font/FILES_c.gmk	(revision 213)
@@ -115,6 +115,8 @@
 ifeq ($(filter-out windows os2,$(PLATFORM)),)
 FILES_c_platform = fontpath.c
-ifneq ($(PLATFORM), os2)  
+ifeq ($(PLATFORM), os2)  
+FILES_c_platform += fontpath_os2.c
 # no D3D on OS/2
+else
 FILES_cpp_platform = D3DTextRenderer.cpp
 endif
Index: trunk/openjdk/jdk/make/sun/font/Makefile
===================================================================
--- trunk/openjdk/jdk/make/sun/font/Makefile	(revision 212)
+++ trunk/openjdk/jdk/make/sun/font/Makefile	(revision 213)
@@ -171,4 +171,8 @@
 vpath %.cpp   $(SHARE_SRC)/native/$(PKGDIR)
 
+ifeq ($(PLATFORM), os2)  
+vpath %.c   $(PLATFORM_SRC_OS2)/native/$(PKGDIR)
+endif
+
 #
 # Fontmanager is headless (independent of X/Motif)
Index: trunk/openjdk/jdk/src/os2/native/sun/font/fontpath_os2.c
===================================================================
--- trunk/openjdk/jdk/src/os2/native/sun/font/fontpath_os2.c	(revision 213)
+++ trunk/openjdk/jdk/src/os2/native/sun/font/fontpath_os2.c	(revision 213)
@@ -0,0 +1,117 @@
+/*
+ * Copyright 1998-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2010 netlabs.org. OS/2 Parts.
+ *
+ * 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.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+#define OS2EMX_PLAIN_CHAR
+#define INCL_WINSHELLDATA
+#include <os2.h>
+
+#include <malloc.h>
+#include <string.h>
+
+#if defined (__EMX__) && !__BSD_VISIBLE
+char *strnstr(const char *, const char*, int);
+#endif
+
+/*
+ * Finds out all folders containing registered fonts from the OS/2 font palette
+ * and returns them as a semicolon-separated list in the zero-terminated string.
+ * The last item is always followed by a semicolon. The returned string must be
+ * freed with free(). NULL is returned on failure.
+ */
+char *getOs2FontPath()
+{
+    char *list = NULL;
+    int listPos = 0, listSize = 0;
+
+    // take the font files from HINI_USERPROFILE\PM_Fonts
+    ULONG bufSize = 0;
+    BOOL ok = PrfQueryProfileSize(HINI_USERPROFILE, "PM_Fonts", 0, &bufSize);
+    if (!ok)
+        return NULL;
+
+    char *buffer = (char *)malloc(bufSize + 1 /* terminating zero */);
+    if (!buffer)
+        return NULL;
+
+    ULONG bufLen = PrfQueryProfileString(HINI_USERPROFILE, "PM_Fonts", 0, 0,
+                                         buffer, bufSize);
+    if (bufLen) {
+        char *key = buffer;
+        for (; *key; key += strlen(key) + 1) {
+            ULONG keySize = 0;
+            ok = PrfQueryProfileSize(HINI_USERPROFILE, "PM_Fonts", key,
+                                     &keySize);
+            // note: keySize includes terminating zero, to be replaced with ';'
+            if (ok) {
+                keySize += 1; /* terminating zero */
+                if (listSize - listPos < keySize) {
+                    listSize += keySize > 512 ? keySize : 512;
+                    if (list) {
+                        list = (char *)realloc(list, listSize);
+                    } else {
+                        ++listSize; /* terminating zero */
+                        list = (char *)malloc(listSize);
+                    }
+                    if (!list)
+                        break;
+                }
+
+                ULONG keyLen =
+                    PrfQueryProfileString(HINI_USERPROFILE, "PM_Fonts", key, 0,
+                                          list + listPos, listSize - listPos);
+                // note: keyLen includes terminating zero
+                if (keyLen < 1)
+                    continue;
+
+                char *sep = strrchr(list + listPos, '\\');
+                if (!sep)
+                    continue;
+                *sep++ = '\0';
+                strupr(list + listPos);
+
+                if (listPos > 0) {
+                    // avoid duplicates
+                    if (strnstr(list, list + listPos, listPos))
+                        continue;
+                    list[listPos - 1] = ';';
+                }
+
+                listPos = sep - list;
+            }
+            key += strlen(key) + 1;
+        }
+    }
+    free(buffer);
+
+    if (list) {
+        list[listPos - 1] = ';';
+        list[listPos] = '\0';
+    }
+
+    return list;
+}
+
Index: trunk/openjdk/jdk/src/windows/native/sun/font/fontpath.c
===================================================================
--- trunk/openjdk/jdk/src/windows/native/sun/font/fontpath.c	(revision 212)
+++ trunk/openjdk/jdk/src/windows/native/sun/font/fontpath.c	(revision 213)
@@ -37,4 +37,5 @@
 #include <wchar.h>
 #include <minivcrt.h>
+extern char *getOs2FontPath();
 #endif
 
@@ -43,6 +44,20 @@
     char windir[BSIZE];
     char sysdir[BSIZE];
+#ifdef __WIN32OS2__
+    char *fontpath;
+#else
     char fontpath[BSIZE*2];
+#endif
     char *end;
+
+#ifdef __WIN32OS2__
+    /* Find out all folders containing registered fonts in OS/2 to let Java
+     * pick them up */
+    fontpath = getOs2FontPath();
+    fontpath = fontpath ? realloc(fontpath, strlen(fontpath) + BSIZE*2)
+                        : malloc(BSIZE*2);
+    if (!fontpath)
+        return NULL;
+#endif
 
     /* Locate fonts directories relative to the Windows System directory.
@@ -65,5 +80,9 @@
     }
 
+#ifdef __WIN32OS2__
+    strcat(fontpath,sysdir);
+#else
     strcpy(fontpath,sysdir);
+#endif
     if (stricmp(sysdir,windir)) {
         strcat(fontpath,";");
@@ -71,5 +90,10 @@
     }
 
-    return JNU_NewStringPlatform(env, fontpath);
+    jstring ret = JNU_NewStringPlatform(env, fontpath);
+#ifdef __WIN32OS2__
+    free(fontpath);
+#endif
+
+    return ret;
 }
 
