cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to change the font of a text field during runtime.

Roger.ch
Associate III

 

We want to change the font and color of text fields at runtime. The text always remains the same. We only want to change to one of the predefined fonts.

Is this possible with TouchGFX?

Thank you for any advice.

Regards, Roger 

1 ACCEPTED SOLUTION

Accepted Solutions
Osman SOYKURT
ST Employee

Hello @Roger.ch ,

Changing the color is possible, you will find in the tutorial 6 on our support website, a guide to change it step by step.
Concerning the font, it's not as easy as the color. In TouchGFX, all texts are associated with a certain typography. That means that if you need to change the font for a certain text in your application, you'll need to duplicate your text in the text database and change the font. So you'll have 2 resources with the same text but with different typographies.

OsmanSOYKURT_0-1694434944986.png

Changing the font runtime would also imply that in your code you'll need to change the text resource to show on your screen.

Osman SOYKURT
ST Software Developer | TouchGFX

View solution in original post

3 REPLIES 3
Osman SOYKURT
ST Employee

Hello @Roger.ch ,

Changing the color is possible, you will find in the tutorial 6 on our support website, a guide to change it step by step.
Concerning the font, it's not as easy as the color. In TouchGFX, all texts are associated with a certain typography. That means that if you need to change the font for a certain text in your application, you'll need to duplicate your text in the text database and change the font. So you'll have 2 resources with the same text but with different typographies.

OsmanSOYKURT_0-1694434944986.png

Changing the font runtime would also imply that in your code you'll need to change the text resource to show on your screen.

Osman SOYKURT
ST Software Developer | TouchGFX
Roger.ch
Associate III

Hi Osman. 

Thank you for your answer. I know this from earlier applications with graphics processors. There I also had to write a character set generator for the characters used. Would have hoped that TouchGFX could specify two or more fonts per text. Many designers would like to highlight the same text with a different font.

Please put it on the "Nice to have" feature list.

Thanks. 

Regards, Roger 

Thank you for your feedback!

Osman SOYKURT
ST Software Developer | TouchGFX