how to display icon font? #1912
-
hello, i want to make a weather project. i generated a weather icon fonts with “processing”,but i don't know how to use this in code. this is processing code.
this is generated icon font
this is my arduino code
Thanks again!! |
Beta Was this translation helpful? Give feedback.
Replies: 7 comments 5 replies
-
This should work as an example:
|
Beta Was this translation helpful? Give feedback.
-
After the load font, try this: tft.setTextColor(TFT_WHITE, TFT_BLACK, true); |
Beta Was this translation helpful? Give feedback.
-
Your font is correct, I did some test. First with no satisfying result, square tofu boxes were printed. For some reason, the _utf8 decoder flag was turned off (seems to be inialized as true but apperently turned off somewhere, I don't know). So, try this, before printing: Here is my result: So your font file is ok. BTW, did you select the right driver in User_Setup.h - I think your board uses ST7789. I use an ILI9342 display. |
Beta Was this translation helpful? Give feedback.
-
Found the same display as yours here, with ST7789. So I gave it another try to see what happens, selecting the right driver in User_Setup.h: Also with good result: |
Beta Was this translation helpful? Give feedback.
-
Strange. I also use 2.4.72 and use these connections, not sure if that makes a difference: Only 4 wires connected of course, 2, 4,18 and 23. #define TFT_MISO 19 And this, but I did not even bother to change that when testing the 240x240 ST7789 display. Some other snippets: // tft.print("_utf8 = "); tft.println(tft.getAttribute(UTF8_SWITCH)); The above is just to show what I did to get the icons displayed, then moved back to my own display and things againg. I tried this in a very large complicated sketch, so it is difficult to share. But I will try this evening if I can make a minimal sketch to see what happens. I will start with your version and work from there. For now, I don't see anything wrong. It is weird ;-) Will let you know... |
Beta Was this translation helpful? Give feedback.
-
This is my minimal sketch that works. The tft.init() is vital. If I leave it out, my display stays dark. #include <TFT_eSPI.h> // Hardware-specific library TFT_eSPI tft = TFT_eSPI(240,240); // Invoke custom library met width & height, die later door rotatie verwisseld uitwerken void setup() { tft.init(); tft.println("\uf101"); } void loop() { |
Beta Was this translation helpful? Give feedback.
-
I think the main reason for your problems is this: tft.loadFont("hefeng40"); It should be tft.loadFont(hefeng40); Hahaha, happens to us all, eh ;-) I was really puzzled why your version did not work. Cheers, Frank |
Beta Was this translation helpful? Give feedback.
This should work as an example: