Hi,

Thanks this was helpful.

Now I can drop  _defaultGlyphForChar for a better solution.

But still, I can not see, how this solve my problem getting characters outside the unicode 16 bits range into a NSString.

Anders Lassen




On Sep 25, 2009, at 8:03 PM, Douglas Davidson wrote:


On Sep 25, 2009, at 10:34 AM, Anders Lassen wrote:

I am trying to display them in a custom NSView that displays math. Of course not all, at the same time, but single characters when needed in a math formula drawing.

For unicode characters in the 16 bits range I use the following code:

 NSGlyph glyph = [font _defaultGlyphForChar:ch];

 NSBezierPath* path = [[NSBezierPath alloc] init];

 [path moveToPoint:NSMakePoint(rect.origin.x,rect.origin.y)];

 [path appendBezierPathWithGlyph:glyph inFont:font];


This works fine for characters in the 16 bits range. Outside this range, I am in trouble since input to _defaultGlyphForChar is 16 bit.

If all you want to do is to display a character in a given font, the string drawing APIs will work just fine for that. If you really need to have a bezier path, don't use the code you show here; we have a sample showing how to get a bezier path from text--look at bezierWithFont: in http://developer.apple.com/mac/library/samplecode/SpeedometerView/listing9.html .

Douglas Davidson


_______________________________________________

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to