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

  • From: Anthony Hilton <ajh@xxxxxxxxxxxxxxxxx>
  • To: davidpilling@xxxxxxxxxxxxx
  • Date: Sat, 20 Mar 2010 15:58:59 GMT

In message <mpro.kzktoq01qnfzk030i.lists@xxxxxxxxxxxxxxxxxx> dated 20 
Mar 2010
          Steve Fryatt <lists@xxxxxxxxxxxxxxxxxx> wrote:

> 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!):

[snip]

> 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?

Wild guesses follow:
Did the local effects change the font size so that the selection 
contained multiple font sizes?
Had the cursor been positioned between the close of a previous font 
size and the open of a next font size? e.g. if the cursor is the pipe 
(|) in the following is font size not defined and therefore returned 
as zero?
<12pt>some 12 point type</12pt>|<10pt> and some 10 point</10pt>

Distracting comments follow:
Depending on what you are doing, you may need to consider the line 
spacing rather than the size of the text to define your bounding box, 
eg by combining getleading() and getfontsize() appropriately for the 
format returned by getleading().

Lock to baseline grid can also have a dramatic affect line spacing.

Hoping there is some sense and relevance in this response.

Anthony

-- 
Anthony Hilton
ajh@xxxxxxxxxxxxxxxxx
To unsubscribe or subscribe goto: //www.freelists.org/list/davidpilling

Other related posts: