Skip to main content

Colossus_LTSM

Donate CI PyPI version

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. Arch Linux AUR package
  3. 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:

Select from application menu(if desktop entry installed) or run from terminal with:

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
  • Some ttf files are available in the extras/ttf directory for testing.

Output

  • Generates a C or C++ header file with bitmap arrays.
  • Visualizes the font in the GUI, a PNG image can also be exported.

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
};

Exported PNG image of font data visualization:

 img font

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 4 Scale of font displayed
Columns int 16 Number of columns of font characters to display
glyph color hex color #0078FF Color of font glyphs in visualization
background color hex color #000000 Background color for visualization
screen_resolution str 1000x800 Window size for GUI on start up
debug bool False Enable debug output to terminal
input_path str $HOME input file path when a file dialog opens
output_path str $HOME output file path when a file dialog opens

Desktop Entry

A button on the main GUI allows Linux users to install a desktop entry and icon for Colossus.This creates a .desktop file in ~/.local/share/applications/ and an icon in ~/.local/share/icons/, allowing Colossus to be launched from the application menu. The button is automatically disabled if the desktop entry is already installed. Uses Curl to download the icon from GitHub and creates the desktop entry file with the correct paths.

Glyph rendering

Glyph rendering help readme. Explains how the converter measures and positions glyphs within the bitmap cell, and how to interpret messages in the conversion log related to width scaling and clipping.

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

See also

Guardian_LTSM is a Python tool for converting image files into C/C++ data arrays and for visualizing image data stored in C/C++ header files. It is aimed at users working with embedded systems, LCDs, and GUIs where compact images are needed.

Guardian_LTSM

Metadata

Release files for colossus-ltsm 1.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for colossus-ltsm 1.0.3
File Size Uploaded
colossus_ltsm-1.0.3.tar.gz 21.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for colossus-ltsm 1.0.3
File Interpreter ABI Platform
colossus_ltsm-1.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 40.8 kB

Release files / colossus_ltsm-1.0.3.tar.gz

Download URL colossus_ltsm-1.0.3.tar.gz
Size 21.3 kB
Tags Source
SHA-256 checksum
How to use checksums
0ab3e4e1f5b4d3e98949419cc070ee777f9c98d3b8251091e9908f5b12591ec4
BLAKE2b-256 checksum
How to use checksums
d2ec978c1687d551c7d8893e8294aac2054b3e283473de4c6b95091fc87f6fa3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.3

Release files / colossus_ltsm-1.0.3-py3-none-any.whl

Download URL colossus_ltsm-1.0.3-py3-none-any.whl
Size 19.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
174bd4ea2dbe50652f4d950eb1c2b0f53dbde494395ca6b2ecb2b300d710530e
BLAKE2b-256 checksum
How to use checksums
442ca71e0a178753963de38447d8f4809ee9296d2ca0fd5e70c283182bb4b9df
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

1.0.3 This release

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page