blob: ac3b1c57c029f288169ff7efbc888603013ae954 [file] [log] [blame]
Andreas Mohr56e6cd02003-04-01 03:26:13 +00001 <sect1 id="config-fonts-main">
John R. Sheets1e8e5ba2000-08-08 01:24:00 +00002 <title>Dealing with Fonts</title>
3
Andreas Mohr56e6cd02003-04-01 03:26:13 +00004 <sect2 id="config-windows-fonts">
John R. Sheets1e8e5ba2000-08-08 01:24:00 +00005 <title>Fonts</title>
6
7 <para>
John R. Sheets1e8e5ba2000-08-08 01:24:00 +00008 <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:
Dimitrie O. Paunc0232542003-11-26 03:55:01 +000014 <ulink url="http://www.winehq.org/development/">http://www.winehq.org/development/</ulink>
John R. Sheets1e8e5ba2000-08-08 01:24:00 +000015 </para>
16 </note>
17 </para>
18
Ian Pilcher744820d2001-04-02 19:14:41 +000019 <sect3>
John R. Sheets1e8e5ba2000-08-08 01:24:00 +000020 <title>How To Convert Windows Fonts</title>
21 <para>
Bill Medland88bb9262001-10-04 16:14:43 +000022 If you have access to a Windows installation you should use the
John R. Sheets1e8e5ba2000-08-08 01:24:00 +000023 <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
Andreas Mohr5ec74d62002-07-24 03:00:02 +000028 Window System can recognize.
John R. Sheets1e8e5ba2000-08-08 01:24:00 +000029 </para>
30
31 <orderedlist>
32 <listitem>
Vincent Béronb940e372003-07-21 22:42:50 +000033 <para>
34 Extract bitmap fonts with <command>fnt2bdf</command>.
35 </para>
John R. Sheets1e8e5ba2000-08-08 01:24:00 +000036 </listitem>
37 <listitem>
38 <para>
39 Convert <filename>.bdf</filename> files produced by Step
40 1 into <filename>.pcf</filename> files with
John R. Sheetsd9e064f2000-12-13 21:52:37 +000041 <command>bdftopcf</command>.
John R. Sheets1e8e5ba2000-08-08 01:24:00 +000042 </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
Bill Medland88bb9262001-10-04 16:14:43 +000059 of the new fonts. You may also or instead have to restart
Andreas Mohr5ec74d62002-07-24 03:00:02 +000060 the font server (using e.g.
Bill Medland88bb9262001-10-04 16:14:43 +000061 <command>/etc/init.d/xfs restart</command>
Andreas Mohr56e6cd02003-04-01 03:26:13 +000062 under Red Hat 7.1)
John R. Sheets1e8e5ba2000-08-08 01:24:00 +000063 </para>
64 </listitem>
65 <listitem>
66 <para>
Chris Morgan9a949802001-01-18 23:03:47 +000067 Edit the <filename>~/.wine/config</filename> file to remove
John R. Sheets1e8e5ba2000-08-08 01:24:00 +000068 aliases for the fonts you've just installed.
69 </para>
70 </listitem>
71 </orderedlist>
72 <para>
Francois Gouget75721482003-01-05 01:08:56 +000073 Wine can get by without these fonts but 'the look and feel'
John R. Sheets1e8e5ba2000-08-08 01:24:00 +000074 may be quite different. Also, some applications try to load
Francois Gouget75721482003-01-05 01:08:56 +000075 their custom fonts on the fly (WinWord 6.0) and since Wine
John R. Sheets1e8e5ba2000-08-08 01:24:00 +000076 does not implement this yet it instead prints out something
77 like;
78 </para>
79 <screen>
80STUB: 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
Francois Gouget75721482003-01-05 01:08:56 +000087 disappear Wine will work around the problem by using the
John R. Sheets1e8e5ba2000-08-08 01:24:00 +000088 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
Andreas Mohra5589d52002-06-04 23:09:34 +0000104 library, see <link linkend="ttfont-server">freetype</link>
105 description).
John R. Sheets1e8e5ba2000-08-08 01:24:00 +0000106 </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>
Ian Pilcher744820d2001-04-02 19:14:41 +0000111 </sect3>
John R. Sheets1e8e5ba2000-08-08 01:24:00 +0000112
Ian Pilcher744820d2001-04-02 19:14:41 +0000113 <sect3>
Chris Morgan9a949802001-01-18 23:03:47 +0000114 <title>How To Add Font Aliases To <filename>~/.wine/config</filename></title>
John R. Sheets1e8e5ba2000-08-08 01:24:00 +0000115 <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>
121
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>
155
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>
168AliasN = [Windows font], [X font] &lt;, optional "mask X font" flag&gt;
169 </screen>
170 <para>
171 Example:
172 </para>
173 <screen>
174Alias0 = System, --international-, subst
175Alias1 = ...
176...
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>
195
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>
244
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
Andreas Mohr5ec74d62002-07-24 03:00:02 +0000250 names appear in the font selection dialogs.
John R. Sheets1e8e5ba2000-08-08 01:24:00 +0000251 </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>
295Alias.. = 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
Francois Gouget75721482003-01-05 01:08:56 +0000304 <filename>fonts.dir</filename>. Therefore Wine uses the
John R. Sheets1e8e5ba2000-08-08 01:24:00 +0000305 following entry to determine which font to check first.
306 </para>
307 <para>
308 Example:
309 </para>
310 <screen>
311Default = -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>
Ian Pilcher744820d2001-04-02 19:14:41 +0000325 </sect3>
John R. Sheets1e8e5ba2000-08-08 01:24:00 +0000326
Ian Pilcher744820d2001-04-02 19:14:41 +0000327 <sect3>
John R. Sheets1e8e5ba2000-08-08 01:24:00 +0000328 <title>How To Manage Cached Font Metrics</title>
329 <para>
Francois Gouget75721482003-01-05 01:08:56 +0000330 Wine stores detailed information about available fonts in
Francois Gouget58b299522001-10-08 20:40:09 +0000331 the <filename>~/.wine/cachedmetrics.[display]</filename> file. You
John R. Sheets1e8e5ba2000-08-08 01:24:00 +0000332 can copy it elsewhere and add this entry to the [fonts]
Chris Morgan9a949802001-01-18 23:03:47 +0000333 section in your <filename>~/.wine/config</filename>:
John R. Sheets1e8e5ba2000-08-08 01:24:00 +0000334 </para>
335 <screen>
336FontMetrics = &lt;file with metrics&gt;
337 </screen>
338 <para>
Francois Gouget75721482003-01-05 01:08:56 +0000339 If Wine detects changes in the X font configuration it will
John R. Sheets1e8e5ba2000-08-08 01:24:00 +0000340 rebuild font metrics from scratch and then it will overwrite
Francois Gouget58b299522001-10-08 20:40:09 +0000341 <filename>~/.wine/cachedmetrics.[display]</filename> with the new
John R. Sheets1e8e5ba2000-08-08 01:24:00 +0000342 information. This process can take a while.
343 </para>
Ian Pilcher744820d2001-04-02 19:14:41 +0000344 </sect3>
John R. Sheets1e8e5ba2000-08-08 01:24:00 +0000345
Ian Pilcher744820d2001-04-02 19:14:41 +0000346 <sect3>
John R. Sheets1e8e5ba2000-08-08 01:24:00 +0000347 <title>Too Small Or Too Large Fonts</title>
348 <para>
Francois Gouget75721482003-01-05 01:08:56 +0000349 Windows programs may ask Wine to render a font with the
John R. Sheets1e8e5ba2000-08-08 01:24:00 +0000350 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>
358Resolution = &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>
Ian Pilcher744820d2001-04-02 19:14:41 +0000365 </sect3>
John R. Sheets1e8e5ba2000-08-08 01:24:00 +0000366
Ian Pilcher744820d2001-04-02 19:14:41 +0000367 <sect3>
John R. Sheets1e8e5ba2000-08-08 01:24:00 +0000368 <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>
Ian Pilcher744820d2001-04-02 19:14:41 +0000378 </sect3>
379 </sect2>
John R. Sheets1e8e5ba2000-08-08 01:24:00 +0000380
Ian Pilcher744820d2001-04-02 19:14:41 +0000381 <sect2 id="ttfont-server">
John R. Sheets1e8e5ba2000-08-08 01:24:00 +0000382 <title>Setting up a TrueType Font Server</title>
383 <para>
John R. Sheets1e8e5ba2000-08-08 01:24:00 +0000384 Follow these instructions to set up a TrueType font server on your system.
385 </para>
386
387 <orderedlist>
388 <listitem>
Vincent Béronb940e372003-07-21 22:42:50 +0000389 <para>
390 Get a freetype source archive (<filename>freetype-X.Y.tar.gz</filename> ?).
391 </para>
John R. Sheets1e8e5ba2000-08-08 01:24:00 +0000392 </listitem>
393 <listitem>
Vincent Béronb940e372003-07-21 22:42:50 +0000394 <para>
395 Read docs, unpack, configure and install
396 </para>
John R. Sheets1e8e5ba2000-08-08 01:24:00 +0000397 </listitem>
398 <listitem>
Vincent Béronb940e372003-07-21 22:42:50 +0000399 <para>
400 Test the library, e.g. <command>ftview 20 /dosc/win95/fonts/times</command>
401 </para>
John R. Sheets1e8e5ba2000-08-08 01:24:00 +0000402 </listitem>
403 <listitem>
Vincent Béronb940e372003-07-21 22:42:50 +0000404 <para>
405 Get <filename>xfsft-beta1e.linux-i586</filename>
406 </para>
John R. Sheets1e8e5ba2000-08-08 01:24:00 +0000407 </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>
Vincent Béronb940e372003-07-21 22:42:50 +0000416 <para>
417 Follow the hints given by <email>williamc@dai.ed.ac.uk</email>
418 </para>
John R. Sheets1e8e5ba2000-08-08 01:24:00 +0000419 </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>
428clone-self = on
429use-syslog = off
430catalogue = /c/windows/fonts
431error-file = /usr/X11R6/lib/X11/fs/fs-errors
432default-point-size = 120
433default-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.
Susan Farley3b10efe2001-09-26 23:02:31 +0000440 </para>
441 <para>
John R. Sheets1e8e5ba2000-08-08 01:24:00 +0000442 In <filename>/c/windows/fonts/fonts.scale</filename> I
Susan Farley3b10efe2001-09-26 23:02:31 +0000443 have:
John R. Sheets1e8e5ba2000-08-08 01:24:00 +0000444 </para>
445 <programlisting>
44614
447arial.ttf -monotype-arial-medium-r-normal--0-0-0-0-p-0-iso8859-1
448arialbd.ttf -monotype-arial-bold-r-normal--0-0-0-0-p-0-iso8859-1
449arialbi.ttf -monotype-arial-bold-o-normal--0-0-0-0-p-0-iso8859-1
450ariali.ttf -monotype-arial-medium-o-normal--0-0-0-0-p-0-iso8859-1
451cour.ttf -monotype-courier-medium-r-normal--0-0-0-0-p-0-iso8859-1
452courbd.ttf -monotype-courier-bold-r-normal--0-0-0-0-p-0-iso8859-1
453courbi.ttf -monotype-courier-bold-o-normal--0-0-0-0-p-0-iso8859-1
454couri.ttf -monotype-courier-medium-o-normal--0-0-0-0-p-0-iso8859-1
455times.ttf -monotype-times-medium-r-normal--0-0-0-0-p-0-iso8859-1
456timesbd.ttf -monotype-times-bold-r-normal--0-0-0-0-p-0-iso8859-1
457timesbi.ttf -monotype-times-bold-i-normal--0-0-0-0-p-0-iso8859-1
458timesi.ttf -monotype-times-medium-i-normal--0-0-0-0-p-0-iso8859-1
459symbol.ttf -monotype-symbol-medium-r-normal--0-0-0-0-p-0-microsoft-symbol
460wingding.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>
470FontPath "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>
Vincent Béronb940e372003-07-21 22:42:50 +0000486 <para>
487 Test with e.g. <command>xlsfont | grep arial</command>
488 </para>
John R. Sheets1e8e5ba2000-08-08 01:24:00 +0000489 </listitem>
490 </orderedlist>
491
Ian Pilcher744820d2001-04-02 19:14:41 +0000492 </sect2>
John R. Sheets1e8e5ba2000-08-08 01:24:00 +0000493
Ian Pilcher744820d2001-04-02 19:14:41 +0000494</sect1>
John R. Sheets1e8e5ba2000-08-08 01:24:00 +0000495
496<!-- Keep this comment at the end of the file
497Local variables:
498mode: sgml
Dimitrie O. Paun255ecc52003-04-19 02:50:57 +0000499sgml-parent-document:("wine-user.sgml" "set" "book" "chapter" "")
John R. Sheets1e8e5ba2000-08-08 01:24:00 +0000500End:
501-->