Variable (parametric) styles

Build 1501 on 14/Nov/2017  This topic last edited on: 11/May/2017, at 14:05

In a standard style, typographical parameters are hard coded when a style is created and end-users cannot change these parameters. Such styles are used for general formatting, either as paragraph or character styles.

This is suitable for text formatting when the formatting rules are complicated, e.g. you have 20 different headline sizes, each one in 10 different colors, each one underlined or not, or reverse or not, also in different colors.

Creating a separate style for each combination would be overwhelming, thus variable styles come handy.

You can apply variable styles by a style selector in the Text style toolbar.

When you apply a variable style, it displays a custom dialog box, where you can type values, for example, type size for the headline. In that way, a single style serves a range of formatting requirements.

See below an example of the variable style named Type size and leading, with tag name hldp, with two parameters:

Click to toggle graphic view

Notes

Since version 2.5, paragraph styles in Ted4, Fred4 and i4 support a new feature: when inserting a paragraph style with parameters, you may want the prompt dialog not to appear, because the parameters already have a default value that fits most of the times. Therefore, a new flag ('Prompt parameters dialog when inserting') is added to the paragraph styles editing dialog box on the 'Edit Paragraph Style' dialog box in EdAmin4. If you tick the flag (true), then the parameter dialog is opened as in previous GN4 versions. If you untick it (false), then the paragraph style is inserted into the text with its default values, without opening the parameter dialog box. The default is true. This new flag works only for the paragraph styles, both in i4 and in clients,

Note that, in clients, if you want to open the parameters dialog to edit an already existing paragraph style, you can run the following script commands:

Dim oCurParStyle As Style = Text.GetParaStyle

If oCurParStyle IsNot Nothing Then

  If Not oCurParStyle.Edit() Then

    Text.SetParaStyle(oCurParStyle)

  End If    

End If

Vice versa, in i4, you can click the paragraph style tag to open the parameters dialog.

Although you can enter default, minimum and maximum value for a variable style, e.g. 20pt as default, 10pt as minimum and 100pt as maximum value, it is not possible to define scattered range of values, e.g. 20pt as default, 10pt as minimum, 100pt as maximum value and 16pt, 14pt, 36pt, 52pt, 64pt, 72pt etc. as "allowed values". Thus there's no way to force users to select, 64pt or 68pt, but they can type 63.5pt as the height of the headline variable styles always prompt you for all values.

Variable styles support: single-line fields (with default values and control of length for strings or  min/max values for measurement units; list boxes (with alignment methods, colors, fonts and hyphenation rules); check boxes.

See also

Organizing Formats, Libraries and Styles

Editing GNML Formats, Libraries and Styles