• 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
How to draw text with fixed spaced font using arbitrary cpi
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to draw text with fixed spaced font using arbitrary cpi


  • Subject: How to draw text with fixed spaced font using arbitrary cpi
  • From: Buddy Kurz <email@hidden>
  • Date: Fri, 16 Jun 2006 11:23:12 -0700


I am using [string drawAtPoint:where withAttributes:textAttributes ] in a PCL5 printer emulation I require for legacy application support.


I am using "Courier New" and calculating a font size that satisfies ([curFont advancementForGlyph:[curFont glyphWithName:@"M"]].width == (horizMotion=72.00 / cpi)) and including NSFixedPitchFontMask in the traits passed to the font manager.
The printed output doesn't line up vertically.


So the multi-part question is:
Why does Courier New not have a fixed advance width? A row of dashes is shorter than a row of numbers on paper.
If there a best way to use the font manager to specify a fixed font with a specific typeface and number of characters per inch.
Should I be using some other method to draw in my NSView subclass?


I'm hoping I don't have to draw each character at the next horizontal position.

thanks,
Buddy Kurz
_______________________________________________
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


  • Prev by Date: Re: NSTextView or NSTextField?
  • Next by Date: Re: NSTextView or NSTextField?
  • Previous by thread: Re: NSTextView or NSTextField?
  • Next by thread: when automatically prepares content doesn't
  • Index(es):
    • Date
    • Thread