fonts.sgml 18.4 KB
Newer Older
1
  <sect1 id="config-fonts-main">
2 3
    <title>Dealing with Fonts</title>

4
    <sect2 id="config-windows-fonts">
5 6 7 8 9 10 11 12 13
      <title>Fonts</title>

      <para>
        <note>
          <para>
            The <command>fnt2bdf</command> utility is included with
            Wine. It can be found in the <filename>tools</filename>
            directory. Links to the other tools mentioned in this
            document can be found on wine headquarters:
14
            <ulink url="http://www.winehq.org/development/">http://www.winehq.org/development/</ulink>
15 16 17 18
          </para>
        </note>
      </para>

19
      <sect3>
20 21
        <title>How To Convert Windows Fonts</title>
        <para>
22
          If you have access to a Windows installation you should use the
23 24 25 26 27
          <command>fnt2bdf</command> utility (found in the
          <filename>tools</filename> directory) to convert bitmap
          fonts (<filename>VGASYS.FON</filename>,
          <filename>SSERIFE.FON</filename>, and
          <filename>SERIFE.FON</filename>) into the format that the X
28
          Window System can recognize.
29 30 31 32
        </para>

        <orderedlist>
          <listitem>
33 34 35
            <para>
              Extract bitmap fonts with <command>fnt2bdf</command>.
            </para>
36 37 38 39 40
          </listitem>
          <listitem>
            <para>
              Convert <filename>.bdf</filename> files produced by Step
              1 into <filename>.pcf</filename> files with
John R. Sheets's avatar
John R. Sheets committed
41
              <command>bdftopcf</command>.
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
            </para>
          </listitem>
          <listitem>
            <para>
              Copy <filename>.pcf</filename> files to the font server
              directory which is usually
              <filename>/usr/lib/X11/fonts/misc</filename> (you will
              probably  need superuser privileges). If you want to
              create a new font directory you will need to add it to
              the font path.
            </para>
          </listitem>
          <listitem>
            <para>
              Run <command>mkfontdir</command> for the directory you
              copied fonts to. If you are already in X you should run
              <command>xset fp rehash</command> to make X server aware
59
              of the new fonts. You may also or instead have to restart
60
              the font server (using e.g.
61
              <command>/etc/init.d/xfs restart</command>
62
              under Red Hat 7.1)
63 64 65 66
            </para>
          </listitem>
          <listitem>
            <para>
67
              Edit the <filename>~/.wine/config</filename> file to remove
68 69 70 71 72
              aliases for the fonts you've just installed.
            </para>
          </listitem>
        </orderedlist>
        <para>
73
          Wine can get by without these fonts but 'the look and feel'
74
          may be quite different. Also, some applications try to load
75
          their custom fonts on the fly (WinWord 6.0) and since Wine
76 77 78 79 80 81 82 83 84 85 86
          does not implement this yet it instead prints out something
          like;
        </para>
        <screen>
STUB: AddFontResource( SOMEFILE.FON )
        </screen>
        <para>
          You can convert this file too. Note that
          <filename>.FON</filename> file may not hold  any bitmap
          fonts and <command>fnt2bdf</command> will fail if this is
          the case. Also note that although the above message will not
87
          disappear Wine will work around the problem by using the
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103
          font you extracted from the
          <filename>SOMEFILE.FON</filename>.
          <command>fnt2bdf</command> will only work for Windows 3.1
          fonts. It  will not work for TrueType fonts.
        </para>
        <para>
          What to do with TrueType fonts? There are several commercial
          font tools that can convert them to the Type1 format but the
          quality of the resulting fonts is far from stellar. The
          other way to use them is to get a font server capable of
          rendering  TrueType (Caldera has one, there also is the free
          <command>xfstt</command> in
          <filename>Linux/X11/fonts</filename> on sunsite and mirrors,
          if you're on FreeBSD you can use the port in
          <filename>/usr/ports/x11-servers/Xfstt</filename>.  And
          there is <command>xfsft</command> which uses the freetype
104 105
          library, see <link linkend="ttfont-server">freetype</link>
	  description).
106 107 108 109 110
        </para>
        <para>
          However, there is a possibility of the native TrueType
          support via FreeType renderer in the future (hint, hint :-)
        </para>
111
      </sect3>
112

113
      <sect3>
