• 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: Invisible characters in NSTextView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Invisible characters in NSTextView


  • Subject: Re: Invisible characters in NSTextView
  • From: Mark Munz <email@hidden>
  • Date: Mon, 3 Jan 2005 10:14:43 -0600


On Jan 3, 2005, at 9:19 AM, glenn andreas wrote:

There, in theory, exist fonts that setShowsInvisibleCharacters works, but I've never found one (it's suppose to be a capability of the font), so subclassing NSLayoutManager is the cleanest way to do this.

I was told that this API doesn't work. I filed a bug report two years ago (3151523) and it was marked closed/duplicate. I would recommend that you (and everyone that would like this behavior to work) file a bug as well. Perhaps if enough people ask for this to work, Apple will put effort behind it to make it work again.

Something like this:

- (void)drawGlyphsForGlyphRange:(NSRange)glyphRange
atPoint:(NSPoint)containerOrigin
[snip]
You can check out some complete workable code at
http://smultron.sourceforge.net (the SMLLayoutManager class).



Unfortunately, the above code doesn't quite work correctly, since characterAtIndex: is a character based index, and you are going through glyph based indices. Now while these two are usually the same (and the layout manager will insert null-glyphs to help maintain this), there is no guarantee that it will be the same, and so you should convert the glyph index to character index.

The original poster could use IDEKit (http://projects.gandreas.com/idekit) and just drop in a view that provides this capability (and a boatload of others).

This works mostly for plain text (single font), but gets trickier if you're using RTF. In particular, the paragraph indentation (first line indent) can wreak havoc on determining the positioning of an invisible character, even when mapping GlyphIndex. For some reason, the fragment position does not take these values into account.


Mark Munz
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Invisible characters in NSTextView (From: Jean Bovet <email@hidden>)
 >Re: Invisible characters in NSTextView (From: Peter Borg <email@hidden>)
 >Re: Invisible characters in NSTextView (From: glenn andreas <email@hidden>)

  • Prev by Date: Re: 2 problems.
  • Next by Date: Re: EPS to NSBezierPath
  • Previous by thread: Re: Invisible characters in NSTextView
  • Next by thread: Re: Invisible characters in NSTextView
  • Index(es):
    • Date
    • Thread