Font is not shown correctly when switch the language.

asked May 18, 2017 in GUI Development by linglongzhu

Specify the default language to A font and the japanse language to B font to the Font. Switch the language to the defalut, but the text is show with font B, not the font A. Is there something wrong?

The sample is as following:

1 Answer

+1 vote
answered May 18, 2017 by Paul Banach


as mentioned in the article Localize a font resource Embedded Wizard merges the font information specified in the individual language variants to one 'virtual' font. This permits to output text containing glyphs from different fonts.

In your particular case the not working font resource is configured with following attributes:

This means the resulting 'virtual' font will contain glyphs from the font DINCond-Bold and Arial Unicode MS. This you have specified in the attribute FontName. Now take a look at the attribute Ranges. It specifies which glyphs you want to use from the corresponding font specified in the attribute FontName.

In your particular case, the virtual font should contain the glyphs 0x20-0x7F from the font DINCond-Bold.The same range, however, is also specified for the other font Arial Unicode MS. In other words, the ranges overlapp.

This should be avoided. Actually, Embedded Wizard accepts such incorrect attribute values and retains the latest evaluated value. Please try to adapt the values for the attribute Ranges, so these don't overlapp.

In the next Embedded Wizard version we plan to output a warning in case of overlapping ranges in order to indicate such error sources.

Does it help you further?

Best regards

Paul Banach

commented May 19, 2017 by linglongzhu
Thanks for your answer.  But maybe we need to show the same char for different language because we using different font for the languages. Is there a quick way to implement this requirement?
commented May 19, 2017 by Paul Banach

In such case you will need to handle with two individual font resource members in your project. One configured to use fonts for the language A and the other for the language B. Then depending on the actually active language you select the first or the second font resource.

For example. Let's assume you have a Text view in a component you want to display text in language A or language B, then following code will assign the right font resource to the Text view:

if ( language == LanguageA )
  TextView.Font = SomeUnit::FontForLanguageA;

if ( language == LanguageB )
  TextView.Font = SomeUnit::FontForLanguageB;

Just ensure that this code is executed at the initialization time of the component. You can do this also dynamically when the language is changed.

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