How to setup using different font size (and possible different fonts) in different vt ?

Dear FreeBSD Gurus!

This mean (for example) “8x16” in ttyv1 (autologon btop user w/ restrictions) and “10x18” in all others ttys.

Thank You all for detailed explanation! ;)
 
If the system is UEFI then it's possible. In (UEFI) framebuffer mode the console supports setting different font sizes (or fonts) for individual consoles in vt(4).

Tested on 13.2-RELEASE.

“10x18” in all others ttys
For all consoles one can set a font size (from /boot/fonts) in /boot/loader.conf with the screen.font variable (It's also possible to add custom fonts in that directory besides the default). The font has effect at the boot menu already.

Or individually for all consoles by following procedure, overriding the system wide console font setting from above:
“8x16” in ttyv1 (autologon btop user w/ restrictions)
For btop virtual console a specific font (and size) can be specified from /etc/rc.conf, with a modified /etc/rc.d/syscons rc(8) script.

As example for ttyv1, font /usr/share/vt/fonts/vgarom-8x16.fnt is used:

Copy /etc/rc.d/syscons > syscons.orig

/etc/rc.d/syscons
Rich (BB code):
46 kbddev=/dev/ttyv0
47 viddev=/dev/ttyv0
+ viddev1=/dev/ttyv1

316         # font 8x8
317         #
318         case ${font8x8} in
319         [Nn][Oo] | '')
320                 ;;
321         *)
322                 sc_init
323                 echo -n ' font8x8';     vidcontrol < ${viddev} -f 8x8 ${font8x8}
324                 ;;
325         esac

+         # font btop8x16
+         #
+         case ${btop8x16} in
+         [Nn][Oo] | '')
+                 ;;
+         *)
+                 sc_init
+                 echo -n ' btop8x16';     vidcontrol < ${viddev1} -f 8x16 ${btop8x16}
+                 ;;
+         esac
/etc/rc.conf
Code:
btop8x16="vgarom-8x16"

As mentioned before, one can use custom fonts also. For example if vgarom-8x16 is not to your liking, try to copy /boot/fonts/8x16.fnt.gz (a Terminus font if I'm not mistaken) to /usr/share/vt/fonts, gunzip(1), rename, and set in /etc/rc.conf.

Or install from ports some .fnt fonts. Some might not work though.
 
In your specific case (autologin of user), If your system is BIOS, it's possible to set a specific font size to the console btop is running on by adding a vidcontrol(1) line into the login shells configuration file.

Make sure the console resolution is high. At the boot menu escape to loader prompt, enter vbe list, choose a resolution, try it out ( vbe set <mode>), boot into multiuser, edit
/boot/loader.conf (i.e.)
Code:
exec="vbe set 0x147"

Set font system wide 10x18:
Code:
cp /boot/fonts/10x18.fnt.gz /usr/share/vt/fonts/terminus-10x18.fnt.gz
gunzip /usr/share/vt/fonts/terminus-10x18.fnt.gz

/etc/rc.conf
Code:
allsreens_flags="-f terminus-10x18"

ttyv1, set font to autologin users console:
Code:
cp /boot/fonts/8x16.fnt.gz  /usr/share/vt/fonts/terminus-8x16.fnt.gz
gunzip /usr/share/vt/fonts/terminus-8x16.fnt.gz

Login shell configuration file:
Code:
vidcontrol -f terminus-8x16
/usr/local/bin/btop
 
Back
Top