Text Renderer

The Text Renderer displays individual strings from a string list with a selected font setting. The font may be different from the setting used for the display of the string list. It is also possible to specify a maximum width and height for the displayed strings.

This function is used for the development of programs for devices that have their own graphic displays (embedded systems). Since such displays are normally limited in size, all strings have fit into the available space.

In this display it is easy to tell when the text is too big. The current size (in pixels) is displayed below the sting. If the displayed text exceeds the specified maximum size it is colored red.

Preparing a Project

To enable use of the Text Renderer in a project, you will need to define certain properties of the given resources and strings. This is done by means of the Tools > Text Renderer > Prepare project for text rendering. After this command is carried out the respective resources and strings contain additional properties.

To define a resource for rendering select it in the tree display of a string list and open the More tab in the property window. Then activate the Render text option.

Defining Fonts

You don't specify the font to be used for text display directly. Instead you enter a name (alias) that will be mapped to a font setting. To edit a font mapping, open the setup dialog for the Text Renderer add-in (see Add-in Configuration). Alternatively you can select Tools > Text Renderer > Setup.

This dialog lists all the font mappings defined in the current project.

To define a new font mapping:

  1. Click Add.
  2. Enter a new Alias name.
  3. Click Select to choose a font (from the fonts installed on your computer).
  4. You can now adjust the size or change the render method. Use one of the GDI+ methods, if you need a fraction number as font size (e.g. 10.5).. The method GDI has been used in Passolo 2007. It allows only integral point sizes (10, 11, ...) You can also choose, if the size is entered as points or as pixels.

If you have more than one project open you can copy font mappings from one project to another by simply dragging the respective entry in the tree with your mouse.

The <Default> mapping is always used when no font alias is specified for a string or the specified alias is not available.

Size Specifications

Once you have prepared the project and defined the font mappings you can enter the required specifications for individual strings. It is advisable to make these specifications in the source string list so that they are automatically carried over to the translation lists for all target languages when the translation lists are updated.

If you do not specify a width or height (i.e. if you leave 0 as the value) the corresponding measurement will not be checked. If you do not select a Font or if you specify an alias that is not available, the <Default> mapping is used.

Automatic Loading of Size Data with the XML Parser

If an XML source file contains the data for max. width, max. height or font as attributes of the data elements, the corresponding rule can be modified so that this data is automatically applied to the Text Renderer.

This is done by entering the corresponding values as metadata in an XML data element and setting the Action to Set maximum width, Set maximum height or Set font.

With a data element of the form
sample text

you can define the attribute maxwidth as metadata for the data element text with Set maximum width as the action.

See Specifying Elements and Attributes in the XML Tree.

Text Renderer Display

The Text Renderer is displayed like a resource (e.g. a dialog). To display the Text Renderer, open the text resource (via View tab > Show Resource or Ctrl+R) and choose the Text Renderer as the resource display (via View > Resource Display or the icon above the string list).

If the Text Renderer is not displayed:

  • Is the Text Renderer add-in installed and loaded (see Add-in Configuration)?
  • Has the preparation of the project been carried out (see above)?
  • Has the Text rendering property of the resource been selected? If you do this afterwards you will need to call up the display of the resource again, for example by closing the resource and opening it again (press Ctrl+R twice).