Background: I am trying to create a custom theme for the GRUB bootloader using a specific font that I've generated myself. However, I'm encountering issues loading the font file.
Steps:
I generated the font with the following command:
sudo grub-mkfont --output=./DejaVuSansMono20.pf2 --size=20 /usr/share/fonts/TTF/dejavu/DejaVuSansMono.ttf
I attempted to load it in my theme.txt file, but it defaults to using the standard font, even though the text color settings are applied correctly.
Here's the relevant section of my theme.txt:
desktop-image: "background.png"
title-text: ""
terminal-box: "terminal_*.png"
terminal-left: "10%"
terminal-top: "25%"
terminal-width: "80%"
terminal-height: "50%"
boot_menu {
left = 20%
width = 60%
top = 30%
height = 40%
item_font = "DejaVuSansMono20.pf2"
item_color = "#808080"
selected_item_font = "DejaVuSansMono30.pf2""
selected_item_color = "#ff0000"
}
What I have tried
I based my theme on another theme where the font is working, but it does not use the file name; instead, it uses a different name. I thought it might relate to the -n flag described here:
https://manpages.ubuntu.com/manpages/noble/man1/grub-mkfont.1.html
Unfortunately, using the -n flag didn't resolve the issue. I also tried removing the fonts from the other theme, and as expected, they were not loaded, confirming that it does use the fonts from its directory.
Is there any documentation or guidance on how to properly create and load your own fonts for a GRUB theme? I've already looked through the official GRUB manual here: https://www.gnu.org/software/grub/manual/grub/html_node/Theme-file-format.html#Fonts, but it wasn't helpful for this issue.
System:
Distributor ID: Ubuntu
Description: Ubuntu 24.04 LTS
Release: 24.04
Codename: noble
Tools
- grub2-theme-preview 2.8.0 (used only to test the theme)
- grub-install (GRUB) 2.12-1ubuntu7
Problems:
- How to load a font file generated by grub-mkfont in a theme?
- Is it possible to test a pf2 in any font viewer?
EDIT: I use Ubuntu version 24.04 and the grub boot-loader that came with the installation. I have downloaded some extra tools to edit the theme preview the bootloader theme.