114
        <title>How To Add Font Aliases To <filename>~/.wine/config</filename></title>
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249
        <para>
          Many Windows applications assume that fonts included in
          original Windows 3.1  distribution are always present. By
          default Wine creates a number of aliases that map them on
          the existing X fonts:
        </para>

        <informaltable>
          <tgroup cols="3">
            <thead>
              <row>
                <entry>Windows font</entry>
                <entry>...is mapped to...</entry>
                <entry>X font</entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry>"MS Sans Serif"</entry>
                <entry align="center">-&gt;</entry>
                <entry>"-adobe-helvetica-"</entry>
              </row>
              <row>
                <entry>"MS Serif"</entry>
                <entry align="center">-&gt;</entry>
                <entry>"-bitstream-charter-"</entry>
              </row>
              <row>
                <entry>"Times New Roman"</entry>
                <entry align="center">-&gt;</entry>
                <entry>"-adobe-times-"</entry>
              </row>
              <row>
                <entry>"Arial"</entry>
                <entry align="center">-&gt;</entry>
                <entry>"-adobe-helvetica-"</entry>
              </row>
            </tbody>
          </tgroup>
        </informaltable>

        <para>
          There is no default alias for the "System" font. Also, no
          aliases are  created for the fonts that applications install
          at runtime. The recommended  way to deal with this problem
          is to convert the missing font (see above).  If it proves
          impossible, like in the case with TrueType fonts, you can
          force  the font mapper to choose a closely related X font by
          adding an alias to the  [fonts] section. Make sure that the
          X font actually exists (with <command>xfontsel</command>
          tool).
        </para>
        <screen>
AliasN = [Windows font], [X font] &lt;, optional "mask X font" flag&gt;
        </screen>
        <para>
          Example:
        </para>
        <screen>
Alias0 = System, --international-, subst
Alias1 = ...
...
        </screen>
        <para>
          Comments:
        </para>
        <itemizedlist>
          <listitem>
            <para>
              There must be no gaps in the sequence <literal>{0, ...,
                N}</literal> otherwise all aliases after the first gap
              won't be read.
            </para>
          </listitem>
          <listitem>
            <para>
              Usually font mapper translates X font names into font
              names visible to Windows programs in the following
              fashion:
            </para>

            <informaltable>
              <tgroup cols="3">
                <thead>
                  <row>
                    <entry>X font</entry>
                    <entry>...will show up as...</entry>
                    <entry>Extracted name</entry>
                  </row>
                </thead>
                <tbody>
                  <row>
                    <entry>--international-...</entry>
                    <entry align="center">-&gt;</entry>
                    <entry>"International"</entry>
                  </row>
                  <row>
                    <entry>-adobe-helvetica-...</entry>
                    <entry align="center">-&gt;</entry>
                    <entry>"Helvetica"</entry>
                  </row>
                  <row>
                    <entry>-adobe-utopia-...</entry>
                    <entry align="center">-&gt;</entry>
                    <entry>"Utopia"</entry>
                  </row>
                  <row>
                    <entry>-misc-fixed-...</entry>
                    <entry align="center">-&gt;</entry>
                    <entry>"Fixed"</entry>
                  </row>
                  <row>
                    <entry>-...</entry>
                    <entry align="center">-&gt;</entry>
                    <entry></entry>
                  </row>
                  <row>
                    <entry>-sony-fixed-...</entry>
                    <entry align="center">-&gt;</entry>
                    <entry>"Sony Fixed"</entry>
                  </row>
                  <row>
                    <entry>-...</entry>
                    <entry align="center">-&gt;</entry>
                    <entry></entry>
                  </row>
                </tbody>
              </tgroup>
            </informaltable>

            <para>
              Note that since <literal>-misc-fixed-</literal> and
              <literal>-sony-fixed-</literal> are different fonts Wine
              modified the second extracted name to make sure Windows
              programs can distinguish them because only extracted
250
              names appear in the font selection dialogs.
