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