Please enable JavaScript to view this site.

 

Navigation: Tokens > Tip and Tricks

Minimizing The Space Taken Up By Tokens

Scroll Prev Up Next More

One of the problems of tokens is that they can often require more text than the output will ever contain.

 

For example, a Macro Token [1*2d] that contains 6 characters, is used where the maximum number of characters that will ever be displayed in the output file is 2 (numbers from 1-31).

 

Although this has no effect whatsoever on the finished output file, in grids where space is at a premium, this can lead to messy looking GridTemplates, or worse GridTemplates where most of the tokens cannot be seen because of text overflow.

 

A common trick is to only code the first and last characters of the token (ie. the front and back braces) in the font size required, and set the font size for the inside of the token to a much smaller value. When processing tokens, Q++Studio will replace the text of a token, using the font attributes of the first letter of the token only (ie, the front brace). The attributes of the other characters are totally ignored.

 

[1*2d]    [1*2d]    [1*2d]

 

Therefore the 3 tokens above will give the exact same result both in text and visually. Although the third presentation saves a little extra space, the second is usually preferred as it looks more balanced, and saves you from having to check that all braces are matched.

 

See also: other tokens tips and tricks.

 


Topic 108881, last updated on 18-Apr-2020