[Xerte] Re: Speaking of MarkWord

Julian Tenney Julian.Tenney at nottingham.ac.uk
Tue Jan 25 17:05:03 GMT 2011


Can you set the background via CSS? That would be much easier as then you could use styles and string.replace(), dropping in html to set the styles. However, I suspect not...

Otherwise you have to use getTextExtent() to

-- find the metrics of the end of the string leading up to the word you want to highlight - so you know where to start drawing
-- work out the w and h of the actual word, so you knowhow wide / deep to draw
-- draw the rect somewhere
-- loop over the string looking for match.

Be a useful engine method, because you'll be wanting a few functions to do this tidily.

From: xerte-bounces at lists.nottingham.ac.uk [mailto:xerte-bounces at lists.nottingham.ac.uk] On Behalf Of Julian Tenney
Sent: 25 January 2011 16:54
To: Xerte discussion list
Subject: [Xerte] Re: Speaking of MarkWord

Difficult bugger.

From: xerte-bounces at lists.nottingham.ac.uk [mailto:xerte-bounces at lists.nottingham.ac.uk] On Behalf Of Dave Burnett
Sent: 25 January 2011 16:54
To: Xerte list
Subject: [Xerte] Re: Speaking of MarkWord

Highlighter.
________________________________
From: Julian.Tenney at nottingham.ac.uk
To: xerte at lists.nottingham.ac.uk
Date: Tue, 25 Jan 2011 16:50:45 +0000
Subject: [Xerte] Re: Speaking of MarkWord
You want to draw a rectangle behind it, like a highlighter, or just make the text a different colour?

From: xerte-bounces at lists.nottingham.ac.uk [mailto:xerte-bounces at lists.nottingham.ac.uk] On Behalf Of Dave Burnett
Sent: 25 January 2011 16:47
To: Xerte list
Subject: [Xerte] Speaking of MarkWord

Xerte 2 desktop.

I don't need any interactivity, just a way to highlight a word or words in a string:
e.g. I would like this [word] to have a yellow highlight.

Method already exist?

Cheers;

Dave

This message and any attachment are intended solely for the addressee and may contain confidential information. If you have received this message in error, please send it back to me, and immediately delete it. Please do not use, copy or disclose the information contained in this message or in any attachment. Any views or opinions expressed by the author of this email do not necessarily reflect the views of the University of Nottingham.
This message has been checked for viruses but the contents of an attachment may still contain software viruses which could damage your computer system: you are advised to perform your own checks. Email communications with the University of Nottingham may be monitored as permitted by UK legislation.

_______________________________________________ Xerte mailing list Xerte at lists.nottingham.ac.uk http://lists.nottingham.ac.uk/mailman/listinfo/xerte This message and any attachment are intended solely for the addressee and may contain confidential information. If you have received this message in error, please send it back to me, and immediately delete it. Please do not use, copy or disclose the information contained in this message or in any attachment. Any views or opinions expressed by the author of this email do not necessarily reflect the views of the University of Nottingham. This message has been checked for viruses but the contents of an attachment may still contain software viruses which could damage your computer system: you are advised to perform your own checks. Email communications with the University of Nottingham may be monitored as permitted by UK legislation.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nottingham.ac.uk/pipermail/xerte/attachments/20110125/59fab852/attachment.html>


More information about the Xerte mailing list