• 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: "email@hidden" <email@hidden>
  • Date: Mon, 24 Sep 2012 12:49:41 +0100

On 23 Sep 2012, at 17:33, Kyle Sluder <email@hidden> wrote:
>
> Attributes are specified on a character, rather than glyph, basis. So if
> you need to draw your characters with a separate color, you should
> probably override
> -showCGGlyphs:positions:count:font:matrix:attributes:inContext: to push
> and pop the foreground color you want before calling super. Should be a
> really simple override, because the context is already set up for you.
>
>
It turns out that customising NSGlyphGenerator is not necessary as the subclass merely calls its delegate, which is the layout manager.
So an override on NSLayoutManager of  - insertGlyphs:length:forStartingGlyphAtIndex:characterIndex: is appropriate.
I cache my substitute glyphs and swap them in as required (a secondary layout manager generates the substitute glyphs).

However there are issues.

Colourisation in - showCGGlyphs:positions:count:font:matrix:attributes:inContext:
will necessitate colouring by glyph value. So if a period is used to highlight a space then all periods in the text get highlighted regardless.

Secondly, swapping out the tab glyph for another seems to break the tab functionality in the NSTextView.

Also, new line and carriage return glyph substitution doesn't seem to work. The substitute glyph is not drawn.
Perhaps its omitted as part of the fragment processing.

I imagine that  the second issue is related to the type setter, though that's just a guess.

Regards

Jonathan Mitchell
Mugginsoft LLP



_______________________________________________

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

  • Follow-Ups:
    • Re: drawGlyphsForGlyphRange layout issue
      • From: "email@hidden" <email@hidden>
References: 
 >drawGlyphsForGlyphRange layout issue (From: "email@hidden" <email@hidden>)
 >Re: drawGlyphsForGlyphRange layout issue (From: Graham Cox <email@hidden>)
 >Re: drawGlyphsForGlyphRange layout issue (From: "email@hidden" <email@hidden>)
 >Re: drawGlyphsForGlyphRange layout issue (From: Kyle Sluder <email@hidden>)

  • Prev by Date: Re: iOS encrypt and stream local video file
  • Next by Date: How to calculate NSToolbar height in fullscreen mode
  • Previous by thread: Re: drawGlyphsForGlyphRange layout issue
  • Next by thread: Re: drawGlyphsForGlyphRange layout issue
  • Index(es):
    • Date
    • Thread