Skip to main content
1-Visitor
April 23, 2018
Solved

length of a string in points APP

  • April 23, 2018
  • 1 reply
  • 3657 views

Hi,

 

How can I get the length of a string in points? (not the number of letters)

 

Florin

Best answer by GarethOakes

You're meant to run this during formatting so it picks up the current formatting properties. I haven't tested what it does outside of formatting context, it will pickup some defaults, but you can use PIs in the text string I believe (or wrap it in a styleSave(), styleChange(), and styleRestore()).

1 reply

16-Pearl
April 23, 2018

Here are a couple of options to measure a string:
APP code: <?show $^(#"Testing")>
JS code: var l = fLength(); l.text = 'Testing'; application.alert(l.makeAbsolute());

otudor1-VisitorAuthor
1-Visitor
April 24, 2018

Hi Gareth,

for application.alert(l.makeAbsolute()); statement I get a message of "69.5666mm" and for

application.alert("length : " + l.makeAbsolute()); statement I get a message of "695666" only.

 

Do you know why? and in what unit is the second message? micrometers?

 

mak.png mak2.png

Florin

 

 

 

16-Pearl
April 25, 2018

The second way you're forcing to a string value, the first is returning an fLength. The second value is in APP's base measurement units known as "decimicrons". You can use these units everywhere in APP by using the "dm" unit suffix.