IMPORTANT ANNOUNCEMENT

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
#54898 - 05/05/17 11:27 AM copyfitting text
Iris Offline
OL Newbie

Registered: 06/13/14
Posts: 6
Is is possible to apply copyfitting to a text box?

I have a variable list of names, and some are larger than the box and I want it to resize the font to fit inside the box.

Top
#54899 - 05/05/17 01:59 PM Re: copyfitting text [Re: Iris]
Philippe F. Offline
OL Expert

Registered: 09/06/00
Posts: 1984
Loc: Objectif Lune, Montreal, Qc
It is not natively available. See this previous post for a method to achieve the same thing.
_________________________
Technical Product Manager
I don't want to achieve immortality through my work; I want to achieve immortality through not dying - Woody Allen

Top
#56175 - 08/01/18 02:17 PM Re: copyfitting text [Re: Iris]
Iris Offline
OL Newbie

Registered: 06/13/14
Posts: 6
It is not quite working correctly for me.
I tried modifying what you suggested.

MoveTo(0,0)

define(&size,measure,0.0000)
define(&lngth,integer,12)
define(&limit,integer,12)

define(&FIRSTNAME,string,trim(@(13,1,80)))
define(&LASTNAME,string,trim(@(14,1,80)))

SetStyleExt(&Style1,&size,-1,-1,-1)

if(lt((stringwidth(&FIRSTNAME)+.125),&width))
BeginParagraph(0.0000,&Width,0.0000,'left',0.3333,False)
SetStyleExt(&Style1,76,-1,-1,-1)
Show(&FIRSTNAME)
EndParagraph()
elseif()
BeginParagraph(0.0000,&Width,0.0000,'left',0.3333,False)
SetStyleExt(&Style1,76*(&Width/stringwidth(&FIRSTNAME)+.125),-1,-1,-1)
Show(&FIRSTNAME)
EndParagraph()
endif()
crlf
crlf
crlf
crlf
if(lt((stringwidth(&LASTNAME)+.125),&width))
BeginParagraph(0.0000,&Width,0.0000,'left',0.3333,False)
SetStyleExt(&Style1,76,-1,-1,-1)
Show(&LASTNAME)
EndParagraph()
elseif()
BeginParagraph(0.0000,&Width,0.0000,'left',0.3333,False)
SetStyleExt(&Style1,76*(&Width/stringwidth(&LASTNAME)+.125),-1,-1,-1)
Show(&LASTNAME)
EndParagraph()
endif()

The Last name will reduce in size but the first name does not.
It also wraps if there is a space in the first name, [GALILEO ALESSIO or MARY ANNE].

Any suggestions?

Top
#56187 - 08/03/18 09:16 AM Re: copyfitting text [Re: Iris]
Raphael Lalonde Lefebvre Offline
OL Expert

Registered: 10/14/05
Posts: 4956
Loc: Objectif Lune Montreal
Hi Iris,

Paragraphs behaves this way: if there's a space, and it can't fit the next word, it will automatically wrap to a new line.

Have you tried combining the first and last name into a single variable instead of using two variables? This way, it would apply the resizing to both words at once.

Regards,
Raphaël Lalonde-Lefebvre

Top
#56520 - 11/20/18 01:38 PM Re: copyfitting text [Re: Iris]
Iris Offline
OL Newbie

Registered: 06/13/14
Posts: 6
The customer wants the first and last name on separate lines.

eg: TOM
SMITHE

Top
#56959 - 04/24/19 07:34 AM Re: copyfitting text [Re: Iris]
Iris Offline
OL Newbie

Registered: 06/13/14
Posts: 6
Okay, I got both to resize at the same time. But it shifts down
.25" each time it shrinks down the font. Tried snapping points, but that does not work. Any other ideas?

Top
#57306 - 11/15/19 07:19 AM Re: copyfitting text [Re: Iris]
Iris Offline
OL Newbie

Registered: 06/13/14
Posts: 6
The name placement needs to be 4 inches from the top of the page.
When the name shrinks down it moves the position down on the page. Is there a way to freeze the position on the page.
MoveTo(0,0)


define(&size,measure,0.000)
define(&lngth,integer,15)
define(&limit,integer,15)

define(&FIRSTNAME,string,trim(@(13,1,80)))
DEFINE(&LASTNAME,string,trim(@(14,1,80)))

define(&code,string,trim(@(15,1,80)))

SetStyleExt(&Style1,&size,-1,-1,-1)

if(lt((stringwidth(&code)+.125),&width))

SetStyleExt(&Style1,74,-1,-1,-1)

elseif()

SetStyleExt(&Style1,74*(&Width/stringwidth(&code)+.125),-1,-1,-1)


endif()

if(lt((stringwidth(&FIRSTNAME + &LASTNAME)+.125),&width))

SetStyleExt(&Style1,74,-1,-1,-1)
Show(&FIRSTNAME)
crlf
crlf
crlf
crlf
crlf
crlf


Show(&LASTNAME)

elseif()

SetStyleExt(&Style1,74*(&Width/stringwidth(&FIRSTNAME + &LASTNAME)+.125),-1,-1,-1)
Show(&FIRSTNAME)
crlf
crlf
crlf
crlf
crlf
crlf

Show(&LASTNAME)

endif()

Top