How to set font larger than Montserrat 48

How do I set default font montserrat larger than 48?

image

Others

  • SquareLine Studio version: 1.2.1
  • Operating system: Windows 11
  • Target hardware: ESP32

Hi Christine

Haven’t managed to figure out how to do this within SLS, but I have created a new font for a demo project and then subsequently use this new font in my code, which can be done by visiting this link:

https://oleddisplay.squix.ch/#/home

Select the font type, size etc, and then make sure you select the library version Adafruit GFX font. Then copy that to your clipboard and paste into a text editor (I used Textedit) and save this as a dot h file and import it into your Arduino project.

Make sure you then get the exact name of the font file which can be found at the very bottom of the .h file you created and using the TFT-eSPI.h library, use this in your code similarly as in the following statements;

  tft.setFreeFont(&Rock_Salt_Regular_20); // sets the name of the font
  tft.drawString("rock font 20", 140, 10); // displays text, at x, y co-ords
  tft.drawString("from file", 140, 40); 
  tft.drawString("12345 aAbBcC", 140, 70);

Make sure you also have the correct include statement a the top of your code

#include "rock_font.h"; // the name of the font file you saved in your text editor as the .h

That of course is the name of the font file in my code which is obtained right at the bottom of the .h file you created from the site above. You use whichever the name of the font file is in your code.

Apologies if this is a little vague, shout if I can help clarify.

John

1 Like

Hello Christine
you can do what ever you want about fonts in font manager. for your problem you can build new font with large size in this tab. NOTE: first of all you should add your favorite font in the asset folder