Skip to content

Set console font automatically when selecting language#4356

Open
softer wants to merge 3 commits intoarchlinux:masterfrom
softer:auto-console-font
Open

Set console font automatically when selecting language#4356
softer wants to merge 3 commits intoarchlinux:masterfrom
softer:auto-console-font

Conversation

@softer
Copy link
Copy Markdown
Contributor

@softer softer commented Apr 2, 2026

PR Description:

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.

Tests and Checks

I have tested switching between languages, and it works in the console and via SSH.

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.
@softer softer requested a review from Torxed as a code owner April 2, 2026 03:23
@svartkanin
Copy link
Copy Markdown
Collaborator

I need to test this thoroughly, we had quite some issues in the past with this.
For example rhe font will be set when exiting archinstall which is not desired

@softer
Copy link
Copy Markdown
Contributor Author

softer commented Apr 2, 2026

Perhaps we can simply reset the font to the "default8x16" when exiting?

@h8d13
Copy link
Copy Markdown
Contributor

h8d13 commented Apr 2, 2026

On a side note @softer : I believe picking any terminus font will cause an error because target would need an extra package terminus-fonts when set through:

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 = 'default8x16'

This is the case because releng profile has this added in https://gitlab.archlinux.org/archlinux/archiso/-/raw/master/configs/releng/packages.x86_64 around line 110~ which means its on the ISO but not in our target

I know a lot of folks would love to be able to set larger font through installer directly (aside from language specific fonts) and would persist on target !

Ideally we can have an option for it which would edit the value above and if something ter we add the correct dependency ^^

@softer
Copy link
Copy Markdown
Contributor Author

softer commented Apr 2, 2026

@h8d13
I think we should at least start... :)

@h8d13
Copy link
Copy Markdown
Contributor

h8d13 commented Apr 2, 2026

Right but, I'm pointing out related more important stuff aha

Also I believe any arabic, greek, asian languages will not work with these mappings if I understand correctly (lots of issues related to this)

@softer
Copy link
Copy Markdown
Contributor Author

softer commented Apr 2, 2026

You are right, but as far as I understand, these languages are not working correctly at the moment. So nothing will change because of that.

I am thinking about giving the user the ability to set a different font for the installer. We cannot get the current font name, for example, the one set by setfont, so what if we use an environment variable? Let it be named FONT - yes, like in vconsole.conf.

If the user sets a font name there, the installer will use that font and will not change it based on my mappings.

The logic would be as follows: if the variable is set, use only the font from it. If it is not set, use my mapping logic.

What do you think?

@h8d13
Copy link
Copy Markdown
Contributor

h8d13 commented Apr 2, 2026

Well I think what is more useful is to try to make a PR for locale to actually store the font and edit this #4356 (comment)

And get the available ones similar to how we get

def list_locales() -> list[str]:

Then you'd have it working inside your install too + add terminus-font when anything ter is selected

image

About the initial PR: an ENV var seems reasonable, it would be better to hook it up to startup functions before any TUI is being displayed

@softer
Copy link
Copy Markdown
Contributor Author

softer commented Apr 2, 2026

What do you mean? You wanna save selected font (via setfont or my mapping) for target system?

@h8d13
Copy link
Copy Markdown
Contributor

h8d13 commented Apr 2, 2026

Yes currently it's hardcoded as shown in snippet above. So this would be a nice target !

And only need to hook it up said: font_vconsole = your_selection

Then it would just work at first boot for target system too :)

@softer
Copy link
Copy Markdown
Contributor Author

softer commented Apr 2, 2026

I'll think what can I do... :)

softer added 2 commits April 2, 2026 21:47
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.
@softer
Copy link
Copy Markdown
Contributor Author

softer commented Apr 2, 2026

Support FONT environment variable is now done.

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.

I will work on saving the font selection for the target system in a separate PR, as it appears to be a separate task. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants