• 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
Re: NSBezierPath append CGGlyph
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSBezierPath append CGGlyph


  • Subject: Re: NSBezierPath append CGGlyph
  • From: Scott Thompson <email@hidden>
  • Date: Sat, 1 Sep 2007 11:06:54 -0500


On Sep 1, 2007, at 10:49 AM, Keith Duncan wrote:

NSGlyph is not an object, it's an int. Try casting them to a NSGlyph (no asterisk)

Actually NSGlyph is an unsigned integer, whereas CGGlyph is an unsigned short. However I have a buffer (C style array) of CGGlyphs.


The method I was using was -[NSBezierPath's appendBezierPathWithGlyphs:count:inFont:] which expects a buffer of NSGlyphs. So you see my cast was correct it just seems that there is an index mismatch between CGGlyph and NSGlyph such that they aren't interchangeable.

Ah.. I see. I believe that NSGlyph and CGGlyph should store the same value, but your problem is that they store them in differently sized chunks so that when you create arrays of the chunks, they don't line up properly.


Both NSGlyph and CGGlyph simply represent the glyph index of a particular graphic in the font. The most direct solution to your problem would be to simply allocate a local array large enough to hold NSGlyph values and then simply trans-coding the array of glyph IDs from CGGlyph to NSGlyph so that you get the properly sized array.

Unfortunately, the other way to go from a CGGlyph to a path would be to use Core Text and CTFontCreatePathForGlyph which does not exist in Tiger. Still, in that case, you'd have to use something like CGPathApply or a similar mechanism to get an NSBezierPath that you could append to other NSBezierPaths.

Scott


_______________________________________________

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


References: 
 >NSBezierPath append CGGlyph (From: Keith Duncan <email@hidden>)
 >Re: NSBezierPath append CGGlyph (From: Scott Thompson <email@hidden>)
 >Re: NSBezierPath append CGGlyph (From: Keith Duncan <email@hidden>)

  • Prev by Date: best way to "reset" values
  • Next by Date: Re: many messages between threads
  • Previous by thread: Re: NSBezierPath append CGGlyph
  • Next by thread: Re: NSBezierPath append CGGlyph
  • Index(es):
    • Date
    • Thread