Re: drawGlyphsForGlyphRange layout issue

2012-09-26 Thread jonat...@mugginsoft.com
On 26 Sep 2012, at 02:08, Aki Inoue wrote: > >> 2. I thought the core text route would be more efficient. I have cached my >> CTLineRefs. Doesn't -drawWithRect:options:attributes: require instantiating >> an NSLayoutManager on each call? > We don't instantiate NSLayoutManager on each call. In

Re: drawGlyphsForGlyphRange layout issue

2012-09-25 Thread Aki Inoue
> 1. Why is -drawWithRect:options:attributes: more compatible with > NSLayoutManager? It's not about either is compatible. When using line fragment origin layout, we're using typesetter behavior 10.2 compatibility for historical reasons. NSLayoutManager, by default, uses the latest behavior.

Re: drawGlyphsForGlyphRange layout issue

2012-09-24 Thread jonat...@mugginsoft.com
On 24 Sep 2012, at 19:19, Aki Inoue wrote: > To be compatible with NSLayoutManager, you should use > -drawWithRect:options:attributes: here instead of using CT. Using -drawWithRect:options:attributes: works. 2 questions: 1. Why is -drawWithRect:options:attributes: more compatible with NSLayout

Re: drawGlyphsForGlyphRange layout issue

2012-09-24 Thread Aki Inoue
To be compatible with NSLayoutManager, you should use -drawWithRect:options:attributes: here instead of using CT. Your source of trouble is using -drawAtPoint: which uses NSStringDrawingUsesLineFragmentOrigin option (layout glyphs from the top instead of the glyph origin). Aki On 2012/09/24,

Re: drawGlyphsForGlyphRange layout issue

2012-09-24 Thread jonat...@mugginsoft.com
On 24 Sep 2012, at 12:49, jonat...@mugginsoft.com wrote: > > On 23 Sep 2012, at 17:33, Kyle Sluder 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

Re: drawGlyphsForGlyphRange layout issue

2012-09-24 Thread jonat...@mugginsoft.com
On 23 Sep 2012, at 17:33, Kyle Sluder 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 t

Re: drawGlyphsForGlyphRange layout issue

2012-09-23 Thread Kyle Sluder
On Sun, Sep 23, 2012, at 01:55 AM, jonat...@mugginsoft.com wrote: > > > > On 22 Sep 2012, at 01:33, Graham Cox wrote: > > > > You might investigate an alternative (and much easier) solution. > > > > NSLayoutManager adopts the NSGlyphStorage protocol. That protocol declares > > a method, -layo

Re: drawGlyphsForGlyphRange layout issue

2012-09-23 Thread jonat...@mugginsoft.com
> > On 22 Sep 2012, at 01:33, Graham Cox wrote: > You might investigate an alternative (and much easier) solution. > > NSLayoutManager adopts the NSGlyphStorage protocol. That protocol declares a > method, -layoutOptions, and one of the flags it can return is > NSShowInvisibleGlyphs. Simply

Re: drawGlyphsForGlyphRange layout issue

2012-09-22 Thread Ross Carter
On Sep 21, 2012, at 8:33 PM, Graham Cox wrote: > NSLayoutManager adopts the NSGlyphStorage protocol. That protocol declares a > method, -layoutOptions, and one of the flags it can return is > NSShowInvisibleGlyphs. Simply returning that flag may be all you need to do. I haven't kept up with re

Re: drawGlyphsForGlyphRange layout issue

2012-09-21 Thread Kyle Sluder
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

Re: drawGlyphsForGlyphRange layout issue

2012-09-21 Thread Graham Cox
On 21/09/2012, at 8:54 PM, jonat...@mugginsoft.com wrote: > The following is used to draw a glyph representing a tab character in an > NSLayoutManager subclass. You might investigate an alternative (and much easier) solution. NSLayoutManager adopts the NSGlyphStorage protocol. That protocol d

Re: drawGlyphsForGlyphRange layout issue

2012-09-21 Thread jonat...@mugginsoft.com
On 21 Sep 2012, at 17:12, Ross Carter wrote: > > On Sep 21, 2012, at 6:54 AM, "jonat...@mugginsoft.com" > wrote: > >> The following is used to draw a glyph representing a tab character in an >> NSLayoutManager subclass. >> When using say the Monaco font everything looks fine. >> When switchi

Re: drawGlyphsForGlyphRange layout issue

2012-09-21 Thread Kyle Sluder
On Fri, Sep 21, 2012, at 03:54 AM, jonat...@mugginsoft.com wrote: > There is obviously something about the layout that I am missing here > which is implemented by the super implementation. > Any pointers would be appreciated. 1. Consider asking your question on the coretext-dev list. 2. Watch the

Re: drawGlyphsForGlyphRange layout issue

2012-09-21 Thread Ross Carter
On Sep 21, 2012, at 6:54 AM, "jonat...@mugginsoft.com" wrote: > The following is used to draw a glyph representing a tab character in an > NSLayoutManager subclass. > When using say the Monaco font everything looks fine. > When switching to Menlo however the glyphs drawn in the method below ar

drawGlyphsForGlyphRange layout issue

2012-09-21 Thread jonat...@mugginsoft.com
The following is used to draw a glyph representing a tab character in an NSLayoutManager subclass. When using say the Monaco font everything looks fine. When switching to Menlo however the glyphs drawn in the method below are positioned lower on the line than those drawn by the super implementati