4

I am working with a programmer who is using Java to create an interface for an application.

The fonts in the program look ugly to me. Somehow too harsh, as if they aren't anti-aliased or something. Sorry for being vague, but they just look "clunky" to me.

I know that there are settings within an OS to change how a font is rendered, such as subpixel smoothing, or grayscale smoothing, as well as subpixel order and hinting.

Since the fonts only look bad in this one program I wonder - is there anything on the programming side that can be done to improve font rendering?

Questioner
  • 7,133
  • 16
  • 61
  • 94
  • Depends on your windowing toolkit: http://stackoverflow.com/questions/2018102/java-font-rendering But in Windows at least, you can pick the font rendering quality. The toolkit needs to 1) use Windows for font rendering and 2) expose the ability to control font rendering. – ta.speot.is Jan 24 '12 at 04:29
  • Keep in mind that there is yet another layer in there - Java itself. Java goes to great lengths to try to make Java applications look "the same" across multiple platforms. This may include fiddling with the usual OS font rendering, depending on your platform and JRE. – Greg Hewgill Jan 24 '12 at 04:30
  • Thanks for the comments. I am a graphics guy and definitely not a Java guy. Are there terms and suggestions I might be able to pass onto him so that he would be better equiped to handle it? He's a very good programmer, so if I can just point in the right direction, I'm sure he'd be able to nail it. – Questioner Jan 24 '12 at 04:32
  • 1
    Is the app. using the native PLAF? If not, try it that way. – Andrew Thompson Jan 24 '12 at 04:35
  • @AndrewThompson: I don't know, but I will ask about that. Thanks for the term. – Questioner Jan 24 '12 at 04:38
  • For some examples of font rendering in the native PLAF, see [this thread](http://stackoverflow.com/a/5630271/418556) for a larger GUI or [this thread](http://stackoverflow.com/a/7143398/418556) for some small examples. – Andrew Thompson Jan 24 '12 at 04:39
  • http://stackoverflow.com/questions/179955/how-do-you-enable-anti-aliasing-in-arbitrary-java-apps (note the comment about clearType and the lcd value.) Otherwise, in the drawing code one can set rendering hints: http://docs.oracle.com/javase/tutorial/2d/text/renderinghints.html – Joop Eggen Jan 24 '12 at 04:59

1 Answers1

1

If you are using Java 6, there is a system property called awt.useSystemAAFontSettings you can use to control anti-aliasing. Possible values are:

"lcd" ClearType style sub-pixel anti-aliasing.

"false" Disable anti-aliasing.

"on" Best contrast.

"gasp" Standar anti-aliasing.

Jaec
  • 390
  • 2
  • 8
  • 18