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