Re: NSBezierPath append CGGlyph
Re: NSBezierPath append CGGlyph
- Subject: Re: NSBezierPath append CGGlyph
- From: Shawn Erickson <email@hidden>
- Date: Sat, 01 Sep 2007 09:09:51 -0700
On Sep 1, 2007, at 8: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.
Actually your cast doesn't help and is in fact wrong since it
prevents the compiler from seeing your error.
If you have an C array of CGGlyphs then each array slot is 2 bytes
wide and casting wont change how the memory is allocated or
populated. The appendBezierPathWithGlyphs:count:inFont: method
expects a C array of NSGlyphs (4 byte slots).
So if you stated you have 10 glyphs then it is expecting an array 40
bytes long but you are only giving it one that is 20 bytes long.
Additionally each time it reads a glyph it was actually reading two
CGGlyphs which is obviously not what you want.
Anyway consider using appendBezierPathWithPackedGlyphs: with a NULL
terminated CGGlyphs array (not ideal...).
-Shawn
_______________________________________________
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