TFT and VGA Fonts

Code tips and tricks for beginners
Post Reply
ramante67
Posts: 6
Joined: Sun Feb 25, 2024 6:18 pm

TFT and VGA Fonts

Post by ramante67 »

Hi There,

I new here and I'm sorry if my question is to basic to you all.
I'm trying to create an interface using 8048S070 LCD and it works very well, by the way.
I would like to use the font #7 from the Annex library.
image.png
It is possíble to use this font with this command below?
GUI.Textline(x, y, width, height, "text" [,font] [,color_text] [,color_back] [,color_frame] [,alignment] [,margin] )

Where can I find the possible options for each one of this parameters?

Thanks you all!

Abraços,
Rogerio
You do not have the required permissions to view the files attached to this post.
BeanieBots
Posts: 361
Joined: Tue Jun 21, 2022 2:17 pm
Location: South coast UK
Has thanked: 197 times
Been thanked: 115 times

Re: TFT and VGA Fonts

Post by BeanieBots »

You can only use fonts 10,11,12 & 13
They can be loaded using a line like this.
tft.loadfont "/fonts/FreeSans12pt7b.bin", 10
It is possible to create your own with this utility
[Local Link Removed for Guests]
To help you on your way, here are some that cicciocb has already done, plus a few of my own.
You might find the font OPEN_24_DisplaySt18pt7.bin close to what you want.
You do not have the required permissions to view the files attached to this post.
BeanieBots
Posts: 361
Joined: Tue Jun 21, 2022 2:17 pm
Location: South coast UK
Has thanked: 197 times
Been thanked: 115 times

Re: TFT and VGA Fonts

Post by BeanieBots »

The font looks like this:-
font.jpg
It should be quite easy to edit the zero to look like 7-segment.
You do not have the required permissions to view the files attached to this post.
ramante67
Posts: 6
Joined: Sun Feb 25, 2024 6:18 pm

Re: TFT and VGA Fonts

Post by ramante67 »

Olá @BeanieBots,
Thanks a lot for the fonts file. It's perfect to me.
But I'm stragling to figure out the options for the other parameters in the command line like "color_back" or "color_frame":

Txt1 =GUI.Textline(x, y, width, height, "text" [,font] [,color_text] [,color_back] [,color_frame] [,alignment] [,margin] )

There is any reference to those other parameters options? I searched at the forum but I was not able to find it.

Thanks again for the assistance.

Have a nice weekend.

Abraço,
Rogério
ramante67
Posts: 6
Joined: Sun Feb 25, 2024 6:18 pm

Re: TFT and VGA Fonts

Post by ramante67 »

I figured out the color names (I was trying for numbers) - white, black, yellow, etc.
There is any "transparent" option to put a text over the background image without borders or black backgorund as for the vgagui.textline command?
Abraços,
Rogerio
BeanieBots
Posts: 361
Joined: Tue Jun 21, 2022 2:17 pm
Location: South coast UK
Has thanked: 197 times
Been thanked: 115 times

Re: TFT and VGA Fonts

Post by BeanieBots »

Glad you figured it out.
A lot of the vga stuff is still experimental and not all is fully documented yet.
You can find help for VGA commands by trying the help for just GUI objects. (eg GUI.TEXTLINE)
[Local Link Removed for Guests]
The parameter names describe well what they do. Anything enclosed in [ ] brackets is optional.
For colours, I prefer to use tft.rgb(R,G,B) so that you can specify the colour using 0-255 for each of R,G & B
The colour names are good but I can never remember them all for any other than fully saturated colours.
I don't think any of the GUI objects have a transparent property. I use vga.text.draw.
Post Reply