-
-
Notifications
You must be signed in to change notification settings - Fork 127
How to create new font for the library
Aleksei edited this page Jul 27, 2019
·
7 revisions
The library supports different font formats. To get exact information on font formats supported, please refer to API.
You can easily add new fonts to your application, using GLCD Font Creator application.
- Download and install GLCD Font Creator
- Download and install Python 2.7
- Download and install pip:
sudo apt-get install python-pip
- Download and install freetype_py:
sudo pip install freetype-py
orpip install freetype-py
- Download and install pip:
- Generate the font, you need, in GLCD Font Creator application.
- Export created font by pressing "Export to GLCD" button to some file glcdfont.c
- Run python script fontgenerator.py from ssd1306/tools directory
python fontgenerator.py --glcd glcdfont.c -f old > ssd1306font.h
- Copy generated font code to your application or include ssd1306font.h file and use the font:
ssd1306_setFixedFont(YOUR_FONT_NAME);
ssd1306_printFixed(0, 8, "Hello", STYLE_NORMAL);
You can easily add new fonts to your application, generating font directly from TTF font file.
- Download and install Python 2.7 (if you don't have it)
- Download and install pip:
sudo apt-get install python-pip
- Download and install freetype_py:
sudo pip install freetype-py
orpip install freetype-py
- Download and install pip:
sudo pip install freetype-py
- Generate the font, you need, directly from ttf file by running python script fontgenerator.py from ssd1306/tools directory
python fontgenerator.py --ttf FreeMono.ttf -f old > ssd1306font.h
- Copy generated font code to your application or include ssd1306font.h file and use the font:
ssd1306_setFixedFont(YOUR_FONT_NAME);
ssd1306_printFixed(0, 8, "Hello", STYLE_NORMAL);
- Download and install Python 2.7 (if you don't have it)
- Download and install pip
- Download and install freetype_py
sudo pip install freetype-py
- Generate the font, you need, directly from ttf file by running python script fontgenerator.py from ssd1306/tools directory
python fontgenerator.py --ttf FreeMono.ttf -f new > ssd1306font.h
- Copy generated font code to your application or include ssd1306font.h file and use the font:
ssd1306_setFreeFont(YOUR_FONT_NAME);
ssd1306_printFixed(0, 8, "Hello", STYLE_NORMAL);
check YOUR_FONT_NAME in generated header file.