Skip to main content

Font, bitmap conversion and visualization tool for embedded systems

Project description

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:

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
debug bool False Enable debug logging

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.

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

colossus_ltsm-1.0.0.tar.gz (15.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

colossus_ltsm-1.0.0-py3-none-any.whl (15.8 kB view details)

Uploaded Python 3

File details

Details for the file colossus_ltsm-1.0.0.tar.gz.

File metadata

  • Download URL: colossus_ltsm-1.0.0.tar.gz
  • Upload date:
  • Size: 15.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for colossus_ltsm-1.0.0.tar.gz
Algorithm Hash digest
SHA256 72d7b3d7442507783c6697be5b79dad06d2d5a0dfdcb2d1f7a6051350869bfed
MD5 582a1db6cb1807ca61b377e08e5af24a
BLAKE2b-256 f7ab00560b981d1be1d222ef9f903e189a5cf7791d0cf8f196cad1541d8678e5

See more details on using hashes here.

File details

Details for the file colossus_ltsm-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: colossus_ltsm-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 15.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for colossus_ltsm-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 65dcec53aa691b7f2de3139515bacd848b4574f3d09652b56da79b9cea0b9942
MD5 22c918e6a1b35699ce2c2b19c9200f36
BLAKE2b-256 3d8457e0b92912bada399c7d9ce14da9434388e2ca31e4922f6882cd831016f5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page