StoreCenter Help : Online Editor : Variable Actions Samples : Change Typeface for Copy Fitting
Change Typeface for Copy Fitting
Fitting text in a frame (see “Copy Fitting Styles and Style Settings”) by simply scaling text is not always desirable. An alternative solution is to apply a narrow typeface when a line becomes too long. This switching between a regular and a narrow typeface as the user types the text can be automated with the following action.
For the example below, two fonts are available in the document: Micron-Regular and Micron-Narrow. The text uses a character style called 'Title' and the action changes the typeface of this character style if the user enters more than 25 characters in a variable called 'City'. The 'On Change' action is applied to this variable.
Action type: On Change
Action code:
1 set characterStyle Title font = font Micron-Regular id
2 if stringFunctions length string variable City value > string 25
3 set characterStyle Title font = font Micron-Narrow id
4 end if
doc. version 6.0.4