Ken Van Hoeylandt 86010186d8
Improve Terminal, App List, app starting, and more (#658)
app-module:

- Implement `AppStartContext` to reduce amount of `app_start_` and `app_exec` functions: replace them with `app_start_with_context()`
- Add support for environment variables when starting apps
- Implement support for environment variables for apps

graphics-module:

- Add this new module
- Move font-module code into this module
- Implement pixel_buffer

apps:

- Terminal app: reduce memory usage by only buffering a single row of characters, and try to buffer in IRAM when possible. Implement new pixel_buffer.
- App List: Mark apps as favourite to pin them on top. Use touch or press "x" key.
- App List: Add toolbar button that shows alert dialog with info about using favourites
2026-09-24 00:44:28 +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)