Working with Text

Storyboard gives you the ability to create and control text content with the text render extension. This render extension offers a single styled text display with options to control the text alignment, text overflow behaviour along with line and inter-character spacing. The text will be rendered using the font and point size selected in the property panel.

Storyboard uses standard TrueType (*.ttf) and OpenType (*.otf) font files and includes a number of commercially redistributable fonts. As these distributed fonts are selected and used the font will be copied to the fonts directory of the project. To use a custom TrueType or OpenType font in your application you just have to copy the font file into the fonts directory of the project. Once the font is parsed and analyzed it will show up for selection and use in the Font property selection.

By using the font files directly Storyboard offers developers total control over what resources are used on the embedded system. For example a system that uses a specific font for only numeric elements can be edited to remove all other glyphs. Similarly several different fonts can be merged together to provide broader language support for a particular product. The editing of these font files can be done with standard commercial editing tools such as FontForge or TypeTool among others.

To support internationalization and broad character support, Storyboard uses UTF-8 encoding universally for all text rendering. As long as the selected font contains support for the Unicode code points described by the encoding, Storyboard will be able to display the content. Support for advanced bi-directional text layout is provided by third party Crank Software partners and is discussed in more detail in Text Shaping and Layout..

There are times when you will want to make formatting choices on your text based on the content you are displaying. Situations like this usually come up when dealing with internationalization and handling languages that have more characters than can be displayed or require a simple layout re-ordering to be displayed right to left. In these cases Storyboard provides you with ways to gather metrics about the text being displayed through the built in Crank Storyboardgre.get_string_size With the functionality provided by the Lua API you can choose to do things like reduce the font size of your text if the language you are displaying is more verbose. The Scrolling Text sample provides an example of how to use this Lua text API to size and measure text and adapt it to a particular display environment.

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

0 comments

Article is closed for comments.