104 views
in GUI Development by

Hi, 

In our project, while implementing globalization there is a memory increase found due to fonts.

Issue Statement:
    When adopting 13 languages including Russian, Chinese, and Japanese, Noto Sans and Noto JP were used.
    
    In our Project, 16 Resources::Font items are used with different heights and when trying to adopt globalization for these Resources::Font, due to the Japanese and Chinese languages it takes so much memory to generate glyphs.
    
    Due to the below changes, the size of 770742 bytes on fonts rose to 35561238 bytes.
    
    For example, 
    
    Before Globalization, as a default font range, 0x20-0xff is used.
    
    After Globalization implementation, for Chinese/Japanese and Russian, the Font Range was updated as 0x4E00-0x9FFF and 0x0410-0x044f respectively.
    
    Other languages have a default Font Range of 0x20-0xff.
    
    When code is generated along with the above changes for the particular profile, code generation is not successful and fails due to being out of memory.
    
    For every font, all the glyphs were generated.
    
    Kindly suggest any methods to minimize the repeated usage of this font range in the fonts to reduce the generation of glyphs by each font.

1 Answer

0 votes
by
Hello Vignesh,

assuming you have 16 different fonts, with different sizes (from small to possibly very big) and you want all languages to be displayed with all fonts, then you have to configure all necessary characters in all fonts. Then a lot of code is generated. This is inevitable.

What you can do:

1. Try to optimize the ranges. Are really all glyphs 0x4E00-0x9FF, etc. necessary in your application? The concept of 'ranges' exists especially for applications running on low-end systems with limited resources and permits the developer to select individually which glyphs will be needed. Not needed glyphs are not generated and don't occupy memory.

2. Use an external True Type font engine (e.g. FreeType)  to raster the glyphs at the runtime. This approach is recommended when different size of fonts with many glyphs are needed. To integrate with an external font engine, a dedicated Platform Package has to be licensed by TARA Systems. The usage of external font engine presumes that the target system has sufficient RAM and CPU resources to run the font engine.

Best regards

Paul Banach
by
Hello Paul,

Want to add one more point along with my previous message.

In our embedded wizard project, we have 16 Resources::Font types with different font sizes.

But in actuality, we have four base fonts(For Eg: Noto Sans, Noto Sans JP, Arial, and Times New Roman) with different sizes.

Is possible to declare only base fonts in the project and sizes can be handled dynamically? Like having a stylesheet kind of configuration file where it has sizes mapped with base font types.
by

Hello Vignesh,

Is possible to declare only base fonts in the project and sizes can be handled dynamically?

Per default, the font glyphs are stored as bitmaps. It means they are rasterized at the code generation time for the specified size. Changing the size at the runtime is not possible unless you scale the bitmaps with ugly results. This mode is useful for most projects and targets with limited resources. The glyphs can be processed quickly with less resource impact.

When using an external TrueType font engine (as mentioned in my preceding answer), the glyphs are rasterized at the runtime. This allows you to manage many Font Resource members - each configured with other size. The Font Resources in such case only limit to refer the TrueType font and the desired size. They don't occupy much memory. With this approach you can even specify the font size dynamically. See Using dynamically configured fonts. This approach is much more CPU and RAM intensive due to the TrueType font engine running in the target system. Also the TrueType font files have to be stored in the target system.

Best regards

Paul

Embedded Wizard Website | Privacy Policy | Imprint

...