• 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: glenn andreas <email@hidden>
  • Date: Fri, 16 Sep 2005 08:08:09 -0500


On Sep 16, 2005, at 5:12 AM, Ondra Cada wrote:

Hello all,

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?

Wrong.

Or I am overlooking something pretty basic and important... anyway, here's a simple example, Mac OS X 10.4.1:



Absolutely not - fonts have never scaled that way, ever (even going back to the earliest days of movable type).

The idea is that when a font is small, in order to be readable, it needs to have slightly different metrics & stroke weights (and even shapes in many cases) than when it is made large. It is true, however, that 32 point text "appears" to be twice the size of 16 point text, but it was all about appearances...

Needless to say, this makes taking a document that has, say, 16 point text at 72 dpi and rendering it at 300 dpi tricky (since that make it be in 48 point text, but then the metrics are all different, so various line layout adjustments have to be made to make everything look right).


The reason is plain -- I need to generate some graphics including texts in different preview sizes; the fact that text widths do not scale the same way as (say) plain rectangles makes a *very big* problem.

(I've considered creating a fixed-size PDF result and scale it later, but I am afraid it would be next to impossible, since the complete graphics contains also some bitmap images selected on-the- fly depending on the current resolution. So far, I haven't been able to find another work-around... perhaps creating the fixed-size PDF with texts and vector graphics, scale it, and only then superimpose all the bitmaps, but that would be *lotta* work changing the current code :( )

Thanks a big lot for any advice,


You're going to either have to just apply linear scaling to the whole thing (i.e., use an NSAffineTransformation) or do what printer driver writers have to do and apply various special line and character fractional spacing. Of the two, using an affine transformation is _far_ easier.


Glenn Andreas email@hidden <http://www.gandreas.com/> wicked fun! Widgetarium | the quickest path to widgets

_______________________________________________
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


References: 
 >Font scaling and string size problem?!? (From: Ondra Cada <email@hidden>)

  • Prev by Date: Re: Detecting CPU type
  • Next by Date: Re: Keeping windows hidden
  • Previous by thread: Font scaling and string size problem?!?
  • Next by thread: Re: Font scaling and string size problem?!?
  • Index(es):
    • Date
    • Thread