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 components
9
I. Configuration macros
11
The file found in "include/freetype/config/ftoption.h" contains a list
12
of 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 interpreter.
18
We invite you to read this file for more information. You can change
19
the file's content to suit your needs, or override it with one of the
20
techniques described below.
25
The file found in "include/freetype/config/ftmodule.h" contains a list
26
of names corresponding to the modules and font drivers to be
27
statically compiled in the FreeType library during the build.
29
You can change it to suit your own preferences. Be aware that certain
30
modules depend on others, as described by the file "modules.txt" in
33
You can modify the file's content to suit your needs, or override it
34
at compile time with one of the methods described below.
39
FreeType's default interface to the system (i.e., the parts that deal
40
with memory management and i/o streams) is located in
41
"src/base/ftsystem.c".
43
The current implementation uses standard C library calls to manage
44
memory and to read font files. It is however possible to write custom
45
implementations to suit specific systems.
47
To tell the GNU Make-based build system to use a custom system
48
interface, you have to define the environment variable FTSYS_SRC to
49
point to the relevant implementation:
53
./configure <your options>
54
export FTSYS_SRC=foo/my_ftsystem.c
61
set FTSYS_SRC=foo/my_ftsystem.c
65
IV. Overriding default configuration and module headers
67
It is possible to override the default configuration and module
68
headers without changing the original files. There are two ways to do
72
1. Using the C include path
74
Use the C include path to ensure that your own versions of the files
75
are used at compile time when the lines
77
#include FT_CONFIG_OPTIONS_H
78
#include FT_CONFIG_MODULES_H
80
are compiled. Their default values being
81
<freetype/config/ftoption.h> and <freetype/config/ftmodule.h>, you
82
can do something like:
87
ftoption.h => custom options header
88
ftmodule.h => custom modules list
90
include/ => normal FreeType 2 include
94
then change the C include path to always give the path to "custom"
95
before the FreeType 2 "include".
98
2. Re-defining FT_CONFIG_OPTIONS_H and FT_CONFIG_MODULES_H
100
Another way to do the same thing is to redefine the macros used to
101
name the configuration headers. To do so, you need a custom
102
"ft2build.h" whose content can be as simple as:
104
#ifndef __FT2_BUILD_MY_PLATFORM_H__
105
#define __FT2_BUILD_MY_PLATFORM_H__
107
#define FT_CONFIG_OPTIONS_H <custom/my-ftoption.h>
108
#define FT_CONFIG_MODULES_H <custom/my-ftmodule.h>
110
#include <freetype/config/ftheader.h>
112
#endif /* __FT2_BUILD_MY_PLATFORM_H__ */
114
Place those files in a separate directory, e.g.:
117
ft2build.h => custom version described above
118
my-ftoption.h => custom options header
119
my-ftmodule.h => custom modules list header
121
and change the C include path to ensure that "custom" is always
122
placed before the FT2 "include" during compilation.
125
--- end of CUSTOMIZE ---