Skip to main content
DCost.1
Associate II
March 5, 2020
Solved

Can't recognize numbers with Unicode

  • March 5, 2020
  • 2 replies
  • 1717 views

Hi,

I'm building a program which has a part that is similar to the "Flex Button Example".

0690X00000DYl45QAD.png

In my case I've got a problem with Unicode. My program works the same as the image above. When I reach to number 24, 26, 28, 29, this is what it shows:

0690X00000DYl2xQAD.png

This is my code:

touchgfx::TextAreaWithOneWildcard texto;
touchgfx::Unicode::UnicodeChar* memoria;
int tama;
 
IP_AdressView::IP_AdressView()
{
 
}
 
void IP_AdressView::adress1_button_pressed()
{
 adress1_button.setBoxWithBorderColors(touchgfx::Color::getColorFrom24BitRGB(169, 172, 173), touchgfx::Color::getColorFrom24BitRGB(169, 172, 173), touchgfx::Color::getColorFrom24BitRGB(0, 0, 0), touchgfx::Color::getColorFrom24BitRGB(0, 0, 0));
 texto = adress1;
	memoria = adress1Buffer;
	tama = ADRESS1_SIZE;
	buttonUppressed();
	buttonDownpressed();
}
 
void IP_AdressView::buttonUppressed()
{
 int tmpVal = Unicode::atoi(texto.getWildcard());
 if (tmpVal >= 0)
 {
 tmpVal++;
 Unicode::snprintf(memoria, tama, "%d", tmpVal);
 texto.invalidate();
 	touchgfx_printf("%d\n", tmpVal);
 
 if (tmpVal >= 300)
 {
 buttonUp.setAlpha(100);
 buttonUp.setTouchable(false);
 buttonUp.setPressed(false);
 buttonUp.invalidate();
 }
 }
}
 
void IP_AdressView::buttonDownpressed()
{
 int tmpVal = Unicode::atoi(texto.getWildcard());
 if (tmpVal >= 0)
 {
 tmpVal--;
 Unicode::snprintf(memoria, tama, "%d", tmpVal);
 texto.invalidate();
 
 if (tmpVal <= 0)
 {
 buttonDown.setAlpha(100);
 buttonDown.setTouchable(false);
 buttonDown.setPressed(false);
 buttonDown.invalidate();
 }
 }
}

And then, when I print the number through the TouchGFX Terminal, it works fine:

0690X00000DYl87QAD.png

I would appreciate your help.

Thanks,

Dani

This topic has been closed for replies.
Best answer by LTimm.1

Looks like the glyphs are missing. "?" is the default fallback character when TouchGFX can't find the glyph.

By default TouchGFX only includes the glyphs, from the font, that are required. When using wildcards you need to tell TouchGFX which glyphs it should include.

This is done in the Designer under typographies. I think it's called "wildcard ranges".

It's mentioned in this article: https://touchgfx.zendesk.com/hc/en-us/articles/207015345-Using-texts-and-fonts

2 replies

LTimm.1
LTimm.1Best answer
Associate
March 5, 2020

Looks like the glyphs are missing. "?" is the default fallback character when TouchGFX can't find the glyph.

By default TouchGFX only includes the glyphs, from the font, that are required. When using wildcards you need to tell TouchGFX which glyphs it should include.

This is done in the Designer under typographies. I think it's called "wildcard ranges".

It's mentioned in this article: https://touchgfx.zendesk.com/hc/en-us/articles/207015345-Using-texts-and-fonts

DCost.1
DCost.1Author
Associate II
March 6, 2020

It worked, that was the problem.

Thanks a lot!