From e45995fa7103287dfe0a0b2841f9c887780f1ab3 Mon Sep 17 00:00:00 2001 From: Softer Date: Thu, 2 Apr 2026 21:47:15 +0300 Subject: [PATCH] Support FONT environment variable for console font override When FONT env var is set, use it as the console font instead of the language-specific font mapping from languages.json. The font is applied at startup and preserved across language switches. On exit (success or failure), restore the console font to default8x16. --- archinstall/lib/translationhandler.py | 4 +++- archinstall/main.py | 7 ++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/archinstall/lib/translationhandler.py b/archinstall/lib/translationhandler.py index d8972077..903185d0 100644 --- a/archinstall/lib/translationhandler.py +++ b/archinstall/lib/translationhandler.py @@ -34,6 +34,7 @@ class Language: _DEFAULT_FONT = 'default8x16' +_ENV_FONT = os.environ.get('FONT') def _set_console_font(font_name: str | None) -> None: @@ -158,7 +159,8 @@ class TranslationHandler: """ # The install() call has the side effect of assigning GNUTranslations.gettext to builtins._ language.translation.install() - _set_console_font(language.console_font) + + _set_console_font(_ENV_FONT if _ENV_FONT else language.console_font) def _get_locales_dir(self) -> Path: """ diff --git a/archinstall/main.py b/archinstall/main.py index ac072b0e..5d463488 100644 --- a/archinstall/main.py +++ b/archinstall/main.py @@ -16,7 +16,7 @@ from archinstall.lib.networking import ping from archinstall.lib.output import debug, error, info, warn from archinstall.lib.packages.util import check_version_upgrade from archinstall.lib.pacman.pacman import Pacman -from archinstall.lib.translationhandler import tr +from archinstall.lib.translationhandler import _ENV_FONT, _set_console_font, tr from archinstall.lib.utils.util import running_from_iso from archinstall.tui.ui.components import tui @@ -79,6 +79,9 @@ def run() -> int: OR straight as a module: python -m archinstall In any case we will be attempting to load the provided script to be run from the scripts/ folder """ + if _ENV_FONT: + _set_console_font(_ENV_FONT) + arch_config_handler = ArchConfigHandler() if '--help' in sys.argv or '-h' in sys.argv: @@ -159,6 +162,8 @@ def main() -> int: _error_message(exc) rc = 1 + _set_console_font(None) + return rc