Ugly fonts in main console window (and a few other places)

Hi,

I’m running Vassal 3.2.8 under Arch Linux, with OpenJDK.

java version “1.7.0_40”
OpenJDK Runtime Environment (IcedTea 2.4.2) (ArchLinux build 7.u40_2.4.2-1-x86_64)
OpenJDK 64-Bit Server VM (build 24.0-b56, mixed mode)

My _JAVA_OPTIONS are:
“-Dawt.useSystemAAFontSettings=lcd -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel”

This all works, and gives me nice antialiased text in all applications.

The odd case I have with VASSAL is that just the console window, where I type chat comments and where move actions are logged, has horrible, jagged-edged fonts. This is also the case for the Startup Wizard when I first open a module. The windows and menus themselves all have nicely antialiased and hinted fonts. Modules (tested mainly with Arkham Horror) also seem to show antialiased fonts for text that they display in the main window. I’ve tested this in Arkham Horror and At the Gates of Loyang.

I’ve tested VASSAL on a Windows system here, and it works fine there. All other fonts seem to work as well on my Linux machine, except for these one or two places.

I’ve had a little dig around the source code, but it would take me quite a while to work out what is doing what where. Does anyone have any ideas? I’ve reproduced a screenshot demonstrating the problem:

One thought at the moment is that it’s just a particular font being used there that either isn’t installed, or that is somehow very ugly due to my font settings. I can’t quite work out the specifics, though.

(Just replying to my own question.)

It does seem related to font hinting, and the inability to control it in Java Swing applications under OpenJDK.

I didn’t realise, though, that each module had its own preferences for fonts. Playing around, I’ve found that one or two of the fonts on my system don’t look too bad if I set them to the right size, and so have selected one of those.

It’s still a little dissatisfying as it doesn’t match the fonts on the rest of my system, but it’s much better than the screenshot I posted above.

If anyone does know about changing this, or has run into the same problem or potential solutions, I’d love to hear them.

Thus spake tealeaf:

(Just replying to my own question.)

It does seem related to font hinting, and the inability to control it in
Java Swing applications under OpenJDK.

I didn’t realise, though, that each module had its own preferences for
fonts. Playing around, I’ve found that one or two of the fonts on my
system don’t look too bad if I set them to the right size, and so have
selected one of those.

It’s still a little dissatisfying as it doesn’t match the fonts on the
rest of my system, but it’s much better than the screenshot I posted
above.

If anyone does know about changing this, or has run into the same
problem or potential solutions, I’d love to hear them.

I’ve noticed this as well, but have never been able to find the cause
of it. If you find a solution (which will almost surely require
modifying the code for the chat pane), please let us know.


J.

Thus spake tealeaf:

I’ve had a little dig around the source code, but it would take me quite
a while to work out what is doing what where. Does anyone have any
ideas? I’ve reproduced a screenshot demonstrating the problem:

The relevant code is in Chatter.java:

sourceforge.net/p/vassalengine/ … atter.java


J.

Thus spake Joel Uckelman:

Thus spake tealeaf:

I’ve had a little dig around the source code, but it would take me quite
a while to work out what is doing what where. Does anyone have any
ideas? I’ve reproduced a screenshot demonstrating the problem:

The relevant code is in Chatter.java:

sourceforge.net/p/vassalengine/ … atter.java

I think I’ve fixed the problem in 3.2.9-svn8851:

vassalengine.sourceforge.net/builds/

Apparently not only do all Swing components not have the same
antialiasing defaults, the defaults differ across platforms. Swing is
utterly daft.


J.

Thank you for the quick response!

That build definitely enables antialiasing on this system. The hinting still seems to be incorrect, but it’s much less of a problem than the antialiasing. From a quick look around the web it seems that detecting and applying system hinting settings is much harder. For now, this is a huge improvement.

The other place where this is really noticeable is in the module wizard. (“Start New Offline Game / Look for a game online / Load saved game”). I imagine that there’s an object exposed as part of that dialog that could have a similar property enabled?

Thanks again for sorting this out so quickly.

(Oh, and Swing is particularly evil on my system. I use Awesome as my window manager. Menus and clicking/dragging are almost always in the wrong place, and often don’t work at all. It’s a nightmare.)

Now, if only the module selection window would disappear once a module was selected (or not appear when starting with vassal -l <module> I’d have no complaints at all… :smiley:

Thus spake tealeaf:

Thank you for the quick response!

That build definitely enables antialiasing on this system. The hinting
still seems to be incorrect, but it’s much less of a problem than the
antialiasing. From a quick look around the web it seems that detecting
and applying system hinting settings is much harder. For now, this is a
huge improvement.

The other place where this is really noticeable is in the module wizard.
(“Start New Offline Game / Look for a game online / Load saved game”). I
imagine that there’s an object exposed as part of that dialog that could
have a similar property enabled?

Sadly, that’s burried deep within the wizard library. We don’t even
have access to the JDialog object, let alone any of its children. This
is one of the many reasons I detest the wizard library.

Thanks again for sorting this out so quickly.

(Oh, and Swing is particularly evil on my system. I use Awesome as my
window manager. Menus and clicking/dragging are almost always in the
wrong place, and often don’t work at all. It’s a nightmare.)

Swing has a bunch of stuff hard-coded for various window managers. I
reported a bug about this to Sun once w/r/t Compiz. It’s utterly
braindead. We’re already doing the only thing we can about it, which is
to stop using Swing after VASSAL 3.2.

Now, if only the module selection window would disappear once a module
was selected (or not appear when starting with vassal -l <module> I’d
have no complaints at all… :smiley:

The reason for this is that the Module Manager coordinates module file
access. Otherwise you could start editing an open module, or vice versa.
We had to do this due to some Java limition I’ve since forgotten about.
This isn’t going to change while we’re still using Java.


J.

I guess I can close WizardSupport.java without bothering to poke any further, then! Thanks again for all your help.

Looking forward to a post-Swing VASSAL. For now, I’m just enjoying playing Arkham Horror by email. :slight_smile: