Skip to content

Colossus_LTSM is a Python tool for converting TrueType fonts (.ttf) into C/C++ bitmap arrays and for visualizing font data stored in C/C++ header files. It is aimed at users working with embedded systems, LCDs, and GUIs where compact fonts are needed.

License

Notifications You must be signed in to change notification settings

gavinlyonsrepo/Colossus_LTSM

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Colossus_LTSM

Website Rss Donate

Table of Contents

Overview

Colossus_LTSM is a Python tool for converting TrueType fonts (.ttf) into C/C++ bitmap arrays and for visualizing font data stored in C/C++ header files.
It is aimed at users working with embedded systems, LCDs, and GUIs where compact fonts are needed.

  • Convert .ttf fonts to C/C++ arrays
  • Adjustable font size, ASCII range, and addressing mode
  • Visualize fonts from existing C/C++ headers
  • GUI built with Tkinter
  • Lightweight: only depends on Pillow

Installation

  1. github repository
  2. Pypi package

The program is present in python package index, Pypi. Install (you can use pip or pipx) to the location or environment of your choice.

# For example with pipx 
pipx install colossus-ltsm

Libraries

Pillow for image processing

Usage

  1. Github repository: Colossus_LTSM
  2. PyPI package name: colossus-ltsm
  3. Import path: import colossus_ltsm
  4. Executable command: colossus

Run the GUI:

colossus
# or directly with Python
 python3 -m colossus_ltsm.colossus_main

Input

  • Select a .ttf font file
  • Set font size, Width and Height(e.g., 12, 16, 24)
  • Define ASCII range (e.g., 32-126)
  • Choose data addressing mode (horizontal or vertical)
  • Choose C or C++ arrays
  • Choose file extension (.h or .hpp)
  • Choose font name and file name

Output

  • Generates a C or C++ header file with bitmap arrays
  • Example output
// Example Font
// An 8 by 8 character size font starting at 
// ASCII offset 0x30 in ASCII table with 0x02 characters in font. 
// 0 and 1 , size 20 bytes, 4 Control bytes at start.
static const std::array<uint8_t, 20> FontBinaryExample =
{
0x08, 0x08, 0x30, 0x01,   // x-size, y-size, offset, (last character-offset : 0x31-0x30)
0x7C,0xC6,0xCE,0xD6,0xE6,0xC6,0x7C,0x00, // ASCII font data '0' : 0x30
0x18,0x38,0x18,0x18,0x18,0x18,0x7E,0x00 // ASCII font data  '1' : 0x31
};

Configuration file

The configuration file is created on startup and populated by default values. The file is located at '~/.config/colossus_ltsm/colossus_ltsm.cfg' on Linux systems.

Setting Value Default Note
scale int 8 Scale of font displayed
Columns int 16 Number of columns of font characters to display

Screenshots

 image

Projects

Some of my libraries that use these fonts are:

MCU type Library link Data adddressing mode
Arduino GFX Horizontal
Raspberry Pi Pico GFX 16 bit Horizontal
Raspberry Pi Pico GFX 1 bit Vertical
Raspberry Pi GFX Horizontal
PIC OLED Vertical

About

Colossus_LTSM is a Python tool for converting TrueType fonts (.ttf) into C/C++ bitmap arrays and for visualizing font data stored in C/C++ header files. It is aimed at users working with embedded systems, LCDs, and GUIs where compact fonts are needed.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages