Debian Codegraph @

upstream/fedora-44/man8/setfont.8

raw
1 .TH SETFONT 8 "24 October 2024" "kbd"
2 .SH NAME
3 setfont \- load EGA/VGA console screen font
4 .SH SYNOPSIS
5 .B setfont
6 .RB [ -O
7 .IR font+umap.orig ]
8 .RB [ -o
9 .IR font.orig ]
10 .RB [ -om
11 .IR cmap.orig ]
12 .RB [ -ou
13 .IR umap.orig ]
14 .RB [ -\c
15 .IR N ]
16 .RI [ "font.new ...\&" ]
17 .RB [ -m
18 .IR cmap ]
19 .RB [ -u
20 .IR umap ]
21 .RB [ -C
22 .IR console ]
23 .RB [ -h\c
24 .IR H ]
25 .RB [ -f ]
26 .RB [ -v ]
27 .RB [ -V ]
28 .IX "setfont command" "" "\fLsetfont\fR command"
29 .SH DESCRIPTION
30 The
31 .B setfont
32 command reads a font from the file
33 .I font.new
34 and loads it into the EGA/VGA character generator,
35 and optionally outputs the previous font.
36 It can also load various mapping tables
37 and output the previous versions.
38 .LP
39 If no args are given (or only the option
40 .RI \- N
41 for some number
42 .IR N ),
43 then a default
44 .RI (8x N )
45 font is loaded (see below).
46 One may give several small fonts, all containing
47 a Unicode table, and
48 .B setfont
49 will combine them and load the union.
50 Typical use:
51 .TP
52 .B setfont
53 Load a default font.
54 .TP
55 .B "setfont drdos8x16"
56 Load a given font (here the 448-glyph drdos font).
57 .TP
58 .B "setfont cybercafe -u cybercafe"
59 Load a given font that does not have a Unicode map
60 and provide one explicitly.
61 .TP
62 .B "setfont LatArCyrHeb-19 -m 8859-2"
63 Load a given font (here a 512-glyph font combining several
64 character sets) and indicate that one's local character set
65 is ISO 8859-2.
66 .LP
67 Note: if a font has more than 256 glyphs, only 8 out of 16 colors
68 can be used simultaneously. It can make console perception worse
69 (loss of intensity and even some colors).
70
71 .SH "FONT FORMATS"
72 The standard Linux font format is the PSF font.
73 It has a header describing font properties like character size,
74 followed by the glyph bitmaps, optionally followed by a Unicode mapping
75 table giving the Unicode value for each glyph.
76 Several other (obsolete) font formats are recognized.
77 If the input file has code page format (probably with suffix .cp),
78 containing three fonts with sizes e.g. 8x8, 8x14 and 8x16, then one of
79 the options \-8 or \-14 or \-16 must be used to select one.
80 Raw font files are binary files of size
81 .RI 256* N
82 bytes, containing bit images for each of 256 characters,
83 one byte per scan line, and
84 .I N
85 bytes per character (0 <
86 .I N
87 <= 32).
88 Most fonts have a width of 8 bits, but with the framebuffer device (fb)
89 other widths can be used.
90
91 .SH "FONT HEIGHT"
92 The program
93 .B setfont
94 has no built-in knowledge of VGA video modes, but just asks
95 the kernel to load the character ROM of the video card with
96 certain bitmaps. However, since Linux 1.3.1 the kernel knows
97 enough about EGA/VGA video modes to select a different line
98 distance. The default character height will be the number
99 .I N
100 inferred from the font or specified by option. However, the
101 user can specify a different character height
102 .I H
103 using the
104 .I "\-h"
105 option.
106
107 .SH "CONSOLE MAPS"
108 Several mappings are involved in the path from user program
109 output to console display. If the console is in utf8 mode (see
110 .BR unicode_start (1))
111 then the kernel expects that user program output is coded as UTF-8 (see
112 .BR utf-8 (7)),
113 and converts that to Unicode (ucs2).
114 Otherwise, a translation table is used from the 8-bit program output
115 to 16-bit Unicode values. Such a translation table is called a
116 .IR "Unicode console map" .
117 There are four of them: three built into the kernel, the fourth
118 settable using the
119 .I "\-m"
120 option of
121 .BR setfont .
122 An escape sequence chooses between these four tables; after loading a
123 .IR cmap ,
124 .B setfont
125 will output the escape sequence Esc ( K that makes it the active translation.
126 .LP
127 Suitable arguments for the
128 .I "\-m"
129 option are for example
130 .IR 8859-1 ,
131 .IR 8859-2 ", ...,"
132 .IR 8859-15 ,
133 .IR cp437 ", ...,"
134 .IR cp1250 .
135 .LP
136 Given the Unicode value of the symbol to be displayed, the kernel
137 finds the right glyph in the font using the Unicode mapping info
138 of the font and displays it.
139 .LP
140 Old fonts do not have Unicode mapping info, and in order to handle
141 them there are direct-to-font maps (also loaded using
142 .IR "\-m" )
143 that give a correspondence between user bytes and font positions.
144 The most common correspondence is the one given in the file
145 .I trivial
146 (where user byte values are used directly as font positions).
147 Other correspondences are sometimes preferable since the
148 PC video hardware expects line drawing characters in certain
149 font positions.
150 .LP
151 Giving a
152 .I "\-m none"
153 argument inhibits the loading and activation of a mapping table.
154 The previous console map can be saved to a file using the
155 .I "\-om file"
156 option.
157 These options of setfont render
158 .BR mapscrn (8)
159 obsolete. (However, it may be useful to read that man page.)
160
161 .SH "UNICODE FONT MAPS"
162 The correspondence between the glyphs in the font and
163 Unicode values is described by a Unicode mapping table.
164 Many fonts have a Unicode mapping table included in
165 the font file, and an explicit table can be indicated using
166 the
167 .I "\-u"
168 option. The program
169 .B setfont
170 will load such a Unicode mapping table, unless a
171 .I "\-u none"
172 argument is given. The previous Unicode mapping table
173 will be saved as part of the saved font file when the \-O
174 option is used. It can be saved to a separate file using the
175 .I "\-ou file"
176 option.
177 These options of setfont render
178 .BR loadunimap (8)
179 obsolete.
180 .LP
181 The Unicode mapping table should assign some glyph to
182 the `missing character' value U+fffd, otherwise missing
183 characters are not translated, giving a usually very confusing
184 result.
185
186 Usually no mapping table is needed, and a Unicode mapping table
187 is already contained in the font (sometimes this is indicated
188 by the .psfu extension), so that most users need not worry
189 about the precise meaning and functioning of these mapping tables.
190
191 One may add a Unicode mapping table to a psf font using
192 .BR psfaddtable (1).
193
194 .SH OPTIONS
195 .TP
196 \fB\-\fR\fI\,N\/\fR, \fB\-\-default8x\fR=\fI\,N\/\fR
197 Load default font
198 .RI (default8x N ).
199 .TP
200 \fB\-h\fR\fI\,N\/\fR, \fB\-\-font-height\fR=\fI\,N\/\fR
201 Override font height. The short option must not have a space between the prefix
202 and the number.
203 .TP
204 \fB\-d\fR, \fB\-\-double\fR
205 Doubles the size of the font, by replicating all of its pixels
206 vertically and horizontally. This is suitable for high pixel density
207 (e.g. "4k") displays on which the standard fonts are too small to be
208 easily legible. Due to kernel limitations, this is suitable only for
209 16x16 or smaller fonts.
210 .TP
211 \fB\-o\fR, \fB\-\-output-font\fR=\fI\,FILE\/\fR
212 Save previous font in
213 .IR FILE .
214 .TP
215 \fB\-om\fR, \fB\-\-output-consolemap\fR=\fI\,FILE\/\fR
216 Store console map in
217 .IR FILE .
218 .TP
219 \fB\-ou\fR, \fB\-\-output-unicodemap\fR=\fI\,FILE\/\fR
220 Save previous Unicode map in
221 .IR FILE .
222 .TP
223 \fB\-O\fR, \fB\-\-output-fullfont\fR=\fI\,FILE\/\fR
224 Save previous font and Unicode map in
225 .IR FILE .
226 .TP
227 \fB\-m\fR, \fB\-\-consolemap\fR=\fI\,FILE\/\fR
228 Load console map or Unicode console map from
229 .IR FILE .
230 .TP
231 \fB\-u\fR, \fB\-\-unicodemap\fR=\fI\,FILE\/\fR
232 Load Unicode table describing the font from
233 .IR FILE .
234 .TP
235 \fB\-C\fR, \fB\-\-console\fR=\fI\,DEVICE\/\fR
236 Set the font for the indicated console. (May require root permissions.)
237 .TP
238 \fB\-f\fR, \fB\-\-force\fR
239 Force-load unicode map: Setfont`issues the system call to load the unicode
240 map even if the specified map is empty. This may be useful in unusual cases.
241 .TP
242 \fB\-R\fR, \fB\-\-reset\fR
243 Reset the screen font, size, and Unicode mapping to the bootup defaults.
244 .TP
245 \fB\-v\fR, \fB\-\-verbose\fR
246 Be verbose.
247 .TP
248 \fB\-V\fR, \fB\-\-version\fR
249 Print version and exit.
250 .TP
251 \fB\-h\fR, \fB\-\-help\fR
252 Print a message describing the options and exit.
253
254 .SH NOTE
255 PC video hardware allows one to use the "intensity" bit
256 either to indicate brightness, or to address 512 (instead of 256)
257 glyphs in the font. So, if the font has more than 256 glyphs,
258 the console will be reduced to 8 (instead of 16) colors.
259
260 .SH FILES
261 .TP
262 .I /usr/lib/kbd/consolefonts
263 The default font directory.
264 .LP
265 .TP
266 .I /usr/lib/kbd/unimaps
267 The default directory for Unicode maps.
268 .LP
269 .TP
270 .I /usr/lib/kbd/consoletrans
271 The default directory for screen mappings.
272 .LP
273 The default font is a file
274 .I default
275 (or
276 .IR default8x N
277 if the \-N option was given for some number N)
278 perhaps with suitable extension (like .psf).
279 .SH "SEE ALSO"
280 .BR psfaddtable (1),
281 .BR unicode_start (1),
282 .BR loadunimap (8),
283 .BR utf-8 (7),
284 .BR mapscrn (8)
285 .\" .SH "AUTHORS"
286 .\" Eugene G. Crosser ([email protected])
287 .\" .br
288 .\" Andries E. Brouwer ([email protected])