1 How to customize the compilation of the library
2 ===============================================
4 FreeType is highly customizable to fit various needs, and this
5 document describes how it is possible to select options and
6 components at compilation time.
9 I. Configuration macros
11 The file found in `include/freetype/config/ftoption.h' contains a
12 list of commented configuration macros that can be toggled by
13 developers to indicate which features should be active while
16 These options range from debug level to availability of certain
17 features, like native TrueType hinting through a bytecode
20 We invite you to read this file for more information. You can
21 change the file's content to suit your needs, or override it with
22 one of the techniques described below.
27 If you use GNU make please edit the top-level file `modules.cfg'.
28 It contains a list of available FreeType modules and extensions to
29 be compiled. Change it to suit your own preferences. Be aware that
30 certain modules depend on others, as described in the file. GNU
31 make uses `modules.cfg' to generate `ftmodule.h' (in the object
34 If you don't use GNU make you have to manually edit the file
35 `include/freetype/config/ftmodule.h' (which is *not* used with if
36 compiled with GNU make) to add or remove the drivers and components
37 you want to compile into the library. See `INSTALL.ANY' for more
43 FreeType's default interface to the system (i.e., the parts that
44 deal with memory management and i/o streams) is located in
45 `src/base/ftsystem.c'.
47 The current implementation uses standard C library calls to manage
48 memory and to read font files. It is however possible to write
49 custom implementations to suit specific systems.
51 To tell the GNU Make-based build system to use a custom system
52 interface, you have to define the environment variable FTSYS_SRC to
53 point to the relevant implementation:
57 ./configure <your options>
58 export FTSYS_SRC=foo/my_ftsystem.c
65 set FTSYS_SRC=foo/my_ftsystem.c
69 IV. Overriding default configuration and module headers
71 It is possible to override the default configuration and module
72 headers without changing the original files. There are three ways
78 [This is actually a combination of method 2 and 3.]
80 Just put your custom `ftoption.h' file into the objects directory
81 (normally `<topdir>/objs'), which GNU make prefers over the
82 standard location. No action is needed for `ftmodule.h' because
83 it is generated automatically in the objects directory.
86 2. Using the C include path
88 Use the C include path to ensure that your own versions of the
89 files are used at compile time when the lines
91 #include FT_CONFIG_OPTIONS_H
92 #include FT_CONFIG_MODULES_H
94 are compiled. Their default values being
95 <freetype/config/ftoption.h> and <freetype/config/ftmodule.h>, you
96 can do something like:
101 ftoption.h => custom options header
102 ftmodule.h => custom modules list
104 include/ => normal FreeType 2 include
108 then change the C include path to always give the path to `custom'
109 before the FreeType 2 `include'.
112 3. Redefining FT_CONFIG_OPTIONS_H and FT_CONFIG_MODULES_H
114 Another way to do the same thing is to redefine the macros used to
115 name the configuration headers. To do so, you need a custom
116 `ft2build.h' whose content can be as simple as:
118 #ifndef __FT2_BUILD_MY_PLATFORM_H__
119 #define __FT2_BUILD_MY_PLATFORM_H__
121 #define FT_CONFIG_OPTIONS_H <custom/my-ftoption.h>
122 #define FT_CONFIG_MODULES_H <custom/my-ftmodule.h>
124 #include <freetype/config/ftheader.h>
126 #endif /* __FT2_BUILD_MY_PLATFORM_H__ */
128 Place those files in a separate directory, e.g.,
131 ft2build.h => custom version described above
132 my-ftoption.h => custom options header
133 my-ftmodule.h => custom modules list header
135 and change the C include path to ensure that `custom' is always
136 placed before the FT2 `include' during compilation.
138 ----------------------------------------------------------------------
140 Copyright 2003, 2005, 2006 by
141 David Turner, Robert Wilhelm, and Werner Lemberg.
143 This file is part of the FreeType project, and may only be used,
144 modified, and distributed under the terms of the FreeType project
145 license, LICENSE.TXT. By continuing to use, modify, or distribute
146 this file you indicate that you have read the license and understand
150 --- end of CUSTOMIZE ---