SETFONT(8)
โจ SETFONT(8) โจ
okay bestie, gather round, because this is the manual page for setfont from the System Manager's Manual, and it's literally the thing that loads your EGA/VGA console screen font ๐
no cap.
๐ธ NAME ๐ธ
setfont โ loads an EGA/VGA console screen font. that's it. that's the job. iconic.
๐ฆ SYNOPSIS ๐ฆ
setfont [-O font+umap.orig] [-o font.orig] [-om cmap.orig] [-ou
umap.orig] [-N] [font.new ...] [-m cmap] [-u umap] [-C console] [-hH]
[-f] [-v] [-V]
๐ DESCRIPTION ๐
so the setfont command reads a font out of the file font.new, loads it straight into the EGA/VGA character generator, and โ if you want โ it can also spit out the previous font on the way. it can also load all kinds of mapping tables and output the previous versions of those too. multitasking queen โจ
if you give it no args at all (or only the option -N for some number N), then a default (8xN) font gets loaded (more on that below). and get this โ you can hand it several small fonts, all of them carrying a Unicode table, and setfont will smoosh them together and load the union. obsessed.
typical uses, because examples are everything:
setfont : Load a default font.
setfont drdos8x16 : Load a given font (here the 448-glyph drdos font).
setfont cybercafe -u cybercafe : Load a given font that does not have a Unicode map and provide one explicitly.
setfont LatArCyrHeb-19 -m 8859-2 : Load a given font (here a 512-glyph font combining several character sets) and indicate that one's local character set is ISO 8859-2.
note bestie: if a font has more than 256 glyphs, only 8 out of 16 colors can be used at the same time. and yeah, it can make your console look worse โ loss of intensity and even some colors. ๐ญ not the glow-down.
๐ FONT FORMATS ๐
the standard Linux font format is the PSF font. it's got a header describing font properties like character size, then the glyph bitmaps, and optionally a Unicode mapping table giving the Unicode value for each glyph. several other (obsolete) font formats are also recognized, because we respect the elders.
if the input file has code page format (probably with a suffix like .cp), containing three fonts with sizes e.g. 8x8, 8x14 and 8x16, then one of the options -8 or -14 or -16 must be used to pick one. gotta choose your fighter.
raw font files are binary files of size 256*N bytes, containing bit images for each of 256 characters, one byte per scan line, and N bytes per character (0 < N <= 32). most fonts have a width of 8 bits, but with the framebuffer device (fb) other widths can be used. flexible fr fr.
๐ FONT HEIGHT ๐
so setfont has no built-in knowledge of VGA video modes โ it just asks the kernel to load the character ROM of the video card with certain bitmaps. however (and this is the plot twist), since Linux 1.3.1 the kernel knows enough about EGA/VGA video modes to select a different line distance. the default character height will be the number N inferred from the font or specified by option. but you, main character, can specify a different character height H using the -h option. slay.
๐ CONSOLE MAPS ๐
several mappings are involved in the path from user program output to console display. keep up, bestie, it's a whole journey.
if the console is in utf8 mode (see unicode_start(1)) then the kernel expects that user program output is coded as UTF-8 (see utf-8(7)), and converts that to Unicode (ucs2). otherwise, a translation table is used from the 8-bit program output to 16-bit Unicode values. such a translation table is called a Unicode console map. there are four of them: three built into the kernel, and the fourth settable using the -m option of setfont. an escape sequence chooses between these four tables; after loading a cmap, setfont will output the escape sequence Esc ( K that makes it the active translation. ๐ซ
suitable arguments for the -m option are for example 8859-1, 8859-2, ..., 8859-15, cp437, ..., cp1250.
given the Unicode value of the symbol to be displayed, the kernel finds the right glyph in the font using the Unicode mapping info of the font and displays it. teamwork makes the dream work ๐ซถ
old fonts don't have Unicode mapping info, and in order to handle them there are direct-to-font maps (also loaded using -m) that give a correspondence between user bytes and font positions. the most common correspondence is the one given in the file trivial (where user byte values are used directly as font positions). other correspondences are sometimes preferable since the PC video hardware expects line drawing characters in certain font positions.
giving a -m none argument inhibits the loading and activation of a mapping table. the previous console map can be saved to a file using the -om file option. these options of setfont render mapscrn(8) obsolete. (however, it may be useful to read that man page.) ok so rip to mapscrn but it's still worth a peek, iykyk.
๐ง UNICODE FONT MAPS ๐ง
the correspondence between the glyphs in the font and Unicode values is described by a Unicode mapping table. many fonts have a Unicode mapping table included in the font file, and an explicit table can be indicated using the -u option. the program setfont will load such a Unicode mapping table, unless a -u none argument is given. the previous Unicode mapping table will be saved as part of the saved font file when the -O option is used. it can be saved to a separate file using the -ou file option. these options of setfont render loadunimap(8) obsolete. another one bites the dust ๐
the Unicode mapping table should assign some glyph to the missing character value U+fffd, otherwise missing characters are not translated, giving a usually very confusing result. so like. please do that.
usually no mapping table is needed, and a Unicode mapping table is already contained in the font (sometimes this is indicated by the .psfu extension), so that most users need not worry about the precise meaning and functioning of these mapping tables. breathe, bestie, it's fine.
one may add a Unicode mapping table to a psf font using psfaddtable(1).
๐ OPTIONS ๐
-N,--default8x=Nโ Load default font (default8xN).-hN,--font-height=Nโ Override font height. The short option must not have a space between the prefix and the number.-d,--doubleโ Doubles the size of the font, by replicating all of its pixels vertically and horizontally. This is suitable for high pixel density (e.g."4k") displays on which the standard fonts are too small to be easily legible. Due to kernel limitations, this is suitable only for 16x16 or smaller fonts.-o,--output-font=FILEโ Save previous font in FILE.-om,--output-consolemap=FILEโ Store console map in FILE.-ou,--output-unicodemap=FILEโ Save previous Unicode map in FILE.-O,--output-fullfont=FILEโ Save previous font and Unicode map in FILE.-m,--consolemap=FILEโ Load console map or Unicode console map from FILE.-u,--unicodemap=FILEโ Load Unicode table describing the font from FILE.-C,--console=DEVICEโ Set the font for the indicated console. (May require root permissions.)-f,--forceโ Force-load unicode map: Setfont`issues the system call to load the unicode map even if the specified map is empty. This may be useful in unusual cases.-R,--resetโ Reset the screen font, size, and Unicode mapping to the bootup defaults.-v,--verboseโ Be verbose.-V,--versionโ Print version and exit.-h,--helpโ Print a message describing the options and exit.
โ ๏ธ NOTE โ ๏ธ
PC video hardware allows one to use the "intensity" bit either to indicate brightness, or to address 512 (instead of 256) glyphs in the font. so, if the font has more than 256 glyphs, the console will be reduced to 8 (instead of 16) colors. it's giving tradeoff. it's giving sacrifice. ๐ญ
๐ FILES ๐
/usr/share/kbd/consolefontsโ The default font directory./usr/share/kbd/unimapsโ The default directory for Unicode maps./usr/share/kbd/consoletransโ The default directory for screen mappings.
the default font is a file default (or default8xN if the -N option was given for some number N) perhaps with suitable extension (like .psf). cute.
๐ SEE ALSO ๐
psfaddtable(1), unicode_start(1), loadunimap(8), utf-8(7), mapscrn(8)
and that's the whole page bestie ๐ this one's from kbd, dated 24 October 2024. go forth and load fonts, you absolute icon ๐๐โจ
๐ฆ where this page comes from
- arch rolling: kbd 2.10.0-1 ยท GPL-2.0-or-later
- opensuse-leap 16.0: kbd 2.7.1-160000.3.1 ยท GPL-2.0-or-later AND GPL-3.0-or-later
- opensuse-leap 16.0: kbd 2.7.1-160000.3.1 ยท GPL-2.0-or-later AND GPL-3.0-or-later
- opensuse-leap 16.0: kbd 2.7.1-160000.3.1 ยท GPL-2.0-or-later AND GPL-3.0-or-later
- opensuse-leap 16.0: kbd 2.7.1-160000.3.1 ยท GPL-2.0-or-later AND GPL-3.0-or-later
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms