• 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
NSLayoutManagers and NSTypesetters and NSGlyphGenerators, oh my!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSLayoutManagers and NSTypesetters and NSGlyphGenerators, oh my!


  • Subject: NSLayoutManagers and NSTypesetters and NSGlyphGenerators, oh my!
  • From: Kaelin Colclasure <email@hidden>
  • Date: Wed, 31 Dec 2003 21:08:35 -0800

As mentioned tangentially in an earlier post, I am a n00b when it comes
to the Cocoa text system. I am wading diligently through the
documentation; however, I am finding it a bit sparse as regards how
characters in an NSTextStorage actually get transformed into glyphs to
be displayed. But not to put the cart before the horse, let me first
describe what it is I'm trying to do...

1) I want to embed some special, hidden control characters into the
character stream contained in an NSTextStorage.
a) These characters I designate as special should normally not show up
as visible glyphs at all. Think tabs, but without any effect on the
position of the next character / glyph position.
b) I do want insertion point positioning in the NSTextView to allow
putting the insertion point between two of these invisible control
characters.
c) It would be nice if I could also have a toggle to "Show Invisibles"
-- but this is not essential.

2) I want to have certain escape sequences in the character stream
mapped into a single character glyph.
a) For example, "&lt;" should map to the glyph for '<'. (You can see
where this would be useful.)
b) Again, the ability to toggle this off and invalidate / re-render
the NSTextView would be nice, but not essential.

I realize that all this is going to require some work -- I'm not
looking for a handout, just a hand getting started. :-)

The conceptual overview of the text system tells me that the
NSLayoutManage class is nominally responsible for the mapping of
characters to glyphs. And indeed, perusing the docs shows me a
bewildering array likely-sounding methods:

Accessing glyphs
 insertGlyph:atGlyphIndex:characterIndex:
 isValidGlyphIndex:
 glyphAtIndex:
 glyphAtIndex:isValidIndex:
 replaceGlyphAtIndex:withGlyph:
 getGlyphs:range:

getGlyphsInRange:glyphs:characterIndexes:glyphInscriptions:elasticBits:

getGlyphsInRange:glyphs:characterIndexes:glyphInscriptions:elasticBits:
bidiLevels
 deleteGlyphsInRange:
 numberOfGlyphs

Mapping characters to glyphs
 setCharacterIndex:forGlyphAtIndex:
 characterIndexForGlyphAtIndex:
 characterRangeForGlyphRange:actualGlyphRange:
 glyphRangeForCharacterRange:actualCharacterRange:

Display of special glyphs
 setNotShownAttribute:forGlyphAtIndex:
 notShownAttributeForGlyphAtIndex:
 setShowsInvisibleCharacters:
 showsInvisibleCharacters
 setShowsControlCharacters:
 showsControlCharacters

The first obvious question is, which of these are the "primitives" that
I'll need to override?

To further confuse matters (or at least to further confuse me), the
release notes mention that NSTypesetter gets involved in this whole
process somewhere. Specifically, it is said to be NSTypesetter that
combines an accent and an 'e' to form 'i'... But isn't that also a
character-to-glyph mapping? So is NSTypesetter a helper class for
whatever methods above are the primitives? And where and how then does
NSGlyphGenerator fit in to all this?

-- Kaelin
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Re: People who develop with MySQL and/or other GPL based code
  • Next by Date: Re: [ANN] Updated source code: Colored Checkboxes, Source List
  • Previous by thread: How to copy Apple's in-column keyboard shortcut editor?
  • Next by thread: Table view check boxes
  • Index(es):
    • Date
    • Thread