251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303
            </para>
          </listitem>
          <listitem>
            <para>
              "Masking" alias replaces the original extracted name so
              that in the  example case we will have the following
              mapping:
            </para>
            <informaltable>
              <tgroup cols="3">
                <thead>
                  <row>
                    <entry>X font</entry>
                    <entry>...is masked to...</entry>
                    <entry>Extracted name</entry>
                  </row>
                </thead>
                <tbody>
                  <row>
                    <entry>--international-...</entry>
                    <entry align="center">-&gt;</entry>
                    <entry>"System"</entry>
                  </row>
                </tbody>
              </tgroup>
            </informaltable>
            <para>
              "Nonmasking" aliases are transparent to the user and
              they do not replace extracted names.
            </para>
            <para>
              Wine discards an alias when it sees that the native X
              font is available.
            </para>
          </listitem>
          <listitem>
            <para>
              If you do not have access to Windows fonts mentioned in
              the first  paragraph you should try to substitute the
              "System" font with  nonmasking alias. The
              <command>xfontsel</command> application will show you
              the fonts available to X.
            </para>
            <screen>
Alias.. = System, ...bold font without serifs
            </screen>
          </listitem>
        </itemizedlist>
        <para>
          Also, some Windows applications request fonts without
          specifying the  typeface name of the font. Font table starts
          with Arial in most Windows  installations, however X font
          table starts with whatever is the first line  in the
304
          <filename>fonts.dir</filename>.  Therefore Wine uses the
305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324
          following entry to determine  which font to check first.
        </para>
        <para>
          Example:
        </para>
        <screen>
Default = -adobe-times-
        </screen>
        <para>
          Comments:
        </para>
        <para>
          It is better to have a scalable font family (bolds and
          italics included)  as the default choice because mapper
          checks all available fonts until  requested height and other
          attributes match perfectly or the end of the  font table is
          reached. Typical X installations have scalable fonts in the
          <filename>../fonts/Type1</filename> and
          <filename>../fonts/Speedo</filename> directories.
        </para>
325
      </sect3>
326

327
      <sect3>
328 329
        <title>How To Manage Cached Font Metrics</title>
        <para>
330
          Wine stores detailed information about available fonts in
331
          the <filename>~/.wine/cachedmetrics.[display]</filename> file. You
332
          can copy it elsewhere and add this entry to the [fonts]
333
          section  in your <filename>~/.wine/config</filename>:
334 335 336 337 338
        </para>
        <screen>
FontMetrics = &lt;file with metrics&gt;
        </screen>
        <para>
339
          If Wine detects changes in the X font configuration it will
340
          rebuild font metrics from scratch and then it will overwrite
341
          <filename>~/.wine/cachedmetrics.[display]</filename> with  the new
342 343
          information. This process can take a while.
        </para>
344
      </sect3>
345

346
      <sect3>
347 348
        <title>Too Small Or Too Large Fonts</title>
        <para>
349
          Windows programs may ask Wine to render a font with the
