archinstall/archinstall/lib
Softer 03b245a77a
Set console font automatically when selecting language (#4356)
* Set console font automatically when selecting language

Add console_font field to languages.json and Language dataclass.
When a language is activated, setfont is called automatically,
falling back to default8x16 on error or for languages without
a custom font. Also activate translation when loading language
from config file.

* 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.

* CI checks fix

* Try to restore original console font with setfont -O

* Fix for pylint

* Restore console font before Textual exits application mode

Move font set/restore into Textual lifecycle to prevent color
artifacts from 256/512 glyph transitions. Apply FONT env var
and language font in on_mount, restore in _on_exit_app.

Skip font change when loading language from config (set_font=False)
to defer it until TUI starts.

* Fall back to language font mapping when FONT env var is invalid

Add _using_env_font flag to skip mapping only when FONT was
successfully applied. Show info message after TUI exits if FONT
could not be set.

* Use tempfile for console font backup files

* Fix linter errors: use mkstemp, close fds, add @override

* Fix ruff formatting

* Move font state from module singleton into TranslationHandler

* Refactor font handling per review feedback

* Make font methods members of TranslationHandler, skip on non-ISO

* ci: trigger tests

* Move running_from_iso import to module level

No circular dep, simpler than per-method local imports.

* Add explicit ISO guard to restore_console_font

Matches the existing guards in _set_font and save_console_font.
Behaviour was already safe implicitly via _font_backup=None, but
the explicit check makes intent obvious at the call site.

* Skip apply_console_font off-ISO

* Use list form for setfont SysCommand calls
2026-04-21 18:36:29 +10:00
..
applications Add optional "Additional fonts" selection to Applications menu (#4420) 2026-04-18 12:02:47 +10:00
authentication Remove deprecated __future__ imports (#4393) 2026-04-08 08:11:05 +02:00
bootloader Async menu (#4308) 2026-03-16 10:39:36 +11:00
disk Refactor EncryptionType (#4438) 2026-04-17 10:08:23 +10:00
general Set console font automatically when selecting language (#4356) 2026-04-21 18:36:29 +10:00
locale Async menu (#4308) 2026-03-16 10:39:36 +11:00
menu Update mypy to 1.20.0 (#4352) 2026-04-02 07:51:47 +11:00
mirror Fix urllib.parse import to avoid warnings with ty and Pyright (#4425) 2026-04-14 15:39:08 +10:00
models Add optional "Additional fonts" selection to Applications menu (#4420) 2026-04-18 12:02:47 +10:00
network Fix iwd network installation and setup (#4271) 2026-03-21 17:56:41 +11:00
packages Allow granular plasma configuration (#4389) 2026-04-10 07:07:28 +02:00
pacman Add Pacman settings submenu with Color and ParallelDownloads (#4404) 2026-04-13 18:37:51 +10:00
profile Allow granular plasma configuration (#4389) 2026-04-10 07:07:28 +02:00
user Allow skip on password confirmation (#4273) 2026-03-21 17:57:17 +11:00
utils Add constant for archiso mountpoint (#4377) 2026-04-06 22:41:33 +10:00
__init__.py Converted the lib to a pip supported structure to make packaging easier. Also tweaked some minor issues and added the AUR function 2020-07-06 18:44:42 +02:00
args.py Set console font automatically when selecting language (#4356) 2026-04-21 18:36:29 +10:00
boot.py Remove invalid container PATH lookup (#4413) 2026-04-12 14:48:51 +10:00
command.py Bump ruff target-version to Python 3.14 (#4390) 2026-04-07 23:09:14 +10:00
configuration.py Async menu (#4308) 2026-03-16 10:39:36 +11:00
crypt.py Convert imports to absolute imports (#4196) 2026-02-26 20:17:48 +11:00
exceptions.py Update ruff formatter (#3496) 2025-05-24 07:58:42 +00:00
global_menu.py Refactor FilesystemType (#4417) 2026-04-13 18:41:59 +10:00
hardware.py Replace tab with spaces in preview package lists (#4409) 2026-04-11 17:48:26 +10:00
installer.py Fix shell injection in user_set_shell and chown (#4443) 2026-04-20 18:36:49 +10:00
linux_path.py Add LPath execute permissions methods (#4378) 2026-04-06 09:16:21 +02:00
networking.py Convert imports to absolute imports (#4196) 2026-02-26 20:17:48 +11:00
output.py Remove quotes from type annotation (#4384) 2026-04-07 12:21:51 +10:00
pathnames.py Add constant for mirrorlist (#4403) 2026-04-11 10:17:29 +10:00
plugins.py Move get_version() to version module (#4270) 2026-03-01 11:31:13 +11:00
translationhandler.py Set console font automatically when selecting language (#4356) 2026-04-21 18:36:29 +10:00
version.py Move get_version() to version module (#4270) 2026-03-01 11:31:13 +11:00