Getting a bezier path for a character
Getting a bezier path for a character
- Subject: Getting a bezier path for a character
- From: email@hidden
- Date: Tue, 27 Apr 2010 18:45:27 -0700
- Importance: Normal
Hi, I been trying to figure out how to get the Bezier path for a character
in different fonts,
but can't quiet figure out why things dont work in some fonts.
Some (many) fonts do not rednder the right path for the glyph,
a 'W' in in "Arial Black" for example is fine (looks like W), but in
"Arial Hebrew" it looks like a J
in some other fonts it just looks like a square box (as it is missing) yet
it does exist in that font if I just use TextEdit for example
I did something like this to get the path:
NSTextStorage* storage = [[[NSTextStorage alloc] initWithString:@"W"]
autorelease];
NSLayoutManager* layout = [[[NSLayoutManager alloc] init] autorelease];
NSFont *font = [NSFont fontWithName:FONT_NAME_HERE size:200];
[layout setTextStorage:storage];
NSGlyph glyph = [layout glyphAtIndex:gindex];
NSBezierPath path = [NSBezierPath bezierPath];
[path moveToPoint: NSMakePoint(0, -[font descender])];
[path appendBezierPathWithGlyphs: &glyph count: 1 inFont: font];
I even tried avoiding the layout manager all together by making NSImage
and pulling glyph from font:
NSGlyph glyph = [font glyphWithName:@"W"];
then locking focus on image before getting the bezierpath:inFont but same
results
Any help would be apreciated
Thank You
_______________________________________________
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