summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile4
-rw-r--r--builds/ansi/ansi.mk4
-rw-r--r--builds/detect.mk6
-rw-r--r--builds/dos/dos-gcc.mk4
-rw-r--r--builds/freetype.mk8
-rw-r--r--builds/os2/os2-dev.mk4
-rw-r--r--builds/os2/os2-gcc.mk4
-rw-r--r--builds/unix/unix-dev.mk4
-rw-r--r--builds/unix/unix-gcc.mk4
-rw-r--r--builds/unix/unix.in2
-rw-r--r--builds/unix/unix.mk4
-rw-r--r--builds/win32/w32-dev.mk4
-rw-r--r--builds/win32/w32-gcc.mk4
-rw-r--r--builds/win32/w32-icc.mk2
-rw-r--r--builds/win32/w32-lcc.mk4
-rw-r--r--builds/win32/w32-vcc.mk4
-rw-r--r--config/freetype.mk2
-rw-r--r--docs/BUILD264
-rw-r--r--src/base/ftbase.c10
-rw-r--r--src/cff/cff.c19
-rw-r--r--src/cff/rules.mk9
-rw-r--r--src/cff/t2driver.c12
-rw-r--r--src/cff/t2gload.c29
-rw-r--r--src/cff/t2gload.h7
-rw-r--r--src/cff/t2load.c13
-rw-r--r--src/cff/t2load.h3
-rw-r--r--src/cff/t2objs.c286
-rw-r--r--src/cff/t2parse.c13
-rw-r--r--src/cid/cidafm.c6
-rw-r--r--src/cid/cidafm.h6
-rw-r--r--src/cid/cidgload.c10
-rw-r--r--src/cid/cidgload.h6
-rw-r--r--src/cid/cidload.c13
-rw-r--r--src/cid/cidload.h7
-rw-r--r--src/cid/cidobjs.c10
-rw-r--r--src/cid/cidparse.c7
-rw-r--r--src/cid/cidriver.c9
-rw-r--r--src/cid/rules.mk9
-rw-r--r--src/cid/type1cid.c20
-rw-r--r--src/psnames/psmodule.c12
-rw-r--r--src/psnames/rules.mk7
-rw-r--r--src/raster1/ftrend1.c10
-rw-r--r--src/raster1/raster1.c9
-rw-r--r--src/raster1/rules.mk8
-rw-r--r--src/sfnt/rules.mk7
-rw-r--r--src/sfnt/sfdriver.c23
-rw-r--r--src/sfnt/sfnt.c34
-rw-r--r--src/sfnt/sfobjs.c7
-rw-r--r--src/sfnt/ttcmap.c11
-rw-r--r--src/sfnt/ttload.c11
-rw-r--r--src/sfnt/ttpost.c10
-rw-r--r--src/sfnt/ttsbit.c7
-rw-r--r--src/sfnt/ttsbit.h7
-rw-r--r--src/smooth/ftgrays.c7
-rw-r--r--src/smooth/ftsmooth.c12
-rw-r--r--src/smooth/rules.mk8
-rw-r--r--src/smooth/smooth.c11
-rw-r--r--src/truetype/rules.mk7
-rw-r--r--src/truetype/truetype.c23
-rw-r--r--src/truetype/ttdriver.c10
-rw-r--r--src/truetype/ttgload.c9
-rw-r--r--src/truetype/ttgload.h15
-rw-r--r--src/truetype/ttinterp.c9
-rw-r--r--src/truetype/ttinterp.h7
-rw-r--r--src/truetype/ttobjs.c22
-rw-r--r--src/truetype/ttpload.c7
-rw-r--r--src/type1/rules.mk7
-rw-r--r--src/type1/t1afm.c7
-rw-r--r--src/type1/t1driver.c12
-rw-r--r--src/type1/t1gload.c20
-rw-r--r--src/type1/t1gload.h7
-rw-r--r--src/type1/t1hinter.c10
-rw-r--r--src/type1/t1hinter.h9
-rw-r--r--src/type1/t1load.c10
-rw-r--r--src/type1/t1load.h8
-rw-r--r--src/type1/t1objs.c22
-rw-r--r--src/type1/t1parse.c8
-rw-r--r--src/type1/t1parse.h8
-rw-r--r--src/type1/t1tokens.c10
-rw-r--r--src/type1/t1tokens.h7
-rw-r--r--src/type1/type1.c35
-rw-r--r--src/type1z/rules.mk7
-rw-r--r--src/type1z/type1z.c26
-rw-r--r--src/type1z/z1afm.c7
-rw-r--r--src/type1z/z1afm.h7
-rw-r--r--src/type1z/z1driver.c16
-rw-r--r--src/type1z/z1gload.c7
-rw-r--r--src/type1z/z1gload.h7
-rw-r--r--src/type1z/z1load.c20
-rw-r--r--src/type1z/z1load.h9
-rw-r--r--src/type1z/z1objs.c14
-rw-r--r--src/type1z/z1parse.c8
-rw-r--r--src/winfonts/rules.mk9
-rw-r--r--src/winfonts/winfnt.c9
94 files changed, 1179 insertions, 293 deletions
diff --git a/Makefile b/Makefile
index 118d37049..ab15cda14 100644
--- a/Makefile
+++ b/Makefile
@@ -75,8 +75,8 @@ ifdef check_platform
#
modules: make_module_list setup
- include $(TOP)/config/detect.mk
- include $(TOP)/config/modules.mk
+ include $(TOP)/builds/detect.mk
+ include $(TOP)/builds/modules.mk
ifeq ($(wildcard $(FT_MODULE_LIST)),)
setup: make_module_list
diff --git a/builds/ansi/ansi.mk b/builds/ansi/ansi.mk
index c0cfcaf43..4c9266e66 100644
--- a/builds/ansi/ansi.mk
+++ b/builds/ansi/ansi.mk
@@ -20,7 +20,7 @@ endif
DELETE := rm -f
SEP := /
HOSTSEP := $(SEP)
-BUILD := $(TOP)/config/ansi
+BUILD := $(TOP)/builds/ansi
PLATFORM := ansi
# The directory where all object files are placed.
@@ -105,7 +105,7 @@ ifdef BUILD_FREETYPE
# Now include the main sub-makefile. It contains all the rules used to
# build the library with the previous variables defined.
#
- include $(TOP)/config/freetype.mk
+ include $(TOP)/builds/freetype.mk
# The cleanup targets.
#
diff --git a/builds/detect.mk b/builds/detect.mk
index 355fcb300..d34904a37 100644
--- a/builds/detect.mk
+++ b/builds/detect.mk
@@ -17,7 +17,7 @@
# the following variables:
#
# BUILD The configuration and system-specific directory. Usually
-# `freetype/config/$(PLATFORM)' but can be different for
+# `freetype/builds/$(PLATFORM)' but can be different for
# custom builds of the library.
#
# The following variables must be defined in system specific `detect.mk'
@@ -52,7 +52,7 @@ DELETE := $(RM)
COPY := cp
SEP := /
-BUILD_CONFIG_ = $(TOP)$(SEP)config$(SEP)
+BUILD_CONFIG_ = $(TOP)$(SEP)builds$(SEP)
BUILD = $(BUILD_CONFIG_)$(PLATFORM)
CONFIG_RULES = $(BUILD)$(SEP)$(CONFIG_FILE)
@@ -70,7 +70,7 @@ CONFIG_RULES = $(BUILD)$(SEP)$(CONFIG_FILE)
#
BACKSLASH := $(strip \ )
-# Now, include all detection rule files found in the `config/<system>'
+# Now, include all detection rule files found in the `builds/<system>'
# directories. Note that the calling order of the various `detect.mk' files
# isn't predictable.
#
diff --git a/builds/dos/dos-gcc.mk b/builds/dos/dos-gcc.mk
index 79bd1823b..0599e5783 100644
--- a/builds/dos/dos-gcc.mk
+++ b/builds/dos/dos-gcc.mk
@@ -20,7 +20,7 @@ endif
DELETE := rm -f
SEP := /
HOSTSEP := $(strip \ )
-BUILD := $(TOP)/config/dos
+BUILD := $(TOP)/builds/dos
PLATFORM := dos
# The directory where all object files are placed.
@@ -105,7 +105,7 @@ ifdef BUILD_FREETYPE
# Now include the main sub-makefile. It contains all the rules used to
# build the library with the previous variables defined.
#
- include $(TOP)/config/freetype.mk
+ include $(TOP)/builds/freetype.mk
# The cleanup targets.
#
diff --git a/builds/freetype.mk b/builds/freetype.mk
index c9d4a9120..69afb142a 100644
--- a/builds/freetype.mk
+++ b/builds/freetype.mk
@@ -21,7 +21,7 @@
# environment, or on the command line) are used:
#
# BUILD The architecture dependent directory,
-# e.g. `$(TOP)/config/unix'.
+# e.g. `$(TOP)/builds/unix'.
#
# OBJ_DIR The directory in which object files are created.
#
@@ -112,7 +112,7 @@ FT_LIBRARY := $(LIB_)$(LIBRARY).$A
# IMPORTANT NOTE: The architecture-dependent directory must ALWAYS be placed
# in front of the include list. Porters are then able to
# put their own version of some of the FreeType components
-# in the `freetype/config/<system>' directory, as these
+# in the `freetype/builds/<system>' directory, as these
# files will override the default sources.
#
INCLUDES := $(BUILD) $(TOP)$(SEP)include $(SRC)
@@ -121,7 +121,7 @@ INCLUDE_FLAGS = $(INCLUDES:%=$I%)
# C flags used for the compilation of an object file. This must include at
-# least the paths for the `base' and `config/<system>' directories;
+# least the paths for the `base' and `builds/<system>' directories;
# debug/optimization/warning flags + ansi compliance if needed.
#
FT_CFLAGS = $(CFLAGS) $(INCLUDE_FLAGS)
@@ -131,7 +131,7 @@ FT_COMPILE = $(CC) $(ANSIFLAGS) $(FT_CFLAGS)
# Include the `modules' rules file.
#
-include $(TOP)/config/modules.mk
+include $(TOP)/builds/modules.mk
# Initialize the list of objects.
diff --git a/builds/os2/os2-dev.mk b/builds/os2/os2-dev.mk
index 7cab22b1c..fcd80b170 100644
--- a/builds/os2/os2-dev.mk
+++ b/builds/os2/os2-dev.mk
@@ -22,7 +22,7 @@ endif
DELETE := del
SEP := /
HOSTSEP := $(strip \ )
-BUILD := $(TOP)/config/os2
+BUILD := $(TOP)/builds/os2
PLATFORM := os2
CC := gcc
@@ -108,7 +108,7 @@ ifdef BUILD_FREETYPE
# Now include the main sub-makefile. It contains all the rules used to
# build the library with the previous variables defined.
#
- include $(TOP)/config/freetype.mk
+ include $(TOP)/builds/freetype.mk
# The cleanup targets.
#
diff --git a/builds/os2/os2-gcc.mk b/builds/os2/os2-gcc.mk
index e94728b1c..38c1322b8 100644
--- a/builds/os2/os2-gcc.mk
+++ b/builds/os2/os2-gcc.mk
@@ -20,7 +20,7 @@ endif
DELETE := del
SEP := /
HOSTSEP := $(strip \ )
-BUILD := $(TOP)/config/os2
+BUILD := $(TOP)/builds/os2
PLATFORM := os2
CC := gcc
@@ -106,7 +106,7 @@ ifdef BUILD_FREETYPE
# Now include the main sub-makefile. It contains all the rules used to
# build the library with the previous variables defined.
#
- include $(TOP)/config/freetype.mk
+ include $(TOP)/builds/freetype.mk
# The cleanup targets.
#
diff --git a/builds/unix/unix-dev.mk b/builds/unix/unix-dev.mk
index 591ad2675..5cd5bebcd 100644
--- a/builds/unix/unix-dev.mk
+++ b/builds/unix/unix-dev.mk
@@ -22,7 +22,7 @@ endif
DELETE := rm -f
SEP := /
HOSTSEP := $(SEP)
-BUILD := $(TOP)/config/unix
+BUILD := $(TOP)/builds/unix
PLATFORM := unix
# The directory where all object files are placed.
@@ -107,7 +107,7 @@ ifdef BUILD_FREETYPE
# Now include the main sub-makefile. It contains all the rules used to
# build the library with the previous variables defined.
#
- include $(TOP)/config/freetype.mk
+ include $(TOP)/builds/freetype.mk
# The cleanup targets.
#
diff --git a/builds/unix/unix-gcc.mk b/builds/unix/unix-gcc.mk
index f14b6979a..e6936dd2b 100644
--- a/builds/unix/unix-gcc.mk
+++ b/builds/unix/unix-gcc.mk
@@ -20,7 +20,7 @@ endif
DELETE := rm -f
SEP := /
HOSTSEP := $(SEP)
-BUILD := $(TOP)/config/unix
+BUILD := $(TOP)/builds/unix
PLATFORM := unix
# The directory where all object files are placed.
@@ -105,7 +105,7 @@ ifdef BUILD_FREETYPE
# Now include the main sub-makefile. It contains all the rules used to
# build the library with the previous variables defined.
#
- include $(TOP)/config/freetype.mk
+ include $(TOP)/builds/freetype.mk
# The cleanup targets.
#
diff --git a/builds/unix/unix.in b/builds/unix/unix.in
index 37a839501..a998274f0 100644
--- a/builds/unix/unix.in
+++ b/builds/unix/unix.in
@@ -20,7 +20,7 @@ endif
DELETE := @RMF@
SEP := /
HOSTSEP := $(SEP)
-BUILD := $(TOP)/config/unix
+BUILD := $(TOP)/builds/unix
PLATFORM := unix
# The directory where all object files are placed.
diff --git a/builds/unix/unix.mk b/builds/unix/unix.mk
index c85653dc3..9fec19b8c 100644
--- a/builds/unix/unix.mk
+++ b/builds/unix/unix.mk
@@ -20,7 +20,7 @@ endif
DELETE := rm -f
SEP := /
HOSTSEP := $(SEP)
-BUILD := $(TOP)/config/unix
+BUILD := $(TOP)/builds/unix
PLATFORM := unix
# The directory where all object files are placed.
@@ -105,7 +105,7 @@ ifdef BUILD_FREETYPE
# Now include the main sub-makefile. It contains all the rules used to
# build the library with the previous variables defined.
#
- include $(TOP)/config/freetype.mk
+ include $(TOP)/builds/freetype.mk
# The cleanup targets.
#
diff --git a/builds/win32/w32-dev.mk b/builds/win32/w32-dev.mk
index 294d63aed..438e7f65d 100644
--- a/builds/win32/w32-dev.mk
+++ b/builds/win32/w32-dev.mk
@@ -25,7 +25,7 @@ endif
DELETE := del
SEP := /
HOSTSEP := $(strip \ )
-BUILD := $(TOP)/config/win32
+BUILD := $(TOP)/builds/win32
PLATFORM := win32
CC := gcc
@@ -111,7 +111,7 @@ ifdef BUILD_FREETYPE
# Now include the main sub-makefile. It contains all the rules used to
# build the library with the previous variables defined.
#
- include $(TOP)/config/freetype.mk
+ include $(TOP)/builds/freetype.mk
# The cleanup targets.
#
diff --git a/builds/win32/w32-gcc.mk b/builds/win32/w32-gcc.mk
index c83c356a3..63570983e 100644
--- a/builds/win32/w32-gcc.mk
+++ b/builds/win32/w32-gcc.mk
@@ -23,7 +23,7 @@ endif
DELETE := del
SEP := /
HOSTSEP := $(strip \ )
-BUILD := $(TOP)/config/win32
+BUILD := $(TOP)/builds/win32
PLATFORM := win32
CC := gcc
@@ -109,7 +109,7 @@ ifdef BUILD_FREETYPE
# Now include the main sub-makefile. It contains all the rules used to
# build the library with the previous variables defined.
#
- include $(TOP)/config/freetype.mk
+ include $(TOP)/builds/freetype.mk
# The cleanup targets.
#
diff --git a/builds/win32/w32-icc.mk b/builds/win32/w32-icc.mk
index deb07203a..2f6627985 100644
--- a/builds/win32/w32-icc.mk
+++ b/builds/win32/w32-icc.mk
@@ -108,7 +108,7 @@ ANSI_FLAGS := /Sa
ifdef BUILD_FREETYPE
-include $(TOP)/config/freetype.mk
+include $(TOP)/builds/freetype.mk
clean_freetype: clean_freetype_dos
distclean_freetype: distclean_freetype_dos
diff --git a/builds/win32/w32-lcc.mk b/builds/win32/w32-lcc.mk
index 172ead1cf..601348dfc 100644
--- a/builds/win32/w32-lcc.mk
+++ b/builds/win32/w32-lcc.mk
@@ -19,7 +19,7 @@ endif
DELETE := del
SEP := /
HOSTSEP := $(strip \ )
-BUILD := $(TOP)/config/win32
+BUILD := $(TOP)/builds/win32
PLATFORM := win32
CC := lcc
@@ -105,7 +105,7 @@ ifdef BUILD_FREETYPE
# Now include the main sub-makefile. It contains all the rules used to
# build the library with the previous variables defined.
#
- include $(TOP)/config/freetype.mk
+ include $(TOP)/builds/freetype.mk
# The cleanup targets.
#
diff --git a/builds/win32/w32-vcc.mk b/builds/win32/w32-vcc.mk
index 4f0a4a3db..4c5442f0a 100644
--- a/builds/win32/w32-vcc.mk
+++ b/builds/win32/w32-vcc.mk
@@ -19,7 +19,7 @@ endif
DELETE := del
SEP := /
HOSTSEP := $(strip \ )
-BUILD := $(TOP)/config/win32
+BUILD := $(TOP)/builds/win32
PLATFORM := win32
CC := cl
@@ -105,7 +105,7 @@ ifdef BUILD_FREETYPE
# Now include the main sub-makefile. It contains all the rules used to
# build the library with the previous variables defined.
#
- include $(TOP)/config/freetype.mk
+ include $(TOP)/builds/freetype.mk
# The cleanup targets.
#
diff --git a/config/freetype.mk b/config/freetype.mk
index dc3043a06..c9d4a9120 100644
--- a/config/freetype.mk
+++ b/config/freetype.mk
@@ -115,7 +115,7 @@ FT_LIBRARY := $(LIB_)$(LIBRARY).$A
# in the `freetype/config/<system>' directory, as these
# files will override the default sources.
#
-INCLUDES := $(BUILD) $(TOP)$(SEP)include $(INCLUDES)
+INCLUDES := $(BUILD) $(TOP)$(SEP)include $(SRC)
INCLUDE_FLAGS = $(INCLUDES:%=$I%)
diff --git a/docs/BUILD b/docs/BUILD
new file mode 100644
index 000000000..93c74633d
--- /dev/null
+++ b/docs/BUILD
@@ -0,0 +1,264 @@
+FreeType 2 compilation how-to
+
+
+Introduction:
+
+Welcome to this new beta of the FreeType 2 library. You'll find in this
+document instructions on how to compile the library on your favorite
+platform.
+
+ *** UNIX USERS : Even though the FT2 build system doesn't
+ ************** : use the Autoconf/Automake tools, these will
+ ************** : be introduced in the Unix-specific parts of
+ ************** : the build in our final release..
+
+
+I. QUICK COMMAND-LINE GUIDE:
+----------------------------
+
+ Install GNU Make, then try the following on Unix or any system with gcc:
+
+ make // this will setup the build
+ make // this will build the library
+
+ On Win32+Visual C++:
+
+ make setup visualc // setup the build for VisualC++ on Win32
+ make // build the library
+
+ Then, go to the "demos" directory and type
+
+ make
+
+ To compile the demo programs..
+
+ If this doesn't work, read the following..
+
+
+
+II. COMMAND-LINE COMPILATION:
+-----------------------------
+
+ Note that if you do not want to compile FreeType 2 from a command line
+ shell, please skip to section III below (DETAILED COMPILATION)
+
+ FreeType 2 includes a powerful and flexible build system that allows you
+ to easily compile it on a great variety of platforms from the command
+ line. To do so, just follow these simple instructions:
+
+ a/ Install GNU Make:
+
+ Because GNU Make is the only Make tool supported to compile FreeType 2,
+ you should install it on your machine.
+
+ Because the FT2 build system relies on many important features of GNU
+ Make, trying to build the library with any other Make tool will *fail*.
+
+
+ b/ Invoke "make":
+
+ Go to the root FT2 directory, then simply invoke GNU Make from the
+ command line, this will launch the FreeType 2 Host Platform detection
+ routines. A summary will be displayed, for example, on Win32:
+
+ ========================================================================
+ FreeType build system -- automatic system detection
+
+ The following settings are used:
+
+ platform win32
+ compiler gcc
+ configuration directory ./builds/win32
+ configuration rules ./builds/win32/w32-gcc.mk
+
+ If this does not correspond to your system or settings please remove
+ the file 'config.mk' from this directory then read the INSTALL file
+ for help.
+
+ Otherwise, simply type 'make' again to build the library.
+ =========================================================================
+
+ If the detected settings correspond to your platform and compiler,
+ skip to step e/. Note that if your platform is completely alien to
+ the build system, the detected platform will be "ansi".
+
+
+ c/ Configure the build system for a different compiler:
+
+ If the build system correctly detected your platform, but you want to
+ use a different compiler than the one specified in the summary (for
+ most platforms, gcc is the defaut compiler), simply invoke GNU Make
+ like :
+
+ make setup <compiler>
+
+ For example:
+
+ to use Visual C++ on Win32, type: "make setup visualc"
+ to use LCC-Win32 on Win32, type: "make setup lcc"
+
+ The <compiler> name to use is platform-dependent. The list of available
+ compilers for your system is available in the file
+ "builds/<system>/detect.mk" (note that we hope to make the list
+ displayed at user demand in the final release)..
+
+ If you're satisfying by the new configuration summary, skip to step e/
+
+
+ d/ Configure the build system for an unknown platform/compiler:
+
+ What the auto-detection/setup phase of the build system does is simply
+ copy a file to the current directory under the name "config.mk".
+
+ For example, on OS/2+gcc, it would simply copy "builds/os2/os2-gcc.mk"
+ to "./config.mk"
+
+ If for some reason your platform isn't correctly detected, simply copy
+ manually the configuration sub-makefile to "./config.mk" and go to
+ step e/.
+
+ Note that this file is a sub-Makefile used to specify Make variables
+ used to invoke the compiler and linker during the build, you can easily
+ create your own version from one of the existing configuration files,
+ then copy it to the current directory under the name "./config.mk".
+
+
+ e/ Build the library:
+
+ The auto-detection/setup phase should have copied a file in the current
+ directory, called "./config.mk". This file contains definitions of various
+ Make variables used to invoke the compiler and linker during the build.
+
+ To launch the build, simply invoke GNU Make again: the top Makefile will
+ detect the configuration file and run the build with it..
+
+
+ f/ Build the demonstration programs:
+
+ Once the library is compiled, go to "demos", then invoke GNU Make.
+
+ Note that the demonstration programs include a tiny graphics sub-system
+ that includes "drivers" to display Windows on Win32, X11 and OS/2. The
+ build system should automatically detect which driver to use based on
+ the current platform.
+
+ UNIX USERS TAKE NOTE: XXXXXX
+
+ When building the demos, the build system tries to detect your X11 path
+ by looking for the patterns "X11R5/bin", "X11R6/bin" or "X11/bin" in
+ your current path. If no X11 path is found, the demo programs will not
+ be able to display graphics and will fail. Change your current path
+ if you encounter this problem.
+
+ Note that the release version will use Autoconf to detect everything
+ on Unix, so this will not be necessary !!
+
+
+II. DETAILED COMPILATION PROCEDURE:
+-----------------------------------
+
+ If you don't want to compile FreeType 2 from the command-line (for example
+ from a graphical IDE on a Mac or Windows), you'll need to understand how the
+ FreeType files are organized.
+
+ FreeType 2 has a very module design, and it is made of several components.
+ Each component must be compiled as a stand-alone object file, even when it
+ is really made of several C source files. For example, the "base layer"
+ component is made of the following C files:
+
+ src/
+ base/
+ ftcalc.c - computations
+ ftobjs.c - object management
+ ftstream.c - stream input
+ ftlist.c - simple list management
+ ftoutln.c - simple outline processing
+ ftextend.c - extensions support
+
+ However, you can create a single object file by compiling the file
+ "src/base/ftbase.c", whose content is basically:
+
+ #include <base/ftcalc.c>
+ #include <base/ftobjs.c>
+ #include <base/ftstream.c>
+ #include <base/ftlist.c>
+ #include <base/ftoutln.c>
+ #include <base/ftextend.c>
+
+ Similarly, each component has a single "englobing" C file to compile it
+ as a stand-alone object, i.e. :
+
+ src/base/ftbase.c - the base layer, high-level interface
+ src/sfnt/sfnt.c - the "sfnt" module
+ src/psnames/psnames.c - the Postscript Names module
+ src/truetype/truetype.c - the TrueType font driver
+ src/type1/type1.c - the Type 1 font driver
+
+
+ To compile one component, do the following:
+
+ - add the top-level "include" directory to your compilation include path
+
+ - add the "src" directory to your compilation include path.
+
+ - compile the component "source" file (see list below), you don't need
+ to be in the component's directory..
+
+ For example, the following line can be used to compile the truetype driver
+ on Unix:
+
+ cd freetype2/
+ cc -c -Iinclude -Isrc src/truetype/truetype.c
+
+ Alternatively:
+
+ cd freetype2/src/truetype
+ cc -c -I../../include -I.. truetype.c
+
+ The complete list of files to compile for a feature-complete build of
+ FreeType 2 is:
+
+ src/base/ftsystem.c - system-specific memory and i/o support
+ src/base/ftinit.c - initialisation layer
+ src/base/ftdebug.c - debugging component (empty in release build)
+ src/base/ftbase.c - the "base layer" component
+ src/base/ftglyph.c - optional convenience functions
+ src/raster1/raster1.c - the monochrome bitmap renderer
+ src/smooth/smooth.c - the anti-aliased bitmap renderer
+ src/sfnt/sfnt.c - the "sfnt" module
+ src/psnames/psnames.c - the "psnames" module
+ src/truetype/truetype.c - the TrueType font driver
+ src/type1/type1.c - the Type 1 font driver (incl. Multiple Masters)
+ src/cid/type1cid.c - the Type 1 CID-keyed font driver
+ src/cff/cff.c - the OpenType/CFF/CEF font driver
+ src/winfonts/winfnt.c - the Windows FNT/FON font driver
+
+ All font drivers are optional. the "sfnt" and "psnames" modules are
+ mandatory for certain drivers.
+
+
+III. Support for flat-directory compilation:
+----------------------------------------
+
+ It is now possible to put all FreeType 2 source files into a single
+ directory, with the exception of the "include" hierarchy.
+
+ Note that you'll still need to only compile the 'wrapper' sources described
+ above. Define the "FT_FLAT_COMPILE" macro when compiling. Here's an
+ example:
+
+ 1/ Copy all files in current directory:
+
+ cp freetype2/src/base/*.[hc] .
+ cp freetype2/src/raster1/*.[hc] .
+ cp freetype2/src/smooth/*.[hc] .
+ etc...
+
+ 2/ Compile sources:
+
+ cc -c -DFT_FLAT_COMPILE -Ifreetype/include ftsystem.c
+ cc -c -DFT_FLAT_COMPILE -Ifreetype/include ftinit.c
+ cc -c -DFT_FLAT_COMPILE -Ifreetype/include ftdebug.c
+ cc -c -DFT_FLAT_COMPILE -Ifreetype/include ftbase.c
+ etc...
+
diff --git a/src/base/ftbase.c b/src/base/ftbase.c
index 20e419921..5d13d5e5b 100644
--- a/src/base/ftbase.c
+++ b/src/base/ftbase.c
@@ -16,12 +16,20 @@
/***************************************************************************/
+#ifdef FT_FLAT_COMPILE
+#include "ftcalc.c"
+#include "ftobjs.c"
+#include "ftstream.c"
+#include "ftlist.c"
+#include "ftoutln.c"
+#include "ftextend.c"
+#else
#include <ftcalc.c>
#include <ftobjs.c>
#include <ftstream.c>
#include <ftlist.c>
#include <ftoutln.c>
#include <ftextend.c>
-
+#endif
/* END */
diff --git a/src/cff/cff.c b/src/cff/cff.c
index 40f6124d3..2d3dad2be 100644
--- a/src/cff/cff.c
+++ b/src/cff/cff.c
@@ -18,11 +18,20 @@
#define FT_MAKE_OPTION_SINGLE_OBJECT
-#include <t2driver.c> /* driver interface */
-#include <t2parse.c> /* token parser */
-#include <t2load.c> /* tables loader */
-#include <t2objs.c> /* object management */
-#include <t2gload.c> /* glyph loader */
+#ifdef FT_FLAT_COMPILE
+#include "t2driver.c" /* driver interface */
+#include "t2parse.c" /* token parser */
+#include "t2load.c" /* tables loader */
+#include "t2objs.c" /* object management */
+#include "t2gload.c" /* glyph loader */
+#else
+#include <cff/t2driver.c> /* driver interface */
+#include <cff/t2parse.c> /* token parser */
+#include <cff/t2load.c> /* tables loader */
+#include <cff/t2objs.c> /* object management */
+#include <cff/t2gload.c> /* glyph loader */
+#endif
+
/* END */
diff --git a/src/cff/rules.mk b/src/cff/rules.mk
index d7cc66ae9..ba87af5f1 100644
--- a/src/cff/rules.mk
+++ b/src/cff/rules.mk
@@ -19,14 +19,7 @@ T2_DIR := $(SRC_)cff
T2_DIR_ := $(T2_DIR)$(SEP)
-# additional include flags used when compiling the driver
-#
-T2_INCLUDE := $(T2_DIR)
-
-# compilation flags for the driver
-#
-T2_CFLAGS := $(T2_INCLUDE:%=$I%)
-T2_COMPILE := $(FT_COMPILE) $(T2_CFLAGS)
+T2_COMPILE := $(FT_COMPILE)
# T2 driver sources (i.e., C files)
diff --git a/src/cff/t2driver.c b/src/cff/t2driver.c
index 5f81b2b59..eea66998d 100644
--- a/src/cff/t2driver.c
+++ b/src/cff/t2driver.c
@@ -22,11 +22,17 @@
#include <freetype/internal/sfnt.h>
#include <freetype/ttnameid.h>
-#include <t2driver.h>
-#include <t2gload.h>
-
#include <freetype/internal/t2errors.h>
+#ifdef FT_FLAT_COMPILE
+#include "t2driver.h"
+#include "t2gload.h"
+#else
+#include <cff/t2driver.h>
+#include <cff/t2gload.h>
+#endif
+
+
/*************************************************************************/
/* */
diff --git a/src/cff/t2gload.c b/src/cff/t2gload.c
index 52786becf..f36841ca3 100644
--- a/src/cff/t2gload.c
+++ b/src/cff/t2gload.c
@@ -23,8 +23,13 @@
#include <freetype/ftoutln.h>
#include <freetype/tttags.h>
-#include <t2load.h>
-#include <t2gload.h>
+#ifdef FT_FLAT_COMPILE
+#include "t2load.h"
+#include "t2gload.h"
+#else
+#include <cff/t2load.h>
+#include <cff/t2gload.h>
+#endif
#include <freetype/internal/t2errors.h>
@@ -472,9 +477,9 @@
builder->path_begun = 1;
error = add_contour( builder );
if ( !error )
- error = add_point1( builder, x, y );
+ return error;
}
- return error;
+ return add_point1( builder, x, y );
}
@@ -595,8 +600,8 @@
v = *ip++;
if ( v >= 32 || v == 28 )
{
- FT_Int shift = 16;
- FT_Long val;
+ FT_Int shift = 16;
+ FT_Int32 val;
/* this is an operand, push it on the stack */
@@ -604,7 +609,7 @@
{
if ( ip + 1 >= limit )
goto Syntax_Error;
- val = (FT_Short)( ( (FT_Int)ip[0] << 8 ) + ip[1] );
+ val = (FT_Int32)( ( (FT_Short)ip[0] << 8 ) | ip[1] );
ip += 2;
}
else if ( v < 247 )
@@ -640,7 +645,7 @@
#ifdef FT_DEBUG_LEVEL_TRACE
if ( !( val & 0xFFFF ) )
- FT_TRACE4(( " %d", (FT_Int)( val >> 16 ) ));
+ FT_TRACE4(( " %d", (FT_Int32)( val >> 16 ) ));
else
FT_TRACE4(( " %.2f", val/65536.0 ));
#endif
@@ -1296,7 +1301,7 @@
{
FT_Pos start_x, start_y; /* record start x,y values for alter use */
FT_Int dx = 0, dy = 0; /* used in hort./vert. algorithm below */
- FT_Int hort_flag, count;
+ FT_Int horizontal, count;
FT_TRACE4(( " flex1" ));
@@ -1314,7 +1319,7 @@
args = stack;
/* grab up to the last argument */
- while ( args < decoder->top - 1)
+ for ( count = 5; count > 0; count-- )
{
dx += args[0];
dy += args[1];
@@ -1328,7 +1333,7 @@
if ( dy < 0 ) dy = -dy;
/* strange test, but here it is... */
- hort_flag = (dx > dy);
+ horizontal = (dx > dy);
for ( count = 5; count > 0; count-- )
{
@@ -1338,7 +1343,7 @@
args += 2;
}
- if (hort_flag)
+ if (horizontal)
{
x += args[0];
y = start_y;
diff --git a/src/cff/t2gload.h b/src/cff/t2gload.h
index 39ef98c66..a089e88d8 100644
--- a/src/cff/t2gload.h
+++ b/src/cff/t2gload.h
@@ -20,7 +20,12 @@
#define T2GLOAD_H
#include <freetype/freetype.h>
-#include <t2objs.h>
+
+#ifdef FT_FLAT_COMPILE
+#include "t2objs.h"
+#else
+#include <cff/t2objs.h>
+#endif
#ifdef __cplusplus
extern "C" {
diff --git a/src/cff/t2load.c b/src/cff/t2load.c
index fdbc9df2e..285c62f46 100644
--- a/src/cff/t2load.c
+++ b/src/cff/t2load.c
@@ -23,8 +23,14 @@
#include <freetype/internal/t2errors.h>
#include <freetype/tttags.h>
-#include <t2load.h>
-#include <t2parse.h>
+
+#ifdef FT_FLAT_COMPILE
+#include "t2load.h"
+#include "t2parse.h"
+#else
+#include <cff/t2load.h>
+#include <cff/t2parse.h>
+#endif
/*************************************************************************/
@@ -283,8 +289,6 @@
}
-#if 0 /* unused until we fully support pure-CFF fonts */
-
LOCAL_FUNC
FT_String* T2_Get_String( CFF_Index* index,
FT_UInt sid,
@@ -319,7 +323,6 @@
}
}
-#endif /* 0 */
/*************************************************************************/
diff --git a/src/cff/t2load.h b/src/cff/t2load.h
index 0cf64e065..b86956d75 100644
--- a/src/cff/t2load.h
+++ b/src/cff/t2load.h
@@ -29,14 +29,11 @@
FT_String* T2_Get_Name( CFF_Index* index,
FT_UInt element );
-#if 0 /* will be used later for pure-CFF font support */
-
LOCAL_DEF
FT_String* T2_Get_String( CFF_Index* index,
FT_UInt sid,
PSNames_Interface* interface );
-#endif
LOCAL_DEF
FT_Error T2_Access_Element( CFF_Index* index,
diff --git a/src/cff/t2objs.c b/src/cff/t2objs.c
index 2030bd167..fa4f9bfe2 100644
--- a/src/cff/t2objs.c
+++ b/src/cff/t2objs.c
@@ -19,14 +19,21 @@
#include <freetype/internal/ftdebug.h>
#include <freetype/internal/ftcalc.h>
#include <freetype/internal/ftstream.h>
+#include <freetype/fterrors.h>
#include <freetype/ttnameid.h>
#include <freetype/tttags.h>
#include <freetype/internal/sfnt.h>
#include <freetype/internal/psnames.h>
-#include <t2objs.h>
-#include <t2load.h>
+#ifdef FT_FLAT_COMPILE
+#include "t2objs.h"
+#include "t2load.h"
+#else
+#include <cff/t2objs.h>
+#include <cff/t2load.h>
+#endif
+
#include <freetype/internal/t2errors.h>
@@ -46,7 +53,131 @@
/* */
/*************************************************************************/
+ static
+ FT_String* T2_StrCopy( FT_Memory memory, const FT_String* source )
+ {
+ FT_Error error;
+ FT_String* result = 0;
+ FT_Int len = (FT_Int)strlen(source);
+
+ if ( !ALLOC( result, len+1 ) )
+ {
+ MEM_Copy( result, source, len );
+ result[len] = 0;
+ }
+ return result;
+ }
+
+
+ /* this function is used to build a Unicode charmap from the glyph names */
+ /* in a file.. */
+ static
+ FT_Error CFF_Build_Unicode_Charmap( T2_Face face,
+ FT_ULong base_offset,
+ PSNames_Interface* psnames )
+ {
+ CFF_Font* font = (CFF_Font*)face->extra.data;
+ FT_Memory memory = FT_FACE_MEMORY(face);
+ FT_UInt n, num_glyphs = face->root.num_glyphs;
+ const char** glyph_names;
+ FT_Error error;
+ CFF_Font_Dict* dict = &font->top_font.font_dict;
+ FT_ULong charset_offset;
+ FT_Byte format;
+ FT_Stream stream = face->root.stream;
+
+ charset_offset = dict->charset_offset;
+ if (!charset_offset)
+ {
+ FT_ERROR(( "CFF.Build_Unicode_Charmap: charset table is missing\n" ));
+ error = FT_Err_Invalid_File_Format;
+ goto Exit;
+ }
+ /* seek to charset table and allocate glyph names table */
+ if ( FILE_Seek( base_offset + charset_offset ) ||
+ ALLOC_ARRAY( glyph_names, num_glyphs, const char* ) )
+ goto Exit;
+
+ /* now, read each glyph name and store it in the glyph name table */
+ if ( READ_Byte(format) )
+ goto Fail;
+
+ switch (format)
+ {
+ case 0: /* format 0 - one SID per glyph */
+ {
+ const char** gname = glyph_names;
+ const char** limit = gname + num_glyphs;
+
+ if ( ACCESS_Frame( num_glyphs*2 ) )
+ goto Fail;
+
+ for ( ; gname < limit; gname++ )
+ gname[0] = T2_Get_String( &font->string_index,
+ GET_UShort(),
+ psnames );
+ FORGET_Frame();
+ break;
+ }
+
+ case 1: /* format 1 - sequential ranges */
+ case 2: /* format 2 - sequential ranges with 16-bit counts */
+ {
+ const char** gname = glyph_names;
+ const char** limit = gname + num_glyphs;
+ FT_UInt len = 3;
+
+ if (format == 2)
+ len++;
+
+ while (gname < limit)
+ {
+ FT_UInt first;
+ FT_UInt count;
+
+ if ( ACCESS_Frame( len ) )
+ goto Fail;
+
+ first = GET_UShort();
+ if (format == 3)
+ count = GET_UShort();
+ else
+ count = GET_Byte();
+
+ FORGET_Frame();
+
+ for ( ; count > 0; count-- )
+ {
+ gname[0] = T2_Get_String( &font->string_index,
+ first,
+ psnames );
+ gname++;
+ first++;
+ }
+ }
+ break;
+ }
+
+ default: /* unknown charset format !! */
+ FT_ERROR(( "CFF: unknown charset format !!\n" ));
+ error = FT_Err_Invalid_File_Format;
+ goto Fail;
+ }
+
+ /* all right, the glyph names were loaded, we now need to create */
+ /* the corresponding unicode charmap.. */
+
+ Fail:
+ for ( n = 0; n < num_glyphs; n++ )
+ FREE( glyph_names[n] );
+
+ FREE( glyph_names );
+
+ Exit:
+ return error;
+ }
+
/*************************************************************************/
/* */
/* <Function> */
@@ -77,48 +208,82 @@
FT_Int num_params,
FT_Parameter* params )
{
- FT_Error error;
- SFNT_Interface* sfnt;
-
+ FT_Error error;
+ SFNT_Interface* sfnt;
+ PSNames_Interface* psnames;
+ FT_Bool pure_cff = 1;
+ FT_Bool sfnt_format = 0;
sfnt = (SFNT_Interface*)FT_Get_Module_Interface(
face->root.driver->root.library, "sfnt" );
if ( !sfnt )
goto Bad_Format;
+ psnames = (PSNames_Interface*)FT_Get_Module_Interface(
+ face->root.driver->root.library, "psnames" );
+
/* create input stream from resource */
if ( FILE_Seek( 0 ) )
goto Exit;
/* check that we have a valid OpenType file */
error = sfnt->init_face( stream, face, face_index, num_params, params );
- if ( error )
- goto Exit;
-
- if ( face->format_tag != 0x4F54544FL ) /* `OTTO'; OpenType/CFF font */
+ if ( !error )
{
- FT_TRACE2(( "[not a valid OpenType/CFF font]\n" ));
- goto Bad_Format;
- }
+ if ( face->format_tag != 0x4F54544FL ) /* `OTTO'; OpenType/CFF font */
+ {
+ FT_TRACE2(( "[not a valid OpenType/CFF font]\n" ));
+ goto Bad_Format;
+ }
- /* If we are performing a simple font format check, exit immediately */
- if ( face_index < 0 )
- return T2_Err_Ok;
+ /* If we are performing a simple font format check, exit immediately */
+ if ( face_index < 0 )
+ return T2_Err_Ok;
- /* Load font directory */
- error = sfnt->load_face( stream, face, face_index, num_params, params );
- if ( error )
- goto Exit;
+ sfnt_format = 1;
- /* now, load the CFF part of the file */
- error = face->goto_table( face, TTAG_CFF, stream, 0 );
- if ( error )
- goto Exit;
+ /* now, the font can be either an OpenType/CFF font, or a SVG CEF font */
+ /* in the later case, it doesn't have a "head" table.. */
+ error = face->goto_table( face, TTAG_head, stream, 0 );
+ if (!error)
+ {
+ pure_cff = 0;
+
+ /* Load font directory */
+ error = sfnt->load_face( stream, face, face_index, num_params, params );
+ if ( error )
+ goto Exit;
+ }
+ else
+ {
+ /* load the "cmap" table by hand */
+ error = sfnt->load_charmaps( face, stream );
+ if (error)
+ goto Exit;
+
+ /* XXX: for now, we don't load the GPOS table, as OpenType Layout */
+ /* support will be added later to FreeType 2 as a separate module */
+ }
+ /* now, load the CFF part of the file */
+ error = face->goto_table( face, TTAG_CFF, stream, 0 );
+ if ( error )
+ goto Exit;
+ }
+ else
+ {
+ /* rewind to start of file, we're going to load a pure-CFF font */
+ (void)FILE_Seek(0);
+ error = FT_Err_Ok;
+ }
+
+
+ /* now load and parse the CFF table in the file */
{
CFF_Font* cff;
FT_Memory memory = face->root.memory;
FT_Face root;
+ FT_UInt flags;
if ( ALLOC( cff, sizeof ( *cff ) ) )
@@ -130,11 +295,80 @@
goto Exit;
/* Complement the root flags with some interesting information. */
- /* Note that for OpenType/CFF, there is no need to do this, but */
- /* this will be necessary for pure CFF fonts through. */
+ /* Note that this is only necessary for pure CFF and CEF fonts */
+
root = &face->root;
- }
+ if (pure_cff)
+ {
+ CFF_Font_Dict* dict = &cff->top_font.font_dict;
+
+ /* we need the psnames module for pure-CFF and CEF formats */
+ if (!psnames)
+ {
+ FT_ERROR(( "cannot open CFF & CEF fonts without the 'psnames' module\n" ));
+ goto Bad_Format;
+ }
+
+ /* retrieve font family & style name */
+ if (dict->cid_registry)
+ {
+ root->family_name = T2_Get_String( &cff->string_index,
+ dict->cid_font_name,
+ psnames );
+
+ root->style_name = T2_StrCopy( memory, "Regular" ); /* XXXX */
+ }
+ else
+ {
+ root->family_name = T2_Get_String( &cff->string_index,
+ dict->base_font_name,
+ psnames );
+
+ root->style_name = T2_Get_String( &cff->string_index,
+ dict->weight,
+ psnames );
+ }
+
+ /*********************************************************************/
+ /* */
+ /* Compute face flags. */
+ /* */
+ flags = FT_FACE_FLAG_SCALABLE | /* scalable outlines */
+ FT_FACE_FLAG_HORIZONTAL; /* horizontal data */
+
+ if (sfnt_format)
+ flags |= FT_FACE_FLAG_SFNT;
+
+ /* fixed width font? */
+ if ( dict->is_fixed_pitch )
+ flags |= FT_FACE_FLAG_FIXED_WIDTH;
+
+/* XXXX: WE DO NOT SUPPORT KERNING METRICS IN THE GPOS TABLE FOR NOW */
+#if 0
+ /* kerning available ? */
+ if ( face->kern_pairs )
+ flags |= FT_FACE_FLAG_KERNING;
+#endif
+ root->face_flags = flags;
+
+ /*********************************************************************/
+ /* */
+ /* Compute style flags. */
+ /* */
+ flags = 0;
+
+ if ( dict->italic_angle )
+ flags |= FT_STYLE_FLAG_ITALIC;
+
+ /* XXXX : may not be correct .. */
+ if ( cff->top_font.private_dict.force_bold )
+ flags |= FT_STYLE_FLAG_BOLD;
+
+ root->style_flags = flags;
+ }
+ }
+
Exit:
return error;
diff --git a/src/cff/t2parse.c b/src/cff/t2parse.c
index b60f984c1..7800fe48d 100644
--- a/src/cff/t2parse.c
+++ b/src/cff/t2parse.c
@@ -16,7 +16,12 @@
/***************************************************************************/
-#include <t2parse.h>
+#ifdef FT_FLAT_COMPILE
+#include "t2parse.h"
+#else
+#include <cff/t2parse.h>
+#endif
+
#include <freetype/internal/t2errors.h>
@@ -417,7 +422,11 @@
static const T2_Field_Handler t2_field_handlers[] =
{
-#include <t2tokens.h>
+#ifdef FT_FLAT_COMPILE
+#include "t2tokens.h"
+#else
+#include <cff/t2tokens.h>
+#endif
{ 0, 0, 0, 0, 0, 0, 0 }
};
diff --git a/src/cid/cidafm.c b/src/cid/cidafm.c
index ce2739b99..d37fe2e84 100644
--- a/src/cid/cidafm.c
+++ b/src/cid/cidafm.c
@@ -15,8 +15,12 @@
/* */
/***************************************************************************/
+#ifdef FT_FLAT_COMPILE
+#include "cidafm.h"
+#else
+#include <cid/cidafm.h>
+#endif
-#include <cidafm.h>
#include <freetype/internal/ftstream.h>
#include <freetype/internal/t1types.h>
#include <freetype/internal/t1errors.h>
diff --git a/src/cid/cidafm.h b/src/cid/cidafm.h
index 1e3f990b7..3496b5d16 100644
--- a/src/cid/cidafm.h
+++ b/src/cid/cidafm.h
@@ -19,7 +19,11 @@
#ifndef CIDAFM_H
#define CIDAFM_H
-#include <cidobjs.h>
+#ifdef FT_FLAT_COMPILE
+#include "cidobjs.h"
+#else
+#include <cid/cidobjs.h>
+#endif
#ifdef __cplusplus
diff --git a/src/cid/cidgload.c b/src/cid/cidgload.c
index 4f32fa458..0c6b14778 100644
--- a/src/cid/cidgload.c
+++ b/src/cid/cidgload.c
@@ -16,8 +16,14 @@
/***************************************************************************/
-#include <cidload.h>
-#include <cidgload.h>
+#ifdef FT_FLAT_COMPILE
+#include "cidload.h"
+#include "cidgload.h"
+#else
+#include <cid/cidload.h>
+#include <cid/cidgload.h>
+#endif
+
#include <freetype/internal/ftdebug.h>
#include <freetype/internal/ftstream.h>
#include <freetype/ftoutln.h>
diff --git a/src/cid/cidgload.h b/src/cid/cidgload.h
index 555586a21..053871011 100644
--- a/src/cid/cidgload.h
+++ b/src/cid/cidgload.h
@@ -19,7 +19,11 @@
#ifndef CIDGLOAD_H
#define CIDGLOAD_H
-#include <cidobjs.h>
+#ifdef FT_FLAT_COMPILE
+#include "cidobjs.h"
+#else
+#include <cid/cidobjs.h>
+#endif
#ifdef __cplusplus
extern "C" {
diff --git a/src/cid/cidload.c b/src/cid/cidload.c
index b9a94f52e..cf5f50e3f 100644
--- a/src/cid/cidload.c
+++ b/src/cid/cidload.c
@@ -22,7 +22,12 @@
#include <freetype/internal/t1types.h>
#include <freetype/internal/t1errors.h>
-#include <cidload.h>
+
+#ifdef FT_FLAT_COMPILE
+#include "cidload.h"
+#else
+#include <cid/cidload.h>
+#endif
#include <stdio.h>
#include <ctype.h> /* for isspace(), isalnum() */
@@ -238,7 +243,11 @@
static
const CID_Field_Rec t1_field_records[] =
{
-#include <cidtokens.h>
+#ifdef FT_FLAT_COMPILE
+#include "cidtokens.h"
+#else
+#include <cid/cidtokens.h>
+#endif
{ 0, 0, 0, 0, 0, 0, 0, 0 }
};
diff --git a/src/cid/cidload.h b/src/cid/cidload.h
index dccfd386c..0e58c929e 100644
--- a/src/cid/cidload.h
+++ b/src/cid/cidload.h
@@ -20,7 +20,12 @@
#define CIDLOAD_H
#include <freetype/internal/ftstream.h>
-#include <cidparse.h>
+
+#ifdef FT_FLAT_COMPILE
+#include "cidparse.h"
+#else
+#include <cid/cidparse.h>
+#endif
#ifdef __cplusplus
extern "C" {
diff --git a/src/cid/cidobjs.c b/src/cid/cidobjs.c
index eead86c2f..277dc1a8f 100644
--- a/src/cid/cidobjs.c
+++ b/src/cid/cidobjs.c
@@ -19,8 +19,14 @@
#include <freetype/internal/ftdebug.h>
#include <freetype/internal/ftstream.h>
-#include <cidgload.h>
-#include <cidload.h>
+#ifdef FT_FLAT_COMPILE
+#include "cidgload.h"
+#include "cidload.h"
+#else
+#include <cid/cidgload.h>
+#include <cid/cidload.h>
+#endif
+
#include <freetype/internal/psnames.h>
diff --git a/src/cid/cidparse.c b/src/cid/cidparse.c
index 5b29db401..c7063a9f7 100644
--- a/src/cid/cidparse.c
+++ b/src/cid/cidparse.c
@@ -21,7 +21,12 @@
#include <freetype/internal/ftobjs.h>
#include <freetype/internal/ftstream.h>
#include <freetype/internal/t1errors.h>
-#include <cidparse.h>
+
+#ifdef FT_FLAT_COMPILE
+#include "cidparse.h"
+#else
+#include <cid/cidparse.h>
+#endif
#include <string.h> /* for strncmp() */
diff --git a/src/cid/cidriver.c b/src/cid/cidriver.c
index 651dcb1c8..84ba6775a 100644
--- a/src/cid/cidriver.c
+++ b/src/cid/cidriver.c
@@ -16,8 +16,13 @@
/***************************************************************************/
-#include <cidriver.h>
-#include <cidgload.h>
+#ifdef FT_FLAT_COMPILE
+#include "cidriver.h"
+#include "cidgload.h"
+#else
+#include <cid/cidriver.h>
+#include <cid/cidgload.h>
+#endif
#include <freetype/internal/ftdebug.h>
#include <freetype/internal/ftstream.h>
diff --git a/src/cid/rules.mk b/src/cid/rules.mk
index 20c0235d4..cbaaec768 100644
--- a/src/cid/rules.mk
+++ b/src/cid/rules.mk
@@ -19,14 +19,7 @@ CID_DIR := $(SRC_)cid
CID_DIR_ := $(CID_DIR)$(SEP)
-# additional include flags used when compiling the driver
-#
-CID_INCLUDE := $(CID_DIR)
-
-# compilation flags for the driver
-#
-CID_CFLAGS := $(CID_INCLUDE:%=$I%)
-CID_COMPILE := $(FT_COMPILE) $(CID_CFLAGS)
+CID_COMPILE := $(FT_COMPILE)
# CID driver sources (i.e., C files)
diff --git a/src/cid/type1cid.c b/src/cid/type1cid.c
index 855f564d2..65feedc24 100644
--- a/src/cid/type1cid.c
+++ b/src/cid/type1cid.c
@@ -18,14 +18,18 @@
#define FT_MAKE_OPTION_SINGLE_OBJECT
-#include <cidparse.c>
-#include <cidload.c>
-#include <cidobjs.c>
-#include <cidriver.c>
-#include <cidgload.c>
-
-#if 0
-#include <cidafm.c>
+#ifdef FT_FLAT_COMPILE
+#include "cidparse.c"
+#include "cidload.c"
+#include "cidobjs.c"
+#include "cidriver.c"
+#include "cidgload.c"
+#else
+#include <cid/cidparse.c>
+#include <cid/cidload.c>
+#include <cid/cidobjs.c>
+#include <cid/cidriver.c>
+#include <cid/cidgload.c>
#endif
diff --git a/src/psnames/psmodule.c b/src/psnames/psmodule.c
index 3a1a8a14f..efd5ab9de 100644
--- a/src/psnames/psmodule.c
+++ b/src/psnames/psmodule.c
@@ -18,7 +18,14 @@
#include <freetype/internal/psnames.h>
#include <freetype/internal/ftobjs.h>
-#include <psmodule.h>
+
+#ifdef FT_FLAT_COMPILE
+#include "psmodule.h"
+#include "pstables.h"
+#else
+#include <psnames/psmodule.h>
+#include <psnames/pstables.h>
+#endif
#include <stdlib.h> /* for qsort() */
#include <string.h> /* for strcmp(), strncpy() */
@@ -27,9 +34,6 @@
#ifndef FT_CONFIG_OPTION_NO_POSTSCRIPT_NAMES
- /* see the Python script `freetype2/docs/glnames.py' which is used */
- /* to generate the following file */
-#include <pstables.h>
#ifdef FT_CONFIG_OPTION_ADOBE_GLYPH_LIST
diff --git a/src/psnames/rules.mk b/src/psnames/rules.mk
index 0ee337348..25552b266 100644
--- a/src/psnames/rules.mk
+++ b/src/psnames/rules.mk
@@ -18,15 +18,10 @@
PSNAMES_DIR := $(SRC_)psnames
PSNAMES_DIR_ := $(PSNAMES_DIR)$(SEP)
-# additional include flags used when compiling the driver
-#
-PSNAMES_INCLUDE := $(PSNAMES_DIR)
-
# compilation flags for the driver
#
-PSNAMES_CFLAGS := $(PSNAMES_INCLUDE:%=$I%)
-PSNAMES_COMPILE := $(FT_COMPILE) $(PSNAMES_CFLAGS)
+PSNAMES_COMPILE := $(FT_COMPILE)
# PSNames driver sources (i.e., C files)
diff --git a/src/raster1/ftrend1.c b/src/raster1/ftrend1.c
index 489cad95c..0b8d72d27 100644
--- a/src/raster1/ftrend1.c
+++ b/src/raster1/ftrend1.c
@@ -18,8 +18,14 @@
#include <freetype/internal/ftobjs.h>
#include <freetype/ftoutln.h>
-#include <ftrend1.h>
-#include <ftraster.h>
+
+#ifdef FT_FLAT_COMPILE
+#include "ftrend1.h"
+#include "ftraster.h"
+#else
+#include <raster1/ftrend1.h>
+#include <raster1/ftraster.h>
+#endif
/* initialize renderer -- init its raster */
diff --git a/src/raster1/raster1.c b/src/raster1/raster1.c
index 8f53a5333..b6b6e6295 100644
--- a/src/raster1/raster1.c
+++ b/src/raster1/raster1.c
@@ -18,8 +18,13 @@
#define FT_MAKE_OPTION_SINGLE_OBJECT
-#include <ftraster.c>
-#include <ftrend1.c>
+#ifdef FT_FLAT_COMPILE
+#include "ftraster.c"
+#include "ftrend1.c"
+#else
+#include <raster1/ftraster.c>
+#include <raster1/ftrend1.c>
+#endif
/* END */
diff --git a/src/raster1/rules.mk b/src/raster1/rules.mk
index bd7da8af5..38108450e 100644
--- a/src/raster1/rules.mk
+++ b/src/raster1/rules.mk
@@ -18,15 +18,9 @@
RAS1_DIR := $(SRC_)raster1
RAS1_DIR_ := $(RAS1_DIR)$(SEP)
-# additional include flags used when compiling the driver
-#
-RAS1_INCLUDE := $(RAS1_DIR)
-
-
# compilation flags for the driver
#
-RAS1_CFLAGS := $(RAS1_INCLUDE:%=$I%)
-RAS1_COMPILE := $(FT_COMPILE) $(RAS1_CFLAGS)
+RAS1_COMPILE := $(FT_COMPILE)
# raster1 driver sources (i.e., C files)
diff --git a/src/sfnt/rules.mk b/src/sfnt/rules.mk
index e3b0bbdd3..2255e6a08 100644
--- a/src/sfnt/rules.mk
+++ b/src/sfnt/rules.mk
@@ -19,14 +19,9 @@ SFNT_DIR := $(SRC_)sfnt
SFNT_DIR_ := $(SFNT_DIR)$(SEP)
-# additional include flags used when compiling the driver
-#
-SFNT_INCLUDE := $(SFNT_DIR)
-
# compilation flags for the driver
#
-SFNT_CFLAGS := $(SFNT_INCLUDE:%=$I%)
-SFNT_COMPILE := $(FT_COMPILE) $(SFNT_CFLAGS)
+SFNT_COMPILE := $(FT_COMPILE)
# SFNT driver sources (i.e., C files)
diff --git a/src/sfnt/sfdriver.c b/src/sfnt/sfdriver.c
index fe0a271ae..758d53a89 100644
--- a/src/sfnt/sfdriver.c
+++ b/src/sfnt/sfdriver.c
@@ -18,12 +18,23 @@
#include <freetype/internal/sfnt.h>
#include <freetype/internal/ftobjs.h>
-#include <sfdriver.h>
-#include <ttload.h>
-#include <ttsbit.h>
-#include <ttpost.h>
-#include <ttcmap.h>
-#include <sfobjs.h>
+
+#ifdef FT_FLAT_COMPILE
+#include "sfdriver.h"
+#include "ttload.h"
+#include "ttsbit.h"
+#include "ttpost.h"
+#include "ttcmap.h"
+#include "sfobjs.h"
+#else
+#include <sfnt/sfdriver.h>
+#include <sfnt/ttload.h>
+#include <sfnt/ttsbit.h>
+#include <sfnt/ttpost.h>
+#include <sfnt/ttcmap.h>
+#include <sfnt/sfobjs.h>
+#endif
+
#include <string.h> /* for strcmp() */
diff --git a/src/sfnt/sfnt.c b/src/sfnt/sfnt.c
index a9aa1826a..a87158d49 100644
--- a/src/sfnt/sfnt.c
+++ b/src/sfnt/sfnt.c
@@ -18,19 +18,41 @@
#define FT_MAKE_OPTION_SINGLE_OBJECT
-#include <ttload.c>
-#include <ttcmap.c>
-#include <sfobjs.c>
+#ifdef FT_FLAT_COMPILE
+
+#include "ttload.c"
+#include "ttcmap.c"
+#include "sfobjs.c"
#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
-#include <ttsbit.c>
+#include "ttsbit.c"
#endif
#ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
-#include <ttpost.c>
+#include "ttpost.c"
+#endif
+#include "sfdriver.c"
+
+
+#else /* FT_FLAT_COMPILE */
+
+#include <sfnt/ttload.c>
+#include <sfnt/ttcmap.c>
+#include <sfnt/sfobjs.c>
+
+#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
+#include <sfnt/ttsbit.c>
#endif
-#include <sfdriver.c>
+#ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
+#include <sfnt/ttpost.c>
+#endif
+#include <sfnt/sfdriver.c>
+
+#endif /* FT_FLAT_COMPILE */
+
+
+
/* END */
diff --git a/src/sfnt/sfobjs.c b/src/sfnt/sfobjs.c
index 87cc0ccec..98b38c1ed 100644
--- a/src/sfnt/sfobjs.c
+++ b/src/sfnt/sfobjs.c
@@ -16,7 +16,12 @@
/***************************************************************************/
-#include <sfobjs.h>
+#ifdef FT_FLAT_COMPILE
+#include "sfobjs.h"
+#else
+#include <sfnt/sfobjs.h>
+#endif
+
#include <freetype/internal/sfnt.h>
#include <freetype/internal/psnames.h>
#include <freetype/ttnameid.h>
diff --git a/src/sfnt/ttcmap.c b/src/sfnt/ttcmap.c
index f15963ead..798285000 100644
--- a/src/sfnt/ttcmap.c
+++ b/src/sfnt/ttcmap.c
@@ -19,8 +19,15 @@
#include <freetype/internal/ftdebug.h>
#include <freetype/internal/tterrors.h>
-#include <ttload.h>
-#include <ttcmap.h>
+#ifdef FT_FLAT_COMPILE
+#include "ttload.h"
+#include "ttcmap.h"
+#else
+#include <sfnt/ttload.h>
+#include <sfnt/ttcmap.h>
+#endif
+
+
/*************************************************************************/
diff --git a/src/sfnt/ttload.c b/src/sfnt/ttload.c
index a8557201d..e316beb02 100644
--- a/src/sfnt/ttload.c
+++ b/src/sfnt/ttload.c
@@ -21,8 +21,15 @@
#include <freetype/internal/tterrors.h>
#include <freetype/tttags.h>
-#include <ttload.h>
-#include <ttcmap.h>
+#ifdef FT_FLAT_COMPILE
+#include "ttload.h"
+#include "ttcmap.h"
+#else
+#include <sfnt/ttload.h>
+#include <sfnt/ttcmap.h>
+#endif
+
+
/*************************************************************************/
diff --git a/src/sfnt/ttpost.c b/src/sfnt/ttpost.c
index d613174fb..4151a6c5b 100644
--- a/src/sfnt/ttpost.c
+++ b/src/sfnt/ttpost.c
@@ -29,8 +29,14 @@
#include <freetype/internal/tterrors.h>
#include <freetype/tttags.h>
-#include <ttpost.h>
-#include <ttload.h>
+#ifdef FT_FLAT_COMPILE
+#include "ttpost.h"
+#include "ttload.h"
+#else
+#include <sfnt/ttpost.h>
+#include <sfnt/ttload.h>
+#endif
+
/*************************************************************************/
diff --git a/src/sfnt/ttsbit.c b/src/sfnt/ttsbit.c
index f6ed29abf..34c548030 100644
--- a/src/sfnt/ttsbit.c
+++ b/src/sfnt/ttsbit.c
@@ -20,7 +20,12 @@
#include <freetype/internal/tterrors.h>
#include <freetype/tttags.h>
-#include <ttsbit.h>
+#ifdef FT_FLAT_COMPILE
+#include "ttsbit.h"
+#else
+#include <sfnt/ttsbit.h>
+#endif
+
/*************************************************************************/
diff --git a/src/sfnt/ttsbit.h b/src/sfnt/ttsbit.h
index 7992a7d1b..fcfec06a8 100644
--- a/src/sfnt/ttsbit.h
+++ b/src/sfnt/ttsbit.h
@@ -19,7 +19,12 @@
#ifndef TTSBIT_H
#define TTSBIT_H
-#include <ttload.h>
+#ifdef FT_FLAT_COMPILE
+#include "ttload.h"
+#else
+#include <sfnt/ttload.h>
+#endif
+
#ifdef __cplusplus
diff --git a/src/smooth/ftgrays.c b/src/smooth/ftgrays.c
index 198fda2f2..7303b3ae4 100644
--- a/src/smooth/ftgrays.c
+++ b/src/smooth/ftgrays.c
@@ -123,8 +123,13 @@
#else /* _STANDALONE_ */
-
+#ifdef FT_FLAT_COMPILE
#include "ftgrays.h"
+#else
+#include <smooth/ftgrays.h>
+#endif
+
+
#include <freetype/internal/ftobjs.h> /* for FT_UNUSED() */
#include <freetype/internal/ftdebug.h> /* for FT_TRACE() and FT_ERROR() */
#include <freetype/ftoutln.h> /* for FT_Outline_Decompose() */
diff --git a/src/smooth/ftsmooth.c b/src/smooth/ftsmooth.c
index 1b1b0bd05..91cfe77dc 100644
--- a/src/smooth/ftsmooth.c
+++ b/src/smooth/ftsmooth.c
@@ -18,8 +18,16 @@
#include <freetype/internal/ftobjs.h>
#include <freetype/ftoutln.h>
-#include <ftsmooth.h>
-#include <ftgrays.h>
+
+#ifdef FT_FLAT_COMPILE
+#include "ftsmooth.h"
+#include "ftgrays.h"
+#else
+#include <smooth/ftsmooth.h>
+#include <smooth/ftgrays.h>
+#endif
+
+
/* initialize renderer -- init its raster */
diff --git a/src/smooth/rules.mk b/src/smooth/rules.mk
index fd0333980..a81d60ae8 100644
--- a/src/smooth/rules.mk
+++ b/src/smooth/rules.mk
@@ -18,15 +18,9 @@
SMOOTH_DIR := $(SRC_)smooth
SMOOTH_DIR_ := $(SMOOTH_DIR)$(SEP)
-# additional include flags used when compiling the driver
-#
-SMOOTH_INCLUDE := $(SMOOTH_DIR)
-
-
# compilation flags for the driver
#
-SMOOTH_CFLAGS := $(SMOOTH_INCLUDE:%=$I%)
-SMOOTH_COMPILE := $(FT_COMPILE) $(SMOOTH_CFLAGS)
+SMOOTH_COMPILE := $(FT_COMPILE)
# smooth driver sources (i.e., C files)
diff --git a/src/smooth/smooth.c b/src/smooth/smooth.c
index bdb124530..9b605470c 100644
--- a/src/smooth/smooth.c
+++ b/src/smooth/smooth.c
@@ -18,8 +18,15 @@
#define FT_MAKE_OPTION_SINGLE_OBJECT
-#include <ftgrays.c>
-#include <ftsmooth.c>
+#ifdef FT_FLAT_COMPILE
+#include "ftgrays.c"
+#include "ftsmooth.c"
+#else
+#include <smooth/ftgrays.c>
+#include <smooth/ftsmooth.c>
+#endif
+
+
/* END */
diff --git a/src/truetype/rules.mk b/src/truetype/rules.mk
index 51c8556a2..9289378cb 100644
--- a/src/truetype/rules.mk
+++ b/src/truetype/rules.mk
@@ -19,14 +19,9 @@ TT_DIR := $(SRC_)truetype
TT_DIR_ := $(TT_DIR)$(SEP)
-# additional include flags used when compiling the driver
-#
-TT_INCLUDE := $(TT_DIR)
-
# compilation flags for the driver
#
-TT_CFLAGS := $(TT_INCLUDE:%=$I%)
-TT_COMPILE := $(FT_COMPILE) $(TT_CFLAGS)
+TT_COMPILE := $(FT_COMPILE)
# TrueType driver sources (i.e., C files)
diff --git a/src/truetype/truetype.c b/src/truetype/truetype.c
index 642e4f738..0d6d5820a 100644
--- a/src/truetype/truetype.c
+++ b/src/truetype/truetype.c
@@ -18,13 +18,26 @@
#define FT_MAKE_OPTION_SINGLE_OBJECT
-#include <ttdriver.c> /* driver interface */
-#include <ttpload.c> /* tables loader */
-#include <ttgload.c> /* glyph loader */
-#include <ttobjs.c> /* object manager */
+#ifdef FT_FLAT_COMPILE
+#include "ttdriver.c" /* driver interface */
+#include "ttpload.c" /* tables loader */
+#include "ttgload.c" /* glyph loader */
+#include "ttobjs.c" /* object manager */
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
-#include <ttinterp.c> /* bytecode interpreter */
+#include "ttinterp.c" /* bytecode interpreter */
+#endif
+
+#else
+
+#include <truetype/ttdriver.c> /* driver interface */
+#include <truetype/ttpload.c> /* tables loader */
+#include <truetype/ttgload.c> /* glyph loader */
+#include <truetype/ttobjs.c> /* object manager */
+#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
+#include <truetype/ttinterp.c> /* bytecode interpreter */
+#endif
+
#endif
diff --git a/src/truetype/ttdriver.c b/src/truetype/ttdriver.c
index 8921349fe..5113d44cf 100644
--- a/src/truetype/ttdriver.c
+++ b/src/truetype/ttdriver.c
@@ -21,8 +21,14 @@
#include <freetype/internal/sfnt.h>
#include <freetype/ttnameid.h>
-#include <ttdriver.h>
-#include <ttgload.h>
+#ifdef FT_FLAT_COMPILE
+#include "ttdriver.h"
+#include "ttgload.h"
+#else
+#include <truetype/ttdriver.h>
+#include <truetype/ttgload.h>
+#endif
+
/*************************************************************************/
diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c
index 264947be7..ba440fa18 100644
--- a/src/truetype/ttgload.c
+++ b/src/truetype/ttgload.c
@@ -23,13 +23,14 @@
#include <freetype/tttags.h>
#include <freetype/ftoutln.h>
-#include <ttgload.h>
-
-#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
-#include <ttinterp.h>
+#ifdef FT_FLAT_COMPILE
+#include "ttgload.h"
+#else
+#include <truetype/ttgload.h>
#endif
+
/*************************************************************************/
/* */
/* The macro FT_COMPONENT is used in trace mode. It is an implicit */
diff --git a/src/truetype/ttgload.h b/src/truetype/ttgload.h
index cebead709..a3b1585e1 100644
--- a/src/truetype/ttgload.h
+++ b/src/truetype/ttgload.h
@@ -19,12 +19,23 @@
#ifndef TTGLOAD_H
#define TTGLOAD_H
-#include <ttobjs.h>
+#ifdef FT_FLAT_COMPILE
+#include "ttobjs.h"
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
-#include <ttinterp.h>
+#include "ttinterp.h"
#endif
+#else
+
+#include <truetype/ttobjs.h>
+#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
+#include <truetype/ttinterp.h>
+#endif
+
+#endif
+
+
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c
index d50382059..5b736d1d7 100644
--- a/src/truetype/ttinterp.c
+++ b/src/truetype/ttinterp.c
@@ -20,9 +20,14 @@
#include <freetype/internal/ftcalc.h>
#include <freetype/ftsystem.h>
-#include <ttobjs.h>
+#ifdef FT_FLAT_COMPILE
+#include "ttinterp.h"
+#else
+#include <truetype/ttinterp.h>
+#endif
+
+
#include <freetype/internal/tterrors.h>
-#include <ttinterp.h>
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
diff --git a/src/truetype/ttinterp.h b/src/truetype/ttinterp.h
index cb183606a..2aceca8ef 100644
--- a/src/truetype/ttinterp.h
+++ b/src/truetype/ttinterp.h
@@ -19,7 +19,12 @@
#ifndef TTINTERP_H
#define TTINTERP_H
-#include <ttobjs.h>
+#ifdef FT_FLAT_COMPILE
+#include "ttobjs.h"
+#else
+#include <truetype/ttobjs.h>
+#endif
+
#ifdef __cplusplus
diff --git a/src/truetype/ttobjs.c b/src/truetype/ttobjs.c
index 38a80f241..747f67daf 100644
--- a/src/truetype/ttobjs.c
+++ b/src/truetype/ttobjs.c
@@ -24,16 +24,28 @@
#include <freetype/internal/sfnt.h>
#include <freetype/internal/psnames.h>
-#include <ttobjs.h>
-#include <ttpload.h>
-#include <ttgload.h>
-#include <freetype/internal/tterrors.h>
+#ifdef FT_FLAT_COMPILE
+
+#include "ttgload.h"
+#include "ttpload.h"
+#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
+#include "ttinterp.h"
+#endif
+
+#else
+#include <truetype/ttgload.h>
+#include <truetype/ttpload.h>
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
-#include <ttinterp.h>
+#include <truetype/ttinterp.h>
#endif
+#endif
+
+#include <freetype/internal/tterrors.h>
+
+
/*************************************************************************/
/* */
diff --git a/src/truetype/ttpload.c b/src/truetype/ttpload.c
index d87bd40cc..d82dd45be 100644
--- a/src/truetype/ttpload.c
+++ b/src/truetype/ttpload.c
@@ -21,7 +21,12 @@
#include <freetype/internal/ftstream.h>
#include <freetype/tttags.h>
-#include <ttpload.h>
+#ifdef FT_FLAT_COMPILE
+#include "ttpload.h"
+#else
+#include <truetype/ttpload.h>
+#endif
+
#include <freetype/internal/tterrors.h>
diff --git a/src/type1/rules.mk b/src/type1/rules.mk
index 6b7184153..b5872ac6b 100644
--- a/src/type1/rules.mk
+++ b/src/type1/rules.mk
@@ -19,14 +19,9 @@ T1_DIR := $(SRC_)type1
T1_DIR_ := $(T1_DIR)$(SEP)
-# additional include flags used when compiling the driver
-#
-T1_INCLUDE := $(T1_DIR)
-
# compilation flags for the driver
#
-T1_CFLAGS := $(T1_INCLUDE:%=$I%)
-T1_COMPILE := $(FT_COMPILE) $(T1_CFLAGS)
+T1_COMPILE := $(FT_COMPILE)
# Type1 driver sources (i.e., C files)
diff --git a/src/type1/t1afm.c b/src/type1/t1afm.c
index 7cee61176..1b2f8fd70 100644
--- a/src/type1/t1afm.c
+++ b/src/type1/t1afm.c
@@ -16,7 +16,12 @@
/***************************************************************************/
-#include <t1afm.h>
+#ifdef FT_FLAT_COMPILE
+#include "t1afm.h"
+#else
+#include <type1/t1afm.h>
+#endif
+
#include <freetype/internal/ftstream.h>
#include <freetype/internal/t1types.h>
diff --git a/src/type1/t1driver.c b/src/type1/t1driver.c
index 5dc9949c1..863cee717 100644
--- a/src/type1/t1driver.c
+++ b/src/type1/t1driver.c
@@ -16,9 +16,15 @@
/***************************************************************************/
-#include <t1driver.h>
-#include <t1gload.h>
-#include <t1afm.h>
+#ifdef FT_FLAT_COMPILE
+#include "t1driver.h"
+#include "t1gload.h"
+#include "t1afm.h"
+#else
+#include <type1/t1driver.h>
+#include <type1/t1gload.h>
+#include <type1/t1afm.h>
+#endif
#include <freetype/internal/ftdebug.h>
#include <freetype/internal/ftstream.h>
diff --git a/src/type1/t1gload.c b/src/type1/t1gload.c
index 2a5bd6a30..f979ab2ed 100644
--- a/src/type1/t1gload.c
+++ b/src/type1/t1gload.c
@@ -16,14 +16,26 @@
/***************************************************************************/
-#include <t1gload.h>
+#ifdef FT_FLAT_COMPILE
+
+#include <type1/t1gload.h>
+#ifndef T1_CONFIG_OPTION_DISABLE_HINTER
+#include <type1/t1hinter.h>
+#endif
+
+#else
+
+#include <type1/t1gload.h>
+#ifndef T1_CONFIG_OPTION_DISABLE_HINTER
+#include <type1/t1hinter.h>
+#endif
+
+#endif
+
#include <freetype/internal/ftdebug.h>
#include <freetype/internal/ftstream.h>
#include <freetype/ftoutln.h>
-#ifndef T1_CONFIG_OPTION_DISABLE_HINTER
-#include <t1hinter.h>
-#endif
#include <string.h> /* for strcmp() */
diff --git a/src/type1/t1gload.h b/src/type1/t1gload.h
index 71f70afac..2aa9c315d 100644
--- a/src/type1/t1gload.h
+++ b/src/type1/t1gload.h
@@ -19,7 +19,12 @@
#ifndef T1GLOAD_H
#define T1GLOAD_H
-#include <t1objs.h>
+#ifdef FT_FLAT_COMPILE
+#include "t1objs.h"
+#else
+#include <type1/t1objs.h>
+#endif
+
#ifdef __cplusplus
extern "C" {
diff --git a/src/type1/t1hinter.c b/src/type1/t1hinter.c
index 2b6b6b300..02613cf8c 100644
--- a/src/type1/t1hinter.c
+++ b/src/type1/t1hinter.c
@@ -26,8 +26,14 @@
#include <freetype/internal/ftdebug.h>
-#include <t1objs.h>
-#include <t1hinter.h>
+#ifdef FT_FLAT_COMPILE
+#include "t1objs.h"
+#include "t1hinter.h"
+#else
+#include <type1/t1objs.h>
+#include <type1/t1hinter.h>
+#endif
+
/*************************************************************************/
diff --git a/src/type1/t1hinter.h b/src/type1/t1hinter.h
index 82872e3b3..b63f1563c 100644
--- a/src/type1/t1hinter.h
+++ b/src/type1/t1hinter.h
@@ -19,8 +19,13 @@
#ifndef T1HINTER_H
#define T1HINTER_H
-#include <t1objs.h>
-#include <t1gload.h>
+#ifdef FT_FLAT_COMPILE
+#include "t1objs.h"
+#include "t1gload.h"
+#else
+#include <type1/t1objs.h>
+#include <type1/t1gload.h>
+#endif
#ifdef __cplusplus
extern "C" {
diff --git a/src/type1/t1load.c b/src/type1/t1load.c
index d646c8ac9..2d4741b70 100644
--- a/src/type1/t1load.c
+++ b/src/type1/t1load.c
@@ -20,8 +20,14 @@
#include <freetype/internal/ftdebug.h>
#include <freetype/internal/t1types.h>
-#include <t1tokens.h>
-#include <t1parse.h>
+#ifdef FT_FLAT_COMPILE
+#include "t1tokens.h"
+#include "t1parse.h"
+#else
+#include <type1/t1tokens.h>
+#include <type1/t1parse.h>
+#endif
+
#include <stdio.h>
diff --git a/src/type1/t1load.h b/src/type1/t1load.h
index b9ce9b06f..508daed4c 100644
--- a/src/type1/t1load.h
+++ b/src/type1/t1load.h
@@ -20,7 +20,13 @@
#define T1LOAD_H
#include <freetype/internal/ftstream.h>
-#include <t1parse.h>
+
+#ifdef FT_FLAT_COMPILE
+#include "t1parse.h"
+#else
+#include <type1/t1parse.h>
+#endif
+
#ifdef __cplusplus
extern "C" {
diff --git a/src/type1/t1objs.c b/src/type1/t1objs.c
index c5ab04c73..dc4821102 100644
--- a/src/type1/t1objs.c
+++ b/src/type1/t1objs.c
@@ -19,14 +19,28 @@
#include <freetype/internal/ftdebug.h>
#include <freetype/internal/ftstream.h>
-#include <t1gload.h>
-#include <t1load.h>
-#include <t1afm.h>
+#ifdef FT_FLAT_COMPILE
+#include "t1gload.h"
+#include "t1load.h"
+#include "t1afm.h"
#ifndef T1_CONFIG_OPTION_DISABLE_HINTER
-#include <t1hinter.h>
+#include "t1hinter.h"
#endif
+#else
+
+#include <type1/t1gload.h>
+#include <type1/t1load.h>
+#include <type1/t1afm.h>
+#ifndef T1_CONFIG_OPTION_DISABLE_HINTER
+#include <type1/t1hinter.h>
+#endif
+
+#endif
+
+
+
#include <freetype/internal/psnames.h>
diff --git a/src/type1/t1parse.c b/src/type1/t1parse.c
index 433928ea8..d70780fbc 100644
--- a/src/type1/t1parse.c
+++ b/src/type1/t1parse.c
@@ -18,7 +18,13 @@
#include <freetype/internal/ftdebug.h>
#include <freetype/internal/t1types.h>
-#include <t1parse.h>
+
+#ifdef FT_FLAT_COMPILE
+#include "t1parse.h"
+#else
+#include <type1/t1parse.h>
+#endif
+
#include <stdio.h> /* for sscanf() */
#include <string.h> /* for strncpy() */
diff --git a/src/type1/t1parse.h b/src/type1/t1parse.h
index 2b6380da8..bfffaed4a 100644
--- a/src/type1/t1parse.h
+++ b/src/type1/t1parse.h
@@ -31,7 +31,13 @@
#define T1PARSE_H
#include <freetype/internal/ftstream.h>
-#include <t1tokens.h>
+
+#ifdef FT_FLAT_COMPILE
+#include "t1tokens.h"
+#else
+#include <type1/t1tokens.h>
+#endif
+
#ifdef __cplusplus
extern "C" {
diff --git a/src/type1/t1tokens.c b/src/type1/t1tokens.c
index 4487b49b6..1d7eea97c 100644
--- a/src/type1/t1tokens.c
+++ b/src/type1/t1tokens.c
@@ -32,8 +32,14 @@
#include <freetype/internal/ftstream.h>
#include <freetype/internal/ftdebug.h>
-#include <t1tokens.h>
-#include <t1load.h>
+#ifdef FT_FLAT_COMPILE
+#include "t1tokens.h"
+#include "t1load.h"
+#else
+#include <type1/t1tokens.h>
+#include <type1/t1load.h>
+#endif
+
#include <string.h> /* for strncmp() */
diff --git a/src/type1/t1tokens.h b/src/type1/t1tokens.h
index 03ae056c8..25d55a352 100644
--- a/src/type1/t1tokens.h
+++ b/src/type1/t1tokens.h
@@ -19,7 +19,12 @@
#ifndef T1TOKENS_H
#define T1TOKENS_H
-#include <t1objs.h>
+#ifdef FT_FLAT_COMPILE
+#include "t1objs.h"
+#else
+#include <type1/t1objs.h>
+#endif
+
#ifdef __cplusplus
diff --git a/src/type1/type1.c b/src/type1/type1.c
index 31ebb4382..6d15b3494 100644
--- a/src/type1/type1.c
+++ b/src/type1/type1.c
@@ -18,20 +18,39 @@
#define FT_MAKE_OPTION_SINGLE_OBJECT
-#include <t1driver.c>
-#include <t1objs.c>
-#include <t1load.c>
-#include <t1gload.c>
-#include <t1tokens.c>
-#include <t1parse.c>
+#ifdef FT_FLAT_COMPILE
+#include "t1driver.c"
+#include "t1objs.c"
+#include "t1load.c"
+#include "t1gload.c"
+#include "t1tokens.c"
+#include "t1parse.c"
#ifndef T1_CONFIG_OPTION_DISABLE_HINTER
-#include <t1hinter.c>
+#include "t1hinter.c"
#endif
+#ifndef T1_CONFIG_OPTION_NO_AFM
+#include "t1afm.c"
+#endif
+
+#else /* FT_FLAT_COMPILE */
+#include <type1/t1driver.c>
+#include <type1/t1objs.c>
+#include <type1/t1load.c>
+#include <type1/t1gload.c>
+#include <type1/t1tokens.c>
+#include <type1/t1parse.c>
+#ifndef T1_CONFIG_OPTION_DISABLE_HINTER
+#include <type1/t1hinter.c>
+#endif
#ifndef T1_CONFIG_OPTION_NO_AFM
-#include <t1afm.c>
+#include <type1/t1afm.c>
#endif
+#endif
+
+
+
/* END */
diff --git a/src/type1z/rules.mk b/src/type1z/rules.mk
index 3eb998698..3411fd171 100644
--- a/src/type1z/rules.mk
+++ b/src/type1z/rules.mk
@@ -19,14 +19,9 @@ T1Z_DIR := $(SRC_)type1z
T1Z_DIR_ := $(T1Z_DIR)$(SEP)
-# additional include flags used when compiling the driver
-#
-T1Z_INCLUDE := $(SHARED) $(T1Z_DIR)
-
# compilation flags for the driver
#
-T1Z_CFLAGS := $(T1Z_INCLUDE:%=$I%)
-T1Z_COMPILE := $(FT_COMPILE) $(T1Z_CFLAGS)
+T1Z_COMPILE := $(FT_COMPILE)
# Type1 driver sources (i.e., C files)
diff --git a/src/type1z/type1z.c b/src/type1z/type1z.c
index 03dd82716..5beee0ebb 100644
--- a/src/type1z/type1z.c
+++ b/src/type1z/type1z.c
@@ -18,14 +18,28 @@
#define FT_MAKE_OPTION_SINGLE_OBJECT
-#include <z1parse.c>
-#include <z1load.c>
-#include <z1objs.c>
-#include <z1driver.c>
-#include <z1gload.c>
+#ifdef FT_FLAT_COMPILE
+#include "z1parse.c"
+#include "z1load.c"
+#include "z1objs.c"
+#include "z1driver.c"
+#include "z1gload.c"
#ifndef Z1_CONFIG_OPTION_NO_AFM
-#include <z1afm.c>
+#include "z1afm.c"
+#endif
+
+#else
+
+#include <type1z/z1parse.c>
+#include <type1z/z1load.c>
+#include <type1z/z1objs.c>
+#include <type1z/z1driver.c>
+#include <type1z/z1gload.c>
+#ifndef Z1_CONFIG_OPTION_NO_AFM
+#include <type1z/z1afm.c>
+#endif
+
#endif
diff --git a/src/type1z/z1afm.c b/src/type1z/z1afm.c
index c75809993..1ceeca213 100644
--- a/src/type1z/z1afm.c
+++ b/src/type1z/z1afm.c
@@ -16,7 +16,12 @@
/***************************************************************************/
-#include <z1afm.h>
+#ifdef FT_FLAT_COMPILE
+#include "z1afm.h"
+#else
+#include <type1z/z1afm.h>
+#endif
+
#include <freetype/internal/ftstream.h>
#include <freetype/internal/t1types.h>
diff --git a/src/type1z/z1afm.h b/src/type1z/z1afm.h
index 4b95393fe..1a909b3ff 100644
--- a/src/type1z/z1afm.h
+++ b/src/type1z/z1afm.h
@@ -19,7 +19,12 @@
#ifndef Z1AFM_H
#define Z1AFM_H
-#include <z1objs.h>
+#ifdef FT_FLAT_COMPILE
+#include "z1objs.h"
+#else
+#include <type1z/z1objs.h>
+#endif
+
#ifdef __cplusplus
diff --git a/src/type1z/z1driver.c b/src/type1z/z1driver.c
index 286d9bd8b..1984b6143 100644
--- a/src/type1z/z1driver.c
+++ b/src/type1z/z1driver.c
@@ -15,10 +15,18 @@
*
******************************************************************/
-#include <z1driver.h>
-#include <z1gload.h>
-#include <z1load.h>
-#include <z1afm.h>
+#ifdef FT_FLAT_COMPILE
+#include "z1driver.h"
+#include "z1gload.h"
+#include "z1load.h"
+#include "z1afm.h"
+#else
+#include <type1z/z1driver.h>
+#include <type1z/z1gload.h>
+#include <type1z/z1load.h>
+#include <type1z/z1afm.h>
+#endif
+
#include <freetype/internal/ftdebug.h>
#include <freetype/internal/ftstream.h>
diff --git a/src/type1z/z1gload.c b/src/type1z/z1gload.c
index a65fc1602..2dbe4a75a 100644
--- a/src/type1z/z1gload.c
+++ b/src/type1z/z1gload.c
@@ -15,7 +15,12 @@
*
******************************************************************/
-#include <z1gload.h>
+#ifdef FT_FLAT_COMPILE
+#include "z1gload.h"
+#else
+#include <type1z/z1gload.h>
+#endif
+
#include <freetype/internal/ftdebug.h>
#include <freetype/internal/ftstream.h>
#include <freetype/ftoutln.h>
diff --git a/src/type1z/z1gload.h b/src/type1z/z1gload.h
index 58986023b..da93d1a82 100644
--- a/src/type1z/z1gload.h
+++ b/src/type1z/z1gload.h
@@ -35,7 +35,12 @@
#ifndef Z1GLOAD_H
#define Z1GLOAD_H
-#include <z1objs.h>
+#ifdef FT_FLAT_COMPILE
+#include "z1objs.h"
+#else
+#include <type1z/z1objs.h>
+#endif
+
#ifdef __cplusplus
extern "C" {
diff --git a/src/type1z/z1load.c b/src/type1z/z1load.c
index 11e8893eb..d1af02936 100644
--- a/src/type1z/z1load.c
+++ b/src/type1z/z1load.c
@@ -65,7 +65,13 @@
#include <freetype/internal/t1types.h>
#include <freetype/internal/t1errors.h>
-#include <z1load.h>
+
+#ifdef FT_FLAT_COMPILE
+#include "z1load.h"
+#else
+#include <type1z/z1load.h>
+#endif
+
#include <stdio.h>
#undef FT_COMPONENT
@@ -631,7 +637,11 @@
#define Z1_TOPDICT_NUM_FIXED2(n,f,m) Z1_NEW_FIXED_TABLE2(n,f,m)
/* including this file defines all field variables */
-#include <z1tokens.h>
+#ifdef FT_FLAT_COMPILE
+#include "z1tokens.h"
+#else
+#include <type1z/z1tokens.h>
+#endif
/*********************************************************************
*
@@ -1203,7 +1213,11 @@
static
const Z1_KeyWord t1_keywords[] =
{
-#include <z1tokens.h>
+#ifdef FT_FLAT_COMPILE
+#include "z1tokens.h"
+#else
+#include <type1z/z1tokens.h>
+#endif
/* now add the special functions... */
Z1_KEYWORD_CALLBACK( "FontName", parse_font_name ),
diff --git a/src/type1z/z1load.h b/src/type1z/z1load.h
index cedb44db7..8e3dc04f0 100644
--- a/src/type1z/z1load.h
+++ b/src/type1z/z1load.h
@@ -21,7 +21,14 @@
#include <freetype/internal/ftstream.h>
#include <freetype/internal/t1types.h>
#include <freetype/ftmm.h>
-#include <z1parse.h>
+
+#ifdef FT_FLAT_COMPILE
+#include "z1parse.h"
+#else
+#include <type1z/z1parse.h>
+#endif
+
+
#ifdef __cplusplus
extern "C" {
diff --git a/src/type1z/z1objs.c b/src/type1z/z1objs.c
index 054dbcc8d..edc6f9b81 100644
--- a/src/type1z/z1objs.c
+++ b/src/type1z/z1objs.c
@@ -18,10 +18,18 @@
#include <freetype/internal/ftdebug.h>
#include <freetype/internal/ftstream.h>
-#include <z1gload.h>
-#include <z1load.h>
+#ifdef FT_FLAT_COMPILE
+#include "z1gload.h"
+#include "z1load.h"
+#include "z1afm.h"
+#else
+#include <type1z/z1gload.h>
+#include <type1z/z1load.h>
+#include <type1z/z1afm.h>
+#endif
+
+
#include <freetype/internal/psnames.h>
-#include <z1afm.h>
/* Required by tracing mode */
#undef FT_COMPONENT
diff --git a/src/type1z/z1parse.c b/src/type1z/z1parse.c
index ed24458f2..7039bdb5e 100644
--- a/src/type1z/z1parse.c
+++ b/src/type1z/z1parse.c
@@ -33,7 +33,13 @@
#include <freetype/internal/ftobjs.h>
#include <freetype/internal/ftstream.h>
#include <freetype/internal/t1errors.h>
-#include <z1parse.h>
+
+#ifdef FT_FLAT_COMPILE
+#include "z1parse.h"
+#else
+#include <type1z/z1parse.h>
+#endif
+
#undef FT_COMPONENT
#define FT_COMPONENT trace_t1load
diff --git a/src/winfonts/rules.mk b/src/winfonts/rules.mk
index ce4134375..8396894d9 100644
--- a/src/winfonts/rules.mk
+++ b/src/winfonts/rules.mk
@@ -19,14 +19,7 @@ FNT_DIR := $(SRC_)winfonts
FNT_DIR_ := $(FNT_DIR)$(SEP)
-# additional include flags used when compiling the driver
-#
-FNT_INCLUDE := $(FNT_DIR)
-
-# compilation flags for the driver
-#
-FNT_CFLAGS := $(FNT_INCLUDE:%=$I%)
-FNT_COMPILE := $(FT_COMPILE) $(FNT_CFLAGS)
+FNT_COMPILE := $(FT_COMPILE)
# Windows driver sources (i.e., C files)
diff --git a/src/winfonts/winfnt.c b/src/winfonts/winfnt.c
index 28e83c47d..870bdb878 100644
--- a/src/winfonts/winfnt.c
+++ b/src/winfonts/winfnt.c
@@ -15,7 +15,12 @@
/* */
/***************************************************************************/
-#include <winfnt.h>
+#ifdef FT_FLAT_COMPILE
+#include "winfnt.h"
+#else
+#include <winfonts/winfnt.h>
+#endif
+
#include <freetype/fterrors.h>
#include <freetype/internal/ftstream.h>
#include <freetype/internal/ftdebug.h>
@@ -170,6 +175,7 @@
READ_Fields( winmz_header_fields, &mz_header ) )
goto Exit;
+ error = FT_Err_Unknown_File_Format;
if ( mz_header.magic == WINFNT_MZ_MAGIC )
{
/* yes, now look for a NE header in the file */
@@ -179,6 +185,7 @@
READ_Fields( winne_header_fields, &ne_header ) )
goto Exit;
+ error = FT_Err_Unknown_File_Format;
if ( ne_header.magic == WINFNT_NE_MAGIC )
{
/* good, now look in the resource table for each FNT resource */