fontpath.c revision 6295
b3d0736ce9ff54f95fc06741c7279172f961363fshankar_mbn * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
b3d0736ce9ff54f95fc06741c7279172f961363fshankar_mbn * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
b3d0736ce9ff54f95fc06741c7279172f961363fshankar_mbn * This code is free software; you can redistribute it and/or modify it
b3d0736ce9ff54f95fc06741c7279172f961363fshankar_mbn * under the terms of the GNU General Public License version 2 only, as
b3d0736ce9ff54f95fc06741c7279172f961363fshankar_mbn * published by the Free Software Foundation. Oracle designates this
b3d0736ce9ff54f95fc06741c7279172f961363fshankar_mbn * particular file as subject to the "Classpath" exception as provided
b3d0736ce9ff54f95fc06741c7279172f961363fshankar_mbn * by Oracle in the LICENSE file that accompanied this code.
b3d0736ce9ff54f95fc06741c7279172f961363fshankar_mbn * This code is distributed in the hope that it will be useful, but WITHOUT
b3d0736ce9ff54f95fc06741c7279172f961363fshankar_mbn * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
b3d0736ce9ff54f95fc06741c7279172f961363fshankar_mbn * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
b3d0736ce9ff54f95fc06741c7279172f961363fshankar_mbn * version 2 for more details (a copy is included in the LICENSE file that
b3d0736ce9ff54f95fc06741c7279172f961363fshankar_mbn * accompanied this code).
b3d0736ce9ff54f95fc06741c7279172f961363fshankar_mbn * You should have received a copy of the GNU General Public License version
b3d0736ce9ff54f95fc06741c7279172f961363fshankar_mbn * 2 along with this work; if not, write to the Free Software Foundation,
b3d0736ce9ff54f95fc06741c7279172f961363fshankar_mbn * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
b3d0736ce9ff54f95fc06741c7279172f961363fshankar_mbn * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
b3d0736ce9ff54f95fc06741c7279172f961363fshankar_mbn * or visit www.oracle.com if you need additional information or have any
a585e5e48b946aa1de0f69a97853291aa519b8c7ludo * questions.
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include <fcntl.h>
#include <unistd.h>
#ifdef __solaris__
#include <jni.h>
#include <jni_util.h>
#include <jvm_md.h>
#include <sizecalc.h>
#include <sun_font_FontManager.h>
#ifndef HEADLESS
#include <awt.h>
/* locks ought to be included from awt.h */
#define AWT_LOCK()
#define AWT_UNLOCK()
#ifndef HEADLESS
#ifdef MACOSX
#ifndef OPENWINHOMELIB
static char *fullSolarisFontPath[] = {
static char *full_MACOSX_X11FontPath[] = {
static char *fullLinuxFontPath[] = {
static char **getFontConfigLocations();
int num;
#ifndef HEADLESS
if (! isLocalSet) {
"()Ljava/awt/GraphicsEnvironment;");
return isLocal;
char *onePath;
int origIndex;
int totalDirCount;
char **origFontPath;
char **tempFontPath;
int doNotAppend;
int *appendDirList;
char **newFontPath;
int dirFile;
doNotAppend = 0;
doNotAppend = 0;
tempFontPath++;
if ( doNotAppend == 0 ) {
#ifndef HEADLESS
static char **getX11FontPath ()
pos = 0;
for (i=0; i < nPaths; i++) {
#ifdef __solaris__
pos++;
if (pos == 0) {
return fontdirs;
/* from awt_LoadLibrary.c */
for (i=0; i < len1; i++) {
for (i=0; i < len2; i++) {
found = 0;
for (j=0; j < currLen; j++) {
if (!found) {
for (i=0; i < len3; i++) {
found = 0;
for (j=0; j < currLen; j++) {
if (!found) {
for (i=0; i<numDirs; i++) {
for (i = 0; i<numDirs; i++) {
return fontPath;
* /etc/fonts/local.conf, and to ensure that directory contains a fonts.dir
#if defined(__linux__)
#ifndef HEADLESS
AWT_LOCK();
AWT_UNLOCK();
char **p = fcdirs;
char **p = x11dirs;
return path;
return ret;
#include <dlfcn.h>
#include <link.h>
#include "fontconfig.h"
static void* openFontConfig() {
char *homeEnv;
#ifdef __solaris__
return NULL;
#ifdef __solaris__
return NULL;
return NULL;
return libfontconfig;
typedef void* (FcFiniFuncType)();
(*FcFini)();
FcPattern *p,
const char *object,
FcBool *b);
const char *object,
const char *object,
FcChar8 ** s);
const char *object,
const FcChar8 *s);
FcPattern *p,
FcPattern *p,
const char *object,
FcCharSet **c);
FcPattern *p,
const FcCharSet *b);
const FcCharSet *b);
typedef int (*FcGetVersionFuncType)();
static char **getFontConfigLocations() {
char **fontdirs;
int numdirs = 0;
char **fontPath;
return NULL;
return NULL;
found = 0;
for (i=0;i<numdirs; i++) {
if (!found) {
return fontdirs;
int rgba = 0;
void* libfontconfig;
if (locale) {
if (locale) {
if (matchPattern) {
if (locale) {
return TEXT_AA_OFF;
return TEXT_AA_ON;
switch (rgba) {
void* libfontconfig;
int version = 0;
return version;
int i, arrlen;
void* libfontconfig;
"Lsun/font/FontConfigManager$FontConfigFont;");
"[Lsun/font/FontConfigManager$FontConfigFont;");
int cnt = 0;
for (i=0; i<arrlen; i++) {
unsigned int minGlyphs;
fontCount = 0;
for (j=0; j<nfonts; j++) {
#ifdef __linux__
> minGlyphs) {
if (!includeFallbacks) {
if (includeFallbacks) {
fn=0;
for (j=0;j<nfonts;j++) {
if (fn==0) {
if (includeFallbacks) {
if (locale) {