Text and fonts
Text properties are inherited: set them once on an outer box and every text inside takes them. This lesson covers the properties that change how text looks and how it is cut.
Font, size and colour
font takes a list of families; the words sans, serif, mono and system name the generic ones, and the first family that exists is used. font size is a length, font weight is a word (light, normal, bold, black) or a number from 100 to 900, and italic is true or false. line height is a number of times the font size.
page:
title = "Text"
box:
padding = 24
max width = 480
color = #1f2937
font = "Vazirmatn", sans
heading: size = 2 font weight = black letter spacing = 1 content = "A headline" end
paragraph:
font size = 18
line height = 1.6
text align = justify
content = "Text properties are inherited. Set the colour and the font on the outer box and every paragraph inside uses them."
end
paragraph: italic = true content = "Italic text." end
paragraph: transform text = upper content = "shouting" end
end
endInheritance
Properties of text are passed down to children: color, font, font size, font weight, italic, line height, letter spacing, text align and the others in the text part of the reference. Box properties such as padding are not inherited.
Alignment and direction
text align is start, center, end or justify. Start and end follow the text direction, so the same page works in English and in Persian. direction is auto, ltr or rtl.
Cutting and shadows
ellipsis = true keeps one line and ends it with three dots. max lines = 2 does the same for two lines. white space = keep keeps spaces and newlines. transform text changes the case, and text shadow takes x, y, blur and colour.
page:
title = "Clipped text"
box:
padding = 16
gap = 12
width = 280
paragraph: ellipsis = true content = "One line only, so a long sentence ends with three dots." end
paragraph: max lines = 2 content = "At most two lines. The rest of this long paragraph is cut off and replaced by an ellipsis, however long it is." end
paragraph: white space = keep content = "spaces are kept" end
paragraph: text shadow = 0, 1, 2, #00000080 font size = 24 content = "Shadow" end
end
endNext: colours and backgrounds.