42 views
in Getting started by
We are having a use case of setting text based on the run time input from external application.Input includes fontname and size.We made the requested fonts avalible as static resource since size value is very dynamic it is not possible to make it as static.

Please let me know is there any way to change the font height in run time.

1 Answer

0 votes
by

Hello,

changing the size of an already generated font at the runtime is not possible. The associated font information is already prepared for the predetermined size. Especially the glyphs are already rasterized. I see following approaches for your application case:

Option 1: Use several font resources configured with meaningful size values and switch the fonts when the text is scaled. Disadvantage: your project will occupy more flash to store the different font variants.

Option 2: Display the text in a GUI component, which is scaled then. To display a scaled image of a GUI component you use the Warp Group view. Disadvantage: due to the scaling the text may appear slightly blur.

Option 3: Combine the option 1 and 2. In this case use few font sizes (option 1) and to get results for some size lying between do scale the component (option 2).

Option 4: Use extern TrueType font engine. We provide a dedicated variant of Platform Package able to work with a TrueType font engine (e.g. FreeType). In this case the font data is estimated and the glyphs are rasterized at the runtime. Disadvantage: usage of TrueType engines expects more powerful HW and more RAM. Also you need to store the complete TTF files in your target system even if you need only few glyphs.

Does it help you further?

Best regards

Paul Banach

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

...