350 351 352 353 354 355 356 357 358 359 360 361 362 363 364
          height specified in points. However, point-to-pixel ratio
          depends on the real physical size  of your display (15",
          17", etc...). X tries to provide an estimate of that  but it
          can be quite different from the actual size. You can change
          this ratio by adding the following entry to the [fonts]
          section:
        </para>
        <screen>
Resolution = &lt;integer value&gt;
        </screen>
        <para>
          In general, higher numbers give you larger fonts. Try to
          experiment with values in the 60 - 120 range. 96 is a good
          starting point.
        </para>
365
      </sect3>
366

367
      <sect3>
368 369 370 371 372 373 374 375 376 377
        <title>"FONT_Init: failed to load ..." Messages On Startup</title>
        <para>
          The most likely cause is a broken
          <filename>fonts.dir</filename> file in one of your font
          directories. You need to rerun <command>mkfontdir</command>
          to rebuild this file. Read its manpage for more information.
          If you can't run <command>mkfontdir</command> on this
          machine as you are not root, use <command>xset -fp
            xxx</command> to remove the broken font path.
        </para>
378 379
      </sect3>
    </sect2>
380

381
    <sect2 id="ttfont-server">
382 383 384 385 386 387 388
    <title>Setting up a TrueType Font Server</title>
      <para>
        Follow these instructions to set up a TrueType font server on your system.
      </para>

      <orderedlist>
        <listitem>
389 390 391
          <para>
            Get a freetype source archive (<filename>freetype-X.Y.tar.gz</filename> ?).
          </para>
392 393
        </listitem>
        <listitem>
394 395 396
          <para>
            Read docs, unpack, configure and install
          </para>
397 398
        </listitem>
        <listitem>
399 400 401
          <para>
            Test the library, e.g. <command>ftview 20 /dosc/win95/fonts/times</command>
          </para>
402 403
        </listitem>
        <listitem>
404 405 406
          <para>
            Get <filename>xfsft-beta1e.linux-i586</filename>
          </para>
407 408 409 410 411 412 413 414 415
        </listitem>
        <listitem>
          <para>
            Install it and start it when booting, e.g. in an
            rc-script.  The manpage for <command>xfs</command>
            applies.
          </para>
        </listitem>
        <listitem>
416 417 418
          <para>
            Follow the hints given by <email>williamc@dai.ed.ac.uk</email>
          </para>
419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439
        </listitem>
        <listitem>
          <para>
            I got <command>xfsft</command> from
            <ulink url="http://www.dcs.ed.ac.uk/home/jec/progindex.html">http://www.dcs.ed.ac.uk/home/jec/progindex.html</ulink>.
            I have it running all the time.  Here is
            <filename>/usr/X11R6/lib/X11/fs/config</filename>:
          </para>
          <programlisting>
clone-self = on
use-syslog = off
catalogue = /c/windows/fonts
error-file = /usr/X11R6/lib/X11/fs/fs-errors
default-point-size = 120
default-resolutions = 75,75,100,100
          </programlisting>
          <para>
            Obviously <filename>/c/windows/fonts</filename> is where
            my Windows fonts on my Win95 <medialabel>C:</medialabel>
            drive live; could be e.g.
            <filename>/mnt/dosC/windows/system</filename> for Win31.
440 441
          </para>
          <para>
442
            In <filename>/c/windows/fonts/fonts.scale</filename> I
443
            have:
444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485
          </para>
          <programlisting>
14
arial.ttf -monotype-arial-medium-r-normal--0-0-0-0-p-0-iso8859-1
arialbd.ttf -monotype-arial-bold-r-normal--0-0-0-0-p-0-iso8859-1
arialbi.ttf -monotype-arial-bold-o-normal--0-0-0-0-p-0-iso8859-1
ariali.ttf -monotype-arial-medium-o-normal--0-0-0-0-p-0-iso8859-1
cour.ttf -monotype-courier-medium-r-normal--0-0-0-0-p-0-iso8859-1
courbd.ttf -monotype-courier-bold-r-normal--0-0-0-0-p-0-iso8859-1
courbi.ttf -monotype-courier-bold-o-normal--0-0-0-0-p-0-iso8859-1
couri.ttf -monotype-courier-medium-o-normal--0-0-0-0-p-0-iso8859-1
times.ttf -monotype-times-medium-r-normal--0-0-0-0-p-0-iso8859-1
timesbd.ttf -monotype-times-bold-r-normal--0-0-0-0-p-0-iso8859-1
timesbi.ttf -monotype-times-bold-i-normal--0-0-0-0-p-0-iso8859-1
timesi.ttf -monotype-times-medium-i-normal--0-0-0-0-p-0-iso8859-1
symbol.ttf -monotype-symbol-medium-r-normal--0-0-0-0-p-0-microsoft-symbol
wingding.ttf -microsoft-wingdings-medium-r-normal--0-0-0-0-p-0-microsoft-symbol
          </programlisting>
          <para>
            In <filename>/c/windows/fonts/fonts.dir</filename> I have
            exactly the same.
          </para>
          <para>
            In <filename>/usr/X11R6/lib/X11/XF86Config</filename> I have
          </para>
          <programlisting>
FontPath "tcp/localhost:7100"
          </programlisting>
          <para>
            in front of the other <literal>FontPath</literal> lines.
            That's it!  As an interesting by-product of course, all
            those web pages which specify Arial come up in Arial in
            Netscape ...
          </para>
        </listitem>
        <listitem>
          <para>
            Shut down X and restart (and debug errors you did while
            setting up everything).
          </para>
        </listitem>
        <listitem>
486 487 488
          <para>
            Test with e.g. <command>xlsfont | grep arial</command>
          </para>
489 490 491
        </listitem>
      </orderedlist>

492
  </sect2>
493

494
</sect1>
495 496 497 498

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
499
sgml-parent-document:("wine-user.sgml" "set" "book" "chapter" "")
500 501
End:
-->