Re: Faster text drawing with configurable stroke width
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