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 `include/freetype/config/ftoption.h' contains a list of
12 commented configuration macros that can be toggled by developers to
13 indicate which features should be active while building the library.
15 These options range from debug level to availability of certain
16 features, like native TrueType hinting through a bytecode
19 We invite you to read this file for more information. You can
20 change the file's content to suit your needs, or override it with
21 one of the techniques described below.
26 If you use GNU make please edit the top-level file `modules.cfg'.
27 It contains a list of available FreeType modules and extensions to
28 be compiled. Change it to suit your own preferences. Be aware that
29 certain modules depend on others, as described in the file. GNU
30 make uses `modules.cfg' to generate `ftmodule.h' (in the object
33 If you build FreeType in a directory separate from the source files,
34 put your customized `modules.cfg' in that directory; that way you
35 can keep the source files `clean'.
37 If you don't use GNU make you have to manually edit the file
38 `include/freetype/config/ftmodule.h' (which is *not* used with if
39 compiled with GNU make) to add or remove the drivers and components
40 you want to compile into the library. See `INSTALL.ANY' for more
46 FreeType's default interface to the system (i.e., the parts that
47 deal with memory management and i/o streams) is located in
48 `src/base/ftsystem.c'.
50 The current implementation uses standard C library calls to manage
51 memory and to read font files. It is however possible to write
52 custom implementations to suit specific systems.
54 To tell the GNU Make-based build system to use a custom system
55 interface, you have to define the environment variable FTSYS_SRC to
56 point to the relevant implementation:
60 ./configure <your options>
61 export FTSYS_SRC=foo/my_ftsystem.c
68 set FTSYS_SRC=foo/my_ftsystem.c
72 IV. Overriding default configuration and module headers
74 It is possible to override the default configuration and module
75 headers without changing the original files. There are three ways
81 [This is actually a combination of method 2 and 3.]
83 Just put your custom `ftoption.h' file into the objects directory
84 (normally `<topdir>/objs' if you build in the source tree, or the
85 directory where you invoke configure if you build in a separate
86 directory), which GNU make prefers over the standard location. No
87 action is needed for `ftmodule.h' because it is generated
88 automatically in the objects directory.
90 2. Using the C include path
92 Use the C include path to ensure that your own versions of the
93 files are used at compile time when the lines
95 #include FT_CONFIG_OPTIONS_H
96 #include FT_CONFIG_MODULES_H
98 are compiled. Their default values being
99 <freetype/config/ftoption.h> and <freetype/config/ftmodule.h>, you
100 can do something like:
104 ftoption.h => custom options header
105 ftmodule.h => custom modules list
107 include/ => normal FreeType 2 include
110 then change the C include path to always give the path to `custom'
111 before the FreeType 2 `include'.
114 3. Redefining FT_CONFIG_OPTIONS_H and FT_CONFIG_MODULES_H
116 Another way to do the same thing is to redefine the macros used to
117 name the configuration headers. To do so, you need a custom
118 `ft2build.h' whose content can be as simple as:
120 #ifndef FT2_BUILD_MY_PLATFORM_H_
121 #define FT2_BUILD_MY_PLATFORM_H_
123 #define FT_CONFIG_OPTIONS_H <custom/my-ftoption.h>
124 #define FT_CONFIG_MODULES_H <custom/my-ftmodule.h>
126 #include <freetype/config/ftheader.h>
128 #endif /* FT2_BUILD_MY_PLATFORM_H_ */
130 Place those files in a separate directory, e.g.,
133 ft2build.h => custom version described above
134 my-ftoption.h => custom options header
135 my-ftmodule.h => custom modules list header
137 and change the C include path to ensure that `custom' is always
138 placed before the FT2 `include' during compilation.
140 ----------------------------------------------------------------------
142 Copyright (C) 2003-2020 by
143 David Turner, Robert Wilhelm, and Werner Lemberg.
145 This file is part of the FreeType project, and may only be used,
146 modified, and distributed under the terms of the FreeType project
147 license, LICENSE.TXT. By continuing to use, modify, or distribute
148 this file you indicate that you have read the license and understand
152 --- end of CUSTOMIZE ---