• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Font scaling and string size problem?!?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Font scaling and string size problem?!?


  • Subject: Re: Font scaling and string size problem?!?
  • From: Ondra Cada <email@hidden>
  • Date: Fri, 16 Sep 2005 20:18:01 +0200

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 :)

Screen fonts do behave differently.
I circumvented this problem by using a big font (≥ 18 points - obviously at this size screen fonts either do not exist, or have same measurements as normal fonts), calculating the size of a string in this big font, and then scaling the sizes back to my small font.

Anyroad, I've tried the Glenn's advice, to render always fonts in their "real" size, using an NSAffineTransformation to enlarge (or decrease) the size as needed. So far, it seems to work like a charm. Thanks again, Glenn!


On 16.9.2005, at 19:17, Gerriet M. Denkmann wrote:

But I have just tried the advancementForGlyph: 'm' in userFontOfSize: 4 - 24 in steps of 0.5.
In a real font this advancement is always 0.222168 * fontSize.
In the corresponding screenFont this varies between 0 (fontSize < 5) and from 0.125 (fontSize = 8) to 0.25 (fontSize = 12)

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 :)


Cheers,
---
Ondra Čada
OCSoftware:     email@hidden               http://www.ocs.cz
private         email@hidden             http://www.ocs.cz/oc


_______________________________________________ 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
  • Follow-Ups:
    • Re: Font scaling and string size problem?!?
      • From: "Gerriet M. Denkmann" <email@hidden>
    • Re: Font scaling and string size problem?!?
      • From: glenn andreas <email@hidden>
References: 
 >Re: Font scaling and string size problem?!? (From: "Gerriet M. Denkmann" <email@hidden>)

  • Prev by Date: Re: Printing sample code?
  • Next by Date: Implementing a drawing canvas
  • Previous by thread: Re: Font scaling and string size problem?!?
  • Next by thread: Re: Font scaling and string size problem?!?
  • Index(es):
    • Date
    • Thread