Skip to main content
AMege
Associate II
July 12, 2019
Question

TextAreaWithWildcard displaying "?"

  • July 12, 2019
  • 7 replies
  • 1813 views

When I run this code:

void Screen1View::startSession()
 
{
 
 Unicode::fromUTF8((const uint8_t*) "Hello world!!", longTxtBuffer, LONGTXT_SIZE);
 
 longTxt.invalidate();
 
}
 
 

it works as expected.

However, when I change it to:

void Screen1View::startSession()
 
{
 
 Unicode::fromUTF8((const uint8_t*) "Hello World!!", longTxtBuffer, LONGTXT_SIZE);
 
 longTxt.invalidate();
 
}

I'm seeing a ? instead of W in both simulator and target.

Is this a bug?

This topic has been closed for replies.

7 replies

Anders Nedergaard PETERSEN
Senior II
July 12, 2019

Hi Antoine,

I seems that you have pasted the same code snippet twice.

When TouchGFX displays a "?" instead of the desired character it is usually because the glyph for that unicode is not within the wildcard characters/ranges.

You can add these characters in the Designer under Texts -> Topographies

0690X000009YgujQAC.png

Regards

Martin KJELDSEN
Principal III
July 12, 2019

I modified the title of the post to "TextAreaWithWildcard displaying "?" now that we know what the issue is about. I hope you don't mind, @AMege​.

/Martin

AMege
AMegeAuthor
Associate II
July 16, 2019

Hi Martin,

"I seems that you have pasted the same code snippet twice."

No, I did not, notice the capital W?

Thanks for your answer, I have now a better understanding how TouchGFX works with text and fonts and I have resolved the issue.

Next issue is how to have support for newlines in a text box...

Anders Nedergaard PETERSEN
Senior II
July 17, 2019

Hi @AMege​ 

Ah, yes I see, didn't catch that the first time i read it.

The text area where you have a wildcard which contains newlines, you need to remove the check "Auto-size" in the Designer and then expand the size of the text area.

0690X000009YoxRQAS.png

Adding new lines are done as usual with \n

	Unicode::fromUTF8((const uint8_t*) "Hello World!!\nNew line", textArea2Buffer, TEXTAREA2_SIZE);
	textArea2.invalidate();

Running the application will yields "New line" written on a new line for a wildcard text (BTW, pressing F3 creates a screenshot of the simulator)

0690X000009YoxCQAS.bmp

Here is a bit more documentation on how texts works in TouchGFX:

https://touchgfx.zendesk.com/hc/en-us/articles/207015345-Using-texts-and-fonts

/Anders

AMege
AMegeAuthor
Associate II
July 18, 2019

Removing Auto-size seemed a bit counter intuitive, but yes, that worked. Thanks!

Anders Nedergaard PETERSEN
Senior II
July 19, 2019

That's because the "auto-size" calculation is done before the code is generated -> The Designer calculates the size of the text input and then sets up the high and width of the text widget.

The wildcard rendering is done at run time, and thus the needed size of the text widget is unknown.

/Anders