1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-02-11 23:22:50 +00:00
trezor-firmware/core/site_scons/ui/common.py
obrusvit 9638c7e28a refactor(core): remove some fonts from C and build
- the C fonts handling will be private impl used only in `prodtest` and
`bootloader_ci`
- use "bootloader_ci" as a separate stage to distinguish fonts

[no changelog]
2025-02-06 13:32:29 +01:00

25 lines
788 B
Python

from __future__ import annotations
def add_font(
font_name: str,
font: str | None,
defines: list[str | tuple[str, str]],
sources: list[str],
) -> None:
"""Add font to the build.
This way is currently only used in `bootloader_ci` and `prodtest`.
The main `bootloader` and `firmware` both use font implementation in Rust.
"""
if font is not None:
font_filename = font.replace("_upper", "").lower()
defines += [
f"TREZOR_FONT_{font_name}_ENABLE",
(f"TREZOR_FONT_{font_name}_NAME", font),
(f"TREZOR_FONT_{font_name}_INCLUDE", f'"{font_filename}.h"'),
]
sourcefile = "embed/gfx/fonts/" + font_filename + ".c"
if sourcefile not in sources:
sources.append(sourcefile)