Tag-based formatting

Informations

Author: Pascal Morin
License: Free for non-commercial use

Description

This extension lets you display several paragraphs inside a frame. The use of tags allows to change the font, the style (bold, italic, underline), the size, and the color of characters.

To do this, 2 methods are available:

- The first one to define your tags:

SetStyle(string tag, string family, string style, int size, string color [, int indent])

tag: name of the tag
family: family of the font
style: N (normal) or combination of B, I, U
size: size
color: color (comma-separated RGB components)
indent: to be specified for the paragraph tag; indents the first line by the indicated value

It is possible to use empty strings or null values, except for the paragraph tag. The values are obtained by inheritance; for instance, with <p><u>, the non-specified values of <u> are replaced by those from <p>.

- The second one to output text:

WriteTag(float w, float h, string txt [, int border [, string align [, int fill [, mixed padding]]]])

w: width of the line (0 to go from one margin to the other)
h: height of a line
txt: text to display - must have at least one tag at beginning and end to delimit a paragraph
border: 0 for none, 1 to have a border (default value: 0)
align: justification of text: L, R, C or J (default value: J)
fill: 0 for none, 1 for background filling (default value: 0)
padding: either a numerical value or a string of the form "left,top,bottom,right" with 2, 3 or 4 specified values (default value: 0)