in Getting started by
I want to know more details about font resources, their usage and the font management within Embedded Wizard: What is a font resource? What is the font cache? How to configure fonts?

1 Answer

0 votes
This article describes some basics about font resources, their usage and the font management within Embedded Wizard.

A font resource describes the attributes of a particular font with its size, attributes and character ranges.
This means, that for each font, for each font size or for each font style you need to declare an Embedded Wizard font resource. The background is, that most targets do not contain a TrueType font engine - therefore all fonts that are used within an UI application have to be converted into bitmap fonts. This means, that all single glyphs of all font resources are rasterized (with their particular size and attributes) and stored as compressed bitmaps.

During runtime, the situation is the following: When a string has to be drawn, each single glyph is loaded from the code memory, decompressed and stored within the font cache. As long as there is enough space within the font cache, all loaded glyphs remain within this cache. This means, in the near future, when the same or another string has to be drawn, the probability is high, that the required glyphs are already loaded within the font cache. If the font cache is full, the least used glyphs are removed.

In order to save code memory, you can limit the font range of each font resources to the character range you need! With the attribute 'Ranges' a set of characters can be specified for the font conversion. Only the characters listed in this attribute are affected. The simplest set consists of a single character (e.g. '0'). To define a range of characters the first and the last character has to be specified (e.g. '0'-'9'). Instead of the character literals it is also possible to use the \x hexadecimal notation (e.g. '\x0030'-'\x0039') or decimal notation (e.g. 48-58). The Ranges attribute allows the programmer to specify more than one character range for a single font resource. In this case the ranges are separated by the comma sign (e.g. 'A'-'Z','a'-'z','0'-'9','\x0020'). All these characters will be then affected by the font conversion. In this manner different character ranges for different languages can be included into a single font resource.

By the way: How do you manage the different languages within your project? Within this support site you will find some interesting description how you can manage your strings for a multilingual project. The provided Excel sheet generates an Embedded Wizard unit containing all strings of your project. Additionally, this Excel sheet is able to generate the font range for your project.

Ask Embedded Wizard

Welcome to the question and answer site for Embedded Wizard users and UI developers.

Ask your question and receive answers from the Embedded Wizard support team or from other members of the community!

Embedded Wizard Website | Privacy Policy | Imprint