Re: Font WORA blues.
On Sun, 27 Jul 2008, RedGrittyBrick wrote:
Roedy Green wrote:
<rant>
If you look at http://mindprod.com/applet/fontshowerawt.html you can
view all the fonts available to Java on your machine. Set it to say
15 points. Then look at the various fonts. They won't be ANYWHERE
NEAR the same size! ARGGH!! Spit, splutter. Surely Java should
auto-compensate so that that font families are interchangeable.
</rant>
Not Java's fault?
http://nwalsh.com/comp.fonts/FAQ/cf_8.htm#SEC16
I don't think Java should be changed to misrepresent font sizes.
I think you're right.
But it *is* still *bloody annoying*. And not just in java - in a word
processor or whatever too. You have text in some typeface, you change the
typeface, and it's a completely different size. Why? Because point size
has become meaningless because designers are precious special snowflakes
whose freedom to design creatively, and impose their own beliefs about how
much leading their precious special snowflake font neeeds on its user, is
more import than their users' need to have practical, usable fonts.
Maybe it could have some method of calculating a font size for a
specified font to make that font fit some arbitrary metric (e.g. desired
distance from top of tallest ascender to bottom of lowest descender)
That would be useful. I wrote code to do just that, back in the 1.1 days,
to deal with just the problem Roedy has - getting a font size that is
actually a particular pixel height. It's not too hard, you just write a
function int getFontHeight(Font base, float size, Graphics g) that uses
getFontMetrics etc to work out the font height in pixels, then do an
optimisation in a loop to work out the font size you need to specify to
get the pixel height you want.
tom
--
Initial thoughts - who cares? Subsequent thoughts - omg!!! (Female, 14,
Scotland) -- 4.5 million young Brits' futures could be compromised by
their electronic footprint, Information Commissioner's Office