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