java fonts and X

G

George Weinberg

I don't know if this is a java problem or an X problem or
a RedHat problem or what but...

when I install new fonts on a RedHat 7.3 system they seem to
automatically be available to java apps. However, this doesn't seem to
work on a RedHat Fedora Core 4 System or RedHat enterprise 4.
Further, on the RedHat E4 system GraphicsEnvironment.getAllFonts()
lists a bunch of fonts I've never heard of before (they don't show up
using xlsfonts, at least not under the same name). I've never fiddled
with any of the fontconfig files, but the impression I get from
the documentation
http://java.sun.com/j2se/1.5.0/docs/guide/intl/fontconfig.html
is that you can use "appendedfontpath" to add fonts that aren't
normally available to X, but your normal X fonts should always be
available.

I think I have a workaround in that if I add fonts to the
[JAVA_HOME]/jre/lib/fonts directory and remake fonts.dir there
things seem to work, but I'd really like to know what's going on.
Anyone jknow why the fonts aren't showing up?

Thanks,
George
 
R

Roedy Green

I think I have a workaround in that if I add fonts to the
[JAVA_HOME]/jre/lib/fonts directory and remake fonts.dir there
things seem to work, but I'd really like to know what's going on.
Anyone jknow why the fonts aren't showing up?

First of all Java is not interested in bit map and vector fonts. By
any chance are the missing fonts of that ilk?

Presumably Java is not interested in fonts without a Unicode mapping.
I don't know how Linux works in that department, but there may be a
way of finding out if they have one, perhaps by trying them out in C
or some code where you can get at the font.
 
T

Thomas Weidenfeller

George said:
when I install new fonts on a RedHat 7.3 system they seem to
automatically be available to java apps. However, this doesn't seem to
work on a RedHat Fedora Core 4 System or RedHat enterprise 4.
Further, on the RedHat E4 system GraphicsEnvironment.getAllFonts()
lists a bunch of fonts I've never heard of before (they don't show up
using xlsfonts, at least not under the same name). I've never fiddled
with any of the fontconfig files,

The fontconfig stuff is primarily responsible for mapping the
standardized logical font names to platform-specific physical fonts.
Since you are looking for missing physical fonts, not logical fonts, the
fontconfig file will be of little help (with the exception of being able
to add directories to the X11 font search path, and the mapping of font
file names).

The way a VM looks up a physical font is implementation defined, and
hard-coded into a particular VM. Sun is not very forthcoming with
information how they do it in their VM (you can of course get a source
license from Sun and look it up, but then you are probably not allowed
to talk about it).

From the rare information it is obvious that the Sun VM searches for
fonts along the X11 font path. You can display your font path with

xset -q

Java doesn't deal with bitmap fonts, so you will only see vector fonts
inside Java. A Java VM is only required to handle TrueType (and since
recently also the similar OpenType) fonts. However, Sun's Unix/Linux VM
do handle more (if I am not mistaken, they also handle F3 and Adobe
Postscript Type 1 fonts). Java also applies some (I don't know the
details) locale specific filtering on the fonts available in the font
path. This is something you might want to check. Do you run the VMs in
the same locale on the different OS versions?

Also, Java checks its own font directory for fonts (which are supposed
to contain the Lucida physical fonts, supposed to be used if people want
to provide a consistent look among platforms).
but the impression I get from
the documentation
http://java.sun.com/j2se/1.5.0/docs/guide/intl/fontconfig.html
is that you can use "appendedfontpath" to add fonts that aren't
normally available to X,

Yes, but why do you want to do that? You could just use xset +fp to make
them available to X and Java.
but your normal X fonts should always be
available.

Only the ones which are provided in a supported format (see above) and
locale.

Of course, there is always the chance of a bug in the VM. You could
check Sun's bug parade.

/Thomas
 
I

Ian Pilcher

George said:
when I install new fonts on a RedHat 7.3 system they seem to
automatically be available to java apps. However, this doesn't seem to
work on a RedHat Fedora Core 4 System or RedHat enterprise 4.
Further, on the RedHat E4 system GraphicsEnvironment.getAllFonts()
lists a bunch of fonts I've never heard of before (they don't show up
using xlsfonts, at least not under the same name). I've never fiddled
with any of the fontconfig files, but the impression I get from
the documentation
http://java.sun.com/j2se/1.5.0/docs/guide/intl/fontconfig.html
is that you can use "appendedfontpath" to add fonts that aren't
normally available to X, but your normal X fonts should always be
available.

Have you read the font-related section of the Fedora Core 4 release
notes?
 
G

George Weinberg

The way a VM looks up a physical font is implementation defined, and
hard-coded into a particular VM. Sun is not very forthcoming with
information how they do it in their VM

Yes. I was hoping that somewhere Sun would say how the font paths are
determined for the more common implementations, but I guess not.
(you can of course get a source
license from Sun and look it up, but then you are probably not allowed
to talk about it).

From the rare information it is obvious that the Sun VM searches for
fonts along the X11 font path. You can display your font path with

xset -q

My font path is unix:/7100, that is, X gets its fonts from the xfs
font server.

I just tried another experiment, running java on a machine that uses
an external computer as the font server, and the only fonts
it could see were things like lucida

It looks like java doesn't get its fonts from xfs, but rather looks
where it expects fonts to be and renders them
itself from the font files.
Java doesn't deal with bitmap fonts, so you will only see vector fonts
inside Java. A Java VM is only required to handle TrueType (and since
recently also the similar OpenType) fonts. However, Sun's Unix/Linux VM
do handle more (if I am not mistaken, they also handle F3 and Adobe
Postscript Type 1 fonts). Java also applies some (I don't know the
details) locale specific filtering on the fonts available in the font
path. This is something you might want to check. Do you run the VMs in
the same locale on the different OS versions?
I think so. looking at System.getProperties the only location
specific info I could find was user.country=US.
The only os specfic stuff I saw was os.name=Linux
and os.version=[the kernal version]
Also, Java checks its own font directory for fonts (which are supposed
to contain the Lucida physical fonts, supposed to be used if people want
to provide a consistent look among platforms).


Yes, but why do you want to do that? You could just use xset +fp to make
them available to X and Java.

I have no idea.
Only the ones which are provided in a supported format (see above) and
locale.

Of course, there is always the chance of a bug in the VM. You could
check Sun's bug parade.

/Thomas

worth a shot.

Thanks,
George
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top