klemek ba43d462e5
Python Lint CI / ruff-format-check (push) Failing after 6m56s
Python Lint CI / ruff (push) Successful in 8m40s
Python Lint CI / ty (push) Successful in 6m41s
chore: 1.0.0
2026-11-08 17:17:31 +01:00
2026-11-07 14:59:39 +01:00
2026-11-08 00:16:58 +01:00
2026-11-08 17:14:27 +01:00
2026-11-07 13:49:26 +00:00
2026-11-07 13:49:26 +00:00
2026-11-07 13:49:26 +00:00
2026-11-08 13:27:30 +01:00
2026-11-08 17:17:31 +01:00
2026-11-08 13:27:30 +01:00
2026-11-08 17:17:31 +01:00

GLSL Glyphs Generator

Generate GLSL ready 8x8 glyph maps and usable functions.

Reads each 8x8 glyph into 4x4 squares then converts them into (0-65535) integers.

 ██████      0x151E, 0x8A87, 0xE19D, 0x789B,
█      █
█ █  █ █       ███    ███     █ ██    ██ █
█      █  ->  █          █    █  █    █  █
█ ████ █      █ █      █ █    █          █
█  ██  █      █          █     ███    ███
█      █
 ██████

Writes it into GLSL ready files to use it easily in shaders

const int cp437_glyphs[] = int[1024](
    0x0000, 0x0000, 0x0000, 0x0000, // 0x00, EMPTY
    0x151E, 0x8A87, 0xE19D, 0x789B, // 0x01, SMILEY
    // ...
);

bool cp437(vec2 pos, int code)
{
    // ...
}

Usage

usage: glsl-glyphs [-h] [-i INPUT_FILE] [-n NAME] [-o OUTPUT_FILE] [-g NAMES_FILE] [-s SETS_FILE] [-f | --functions | --no-functions]
                   [--sentences-input SENTENCES_FILE] [--sentences-output OUTPUT_FILE] [--sentences-only | --no-sentences-only]
                   [--includes | --no-includes] [--add-empty | --no-add-empty] [--add-all | --no-add-all] [-v | --verbose | --no-verbose]
                   [-q | --quiet | --no-quiet]

options:
  -h, --help            show this help message and exit
  -i, --input INPUT_FILE
                        png 8x8 glyph map
  -n, --name NAME       target derived name for GLSL constants and functions (default: glyph)
  -o, --output OUTPUT_FILE
                        output glyphs glsl file (default: build/{name}.glsl}
  -g, --glyph-names NAMES_FILE
                        glyphs names, one line each
  -s, --sets SETS_FILE  defined sets in CSV: index,length,name
  -f, --functions, --no-functions
                        add GLSL functions to output
  --sentences-input SENTENCES_FILE
                        generate sentences from file and names
  --sentences-output OUTPUT_FILE
                        output sentences glsl file (default: build/{name}_sentences.glsl)
  --sentences-only, --no-sentences-only
                        generate only sentences from names (does not read input image)
  --includes, --no-includes
                        use #include preprocessor in GLSL (forge)
  --add-empty, --no-add-empty
                        add EMPTY tile at start of tileset if missing
  --add-all, --no-add-all
                        add ALL set at start list
  -v, --verbose, --no-verbose
                        more verbose logging
  -q, --quiet, --no-quiet
                        disable logging

More info about included samples

IBM PC CP437

See Why is there a "small house" in IBM's Code page 437? for more info on IBM PC CP437.

Crystalwarrior

See 1 bit by Crystalwarrior

Pmlomb

See 8x8 1 bit pixel set

Development

Makefile

Usage: make [target1] [target2] ...

Commands/Targets:
help                 show this message
install              install project
update               update project dependencies
run                  run project
sample-all           generate all samples
sample-%             generate sample (cp437/cw/pmlomb)
format               format project
lint                 lint project
build                build project
uv-sync              uv sync
uv-upgrade           uv sync upgrade
uv-run               uv run (project)
uv-run-sample-%      uv run (project) sample/(xxx)
ruff                 ruff check
ruff-fix             ruff check (and fix)
ruff-format          ruff format
ruff-format-check    ruff format (check only)
ty                   ty check
release-%            release major/minor/patch

TODO

  • Initial implementation
  • Generate a separate sentences file
  • Custom height glyph map
  • Custom width glyph map
  • More compact data using GLSL ints
  • separated sets/patterns
S
Description
Generate GLSL ready glyph maps and usable functions
Readme
182 KiB
2026-11-08 17:26:56 +00:00
Languages
Python 89.4%
Makefile 10.6%