cancel
Showing results for 
Search instead for 
Did you mean: 

Space character displays as Fallback character (bug?)

ypiotrp
Senior

Hi!

In my project I added a text area with one wildcard. I checked option "Use wildcard buffer", but left "Initial value" blank. Then in setupScreen() function I wrote some text to the wildcard buffer using Unicode::strncpy(). After starting my project in simulator to my surprise the text showed up with spaces displayed as fallback characters (?). I added some characters to the wildcard characters space was there too. I tried everything and in the end I set the initial value of the text area for some text with space in it. Then the wildcard text was rendered correctly with spaces.

Am I doing something wrong or is it some sort of bug?

Regards,

Piotr

1 ACCEPTED SOLUTION

Accepted Solutions

Hello,

I successfully managed to reproduce your error finally, and I understood why it is behaving like that :

TouchGFX only generates the glyphs it needs because of memory size matters. That means that if you have not already an other text in your application with space characters on this particular typography, it won't generate the space symbol in the font file I previously mentioned and you will get a fallback character in your TextArea.

So you have some option to force the space character to be included in your font :

  • The one I suggest, add the ASCII symbol of the space character (0x20) in the "Wildcards Ranges" parameter of your typography.

0693W00000Sw51MQAR.png

  • Add a space character between to other symbols ("a b" for example) in the "Wildcards Characters" parameter of your typography. You have to include it between 2 symbols, otherwise TouchGFX will skip the space and only include the other character glyph.

0693W00000Sw4xuQAB.png

  • Add another TextArea using the same typography and display a text with spaces inside to force TouchGFX to include the symbol for this font.

0693W00000Sw53cQAB.png 

For me the first solution is the best and cleanest, but you can do what arrange you the most.

Hope that this solves the issue,

/Yoann

Yoann KLEIN
ST Software Developer | TouchGFX

View solution in original post

6 REPLIES 6
Yoann KLEIN
ST Employee

Hello,

I just did a simple project with a TextArea with one wildcard also and I display "hello sp" inside the wildcard with the Unicode::strncpy() method. I haven't observed any bugs related to that, but there is maybe something you forgot.

  • Did you remember to allow characters in wildcards by specifying the wildcard range in the text parameters ?

0693W00000SvzcRQAR.pngThere is the code of my setupScreen() method :

void Screen1View::setupScreen()
{
    Screen1ViewBase::setupScreen();
    char str[] = "hello  sp";
    Unicode::strncpy(textArea1Buffer, str, TEXTAREA1_SIZE);
    textArea1.invalidate();
}

My screen :

0693W00000SvzdtQAB.png 

Let me know if you find the reason why it doesn't work for you.

/Yoann

Yoann KLEIN
ST Software Developer | TouchGFX
ypiotrp
Senior

Hello Yoann!

Thank you for your reply.

Yes, I added the wildcard characters to the Wildcard ranges section that you mentioned about.

As I see it your example works because you added space character in the text area before the wildcard. Could you please show me your text area configuration section in TouchGFX Designer?

For example mine looks like this:

0693W00000SvzfCQAR.pngYours possibly looks like this:

0693W00000SvzfRQAR.pngIn your case TouchGFX must render the space character for the specific typography no matter what is going to be in the wildcard. This is because the space character is always present in the text area (before and after colon character). If I'm right please remove the text before the wildcard ("Wildcard : ") and try then. I'm curious if it's going to work for you.

PS. I'm using the newest version of TouchGFX 4.20.

Regards,

Piotr

Hello @Community member​ ,

There you go :

0693W00000Sw03mQAB.png 

I am also using 4.20.0.

I'm using Verdana Font, if you are using an custom font, you have to be sure that the Unicode characters you try to use are included in your font, by checking the related cpp file inside TouchGFX\generated\fonts\src.

/Yoann

Yoann KLEIN
ST Software Developer | TouchGFX

I'm using Roboto font.

Correct me if I'm wrong. With this configuration you just sent me no matter what is going to be in the wildcard buffer the space character must get generated by TouchGFX, because it's always present in the text.

Now try to leave the text ("Translation" section) with just the wildcard without any additional text (just "<value>). Also leave the initial value of the wildcard empty. Then you should get the same result as I get, which is:

0693W00000Sw4LQQAZ.pngFor this test I used the Verdana font:

0693W00000Sw4MEQAZ.pngRegards,

Piotr

Hello,

I successfully managed to reproduce your error finally, and I understood why it is behaving like that :

TouchGFX only generates the glyphs it needs because of memory size matters. That means that if you have not already an other text in your application with space characters on this particular typography, it won't generate the space symbol in the font file I previously mentioned and you will get a fallback character in your TextArea.

So you have some option to force the space character to be included in your font :

  • The one I suggest, add the ASCII symbol of the space character (0x20) in the "Wildcards Ranges" parameter of your typography.

0693W00000Sw51MQAR.png

  • Add a space character between to other symbols ("a b" for example) in the "Wildcards Characters" parameter of your typography. You have to include it between 2 symbols, otherwise TouchGFX will skip the space and only include the other character glyph.

0693W00000Sw4xuQAB.png

  • Add another TextArea using the same typography and display a text with spaces inside to force TouchGFX to include the symbol for this font.

0693W00000Sw53cQAB.png 

For me the first solution is the best and cleanest, but you can do what arrange you the most.

Hope that this solves the issue,

/Yoann

Yoann KLEIN
ST Software Developer | TouchGFX
ypiotrp
Senior

HI Yoann!

Thank you for your solution! I confirm in fact it works. I tried to add space character as a wildcard character but there was no result. Like you said I added it in the end and not in between some other characters and it got ignored. I think it might be a little bit unclear for the end user as it was for me. Maybe you could think of some solution or additional description to improve it so that kind of problems won't happen in the future.

Thank you for your help.

Regards,

Piotr