• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Finding Glyphs for String
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Finding Glyphs for String


  • Subject: Re: Finding Glyphs for String
  • From: Douglas Davidson <email@hidden>
  • Date: Tue, 27 Nov 2001 09:00:08 -0800

On Monday, November 26, 2001, at 04:55 PM, Charles Jolley wrote:

> Does anyone know how to find the corresponding glyphs for
> characters in a string? It appears that the mechanism used by the text
> system and even ATSUI is all internal...

Here is a copy of one of my earlier posts on this:

> Certainly there is public API for getting NSGlyphs. NSLayoutManager
> defines
>
> - (NSGlyph)glyphAtIndex:(unsigned)glyphIndex;
> - (NSGlyph)glyphAtIndex:(unsigned)glyphIndex isValidIndex:(BOOL
> *)isValidIndex;
> - (unsigned)getGlyphs:(NSGlyph *)glyphArray range:(NSRange)glyphRange;
>
> To be sure, it is necessary to set up an NSLayoutManager instance in
> order to use these; there is no way, for example, to convert a single
> character into a glyph. That is because, as you note, glyph management
> is quite complex; the mapping from characters to glyphs is
> many-to-many, and in general requires access to the whole string,
> rather than a single character, for correctness. The NSLayoutManager
> will also cache the glyphs for you.
>
> For an example of using NSLayoutManager without an NSTextView, see the
> CircleView example. That example uses the layout manager for both
> glyph generation and layout; to perform glyph generation without
> layout, you would simply call some of the methods listed above rather
> than the methods glyphRangeForTextContainer:,
> usedRectForTextContainer:, and drawGlyphsForGlyphRange:atPoint: used in
> the example.
>
> Remember that the font that should be used to display the glyph is not
> necessarily the font you supplied in your text storage. If the font
> you supply does not have a glyph for a particular character, the text
> system will find an appropriate font during font fixing. You will need
> to inspect the text storage to find the fonts actually used.

Douglas Davidson


  • Follow-Ups:
    • Re: Finding Glyphs for String
      • From: Charles Jolley <email@hidden>
References: 
 >Finding Glyphs for String (From: Charles Jolley <email@hidden>)

  • Prev by Date: Re: horizontal tabs in TabView
  • Next by Date: Re: LayoutManager
  • Previous by thread: Re: Finding Glyphs for String
  • Next by thread: Re: Finding Glyphs for String
  • Index(es):
    • Date
    • Thread