[softwarelist] Re: Finding position info using O-Pro scripts

  • From: Steve Fryatt <lists@xxxxxxxxxxxxxxxxxx>
  • To: davidpilling@xxxxxxxxxxxxx
  • Date: Sat, 20 Mar 2010 10:41:14 +0000

On 18 Mar, Steve Fryatt wrote in message
    <mpro.kzi22q04s9k68038q.lists@xxxxxxxxxxxxxxxxxx>:

> [...] I suspect I might be able to give some feedback on the new functions
> soon.

And they seem to do what was required.  I can now scan through a document
and locate start and end points of the baselines of pieces of text in a
given style, and output this information to a file.

The problem now is getting a bounding box: in other words, I need the height
of the line of text.  My assumption was that this could be based on the font
size, so I tried something like the following (which doesn't consider line
wraps in the text as yet!):

  // With the caret at the start of the style.
  setbmtocaret(bm);

  // ...find the end of the style with the caret...

  startx = bmgetx(bm)+getselectionx();
  starty = bmgety(bm)+getselectiony();
  startpage = bmpage(bm);

  setzonetobm(bm);
  height = getfontsize();

This seemed to work most of the time, but when I inserted some local effects
into one of the titles I was searching for it still found the title style
and start coordinates correctly but getfontsize() returned zero.  Is there
something else I'm missing, or is there a better way to do this?

(One problem I'm having is that the other applets I've got access to often
seem to do things that aren't described in the Script Manual.  It's often
hard to tell if this is necessary, or just how the author decided to do
something.)

-- 
Steve Fryatt - Leeds, England

http://www.stevefryatt.org.uk/
To unsubscribe or subscribe goto: //www.freelists.org/list/davidpilling

Other related posts: