On 1 Oct 2012, at 01:35, Eric Gorr <[email protected]> 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 protected]) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [email protected]
