grub-mkfont
Create GRUB font files from TrueType fonts
SYNOPSIS
grub-mkfont [OPTION...] FONT_FILE...
PARAMETERS
-o, --output=FILE
Write the generated GRUB font to FILE.
-s, --size=SIZE
Set the font size in pixels for the generated font.
-r, --range=RANGE
Specify character ranges to include in the font. Ranges are given in Unicode hexadecimal notation (e.g., U+0000-U+00FF, U+0400-U+04FF). This option can be specified multiple times.
-b, --bold
Render the font with bold styling.
-i, --italic
Render the font with italic styling.
-a, --autohint
Enable FreeType's autohinter for improved rendering.
-f, --force
Overwrite the output file if it already exists without prompting.
--help
Display a help message and exit.
--version
Display version information and exit.
DESCRIPTION
grub-mkfont is a utility included in the GRUB bootloader package, designed to convert TrueType Font (TTF) files into a format usable by GRUB. This command is essential for customizing the appearance of the GRUB boot menu, allowing users to incorporate specific fonts, including those required for internationalization or custom graphical themes.
It enables the display of a wider range of characters beyond the default console font, supporting various languages and symbols. The utility takes a TTF file, specifies character ranges to include, and outputs a GRUB-compatible font file (typically .pf2 or .pfw). This font file can then be referenced in the grub.cfg configuration to enhance the GRUB boot experience, creating a more visually appealing and accessible boot environment.
CAVEATS
grub-mkfont strictly requires TrueType Font (TTF) files as input. The generated font files are optimized for GRUB's limited display capabilities, which means complex font features or very high resolutions might not render perfectly.
Users must carefully specify character ranges to ensure all required characters are included, as omitting ranges will result in missing characters in GRUB's display.
OUTPUT FILE FORMAT
The output of grub-mkfont is typically a GRUB Portable Font file, often with a .pf2 or .pfw extension. This compact format is specifically designed for efficient loading and rendering by the GRUB bootloader, ensuring minimal overhead during the boot process.
INTEGRATION WITH GRUB
Once a font file is generated, it needs to be placed in an accessible location for GRUB (e.g., /boot/grub/fonts/). It is then loaded in the grub.cfg configuration file using the `loadfont` command, for example: loadfont /boot/grub/fonts/myfont.pf2.
Subsequently, the font can be applied to the graphical menu by setting the `gfxfont` variable: set gfxfont=myfont.
HISTORY
grub-mkfont is a component of the GRUB 2 bootloader suite, which represents a significant rewrite and advancement over the original GRUB Legacy. Introduced with GRUB 2, this command provides the necessary utility for handling TrueType fonts, a feature crucial for improved internationalization and graphical boot menu capabilities.
Its development reflects GRUB's shift towards a more modular and feature-rich architecture, allowing greater customization of the boot environment beyond basic console text.
SEE ALSO
grub-install(8), grub-mkconfig(8), grub-mkimage(1)