grub-mkfont
Create GRUB font files from TrueType fonts
SYNOPSIS
grub-mkfont [OPTION...] [FONT_FILE]
PARAMETERS
-o, --output=FILE
Set output filename for the generated PF2 font
-s, --size=PIXELS
Set font size in pixels (default: 12)
--prefix=DIR
Set GRUB prefix directory (default: /boot/grub)
--no-double-scan
Disable second glyph scan for better performance
--range=RANGE
Specify Unicode glyph ranges, e.g., 0x20-0x7E,0x390-0x3A1
-v, --verbose
Enable verbose output
--target=PLATFORM
Set target platform, e.g., i386-pc, x86_64-efi
--help
Display usage summary and exit
--version
Print version information and exit
DESCRIPTION
grub-mkfont is a utility from the GRUB2 bootloader suite used to convert scalable font files (such as TTF, OTF, or Type1) into GRUB's proprietary PF2 raster font format. This enables custom fonts in GRUB's graphical console, boot menus, and themes.
GRUB2 relies on PF2 fonts for rendering text in its terminal emulator, supporting Unicode glyphs for international characters. The tool leverages libraries like FreeType or Pango to rasterize glyphs at specified pixel sizes, generating bitmaps optimized for GRUB modules.
Common workflow: Install fonts system-wide, then run grub-mkfont to create PF2 files in /boot/grub/fonts/, and embed them via grub-mkimage into the core image or theme. Supports glyph range selection to reduce file size by including only needed characters, ideal for embedded systems.
Without custom fonts, GRUB defaults to built-in ASCII fonts, limiting display quality and language support.
CAVEATS
Requires font rendering libraries like FreeType/Pango; output is platform-specific if --target used. Large glyph ranges increase file size significantly.
TYPICAL USAGE
grub-mkfont -o /boot/grub/fonts/unicode.pf2 -s 32 /usr/share/fonts/TTF/DejaVuSans.ttf --range=0x20-0x7FF
OUTPUT VERIFICATION
PF2 files can be inspected with hexdump or loaded via GRUB's loadfont command in the shell.
HISTORY
Introduced in GRUB 1.98 (2009) as part of GRUB2 development for graphical improvements; matured in GRUB 2.02 (2012) with Unicode and theme support.
SEE ALSO
grub-mkimage(1), grub-install(8), grub-mkconfig(8)


