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