You aint suppose get transformation out from RenderingContext... you should
put it in..
Well here is trick how you can do things -
get size in inches, then get resolution of device, then get RC with 1:1
transformation,
measure string with 1:1 transformation (get measurement in device space) and
then just map
one size to another... Use this transformation right before drawString
Trick will not work for X-Windows thou.. Just because size there is broken
and antialiasing can just crack you up, when you apply it with fonts..
Cheers,
Sergei
----- Original Message -----
From: "Irving Salisbury" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, April 11, 2000 7:25 PM
Subject: [JAVA2D] Exact font size
> In our application, people specify fonts with inch sizes. When I
> actually render text at various dpis I need to figure out what point
> size for the given font will give me the height I need. In other words,
> I need a point size to pixel algorithm for the given font. I saw in the
> FontRenderContext there was a getTransform that is supposed to do this,
> but it always seems to return the identity transform. When I look at
> the FontMetrics however, it is not a 1-1 mapping of point size to pixel
> size for any font I have.
>
> Is this feature broken?
>
> Is there another way to figure this out?
>
> What we are doing now is assuming there is a 1-1 mapping and then using
> an algorithm with brute force to figure out the right point size. It
> currently takes us from 2-5 tries to actually figure it out. However,
> it would be nice to be able to do this without brute force.
>
> Thanks in advance,
>
> Irv
>
>
===========================================================================
> 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".
>
===========================================================================
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".