Go Down

Topic: Pretty Bold (all caps) vector Font for TFT (Read 172 times) previous topic - next topic

wzaggle

So I really needed to dump the dots for the text in a current clock calendar project, and so I wrote this short program to actually draw out the capital letters, numbers, and a few other key characters. Figured I would share in case someone else would like some pretty titles on their little TFT. 

It really came out a lot smaller than I expected when I started.  Efforts to try and bit map patterns just used up more space so I just stuck with the hard coded version.  Plus it is a bit easier to add new characters if anyone is interested.  Total sketch was 13838 bytes. 

It is fairly well documented and tested, and not really hard to use.  Here is a picture of what it can do and the code that created the picture as a reference, shown with an Adafruit_ILI9341 2.8 touch and an Arduino UNO. 

Right now it clears with a background color, but you could easily remove that one line and use it to write over existing images. 



The larger entire code file is attached as-is for anyone interested.

WZ


Code: [Select]

  vtextDirection = 1; 
  vtextDrawString("B",20,15,17);
  vtextDrawString("O",150,15,5);
  vtextDrawString("L",190,15,5);
  vtextDrawString("D",230,15,5);
  vtextDrawString("!",270,15,5);
  vtextDrawString("<ABCDEFGHI>",145,90,2,ILI9341_DARKGREEN);
  vtextDrawString("!JKLMNOPQR.",145,112,2,ILI9341_OLIVE);
  vtextDrawString("\\STUVWXYZ/",145,134,2,ILI9341_ORANGE);
  vtextDrawString("0123456789",145,156,2,ILI9341_GREENYELLOW);
  vtextDirection = 0;
  vtextDrawString("INVERTED",75,25,2,ILI9341_BLACK,ILI9341_WHITE);
  vtextDrawString("HELLO WORLD",0,0,1,ILI9341_GREEN);
  vtextDirection = 1; 
  vtextDrawString("HELLO WORLD",0,0,1,ILI9341_RED);
  vtextDirection = 2; 
  vtextDrawString("HELLO WORLD",0,0,1,ILI9341_MAGENTA);
  vtextDirection = 3; 
  vtextDrawString("HELLO WORLD",0,0,1,ILI9341_YELLOW);
  vtextDirection = 1;   
  vtextDrawString("Limited Characters",25,195,2,ILI9341_CYAN); 
  vtextDrawString("Lower Case Caps",25,220,2,ILI9341_CYAN);
  vtextDrawString("Pretty!",195,185,3,0x2378);
 

common_ground

Thank you once again, you are a very useful Newbie :D

And where is a version for those that prefer compressed coding  ;)
Kidding of course, keep on this way.

wzaggle

That's funny!  :) 

Grew up with COBOL, but always loved APL.  Sort of opposite ends of the code size spectrum.

WZ

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy