6. Text

6.1 The <text> tag

One of the most fundamental components of X2D are <text> elements. Text elements consist of a line of text that can be displayed on the screen. Text elements are like any other components in that position, size, and color can be specified as attributes. Additional attributes for <text> components include font and fontsize. For example:

<x2d>
  <text position="60 20" font="arial" fontsize="12">hello</text>
</x2d>

Here, the word "hello" is inserted at position (60, 20) in the X2D document. Note that the font is 12 point Arial.

6.2 The <paragraph> tag

The <paragraph> tag (or <p> abbreviated) is similar to the text element however it presents a full paragraph of text that can wrap across lines and be justified. All newlines within a <paragraph> tag are ignored (following the whitespace rules defined in HTML).