Re: Drawing an underline like the one used to indicate spelling errors?
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: Evan Gross <email@hidden>
- Date: Thu, 16 May 2002 22:09:24 -0400
On 5/16/02 8:45 PM, "Douglas Davidson" <email@hidden> wrote:
>
>
On Monday, May 13, 2002, at 12:56 AM, Evan Gross wrote:
>
>
>
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
>
Yes, after a couple of nights of trying to get something acceptable working
(based on using an image like the spellingdot one) I discovered that there
are other (unexposed, as you state) methods used to draw the spelling
underline. Subclassing NSLayoutManager and overriding
drawUnderlineForGlyphRange to deal with my own underline variant just isn't
giving the results I want because (as I'm sure you know) the glyph range
passed in isn't always quite right for drawing the spelling underline.
Sigh.
Guess I can just do what I'm doing, but draw the underline differently (just
use NSBezierPath I guess) and make do with the slightly-less-good-looking
results.
Maybe I'll file an enhancement request to get those APIs exposed.
Meanwhile, if you can suggest a good, efficient way for me to draw a dotted
underline using drawUnderlineForGlyphRange I'd be happy for the advice. One
issue is that if there are character attribute changes within a word, you
get handed a glyph range that doesn't "cover" the entire word, making it
tricky to get the line dash spacing right.
Thanks!
Evan Gross
Rainmaker Research Inc.
P.S. Just a minor observation, not sure where the "problem" lies, but if you
zoom in when there are spelling underlines onscreen in TextEdit they don't
scale like regular underlines do...
_______________________________________________
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.