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