Skip to main content
1-Visitor
Apr 23, 2018 8:20 PM UTC
Solved

length of a string in points APP

Hi,

 

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

 

Florin

16-Pearl
Apr 26, 2018 2:50 AM UTC

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

5 replies

16-Pearl
Apr 23, 2018 10:37 PM UTC

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());

Translate
otudor1-VisitorAuthor
1-Visitor
Apr 24, 2018 2:48 PM UTC

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

 

 

 

Translate
16-Pearl
Apr 25, 2018 12:14 AM UTC

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.

Translate