.. | ||
fonts | ||
main | ||
CMakeLists.txt | ||
partitions.csv | ||
README.md | ||
sdkconfig.defaults |
FreeTypeDemo for SSD1306
FreeType components are published in the ESP Component Registry.
The github page is here.
This component can convert a True Type Font to a bitmap image.
Please note that if you use a proportional font, some fonts may not convert correctly.
Monospaced fonts can be converted correctly.
You can find Monospaced fonts here.
How to use True Type font.
-
Download Monospaced fonts from internet.
-
Copy font file to fonts directory.
-
Select font.
load_font("/fonts/consola.ttf"); -
Specify the display position and threshold.
The converted bitmap is monochrome data with gradations from 0 to 255.
The lower the value, the lighter the black, and the higher the value, the darker the black.
Unfortunately, SSD1306 cannot express gradations.
The lower the threshold, the small value will display. As a result, the text becomes thicker.
The higher the threshold, the small value will not display. As a result, the text becomes thinner.
render_text(&dev, 0, 16, 128, "FreeType");