Changeset 213 for trunk/openjdk/jdk/src


Ignore:
Timestamp:
Dec 18, 2010, 12:41:53 AM (15 years ago)
Author:
dmik
Message:

jdk: Search for font files in directories where registered fonts from the OS/2 font palette reside. This causes JDK to pick up system fonts and eliminates the need to distribute any fonts with it.

Location:
trunk/openjdk/jdk/src
Files:
3 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/openjdk/jdk/src/windows/native/sun/font/fontpath.c

    r200 r213  
    3737#include <wchar.h>
    3838#include <minivcrt.h>
     39extern char *getOs2FontPath();
    3940#endif
    4041
     
    4344    char windir[BSIZE];
    4445    char sysdir[BSIZE];
     46#ifdef __WIN32OS2__
     47    char *fontpath;
     48#else
    4549    char fontpath[BSIZE*2];
     50#endif
    4651    char *end;
     52
     53#ifdef __WIN32OS2__
     54    /* Find out all folders containing registered fonts in OS/2 to let Java
     55     * pick them up */
     56    fontpath = getOs2FontPath();
     57    fontpath = fontpath ? realloc(fontpath, strlen(fontpath) + BSIZE*2)
     58                        : malloc(BSIZE*2);
     59    if (!fontpath)
     60        return NULL;
     61#endif
    4762
    4863    /* Locate fonts directories relative to the Windows System directory.
     
    6580    }
    6681
     82#ifdef __WIN32OS2__
     83    strcat(fontpath,sysdir);
     84#else
    6785    strcpy(fontpath,sysdir);
     86#endif
    6887    if (stricmp(sysdir,windir)) {
    6988        strcat(fontpath,";");
     
    7190    }
    7291
    73     return JNU_NewStringPlatform(env, fontpath);
     92    jstring ret = JNU_NewStringPlatform(env, fontpath);
     93#ifdef __WIN32OS2__
     94    free(fontpath);
     95#endif
     96
     97    return ret;
    7498}
    7599
Note: See TracChangeset for help on using the changeset viewer.