Hi, I'm displaying search results in an outine view, and want to show the 
portion of the text where the search term was found, by truncating both the 
start and end of the string (where necessary) so that the result is visible in 
the displayed portion of the string. I can see how to truncate at the head or 
tail or center using the built in truncation options, but nothing to give a 
range of characters I want visible and get it to truncate before and after 
where necessary.

I know enough about the string measurement stuff to be able to come up with an 
algorithm myself, but it would probably take a lot of work, when it may well 
already be a solved problem.

I tried searching for something that would do the trick, but didn't come up 
with anything.

Is there something already available that would take an attributed string, and 
the range you want visible and a rectangle (or size) to fit it in, and return a 
modified attributed string which will fit in that size, with ellipses at the 
start and/or end as required so that the required range is visible?

Thanks

Ken
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to