• 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
Getting a bezier path for a character
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Getting a bezier path for a character
      • From: Douglas Davidson <email@hidden>
    • Re: Getting a bezier path for a character
      • From: Jens Alfke <email@hidden>
  • Prev by Date: Re: Finder file label from cocoa?
  • Next by Date: Design for cleaning up Undo for a tree of objects
  • Previous by thread: Re: Finder file label from cocoa?
  • Next by thread: Re: Getting a bezier path for a character
  • Index(es):
    • Date
    • Thread