Appearance of text on 2.8" TFT LCD display

EL Wire/Tape/Panels, LEDs, pixels and strips, LCDs and TFTs, etc products from Adafruit

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
robert_david
 
Posts: 16
Joined: Thu Jan 14, 2021 6:44 am

Appearance of text on 2.8" TFT LCD display

Post by robert_david »

If one uses the commands tft.setTextSize(12) & tft.print("83") to display a "large font size numver" on the screen it appears in a very "Blocky" form.

So I have 2 questions how is the text to be diplayed converted into pixels to be coloured and secondly is there a way to do this that will generate a much smoother appearance of the text?

Thank you in anticipation

User avatar
dastels
 
Posts: 15667
Joined: Tue Oct 20, 2015 3:22 pm

Re: Appearance of text on 2.8" TFT LCD display

Post by dastels »

What product is it? And how are you using it (language & libraries)?

Dave

User avatar
robert_david
 
Posts: 16
Joined: Thu Jan 14, 2021 6:44 am

Re: Appearance of text on 2.8" TFT LCD display

Post by robert_david »

Product is an Elegoo 2.8inch TFT LCD Shield touch screen with 320 x 240 pixels, mounted on an UNO R3
The libraries used are Elegoo_GFX.h, Elegoo_TFTLCD.h & TouchScreen.h (and all that these codes call) The corresponding Adafruit library routines have also been tried.
This is the first time that I have worked with display screens and so far I have run the example sketches provided with the screen and then modified one to print large text as shown in attached photo
Photo of display
Photo of display
P1070238crp.jpg (103.11 KiB) Viewed 892 times

User avatar
dastels
 
Posts: 15667
Joined: Tue Oct 20, 2015 3:22 pm

Re: Appearance of text on 2.8" TFT LCD display

Post by dastels »

You'll likely need a font designed to look good at that size. This is just enlarging the smaller font by multiplying pixels. I.e. to double the size 1 pixel becomes a 2x2 block.

See https://learn.adafruit.com/adafruit-gfx ... sing-fonts.

Dave

User avatar
robert_david
 
Posts: 16
Joined: Thu Jan 14, 2021 6:44 am

Re: Appearance of text on 2.8" TFT LCD display

Post by robert_david »

Thank you for replying to my questions.
Is there such a font readily available, or do I have to "design" it myself? How does one change the font when writing text to these screens?

User avatar
dastels
 
Posts: 15667
Joined: Tue Oct 20, 2015 3:22 pm

Re: Appearance of text on 2.8" TFT LCD display

Post by dastels »

If you read the page I linked to, you should have the information you need.

Dave

User avatar
robert_david
 
Posts: 16
Joined: Thu Jan 14, 2021 6:44 am

Re: Appearance of text on 2.8" TFT LCD display

Post by robert_david »

Again thank you. The additional fonts available in the Adafruit_GFX_Library/Fonts only go up to 24pt - and I have used that, but the output on the screen is not as large as I would like. I guess that I need a font size possibly between 60 & 70, so inspired by your replies (or perhaps shamed by my ignorance) I have looked futher and found an article by Bodmer (https://www.instructables.com/Arduino-T ... t-library/), that seems to answer my need. The <TFT_ILI9341 Font Library 14b.zip> was down loaded the files extracted and the fonts (Font32rle.h etc )added to Adafruit_GFX_Libraries/Fonts, but when I added the lines:-
#include <Fonts/Font64rle.h> &
tft.setFont(&Font64rle);
in the sketch the compile failed with the error
Font64rle not declared in this scope.

As a relative beginner playing with these codes I have no idea how to correct this error and am thus stuck! And hence the cry for help

User avatar
dastels
 
Posts: 15667
Joined: Tue Oct 20, 2015 3:22 pm

Re: Appearance of text on 2.8" TFT LCD display

Post by dastels »

Font64rle doesn't appear in the files. Maybe you want to use chrtbl_f64? That's what contains the bitmaps.

Dave

User avatar
robert_david
 
Posts: 16
Joined: Thu Jan 14, 2021 6:44 am

Re: Appearance of text on 2.8" TFT LCD display

Post by robert_david »

Again thank you for your reply - not that I understand it! Below is a screen shot of the fonts in the GFX/Fonts folder
showing Font64rle.h & as a C file
Screen shot library fonts.png
Screen shot library fonts.png (35.71 KiB) Viewed 855 times
And here are the contents of Font64rle.h opened in Notepad, so it exists, or at least to my simple understanding it exists, hence my not understanding your reply
Contents of Font64rle.png
Contents of Font64rle.png (10.44 KiB) Viewed 855 times
If you can shed any light on this brick wall that I seem to be up against it would be very much appreciated

User avatar
dastels
 
Posts: 15667
Joined: Tue Oct 20, 2015 3:22 pm

Re: Appearance of text on 2.8" TFT LCD display

Post by dastels »

OK. Your error is:

Code: Select all

Font64rle not declared in this scope.
That means the name Font64rle isn't in any of the included header files so when it's used the compiler has no idea what you are talking about. It's not the file that it can't find (that'd be a different error).

As I said, try using chrtbl_f64 instead of Font64rle.

Beyond that you should talk to the author of that instructable.

Dave

User avatar
robert_david
 
Posts: 16
Joined: Thu Jan 14, 2021 6:44 am

Re: Appearance of text on 2.8" TFT LCD display

Post by robert_david »

Again many thanks; I have tried your suggestion to replace Font64rle by chrtbl_f64 in my sketch, by which I mean the 2 code lines become #include <Fonts/chrtbl_f64> and tft.setFont(&chrtbl_f64). The error message this time was that the file chrtbl_f64 does not exist. If I have misunderstood your comment and suggestion it is just a confirmation of my lack of knowledge and understanding!
May I test your patience a little further? You say "That means the name Font64rle isn't in any of the included header files so when it's used the compiler has no idea what you are talking about. It's not the file that it can't find (that'd be a different error)."
What are the Header files? At the start of my sketch are the lines:-
#include <Adafruit_TFTLCD.h>
#include <Adafruit_GFX.h>
#include <TouchScreen.h>
#include <Fonts/Font64rle.h> are these the header files? My understanding is that the instruction to include a font directs the compiler to look in the library files for the font "Font64rle.h" and since that does exist in the appropriate location the compiler should include its code when compiling the sketch. So where is my understanding at fault?
As you can see I really would appreciate help since my understanding and knowledge is so lacking

User avatar
dastels
 
Posts: 15667
Joined: Tue Oct 20, 2015 3:22 pm

Re: Appearance of text on 2.8" TFT LCD display

Post by dastels »

The file was fine, it's what's in the file that's the point.

Dave

User avatar
robert_david
 
Posts: 16
Joined: Thu Jan 14, 2021 6:44 am

Re: Appearance of text on 2.8" TFT LCD display

Post by robert_david »

Again many thanks for taking the time to reply to my questions. It is much appreciated even if unfortunately I am no further forward! In addition to posting questions on this forum I have also tried to ask the questions of the author, but regretably have not had a reply.
I have taken your comment (The file was fine, it's what's in the file that's the point.) to mean that it is the contents of Font64rle are the cause of the failure to compile, but I have no idea of how to change/correct the contents in order to allow the code to compile correctly. So I guess that I have to leave it there and see if I can find an alternative solution.

But again thanks for your help

Locked
Please be positive and constructive with your questions and comments.

Return to “Glowy things (LCD, LED, TFT, EL) purchased at Adafruit”