Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: drawing images on text face after displayed = "highlighting text"

From: henrikmk:gmai:l at: 1-Oct-2008 14:26

On Wed, Oct 1, 2008 at 2:14 PM, Alan Macleod <fergus4-bellatlantic.net> wrote:
> Henrik, > > I was going to map the start and endpoints using caret_to_offset on find > text and find/tail text. And knowing the text field width paint multiple > boxes to fit the shape. Not pretty but I think good enough for what I want.
I use almost the same method.
> Or is the function that highlight_start and highlight-end uses available or > is it hidden too deep (not mezzazine) > > Anton, or Henrik, > > Is it possible to use the draw dialect to "paint" these highlights? The way > a simple paint program pains into an area?
You can probably do that with the SHAPE command in DRAW. To ensure accurate painting, I would use SIZE-TEXT as it can accurately detemine the width and height of the area you need to paint per row. My implementation uses plain boxes and then SIZE-TEXT to calculate the size of one highlight box. It works for all font sizes I've tested so far. My only problem right now is detecting the start and end point of multi-line text as I want a more accurate depiction of the selected text. To detect multiple line highlights: If the Y position of caret-to-offset is not identical for start and end position, then you are using multiple lines. -- Regards, Henrik Mikael Kristensen