Let me second Alastair's recommendations.  Our standard developer example for 
this sort of thing is in the SpeedometerView example code, in the 
SpeedyCategories.m file; take a look at the BezierConversions category on 
NSString, and the associated BezierNSLayoutManager.

Douglas Davidson


On Jun 1, 2010, at 2:11 AM, Alastair Houghton wrote:

> Normally you'd be drawing using higher-level APIs that take Unicode code 
> points/units rather than glyph indices; in that case, if you *really* needed 
> a glyph ID for some reason, you could get NSLayoutManager or Core Text to map 
> your Unicode data to glyphs for you.
> 
> Mapping glyphs yourself is a little on the painful side; it *is* possible to 
> do it, but you'd have to grab the font's tables and parse them yourself... I 
> wouldn't recommend it if you can get something else to do glyph mapping for 
> you.  Further, if you want to support advanced layout features like OpenType 
> or AAT, it will rapidly become an *extremely* unpleasant and complicated 
> exercise.
> 
>> Simple question: since using the Glyph ID (i.e., from the Character viewer) 
>> directly at least **works**, is there any real reason why the same font, on 
>> different systems, would have different Glyph IDs for the same character? Or 
>> was this possibly just some form of font corruption?
> 
> The glyph IDs are generally speaking up to the font; there are a few 
> predefined ones - 0 is reserved for the undefined/missing character glyph, 
> and index 1 is the null glyph.
> 
>> If looking up the Glyph ID and using it directly is supposed to be safe 
>> across machines, I'll just go back to that, as this glyphWithName business 
>> is way too annoying...
> 
> If you can guarantee that you're always using the same version of the font, 
> and nobody is going to change the glyph IDs, then you can use them directly 
> if you must.  However, if the font you're using supports it, you'd be better 
> off using the Unicode "Musical Symbols" block at U+1D100, because that frees 
> you from relying on knowing specific glyph IDs; it also means you can use the 
> higher-level rendering machinery, which gets you all kinds of advantages like 
> automatic support for kerning, ligatures, positioning and so on.

_______________________________________________

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 arch...@mail-archive.com

Reply via email to