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