From 27e8b236373821c8e719a99d70200f686a4b03d9 Mon Sep 17 00:00:00 2001 From: HADEON <52324046+h8d13@users.noreply.github.com> Date: Sun, 19 Apr 2026 13:10:42 +0200 Subject: [PATCH 1/6] init console fonts --- archinstall/lib/installer.py | 16 ++++++-------- archinstall/lib/locale/locale_menu.py | 31 ++++++++++++++++++++++++++- archinstall/lib/locale/utils.py | 12 +++++++++++ archinstall/lib/models/locale.py | 5 +++++ 4 files changed, 53 insertions(+), 11 deletions(-) diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index 9f8c51b2bd..a1313b9f71 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -927,6 +927,11 @@ def minimal_installation( if locale_config: self.set_vconsole(locale_config) + # fonts that are in the ISO but not on target + # unless we specifically request it before base + # otherwise mkinitcpio will be screaming at you + if locale_config.console_font.startswith('ter-'): + self._base_packages.append('terminus-font') self.pacman.strap(self._base_packages) self._helper_flags['base-strapped'] = True @@ -1979,23 +1984,14 @@ def chown(self, owner: str, path: str, options: list[str] = []) -> bool: return False def set_vconsole(self, locale_config: LocaleConfiguration) -> None: - # use the already set kb layout kb_vconsole: str = locale_config.kb_layout - # this is the default used in ISO other option for hdpi screens TER16x32 - # can be checked using - # zgrep "CONFIG_FONT" /proc/config.gz - # https://wiki.archlinux.org/title/Linux_console#Fonts + font_vconsole: str = locale_config.console_font - font_vconsole = 'default8x16' - - # Ensure /etc exists vconsole_dir: Path = self.target / 'etc' vconsole_dir.mkdir(parents=True, exist_ok=True) vconsole_path: Path = vconsole_dir / 'vconsole.conf' - # Write both KEYMAP and FONT to vconsole.conf vconsole_content = f'KEYMAP={kb_vconsole}\n' - # Corrects another warning vconsole_content += f'FONT={font_vconsole}\n' vconsole_path.write_text(vconsole_content) diff --git a/archinstall/lib/locale/locale_menu.py b/archinstall/lib/locale/locale_menu.py index c03824a145..aaf2008964 100644 --- a/archinstall/lib/locale/locale_menu.py +++ b/archinstall/lib/locale/locale_menu.py @@ -1,6 +1,6 @@ from typing import override -from archinstall.lib.locale.utils import list_keyboard_languages, list_locales, set_kb_layout +from archinstall.lib.locale.utils import list_console_fonts, list_keyboard_languages, list_locales, set_kb_layout from archinstall.lib.menu.abstract_menu import AbstractSubMenu from archinstall.lib.menu.helpers import Selection from archinstall.lib.models.locale import LocaleConfiguration @@ -47,6 +47,13 @@ def _define_menu_options(self) -> list[MenuItem]: preview_action=lambda item: item.get_value(), key='sys_enc', ), + MenuItem( + text=tr('Console font'), + action=select_console_font, + value=self._locale_conf.console_font, + preview_action=lambda item: item.get_value(), + key='console_font', + ), ] @override @@ -140,3 +147,25 @@ async def select_kb_layout(preset: str | None = None) -> str | None: return preset case _: raise ValueError('Unhandled return type') + +async def select_console_font(preset: str | None = None) -> str | None: + fonts = list_console_fonts() + + items = [MenuItem(f, value=f) for f in fonts] + group = MenuItemGroup(items, sort_items=False) + group.set_focus_by_value(preset) + + result = SelectMenu[str]( + group, + alignment=Alignment.CENTER, + frame=FrameProperties.min(tr('Console font')), + allow_skip=True, + ).run() + + match result.type_: + case ResultType.Selection: + return result.get_value() + case ResultType.Skip: + return preset + case _: + raise ValueError('Unhandled return type') \ No newline at end of file diff --git a/archinstall/lib/locale/utils.py b/archinstall/lib/locale/utils.py index e72291606b..c86e30b4ab 100644 --- a/archinstall/lib/locale/utils.py +++ b/archinstall/lib/locale/utils.py @@ -109,3 +109,15 @@ def list_timezones() -> list[str]: .decode() .splitlines() ) + +def list_console_fonts() -> list[str]: + fonts: list[str] = [] + font_dir = Path('/usr/share/kbd/consolefonts') + if font_dir.exists(): + for f in font_dir.iterdir(): + # do not ask me there are readme files in here + if not f.name.startswith('README'): + name = f.name.removesuffix('.gz').removesuffix('.psfu').removesuffix('.psf') + fonts.append(name) + + return sorted(fonts, key=lambda x: (len(x), x)) \ No newline at end of file diff --git a/archinstall/lib/models/locale.py b/archinstall/lib/models/locale.py index 15dee2f66c..c53cff68a8 100644 --- a/archinstall/lib/models/locale.py +++ b/archinstall/lib/models/locale.py @@ -10,6 +10,7 @@ class LocaleConfiguration: kb_layout: str sys_lang: str sys_enc: str + console_font: str = 'default8x16' @classmethod def default(cls) -> Self: @@ -23,12 +24,14 @@ def json(self) -> dict[str, str]: 'kb_layout': self.kb_layout, 'sys_lang': self.sys_lang, 'sys_enc': self.sys_enc, + 'console_font': self.console_font, } def preview(self) -> str: output = '{}: {}\n'.format(tr('Keyboard layout'), self.kb_layout) output += '{}: {}\n'.format(tr('Locale language'), self.sys_lang) output += '{}: {}'.format(tr('Locale encoding'), self.sys_enc) + output += '{}: {}'.format(tr('Console font'), self.console_font) return output def _load_config(self, args: dict[str, str]) -> None: @@ -38,6 +41,8 @@ def _load_config(self, args: dict[str, str]) -> None: self.sys_enc = args['sys_enc'] if 'kb_layout' in args: self.kb_layout = args['kb_layout'] + if 'console_font' in args: + self.console_font = args['console_font'] @classmethod def parse_arg(cls, args: dict[str, Any]) -> Self: From ca52b7e172753bc9821c5c9b89e5ce843f0315b6 Mon Sep 17 00:00:00 2001 From: HADEON <52324046+h8d13@users.noreply.github.com> Date: Sun, 19 Apr 2026 13:19:13 +0200 Subject: [PATCH 2/6] ruff --- archinstall/lib/locale/locale_menu.py | 13 +++++++------ archinstall/lib/locale/utils.py | 4 ++-- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/archinstall/lib/locale/locale_menu.py b/archinstall/lib/locale/locale_menu.py index aaf2008964..73cd534a46 100644 --- a/archinstall/lib/locale/locale_menu.py +++ b/archinstall/lib/locale/locale_menu.py @@ -148,6 +148,7 @@ async def select_kb_layout(preset: str | None = None) -> str | None: case _: raise ValueError('Unhandled return type') + async def select_console_font(preset: str | None = None) -> str | None: fonts = list_console_fonts() @@ -155,12 +156,12 @@ async def select_console_font(preset: str | None = None) -> str | None: group = MenuItemGroup(items, sort_items=False) group.set_focus_by_value(preset) - result = SelectMenu[str]( + result = await Selecton[str]( group, - alignment=Alignment.CENTER, - frame=FrameProperties.min(tr('Console font')), - allow_skip=True, - ).run() + header=tr('Console font'), + group=group, + enable_filter=True, + ).show() match result.type_: case ResultType.Selection: @@ -168,4 +169,4 @@ async def select_console_font(preset: str | None = None) -> str | None: case ResultType.Skip: return preset case _: - raise ValueError('Unhandled return type') \ No newline at end of file + raise ValueError('Unhandled return type') diff --git a/archinstall/lib/locale/utils.py b/archinstall/lib/locale/utils.py index c86e30b4ab..27393cef92 100644 --- a/archinstall/lib/locale/utils.py +++ b/archinstall/lib/locale/utils.py @@ -2,7 +2,7 @@ from archinstall.lib.exceptions import ServiceException, SysCallError from archinstall.lib.output import error from archinstall.lib.utils.util import running_from_iso - +from archinstall.linux_path import LPath def list_keyboard_languages() -> list[str]: return ( @@ -112,7 +112,7 @@ def list_timezones() -> list[str]: def list_console_fonts() -> list[str]: fonts: list[str] = [] - font_dir = Path('/usr/share/kbd/consolefonts') + font_dir = LPath('/usr/share/kbd/consolefonts') if font_dir.exists(): for f in font_dir.iterdir(): # do not ask me there are readme files in here From 3c58fee65ebfeca3b48e3f80eff5f99d10d29e17 Mon Sep 17 00:00:00 2001 From: HADEON <52324046+h8d13@users.noreply.github.com> Date: Sun, 19 Apr 2026 13:20:37 +0200 Subject: [PATCH 3/6] ruff2 --- archinstall/lib/locale/locale_menu.py | 2 +- archinstall/lib/locale/utils.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/archinstall/lib/locale/locale_menu.py b/archinstall/lib/locale/locale_menu.py index 73cd534a46..998d52a6f9 100644 --- a/archinstall/lib/locale/locale_menu.py +++ b/archinstall/lib/locale/locale_menu.py @@ -156,7 +156,7 @@ async def select_console_font(preset: str | None = None) -> str | None: group = MenuItemGroup(items, sort_items=False) group.set_focus_by_value(preset) - result = await Selecton[str]( + result = await Selection[str]( group, header=tr('Console font'), group=group, diff --git a/archinstall/lib/locale/utils.py b/archinstall/lib/locale/utils.py index 27393cef92..361176a009 100644 --- a/archinstall/lib/locale/utils.py +++ b/archinstall/lib/locale/utils.py @@ -120,4 +120,4 @@ def list_console_fonts() -> list[str]: name = f.name.removesuffix('.gz').removesuffix('.psfu').removesuffix('.psf') fonts.append(name) - return sorted(fonts, key=lambda x: (len(x), x)) \ No newline at end of file + return sorted(fonts, key=lambda x: (len(x), x)) From e27dea00c22754b04e16879722732bbd723d3088 Mon Sep 17 00:00:00 2001 From: h8d13 Date: Sun, 19 Apr 2026 13:28:04 +0200 Subject: [PATCH 4/6] fix import --- archinstall/lib/locale/utils.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/archinstall/lib/locale/utils.py b/archinstall/lib/locale/utils.py index 361176a009..1ebea08885 100644 --- a/archinstall/lib/locale/utils.py +++ b/archinstall/lib/locale/utils.py @@ -1,8 +1,9 @@ from archinstall.lib.command import SysCommand from archinstall.lib.exceptions import ServiceException, SysCallError +from archinstall.lib.linux_path import LPath from archinstall.lib.output import error from archinstall.lib.utils.util import running_from_iso -from archinstall.linux_path import LPath + def list_keyboard_languages() -> list[str]: return ( @@ -110,6 +111,7 @@ def list_timezones() -> list[str]: .splitlines() ) + def list_console_fonts() -> list[str]: fonts: list[str] = [] font_dir = LPath('/usr/share/kbd/consolefonts') From 7435760f9d57b6797b14b47e7007412974e302e2 Mon Sep 17 00:00:00 2001 From: h8d13 Date: Sun, 19 Apr 2026 13:29:10 +0200 Subject: [PATCH 5/6] fix display newline --- archinstall/lib/models/locale.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/archinstall/lib/models/locale.py b/archinstall/lib/models/locale.py index c53cff68a8..f6f41abac3 100644 --- a/archinstall/lib/models/locale.py +++ b/archinstall/lib/models/locale.py @@ -30,7 +30,7 @@ def json(self) -> dict[str, str]: def preview(self) -> str: output = '{}: {}\n'.format(tr('Keyboard layout'), self.kb_layout) output += '{}: {}\n'.format(tr('Locale language'), self.sys_lang) - output += '{}: {}'.format(tr('Locale encoding'), self.sys_enc) + output += '{}: {}\n'.format(tr('Locale encoding'), self.sys_enc) output += '{}: {}'.format(tr('Console font'), self.console_font) return output From 03ee10724335d7e2e1506a77c9b4981b3f7ba5ac Mon Sep 17 00:00:00 2001 From: h8d13 Date: Sun, 19 Apr 2026 13:37:26 +0200 Subject: [PATCH 6/6] oops --- archinstall/lib/locale/locale_menu.py | 1 - 1 file changed, 1 deletion(-) diff --git a/archinstall/lib/locale/locale_menu.py b/archinstall/lib/locale/locale_menu.py index 998d52a6f9..dc743fd358 100644 --- a/archinstall/lib/locale/locale_menu.py +++ b/archinstall/lib/locale/locale_menu.py @@ -157,7 +157,6 @@ async def select_console_font(preset: str | None = None) -> str | None: group.set_focus_by_value(preset) result = await Selection[str]( - group, header=tr('Console font'), group=group, enable_filter=True,