Release 20040914.
[wine/gsoc-2012-control.git] / documentation / fonts.sgml
blobac3b1c57c029f288169ff7efbc888603013ae954
1 <sect1 id="config-fonts-main">
2 <title>Dealing with Fonts</title>
4 <sect2 id="config-windows-fonts">
5 <title>Fonts</title>
7 <para>
8 <note>
9 <para>
10 The <command>fnt2bdf</command> utility is included with
11 Wine. It can be found in the <filename>tools</filename>
12 directory. Links to the other tools mentioned in this
13 document can be found on wine headquarters:
14 <ulink url="http://www.winehq.org/development/">http://www.winehq.org/development/</ulink>
15 </para>
16 </note>
17 </para>
19 <sect3>
20 <title>How To Convert Windows Fonts</title>
21 <para>
22 If you have access to a Windows installation you should use the
23 <command>fnt2bdf</command> utility (found in the
24 <filename>tools</filename> directory) to convert bitmap
25 fonts (<filename>VGASYS.FON</filename>,
26 <filename>SSERIFE.FON</filename>, and
27 <filename>SERIFE.FON</filename>) into the format that the X
28 Window System can recognize.
29 </para>
31 <orderedlist>
32 <listitem>
33 <para>
34 Extract bitmap fonts with <command>fnt2bdf</command>.
35 </para>
36 </listitem>
37 <listitem>
38 <para>
39 Convert <filename>.bdf</filename> files produced by Step
40 1 into <filename>.pcf</filename> files with
41 <command>bdftopcf</command>.
42 </para>
43 </listitem>
44 <listitem>
45 <para>
46 Copy <filename>.pcf</filename> files to the font server
47 directory which is usually
48 <filename>/usr/lib/X11/fonts/misc</filename> (you will
49 probably need superuser privileges). If you want to
50 create a new font directory you will need to add it to
51 the font path.
52 </para>
53 </listitem>
54 <listitem>
55 <para>
56 Run <command>mkfontdir</command> for the directory you
57 copied fonts to. If you are already in X you should run
58 <command>xset fp rehash</command> to make X server aware
59 of the new fonts. You may also or instead have to restart
60 the font server (using e.g.
61 <command>/etc/init.d/xfs restart</command>
62 under Red Hat 7.1)
63 </para>
64 </listitem>
65 <listitem>
66 <para>
67 Edit the <filename>~/.wine/config</filename> file to remove
68 aliases for the fonts you've just installed.
69 </para>
70 </listitem>
71 </orderedlist>
72 <para>
73 Wine can get by without these fonts but 'the look and feel'
74 may be quite different. Also, some applications try to load
75 their custom fonts on the fly (WinWord 6.0) and since Wine
76 does not implement this yet it instead prints out something
77 like;
78 </para>
79 <screen>
80 STUB: AddFontResource( SOMEFILE.FON )
81 </screen>
82 <para>
83 You can convert this file too. Note that
84 <filename>.FON</filename> file may not hold any bitmap
85 fonts and <command>fnt2bdf</command> will fail if this is
86 the case. Also note that although the above message will not
87 disappear Wine will work around the problem by using the
88 font you extracted from the
89 <filename>SOMEFILE.FON</filename>.
90 <command>fnt2bdf</command> will only work for Windows 3.1
91 fonts. It will not work for TrueType fonts.
92 </para>
93 <para>
94 What to do with TrueType fonts? There are several commercial
95 font tools that can convert them to the Type1 format but the
96 quality of the resulting fonts is far from stellar. The
97 other way to use them is to get a font server capable of
98 rendering TrueType (Caldera has one, there also is the free
99 <command>xfstt</command> in
100 <filename>Linux/X11/fonts</filename> on sunsite and mirrors,
101 if you're on FreeBSD you can use the port in
102 <filename>/usr/ports/x11-servers/Xfstt</filename>. And
103 there is <command>xfsft</command> which uses the freetype
104 library, see <link linkend="ttfont-server">freetype</link>
105 description).
106 </para>
107 <para>
108 However, there is a possibility of the native TrueType
109 support via FreeType renderer in the future (hint, hint :-)
110 </para>
111 </sect3>
113 <sect3>
114 <title>How To Add Font Aliases To <filename>~/.wine/config</filename></title>
115 <para>
116 Many Windows applications assume that fonts included in
117 original Windows 3.1 distribution are always present. By
118 default Wine creates a number of aliases that map them on
119 the existing X fonts:
120 </para>
122 <informaltable>
123 <tgroup cols="3">
124 <thead>
125 <row>
126 <entry>Windows font</entry>
127 <entry>...is mapped to...</entry>
128 <entry>X font</entry>
129 </row>
130 </thead>
131 <tbody>
132 <row>
133 <entry>"MS Sans Serif"</entry>
134 <entry align="center">-&gt;</entry>
135 <entry>"-adobe-helvetica-"</entry>
136 </row>
137 <row>
138 <entry>"MS Serif"</entry>
139 <entry align="center">-&gt;</entry>
140 <entry>"-bitstream-charter-"</entry>
141 </row>
142 <row>
143 <entry>"Times New Roman"</entry>
144 <entry align="center">-&gt;</entry>
145 <entry>"-adobe-times-"</entry>
146 </row>
147 <row>
148 <entry>"Arial"</entry>
149 <entry align="center">-&gt;</entry>
150 <entry>"-adobe-helvetica-"</entry>
151 </row>
152 </tbody>
153 </tgroup>
154 </informaltable>
156 <para>
157 There is no default alias for the "System" font. Also, no
158 aliases are created for the fonts that applications install
159 at runtime. The recommended way to deal with this problem
160 is to convert the missing font (see above). If it proves
161 impossible, like in the case with TrueType fonts, you can
162 force the font mapper to choose a closely related X font by
163 adding an alias to the [fonts] section. Make sure that the
164 X font actually exists (with <command>xfontsel</command>
165 tool).
166 </para>
167 <screen>
168 AliasN = [Windows font], [X font] &lt;, optional "mask X font" flag&gt;
169 </screen>
170 <para>
171 Example:
172 </para>
173 <screen>
174 Alias0 = System, --international-, subst
175 Alias1 = ...
177 </screen>
178 <para>
179 Comments:
180 </para>
181 <itemizedlist>
182 <listitem>
183 <para>
184 There must be no gaps in the sequence <literal>{0, ...,
185 N}</literal> otherwise all aliases after the first gap
186 won't be read.
187 </para>
188 </listitem>
189 <listitem>
190 <para>
191 Usually font mapper translates X font names into font
192 names visible to Windows programs in the following
193 fashion:
194 </para>
196 <informaltable>
197 <tgroup cols="3">
198 <thead>
199 <row>
200 <entry>X font</entry>
201 <entry>...will show up as...</entry>
202 <entry>Extracted name</entry>
203 </row>
204 </thead>
205 <tbody>
206 <row>
207 <entry>--international-...</entry>
208 <entry align="center">-&gt;</entry>
209 <entry>"International"</entry>
210 </row>
211 <row>
212 <entry>-adobe-helvetica-...</entry>
213 <entry align="center">-&gt;</entry>
214 <entry>"Helvetica"</entry>
215 </row>
216 <row>
217 <entry>-adobe-utopia-...</entry>
218 <entry align="center">-&gt;</entry>
219 <entry>"Utopia"</entry>
220 </row>
221 <row>
222 <entry>-misc-fixed-...</entry>
223 <entry align="center">-&gt;</entry>
224 <entry>"Fixed"</entry>
225 </row>
226 <row>
227 <entry>-...</entry>
228 <entry align="center">-&gt;</entry>
229 <entry></entry>
230 </row>
231 <row>
232 <entry>-sony-fixed-...</entry>
233 <entry align="center">-&gt;</entry>
234 <entry>"Sony Fixed"</entry>
235 </row>
236 <row>
237 <entry>-...</entry>
238 <entry align="center">-&gt;</entry>
239 <entry></entry>
240 </row>
241 </tbody>
242 </tgroup>
243 </informaltable>
245 <para>
246 Note that since <literal>-misc-fixed-</literal> and
247 <literal>-sony-fixed-</literal> are different fonts Wine
248 modified the second extracted name to make sure Windows
249 programs can distinguish them because only extracted
250 names appear in the font selection dialogs.
251 </para>
252 </listitem>
253 <listitem>
254 <para>
255 "Masking" alias replaces the original extracted name so
256 that in the example case we will have the following
257 mapping:
258 </para>
259 <informaltable>
260 <tgroup cols="3">
261 <thead>
262 <row>
263 <entry>X font</entry>
264 <entry>...is masked to...</entry>
265 <entry>Extracted name</entry>
266 </row>
267 </thead>
268 <tbody>
269 <row>
270 <entry>--international-...</entry>
271 <entry align="center">-&gt;</entry>
272 <entry>"System"</entry>
273 </row>
274 </tbody>
275 </tgroup>
276 </informaltable>
277 <para>
278 "Nonmasking" aliases are transparent to the user and
279 they do not replace extracted names.
280 </para>
281 <para>
282 Wine discards an alias when it sees that the native X
283 font is available.
284 </para>
285 </listitem>
286 <listitem>
287 <para>
288 If you do not have access to Windows fonts mentioned in
289 the first paragraph you should try to substitute the
290 "System" font with nonmasking alias. The
291 <command>xfontsel</command> application will show you
292 the fonts available to X.
293 </para>
294 <screen>
295 Alias.. = System, ...bold font without serifs
296 </screen>
297 </listitem>
298 </itemizedlist>
299 <para>
300 Also, some Windows applications request fonts without
301 specifying the typeface name of the font. Font table starts
302 with Arial in most Windows installations, however X font
303 table starts with whatever is the first line in the
304 <filename>fonts.dir</filename>. Therefore Wine uses the
305 following entry to determine which font to check first.
306 </para>
307 <para>
308 Example:
309 </para>
310 <screen>
311 Default = -adobe-times-
312 </screen>
313 <para>
314 Comments:
315 </para>
316 <para>
317 It is better to have a scalable font family (bolds and
318 italics included) as the default choice because mapper
319 checks all available fonts until requested height and other
320 attributes match perfectly or the end of the font table is
321 reached. Typical X installations have scalable fonts in the
322 <filename>../fonts/Type1</filename> and
323 <filename>../fonts/Speedo</filename> directories.
324 </para>
325 </sect3>
327 <sect3>
328 <title>How To Manage Cached Font Metrics</title>
329 <para>
330 Wine stores detailed information about available fonts in
331 the <filename>~/.wine/cachedmetrics.[display]</filename> file. You
332 can copy it elsewhere and add this entry to the [fonts]
333 section in your <filename>~/.wine/config</filename>:
334 </para>
335 <screen>
336 FontMetrics = &lt;file with metrics&gt;
337 </screen>
338 <para>
339 If Wine detects changes in the X font configuration it will
340 rebuild font metrics from scratch and then it will overwrite
341 <filename>~/.wine/cachedmetrics.[display]</filename> with the new
342 information. This process can take a while.
343 </para>
344 </sect3>
346 <sect3>
347 <title>Too Small Or Too Large Fonts</title>
348 <para>
349 Windows programs may ask Wine to render a font with the
350 height specified in points. However, point-to-pixel ratio
351 depends on the real physical size of your display (15",
352 17", etc...). X tries to provide an estimate of that but it
353 can be quite different from the actual size. You can change
354 this ratio by adding the following entry to the [fonts]
355 section:
356 </para>
357 <screen>
358 Resolution = &lt;integer value&gt;
359 </screen>
360 <para>
361 In general, higher numbers give you larger fonts. Try to
362 experiment with values in the 60 - 120 range. 96 is a good
363 starting point.
364 </para>
365 </sect3>
367 <sect3>
368 <title>"FONT_Init: failed to load ..." Messages On Startup</title>
369 <para>
370 The most likely cause is a broken
371 <filename>fonts.dir</filename> file in one of your font
372 directories. You need to rerun <command>mkfontdir</command>
373 to rebuild this file. Read its manpage for more information.
374 If you can't run <command>mkfontdir</command> on this
375 machine as you are not root, use <command>xset -fp
376 xxx</command> to remove the broken font path.
377 </para>
378 </sect3>
379 </sect2>
381 <sect2 id="ttfont-server">
382 <title>Setting up a TrueType Font Server</title>
383 <para>
384 Follow these instructions to set up a TrueType font server on your system.
385 </para>
387 <orderedlist>
388 <listitem>
389 <para>
390 Get a freetype source archive (<filename>freetype-X.Y.tar.gz</filename> ?).
391 </para>
392 </listitem>
393 <listitem>
394 <para>
395 Read docs, unpack, configure and install
396 </para>
397 </listitem>
398 <listitem>
399 <para>
400 Test the library, e.g. <command>ftview 20 /dosc/win95/fonts/times</command>
401 </para>
402 </listitem>
403 <listitem>
404 <para>
405 Get <filename>xfsft-beta1e.linux-i586</filename>
406 </para>
407 </listitem>
408 <listitem>
409 <para>
410 Install it and start it when booting, e.g. in an
411 rc-script. The manpage for <command>xfs</command>
412 applies.
413 </para>
414 </listitem>
415 <listitem>
416 <para>
417 Follow the hints given by <email>williamc@dai.ed.ac.uk</email>
418 </para>
419 </listitem>
420 <listitem>
421 <para>
422 I got <command>xfsft</command> from
423 <ulink url="http://www.dcs.ed.ac.uk/home/jec/progindex.html">http://www.dcs.ed.ac.uk/home/jec/progindex.html</ulink>.
424 I have it running all the time. Here is
425 <filename>/usr/X11R6/lib/X11/fs/config</filename>:
426 </para>
427 <programlisting>
428 clone-self = on
429 use-syslog = off
430 catalogue = /c/windows/fonts
431 error-file = /usr/X11R6/lib/X11/fs/fs-errors
432 default-point-size = 120
433 default-resolutions = 75,75,100,100
434 </programlisting>
435 <para>
436 Obviously <filename>/c/windows/fonts</filename> is where
437 my Windows fonts on my Win95 <medialabel>C:</medialabel>
438 drive live; could be e.g.
439 <filename>/mnt/dosC/windows/system</filename> for Win31.
440 </para>
441 <para>
442 In <filename>/c/windows/fonts/fonts.scale</filename> I
443 have:
444 </para>
445 <programlisting>
447 arial.ttf -monotype-arial-medium-r-normal--0-0-0-0-p-0-iso8859-1
448 arialbd.ttf -monotype-arial-bold-r-normal--0-0-0-0-p-0-iso8859-1
449 arialbi.ttf -monotype-arial-bold-o-normal--0-0-0-0-p-0-iso8859-1
450 ariali.ttf -monotype-arial-medium-o-normal--0-0-0-0-p-0-iso8859-1
451 cour.ttf -monotype-courier-medium-r-normal--0-0-0-0-p-0-iso8859-1
452 courbd.ttf -monotype-courier-bold-r-normal--0-0-0-0-p-0-iso8859-1
453 courbi.ttf -monotype-courier-bold-o-normal--0-0-0-0-p-0-iso8859-1
454 couri.ttf -monotype-courier-medium-o-normal--0-0-0-0-p-0-iso8859-1
455 times.ttf -monotype-times-medium-r-normal--0-0-0-0-p-0-iso8859-1
456 timesbd.ttf -monotype-times-bold-r-normal--0-0-0-0-p-0-iso8859-1
457 timesbi.ttf -monotype-times-bold-i-normal--0-0-0-0-p-0-iso8859-1
458 timesi.ttf -monotype-times-medium-i-normal--0-0-0-0-p-0-iso8859-1
459 symbol.ttf -monotype-symbol-medium-r-normal--0-0-0-0-p-0-microsoft-symbol
460 wingding.ttf -microsoft-wingdings-medium-r-normal--0-0-0-0-p-0-microsoft-symbol
461 </programlisting>
462 <para>
463 In <filename>/c/windows/fonts/fonts.dir</filename> I have
464 exactly the same.
465 </para>
466 <para>
467 In <filename>/usr/X11R6/lib/X11/XF86Config</filename> I have
468 </para>
469 <programlisting>
470 FontPath "tcp/localhost:7100"
471 </programlisting>
472 <para>
473 in front of the other <literal>FontPath</literal> lines.
474 That's it! As an interesting by-product of course, all
475 those web pages which specify Arial come up in Arial in
476 Netscape ...
477 </para>
478 </listitem>
479 <listitem>
480 <para>
481 Shut down X and restart (and debug errors you did while
482 setting up everything).
483 </para>
484 </listitem>
485 <listitem>
486 <para>
487 Test with e.g. <command>xlsfont | grep arial</command>
488 </para>
489 </listitem>
490 </orderedlist>
492 </sect2>
494 </sect1>
496 <!-- Keep this comment at the end of the file
497 Local variables:
498 mode: sgml
499 sgml-parent-document:("wine-user.sgml" "set" "book" "chapter" "")
500 End: