• 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: Faster text drawing with configurable stroke width
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Faster text drawing with configurable stroke width


  • Subject: Re: Faster text drawing with configurable stroke width
  • From: Martin Wierschin <email@hidden>
  • Date: Wed, 16 Mar 2011 17:48:38 -0700

> I'm currently drawing text one character at a time with -[NSAttributedString drawWithRect:options:], and it is really slow. I'm looking for a faster alternative.
>
> I draw one character at a time because I need exact control over horizontal positioning (regardless of whether the font is monospaced or not, I force characters onto a grid--this is non-negotiable)

Without knowing your exact requirements, I can't say if this technique meets them (or is faster than what you're already doing), but you might try rigging up an NSTextStorage where each composed character sequence is separated by a tab character. To achieve the exact spacing you'd also apply an NSParagraphStyle with corresponding center-aligned uniformly-spaced NSTextTabs. Then just let NSLayoutManager do all the drawing for you all at once.

~Martin

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Faster text drawing with configurable stroke width (From: George Nachman <email@hidden>)

  • Prev by Date: Re: Symbol not found
  • Next by Date: Re: Faster text drawing with configurable stroke width
  • Previous by thread: Re: Faster text drawing with configurable stroke width
  • Next by thread: Re: Faster text drawing with configurable stroke width
  • Index(es):
    • Date
    • Thread