#Simple Font And Image generator
Simple scripts for generating bit fonts for STM32, AVR, Arduino or other MCU, game and etc.
#How to use Font Generator
-
Install python 3.4 or newer
-
Install PILLOW:
pip install Pillow
-
Select font and place it in the folder with scripts
-
Edit config.py
-
run GenerateFontBitmap.py, it will be create and open image with name as bitmap_png value:
python GenerateFontBitmap.py
- Check and edit bitmap_png. Regenerate font if thats required.
Check this:
- All chars must be in their cells
- If cell is blue, that means it's height more then default and it was offseted up.
- Check if white pixels isn't on cell outline. Like this
If something wrong you can change anything in any image editor.
- Generate code with:
python BitmapFontToCode.py
#How to use Image generator:
-
Edit "png" value in ImageToCode.py. That is a path to image.
-
Generate code and file:
python ImageToCode.py
You can find usage of generated code here: https://github.com/SL-RU/stm32libs/blob/master/HAL/ssd1306/ssd1306.c in function void ssd1306_image(uint8_t *img, uint8_t x, uint8_t y)
Video: http://www.youtube.com/watch?v=g6N0J6xSCS0
#How to use font with my ssd1306 stm32 library:
const uint8_t customfont[] = {
//output_file text
};
FontDef_t custom_font = {
width,
height,
byte width, //in the end of output BitmapFontToCode.py
customfont
};
Good luck!