• 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: Drawing an underline like the one used to indicate spelling errors?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Drawing an underline like the one used to indicate spelling errors?


  • Subject: Re: Drawing an underline like the one used to indicate spelling errors?
  • From: Douglas Davidson <email@hidden>
  • Date: Thu, 16 May 2002 17:45:38 -0700

On Monday, May 13, 2002, at 12:56 AM, Evan Gross wrote:

I'm subclassing NSLayoutManager and implementing -drawUnderlineForGlyphRange
so that I can indicate various types of errors (not just spelling) in my own
NSTextView (this is NOT a global behavior I'm after - it's specific to my
app).

Ideally, I want the underline drawn just like it's done "normally", but I'll
be underlining in various colors.

Using Pixie, I can see that the underline is 3 pixels high, dashed (well, if
it's drawn using NSBezierPath) 3 on, 1 off.

This much I can *almost* get working - for some reason I just can't get the
line drawn to be 3 pixels high - it's always 2 or 4 (specifying
setLineWidth:3.0 yields a 4 pixel high line).

But there are other details that elude me (I've touched on many parts of
Cocoa with my project, but haven't done any actual drawing of my own - all
the widgets in my app draw themselves) - but this is my first venture into
the world of NSBezierPath et. al.

Specifically, the underline drawn for spelling errors appears to have a
gradient of some sort - light red at the top, darkest in the middle,
medium-light at the bottom.

The spelling-error underline is not yet public; it uses a pattern based on an image, with some additional adjustment for word boundaries. Even if we did make it public in its present form, it would not allow for multiple colors, since the gradient you see comes from an image rather than being programmatically generated. Until the AppKit exposes something like what you want, I'm afraid you are probably on your own.

Douglas Davidson
_______________________________________________
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.

  • Follow-Ups:
    • Re: Drawing an underline like the one used to indicate spelling errors?
      • From: Evan Gross <email@hidden>
References: 
 >Drawing an underline like the one used to indicate spelling errors? (From: Evan Gross <email@hidden>)

  • Prev by Date: Re: NSStringReference: Chinese encodeing
  • Next by Date: creating 'omni like' disk images
  • Previous by thread: Re: Drawing an underline like the one used to indicate spelling errors?
  • Next by thread: Re: Drawing an underline like the one used to indicate spelling errors?
  • Index(es):
    • Date
    • Thread