Set console font automatically when selecting language#4356
Set console font automatically when selecting language#4356softer wants to merge 3 commits intoarchlinux:masterfrom
Conversation
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.
|
I need to test this thoroughly, we had quite some issues in the past with this. |
|
Perhaps we can simply reset the font to the "default8x16" when exiting? |
|
On a side note @softer : I believe picking any terminus font will cause an error because target would need an extra package archinstall/archinstall/lib/installer.py Lines 1978 to 1986 in 6c9f662 This is the case because 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 |
|
@h8d13 |
|
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) |
|
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? |
|
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 Then you'd have it working inside your install too + add
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 |
|
What do you mean? You wanna save selected font (via setfont or my mapping) for target system? |
|
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: Then it would just work at first boot for target system too :) |
|
I'll think what can I do... :) |
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.
|
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. :) |

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.