Michael,
There are multiple reasons you are having this problem:
a. Today, the Java 2D API does not do font hinting, which is the
process that allows fonts to be rendered nicely in small sizes (as in
Photoshop). Font hinting is going to be added to the platform.
b. The TextLayer class turns text into Shapes before rendering. This has
advantages and disadvantages. In a nutshell, turning text into Shapes for the
Graphic Layers Framework allows fancier text rendering but has some drawbacks
(e.g., loss of text metrics once the text has been converted). Even if the Java
2D API supported font hinting today, you would still get the behavior you
describe with TextLayer. To avoid this, you could write another version of
TextLayer that makes different design choices (with different tradeoffs).
Hope this helps.
V.
P.S: For those who may be wondering where TextLayer comes from, it is not part
of the Java 2D API but comes from the Graphic Layers Framework (GLF) that was
written for the "Java 2D API Graphics" book. The GLF can be freely downloaded
at:
http://developer.java.sun.com/developer/Books/2dgraphics/
> MIME-Version: 1.0
> Subject: [JAVA2D] Problems Rendering Small Fonts
> To: [EMAIL PROTECTED]
>
> Hello All!
>
> I have been rendering small aliased fonts using
> the Java 2d package and have been having problems.
>
> I find that rendering small fonts such as Arial
> 10 pt usually looks better aliased because they
> look blurry otherwise. I've been rendering these
> fonts using FRACTIONMETRICS_ON and
> TEXT_ANTIALIASING_OFF. The renderings are very poor
> and often even have pixels missing. When I render
> the same aliased fonts in Photoshop on the same
> machine, they look great.
>
> Am I doing something wrong here or is this a current
> limitation of the Java2D package?
>
> Sample code...
>
> TextLayer text = new TextLayer (composition, text,
> font, new FillRenderer
> (color))
>
> text.setRenderingHints ( ...
>
> Michael Connor
>
>
> __________________________________________________
> Do You Yahoo!?
> Talk to your friends online with Yahoo! Messenger.
> http://im.yahoo.com
>
> ===========================================================================
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff JAVA2D-INTEREST". For general help, send email to
> [EMAIL PROTECTED] and include in the body of the message "help".
+-----------------------------------------------------------+
| Vincent Hardy [EMAIL PROTECTED] |
| Java Architect .com/ready Competency Center |
| 650-786-4066 Menlo Park |
+-----------------------------------------------------------+
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".