File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes font getting fuzzy on Graphics 2D Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "font getting fuzzy on Graphics 2D" Watch "font getting fuzzy on Graphics 2D" New topic

font getting fuzzy on Graphics 2D

Stephen Huey
Ranch Hand

Joined: Jul 15, 2003
Posts: 618
I'm using drawString on a Graphics 2D image object and writing at font sizes anywhere from 8 or 10 to 40. After printing out the image, I've noticed that a lot of the Arial letters are showing up more jagged than they do in Word, and I'm using what seems to be a pretty decent laser jet printer. As you might expect, it's not always as clear to read at the lower point sizes (e.g. 10), so I'm wondering if there's something I can do to make things look a little cleaner?
I stick the image I create into a webpage, and when you print out the whole page, the text in the image is definitely less clear than the HTML text next to it. I know there are a whole lot of variables here, but I'm wondering if this problem could be in Java or if it's most likely elsewhere.
By the way, I'm using ImageIO's write method to write it out as a PNG image. Should I be using something other than PNG?
[ February 27, 2004: Message edited by: S. C. Huey ]
Craig Wood
Ranch Hand

Joined: Jan 14, 2004
Posts: 1535
png works great. Are you using antialiasing? See how this demo compares to what you're working with.

[ February 27, 2004: Message edited by: Craig Wood ]
I agree. Here's the link:
subject: font getting fuzzy on Graphics 2D
It's not a secret anymore!