[geeks] Java: make it use the good fonts in X

Francois Dion francois.dion at gmail.com
Mon Feb 19 15:54:13 CST 2007


On 2/19/07, Charles Shannon Hendrix <shannon at widomaker.com> wrote:
> On Mon, 19 Feb 2007 03:03:46 -0500 (EST)
> der Mouse <mouse at Rodents.Montreal.QC.CA> wrote:
>
> > > Does anyone know how to make Sun's Java use the good fonts when
> > > running under X and Linux?
> >
> > > I would like Java apps to use sub-pixel fonts rather than the ugly
> > > raster stuff.
> >
> > X font handling can't do anti-aliasing or sub-pixel rendering or
> > anything else but simple bitmaps unless you depend on extensions.
>
> In case you haven't noticed just about *everything* is now a module or
> extension.
>
> You can't use most fonts *AT ALL* without an extension these days.
>
> I don't see what that has to do with Java anyway, since I'm running it on the
> same server with all my other applications.
>
> > Depending on what X server you want to run it against, there may be a
> > way to do this - that I can't comment on.  But you definitely will need
> > to look at extensions if you want sub-pixel font rendering under X.
>
> Ah, you misunderstood.
>
> I have sub-pixel font rendering working perfectly.
>
> The problem is that it isn't happening in Java.

Are you talking about Gnome's sub pixel smoothing? This only affects
Gnome apps. For java apps, you have to call them with:

java -Dawt.useSystemAAFontSettings=lcd

I'm thinking that is what you want since I think you are running on a
Samsung syncmaster 204b. If not, try:

java -Dawt.useSystemAAFontSettings=on

This applies to standard Swing components (like JTextArea, JButton) in
the Metal L&F (aka Java L&F) and native (Windows, GTK) Swing L&Fs. It
should also apply to any custom component or L&F which picks up the
same property.

See:
http://java.sun.com/javase/6/docs/technotes/guides/2d/flags.html

Francois



More information about the geeks mailing list