On Oct 4, 2008, at 11:59 AM, [EMAIL PROTECTED] wrote:

I can't figure out how NSGlyph works in methods like this:

[path appendBezierPathWithGlyph:'x' inFont:[NSFont userFontOfSize: 14.0]]

(Of course 'path' is an NSBezierPath.)

What I get on the screen is not an '+', but an upper-case "H" in some outline font. And when I put in explicit Unicodes, I don't get the expected symbol either.

NSGlyph is declared as an unsigned int. But how is it connected to displayed characters?

You should take a look at some of the text system conceptual documentation, such as http://developer.apple.com/documentation/Cocoa/Conceptual/TextLayout/TextLayout.html .

Glyph are not characters, and in general they do not have a simple relationship to characters. A glyph is an individual displayable element in a particular font, and its numerical value is an index into the font's glyph repertoire; this numerical value does not in general have meaning outside of the context of that particular font.

The Cocoa text system converts characters into glyphs as needed for text display; in general, NSLayoutManager manages this process, with the help of two auxiliary classes, NSGlyphGenerator and NSTypesetter. The first of these performs a first-pass conversion of characters to glyphs, while the second makes any contextual adjustments that are necessary as the text is laid out. The final mapping between glyphs and characters need not be one-to-one; for example, even with Latin- script text, in many fonts the two characters "fi" will be represented by a single "fi" ligature glyph. Other scripts, or specialized fonts, can produce much more complicated character-glyph mappings.

Try taking a look at the "SpeedometerView" example on developer.apple.com. It includes among other things a mechanism for producing bezier paths from arbitrary text, in the SpeedyCategories.m file.

Douglas Davidson

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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