-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
contrib/: expand font setting capabilities
ZFSBootMenu binary releases use a default font size that's barely suitable for 2k screens and entirely unsuitable for 4k screens. In an attempt to fix this, a new script has been added that introduces automatic console font resizing. Utilizing the Terminus font, we can pick a range of bold font sizes to better match screen resolutions. Working backwards from the largest to the smallest, the hook simply runs `setfont` and then checks if COLUMNS is at least 100 characters. If it is not, the next font is selected and it tries again. Based on documentation, Terminus fonts prefixed with a 'v' have all mappings/codepages in them; so they should support the maximal number of languages. contrib/20-console-autosize.sh is included in all release and recovery images. The automatic font setting behavior can be disabled via zbm.autosize=(0|off). contrib/console-init.sh has been renamed to ensure it precedes this hook, since 10-console-init.sh calls console_init from Dracut, which is hard-coded to set a console font. Since console_init also performs setting a keymap, it should always be executed. The legacy behavior of setting a font via rd.vconsole.font overrides/disables zbm.autosize.
- Loading branch information
Showing
5 changed files
with
47 additions
and
2 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/bin/bash | ||
# vim: softtabstop=2 shiftwidth=2 expandtab | ||
|
||
## This early-setup hook attempts to get a physical (non-serial) console | ||
## to at least 100 columns. The Dracut module 'i18n' is required to populate | ||
## /usr/share/consolefonts and to add the 'setfont' binary. | ||
## | ||
## This hook is enabled by default in Release and Recovery builds. To disable, | ||
## add `zbm.autosize=off` to the ZFSBootMenu kernel commandline. | ||
## If rd.vconsole.font is defined, autosizing is skipped to not override | ||
## this font preference. | ||
|
||
|
||
#shellcheck disable=SC1091 | ||
source /lib/zfsbootmenu-kcl.sh || exit 1 | ||
source /lib/kmsg-log-lib.sh || exit 1 | ||
|
||
if [ -z "${control_term}" ] && [ -f /etc/zfsbootmenu.conf ]; then | ||
#shellcheck disable=SC1091 | ||
source /etc/zfsbootmenu.conf | ||
fi | ||
|
||
[ -c "${control_term}" ] || exit 1 | ||
|
||
# Ensure that control_term is not a serial console | ||
tty_re='/dev/tty[0-9]' | ||
[[ ${control_term} =~ ${tty_re} ]] || exit 1 | ||
|
||
if get_zbm_bool 1 zbm.autosize && ! font=$( get_zbm_arg rd.vconsole.font ) ; then | ||
for font in ter-v32b ter-v28b ter-v24b ter-v20b ter-v14b ; do | ||
setfont "${font}" >/dev/null 2>&1 | ||
if [ "${COLUMNS}" -ge 100 ]; then | ||
zdebug "set font to ${font}, screen is ${COLUMNS}x${LINES}" | ||
break | ||
fi | ||
done | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters