Ken Van Hoeylandt 4279a8ed72
Terminal and shell support based on BreezyBox (#656)
Features:
- Implemented terminal app based on BreezyBox
- Implemented shell based on BreezyBox
- Added font-module with fixed-width fonts

Improvements:
- Improved application standard-output and error-output routing, including dynamically loaded applications.
- Updated shared icons and Material Symbols mappings.
- Other improvements & fixes
2026-09-22 23:01:03 +02:00

39 lines
1.3 KiB
Python

#!/usr/bin/env python3
"""
Generates bitmap font files (see generate.py) for a fixed set of glyph heights, from the same
monospace TTF.
Requires the freetype-py package: pip install freetype-py
Usage:
python3 generate-all.py
"""
import importlib.util
import os
MONO_URL = "https://github.com/google/fonts/raw/refs/heads/main/ofl/ibmplexmono/IBMPlexMono-Regular.ttf"
SIZES = [12, 14, 16, 18, 24, 28]
spec = importlib.util.spec_from_file_location("generate_font", os.path.join(os.path.dirname(__file__), "generate.py"))
generate_font = importlib.util.module_from_spec(spec)
spec.loader.exec_module(generate_font)
def write_fonts_header(outputs: list):
path = os.path.join(generate_font.INCLUDE_DIR, "fonts.h")
print(f"Generating {path}")
with open(path, "w") as f:
f.write("// SPDX-License-Identifier: Apache-2.0\n")
f.write("#pragma once\n\n")
f.write("// Every font generate-all.py produces, so a caller can pull them all in with one include.\n")
for output in outputs:
f.write(f"#include <font/{output}.h>\n")
if __name__ == "__main__":
outputs = [f"ibmplexmono{size}" for size in SIZES]
for output, size in zip(outputs, SIZES):
generate_font.generate(MONO_URL, size, output)
write_fonts_header(outputs)