Font converter

Fonts can be converted from the operation system fonts and added to the Littlev Graphics Library it two steps:

  • Convert a font to .fnt format
  • Convert the .fnt file to C arrays

The required softwares are located at lv_utils/font_conv

To learn how the fonts work in LittlevGL, please check this font overview

Font to fnt

Firstly with BMFont software an .fnt file has to be created from the chosen system font:

  1. Download the utilities from the Download menu and unzip it
  2. Open the font_conv folder and install BMFont. (BMFont written for Windows but it runs on Linux with Wine)
  3. Run BMFont
  4. In Options/Font settings choose a font, set its size and other settings (bold, italian etc.)
  5. In Options/Export settings choose XML file format and .png texture. Set the texture width and height to 2048.
  6. Select the characters to convert
  7. Save the fnt file: Options/Save bitmap font as…
  8. Check the created files: an .fnt and a .png file has to be created. If there are more .png files then increase texture size in Export settings.

Fnt to c

A python script ( will convert the .fnt and .png files to .c file. It works like this:

  1. Install Python if it is not installed on you system
  2. Copy the .fnt and the .png file next to
  3. Open a terminal
  4. To convert for example ASCII characters from my_font1.fnt type "python -f -s 32 -e 126".
  5. Check the result in the .c file.

The paramters of the script:

  • -f Font name without extension (e.g. my_font1.fnt -> my_font1)
  • -s First unicude character to convert
  • -e Last unicude character to convert
  • -o Output font name (if not specified same as input font)

(The script is a modified version of Lars Ole Pontoppidan’s script.)

Add the font to LittlevGL

  1. Copy the created .c and .h file into your project
  2. Include the created header file
  3. In a style set style.text.font = &my_font1.

LittlevGL - Open-source Embedded GUI Library

LittlevGL is a free and open-source graphics library providing everything you need to create embedded GUI with easy-to-use graphical elements, beautiful visual effects and low memory footprint.

If you like LittlevGL, please
support its deveopment!

The founder of Littlev Graphics Library (LittlevGL) and related software modules is:
Gábor Kiss-Vámosi
All Rights Reserved ©  2018 Hungary