archinstall/archinstall
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 Enable power management services after package installation (#4440) 2026-04-18 12:04:14 +10:00
default_profiles Replace tab with spaces in preview package lists (#4409) 2026-04-11 17:48:26 +10:00
lib Set console font automatically when selecting language (#4356) 2026-04-21 18:36:29 +10:00
locales Set console font automatically when selecting language (#4356) 2026-04-21 18:36:29 +10:00
scripts Refactor EncryptionType (#4438) 2026-04-17 10:08:23 +10:00
tui Set console font automatically when selecting language (#4356) 2026-04-21 18:36:29 +10:00
__init__.py Convert imports to absolute imports (#4196) 2026-02-26 20:17:48 +11:00
__main__.py Replace sys.exit calls with return values (#4156) 2026-01-22 13:58:40 +11:00
examples Adding symlink to examples. 2020-07-08 12:34:22 +00:00
main.py Set console font automatically when selecting language (#4356) 2026-04-21 18:36:29 +10:00