| 1 |
This document describes the syntax for text objects in the scene graph. |
| 2 |
Text nodes are configured using XML and may appear within a model description |
| 3 |
file, like other models or the particlesystem. |
| 4 |
|
| 5 |
For the anxious reader, here is a complete example of a text node: |
| 6 |
|
| 7 |
<!-- Must be enclosed by a <text/> node |
| 8 |
<text> |
| 9 |
<!-- It should have a name. Can be used for other animations --> |
| 10 |
<name>My first Text</name> |
| 11 |
<!-- Use offsets for the initial placement --> |
| 12 |
<offsets> |
| 13 |
<pitch-deg>0</pitch-deg> |
| 14 |
<heading-deg>0</heading-deg> |
| 15 |
<roll-deg>0</roll-deg> |
| 16 |
<x-m>0</x-m> |
| 17 |
<y-m>0</y-m> |
| 18 |
<z-m>0</z-m> |
| 19 |
</offsets> |
| 20 |
|
| 21 |
<!-- instead of using pitch/heading/roll offset, one may use |
| 22 |
axis-alignment --> |
| 23 |
<!-- remember: x backwards, y right and z up --> |
| 24 |
<axis-alignment>xy-plane</axis-alignment> |
| 25 |
<!-- |
| 26 |
<axis-alignment>reversed-xy-plane</axis-alignment> |
| 27 |
<axis-alignment>xz-plane</axis-alignment> |
| 28 |
<axis-alignment>reversed-xz-plane</axis-alignment> |
| 29 |
<axis-alignment>yz-plane</axis-alignment> |
| 30 |
<axis-alignment>reversed-yz-plane</axis-alignment> |
| 31 |
<axis-alignment>screen</axis-alignment> |
| 32 |
--> |
| 33 |
|
| 34 |
<!-- what type of text to draw, use on of literal, text-value or number-value --> |
| 35 |
<!-- A simple constant, never changing string --> |
| 36 |
<type type="string">literal</type> |
| 37 |
<text type="string">Hello, world!</text> |
| 38 |
|
| 39 |
<!-- The string value of a property --> |
| 40 |
<type type="string">text-value</type> |
| 41 |
<property type="string">some/property</property> |
| 42 |
<format type="string">%s</format> <!-- the printf() format to display the value --> |
| 43 |
|
| 44 |
<!-- A number from a property --> |
| 45 |
<type type="string">number-value</type> |
| 46 |
<property type="string">position/latitude-deg</property> |
| 47 |
<factor type="double">1.0</factor> <!-- optional, scale the propertie's value --> |
| 48 |
<offset type="double">0.0</offset> <!-- optional, shift the propertie's value --> |
| 49 |
<format type="string">%5.2lf</format> <!-- printf() format to display --> |
| 50 |
<truncate type="bool">false</truncate> <!-- truncate to an integer value --> |
| 51 |
|
| 52 |
<layout>left-to-right</layout> <!-- default --> |
| 53 |
<!-- |
| 54 |
<layout>right-to-left</layout> |
| 55 |
<layout>vertical</layout> |
| 56 |
--> |
| 57 |
|
| 58 |
<draw-text type="bool">true</draw-text> <!-- draw the text itself --> |
| 59 |
<draw-alignment type="bool">false</draw-alignment> <!-- draw crosshair at object center --> |
| 60 |
<draw-boundingbox type="bool">false</draw-boundingbox> <!-- draw a bounding box --> |
| 61 |
|
| 62 |
<font>led.txf</font> <!-- The font file name, relative to data/Fonts --> |
| 63 |
<character-size type="double">0.01</character-size> <!-- size (height) im meters --> |
| 64 |
<character-aspect-ratio type="double">1.0</character-aspect-ratio> |
| 65 |
<max-height>0.012</max-height> <!-- the maximum height of the text --> |
| 66 |
<max-width>0.040</max-width> <!-- the maximum width of the text --> |
| 67 |
<font-resolution> |
| 68 |
<width type="int">32</width> |
| 69 |
<height type="int">32</height> |
| 70 |
</font-resolution> |
| 71 |
|
| 72 |
<!-- chose one of the kerning types or omit for default --> |
| 73 |
<kerning>default</kerning> |
| 74 |
<!-- |
| 75 |
<kerning>unfitted</kerning> |
| 76 |
<kerning>none</kerning> |
| 77 |
--> |
| 78 |
|
| 79 |
<alignment>center-center</alignment> <!-- alignment of the text itself --> |
| 80 |
<!-- possible values are |
| 81 |
<alignment>left-top</alignment> |
| 82 |
<alignment>left-center</alignment> |
| 83 |
<alignment>left-bottom</alignment> |
| 84 |
<alignment>center-top</alignment> |
| 85 |
<alignment>center-center</alignment> |
| 86 |
<alignment>center-bottom</alignment> |
| 87 |
<alignment>right-top</alignment> |
| 88 |
<alignment>right-center</alignment> |
| 89 |
<alignment>right-bottom</alignment> |
| 90 |
<alignment>left-baseline</alignment> |
| 91 |
<alignment>center-baseline</alignment> |
| 92 |
<alignment>right-baseline</alignment> |
| 93 |
<alignment>baseline</alignment> |
| 94 |
--> |
| 95 |
|
| 96 |
</text> |
| 97 |
|
| 98 |
The <text/> node may appear within <model/> or <PropertyList/> nodes. If you place |
| 99 |
your text directly within your model file, use <text></text> nodes. You can also put |
| 100 |
your <text> configuration into a separate file using the well known include directive: |
| 101 |
|
| 102 |
Your model.xml file: |
| 103 |
<model> |
| 104 |
<path>may-fancy-model.ac</path> |
| 105 |
<text include="HelloWorld.xml"/> |
| 106 |
</model> |
| 107 |
|
| 108 |
Your HelloWorld.xml: |
| 109 |
<PropertyList> |
| 110 |
<name>Hello World</name> |
| 111 |
<font>Helvetica.txf</font> |
| 112 |
<type type="string">literal</type> |
| 113 |
<text type="string">Hello, world!</text> |
| 114 |
<!-- etc. - you get the idea --> |
| 115 |
</PropertyList> |
| 116 |
|
| 117 |
Animation can be applied to text nodes like any other object. To give your text some |
| 118 |
color, use the material animation, or translate, rotate, scale or spin your text as |
| 119 |
you like. |