mbod
December 16, 2021, 10:13am
1
Hi,
I tried to change the fonts in the grub menu based on what I read here:
For example, let’s say you want to use the Hack font size 36 pt. First convert the True Type Font file to pf2:
sudo grub-mkfont --output=/boot/grub/fonts/Hack36.pf2 --size=36 /usr/share/fonts/TTF/Hack-Regular.ttf
And then add the following line to your /etc/default/grub:
GRUB_FONT=/boot/grub/fonts/Hack36.pf2
But it does not work. No matter what I do, the font does not change.
I created this font file: /boot/grub/fonts/Hack144.pf2
. I picked a very huge font size just to make it obvious to me when I look at the menu.
# file /boot/grub/fonts/Hack144.pf2
/boot/grub/fonts/Hack144.pf2: GRUB2 font "Hack Regular 144"
I added
GRUB_FONT=/boot/grub/fonts/Hack144.pf2
to /etc/default/grub
and I created a new grub.cfg. It contains the new fonts:
[...]
if loadfont /boot/grub/fonts/Hack144.pf2 ; then
set gfxmode=2560x1440x32,1600x1200x32,1280x1024x32,auto
load_video
insmod gfxterm
fi
terminal_input console
terminal_output gfxterm
insmod part_gpt
insmod xfs
search --no-floppy --fs-uuid --set=root 0a765f87-6eca-4e05-bd1a-36ac4ba3fb8f
insmod gfxmenu
loadfont ($root)/boot/grub/themes/EndeavourOS/unifont-regular-16.pf2
insmod png
set theme=($root)/boot/grub/themes/EndeavourOS/theme.txt
export theme
[...]
I also eliminate all *fonts definitions from /boot/grub/themes/EndeavourOS/theme.txt
But the grub menu is the same as always. What is going wrong here?
I don’t know if this is the reason you’re having an issue, but - have you tried with a more sane font size, like perhaps 44, rather than 144? I can find no documentation that lists a maximum allowable font size, but perhaps GRUB doesn’t like triple-digit integers for that field. Just a guess.
EDIT - Ah, I forgot about the EndeavourOS GRUB theme (I don’t use EndeavourOS, nor any themes on my GRUB). Just for troubleshooting, if you comment out the GRUB_THEME=
line in /etc/default/grub
, do your fonts show properly?
mbod
December 16, 2021, 5:03pm
3
Yes, indeed, the font is changed when I comment out the GRUB_THEME. So it is theme related.
But I eliminated all fonts definitions from EndeavourOS/theme.txt
theme.txt
# cat theme.txt
# GRUB2 gfxmenu Linux EndeavourOS theme
# Designed for any resolution
# Global Property
title-text: ""
desktop-image: "background.png"
desktop-color: "#000000"
terminal-box: "terminal_box_*.png"
terminal-left: "0"
terminal-top: "0"
terminal-width: "100%"
terminal-height: "100%"
terminal-border: "0"
# Show the boot menu
+ boot_menu {
left = 10%
top = 10%
width = 80%
height = 80%
item_color = "#cccccc"
selected_item_color = "#ffffff"
item_height = 24
item_spacing = 16
selected_item_pixmap_style = "select_*.png"
}
# Show a countdown message using the label component
+ label {
top = 82%
left = 35%
width = 30%
align = "center"
id = "__timeout__"
text = "Booting in %d seconds"
color = "#cccccc"
}
1 Like
Depends on the order of execution for font setting.
Your manual font override could be being set correctly initially, but then is subsequently clobbered when the theme is loaded.
What if you explicitly set the font within the theme?
3 Likes
Did you run sudo grub-mkconfig -o /boot/grub/grub.cfg
after making these changes?
mbod
December 17, 2021, 7:34am
7
This actually did the trick. It is not sufficient to remove the font definitions from theme.txt and to add GRUB_FONT to /detc/default/grub.
I had to add the font to theme.txt
/boot/grub/themes/EndeavourOS/theme.txt
# cat theme.txt
# GRUB2 gfxmenu Linux EndeavourOS theme
# Designed for any resolution
# Global Property
title-text: ""
desktop-image: "background.png"
desktop-color: "#000000"
terminal-font: "Hack Regular 24"
terminal-box: "terminal_box_*.png"
terminal-left: "0"
terminal-top: "0"
terminal-width: "100%"
terminal-height: "100%"
terminal-border: "0"
# Show the boot menu
+ boot_menu {
left = 10%
top = 10%
width = 80%
height = 80%
item_font = "Hack Regular 24"
item_color = "#cccccc"
selected_item_color = "#ffffff"
item_height = 24
item_spacing = 16
selected_item_pixmap_style = "select_*.png"
}
# Show a countdown message using the label component
+ label {
top = 82%
left = 35%
width = 30%
align = "center"
id = "__timeout__"
text = "Booting in %d seconds"
color = "#cccccc"
font = "Hack Regular 24"
}
Thanks for helping!
1 Like
system
Closed
December 19, 2021, 7:34am
8
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.