Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / October 2005

Tip: Looking for answers? Try searching our database.

java fonts and X

Thread view: 
George Weinberg - 18 Oct 2005 01:36 GMT
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
Roedy Green - 18 Oct 2005 02:19 GMT
>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.
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.

Thomas Weidenfeller - 18 Oct 2005 13:57 GMT
> 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
[quoted text clipped - 3 lines]
> 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
Signature

The comp.lang.java.gui FAQ:
ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq
http://www.uni-giessen.de/faq/archiv/computer-lang.java.gui.faq/

George Weinberg - 18 Oct 2005 18:37 GMT
>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
[quoted text clipped - 4 lines]
>
>   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
[quoted text clipped - 4 lines]
>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
[quoted text clipped - 8 lines]
>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.
>> but your normal X fonts should always be
>> available.
[quoted text clipped - 6 lines]
>
>/Thomas

worth a shot.

Thanks,
    George
Ian Pilcher - 18 Oct 2005 16:58 GMT
> 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
[quoted text clipped - 8 lines]
> 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?

Signature

========================================================================
Ian Pilcher                                        i.pilcher@comcast.net
========================================================================



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.