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.
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"
}
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/bionic/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.