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

  • From: David Pilling <flist@xxxxxxxxxxxxxxxxxxx>
  • To: davidpilling@xxxxxxxxxxxxx
  • Date: Sat, 20 Mar 2010 17:12:23 +0000

In message <mpro.kzktoq01qnfzk030i.lists@xxxxxxxxxxxxxxxxxx>, Steve Fryatt <lists@xxxxxxxxxxxxxxxxxx> writes

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

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

There's a lot of complexity in the bounding box. When I started writing DTP software, books would say things like "the point size is the height of the font from the highest ascender to the lowest descender" and it's not. A line of 12 point text, probably pokes 11 points above the line and 4 below. Depends on the font, and depends on the characters in use. Later versions of OP offer to calculate the bounding box for lines using characters 32..127 alone or plus characters 128..255.

and start coordinates correctly but getfontsize() returned zero.  Is there
something else I'm missing, or is there a better way to do this?

The thing that springs to mind is "caretcontext()" some functions need you to call this function first to read the values where the caret is.

(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.

Such as?



--
David Pilling
email: david@xxxxxxxxxxxxxxxxxxx
  web: http://www.davidpilling.net
 post: David Pilling P.O. Box 22 Thornton Cleveleys Blackpool. FY5 1LR UK
  fax: +44(0)870-0520-941


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

Other related posts: