21 Jan 2017

Setting console font size on HiDPI screens in Fedora

I recently switched to another laptop which has a HiDPI screen. As usual, the thing is running Fedora (currently in version 25). Especially the KDE desktop was quite easy to configure to be usable; basically, it is a thing of starting System Settings, going to Display and Monitor and using the Scale Display button to bring up a neat configuration dialog which allows you to set a scaling factor for the monitor. For my particular setup, a factor of 2 works quite nice for the UI to be usable.

One open point was the font size in the Linux console as well as in GRUB2. However, some configuration changes later this was fixed as well ;-)

Increasing Font Size of GRUB2

First, I generated a custom font file from one of the TTF fonts installed on my system (in this case from Google Noto):

sudo mkdir /boot/grub2/fonts
sudo grub2-mkfont -s 36 -o /boot/grub2/fonts/NotoSansRegular36.pf2 \

This font can now be used in /etc/default/grub:

GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)" 

Basically, I added the GRUB_FONT entry which points to the font to use. In addition, I had to change the GRUB_TERMINAL_OUTPUT from console to gfxterm.

Note: The remaining entries must remain as they are! Only edit the two variables. Finally, the GRUB configuration can be regenerated. Depending on whether you have EFI or a BIOS, this can be done via:

sudo grub2-mkconfig -o /boot/grub2/grub.cfg

# EFI:
sudo grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg

Increasing the Console Font Size

To increase the font size for the Linux console (Ctrl+Alt+F[2-8]), first install the terminus fonts:

sudo dnf install terminus-fonts-console

Now, change to a TTY and use the setfont command to load one of the fonts. You will find them in /usr/lib/kbd/consolefonts/. For me, the ter-m32n font works quite nicely:

sudo setfont ter-m32n

To make this font the default console font, edit /etc/vconsole.conf and adjust the FONT entry:

Thank You For Reading
Martin Hoeher

I am a software/firmware developer, working in Dresden, Germany. In my free time, I spent some time on developing apps, presenting some interesting findings here in my blog.

Your comment has been filed

We'll review it and it will appear here as soon as we're done.

Sorry, something went wrong...

Your comment could not be posted.

Regarding your personal information...
  • The name you enter will be shown next to your comment. You may enter your real name or whatever you like.
  • Your e-mail will be used to show an image representing you next to your comment. We do not store nor show your address somewhere. Instead, an ID will be calculated from it and stored. This ID is then used to retrieve an image from Gravatar.