cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to use new font size, new font style through code instead of adding in TouchGFX GUI? How to do that??

Iswarya
Associate II

Is it possible to use new font size, new font style through code instead of adding in TouchGFX GUI? How to do that??

1 ACCEPTED SOLUTION

Accepted Solutions
Martin KJELDSEN
Chief III

Hi,

The TouchGFX Designer uses the excel sheet in assets/texts/texts.xlsx as input for which glyphs, and the size of these, to generate. You can edit it manually to change the size of a font, for instance, if you want to avoid using the designer, but not through code. TouchGFX is based on the idea of pre-rendering as much as possible to optimize performance.

/Martin

View solution in original post

6 REPLIES 6
Martin KJELDSEN
Chief III

Hi,

The TouchGFX Designer uses the excel sheet in assets/texts/texts.xlsx as input for which glyphs, and the size of these, to generate. You can edit it manually to change the size of a font, for instance, if you want to avoid using the designer, but not through code. TouchGFX is based on the idea of pre-rendering as much as possible to optimize performance.

/Martin

scottSD
Senior III

You could change the font at run time as described in this link:

https://touchgfx.zendesk.com/hc/en-us/articles/360024979552-Using-Binary-Fonts-and-the-Font-Cache

But this means everything that uses the font you are changing will also be replaced.

Sad to say, but there is not a way to dynamically change the font of an individual widget (textArea, for example).

Edit: the link above is no longer valid, here is a link on the new documentation:

https://support.touchgfx.com/docs/development/ui-development/touchgfx-engine-features/using-binary-fonts

JSchw.1
Associate

@scottSD​ - Would this be possible by giving a new font for the specific control and having that control use the font even if it's the same font as default? So just essentially make a copy of the font file and rename then target this from the designer? Would this work to be able to change that font size without impacting the default?

@JSchw.1​ 

I am by no means an expert in this, but I think what you suggest would be possible.

I just tried in a test project and that does work, question is that the recommended way is to just add a bunch of rows to that spreadsheet? Right now the spreadsheet is around 18kb alone so curious if there's any alternatives to packaging the file with the app or if there might be a better approach to free up space. I'm extremely new to this so I might be crazy but thought I would check here to at least see if using the different fonts is possible. Thanks!

Hi, what do you mean by "add a bunch of rows to that spreadsheet"? And "Free up space"? The sheet is not used run-time, only to generate glyphs/binary fonts/texts.