                The FreeType Win32 Compilation HowTo


Introduction:

This file  describes the compilation  of the FreeType package  on an
Win32  system.   Unlike  other  systems,  only the  library  can  be
compiled on such  a system, as the demo programs  still lack a Win32
component (we welcome any contribution).

Nevertheless,  we  _do_  provide  project/workspace  files  for  the
following compilers: Borland C++ 5.0, Visual C++ 4.0, and Visual C++
5.0.  They can be found in the "freetype/lib/arch/win32" directory:

  freetype.ide      for Borland C++ 5.0

  freetype.dsp      project and workspace files for
  freetype.dsw      Visual C++ 5.0

  freetype.mdp      project and makefile files for
  freetype.mak      Visual C++ 4.0

They generate a  static library, which contain the  core engine as a
single object file, as well as all standard extensions.

Notes:

  - You  may need to  update the  include paths  in the  Borland C++
    workspace  settings.  The  current  one looks  in the  directory
    "c:\Program Files\Borland\BC 5.0\Include" for include files.

  - Take  care that some  compilers may  overwrite these  files when
    generating  the  library  (e.g.  Borland  C++  creates  its  own
    "freetype.mdp"  file, which  isn't a  Visual C++  project during
    compilation).

    This  is only  important  if you  try  to compile  the lib  with
    several compilers.

We gladly  accept project  files for other  compilers.  The  rest of
this document  will show you all  the steps required  to compile the
library by hand.



1. Static compilation:

  Here are explained the steps that are required to compile FreeType
  as a *static* library.  Explanations follow to build a DLL.

  a. Set include paths:

    Simply add the following to your project's include paths:

      "freetype/lib"
         
        It  contains   all  core  library   sources  (tt*.c  files),
        including  the API  in "freetype.h",  which can  be  used by
        client applications to use the library.

      "freetype/lib/arch/win32"  

        Here you'll find the file "ft_conf.h" which contains various
        configuration  macros  which have  been  set  for the  Win32
        platform.   You   can  also   play  with  some   options  by
        setting/undefining the  TT_CONFIG_OPTION_???? macros.  (Read
        the comments carefully before that!)

    You might as  well decide to compile some  extensions (which are
    separately  compilable and  linkable  units used  to extend  the
    engine's capabilities).  To do so, add the directory

      "freetype/lib/extend" 


  b. Set the warning level:

    Set the warning  level to 3 under Visual C++,  you should get no
    warnings during compilation.   (Compilation produces warnings in
    level 4, but we're not  going to correct this for deep technical
    reasons.)

    Under  BC++, set  the warning  level  to ANSI,  and disable  the
    "unused  parameter"  and  "unused  variable"  warnings.   You'll
    probably get a slew of warnings, because BC is probably the most
    pedantic and bad-ass ANSI  compiler I've ever seen.  The library
    will work perfectly though.

  c. Compile in "normal mode":

    Add all  the files  in "tt*.c" found  in "freetype/lib"  to your
    project.     You   can   also    add   some    extensions   from
    "freetype/lib/extend" provided that  you've added this directory
    to your include path.

    Build.  Voila!

  d. Or compile in "single object mode":

    This  allows you  to build  a single  object file  for  the core
    library.   Use the single  file "freetype/arch/win32/freetype.c"
    instead of _all_ the  individual "tt*.c" source components (they
    are included by freetype.c).

    The resulting library file should be smaller, because it got rid
    of  lots  of  internal  extern  symbols  which  are  needed  for
    inter-component interfacing.

    You  still  can  add  extensions individually  to  the  project.
    They'll link with the single object too.


2. DLL Compilation:

  Some people have expressed the  need to compile FreeType as a DLL.
  This is possible with very, very few changes.  Simply follow these
  instructions:

  - Edit the  source of "freetype/arch/win32/freetype.c"  and define
    the EXPORT macro before the first #include.

  - Compile in single object mode.

  This should be enough.


3. Other contributions in the package:

  All  other  parts  of  the  FreeType  distribution  are  currently
  unsupported  on Win32.  This includes  the test/demo  programs, as
  well as the many tools found in "freetype/contrib" (nevertheless,
  ttf2pk may compile provided you've got the web2c port to Win32,
  including the kpathsea library).


--- end of win32.txt ---
