Re: Getting a dotted font from a regular font
Re: Getting a dotted font from a regular font
- Subject: Re: Getting a dotted font from a regular font
- From: "email@hidden" <email@hidden>
- Date: Mon, 01 Oct 2012 10:09:03 +0100
On 1 Oct 2012, at 01:35, Eric Gorr <email@hidden> wrote:
> An odd request I know, but I have a need to take a regular font and obtain a dotted version of it.
>
> Any clever ideas that would not involve loading the font into a font editor and turing it into a dotted font?
>
To do this properly you would need to transform the paths associated with each glyph within the target font and generate a new NSFont representation.
You can however access the glyph paths for a given character sequence and transform that path.
Something like:
Allocate and NSLayoutManager instance and configure the NSTextStorage with your text in the target font.
NSLayoutManger handles all the complexity of mapping a character to a particular glyph index within a given font.
Then call NSLayoutManager - getGlyphs:range: to retrieve the glyph indexes
Build a path from glyphs using the target font.
NSBezierPath - (void)appendBezierPathWithGlyphs:(NSGlyph *)glyphs count:(NSInteger)count inFont:(NSFont *)fontObj
Set the dash style
NSBezierPath - (void)setLineDash:(const CGFloat *)pattern count:(NSInteger)count phase:(CGFloat)phase
Stroke the path
Regards
Jonathan Mitchell
Mugginsoft LLP
================================================
KosmicTask - the Integrated Scripting Environment for OS X.
http://www.mugginsoft.com/KosmicTask
================================================
_______________________________________________
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