Re: Getting glyphs for surrogate characters ??
Re: Getting glyphs for surrogate characters ??
- Subject: Re: Getting glyphs for surrogate characters ??
- From: Alastair Houghton <email@hidden>
- Date: Sun, 27 Sep 2009 18:25:14 +0100
On 27 Sep 2009, at 16:51, Anders Lassen wrote:
I may have solved the problem described above.
The method glyphAtIndex returns two glyphs. The first one is
actually the correct glyph for the surrogate character. The next one
is zero.
Indeed, the system generates a special NSNullGlyph in many of these
cases, the reason presumably being that it keeps the character ranges
and glyph ranges aligned.
*However*, I'm not sure that there is any guarantee that a single
character won't map in general to multiple glyphs, or indeed that a
given character will directly result in *any* glyphs of its own.
You really do need to cope with these cases in your code, because they
come up in real use cases. They may be more common in non-Latin
languages (Arabic, Indic scripts and Hangul are particularly fun), but
even if you only support Latin languages it's possible that some fonts
will cause problems for you if you can't cope with an arbitrary number
of glyphs per character.
FWIW, if you aren't using the text system for this task, doing it
yourself is decidedly non-trivial. I would strongly recommend using
the text system, and actually, if you can I would *also* recommend
letting the text system do the layout for you, because it is very much
more sophisticated than just worrying about bounding boxes and glyph
advances.
Kind regards,
Alastair.
--
http://alastairs-place.net
_______________________________________________
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