Re: Font scaling and string size problem?!?
Re: Font scaling and string size problem?!?
- Subject: Re: Font scaling and string size problem?!?
- From: "Gerriet M. Denkmann" <email@hidden>
- Date: Fri, 16 Sep 2005 23:02:27 +0200
On 16.09.2005, at 20:18, Ondra Cada wrote:
Gerriet,
thanks for your answer,
On 16.9.2005, at 18:37, Gerriet M. Denkmann wrote:
I've always thought that fonts scale linearly, in the sense that if
"XYZ" in 10pt font happens to be an inch wide, then in the same font
scaled to 20pt it would be two inches. Right?
Yes, for real fonts this should be true.
Seems it should not.
Actually, it definitely should not, far as typography is concerned --
but I've been pretty positive that PostScript or TrueType fonts do not
support the fact that, say, 60pt 'a' should not be just the 10pt 'a',
six times linearly enlarged -- it should have different proportions,
being designed for the big size, whils the 10pt 'a' is, well, designed
for the small size. I've always thought only METAFONT supported this
distinction, whilst the newer and more widely used means to describe
letters lack the support alltogether.
Well it looks like I was wrong :)
My experience is that (at least userFontOfSize:) is just one font
scaled; that is a 60pt 'a' is just a 10pt 'a' scaled by 6.
Well I haven't the time just now; if you do and wanna play, perhaps it
might be interesting to make an application which would render whole
strings in more different point sizes, scale them using
NSAffineTransformation to be of "same real size", and superimpose them
to see whether they are exactly the same (proving so my original
suspicion our fonts do not support these differences) or not :)
I did play around a bit more. And found out that:
1. The size of an attributedString equals the screenFont advancement if
fontSize ≤ 16. (regardless of the fact that the font of the
attributedString was set to the real font, not it's screenFont
substitute).
I don't know whether this is a bug or a well-documented feature.
2. The size of an attributed string equals realFont advancement if
fontSize ≥ 16.1 (as one would expect)
For this reason, when I want to know the size of an attributedString
with font size < 16 I use a bigger font (> 16pt), get the size and
scale it back to the real font size.
Tested so far on Panther.
Tiger has same sizes as Panther for ≥ 8.5pt. Glyph advancement could
not be tested because glyphWithName: does not work on Tiger.
Kind regards,
Gerriet.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden