I'm having some difficulty in finding a procedure to precisely layout
text for printing - JDK 1.2. I would like to position text (e.g. tabular

data) in a device indepent manner without major alignment or clipping
problems problems. Here is what I have tried / observed and believe to
be correct so far (winNT):

1) Graphics.stringWidth returns accurate results for varying point
sizes. As expected, the string widths do not vary linearly with point
size, i.e. 16 point text is not necessarily twice as long as 8 point
text, but is close for integral point sizes. As the point size
increases, the degree of linearity increases as expected since errors in

the "pixelization" (proper term?)  of the text characters are less
significant. Font.getStringBounds retruns correct results in the default

case.
No problem here.

2) Displaying / printing text with the FRACTIONALMETRICS rendering hint
ON does not change the displayed text and does not affect the string
width measurements. It does cause Font.getStringBounds to return longer
and apparently incorrect values beyond the actual drawn characters.

I was expecting FRACTIONALMETRICS_ON to essentially cause the text to be

rendered at its "natural" width, i.e. the text is represented (I
believe) by geometric shapes that are scaled linearly to the requested
height and rendered wherever they happen to fall with no attempt to
align character edges on pixels, etc to make them more uniform and
readable. Perhaps I have the wrong idea here?

Assuming that Font.getStringBounds was correct and the rendering just
isn't implemented, I stll expected FRACTIONALMETRICS_ON to more often
shorten, not lengthen small point size strings. (Note that my
experiments with Font.getStringBounds have just been to understand what
is going on and i hope not to need to use these more time consuming
calculations for my text layout procedure.)

Since the printer resolution is significantly higher than the screen, I
was hoping that even if the FRACTIONALMETRICS stuff wasn't implemented
that the relatively large variations in the measurement of 8 point
screen text would be small for 8 point printer text since the pixels
involved are (in my case) 600 dpi / 72 dpi larger, i.e. the printer 8
point text is ~equivalent to screen 66.6 point text. So, I layed out the

text using string widths based on 66.6 point text but when printed it is

as though the small point size issues with display fonts still applied -

if you get my drift. Also the text prints as geometric shapes rather
than text primitives resulting in poor quality and sometimes overlapping

characters (on pages with text and simple graphics, no images).

As you can see if you're still reading at this point, I've been fishing
around quite a bit and could use any corrections, observations, help, or

advice from those who might be more familiar with these font issues or
with the JDK 1.2 implementation. Thanks for reading!

-Dave




=====================================================================
To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
Java 2D Home Page: http://java.sun.com/products/java-media/2D/

Reply via email to