• 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: drawGlyphsForGlyphRange layout issue
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: drawGlyphsForGlyphRange layout issue


  • Subject: Re: drawGlyphsForGlyphRange layout issue
  • From: Kyle Sluder <email@hidden>
  • Date: Fri, 21 Sep 2012 18:20:05 -0700

On Fri, Sep 21, 2012, at 05:33 PM, Graham Cox wrote:
> Another approach is to override
> -showCGGlyphs:positions:count:font:matrix:attributes:inContext: which is
> the primitive drawing method. All of the positioning and context
> flippedness has been handled by this point, so you can usually just go
> ahead and draw the characters. Inserting some other glyph at this point
> for the tab should be straightforward.

I would imagine it would be much better to modify the glyph stream at
one of its defined override points: the glyph generator. Subclass
NSGlyphGenerator and override
-generateGlyphsForGlyphStorage:desiredNumberOfCharacters:glyphIndex:characterIndex:
to call through to the sharedGlyphGenerator's implementation to get the
standard glyphs before the first tab character, generate a tab glyph and
insert it into the glyph storage, and then call through to the
sharedGlyphGenerator to generate the remaining characters (repeat this
process for each tab character for which a glyph is requested). Call
-setGlyphGenerator: on your layout manager to provide an instance of
your glyph generator subclass.

Aki Inoue describes this approach in the WWDC 2010 video for Session 114
- Advanced Cocoa Text Tips and Tricks.

--Kyle Sluder
_______________________________________________

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

References: 
 >drawGlyphsForGlyphRange layout issue (From: "email@hidden" <email@hidden>)
 >Re: drawGlyphsForGlyphRange layout issue (From: Graham Cox <email@hidden>)

  • Prev by Date: Re: Autosave in place - common use case that makes me hate it
  • Next by Date: Re: Autosave in place - common use case that makes me hate it
  • Previous by thread: Re: drawGlyphsForGlyphRange layout issue
  • Next by thread: Re: drawGlyphsForGlyphRange layout issue
  • Index(es):
    • Date
    • Thread