These forums were permanently set to read-only mode on July 20, 2022. From that day onwards, no new posting or comment is allowed on the site, but the historical content remains intact and searchable.

A new location for posting questions about PlanetPress Suite is now available:

OL Learn - PlanetPress Classic (opens in new tab)

Topic Options
#58132 - 08/26/21 08:31 PM String length in inches (Measure)
ricks Offline
OL Guru

Registered: 04/17/10
Posts: 101
Loc: Seattle
I want to truncate a string based on the length of the string when using a specific font. I can't just count characters since the font is proportional.

Is there a Press Talk command to return the length? I thought I spotted something like this once, but can't find it now.

My thought is to check the length initially. If to long, remove characters on the right until the string will fit in the limited space I have.

Any help is appreciated.

#58133 - 08/27/21 12:10 AM Re: String length in inches (Measure) [Re: ricks]
Yannick Fortin Offline
OL Expert

Registered: 08/25/00
Posts: 354
Loc: Objectif Lune Montréal
The function you are looking for is stringwidth(). ;-)
Yannick Fortin, Team OL