17 views
in Embedded Wizard Studio by

Hello EmWiz team,

I'm trying to use in a project a font with a name greater the 32 characters: "Fira Sans Extra Condensed Medium". The problem I'm having is that I get a quite annoying warning that the Font name is too large and it's automatically truncated.   

Warning Res::FontRegular.FontName.Default : The font name 'Fira Sans Extra Condensed Medium' in the font resource 'Res::FontRegular' is too long. It will be truncated to 'Fira Sans Extra Condensed Mediu'.

Is there a way this to get around this warning without manually modifying the Font name using some font editing tools?

 

It also might be seen as a bug in EmWiz because if you select the Font from the drop down menu the actual selection in the property field is the truncated name: ""Fira Sans Extra Condensed Mediu". And you get the following warning:

Warning Res::FontRegular.FontName.Default : The font with the specified name 'Fira Sans Extra Condensed Mediu' is not available on this Windows system. Instead the font with the name 'Fira Sans Extra Condensed Medium' has been used for the font conversion. This can result in text being rendered differently. If necessary ensure that correct TTF font files are installed on your Windows system.

So either way you get a warning message.

Best regards,

Alex

1 Answer

0 votes
by
 
Best answer

Hello Alex,

thank you for this very interesting report. There are in fact two separate aspects to consider:

1. The font name restriction to 32 character:

This restriction is Windows specific. The Win32 API used to search for and load a TrueType font accepts 32 characters only (including the zero terminator sign). Effectively Windows uses 31 characters to find the desired font. To avoid potential user errors Embedded Wizard respects this restriction and if you specify a font name longer than 31 characters, it reports a warning. Consequently, the font names listed in the Assistant window are also truncated to 31 characters.

Nevertheless Windows is able to find the desired font as long as the first 31 characters match the name in a TrueType font file. In your case it is sufficient to use the name 'Fira Sans Extra Condensed Mediu' (without the last m letter). As you see in the following screenshot, it produces the correct outputs:

2. The second warning because of not available font:

Embedded Wizard double checks whether Windows has really found and loaded the right font. The background: if the specified font is not available on the Windows machine, Windows font engine simply selects another font without reporting any error code. Consequently, if you give your Embedded Wizard project to your colleague and he/she has not installed the appropriate TrueType font, Windows would use another font silently. This would produce another text outputs in your GUI application. To detect such errors, Embedded Wizard after selecting the font asks Windows for the real name of the selected font and compares this name with the originally specified.

Bizarrely, the for this purpose used Windows API returns the complete TrueType name (longer than 31 characters). As consequence, this name will not match the original truncated name. Embedded Wizard reports a warning again.

This behavior results from an evidently inconsequent implementation of the Windows API and is new for us. So far the technical background for the issue. In the next release we will adapt the comparison operation to respect the first 31 characters only so that the second warning is not reported anymore. For the moment I would ask you to simply ignore the warnings. Anyway Windows does select the right font.

I hope it clarifies the issue a little bit.

Best regards

Paul Banach

Embedded Wizard Website | Privacy Policy | Imprint

...