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

4
    <sect2 id="windows-fonts">
5 6 7
      <title>Fonts</title>

      <para>
John R. Sheets's avatar
John R. Sheets committed
8
        Written by &name-alex-korobka; <email>&email-alex-korobka;</email>
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
      </para>
      <para>
        (Extracted from <filename>wine/documentation/fonts</filename>)
      </para>

      <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:
            <ulink url="http://www.winehq.com/tools.html">http://www.winehq.com/tools.html</ulink>
          </para>
        </note>
      </para>

26
      <sect3>
27 28
        <title>How To Convert Windows Fonts</title>
        <para>
29
          If you have access to a Windows installation you should use the
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
          <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
          Window System can recognize. 
        </para>

        <orderedlist>
          <listitem>
            <para>Extract bitmap fonts with <command>fnt2bdf</command>.</para>
          </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
46
              <command>bdftopcf</command>.
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
            </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
64 65 66 67
              of the new fonts. You may also or instead have to restart
              the font server (using e.g. 
              <command>/etc/init.d/xfs restart</command>
              under RedHat 7.1)
68 69 70 71
            </para>
          </listitem>
          <listitem>
            <para>
72
              Edit the <filename>~/.wine/config</filename> file to remove
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114
              aliases for the fonts you've just installed.
            </para>
          </listitem>
        </orderedlist>
        <para>
          WINE can get by without these fonts but 'the look and feel'
          may be quite different. Also, some applications try to load
          their custom fonts on the fly (WinWord 6.0) and since WINE
          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
          disappear WINE will work around the problem by using the
          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
          library, see <filename>documentation/ttfserver</filename>).
        </para>
        <para>
          However, there is a possibility of the native TrueType
          support via FreeType renderer in the future (hint, hint :-)
        </para>
115
      </sect3>
116

117
      <sect3>
118
        <title>How To Add Font Aliases To <filename>~/.wine/config</filename></title>
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 250 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 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328
        <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
              names appear in the font selection dialogs. 
            </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
          <filename>fonts.dir</filename>.  Therefore WINE uses the
          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>
329
      </sect3>
330

331
      <sect3>
332 333 334
        <title>How To Manage Cached Font Metrics</title>
        <para>
          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 339 340 341 342 343 344
        </para>
        <screen>
FontMetrics = &lt;file with metrics&gt;
        </screen>
        <para>
          If WINE detects changes in the X font configuration it will
          rebuild font metrics from scratch and then it will overwrite
345
          <filename>~/.wine/cachedmetrics.[display]</filename> with  the new
346 347
          information. This process can take a while.
        </para>
348
      </sect3>
349

350
      <sect3>
351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368
        <title>Too Small Or Too Large Fonts</title>
        <para>
          Windows programs may ask WINE to render a font with the
          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>
369
      </sect3>
370

371
      <sect3>
372 373 374 375 376 377 378 379 380 381
        <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>
382 383
      </sect3>
    </sect2>
384

385
    <sect2 id="ttfont-server">
386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440
    <title>Setting up a TrueType Font Server</title>
      <para>
        written by ???
      </para>
      <para>
        (Extracted from <filename>wine/documentation/ttfserver</filename>)
      </para>

      <para>
        Follow these instructions to set up a TrueType font server on your system.
      </para>

      <orderedlist>
        <listitem>
          <para>Get <filename>freetype-1.0.full.tar.gz</filename></para>
        </listitem>
        <listitem>
          <para>Read docs, unpack, configure and install</para>
        </listitem>
        <listitem>
          <para>Test the library, e.g. <command>ftview 20 /dosc/win95/fonts/times</command></para>
        </listitem>
        <listitem>
          <para>Get <filename>xfsft-beta1e.linux-i586</filename></para>
        </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>
          <para>Follow the hints given by <email>williamc@dai.ed.ac.uk</email></para>
        </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.
441 442
          </para>
          <para>
443
            In <filename>/c/windows/fonts/fonts.scale</filename> I
444
            have:
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 486 487 488 489 490 491 492 493
          </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>
          <para>Test with e.g <command>xlsfont | grep arial</command></para>
        </listitem>
      </orderedlist>

      <para>
        Hope this helps...
    </para>
494
  </sect2>
495

496
</sect1>
497 498 499 500

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
John R. Sheets's avatar
John R. Sheets committed
501
sgml-parent-document:("wine-doc.sgml" "set" "book" "chapter" "")
502 503
End:
-->