ThirdParty: add FreeType 2.0.1 (the version in 12340)
Identified from the binary: ftgrays clipping and sweep predate 2.0.2, the module list is the stock 2.0.1 ftmodule.h. Source is the GitLab tag archive VER-2-0-1, unmodified; static target `freetype` built from the per-module single-file sources. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@@ -65,3 +65,28 @@ if (WIN32)
|
||||
target_link_libraries(nvapi INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/nvapi/x86/nvapi.lib)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
add_library(freetype STATIC
|
||||
freetype/src/base/ftsystem.c
|
||||
freetype/src/base/ftinit.c
|
||||
freetype/src/base/ftdebug.c
|
||||
freetype/src/base/ftbase.c
|
||||
freetype/src/autohint/autohint.c
|
||||
freetype/src/cff/cff.c
|
||||
freetype/src/cid/type1cid.c
|
||||
freetype/src/psaux/psaux.c
|
||||
freetype/src/psnames/psnames.c
|
||||
freetype/src/raster/raster.c
|
||||
freetype/src/sfnt/sfnt.c
|
||||
freetype/src/smooth/smooth.c
|
||||
freetype/src/truetype/truetype.c
|
||||
freetype/src/type1/type1.c
|
||||
freetype/src/winfonts/winfnt.c
|
||||
)
|
||||
|
||||
target_include_directories(freetype
|
||||
PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/freetype/include
|
||||
PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/freetype/src
|
||||
)
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
config.mk
|
||||
@@ -0,0 +1,215 @@
|
||||
2000-12-01 David Turner <[email protected]>
|
||||
|
||||
* builds/unix/configure.in, builds/unix/configure,
|
||||
builds/cygwin/configure.in, builds/cygwin/configure: setting
|
||||
"version_info" to 6:1:0 for the 2.0.1 release
|
||||
|
||||
* CHANGES: added a summary of changes between 2.0.1 and 2.0
|
||||
|
||||
* builds/unix/ftconfig.in, builds/cygwin/ftconfig.in: changes
|
||||
to allow compilation under Unix with the Unix-specific config
|
||||
files..
|
||||
|
||||
2000-12-01 Werner Lemberg <[email protected]>
|
||||
|
||||
* INSTALL: Revised.
|
||||
* builds/compiler/bcc-dev.mk, builds/compiler/visualage.mk,
|
||||
builds/compiler/bcc.mk, builds/win32/w32-bcc.mk,
|
||||
builds/win32/w32-bccd.mk: Revised.
|
||||
* include/freetype/config/ftbuild.h,
|
||||
include/freetype/internal/internal.h: Revised.
|
||||
* include/freetype/ftimage.h: Updated to new header inclusion scheme.
|
||||
|
||||
2000-11-30 Werner Lemberg <[email protected]>
|
||||
|
||||
* builds/toplevel.mk (.PHONY): Adding `distclean'.
|
||||
* builds/unix/detect.mk (.PHONY): Adding `devel', `unix', `lcc',
|
||||
`setup'.
|
||||
|
||||
2000-11-30 David Turner <[email protected]>
|
||||
|
||||
* INSTALL: Slightly updated the quick starter documentation to
|
||||
include IDE compilation, prevent against BSD Make, and specify "make
|
||||
setup" instead of a single "make" for build configuration.
|
||||
|
||||
* include/config/ftbuild.h, include/internal/internal.h: Added new
|
||||
configuration files used to determine the location of all public,
|
||||
configuration, and internal header files for FreeType 2. Modified
|
||||
all headers under "include/freetype" to reflect this change. Note
|
||||
that we still need to change the library source files themselves
|
||||
though.
|
||||
|
||||
* builds/compiler/bcc.mk, builds/compiler/bcc-dev.mk,
|
||||
builds/win32/w32-bcc.mk, builds/win32/w32-bccd.mk,
|
||||
builds/win32/detect.mk: Added new files to support compilation with
|
||||
the free Borland C++ command-line compiler. Modified the detection
|
||||
rules to recognize the new "bcc32" target in "make setup bcc32".
|
||||
|
||||
* src/sfnt/ttcmap.c, src/sfnt/ttpost.c, src/sfnt/ttsbit.c,
|
||||
src/truetype/ttobjs.c, src/truetype/ttgload.c,
|
||||
src/truetype/ttinterp.c: Fixed a few comparisons that Borland C++
|
||||
didn't really like. Basically, this compiler complains when FT_UInt
|
||||
is compared to FT_UShort (apparently, it promotes `UShort' to `Int'
|
||||
in these cases).
|
||||
|
||||
2000-11-30 Tom Kacvinsky <[email protected]>
|
||||
|
||||
* t2objs.c (T2_Init_Face): Added calculation of `face->height' for
|
||||
pure CFF fonts.
|
||||
|
||||
* t1objs.c (T1_Init_Face): Fixed computation of `face->height'.
|
||||
|
||||
2000-11-29 David Turner <[email protected]>
|
||||
|
||||
* src/base/ftbbox.c (BBox_Conic_Check): Fixed a really stupid
|
||||
bug in the formula used to compute the conic Bézier extrema
|
||||
of non-monotonous arcs.
|
||||
|
||||
2000-11-29 Werner Lemberg <[email protected]>
|
||||
|
||||
* src/base/ftcalc.c (FT_SqrtFixed), src/base/ftobjs.c
|
||||
(FT_Set_Renderer): Use FT_EXPORT_DEF.
|
||||
* src/cache/ftcimage.c (FTC_Image_Cache_Lookup),
|
||||
src/cache/ftcmanag.c (FTC_Manager_Done, FTC_Manager_Reset,
|
||||
FTC_Manager_Lookup_Face, FTC_Manager_Lookup_Size,
|
||||
FTC_Manager_Register_Cache), src/cache/ftcsbits.c
|
||||
(FTC_SBit_Cache_Lookup): Ditto.
|
||||
|
||||
* src/include/freetype/cache/ftcglyph.h (FTC_GlyphNode_Init),
|
||||
src/include/freetype/ftmac.h (FT_New_Face_From_FOND): Use FT_EXPORT.
|
||||
|
||||
2000-11-29 Werner Lemberg <[email protected]>
|
||||
|
||||
* src/sfnt/sfdriver.c: Include ttsbit.h and ttpost.h only
|
||||
conditionally.
|
||||
|
||||
* src/truetype/ttdriver.c (Set_Char_Sizes, Set_Pixel_Sizes): Set
|
||||
`size->strike_index' only conditionally.
|
||||
|
||||
* src/type1/t1driver.c, src/type1/t1objs.c: Include t1afm.h only
|
||||
conditionally.
|
||||
|
||||
* src/winfonts/winfnt.h: Move all type definitions to...
|
||||
* src/include/freetype/internal/fnttypes.h: New file.
|
||||
* src/winfonts/winfnt.c: Use it.
|
||||
|
||||
2000-11-29 ??? ??? <[email protected]>
|
||||
|
||||
* include/freetype/internal/ftdebug.h: Replaced FT_CAT and FT_XCAT
|
||||
with a direct solution (which also satifies picky compilers).
|
||||
|
||||
2000-11-28 YAMANO-UCHI Hidetoshi <[email protected]>
|
||||
|
||||
* src/truetype/ttobjs.c (TT_Init_Size): Fix #ifdef's to work with
|
||||
disabled interpreter also.
|
||||
|
||||
* src/base/ftnames.c (FT_Get_Sfnt_Name_Count): Fix incorrect
|
||||
parentheses.
|
||||
|
||||
2000-11-26 Tom Kacvinsky <[email protected]>
|
||||
|
||||
* src/cff/t2gload.c (T2_Parse_CharStrings): Added logic to glyph
|
||||
width setting code to take into account even/odd argument counts
|
||||
and glyph width operand before endchar/hmoveto/vmoveto.
|
||||
|
||||
2000-11-26 Werner Lemberg <[email protected]>
|
||||
|
||||
* builds/ansi/ansi.mk: Fix inclusion order of files.
|
||||
|
||||
2000-11-26 Keith Packard <[email protected]>
|
||||
|
||||
* src/type1/t1objs.c (T1_Init_Face): Compute style flags.
|
||||
|
||||
2000-11-26 Werner Lemberg <[email protected]>
|
||||
|
||||
* builds/compiler/ansi-cc.mk (CLEAN_LIBRARY): Fix rule and
|
||||
conditional.
|
||||
|
||||
2000-11-23 Werner Lemberg <[email protected]>
|
||||
|
||||
* src/type1/t1load.c (parse_subrs, parse_charstrings): Use decrypt
|
||||
function from PSAux module.
|
||||
|
||||
* src/type1/t1parse.c (T1_Done_Parse): Renamed to...
|
||||
(T1_Finalize_Parser): New function (to avoid name clash with a
|
||||
function in the PSAux module).
|
||||
(T1_Decrypt): Removed since it is duplicated in the PSAux module.
|
||||
(T1_Get_Private_Dict): Added `psaux' as new parameter; use decrypt
|
||||
function from PSAux module.
|
||||
|
||||
* src/type1/t1parse.h: Adapted.
|
||||
|
||||
2000-11-22 Tom Kacvinsky <[email protected]>
|
||||
|
||||
* src/cff/t2objs.c (T2_Init_Face): For pure CFF fonts, set
|
||||
`root->num_faces' to `cff->num_faces' and set `units_per_EM'
|
||||
to 1000.
|
||||
|
||||
* src/cff/t2parse.c (parse_t2_real): Fixed real number parsing
|
||||
loop.
|
||||
|
||||
* src/cff/t2load.c (T2_Get_String): Called T2_Get_Name with a
|
||||
sid that was off by one.
|
||||
|
||||
2000-11-16 David Turner <[email protected]>
|
||||
|
||||
* src/autohint/ahtypes.h (AH_Hinter): Added new fields to control
|
||||
auto-hinting of synthetic Type 1 fonts.
|
||||
|
||||
* src/autohint/ahhint.c (ah_hinter_load, ah_hinter_load_glyph):
|
||||
Added auto-hinting support of synthetic Type 1 fonts.
|
||||
|
||||
2000-11-12 Tom Kacvinsky <[email protected]>
|
||||
|
||||
* src/sfnt/ttload.c (TT_LookUp_Table, TT_Load_Generic_Table): Change
|
||||
tracing output.
|
||||
|
||||
* src/sfnt/sfobjs.c (SFNT_Load_Face): Set boolean variable
|
||||
`has-outline' to true only if the font has a `glyf' or `CFF ' table.
|
||||
|
||||
2000-11-11 Werner Lemberg <[email protected]>
|
||||
|
||||
* builds/win32/visualc/freetype.dsp: Fix raster1->raster and
|
||||
type1z->type1.
|
||||
|
||||
2000-11-11 Tom Kacvinsky <[email protected]>
|
||||
|
||||
* builds/unix/freetype-config.in, builds/cygwin/freetype-config.in:
|
||||
Added a --libtool option. When freetype-config --libtool is
|
||||
invoked, the absolute path to the libtool convenience library
|
||||
is returned.
|
||||
|
||||
2000-11-11 Werner Lemberg <[email protected]>
|
||||
|
||||
* builds/cygwin/cygwin-def.in: Same fix as previous.
|
||||
|
||||
2000-11-10 Tom Kacvinsky <[email protected]>
|
||||
|
||||
* builds/unix/unix-def.in: Add
|
||||
|
||||
INSTALL_PROGRAM := @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT := @INSTALL_SCRIPT@
|
||||
|
||||
so that installation of freetype-config does not fail.
|
||||
|
||||
2000-11-10 Werner Lemberg <[email protected]>
|
||||
|
||||
* builds/cygwin/freetype-config.in, builds/unix/freetype-config.in:
|
||||
Move test down for empty --exec-prefix.
|
||||
Fix --version.
|
||||
|
||||
* builds/cygwin/install.mk, builds/unix/install.mk: Use
|
||||
$(INSTALL_SCRIPT) for installation of freetype-config.
|
||||
|
||||
* builds/cygwin/install.mk: Fix clean target names.
|
||||
|
||||
2000-11-09 David Turner <[email protected]>
|
||||
|
||||
* Version 2.0 released.
|
||||
=======================
|
||||
|
||||
|
||||
Local Variables:
|
||||
version-control: never
|
||||
coding: latin-1
|
||||
End:
|
||||
@@ -0,0 +1,93 @@
|
||||
In order to build the library, read the `BUILD' document in the `docs'
|
||||
directory. This is only a quick starter:
|
||||
|
||||
I. From the command line:
|
||||
|
||||
You need to have GNU Make installed on your system to compile the
|
||||
library from the command line. This will _not_ work with other
|
||||
make tools (including BSD make)!
|
||||
|
||||
- Go to the `freetype2' directory.
|
||||
|
||||
- On Unix (any C compiler should work):
|
||||
|
||||
- make setup (don't worry, this will invoke a configure script)
|
||||
- make
|
||||
- make install
|
||||
|
||||
Alternatively, you can pass parameters to the configure script
|
||||
within the CFG variable, as in:
|
||||
|
||||
- make setup CFG="--prefix=/usr"
|
||||
- make
|
||||
- make install
|
||||
|
||||
- On Windows:
|
||||
|
||||
We provide a version of GNU Make for Win32 on the FreeType site.
|
||||
See http://www.freetype.org/download.html for details.
|
||||
|
||||
If you are using gcc:
|
||||
|
||||
- make setup
|
||||
- make
|
||||
|
||||
If you are using Visual C++:
|
||||
|
||||
- make setup visualc
|
||||
- make
|
||||
|
||||
If you are using Win32-lCC:
|
||||
|
||||
- make setup lcc
|
||||
- make
|
||||
|
||||
If you are using the Borland C++ Builder compiler:
|
||||
|
||||
- make setup bcc32
|
||||
- make
|
||||
|
||||
|
||||
II. In your own environment (IDE):
|
||||
|
||||
You need to add the directories "freetype2/include" and "freetype2/src"
|
||||
to your include path when compiling the library.
|
||||
|
||||
Compile each library component through the following files:
|
||||
|
||||
-- base components (required)
|
||||
|
||||
src/base/ftsystem.c
|
||||
src/base/ftinit.c
|
||||
src/base/ftdebug.c
|
||||
src/base/ftbase.c
|
||||
src/base/ftglyph.c
|
||||
src/base/ftbbox.c
|
||||
src/base/ftmm.c
|
||||
|
||||
src/base/ftmac.c -- only on the Macintosh
|
||||
|
||||
-- other components are optional
|
||||
|
||||
src/autohint/autohint.c -- auto hinting module
|
||||
src/cache/ftcache.c -- cache sub-system (in beta)
|
||||
src/sfnt/sfnt.c -- SFNT files support (TrueType & OpenType)
|
||||
src/cff/cff.c -- CFF/OpenType font driver
|
||||
src/psnames/psnames.c -- Postscript glyph names support
|
||||
src/psaux/psaux.c -- Postscript Type 1 parsing
|
||||
src/truetype/truetype.c -- TrueType font driver
|
||||
src/type1/type1.c -- Type 1 font driver
|
||||
src/cid/type1cid.c -- Type 1 CID-keyed font driver
|
||||
src/winfonts/winfonts.c -- Windows FONT / FNT font driver
|
||||
|
||||
Note:
|
||||
|
||||
`truetype.c' needs `sfnt.c' and `psnames.c'
|
||||
`type1.c' needs `psaux.c' and `psnames.c'
|
||||
`type1cid.c' needs `psaux.c' and `psnames.c'
|
||||
`cff.c' needs `sfnt.c', `psaux.c', and `psnames.c'
|
||||
|
||||
etc.
|
||||
|
||||
|
||||
--- end of INSTALL --
|
||||
@@ -0,0 +1,7 @@
|
||||
|
||||
FreeType comes with two licenses from which you can choose the one which
|
||||
fits your needs best:
|
||||
|
||||
. The FreeType License, in file `docs/FTL.txt'.
|
||||
|
||||
. The GNU General Public License, in file `docs/GPL.txt'.
|
||||
@@ -0,0 +1,32 @@
|
||||
#
|
||||
# FreeType 2 build system -- top-level Makefile
|
||||
#
|
||||
|
||||
|
||||
# Copyright 1996-2000 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
|
||||
# Project names
|
||||
#
|
||||
PROJECT := freetype
|
||||
PROJECT_TITLE := FreeType
|
||||
|
||||
USE_MODULES := 1
|
||||
|
||||
# The variable TOP holds the path to the topmost directory in the project
|
||||
# engine source hierarchy. If it is not defined, default it to `.'.
|
||||
#
|
||||
ifndef TOP
|
||||
TOP := .
|
||||
endif
|
||||
|
||||
include $(TOP)/builds/toplevel.mk
|
||||
|
||||
# EOF
|
||||
@@ -0,0 +1,118 @@
|
||||
#
|
||||
# FreeType 2 configuration rules for a `normal' ANSI system
|
||||
#
|
||||
|
||||
|
||||
# Copyright 1996-2000 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
|
||||
ifndef TOP
|
||||
TOP := .
|
||||
endif
|
||||
|
||||
DELETE := rm -f
|
||||
SEP := /
|
||||
HOSTSEP := $(SEP)
|
||||
BUILD := $(TOP)/builds/ansi
|
||||
PLATFORM := ansi
|
||||
|
||||
|
||||
# The directory where all object files are placed.
|
||||
#
|
||||
# This lets you build the library in your own directory with something like
|
||||
#
|
||||
# set TOP=.../path/to/freetype2/top/dir...
|
||||
# set OBJ_DIR=.../path/to/obj/dir
|
||||
# make -f $TOP/Makefile setup [options]
|
||||
# make -f $TOP/Makefile
|
||||
#
|
||||
ifndef OBJ_DIR
|
||||
OBJ_DIR := $(TOP)$(SEP)obj
|
||||
endif
|
||||
|
||||
|
||||
# The directory where all library files are placed.
|
||||
#
|
||||
# By default, this is the same as $(OBJ_DIR); however, this can be changed
|
||||
# to suit particular needs.
|
||||
#
|
||||
LIB_DIR := $(OBJ_DIR)
|
||||
|
||||
|
||||
# The name of the final library file. Note that the DOS-specific Makefile
|
||||
# uses a shorter (8.3) name.
|
||||
#
|
||||
LIBRARY := lib$(PROJECT)
|
||||
|
||||
|
||||
# Path inclusion flag. Some compilers use a different flag than `-I' to
|
||||
# specify an additional include path. Examples are `/i=' or `-J'.
|
||||
#
|
||||
I := -I
|
||||
|
||||
|
||||
# C flag used to define a macro before the compilation of a given source
|
||||
# object. Usually it is `-D' like in `-DDEBUG'.
|
||||
#
|
||||
D := -D
|
||||
|
||||
|
||||
# The link flag used to specify a given library file on link. Note that
|
||||
# this is only used to compile the demo programs, not the library itself.
|
||||
#
|
||||
L := -l
|
||||
|
||||
|
||||
# Target flag.
|
||||
#
|
||||
T := -o$(space)
|
||||
|
||||
|
||||
# C flags
|
||||
#
|
||||
# These should concern: debug output, optimization & warnings.
|
||||
#
|
||||
# Use the ANSIFLAGS variable to define the compiler flags used to enfore
|
||||
# ANSI compliance.
|
||||
#
|
||||
ifndef CFLAGS
|
||||
CFLAGS := -c
|
||||
endif
|
||||
|
||||
# ANSIFLAGS: Put there the flags used to make your compiler ANSI-compliant.
|
||||
#
|
||||
ANSIFLAGS :=
|
||||
|
||||
|
||||
ifdef BUILD_PROJECT
|
||||
|
||||
# Now include the main sub-makefile. It contains all the rules used to
|
||||
# build the library with the previous variables defined.
|
||||
#
|
||||
include $(TOP)/builds/$(PROJECT).mk
|
||||
|
||||
# The cleanup targets.
|
||||
#
|
||||
clean_project: clean_project_std
|
||||
distclean_project: distclean_project_std
|
||||
|
||||
# This final rule is used to link all object files into a single library.
|
||||
# It is part of the system-specific sub-Makefile because not all
|
||||
# librarians accept a simple syntax like
|
||||
#
|
||||
# librarian library_file {list of object files}
|
||||
#
|
||||
$(PROJECT_LIBRARY): $(OBJECTS_LIST)
|
||||
-$(CLEAN_LIBRARY) $(NO_OUTPUT)
|
||||
$(LINK_LIBRARY)
|
||||
|
||||
endif
|
||||
|
||||
# EOF
|
||||
@@ -0,0 +1,19 @@
|
||||
#
|
||||
# FreeType 2 configuration rules for a `normal' pseudo ANSI compiler/system
|
||||
#
|
||||
|
||||
|
||||
# Copyright 1996-2000 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
|
||||
include $(TOP)/builds/compiler/ansi-cc.mk
|
||||
include $(TOP)/builds/ansi/ansi-def.mk
|
||||
|
||||
# EOF
|
||||
@@ -0,0 +1,82 @@
|
||||
#
|
||||
# FreeType 2 generic pseudo ANSI compiler
|
||||
#
|
||||
|
||||
|
||||
# Copyright 1996-2000 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
|
||||
# Compiler command line name
|
||||
#
|
||||
CC := cc
|
||||
|
||||
# The object file extension (for standard and static libraries). This can be
|
||||
# .o, .tco, .obj, etc., depending on the platform.
|
||||
#
|
||||
O := o
|
||||
SO := o
|
||||
|
||||
# The library file extension (for standard and static libraries). This can
|
||||
# be .a, .lib, etc., depending on the platform.
|
||||
#
|
||||
A := a
|
||||
SA := a
|
||||
|
||||
|
||||
# Path inclusion flag. Some compilers use a different flag than `-I' to
|
||||
# specify an additional include path. Examples are `/i=' or `-J'.
|
||||
#
|
||||
I := -I
|
||||
|
||||
|
||||
# C flag used to define a macro before the compilation of a given source
|
||||
# object. Usually it is `-D' like in `-DDEBUG'.
|
||||
#
|
||||
D := -D
|
||||
|
||||
|
||||
# The link flag used to specify a given library file on link. Note that
|
||||
# this is only used to compile the demo programs, not the library itself.
|
||||
#
|
||||
L := -l
|
||||
|
||||
|
||||
# Target flag.
|
||||
#
|
||||
T := -o$(space)
|
||||
|
||||
|
||||
# C flags
|
||||
#
|
||||
# These should concern: debug output, optimization & warnings.
|
||||
#
|
||||
# Use the ANSIFLAGS variable to define the compiler flags used to enfore
|
||||
# ANSI compliance.
|
||||
#
|
||||
ifndef CFLAGS
|
||||
CFLAGS := -c
|
||||
endif
|
||||
|
||||
# ANSIFLAGS: Put there the flags used to make your compiler ANSI-compliant.
|
||||
#
|
||||
# we assume the compiler is already strictly ANSI
|
||||
#
|
||||
ANSIFLAGS :=
|
||||
|
||||
|
||||
# Library linking
|
||||
#
|
||||
ifndef CLEAN_LIBRARY
|
||||
CLEAN_LIBRARY = $(DELETE) $(subst $(SEP),$(HOSTSEP),$(PROJECT_LIBRARY)) \
|
||||
$(NO_OUTPUT)
|
||||
endif
|
||||
LINK_LIBRARY = $(AR) -r $@ $(OBJECTS_LIST)
|
||||
|
||||
# EOF
|
||||
@@ -0,0 +1,81 @@
|
||||
#
|
||||
# FreeType 2 Borland C++-specific with NO OPTIMIZATIONS + DEBUGGING
|
||||
#
|
||||
|
||||
|
||||
# Copyright 1996-2000 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
|
||||
# Compiler command line name
|
||||
#
|
||||
CC := bcc32
|
||||
|
||||
# The object file extension (for standard and static libraries). This can be
|
||||
# .o, .tco, .obj, etc., depending on the platform.
|
||||
#
|
||||
O := obj
|
||||
SO := obj
|
||||
|
||||
# The library file extension (for standard and static libraries). This can
|
||||
# be .a, .lib, etc., depending on the platform.
|
||||
#
|
||||
A := lib
|
||||
SA := lib
|
||||
|
||||
|
||||
# Path inclusion flag. Some compilers use a different flag than `-I' to
|
||||
# specify an additional include path. Examples are `/i=' or `-J'.
|
||||
#
|
||||
I := -I
|
||||
|
||||
|
||||
# C flag used to define a macro before the compilation of a given source
|
||||
# object. Usually it is `-D' like in `-DDEBUG'.
|
||||
#
|
||||
D := -D
|
||||
|
||||
|
||||
# The link flag used to specify a given library file on link. Note that
|
||||
# this is only used to compile the demo programs, not the library itself.
|
||||
#
|
||||
L :=
|
||||
|
||||
|
||||
# Target flag -- no trailing space.
|
||||
#
|
||||
T := -o
|
||||
|
||||
|
||||
# C flags
|
||||
#
|
||||
# These should concern: debug output, optimization & warnings.
|
||||
#
|
||||
# Use the ANSIFLAGS variable to define the compiler flags used to enfore
|
||||
# ANSI compliance.
|
||||
#
|
||||
ifndef CFLAGS
|
||||
CFLAGS := -c -y -d -v -Od -w-par -w-ccc -w-rch -w-pro -w-aus
|
||||
endif
|
||||
|
||||
# ANSIFLAGS: Put there the flags used to make your compiler ANSI-compliant.
|
||||
#
|
||||
ANSIFLAGS := -A
|
||||
|
||||
|
||||
# Library linking
|
||||
#
|
||||
ifndef CLEAN_LIBRARY
|
||||
CLEAN_LIBRARY = $(DELETE) $(subst $(SEP),$(HOSTSEP),$(PROJECT_LIBRARY)) \
|
||||
$(NO_OUTPUT)
|
||||
endif
|
||||
TARGET_OBJECTS = $(subst $(SEP),\\,$(OBJECTS_LIST))
|
||||
LINK_LIBRARY = tlib /u $(subst $(SEP),\\,$@) $(TARGET_OBJECTS:%=+%)
|
||||
|
||||
# EOF
|
||||
@@ -0,0 +1,81 @@
|
||||
#
|
||||
# FreeType 2 Borland C++-specific rules
|
||||
#
|
||||
|
||||
|
||||
# Copyright 1996-2000 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
|
||||
# Compiler command line name
|
||||
#
|
||||
CC := bcc32
|
||||
|
||||
# The object file extension (for standard and static libraries). This can be
|
||||
# .o, .tco, .obj, etc., depending on the platform.
|
||||
#
|
||||
O := obj
|
||||
SO := obj
|
||||
|
||||
# The library file extension (for standard and static libraries). This can
|
||||
# be .a, .lib, etc., depending on the platform.
|
||||
#
|
||||
A := lib
|
||||
SA := lib
|
||||
|
||||
|
||||
# Path inclusion flag. Some compilers use a different flag than `-I' to
|
||||
# specify an additional include path. Examples are `/i=' or `-J'.
|
||||
#
|
||||
I := -I
|
||||
|
||||
|
||||
# C flag used to define a macro before the compilation of a given source
|
||||
# object. Usually it is `-D' like in `-DDEBUG'.
|
||||
#
|
||||
D := -D
|
||||
|
||||
|
||||
# The link flag used to specify a given library file on link. Note that
|
||||
# this is only used to compile the demo programs, not the library itself.
|
||||
#
|
||||
L :=
|
||||
|
||||
|
||||
# Target flag -- no trailing space.
|
||||
#
|
||||
T := -o
|
||||
|
||||
|
||||
# C flags
|
||||
#
|
||||
# These should concern: debug output, optimization & warnings.
|
||||
#
|
||||
# Use the ANSIFLAGS variable to define the compiler flags used to enfore
|
||||
# ANSI compliance.
|
||||
#
|
||||
ifndef CFLAGS
|
||||
CFLAGS := -c -q -y -d -v -Od -w-par -w-ccc -w-rch -w-pro -w-aus
|
||||
endif
|
||||
|
||||
# ANSIFLAGS: Put there the flags used to make your compiler ANSI-compliant.
|
||||
#
|
||||
ANSIFLAGS := -A
|
||||
|
||||
|
||||
# Library linking
|
||||
#
|
||||
ifndef CLEAN_LIBRARY
|
||||
CLEAN_LIBRARY = $(DELETE) $(subst $(SEP),$(HOSTSEP),$(PROJECT_LIBRARY)) \
|
||||
$(NO_OUTPUT)
|
||||
endif
|
||||
TARGET_OBJECTS = $(subst $(SEP),\\,$(OBJECTS_LIST))
|
||||
LINK_LIBRARY = tlib /u $(subst $(SEP),\\,$@) $(TARGET_OBJECTS:%=+%)
|
||||
|
||||
# EOF
|
||||
@@ -0,0 +1,89 @@
|
||||
#
|
||||
# FreeType 2 gcc-specific with NO OPTIMIZATIONS + DEBUGGING
|
||||
#
|
||||
|
||||
|
||||
# Copyright 1996-2000 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
|
||||
# Compiler command line name
|
||||
#
|
||||
CC := gcc
|
||||
|
||||
# The object file extension (for standard and static libraries). This can be
|
||||
# .o, .tco, .obj, etc., depending on the platform.
|
||||
#
|
||||
O := o
|
||||
SO := o
|
||||
|
||||
# The library file extension (for standard and static libraries). This can
|
||||
# be .a, .lib, etc., depending on the platform.
|
||||
#
|
||||
A := a
|
||||
SA := a
|
||||
|
||||
|
||||
# Path inclusion flag. Some compilers use a different flag than `-I' to
|
||||
# specify an additional include path. Examples are `/i=' or `-J'.
|
||||
#
|
||||
I := -I
|
||||
|
||||
|
||||
# C flag used to define a macro before the compilation of a given source
|
||||
# object. Usually it is `-D' like in `-DDEBUG'.
|
||||
#
|
||||
D := -D
|
||||
|
||||
|
||||
# The link flag used to specify a given library file on link. Note that
|
||||
# this is only used to compile the demo programs, not the library itself.
|
||||
#
|
||||
L := -l
|
||||
|
||||
|
||||
# Target flag.
|
||||
#
|
||||
T := -o$(space)
|
||||
|
||||
|
||||
# C flags
|
||||
#
|
||||
# These should concern: debug output, optimization & warnings.
|
||||
#
|
||||
# Use the ANSIFLAGS variable to define the compiler flags used to enfore
|
||||
# ANSI compliance.
|
||||
#
|
||||
ifndef CFLAGS
|
||||
CFLAGS := -c -g -O0 \
|
||||
-Wall \
|
||||
-W \
|
||||
-Wundef \
|
||||
-Wshadow \
|
||||
-Wpointer-arith \
|
||||
-Wwrite-strings \
|
||||
-Wstrict-prototypes \
|
||||
-Wredundant-decls \
|
||||
-Wnested-externs
|
||||
endif
|
||||
|
||||
# ANSIFLAGS: Put there the flags used to make your compiler ANSI-compliant.
|
||||
#
|
||||
ANSIFLAGS := -ansi -pedantic
|
||||
|
||||
|
||||
# Library linking
|
||||
#
|
||||
ifndef CLEAN_LIBRARY
|
||||
CLEAN_LIBRARY = $(DELETE) $(subst $(SEP),$(HOSTSEP),$(PROJECT_LIBRARY)) \
|
||||
$(NO_OUTPUT)
|
||||
endif
|
||||
LINK_LIBRARY = $(AR) -r $@ $(OBJECTS_LIST)
|
||||
|
||||
# EOF
|
||||
@@ -0,0 +1,80 @@
|
||||
#
|
||||
# FreeType 2 gcc-specific definitions
|
||||
#
|
||||
|
||||
|
||||
# Copyright 1996-2000 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
|
||||
# Compiler command line name
|
||||
#
|
||||
CC := gcc
|
||||
|
||||
# The object file extension (for standard and static libraries). This can be
|
||||
# .o, .tco, .obj, etc., depending on the platform.
|
||||
#
|
||||
O := o
|
||||
SO := o
|
||||
|
||||
# The library file extension (for standard and static libraries). This can
|
||||
# be .a, .lib, etc., depending on the platform.
|
||||
#
|
||||
A := a
|
||||
SA := a
|
||||
|
||||
|
||||
# Path inclusion flag. Some compilers use a different flag than `-I' to
|
||||
# specify an additional include path. Examples are `/i=' or `-J'.
|
||||
#
|
||||
I := -I
|
||||
|
||||
|
||||
# C flag used to define a macro before the compilation of a given source
|
||||
# object. Usually it is `-D' like in `-DDEBUG'.
|
||||
#
|
||||
D := -D
|
||||
|
||||
|
||||
# The link flag used to specify a given library file on link. Note that
|
||||
# this is only used to compile the demo programs, not the library itself.
|
||||
#
|
||||
L := -l
|
||||
|
||||
|
||||
# Target flag.
|
||||
#
|
||||
T := -o$(space)
|
||||
|
||||
|
||||
# C flags
|
||||
#
|
||||
# These should concern: debug output, optimization & warnings.
|
||||
#
|
||||
# Use the ANSIFLAGS variable to define the compiler flags used to enfore
|
||||
# ANSI compliance.
|
||||
#
|
||||
ifndef CFLAGS
|
||||
CFLAGS := -c -g -O6 -Wall
|
||||
endif
|
||||
|
||||
# ANSIFLAGS: Put there the flags used to make your compiler ANSI-compliant.
|
||||
#
|
||||
ANSIFLAGS := -ansi -pedantic
|
||||
|
||||
|
||||
# Library linking
|
||||
#
|
||||
ifndef CLEAN_LIBRARY
|
||||
CLEAN_LIBRARY = $(DELETE) $(subst $(SEP),$(HOSTSEP),$(PROJECT_LIBRARY)) \
|
||||
$(NO_OUTPUT)
|
||||
endif
|
||||
LINK_LIBRARY = $(AR) -r $@ $(OBJECTS_LIST)
|
||||
|
||||
# EOF
|
||||
@@ -0,0 +1,86 @@
|
||||
#
|
||||
# FreeType 2 Unix LCC specific definitions
|
||||
#
|
||||
|
||||
|
||||
# Copyright 1996-2000 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
|
||||
# Command line name
|
||||
#
|
||||
CC := lcc
|
||||
|
||||
|
||||
# The object file extension (for standard and static libraries). This can be
|
||||
# .o, .tco, .obj, etc., depending on the platform.
|
||||
#
|
||||
O := o
|
||||
SO := o
|
||||
|
||||
|
||||
# The library file extension (for standard and static libraries). This can
|
||||
# be .a, .lib, etc., depending on the platform.
|
||||
#
|
||||
A := a
|
||||
SA := a
|
||||
|
||||
|
||||
# Path inclusion flag. Some compilers use a different flag than `-I' to
|
||||
# specify an additional include path. Examples are `/i=' or `-J'.
|
||||
#
|
||||
I := -I
|
||||
|
||||
|
||||
# C flag used to define a macro before the compilation of a given source
|
||||
# object. Usually it is `-D' like in `-DDEBUG'.
|
||||
#
|
||||
D := -D
|
||||
|
||||
|
||||
# The link flag used to specify a given library file on link. Note that
|
||||
# this is only used to compile the demo programs, not the library itself.
|
||||
#
|
||||
L := -l
|
||||
|
||||
|
||||
# Target flag.
|
||||
#
|
||||
T := -o$(space)
|
||||
|
||||
|
||||
# C flags
|
||||
#
|
||||
# These should concern: debug output, optimization & warnings.
|
||||
#
|
||||
# Use the ANSIFLAGS variable to define the compiler flags used to enfore
|
||||
# ANSI compliance.
|
||||
#
|
||||
ifndef CFLAGS
|
||||
CFLAGS := -c -g
|
||||
endif
|
||||
|
||||
# ANSIFLAGS: Put there the flags used to make your compiler ANSI-compliant.
|
||||
#
|
||||
# LCC is pure ANSI anyway!
|
||||
#
|
||||
# the "-A" flag simply increments verbosity about non ANSI code
|
||||
#
|
||||
ANSIFLAGS := -A
|
||||
|
||||
|
||||
# library linking
|
||||
#
|
||||
ifndef CLEAN_LIBRARY
|
||||
CLEAN_LIBRARY = $(DELETE) $(subst $(SEP),$(HOSTSEP),$(PROJECT_LIBRARY)) \
|
||||
$(NO_OUTPUT)
|
||||
endif
|
||||
LINK_LIBRARY = $(AR) -r $@ $(OBJECTS_LIST)
|
||||
|
||||
# EOF
|
||||
@@ -0,0 +1,76 @@
|
||||
#
|
||||
# FreeType 2 Visual Age C++ specific definitions
|
||||
#
|
||||
|
||||
|
||||
# Copyright 1996-2000 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
|
||||
# command line compiler name
|
||||
#
|
||||
CC := icc
|
||||
|
||||
|
||||
# The object file extension (for standard and static libraries). This can be
|
||||
# .o, .tco, .obj, etc., depending on the platform.
|
||||
#
|
||||
O := obj
|
||||
SO := obj
|
||||
|
||||
|
||||
# The library file extension (for standard and static libraries). This can
|
||||
# be .a, .lib, etc., depending on the platform.
|
||||
#
|
||||
A := lib
|
||||
SA := lib
|
||||
|
||||
|
||||
# Path inclusion flag. Some compilers use a different flag than `-I' to
|
||||
# specify an additional include path. Examples are `/i=' or `-J'.
|
||||
#
|
||||
I := /I
|
||||
|
||||
|
||||
# C flag used to define a macro before the compilation of a given source
|
||||
# object. Usually it is `-D' like in `-DDEBUG'.
|
||||
#
|
||||
D := /D
|
||||
|
||||
|
||||
# The link flag used to specify a given library file on link. Note that
|
||||
# this is only used to compile the demo programs, not the library itself.
|
||||
#
|
||||
L := /Fl
|
||||
|
||||
|
||||
# Target flag.
|
||||
#
|
||||
T := /Fo
|
||||
|
||||
|
||||
# C flags
|
||||
#
|
||||
# These should concern: debug output, optimization & warnings.
|
||||
#
|
||||
ifndef CFLAGS
|
||||
CFLAGS := /Q- /Gd+ /O2 /G5 /W3 /C
|
||||
endif
|
||||
|
||||
# ANSIFLAGS: Put there the flags used to make your compiler ANSI-compliant.
|
||||
#
|
||||
ANSI_FLAGS := /Sa
|
||||
|
||||
|
||||
# Library linking
|
||||
#
|
||||
#CLEAN_LIBRARY :=
|
||||
LINK_LIBRARY = lib /nologo /out:$@ $(OBJECTS_LIST)
|
||||
|
||||
# EOF
|
||||
@@ -0,0 +1,78 @@
|
||||
#
|
||||
# FreeType 2 Visual C++ definitions
|
||||
#
|
||||
|
||||
|
||||
# Copyright 1996-2000 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
|
||||
# compiler command line name
|
||||
#
|
||||
CC := cl
|
||||
|
||||
|
||||
# The object file extension (for standard and static libraries). This can be
|
||||
# .o, .tco, .obj, etc., depending on the platform.
|
||||
#
|
||||
O := obj
|
||||
SO := obj
|
||||
|
||||
|
||||
# The library file extension (for standard and static libraries). This can
|
||||
# be .a, .lib, etc., depending on the platform.
|
||||
#
|
||||
A := lib
|
||||
SA := lib
|
||||
|
||||
|
||||
# Path inclusion flag. Some compilers use a different flag than `-I' to
|
||||
# specify an additional include path. Examples are `/i=' or `-J'.
|
||||
#
|
||||
I := /I
|
||||
|
||||
|
||||
# C flag used to define a macro before the compilation of a given source
|
||||
# object. Usually it is `-D' like in `-DDEBUG'.
|
||||
#
|
||||
D := /D
|
||||
|
||||
|
||||
# The link flag used to specify a given library file on link. Note that
|
||||
# this is only used to compile the demo programs, not the library itself.
|
||||
#
|
||||
L := /Fl
|
||||
|
||||
|
||||
# Target flag.
|
||||
#
|
||||
T := /Fo
|
||||
|
||||
|
||||
# C flags
|
||||
#
|
||||
# These should concern: debug output, optimization & warnings.
|
||||
#
|
||||
# Use the ANSIFLAGS variable to define the compiler flags used to enfore
|
||||
# ANSI compliance.
|
||||
#
|
||||
ifndef CFLAGS
|
||||
CFLAGS := /nologo /c /Ox /G5 /W3 /WX
|
||||
endif
|
||||
|
||||
# ANSIFLAGS: Put there the flags used to make your compiler ANSI-compliant.
|
||||
#
|
||||
ANSIFLAGS := /Za
|
||||
|
||||
# Library linking
|
||||
#
|
||||
#CLEAN_LIBRARY =
|
||||
LINK_LIBRARY = lib /nologo /out:$@ $(OBJECTS_LIST)
|
||||
|
||||
# EOF
|
||||
@@ -0,0 +1,81 @@
|
||||
#
|
||||
# FreeType 2 Win32-LCC specific definitions
|
||||
#
|
||||
|
||||
|
||||
# Copyright 1996-2000 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
|
||||
# Command line name
|
||||
#
|
||||
CC := lcc
|
||||
|
||||
|
||||
# The object file extension (for standard and static libraries). This can be
|
||||
# .o, .tco, .obj, etc., depending on the platform.
|
||||
#
|
||||
O := obj
|
||||
SO := obj
|
||||
|
||||
|
||||
# The library file extension (for standard and static libraries). This can
|
||||
# be .a, .lib, etc., depending on the platform.
|
||||
#
|
||||
A := lib
|
||||
SA := lib
|
||||
|
||||
|
||||
# Path inclusion flag. Some compilers use a different flag than `-I' to
|
||||
# specify an additional include path. Examples are `/i=' or `-J'.
|
||||
#
|
||||
I := -I
|
||||
|
||||
|
||||
# C flag used to define a macro before the compilation of a given source
|
||||
# object. Usually it is `-D' like in `-DDEBUG'.
|
||||
#
|
||||
D := -D
|
||||
|
||||
|
||||
# The link flag used to specify a given library file on link. Note that
|
||||
# this is only used to compile the demo programs, not the library itself.
|
||||
#
|
||||
L := -Fl
|
||||
|
||||
|
||||
# Target flag.
|
||||
#
|
||||
T := -Fo
|
||||
|
||||
|
||||
# C flags
|
||||
#
|
||||
# These should concern: debug output, optimization & warnings.
|
||||
#
|
||||
# Use the ANSIFLAGS variable to define the compiler flags used to enfore
|
||||
# ANSI compliance.
|
||||
#
|
||||
ifndef CFLAGS
|
||||
CFLAGS := -c -g2 -O
|
||||
endif
|
||||
|
||||
# ANSIFLAGS: Put there the flags used to make your compiler ANSI-compliant.
|
||||
#
|
||||
# LCC is pure ANSI anyway!
|
||||
#
|
||||
ANSIFLAGS :=
|
||||
|
||||
|
||||
# library linking
|
||||
#
|
||||
#CLEAN_LIBRARY :=
|
||||
LINK_LIBRARY = lcclib /out:$(subst $(SEP),\\,$@) $(subst $(SEP),\\,$(OBJECTS_LIST))
|
||||
|
||||
# EOF
|
||||
@@ -0,0 +1,458 @@
|
||||
## FreeType specific autoconf tests
|
||||
|
||||
AC_DEFUN(FT_MUNMAP_DECL,
|
||||
[AC_MSG_CHECKING([whether munmap must be declared])
|
||||
AC_CACHE_VAL(ft_cv_munmap_decl,
|
||||
[AC_TRY_COMPILE([
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include <sys/mman.h>],
|
||||
[char *(*pfn) = (char *(*))munmap],
|
||||
ft_cv_munmap_decl=no,
|
||||
ft_cv_munmap_decl=yes)])
|
||||
AC_MSG_RESULT($ft_cv_munmap_decl)
|
||||
if test $ft_cv_munmap_decl = yes; then
|
||||
AC_DEFINE(NEED_MUNMAP_DECL)
|
||||
fi])
|
||||
|
||||
AC_DEFUN(FT_MUNMAP_PARAM,
|
||||
[AC_MSG_CHECKING([for munmap's first parameter type])
|
||||
AC_TRY_COMPILE([
|
||||
#include <unistd.h>
|
||||
#include <sys/mman.h>
|
||||
int munmap(void *, size_t);],,
|
||||
AC_MSG_RESULT([void *]);AC_DEFINE(MUNMAP_USES_VOIDP),
|
||||
AC_MSG_RESULT([char *]))
|
||||
])
|
||||
|
||||
## libtool.m4 - Configure libtool for the target system. -*-Shell-script-*-
|
||||
## Copyright (C) 1996-1999 Free Software Foundation, Inc.
|
||||
## Originally by Gordon Matzigkeit <[email protected]>, 1996
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published by
|
||||
## the Free Software Foundation; either version 2 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but
|
||||
## WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
## General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program; if not, write to the Free Software
|
||||
## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
##
|
||||
## As a special exception to the GNU General Public License, if you
|
||||
## distribute this file as part of a program that contains a
|
||||
## configuration script generated by Autoconf, you may include it under
|
||||
## the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# serial 40 AC_PROG_LIBTOOL
|
||||
AC_DEFUN(AC_PROG_LIBTOOL,
|
||||
[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
|
||||
|
||||
# Save cache, so that ltconfig can load it
|
||||
AC_CACHE_SAVE
|
||||
|
||||
# Actually configure libtool. ac_aux_dir is where install-sh is found.
|
||||
CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
|
||||
LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
|
||||
LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \
|
||||
DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \
|
||||
${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
|
||||
$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $lt_target \
|
||||
|| AC_MSG_ERROR([libtool configure failed])
|
||||
|
||||
# Reload cache, that may have been modified by ltconfig
|
||||
AC_CACHE_LOAD
|
||||
|
||||
# This can be used to rebuild libtool when needed
|
||||
LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh"
|
||||
|
||||
# Always use our own libtool.
|
||||
LIBTOOL='$(SHELL) $(top_builddir)/libtool'
|
||||
AC_SUBST(LIBTOOL)dnl
|
||||
|
||||
# Redirect the config.log output again, so that the ltconfig log is not
|
||||
# clobbered by the next message.
|
||||
exec 5>>./config.log
|
||||
])
|
||||
|
||||
AC_DEFUN(AC_LIBTOOL_SETUP,
|
||||
[AC_PREREQ(2.13)dnl
|
||||
AC_REQUIRE([AC_ENABLE_SHARED])dnl
|
||||
AC_REQUIRE([AC_ENABLE_STATIC])dnl
|
||||
AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
|
||||
AC_REQUIRE([AC_CANONICAL_HOST])dnl
|
||||
AC_REQUIRE([AC_CANONICAL_BUILD])dnl
|
||||
AC_REQUIRE([AC_PROG_RANLIB])dnl
|
||||
AC_REQUIRE([AC_PROG_CC])dnl
|
||||
AC_REQUIRE([AC_PROG_LD])dnl
|
||||
AC_REQUIRE([AC_PROG_NM])dnl
|
||||
AC_REQUIRE([AC_PROG_LN_S])dnl
|
||||
dnl
|
||||
|
||||
case "$target" in
|
||||
NONE) lt_target="$host" ;;
|
||||
*) lt_target="$target" ;;
|
||||
esac
|
||||
|
||||
# Check for any special flags to pass to ltconfig.
|
||||
libtool_flags="--cache-file=$cache_file"
|
||||
test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
|
||||
test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
|
||||
test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install"
|
||||
test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
|
||||
test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
|
||||
ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN],
|
||||
[libtool_flags="$libtool_flags --enable-dlopen"])
|
||||
ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
|
||||
[libtool_flags="$libtool_flags --enable-win32-dll"])
|
||||
AC_ARG_ENABLE(libtool-lock,
|
||||
[ --disable-libtool-lock avoid locking (might break parallel builds)])
|
||||
test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock"
|
||||
test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
|
||||
|
||||
# Some flags need to be propagated to the compiler or linker for good
|
||||
# libtool support.
|
||||
case "$lt_target" in
|
||||
*-*-irix6*)
|
||||
# Find out which ABI we are using.
|
||||
echo '[#]line __oline__ "configure"' > conftest.$ac_ext
|
||||
if AC_TRY_EVAL(ac_compile); then
|
||||
case "`/usr/bin/file conftest.o`" in
|
||||
*32-bit*)
|
||||
LD="${LD-ld} -32"
|
||||
;;
|
||||
*N32*)
|
||||
LD="${LD-ld} -n32"
|
||||
;;
|
||||
*64-bit*)
|
||||
LD="${LD-ld} -64"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
rm -rf conftest*
|
||||
;;
|
||||
|
||||
*-*-sco3.2v5*)
|
||||
# On SCO OpenServer 5, we need -belf to get full-featured binaries.
|
||||
SAVE_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS -belf"
|
||||
AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
|
||||
[AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])])
|
||||
if test x"$lt_cv_cc_needs_belf" != x"yes"; then
|
||||
# this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
|
||||
CFLAGS="$SAVE_CFLAGS"
|
||||
fi
|
||||
;;
|
||||
|
||||
ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
|
||||
[*-*-cygwin* | *-*-mingw*)
|
||||
AC_CHECK_TOOL(DLLTOOL, dlltool, false)
|
||||
AC_CHECK_TOOL(AS, as, false)
|
||||
AC_CHECK_TOOL(OBJDUMP, objdump, false)
|
||||
;;
|
||||
])
|
||||
esac
|
||||
])
|
||||
|
||||
# AC_LIBTOOL_DLOPEN - enable checks for dlopen support
|
||||
AC_DEFUN(AC_LIBTOOL_DLOPEN, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])])
|
||||
|
||||
# AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's
|
||||
AC_DEFUN(AC_LIBTOOL_WIN32_DLL, [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])])
|
||||
|
||||
# AC_ENABLE_SHARED - implement the --enable-shared flag
|
||||
# Usage: AC_ENABLE_SHARED[(DEFAULT)]
|
||||
# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
|
||||
# `yes'.
|
||||
AC_DEFUN(AC_ENABLE_SHARED, [dnl
|
||||
define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
|
||||
AC_ARG_ENABLE(shared,
|
||||
changequote(<<, >>)dnl
|
||||
<< --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
|
||||
changequote([, ])dnl
|
||||
[p=${PACKAGE-default}
|
||||
case "$enableval" in
|
||||
yes) enable_shared=yes ;;
|
||||
no) enable_shared=no ;;
|
||||
*)
|
||||
enable_shared=no
|
||||
# Look at the argument we got. We use all the common list separators.
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
|
||||
for pkg in $enableval; do
|
||||
if test "X$pkg" = "X$p"; then
|
||||
enable_shared=yes
|
||||
fi
|
||||
done
|
||||
IFS="$ac_save_ifs"
|
||||
;;
|
||||
esac],
|
||||
enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
|
||||
])
|
||||
|
||||
# AC_DISABLE_SHARED - set the default shared flag to --disable-shared
|
||||
AC_DEFUN(AC_DISABLE_SHARED, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
|
||||
AC_ENABLE_SHARED(no)])
|
||||
|
||||
# AC_ENABLE_STATIC - implement the --enable-static flag
|
||||
# Usage: AC_ENABLE_STATIC[(DEFAULT)]
|
||||
# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
|
||||
# `yes'.
|
||||
AC_DEFUN(AC_ENABLE_STATIC, [dnl
|
||||
define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
|
||||
AC_ARG_ENABLE(static,
|
||||
changequote(<<, >>)dnl
|
||||
<< --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
|
||||
changequote([, ])dnl
|
||||
[p=${PACKAGE-default}
|
||||
case "$enableval" in
|
||||
yes) enable_static=yes ;;
|
||||
no) enable_static=no ;;
|
||||
*)
|
||||
enable_static=no
|
||||
# Look at the argument we got. We use all the common list separators.
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
|
||||
for pkg in $enableval; do
|
||||
if test "X$pkg" = "X$p"; then
|
||||
enable_static=yes
|
||||
fi
|
||||
done
|
||||
IFS="$ac_save_ifs"
|
||||
;;
|
||||
esac],
|
||||
enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
|
||||
])
|
||||
|
||||
# AC_DISABLE_STATIC - set the default static flag to --disable-static
|
||||
AC_DEFUN(AC_DISABLE_STATIC, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
|
||||
AC_ENABLE_STATIC(no)])
|
||||
|
||||
|
||||
# AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag
|
||||
# Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)]
|
||||
# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
|
||||
# `yes'.
|
||||
AC_DEFUN(AC_ENABLE_FAST_INSTALL, [dnl
|
||||
define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
|
||||
AC_ARG_ENABLE(fast-install,
|
||||
changequote(<<, >>)dnl
|
||||
<< --enable-fast-install[=PKGS] optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT],
|
||||
changequote([, ])dnl
|
||||
[p=${PACKAGE-default}
|
||||
case "$enableval" in
|
||||
yes) enable_fast_install=yes ;;
|
||||
no) enable_fast_install=no ;;
|
||||
*)
|
||||
enable_fast_install=no
|
||||
# Look at the argument we got. We use all the common list separators.
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
|
||||
for pkg in $enableval; do
|
||||
if test "X$pkg" = "X$p"; then
|
||||
enable_fast_install=yes
|
||||
fi
|
||||
done
|
||||
IFS="$ac_save_ifs"
|
||||
;;
|
||||
esac],
|
||||
enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl
|
||||
])
|
||||
|
||||
# AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install
|
||||
AC_DEFUN(AC_DISABLE_FAST_INSTALL, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
|
||||
AC_ENABLE_FAST_INSTALL(no)])
|
||||
|
||||
# AC_PROG_LD - find the path to the GNU or non-GNU linker
|
||||
AC_DEFUN(AC_PROG_LD,
|
||||
[AC_ARG_WITH(gnu-ld,
|
||||
[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
|
||||
test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
|
||||
AC_REQUIRE([AC_PROG_CC])dnl
|
||||
AC_REQUIRE([AC_CANONICAL_HOST])dnl
|
||||
AC_REQUIRE([AC_CANONICAL_BUILD])dnl
|
||||
ac_prog=ld
|
||||
if test "$ac_cv_prog_gcc" = yes; then
|
||||
# Check if gcc -print-prog-name=ld gives a path.
|
||||
AC_MSG_CHECKING([for ld used by GCC])
|
||||
ac_prog=`($CC -print-prog-name=ld) 2>&5`
|
||||
case "$ac_prog" in
|
||||
# Accept absolute paths.
|
||||
changequote(,)dnl
|
||||
[\\/]* | [A-Za-z]:[\\/]*)
|
||||
re_direlt='/[^/][^/]*/\.\./'
|
||||
changequote([,])dnl
|
||||
# Canonicalize the path of ld
|
||||
ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
|
||||
while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
|
||||
ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
|
||||
done
|
||||
test -z "$LD" && LD="$ac_prog"
|
||||
;;
|
||||
"")
|
||||
# If it fails, then pretend we aren't using GCC.
|
||||
ac_prog=ld
|
||||
;;
|
||||
*)
|
||||
# If it is relative, then search for the first ld in PATH.
|
||||
with_gnu_ld=unknown
|
||||
;;
|
||||
esac
|
||||
elif test "$with_gnu_ld" = yes; then
|
||||
AC_MSG_CHECKING([for GNU ld])
|
||||
else
|
||||
AC_MSG_CHECKING([for non-GNU ld])
|
||||
fi
|
||||
AC_CACHE_VAL(ac_cv_path_LD,
|
||||
[if test -z "$LD"; then
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
|
||||
for ac_dir in $PATH; do
|
||||
test -z "$ac_dir" && ac_dir=.
|
||||
if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
|
||||
ac_cv_path_LD="$ac_dir/$ac_prog"
|
||||
# Check to see if the program is GNU ld. I'd rather use --version,
|
||||
# but apparently some GNU ld's only accept -v.
|
||||
# Break only if it was the GNU/non-GNU ld that we prefer.
|
||||
if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
|
||||
test "$with_gnu_ld" != no && break
|
||||
else
|
||||
test "$with_gnu_ld" != yes && break
|
||||
fi
|
||||
fi
|
||||
done
|
||||
IFS="$ac_save_ifs"
|
||||
else
|
||||
ac_cv_path_LD="$LD" # Let the user override the test with a path.
|
||||
fi])
|
||||
LD="$ac_cv_path_LD"
|
||||
if test -n "$LD"; then
|
||||
AC_MSG_RESULT($LD)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
|
||||
AC_PROG_LD_GNU
|
||||
])
|
||||
|
||||
AC_DEFUN(AC_PROG_LD_GNU,
|
||||
[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
|
||||
[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
|
||||
if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
|
||||
ac_cv_prog_gnu_ld=yes
|
||||
else
|
||||
ac_cv_prog_gnu_ld=no
|
||||
fi])
|
||||
])
|
||||
|
||||
# AC_PROG_NM - find the path to a BSD-compatible name lister
|
||||
AC_DEFUN(AC_PROG_NM,
|
||||
[AC_MSG_CHECKING([for BSD-compatible nm])
|
||||
AC_CACHE_VAL(ac_cv_path_NM,
|
||||
[if test -n "$NM"; then
|
||||
# Let the user override the test.
|
||||
ac_cv_path_NM="$NM"
|
||||
else
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
|
||||
for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
|
||||
test -z "$ac_dir" && ac_dir=.
|
||||
if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext ; then
|
||||
# Check to see if the nm accepts a BSD-compat flag.
|
||||
# Adding the `sed 1q' prevents false positives on HP-UX, which says:
|
||||
# nm: unknown option "B" ignored
|
||||
if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
|
||||
ac_cv_path_NM="$ac_dir/nm -B"
|
||||
break
|
||||
elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
|
||||
ac_cv_path_NM="$ac_dir/nm -p"
|
||||
break
|
||||
else
|
||||
ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but
|
||||
continue # so that we can try to find one that supports BSD flags
|
||||
fi
|
||||
fi
|
||||
done
|
||||
IFS="$ac_save_ifs"
|
||||
test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
|
||||
fi])
|
||||
NM="$ac_cv_path_NM"
|
||||
AC_MSG_RESULT([$NM])
|
||||
])
|
||||
|
||||
# AC_CHECK_LIBM - check for math library
|
||||
AC_DEFUN(AC_CHECK_LIBM,
|
||||
[AC_REQUIRE([AC_CANONICAL_HOST])dnl
|
||||
LIBM=
|
||||
case "$lt_target" in
|
||||
*-*-beos* | *-*-cygwin*)
|
||||
# These system don't have libm
|
||||
;;
|
||||
*-ncr-sysv4.3*)
|
||||
AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
|
||||
AC_CHECK_LIB(m, main, LIBM="$LIBM -lm")
|
||||
;;
|
||||
*)
|
||||
AC_CHECK_LIB(m, main, LIBM="-lm")
|
||||
;;
|
||||
esac
|
||||
])
|
||||
|
||||
# AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for
|
||||
# the libltdl convenience library, adds --enable-ltdl-convenience to
|
||||
# the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor
|
||||
# is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed
|
||||
# to be `${top_builddir}/libltdl'. Make sure you start DIR with
|
||||
# '${top_builddir}/' (note the single quotes!) if your package is not
|
||||
# flat, and, if you're not using automake, define top_builddir as
|
||||
# appropriate in the Makefiles.
|
||||
AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
|
||||
case "$enable_ltdl_convenience" in
|
||||
no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
|
||||
"") enable_ltdl_convenience=yes
|
||||
ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
|
||||
esac
|
||||
LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdlc.la
|
||||
INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl'])
|
||||
])
|
||||
|
||||
# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for
|
||||
# the libltdl installable library, and adds --enable-ltdl-install to
|
||||
# the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor
|
||||
# is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed
|
||||
# to be `${top_builddir}/libltdl'. Make sure you start DIR with
|
||||
# '${top_builddir}/' (note the single quotes!) if your package is not
|
||||
# flat, and, if you're not using automake, define top_builddir as
|
||||
# appropriate in the Makefiles.
|
||||
# In the future, this macro may have to be called after AC_PROG_LIBTOOL.
|
||||
AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
|
||||
AC_CHECK_LIB(ltdl, main,
|
||||
[test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
|
||||
[if test x"$enable_ltdl_install" = xno; then
|
||||
AC_MSG_WARN([libltdl not installed, but installation disabled])
|
||||
else
|
||||
enable_ltdl_install=yes
|
||||
fi
|
||||
])
|
||||
if test x"$enable_ltdl_install" = x"yes"; then
|
||||
ac_configure_args="$ac_configure_args --enable-ltdl-install"
|
||||
LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdl.la
|
||||
INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl'])
|
||||
else
|
||||
ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
|
||||
LIBLTDL="-lltdl"
|
||||
INCLTDL=
|
||||
fi
|
||||
])
|
||||
|
||||
dnl old names
|
||||
AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl
|
||||
AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl
|
||||
AC_DEFUN(AM_ENABLE_STATIC, [indir([AC_ENABLE_STATIC], $@)])dnl
|
||||
AC_DEFUN(AM_DISABLE_SHARED, [indir([AC_DISABLE_SHARED], $@)])dnl
|
||||
AC_DEFUN(AM_DISABLE_STATIC, [indir([AC_DISABLE_STATIC], $@)])dnl
|
||||
AC_DEFUN(AM_PROG_LD, [indir([AC_PROG_LD])])dnl
|
||||
AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl
|
||||
|
||||
dnl This is just to silence aclocal about the macro not being used
|
||||
ifelse([AC_DISABLE_FAST_INSTALL])dnl
|
||||
@@ -0,0 +1,87 @@
|
||||
dnl This file is part of the FreeType project.
|
||||
dnl
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
dnl
|
||||
|
||||
AC_INIT(ftconfig.in)
|
||||
|
||||
dnl configuration file -- stay in 8.3 limit
|
||||
AC_CONFIG_HEADER(ftconfig.h:ftconfig.in)
|
||||
|
||||
version_info='6:1:0'
|
||||
AC_SUBST(version_info)
|
||||
|
||||
dnl checks for system type
|
||||
AC_CANONICAL_SYSTEM
|
||||
|
||||
dnl checks for programs
|
||||
AC_PROG_CC
|
||||
AC_PROG_CPP
|
||||
|
||||
dnl get Compiler flags right.
|
||||
if test "x$CC" = xgcc; then
|
||||
XX_CFLAGS="-Wall"
|
||||
XX_ANSIFLAGS="-pedantic -ansi"
|
||||
else
|
||||
case "$host" in
|
||||
*-dec-osf*)
|
||||
CFLAGS=
|
||||
XX_CFLAGS="-std1 -g3"
|
||||
XX_ANSIFLAGS=
|
||||
;;
|
||||
*)
|
||||
XX_CFLAGS=
|
||||
XX_ANSIFLAGS=
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
AC_SUBST(XX_CFLAGS)
|
||||
AC_SUBST(XX_ANSIFLAGS)
|
||||
|
||||
AC_CHECK_PROG(RMF, rm, rm -f)
|
||||
AC_CHECK_PROG(RMDIR, rmdir, rmdir)
|
||||
|
||||
dnl Since this file will be finally moved to another directory we make
|
||||
dnl the path of the install script absolute. This small code snippet has
|
||||
dnl been taken from automake's `ylwrap' script.
|
||||
AC_PROG_INSTALL
|
||||
case "$INSTALL" in
|
||||
/*)
|
||||
;;
|
||||
*/*)
|
||||
INSTALL="`pwd`/$INSTALL" ;;
|
||||
esac
|
||||
|
||||
dnl checks for header files
|
||||
AC_HEADER_STDC
|
||||
AC_CHECK_HEADERS(fcntl.h unistd.h)
|
||||
|
||||
dnl checks for typedefs, structures, and compiler characteristics
|
||||
AC_C_CONST
|
||||
AC_CHECK_SIZEOF(int)
|
||||
AC_CHECK_SIZEOF(long)
|
||||
|
||||
dnl checks for library functions
|
||||
|
||||
dnl Here we check whether we can use our mmap file component.
|
||||
AC_FUNC_MMAP
|
||||
if test "$ac_cv_func_mmap_fixed_mapped" != yes; then
|
||||
FTSYS_SRC='$(BASE_)ftsystem.c'
|
||||
else
|
||||
FTSYS_SRC='$(BUILD)/ftsystem.c'
|
||||
|
||||
FT_MUNMAP_DECL
|
||||
FT_MUNMAP_PARAM
|
||||
fi
|
||||
AC_SUBST(FTSYS_SRC)
|
||||
|
||||
AC_CHECK_FUNCS(memcpy memmove)
|
||||
|
||||
AM_PROG_LIBTOOL
|
||||
|
||||
dnl create the CygWin-specific sub-Makefile `builds/cygwin/cygwin-def.mk'
|
||||
dnl and 'builds/cygwin/cygwin-cc.mk' that will be used by the build system
|
||||
dnl
|
||||
AC_OUTPUT(cygwin-cc.mk:cygwin-cc.in cygwin-def.mk:cygwin-def.in freetype-config)
|
||||
|
||||
dnl end of configure.in
|
||||
@@ -0,0 +1,79 @@
|
||||
# template for Unix-specific compiler definitions
|
||||
#
|
||||
|
||||
CC := @CC@
|
||||
|
||||
LIBTOOL := $(BUILD)/libtool
|
||||
|
||||
# The object file extension (for standard and static libraries). This can be
|
||||
# .o, .tco, .obj, etc., depending on the platform.
|
||||
#
|
||||
O := lo
|
||||
SO := o
|
||||
|
||||
# The library file extension (for standard and static libraries). This can
|
||||
# be .a, .lib, etc., depending on the platform.
|
||||
#
|
||||
A := la
|
||||
SA := a
|
||||
|
||||
|
||||
# The name of the final library file. Note that the DOS-specific Makefile
|
||||
# uses a shorter (8.3) name.
|
||||
#
|
||||
LIBRARY := lib$(PROJECT)
|
||||
|
||||
|
||||
# Path inclusion flag. Some compilers use a different flag than `-I' to
|
||||
# specify an additional include path. Examples are `/i=' or `-J'.
|
||||
#
|
||||
I := -I
|
||||
|
||||
|
||||
# C flag used to define a macro before the compilation of a given source
|
||||
# object. Usually is `-D' like in `-DDEBUG'.
|
||||
#
|
||||
D := -D
|
||||
|
||||
|
||||
# The link flag used to specify a given library file on link. Note that
|
||||
# this is only used to compile the demo programs, not the library itself.
|
||||
#
|
||||
L := -l
|
||||
|
||||
|
||||
# Target flag.
|
||||
#
|
||||
T := -o # Don't remove this comment line! We need the space after `-o'.
|
||||
|
||||
|
||||
# C flags
|
||||
#
|
||||
# These should concern: debug output, optimization & warnings.
|
||||
#
|
||||
# Use the ANSIFLAGS variable to define the compiler flags used to enfore
|
||||
# ANSI compliance.
|
||||
#
|
||||
CFLAGS := -c @XX_CFLAGS@ @CFLAGS@
|
||||
|
||||
# ANSIFLAGS: Put there the flags used to make your compiler ANSI-compliant.
|
||||
#
|
||||
ANSIFLAGS := @XX_ANSIFLAGS@
|
||||
|
||||
# C compiler to use -- we use libtool!
|
||||
#
|
||||
#
|
||||
CCraw := $(CC)
|
||||
CC := $(LIBTOOL) --mode=compile $(CCraw)
|
||||
|
||||
# Linker flags.
|
||||
#
|
||||
LDFLAGS := @LDFLAGS@
|
||||
|
||||
|
||||
# Library linking
|
||||
#
|
||||
LINK_LIBRARY = $(LIBTOOL) --mode=link $(CCraw) -o $@ $(OBJECTS_LIST) \
|
||||
-rpath $(libdir) -version-info $(version_info)
|
||||
|
||||
# EOF
|
||||
@@ -0,0 +1,86 @@
|
||||
#
|
||||
# FreeType 2 configuration rules templates for Unix + configure
|
||||
#
|
||||
|
||||
|
||||
# Copyright 1996-2000 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
|
||||
ifndef TOP
|
||||
TOP := .
|
||||
endif
|
||||
TOP := $(shell cd $(TOP); pwd)
|
||||
|
||||
DELETE := @RMF@
|
||||
DELDIR := @RMDIR@
|
||||
SEP := /
|
||||
HOSTSEP := $(SEP)
|
||||
BUILD := $(TOP)/builds/cygwin
|
||||
PLATFORM := cygwin
|
||||
|
||||
# don't use `:=' here since the path stuff will be included after this file
|
||||
#
|
||||
FTSYS_SRC = @FTSYS_SRC@
|
||||
|
||||
INSTALL := @INSTALL@
|
||||
INSTALL_DATA := @INSTALL_DATA@
|
||||
INSTALL_PROGRAM := @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT := @INSTALL_SCRIPT@
|
||||
MKINSTALLDIRS := $(BUILD)/mkinstalldirs
|
||||
|
||||
DISTCLEAN += $(BUILD)/config.cache \
|
||||
$(BUILD)/config.log \
|
||||
$(BUILD)/config.status \
|
||||
$(BUILD)/cygwin-def.mk \
|
||||
$(BUILD)/cygwin-cc.mk \
|
||||
$(BUILD)/ftconfig.h \
|
||||
$(BUILD)/freetype-config \
|
||||
$(LIBTOOL)
|
||||
|
||||
|
||||
# Standard installation variables.
|
||||
#
|
||||
prefix := @prefix@
|
||||
exec_prefix := @exec_prefix@
|
||||
libdir := @libdir@
|
||||
bindir := @bindir@
|
||||
includedir := @includedir@
|
||||
|
||||
version_info := @version_info@
|
||||
|
||||
|
||||
# The directory where all object files are placed.
|
||||
#
|
||||
# This lets you build the library in your own directory with something like
|
||||
#
|
||||
# set TOP=.../path/to/freetype2/top/dir...
|
||||
# set OBJ_DIR=.../path/to/obj/dir
|
||||
# make -f $TOP/Makefile setup [options]
|
||||
# make -f $TOP/Makefile
|
||||
#
|
||||
ifndef OBJ_DIR
|
||||
OBJ_DIR := $(shell cd $(TOP)/obj; pwd)
|
||||
endif
|
||||
|
||||
|
||||
# The directory where all library files are placed.
|
||||
#
|
||||
# By default, this is the same as $(OBJ_DIR); however, this can be changed
|
||||
# to suit particular needs.
|
||||
#
|
||||
LIB_DIR := $(OBJ_DIR)
|
||||
|
||||
|
||||
# The NO_OUTPUT macro is appended to command lines in order to ignore
|
||||
# the output of some programs.
|
||||
#
|
||||
NO_OUTPUT := 2> /dev/null
|
||||
|
||||
# EOF
|
||||
@@ -0,0 +1,23 @@
|
||||
#
|
||||
# FreeType 2 Configuration rules for CygWin + GCC
|
||||
#
|
||||
# Development version without optimizations & libtool
|
||||
# and no installation
|
||||
#
|
||||
|
||||
|
||||
# Copyright 1996-2000 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
|
||||
include $(TOP)/builds/cygwin/cygwinddef.mk
|
||||
include $(TOP)/builds/compiler/gcc-dev.mk
|
||||
include $(TOP)/builds/link_std.mk
|
||||
|
||||
# EOF
|
||||
@@ -0,0 +1,46 @@
|
||||
#
|
||||
# FreeType 2 configuration file for CygWin host platform.
|
||||
#
|
||||
|
||||
|
||||
# Copyright 1996-2000 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
|
||||
include $(TOP)/builds/cygwin/cygwin-def.mk
|
||||
include $(TOP)/builds/cygwin/cygwin-cc.mk
|
||||
|
||||
ifdef BUILD_PROJECT
|
||||
|
||||
# Now include the main sub-makefile. It contains all the rules used to
|
||||
# build the library with the previous variables defined.
|
||||
#
|
||||
include $(TOP)/builds/$(PROJECT).mk
|
||||
|
||||
|
||||
# The cleanup targets.
|
||||
#
|
||||
clean_project: clean_project_cygwin
|
||||
distclean_project: distclean_project_cygwin
|
||||
|
||||
|
||||
# This final rule is used to link all object files into a single library.
|
||||
# this is compiler-specific
|
||||
#
|
||||
$(PROJECT_LIBRARY): $(OBJECTS_LIST)
|
||||
ifdef CLEAN_LIBRARY
|
||||
-$(CLEAN_LIBRARY) $(NO_OUTPUT)
|
||||
endif
|
||||
$(LINK_LIBRARY)
|
||||
|
||||
endif
|
||||
|
||||
include $(TOP)/builds/cygwin/install.mk
|
||||
|
||||
# EOF
|
||||
@@ -0,0 +1,50 @@
|
||||
#
|
||||
# FreeType 2 configuration rules templates for
|
||||
# development under Unix-like platforms with no configure script (gcc only)
|
||||
#
|
||||
|
||||
|
||||
# Copyright 1996-2000 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
|
||||
ifndef TOP
|
||||
TOP := .
|
||||
endif
|
||||
TOP := $(shell cd $(TOP); pwd)
|
||||
|
||||
DELETE := rm -f
|
||||
SEP := /
|
||||
HOSTSEP := $(SEP)
|
||||
# we use a special devel ftoption.h
|
||||
BUILD := $(TOP)/builds/cygwin/devel
|
||||
# do not set it to 'cygwin', or libtool will trick you
|
||||
PLATFORM := cygwindev
|
||||
|
||||
# The directory where all object files are placed.
|
||||
#
|
||||
ifndef OBJ_DIR
|
||||
OBJ_DIR := $(shell cd $(TOP)/obj; pwd)
|
||||
endif
|
||||
|
||||
# library file name
|
||||
#
|
||||
LIBRARY := lib$(PROJECT)
|
||||
|
||||
# The directory where all library files are placed.
|
||||
#
|
||||
# By default, this is the same as $(OBJ_DIR), however, this can be changed
|
||||
# to suit particular needs.
|
||||
#
|
||||
LIB_DIR := $(OBJ_DIR)
|
||||
|
||||
#
|
||||
NO_OUTPUT := 2> /dev/null
|
||||
|
||||
# EOF
|
||||
@@ -0,0 +1,80 @@
|
||||
#
|
||||
# FreeType 2 configuration file to detect a CygWin host platform.
|
||||
#
|
||||
|
||||
|
||||
# Copyright 1996-2000 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
|
||||
ifeq ($(PLATFORM),ansi)
|
||||
|
||||
# Detecting Windows NT is easy, as the OS variable must be defined and
|
||||
# contains `Windows_NT'. Untested with Windows 2K, but I guess it should
|
||||
# work...
|
||||
#
|
||||
ifeq ($(OS),Windows_NT)
|
||||
|
||||
# Check if we are running on a CygWin system by checking the OSTYPE
|
||||
# variable.
|
||||
ifeq ($(OSTYPE),cygwin)
|
||||
is_cygwin := 1
|
||||
endif
|
||||
|
||||
# We test for the COMSPEC environment variable, then run the `ver'
|
||||
# command-line program to see if its output contains the word `Windows'.
|
||||
#
|
||||
# If this is true, we are running a win32 platform (or an emulation).
|
||||
#
|
||||
else
|
||||
ifeq ($(OSTYPE),cygwin)
|
||||
ifdef COMSPEC
|
||||
is_cygwin := $(findstring Windows,$(strip $(shell ver)))
|
||||
endif
|
||||
endif # test CygWin
|
||||
endif # test NT
|
||||
|
||||
ifdef is_cygwin
|
||||
|
||||
PLATFORM := cygwin
|
||||
COPY := cp
|
||||
DELETE := rm -f
|
||||
|
||||
# If `devel' is the requested target, we use a special configuration
|
||||
# file named `cygwin-dev.mk'. It disables optimization and libtool.
|
||||
#
|
||||
ifneq ($(findstring devel,$(MAKECMDGOALS)),)
|
||||
CONFIG_FILE := cygwin-dev.mk
|
||||
CC := gcc
|
||||
devel: setup
|
||||
else
|
||||
# If a CygWin platform is detected, the configure script is called and
|
||||
# `cygwin.mk' is created.
|
||||
#
|
||||
# Arguments to `configure' should be in the CFG variable. Example:
|
||||
#
|
||||
# make CFG="--prefix=/usr --disable-static"
|
||||
#
|
||||
# If you need to set CFLAGS or LDFLAGS, do it here also.
|
||||
#
|
||||
CONFIG_FILE := cygwin.mk
|
||||
setup: cygwin-def.mk
|
||||
cygwin: setup
|
||||
endif
|
||||
|
||||
setup: std_setup
|
||||
|
||||
cygwin-def.mk: builds/cygwin/cygwin-def.in
|
||||
cd builds/cygwin; \
|
||||
$(USE_CFLAGS) CONFIG_SHELL=/bin/bash ./configure $(CFG)
|
||||
|
||||
endif # test CygWin
|
||||
endif # test PLATFORM
|
||||
|
||||
# EOF
|
||||
@@ -0,0 +1,400 @@
|
||||
/***************************************************************************/
|
||||
/* */
|
||||
/* ftoption.h */
|
||||
/* */
|
||||
/* User-selectable configuration macros (specification only). */
|
||||
/* */
|
||||
/* Copyright 1996-2000 by */
|
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used, */
|
||||
/* modified, and distributed under the terms of the FreeType project */
|
||||
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
|
||||
/* this file you indicate that you have read the license and */
|
||||
/* understand and accept it fully. */
|
||||
/* */
|
||||
/***************************************************************************/
|
||||
|
||||
|
||||
#ifndef __FTOPTION_H__
|
||||
#define __FTOPTION_H__
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* USER-SELECTABLE CONFIGURATION MACROS */
|
||||
/* */
|
||||
/* These macros can be toggled by developers to enable or disable */
|
||||
/* certain aspects of FreeType. This is a default file, where all major */
|
||||
/* options are enabled. */
|
||||
/* */
|
||||
/* Note that if some modifications are required for your build, we */
|
||||
/* advise you to put a modified copy of this file in your build */
|
||||
/* directory, rather than modifying it in-place. */
|
||||
/* */
|
||||
/* The build directory is normally `freetype/builds/<system>' and */
|
||||
/* contains build or system-specific files that are included in */
|
||||
/* priority when building the library. */
|
||||
/* */
|
||||
/*************************************************************************/
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
/**** ****/
|
||||
/**** G E N E R A L F R E E T Y P E 2 C O N F I G U R A T I O N ****/
|
||||
/**** ****/
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* Convenience functions support */
|
||||
/* */
|
||||
/* Some functions of the FreeType 2 API are provided as a convenience */
|
||||
/* for client applications and developers. However, they are not */
|
||||
/* required to build and run the library itself. */
|
||||
/* */
|
||||
/* By defining this configuration macro, you'll disable the */
|
||||
/* compilation of these functions at build time. This can be useful */
|
||||
/* to reduce the library's code size when you don't need any of */
|
||||
/* these functions. */
|
||||
/* */
|
||||
/* All convenience functions are declared as such in their */
|
||||
/* documentation. */
|
||||
/* */
|
||||
#undef FT_CONFIG_OPTION_NO_CONVENIENCE_FUNCS
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* Alternate Glyph Image Format support */
|
||||
/* */
|
||||
/* By default, the glyph images returned by the FreeType glyph loader */
|
||||
/* can either be a pixmap or a vectorial outline defined through */
|
||||
/* Bezier control points. When defining the following configuration */
|
||||
/* macro, some font drivers will be able to register alternate */
|
||||
/* glyph image formats. */
|
||||
/* */
|
||||
/* Unset this macro if you are sure that you will never use a font */
|
||||
/* driver with an alternate glyph format; this will reduce the size of */
|
||||
/* the base layer code. */
|
||||
/* */
|
||||
/* Note that a few Type 1 fonts, as well as Windows `vector' fonts */
|
||||
/* use a vector `plotter' format that isn't supported when this */
|
||||
/* macro is undefined. */
|
||||
/* */
|
||||
#define FT_CONFIG_OPTION_ALTERNATE_GLYPH_FORMATS
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* Glyph Postscript Names handling */
|
||||
/* */
|
||||
/* By default, FreeType 2 is compiled with the `PSNames' module. This */
|
||||
/* This module is in charge of converting a glyph name string into a */
|
||||
/* Unicode value, or return a Macintosh standard glyph name for the */
|
||||
/* use with the TrueType `post' table. */
|
||||
/* */
|
||||
/* Undefine this macro if you do not want `PSNames' compiled in your */
|
||||
/* build of FreeType. This has the following effects: */
|
||||
/* */
|
||||
/* - The TrueType driver will provide its own set of glyph names, */
|
||||
/* if you build it to support postscript names in the TrueType */
|
||||
/* `post' table. */
|
||||
/* */
|
||||
/* - The Type 1 driver will not be able to synthetize a Unicode */
|
||||
/* charmap out of the glyphs found in the fonts. */
|
||||
/* */
|
||||
/* You would normally undefine this configuration macro when building */
|
||||
/* a version of FreeType that doesn't contain a Type 1 or CFF driver. */
|
||||
/* */
|
||||
#define FT_CONFIG_OPTION_POSTSCRIPT_NAMES
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* Postscript Names to Unicode Values support */
|
||||
/* */
|
||||
/* By default, FreeType 2 is built with the `PSNames' module compiled */
|
||||
/* in. Among other things, the module is used to convert a glyph name */
|
||||
/* into a Unicode value. This is especially useful in order to */
|
||||
/* synthetize on the fly a Unicode charmap from the CFF/Type 1 driver */
|
||||
/* through a big table named the `Adobe Glyph List' (AGL). */
|
||||
/* */
|
||||
/* Undefine this macro if you do not want the Adobe Glyph List */
|
||||
/* compiled in your `PSNames' module. The Type 1 driver will not be */
|
||||
/* able to synthetize a Unicode charmap out of the glyphs found in the */
|
||||
/* fonts. */
|
||||
/* */
|
||||
#define FT_CONFIG_OPTION_ADOBE_GLYPH_LIST
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* Many compilers provide the non-ANSI `long long' 64-bit type. You can */
|
||||
/* activate it by defining the FTCALC_USE_LONG_LONG macro. Note that */
|
||||
/* this will produce many -ansi warnings during library compilation, and */
|
||||
/* that in many cases the generated code will not be smaller or faster! */
|
||||
/* */
|
||||
#undef FTCALC_USE_LONG_LONG
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* DLL export compilation */
|
||||
/* */
|
||||
/* When compiling FreeType as a DLL, some systems/compilers need a */
|
||||
/* special keyword in front OR after the return type of function */
|
||||
/* declarations. */
|
||||
/* */
|
||||
/* Two macros are used within the FreeType source code to define */
|
||||
/* exported library functions: FT_EXPORT and FT_EXPORT_DEF. */
|
||||
/* */
|
||||
/* FT_EXPORT( return_type ) */
|
||||
/* */
|
||||
/* is used in a function declaration, as in */
|
||||
/* */
|
||||
/* FT_EXPORT( FT_Error ) */
|
||||
/* FT_Init_FreeType( FT_Library* alibrary ); */
|
||||
/* */
|
||||
/* */
|
||||
/* FT_EXPORT_DEF( return_type ) */
|
||||
/* */
|
||||
/* is used in a function definition, as in */
|
||||
/* */
|
||||
/* FT_EXPORT_DEF( FT_Error ) */
|
||||
/* FT_Init_FreeType( FT_Library* alibrary ) */
|
||||
/* { */
|
||||
/* ... some code ... */
|
||||
/* return FT_Err_Ok; */
|
||||
/* } */
|
||||
/* */
|
||||
/* You can provide your own implementation of FT_EXPORT and */
|
||||
/* FT_EXPORT_DEF here if you want. If you leave them undefined, they */
|
||||
/* will be later automatically defined as `extern return_type' to */
|
||||
/* allow normal compilation. */
|
||||
/* */
|
||||
#undef FT_EXPORT
|
||||
#undef FT_EXPORT_DEF
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* Debug level */
|
||||
/* */
|
||||
/* FreeType can be compiled in debug or trace mode. In debug mode, */
|
||||
/* errors are reported through the `ftdebug' component. In trace */
|
||||
/* mode, additional messages are sent to the standard output during */
|
||||
/* execution. */
|
||||
/* */
|
||||
/* Define FT_DEBUG_LEVEL_ERROR to build the library in debug mode. */
|
||||
/* Define FT_DEBUG_LEVEL_TRACE to build it in trace mode. */
|
||||
/* */
|
||||
/* Don't define any of these macros to compile in `release' mode! */
|
||||
/* */
|
||||
#define FT_DEBUG_LEVEL_ERROR
|
||||
#define FT_DEBUG_LEVEL_TRACE
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* Computation Algorithms */
|
||||
/* */
|
||||
/* Used for debugging, this configuration macro should disappear */
|
||||
/* soon. */
|
||||
/* */
|
||||
#define FT_CONFIG_OPTION_OLD_CALCS
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* The size in bytes of the render pool used by the scan-line converter */
|
||||
/* to do all of its work. */
|
||||
/* */
|
||||
/* This must be greater than 4kByte. */
|
||||
/* */
|
||||
#define FT_RENDER_POOL_SIZE 16384
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* FT_MAX_MODULES */
|
||||
/* */
|
||||
/* The maximum number of modules that can be registered in a single */
|
||||
/* FreeType library object. 16 is the default. */
|
||||
/* */
|
||||
#define FT_MAX_MODULES 16
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* FT_MAX_EXTENSIONS */
|
||||
/* */
|
||||
/* The maximum number of extensions that can be registered in a single */
|
||||
/* font driver. 8 is the default. */
|
||||
/* */
|
||||
/* If you don't know what this means, you certainly do not need to */
|
||||
/* change this value. */
|
||||
/* */
|
||||
#define FT_MAX_EXTENSIONS 8
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
/**** ****/
|
||||
/**** S F N T D R I V E R C O N F I G U R A T I O N ****/
|
||||
/**** ****/
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* Define TT_CONFIG_OPTION_EMBEDDED_BITMAPS if you want to support */
|
||||
/* embedded bitmaps in all formats using the SFNT module (namely */
|
||||
/* TrueType & OpenType). */
|
||||
/* */
|
||||
#define TT_CONFIG_OPTION_EMBEDDED_BITMAPS
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* Define TT_CONFIG_OPTION_POSTSCRIPT_NAMES if you want to be able to */
|
||||
/* load and enumerate the glyph Postscript names in a TrueType or */
|
||||
/* OpenType file. */
|
||||
/* */
|
||||
/* Note that when you do not compile the `PSNames' module by undefining */
|
||||
/* the above FT_CONFIG_OPTION_POSTSCRIPT_NAMES, the `sfnt' module will */
|
||||
/* contain additional code used to read the PS Names table from a font. */
|
||||
/* */
|
||||
/* (By default, the module uses `PSNames' to extract glyph names.) */
|
||||
/* */
|
||||
#define TT_CONFIG_OPTION_POSTSCRIPT_NAMES
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* Define TT_CONFIG_OPTION_SFNT_NAMES if your applications need to */
|
||||
/* access the internal name table in a SFNT-based format like TrueType */
|
||||
/* or OpenType. The name table contains various strings used to */
|
||||
/* describe the font, like family name, copyright, version, etc. It */
|
||||
/* does not contain any glyph name though. */
|
||||
/* */
|
||||
/* Accessing SFNT names is done through the functions declared in */
|
||||
/* `freetype/ftnames.h'. */
|
||||
/* */
|
||||
#define TT_CONFIG_OPTION_SFNT_NAMES
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
/**** ****/
|
||||
/**** T R U E T Y P E D R I V E R C O N F I G U R A T I O N ****/
|
||||
/**** ****/
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* Define TT_CONFIG_OPTION_BYTECODE_INTERPRETER if you want to compile */
|
||||
/* a bytecode interpreter in the TrueType driver. Note that there are */
|
||||
/* important patent issues related to the use of the interpreter. */
|
||||
/* */
|
||||
/* By undefining this, you will only compile the code necessary to load */
|
||||
/* TrueType glyphs without hinting. */
|
||||
/* */
|
||||
#define TT_CONFIG_OPTION_BYTECODE_INTERPRETER
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* Define TT_CONFIG_OPTION_INTERPRETER_SWITCH to compile the TrueType */
|
||||
/* bytecode interpreter with a huge switch statement, rather than a call */
|
||||
/* table. This results in smaller and faster code for a number of */
|
||||
/* architectures. */
|
||||
/* */
|
||||
/* Note however that on some compiler/processor combinations, undefining */
|
||||
/* this macro will generate faster, though larger, code. */
|
||||
/* */
|
||||
#define TT_CONFIG_OPTION_INTERPRETER_SWITCH
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
/**** ****/
|
||||
/**** T Y P E 1 D R I V E R C O N F I G U R A T I O N ****/
|
||||
/**** ****/
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* T1_MAX_DICT_DEPTH is the maximal depth of nest dictionaries and */
|
||||
/* arrays in the Type 1 stream (see t1load.c). A minimum of 4 is */
|
||||
/* required. */
|
||||
/* */
|
||||
#define T1_MAX_DICT_DEPTH 5
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* T1_MAX_SUBRS_CALLS details the maximum number of nested sub-routine */
|
||||
/* calls during glyph loading. */
|
||||
/* */
|
||||
#define T1_MAX_SUBRS_CALLS 16
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* T1_MAX_CHARSTRING_OPERANDS is the charstring stack's capacity. A */
|
||||
/* minimum of 16 is required. */
|
||||
/* */
|
||||
/* The Chinese font MingTiEG-Medium (CNS 11643 character set) needs 256. */
|
||||
/* */
|
||||
#define T1_MAX_CHARSTRINGS_OPERANDS 256
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* Define T1_CONFIG_OPTION_DISABLE_HINTER if you want to generate a */
|
||||
/* driver with no hinter. This can be useful to debug the parser. */
|
||||
/* */
|
||||
#undef T1_CONFIG_OPTION_DISABLE_HINTER
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* Define this configuration macro if you want to prevent the */
|
||||
/* compilation of `t1afm', which is in charge of reading Type 1 AFM */
|
||||
/* files into an existing face. Note that if set, the T1 driver will be */
|
||||
/* unable to produce kerning distances. */
|
||||
/* */
|
||||
#undef T1_CONFIG_OPTION_NO_AFM
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* Define this configuration macro if you want to prevent the */
|
||||
/* compilation of the Multiple Masters font support in the Type 1 */
|
||||
/* driver. */
|
||||
/* */
|
||||
#undef T1_CONFIG_OPTION_NO_MM_SUPPORT
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* __FTOPTION_H__ */
|
||||
|
||||
|
||||
/* END */
|
||||
@@ -0,0 +1,90 @@
|
||||
#!/bin/sh
|
||||
|
||||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
exec_prefix_set=no
|
||||
|
||||
usage()
|
||||
{
|
||||
cat <<EOF
|
||||
Usage: freetype-config [OPTIONS] [LIBRARIES]
|
||||
Options:
|
||||
[--prefix[=DIR]]
|
||||
[--exec-prefix[=DIR]]
|
||||
[--version]
|
||||
[--libs]
|
||||
[--libtool]
|
||||
[--cflags]
|
||||
EOF
|
||||
exit $1
|
||||
}
|
||||
|
||||
if test $# -eq 0; then
|
||||
usage 1 1>&2
|
||||
fi
|
||||
|
||||
|
||||
while test $# -gt 0; do
|
||||
case "$1" in
|
||||
-*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
|
||||
*) optarg= ;;
|
||||
esac
|
||||
|
||||
case $1 in
|
||||
--prefix=*)
|
||||
prefix=$optarg
|
||||
;;
|
||||
--prefix)
|
||||
echo_prefix=yes
|
||||
;;
|
||||
--exec-prefix=*)
|
||||
exec_prefix=$optarg
|
||||
exec_prefix_set=yes
|
||||
;;
|
||||
--exec-prefix)
|
||||
echo_exec_prefix=yes
|
||||
;;
|
||||
--version)
|
||||
echo @version_info@
|
||||
exit 0
|
||||
;;
|
||||
--cflags)
|
||||
echo_cflags=yes
|
||||
;;
|
||||
--libs)
|
||||
echo_libs=yes
|
||||
;;
|
||||
--libtool)
|
||||
echo_libtool=yes
|
||||
;;
|
||||
*)
|
||||
usage 1 1>&2
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
if test "$exec_prefix_set" = "no"; then
|
||||
exec_prefix=$prefix
|
||||
fi
|
||||
|
||||
if test "$echo_prefix" = "yes"; then
|
||||
echo $prefix
|
||||
fi
|
||||
if test "$echo_exec_prefix" = "yes"; then
|
||||
echo $exec_prefix
|
||||
fi
|
||||
if test "$echo_cflags" = "yes"; then
|
||||
cflags="-I@includedir@/freetype2"
|
||||
echo $cflags $includes
|
||||
fi
|
||||
if test "$echo_libs" = "yes"; then
|
||||
libs="-lfreetype"
|
||||
echo -L@libdir@ $libs
|
||||
fi
|
||||
if test "$echo_libtool" = "yes"; then
|
||||
convlib="libfreetype.la"
|
||||
echo @libdir@/$convlib
|
||||
fi
|
||||
|
||||
# EOF
|
||||
@@ -0,0 +1,261 @@
|
||||
/***************************************************************************/
|
||||
/* */
|
||||
/* ftconfig.in */
|
||||
/* */
|
||||
/* UNIX-specific configuration file (specification only). */
|
||||
/* */
|
||||
/* Copyright 1996-2000 by */
|
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used, */
|
||||
/* modified, and distributed under the terms of the FreeType project */
|
||||
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
|
||||
/* this file you indicate that you have read the license and */
|
||||
/* understand and accept it fully. */
|
||||
/* */
|
||||
/***************************************************************************/
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* This header file contains a number of macro definitions that are used */
|
||||
/* by the rest of the engine. Most of the macros here are automatically */
|
||||
/* determined at compile time, and you should not need to change it to */
|
||||
/* port FreeType, except to compile the library with a non-ANSI */
|
||||
/* compiler. */
|
||||
/* */
|
||||
/* Note however that if some specific modifications are needed, we */
|
||||
/* advise you to place a modified copy in your build directory. */
|
||||
/* */
|
||||
/* The build directory is usually `freetype/builds/<system>', and */
|
||||
/* contains system-specific files that are always included first when */
|
||||
/* building the library. */
|
||||
/* */
|
||||
/*************************************************************************/
|
||||
|
||||
|
||||
#ifndef __FTCONFIG_H__
|
||||
#define __FTCONFIG_H__
|
||||
|
||||
#ifndef FT_BUILD_H
|
||||
# define FT_BUILD_H <freetype/config/ftbuild.h>
|
||||
#endif
|
||||
|
||||
|
||||
/* Include the header file containing all developer build options */
|
||||
#include FT_BUILD_H
|
||||
#include FT_CONFIG_OPTIONS_H
|
||||
|
||||
|
||||
FT_BEGIN_HEADER
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* PLATFORM-SPECIFIC CONFIGURATION MACROS */
|
||||
/* */
|
||||
/* These macros can be toggled to suit a specific system. The current */
|
||||
/* ones are defaults used to compile FreeType in an ANSI C environment */
|
||||
/* (16bit compilers are also supported). Copy this file to your own */
|
||||
/* `freetype/builds/<system>' directory, and edit it to port the engine. */
|
||||
/* */
|
||||
/*************************************************************************/
|
||||
|
||||
|
||||
#define HAVE_UNISTD_H 0
|
||||
#define HAVE_FCNTL_H 0
|
||||
|
||||
#define SIZEOF_INT 2
|
||||
#define SIZEOF_LONG 2
|
||||
|
||||
|
||||
#define FT_SIZEOF_INT SIZEOF_INT
|
||||
#define FT_SIZEOF_LONG SIZEOF_LONG
|
||||
|
||||
|
||||
/* Preferred alignment of data */
|
||||
#define FT_ALIGNMENT 8
|
||||
|
||||
|
||||
/* UNUSED is a macro used to indicate that a given parameter is not used */
|
||||
/* -- this is only used to get rid of unpleasant compiler warnings */
|
||||
#ifndef FT_UNUSED
|
||||
#define FT_UNUSED( arg ) ( (arg) = (arg) )
|
||||
#endif
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* AUTOMATIC CONFIGURATION MACROS */
|
||||
/* */
|
||||
/* These macros are computed from the ones defined above. Don't touch */
|
||||
/* their definition, unless you know precisely what you are doing. No */
|
||||
/* porter should need to mess with them. */
|
||||
/* */
|
||||
/*************************************************************************/
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* IntN types */
|
||||
/* */
|
||||
/* Used to guarantee the size of some specific integers. */
|
||||
/* */
|
||||
typedef signed short FT_Int16;
|
||||
typedef unsigned short FT_UInt16;
|
||||
|
||||
#if FT_SIZEOF_INT == 4
|
||||
|
||||
typedef signed int FT_Int32;
|
||||
typedef unsigned int FT_UInt32;
|
||||
|
||||
#elif FT_SIZEOF_LONG == 4
|
||||
|
||||
typedef signed long FT_Int32;
|
||||
typedef unsigned long FT_UInt32;
|
||||
|
||||
#else
|
||||
#error "no 32bit type found -- please check your configuration files"
|
||||
#endif
|
||||
|
||||
#if FT_SIZEOF_LONG == 8
|
||||
|
||||
/* FT_LONG64 must be defined if a 64-bit type is available */
|
||||
#define FT_LONG64
|
||||
#define FT_INT64 long
|
||||
|
||||
#else
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* Many compilers provide the non-ANSI `long long' 64-bit type. You can */
|
||||
/* activate it by defining the FTCALC_USE_LONG_LONG macro in */
|
||||
/* `ftoption.h'. */
|
||||
/* */
|
||||
/* Note that this will produce many -ansi warnings during library */
|
||||
/* compilation, and that in many cases, the generated code will be */
|
||||
/* neither smaller nor faster! */
|
||||
/* */
|
||||
#ifdef FTCALC_USE_LONG_LONG
|
||||
|
||||
#define FT_LONG64
|
||||
#define FT_INT64 long long
|
||||
|
||||
#endif /* FTCALC_USE_LONG_LONG */
|
||||
#endif /* FT_SIZEOF_LONG == 8 */
|
||||
|
||||
|
||||
#ifdef FT_MAKE_OPTION_SINGLE_OBJECT
|
||||
|
||||
#define FT_LOCAL static
|
||||
#define FT_LOCAL_DEF static
|
||||
|
||||
#else
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define FT_LOCAL extern "C"
|
||||
#define FT_LOCAL_DEF extern "C"
|
||||
#else
|
||||
#define FT_LOCAL extern
|
||||
#define FT_LOCAL_DEF extern
|
||||
#endif
|
||||
|
||||
#endif /* FT_MAKE_OPTION_SINGLE_OBJECT */
|
||||
|
||||
|
||||
#ifndef FT_BASE
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define FT_BASE( x ) extern "C" x
|
||||
#else
|
||||
#define FT_BASE( x ) extern x
|
||||
#endif
|
||||
|
||||
#endif /* !FT_BASE */
|
||||
|
||||
|
||||
#ifndef FT_BASE_DEF
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define FT_BASE_DEF( x ) extern "C" x
|
||||
#else
|
||||
#define FT_BASE_DEF( x ) extern x
|
||||
#endif
|
||||
|
||||
#endif /* !FT_BASE_DEF */
|
||||
|
||||
|
||||
#ifndef FT_EXPORT
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define FT_EXPORT( x ) extern "C" x
|
||||
#else
|
||||
#define FT_EXPORT( x ) extern x
|
||||
#endif
|
||||
|
||||
#endif /* !FT_EXPORT */
|
||||
|
||||
|
||||
#ifndef FT_EXPORT_DEF
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define FT_EXPORT_DEF( x ) extern "C" x
|
||||
#else
|
||||
#define FT_EXPORT_DEF( x ) extern x
|
||||
#endif
|
||||
|
||||
#endif /* !FT_EXPORT_DEF */
|
||||
|
||||
|
||||
#ifndef FT_EXPORT_VAR
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define FT_EXPORT_VAR( x ) extern "C" x
|
||||
#else
|
||||
#define FT_EXPORT_VAR( x ) extern x
|
||||
#endif
|
||||
|
||||
#endif /* !FT_EXPORT_VAR */
|
||||
|
||||
/* The following macros are needed to compile the library with a */
|
||||
/* C++ compiler. Note that we do this for convenience -- please */
|
||||
/* don't ask for more C++ features. */
|
||||
/* */
|
||||
|
||||
/* This is special. Within C++, you must specify `extern "C"' for */
|
||||
/* functions which are used via function pointers, and you also */
|
||||
/* must do that for structures which contain function pointers to */
|
||||
/* assure C linkage -- it's not possible to have (local) anonymous */
|
||||
/* functions which are accessed by (global) function pointers. */
|
||||
/* */
|
||||
/* */
|
||||
/* FT_CALLBACK_DEF is used to _define_ a callback function. */
|
||||
/* */
|
||||
/* FT_CALLBACK_TABLE is used to _declare_ a constant variable that */
|
||||
/* contains pointers to callback functions. */
|
||||
/* */
|
||||
/* FT_CALLBACK_TABLE_DEF is used to _define_ a constant variable */
|
||||
/* that contains pointers to callback functions. */
|
||||
/* */
|
||||
#ifdef __cplusplus
|
||||
|
||||
#define FT_CALLBACK_DEF extern "C"
|
||||
#define FT_CALLBACK_TABLE extern "C"
|
||||
#define FT_CALLBACK_TABLE_DEF extern "C"
|
||||
|
||||
#else
|
||||
|
||||
#define FT_CALLBACK_DEF static
|
||||
#define FT_CALLBACK_TABLE extern
|
||||
#define FT_CALLBACK_TABLE_DEF
|
||||
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
FT_END_HEADER
|
||||
|
||||
#endif /* __FTCONFIG_H__ */
|
||||
|
||||
|
||||
/* END */
|
||||
@@ -0,0 +1,334 @@
|
||||
/***************************************************************************/
|
||||
/* */
|
||||
/* ftsystem.c */
|
||||
/* */
|
||||
/* Unix-specific FreeType low-level system interface (body). */
|
||||
/* */
|
||||
/* Copyright 1996-2000 by */
|
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used, */
|
||||
/* modified, and distributed under the terms of the FreeType project */
|
||||
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
|
||||
/* this file you indicate that you have read the license and */
|
||||
/* understand and accept it fully. */
|
||||
/* */
|
||||
/***************************************************************************/
|
||||
|
||||
|
||||
#include <ftconfig.h>
|
||||
#include <freetype/internal/ftdebug.h>
|
||||
#include <freetype/ftsystem.h>
|
||||
#include <freetype/fterrors.h>
|
||||
#include <freetype/fttypes.h>
|
||||
#include <freetype/internal/ftobjs.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
/* memory-mapping includes and definitions */
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <sys/mman.h>
|
||||
#ifndef MAP_FILE
|
||||
#define MAP_FILE 0x00
|
||||
#endif
|
||||
|
||||
#ifdef MUNMAP_USES_VOIDP
|
||||
#define MUNMAP_ARG_CAST void *
|
||||
#else
|
||||
#define MUNMAP_ARG_CAST char *
|
||||
#endif
|
||||
|
||||
#ifdef NEED_MUNMAP_DECL
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#else
|
||||
extern
|
||||
#endif
|
||||
int munmap( char* addr,
|
||||
int len );
|
||||
|
||||
#define MUNMAP_ARG_CAST char *
|
||||
|
||||
#endif /* NEED_DECLARATION_MUNMAP */
|
||||
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
#ifdef HAVE_FCNTL_H
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* MEMORY MANAGEMENT INTERFACE */
|
||||
/* */
|
||||
/*************************************************************************/
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Function> */
|
||||
/* ft_alloc */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* The memory allocation function. */
|
||||
/* */
|
||||
/* <Input> */
|
||||
/* memory :: A pointer to the memory object. */
|
||||
/* size :: The requested size in bytes. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* block :: The address of newly allocated block. */
|
||||
/* */
|
||||
FT_CALLBACK_DEF
|
||||
void* ft_alloc( FT_Memory memory,
|
||||
long size )
|
||||
{
|
||||
FT_UNUSED( memory );
|
||||
|
||||
return malloc( size );
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Function> */
|
||||
/* ft_realloc */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* The memory reallocation function. */
|
||||
/* */
|
||||
/* <Input> */
|
||||
/* memory :: A pointer to the memory object. */
|
||||
/* */
|
||||
/* cur_size :: The current size of the allocated memory block. */
|
||||
/* */
|
||||
/* new_size :: The newly requested size in bytes. */
|
||||
/* */
|
||||
/* block :: The current address of the block in memory. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* The address of the reallocated memory block. */
|
||||
/* */
|
||||
FT_CALLBACK_DEF
|
||||
void* ft_realloc( FT_Memory memory,
|
||||
long cur_size,
|
||||
long new_size,
|
||||
void* block )
|
||||
{
|
||||
FT_UNUSED( memory );
|
||||
FT_UNUSED( cur_size );
|
||||
|
||||
return realloc( block, new_size );
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Function> */
|
||||
/* ft_free */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* The memory release function. */
|
||||
/* */
|
||||
/* <Input> */
|
||||
/* memory :: A pointer to the memory object. */
|
||||
/* */
|
||||
/* block :: The address of block in memory to be freed. */
|
||||
/* */
|
||||
FT_CALLBACK_DEF
|
||||
void ft_free( FT_Memory memory,
|
||||
void* block )
|
||||
{
|
||||
FT_UNUSED( memory );
|
||||
|
||||
free( block );
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* RESOURCE MANAGEMENT INTERFACE */
|
||||
/* */
|
||||
/*************************************************************************/
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* The macro FT_COMPONENT is used in trace mode. It is an implicit */
|
||||
/* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
|
||||
/* messages during execution. */
|
||||
/* */
|
||||
#undef FT_COMPONENT
|
||||
#define FT_COMPONENT trace_io
|
||||
|
||||
/* We use the macro STREAM_FILE for convenience to extract the */
|
||||
/* system-specific stream handle from a given FreeType stream object */
|
||||
#define STREAM_FILE( stream ) ( (FILE*)stream->descriptor.pointer )
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Function> */
|
||||
/* ft_close_stream */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* The function to close a stream. */
|
||||
/* */
|
||||
/* <Input> */
|
||||
/* stream :: A pointer to the stream object. */
|
||||
/* */
|
||||
FT_CALLBACK_DEF
|
||||
void ft_close_stream( FT_Stream stream )
|
||||
{
|
||||
munmap( (MUNMAP_ARG_CAST)stream->descriptor.pointer, stream->size );
|
||||
|
||||
stream->descriptor.pointer = NULL;
|
||||
stream->size = 0;
|
||||
stream->base = 0;
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Function> */
|
||||
/* FT_New_Stream */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* Creates a new stream object. */
|
||||
/* */
|
||||
/* <Input> */
|
||||
/* filepathname :: The name of the stream (usually a file) to be */
|
||||
/* opened. */
|
||||
/* */
|
||||
/* stream :: A pointer to the stream object. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
FT_EXPORT_DEF( FT_Error ) FT_New_Stream( const char* filepathname,
|
||||
FT_Stream stream )
|
||||
{
|
||||
int file;
|
||||
struct stat stat_buf;
|
||||
|
||||
|
||||
if ( !stream )
|
||||
return FT_Err_Invalid_Stream_Handle;
|
||||
|
||||
/* open the file */
|
||||
file = open( filepathname, O_RDONLY );
|
||||
if ( file < 0 )
|
||||
{
|
||||
FT_ERROR(( "FT_New_Stream:" ));
|
||||
FT_ERROR(( " could not open `%s'\n", filepathname ));
|
||||
return FT_Err_Cannot_Open_Resource;
|
||||
}
|
||||
|
||||
if ( fstat( file, &stat_buf ) < 0 )
|
||||
{
|
||||
FT_ERROR(( "FT_New_Stream:" ));
|
||||
FT_ERROR(( " could not `fstat' file `%s'\n", filepathname ));
|
||||
goto Fail_Map;
|
||||
}
|
||||
|
||||
stream->size = stat_buf.st_size;
|
||||
stream->pos = 0;
|
||||
stream->base = (unsigned char *)mmap( NULL,
|
||||
stream->size,
|
||||
PROT_READ,
|
||||
MAP_FILE | MAP_PRIVATE,
|
||||
file,
|
||||
0 );
|
||||
|
||||
if ( (long)stream->base == -1 )
|
||||
{
|
||||
FT_ERROR(( "FT_New_Stream:" ));
|
||||
FT_ERROR(( " could not `mmap' file `%s'\n", filepathname ));
|
||||
goto Fail_Map;
|
||||
}
|
||||
|
||||
close( file );
|
||||
|
||||
stream->descriptor.pointer = stream->base;
|
||||
stream->pathname.pointer = (char*)filepathname;
|
||||
|
||||
stream->close = ft_close_stream;
|
||||
stream->read = 0;
|
||||
|
||||
FT_TRACE1(( "FT_New_Stream:" ));
|
||||
FT_TRACE1(( " opened `%s' (%d bytes) successfully\n",
|
||||
filepathname, stream->size ));
|
||||
|
||||
return FT_Err_Ok;
|
||||
|
||||
Fail_Map:
|
||||
close( file );
|
||||
|
||||
stream->base = NULL;
|
||||
stream->size = 0;
|
||||
stream->pos = 0;
|
||||
|
||||
return FT_Err_Cannot_Open_Stream;
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Function> */
|
||||
/* FT_New_Memory */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* Creates a new memory object. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* A pointer to the new memory object. 0 in case of error. */
|
||||
/* */
|
||||
FT_EXPORT_DEF( FT_Memory ) FT_New_Memory( void )
|
||||
{
|
||||
FT_Memory memory;
|
||||
|
||||
|
||||
memory = (FT_Memory)malloc( sizeof ( *memory ) );
|
||||
if ( memory )
|
||||
{
|
||||
memory->user = 0;
|
||||
memory->alloc = ft_alloc;
|
||||
memory->realloc = ft_realloc;
|
||||
memory->free = ft_free;
|
||||
}
|
||||
|
||||
return memory;
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Function> */
|
||||
/* FT_Done_Memory */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* Discards memory manager. */
|
||||
/* */
|
||||
/* <Input> */
|
||||
/* memory :: A handle to the memory manager. */
|
||||
/* */
|
||||
FT_EXPORT_DEF( void ) FT_Done_Memory( FT_Memory memory )
|
||||
{
|
||||
free( memory );
|
||||
}
|
||||
|
||||
|
||||
/* END */
|
||||
@@ -0,0 +1,250 @@
|
||||
#! /bin/sh
|
||||
#
|
||||
# install - install a program, script, or datafile
|
||||
# This comes from X11R5 (mit/util/scripts/install.sh).
|
||||
#
|
||||
# Copyright 1991 by the Massachusetts Institute of Technology
|
||||
#
|
||||
# Permission to use, copy, modify, distribute, and sell this software and its
|
||||
# documentation for any purpose is hereby granted without fee, provided that
|
||||
# the above copyright notice appear in all copies and that both that
|
||||
# copyright notice and this permission notice appear in supporting
|
||||
# documentation, and that the name of M.I.T. not be used in advertising or
|
||||
# publicity pertaining to distribution of the software without specific,
|
||||
# written prior permission. M.I.T. makes no representations about the
|
||||
# suitability of this software for any purpose. It is provided "as is"
|
||||
# without express or implied warranty.
|
||||
#
|
||||
# Calling this script install-sh is preferred over install.sh, to prevent
|
||||
# `make' implicit rules from creating a file called install from it
|
||||
# when there is no Makefile.
|
||||
#
|
||||
# This script is compatible with the BSD install script, but was written
|
||||
# from scratch. It can only install one file at a time, a restriction
|
||||
# shared with many OS's install programs.
|
||||
|
||||
|
||||
# set DOITPROG to echo to test this script
|
||||
|
||||
# Don't use :- since 4.3BSD and earlier shells don't like it.
|
||||
doit="${DOITPROG-}"
|
||||
|
||||
|
||||
# put in absolute paths if you don't have them in your path; or use env. vars.
|
||||
|
||||
mvprog="${MVPROG-mv}"
|
||||
cpprog="${CPPROG-cp}"
|
||||
chmodprog="${CHMODPROG-chmod}"
|
||||
chownprog="${CHOWNPROG-chown}"
|
||||
chgrpprog="${CHGRPPROG-chgrp}"
|
||||
stripprog="${STRIPPROG-strip}"
|
||||
rmprog="${RMPROG-rm}"
|
||||
mkdirprog="${MKDIRPROG-mkdir}"
|
||||
|
||||
transformbasename=""
|
||||
transform_arg=""
|
||||
instcmd="$mvprog"
|
||||
chmodcmd="$chmodprog 0755"
|
||||
chowncmd=""
|
||||
chgrpcmd=""
|
||||
stripcmd=""
|
||||
rmcmd="$rmprog -f"
|
||||
mvcmd="$mvprog"
|
||||
src=""
|
||||
dst=""
|
||||
dir_arg=""
|
||||
|
||||
while [ x"$1" != x ]; do
|
||||
case $1 in
|
||||
-c) instcmd="$cpprog"
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-d) dir_arg=true
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-m) chmodcmd="$chmodprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-o) chowncmd="$chownprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-g) chgrpcmd="$chgrpprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-s) stripcmd="$stripprog"
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
|
||||
shift
|
||||
continue;;
|
||||
|
||||
*) if [ x"$src" = x ]
|
||||
then
|
||||
src=$1
|
||||
else
|
||||
# this colon is to work around a 386BSD /bin/sh bug
|
||||
:
|
||||
dst=$1
|
||||
fi
|
||||
shift
|
||||
continue;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ x"$src" = x ]
|
||||
then
|
||||
echo "install: no input file specified"
|
||||
exit 1
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
||||
if [ x"$dir_arg" != x ]; then
|
||||
dst=$src
|
||||
src=""
|
||||
|
||||
if [ -d $dst ]; then
|
||||
instcmd=:
|
||||
else
|
||||
instcmd=mkdir
|
||||
fi
|
||||
else
|
||||
|
||||
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
|
||||
# might cause directories to be created, which would be especially bad
|
||||
# if $src (and thus $dsttmp) contains '*'.
|
||||
|
||||
if [ -f $src -o -d $src ]
|
||||
then
|
||||
true
|
||||
else
|
||||
echo "install: $src does not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ x"$dst" = x ]
|
||||
then
|
||||
echo "install: no destination specified"
|
||||
exit 1
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
||||
# If destination is a directory, append the input filename; if your system
|
||||
# does not like double slashes in filenames, you may need to add some logic
|
||||
|
||||
if [ -d $dst ]
|
||||
then
|
||||
dst="$dst"/`basename $src`
|
||||
else
|
||||
true
|
||||
fi
|
||||
fi
|
||||
|
||||
## this sed command emulates the dirname command
|
||||
dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
|
||||
|
||||
# Make sure that the destination directory exists.
|
||||
# this part is taken from Noah Friedman's mkinstalldirs script
|
||||
|
||||
# Skip lots of stat calls in the usual case.
|
||||
if [ ! -d "$dstdir" ]; then
|
||||
defaultIFS='
|
||||
'
|
||||
IFS="${IFS-${defaultIFS}}"
|
||||
|
||||
oIFS="${IFS}"
|
||||
# Some sh's can't handle IFS=/ for some reason.
|
||||
IFS='%'
|
||||
set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
|
||||
IFS="${oIFS}"
|
||||
|
||||
pathcomp=''
|
||||
|
||||
while [ $# -ne 0 ] ; do
|
||||
pathcomp="${pathcomp}${1}"
|
||||
shift
|
||||
|
||||
if [ ! -d "${pathcomp}" ] ;
|
||||
then
|
||||
$mkdirprog "${pathcomp}"
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
||||
pathcomp="${pathcomp}/"
|
||||
done
|
||||
fi
|
||||
|
||||
if [ x"$dir_arg" != x ]
|
||||
then
|
||||
$doit $instcmd $dst &&
|
||||
|
||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
|
||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
|
||||
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
|
||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
|
||||
else
|
||||
|
||||
# If we're going to rename the final executable, determine the name now.
|
||||
|
||||
if [ x"$transformarg" = x ]
|
||||
then
|
||||
dstfile=`basename $dst`
|
||||
else
|
||||
dstfile=`basename $dst $transformbasename |
|
||||
sed $transformarg`$transformbasename
|
||||
fi
|
||||
|
||||
# don't allow the sed command to completely eliminate the filename
|
||||
|
||||
if [ x"$dstfile" = x ]
|
||||
then
|
||||
dstfile=`basename $dst`
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
||||
# Make a temp file name in the proper directory.
|
||||
|
||||
dsttmp=$dstdir/#inst.$$#
|
||||
|
||||
# Move or copy the file name to the temp name
|
||||
|
||||
$doit $instcmd $src $dsttmp &&
|
||||
|
||||
trap "rm -f ${dsttmp}" 0 &&
|
||||
|
||||
# and set any options; do chmod last to preserve setuid bits
|
||||
|
||||
# If any of these fail, we abort the whole thing. If we want to
|
||||
# ignore errors from any of these, just make sure not to ignore
|
||||
# errors from the above "$doit $instcmd $src $dsttmp" command.
|
||||
|
||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
|
||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
|
||||
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
|
||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
|
||||
|
||||
# Now rename the file to the real destination.
|
||||
|
||||
$doit $rmcmd -f $dstdir/$dstfile &&
|
||||
$doit $mvcmd $dsttmp $dstdir/$dstfile
|
||||
|
||||
fi &&
|
||||
|
||||
|
||||
exit 0
|
||||
@@ -0,0 +1,67 @@
|
||||
#
|
||||
# FreeType 2 installation instructions for Unix systems
|
||||
#
|
||||
|
||||
|
||||
# Copyright 1996-2000 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
|
||||
# Unix installation and deinstallation targets.
|
||||
install: $(PROJECT_LIBRARY)
|
||||
$(MKINSTALLDIRS) $(libdir) \
|
||||
$(includedir)/freetype2/freetype/config \
|
||||
$(includedir)/freetype2/freetype/internal \
|
||||
$(includedir)/freetype2/freetype/cache \
|
||||
$(bindir)
|
||||
$(LIBTOOL) --mode=install $(INSTALL) $(PROJECT_LIBRARY) $(libdir)
|
||||
-for P in $(PUBLIC_H) ; do \
|
||||
$(INSTALL_DATA) $$P $(includedir)/freetype2/freetype ; \
|
||||
done
|
||||
-for P in $(BASE_H) ; do \
|
||||
$(INSTALL_DATA) $$P $(includedir)/freetype2/freetype/internal ; \
|
||||
done
|
||||
-for P in $(CONFIG_H) ; do \
|
||||
$(INSTALL_DATA) $$P $(includedir)/freetype2/freetype/config ; \
|
||||
done
|
||||
-for P in $(CACHE_H) ; do \
|
||||
$(INSTALL_DATA) $$P $(includedir)/freetype2/freetype/cache ; \
|
||||
done
|
||||
$(INSTALL_SCRIPT) -m 755 $(BUILD)/freetype-config \
|
||||
$(bindir)/freetype-config
|
||||
|
||||
|
||||
uninstall:
|
||||
-$(LIBTOOL) --mode=uninstall $(RM) $(libdir)/$(PROJECT_LIBRARY)
|
||||
-$(DELETE) $(includedir)/freetype2/freetype/cache/*
|
||||
-$(DELDIR) $(includedir)/freetype2/freetype/cache
|
||||
-$(DELETE) $(includedir)/freetype2/freetype/config/*
|
||||
-$(DELDIR) $(includedir)/freetype2/freetype/config
|
||||
-$(DELETE) $(includedir)/freetype2/freetype/internal/*
|
||||
-$(DELDIR) $(includedir)/freetype2/freetype/internal
|
||||
-$(DELETE) $(includedir)/freetype2/freetype/*
|
||||
-$(DELDIR) $(includedir)/freetype2/freetype
|
||||
-$(DELDIR) $(includedir)/freetype2
|
||||
-$(DELETE) $(bindir)/freetype-config
|
||||
|
||||
|
||||
# Unix cleaning and distclean rules.
|
||||
#
|
||||
clean_project_cygwin:
|
||||
-$(DELETE) $(BASE_OBJECTS) $(OBJ_M) $(OBJ_S)
|
||||
-$(DELETE) $(patsubst %.$O,%.$(SO),$(BASE_OBJECTS) $(OBJ_M) $(OBJ_S)) \
|
||||
$(CLEAN)
|
||||
|
||||
distclean_project_cygwin: clean_project_cygwin
|
||||
-$(DELETE) $(PROJECT_LIBRARY)
|
||||
-$(DELETE) $(OBJ_DIR)/.libs/*
|
||||
-$(DELDIR) $(OBJ_DIR)/.libs
|
||||
-$(DELETE) *.orig *~ core *.core $(DISTCLEAN)
|
||||
|
||||
# EOF
|
||||
@@ -0,0 +1,40 @@
|
||||
#! /bin/sh
|
||||
# mkinstalldirs --- make directory hierarchy
|
||||
# Author: Noah Friedman <[email protected]>
|
||||
# Created: 1993-05-16
|
||||
# Public domain
|
||||
|
||||
# $Id$
|
||||
|
||||
errstatus=0
|
||||
|
||||
for file
|
||||
do
|
||||
set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
|
||||
shift
|
||||
|
||||
pathcomp=
|
||||
for d
|
||||
do
|
||||
pathcomp="$pathcomp$d"
|
||||
case "$pathcomp" in
|
||||
-* ) pathcomp=./$pathcomp ;;
|
||||
esac
|
||||
|
||||
if test ! -d "$pathcomp"; then
|
||||
echo "mkdir $pathcomp" 1>&2
|
||||
|
||||
mkdir "$pathcomp" || lasterr=$?
|
||||
|
||||
if test ! -d "$pathcomp"; then
|
||||
errstatus=$lasterr
|
||||
fi
|
||||
fi
|
||||
|
||||
pathcomp="$pathcomp/"
|
||||
done
|
||||
done
|
||||
|
||||
exit $errstatus
|
||||
|
||||
# mkinstalldirs ends here
|
||||
@@ -0,0 +1,130 @@
|
||||
#
|
||||
# FreeType 2 host platform detection rules
|
||||
#
|
||||
|
||||
|
||||
# Copyright 1996-2000 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
|
||||
# This sub-Makefile is in charge of detecting the current platform. It sets
|
||||
# the following variables:
|
||||
#
|
||||
# BUILD The configuration and system-specific directory. Usually
|
||||
# `freetype/builds/$(PLATFORM)' but can be different for
|
||||
# custom builds of the library.
|
||||
#
|
||||
# The following variables must be defined in system specific `detect.mk'
|
||||
# files:
|
||||
#
|
||||
# PLATFORM The detected platform. This will default to `ansi' if
|
||||
# auto-detection fails.
|
||||
# CONFIG_FILE The configuration sub-makefile to use. This usually depends
|
||||
# on the compiler defined in the `CC' environment variable.
|
||||
# DELETE The shell command used to remove a given file.
|
||||
# COPY The shell command used to copy one file.
|
||||
# SEP The platform-specific directory separator.
|
||||
# CC The compiler to use.
|
||||
#
|
||||
# You need to set the following variable(s) before calling it:
|
||||
#
|
||||
# TOP The top-most directory in the FreeType library source
|
||||
# hierarchy. If not defined, it will default to `.'.
|
||||
|
||||
# If TOP is not defined, default it to `.'
|
||||
#
|
||||
ifndef TOP
|
||||
TOP := .
|
||||
endif
|
||||
|
||||
# Set auto-detection default to `ansi' resp. UNIX-like operating systems.
|
||||
# Note that we delay evaluation of $(BUILD_CONFIG_), $(BUILD), and
|
||||
# $(CONFIG_RULES).
|
||||
#
|
||||
PLATFORM := ansi
|
||||
DELETE := $(RM)
|
||||
COPY := cp
|
||||
SEP := /
|
||||
|
||||
BUILD_CONFIG_ = $(TOP)$(SEP)builds$(SEP)
|
||||
BUILD = $(BUILD_CONFIG_)$(PLATFORM)
|
||||
CONFIG_RULES = $(BUILD)$(SEP)$(CONFIG_FILE)
|
||||
|
||||
# We define the BACKSLASH variable to hold a single back-slash character.
|
||||
# This is needed because a line like
|
||||
#
|
||||
# SEP := \
|
||||
#
|
||||
# does not work with GNU Make (the backslash is interpreted as a line
|
||||
# continuation). While a line like
|
||||
#
|
||||
# SEP := \\
|
||||
#
|
||||
# really defines $(SEP) as `\' on Unix, and `\\' on Dos and Windows!
|
||||
#
|
||||
BACKSLASH := $(strip \ )
|
||||
|
||||
# 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.
|
||||
#
|
||||
include $(wildcard $(BUILD_CONFIG_)*/detect.mk)
|
||||
|
||||
# In case no detection rule file was successful, use the default.
|
||||
#
|
||||
ifndef CONFIG_FILE
|
||||
CONFIG_FILE := ansi.mk
|
||||
setup: std_setup
|
||||
endif
|
||||
|
||||
# The following targets are equivalent, with the exception that they use
|
||||
# a slightly different syntax for the `echo' command.
|
||||
#
|
||||
# std_setup: defined for most (i.e. Unix-like) platforms
|
||||
# dos_setup: defined for Dos-ish platforms like Dos, Windows & OS/2
|
||||
#
|
||||
.PHONY: std_setup dos_setup
|
||||
|
||||
std_setup:
|
||||
@echo ""
|
||||
@echo "$(PROJECT_TITLE) build system -- automatic system detection"
|
||||
@echo ""
|
||||
@echo "The following settings are used:"
|
||||
@echo ""
|
||||
@echo " platform $(PLATFORM)"
|
||||
@echo " compiler $(CC)"
|
||||
@echo " configuration directory $(BUILD)"
|
||||
@echo " configuration rules $(CONFIG_RULES)"
|
||||
@echo ""
|
||||
@echo "If this does not correspond to your system or settings please remove the file"
|
||||
@echo "\`$(CONFIG_MK)' from this directory then read the INSTALL file for help."
|
||||
@echo ""
|
||||
@echo "Otherwise, simply type \`make' again to build the library."
|
||||
@echo ""
|
||||
@$(COPY) $(CONFIG_RULES) $(CONFIG_MK)
|
||||
|
||||
dos_setup:
|
||||
@echo ÿ
|
||||
@echo $(PROJECT_TITLE) build system -- automatic system detection
|
||||
@echo ÿ
|
||||
@echo The following settings are used:
|
||||
@echo ÿ
|
||||
@echo ÿÿplatformÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ$(PLATFORM)
|
||||
@echo ÿÿcompilerÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ$(CC)
|
||||
@echo ÿÿconfiguration directoryÿÿÿÿÿÿ$(BUILD)
|
||||
@echo ÿÿconfiguration rulesÿÿÿÿÿÿÿÿÿÿ$(CONFIG_RULES)
|
||||
@echo ÿ
|
||||
@echo If this does not correspond to your system or settings please remove the file
|
||||
@echo '$(CONFIG_MK)' from this directory then read the INSTALL file for help.
|
||||
@echo ÿ
|
||||
@echo Otherwise, simply type 'make' again to build the library.
|
||||
@echo ÿ
|
||||
@$(COPY) $(subst /,\,$(CONFIG_RULES) $(CONFIG_MK)) > nul
|
||||
|
||||
# EOF
|
||||
@@ -0,0 +1,116 @@
|
||||
#
|
||||
# FreeType 2 configuration file to detect a DOS host platform.
|
||||
#
|
||||
|
||||
|
||||
# Copyright 1996-2000 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
|
||||
# Test for DJGPP by checking the DJGPP environment variable, which must be
|
||||
# set in order to use the system (ie. it will always be present when the
|
||||
# `make' utility is run).
|
||||
#
|
||||
ifeq ($(PLATFORM),ansi)
|
||||
|
||||
ifdef DJGPP
|
||||
# We are definitely using DJGPP
|
||||
PLATFORM := dos
|
||||
DELETE := del
|
||||
COPY := copy
|
||||
CONFIG_FILE := dos-gcc.mk
|
||||
SEP := /
|
||||
ifndef CC
|
||||
CC := gcc
|
||||
endif # test CC
|
||||
|
||||
setup : dos_setup
|
||||
|
||||
endif # test DJGPP
|
||||
endif # test PLATFORM
|
||||
|
||||
|
||||
|
||||
# We test for the COMSPEC environment variable, then run the `ver'
|
||||
# command-line program to see if its output contains the word `Dos'.
|
||||
#
|
||||
# If this is true, we are running a Dos-ish platform (or an emulation).
|
||||
#
|
||||
ifeq ($(PLATFORM),ansi)
|
||||
|
||||
ifdef COMSPEC
|
||||
#
|
||||
# We try to recognize a Cygwin session, in which case we're
|
||||
# certainly not running on DOS!
|
||||
#
|
||||
ifneq ($(OSTYPE),cygwin)
|
||||
is_dos := $(findstring Dos,$(shell ver))
|
||||
|
||||
# We try to recognize a Dos session under OS/2. The `ver' command
|
||||
# returns `Operating System/2 ...' there, so `is_dos' should be empty.
|
||||
#
|
||||
# To recognize a Dos session under OS/2, we check COMSPEC for the
|
||||
# substring `MDOS\COMMAND'
|
||||
#
|
||||
ifeq ($(is_dos),)
|
||||
is_dos := $(findstring MDOS\COMMAND,$(COMSPEC))
|
||||
endif
|
||||
endif # test Cygwin
|
||||
endif # test COMSPEC
|
||||
|
||||
ifneq ($(is_dos),)
|
||||
|
||||
PLATFORM := dos
|
||||
DELETE := del
|
||||
COPY := copy
|
||||
|
||||
# Use DJGPP (i.e. gcc) by default.
|
||||
#
|
||||
CONFIG_FILE := dos-gcc.mk
|
||||
SEP := /
|
||||
ifndef CC
|
||||
CC := gcc
|
||||
endif
|
||||
|
||||
# additionally, we provide hooks for various other compilers
|
||||
#
|
||||
ifneq ($(findstring turboc,$(MAKECMDGOALS)),) # Turbo C
|
||||
CONFIG_FILE := dos-tcc.mk
|
||||
SEP := $(BACKSLASH)
|
||||
CC := tcc
|
||||
.PHONY: turboc
|
||||
endif
|
||||
|
||||
ifneq ($(findstring watcom,$(MAKECMDGOALS)),) # Watcom C/C++
|
||||
CONFIG_FILE := dos-wat.mk
|
||||
SEP := $(BACKSLASH)
|
||||
CC := wcc386
|
||||
.PHONY: watcom
|
||||
endif
|
||||
|
||||
ifneq ($(findstring borlandc16,$(MAKECMDGOALS)),) # Borland C/C++ 16-bit
|
||||
CONFIG_FILE := dos-bcc.mk
|
||||
SEP := $(BACKSLASH)
|
||||
CC := bcc
|
||||
.PHONY: borlandc16
|
||||
endif
|
||||
|
||||
ifneq ($(findstring borlandc,$(MAKECMDGOALS)),) # Borland C/C++ 32-bit
|
||||
CONFIG_FILE := dos-bcc.mk
|
||||
SEP := $(BACKSLASH)
|
||||
CC := bcc32
|
||||
.PHONY: borlandc
|
||||
endif
|
||||
|
||||
setup: dos_setup
|
||||
|
||||
endif # test Dos
|
||||
endif # test PLATFORM
|
||||
|
||||
# EOF
|
||||
@@ -0,0 +1,83 @@
|
||||
#
|
||||
# FreeType 2 DOS specific definitions
|
||||
#
|
||||
|
||||
|
||||
# Copyright 1996-2000 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
|
||||
DELETE := del
|
||||
HOSTSEP := $(strip \ )
|
||||
BUILD := $(TOP)$(SEP)builds$(SEP)dos
|
||||
PLATFORM := dos
|
||||
|
||||
# except for DJGPP/GCC on Dos
|
||||
ifndef SEP
|
||||
SEP := $(HOSTSEP)
|
||||
endif
|
||||
|
||||
|
||||
# The directory where all object files are placed.
|
||||
#
|
||||
# This lets you build the library in your own directory with something like
|
||||
#
|
||||
# set TOP=.../path/to/freetype2/top/dir...
|
||||
# set OBJ_DIR=.../path/to/obj/dir
|
||||
# make -f %TOP%/Makefile setup [options]
|
||||
# make -f %TOP%/Makefile
|
||||
#
|
||||
ifndef OBJ_DIR
|
||||
OBJ_DIR := $(TOP)$(SEP)obj
|
||||
endif
|
||||
|
||||
|
||||
# The directory where all library files are placed.
|
||||
#
|
||||
# By default, this is the same as $(OBJ_DIR); however, this can be changed
|
||||
# to suit particular needs.
|
||||
#
|
||||
LIB_DIR := $(OBJ_DIR)
|
||||
|
||||
# The name of the final library file. Note that the DOS-specific Makefile
|
||||
# uses a shorter (8.3) name.
|
||||
#
|
||||
LIBRARY := $(PROJECT)
|
||||
|
||||
|
||||
# The NO_OUTPUT macro is used to ignore the output of commands.
|
||||
#
|
||||
NO_OUTPUT = &> nul
|
||||
|
||||
|
||||
ifdef BUILD_PROJECT
|
||||
|
||||
# Now include the main sub-makefile. It contains all the rules used to
|
||||
# build the library with the previous variables defined.
|
||||
#
|
||||
include $(TOP)/builds/$(PROJECT).mk
|
||||
|
||||
# The cleanup targets.
|
||||
#
|
||||
clean_project: clean_project_dos
|
||||
distclean_project: distclean_project_dos
|
||||
|
||||
# This final rule is used to link all object files into a single library.
|
||||
# It is part of the system-specific sub-Makefile because not all
|
||||
# librarians accept a simple syntax like
|
||||
#
|
||||
# librarian library_file {list of object files}
|
||||
#
|
||||
$(PROJECT_LIBRARY): $(OBJECTS_LIST)
|
||||
-$(CLEAN_LIBRARY) $(NO_OUTPUT)
|
||||
$(LINK_LIBRARY)
|
||||
|
||||
endif
|
||||
|
||||
# EOF
|
||||
@@ -0,0 +1,22 @@
|
||||
#
|
||||
# FreeType 2 configuration rules for the DJGPP compiler
|
||||
#
|
||||
|
||||
|
||||
# Copyright 1996-2000 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
|
||||
SEP := /
|
||||
CLEAN_LIBRARY := $(DELETE) $@
|
||||
|
||||
include $(TOP)/builds/compiler/gcc.mk
|
||||
include $(TOP)/builds/dos/dos-def.mk
|
||||
|
||||
# EOF
|
||||
@@ -0,0 +1,284 @@
|
||||
#
|
||||
# FreeType 2 library sub-Makefile
|
||||
#
|
||||
|
||||
|
||||
# Copyright 1996-2000 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
|
||||
# DO NOT INVOKE THIS MAKEFILE DIRECTLY! IT IS MEANT TO BE INCLUDED BY
|
||||
# OTHER MAKEFILES.
|
||||
|
||||
|
||||
# The following variables (set by other Makefile components, in the
|
||||
# environment, or on the command line) are used:
|
||||
#
|
||||
# BUILD The architecture dependent directory,
|
||||
# e.g. `$(TOP)/builds/unix'.
|
||||
#
|
||||
# OBJ_DIR The directory in which object files are created.
|
||||
#
|
||||
# LIB_DIR The directory in which the library is created.
|
||||
#
|
||||
# INCLUDES A list of directories to be included additionally.
|
||||
# Usually empty.
|
||||
#
|
||||
# CFLAGS Compilation flags. This overrides the default settings
|
||||
# in the platform-specific configuration files.
|
||||
#
|
||||
# FTSYS_SRC If set, its value is used as the name of a replacement
|
||||
# file for `src/base/ftsystem.c'.
|
||||
#
|
||||
# FTDEBUG_SRC If set, its value is used as the name of a replacement
|
||||
# file for `src/base/ftdebug.c'. [For a normal build, this
|
||||
# file does nothing.]
|
||||
#
|
||||
# FT_MODULE_LIST The file which contains the list of modules for the
|
||||
# current build. Usually, this is automatically created by
|
||||
# `modules.mk'.
|
||||
#
|
||||
# BASE_OBJ_S
|
||||
# BASE_OBJ_M A list of base objects (for single object and multiple
|
||||
# object builds, respectively). Set up in
|
||||
# `src/base/rules.mk'.
|
||||
#
|
||||
# BASE_EXT_OBJ A list of base extension objects. Set up in
|
||||
# `src/base/rules.mk'.
|
||||
#
|
||||
# DRV_OBJ_S
|
||||
# DRV_OBJ_M A list of driver objects (for single object and multiple
|
||||
# object builds, respectively). Set up cumulatively in
|
||||
# `src/<driver>/rules.mk'.
|
||||
#
|
||||
# CLEAN
|
||||
# DISTCLEAN The sub-makefiles can append additional stuff to these two
|
||||
# variables which is to be removed for the `clean' resp.
|
||||
# `distclean' target.
|
||||
#
|
||||
# TOP, SEP,
|
||||
# LIBRARY, CC,
|
||||
# A, I, O, T Check `config.mk' for details.
|
||||
|
||||
|
||||
# The targets `objects' and `library' are defined at the end of this
|
||||
# Makefile after all other rules have been included.
|
||||
#
|
||||
.PHONY: single objects library
|
||||
|
||||
# default target -- build single objects and library
|
||||
#
|
||||
single: objects library
|
||||
|
||||
# `multi' target -- build multiple objects and library
|
||||
#
|
||||
multi: objects library
|
||||
|
||||
|
||||
# The FreeType source directory, usually `./src'.
|
||||
#
|
||||
SRC := $(TOP)$(SEP)src
|
||||
|
||||
|
||||
# The directory where the base layer components are placed, usually
|
||||
# `./src/base'.
|
||||
#
|
||||
BASE_DIR := $(SRC)$(SEP)base
|
||||
|
||||
|
||||
# A few short-cuts in order to avoid typing $(SEP) all the time for the
|
||||
# directory separator.
|
||||
#
|
||||
# For example: $(SRC_) equals to `./src/' where `.' is $(TOP).
|
||||
#
|
||||
#
|
||||
SRC_ := $(SRC)$(SEP)
|
||||
BASE_ := $(BASE_DIR)$(SEP)
|
||||
OBJ_ := $(OBJ_DIR)$(SEP)
|
||||
LIB_ := $(LIB_DIR)$(SEP)
|
||||
PUBLIC_ := $(TOP)$(SEP)include$(SEP)freetype$(SEP)
|
||||
INTERNAL_ := $(PUBLIC_)internal$(SEP)
|
||||
CONFIG_ := $(PUBLIC_)config$(SEP)
|
||||
CACHE_ := $(PUBLIC_)cache$(SEP)
|
||||
|
||||
|
||||
# The final name of the library file.
|
||||
#
|
||||
PROJECT_LIBRARY := $(LIB_)$(LIBRARY).$A
|
||||
|
||||
|
||||
# include paths
|
||||
#
|
||||
# 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/builds/<system>' directory, as these
|
||||
# files will override the default sources.
|
||||
#
|
||||
INCLUDES := $(BUILD) $(TOP)$(SEP)include $(SRC)
|
||||
|
||||
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 `builds/<system>' directories;
|
||||
# debug/optimization/warning flags + ansi compliance if needed.
|
||||
#
|
||||
FT_CFLAGS = $(CFLAGS) $(INCLUDE_FLAGS)
|
||||
FT_CC = $(CC) $(FT_CFLAGS)
|
||||
FT_COMPILE = $(CC) $(ANSIFLAGS) $(FT_CFLAGS)
|
||||
|
||||
|
||||
# Include the `modules' rules file.
|
||||
#
|
||||
include $(TOP)/builds/modules.mk
|
||||
|
||||
|
||||
# Initialize the list of objects.
|
||||
#
|
||||
OBJECTS_LIST :=
|
||||
|
||||
|
||||
# Define $(PUBLIC_H) as the list of all public header files located in
|
||||
# `$(TOP)/include/freetype'. $(BASE_H), $(CACHE_H), and $(CONFIG_H) are
|
||||
# defined similarly.
|
||||
#
|
||||
# This is used to simplify the dependency rules -- if one of these files
|
||||
# changes, the whole library is recompiled.
|
||||
#
|
||||
PUBLIC_H := $(wildcard $(PUBLIC_)*.h)
|
||||
BASE_H := $(wildcard $(INTERNAL_)*.h)
|
||||
CONFIG_H := $(wildcard $(CONFIG_)*.h) \
|
||||
$(wildcard $(BUILD)$(SEP)freetype$(SEP)config$(SEP)*.h)
|
||||
CACHE_H := $(wildcard $(CACHE_)*.h)
|
||||
|
||||
FREETYPE_H := $(PUBLIC_H) $(BASE_H) $(CONFIG_H) $(CACHE_H)
|
||||
|
||||
|
||||
# ftsystem component
|
||||
#
|
||||
ifndef FTSYS_SRC
|
||||
FTSYS_SRC = $(BASE_)ftsystem.c
|
||||
endif
|
||||
|
||||
FTSYS_OBJ = $(OBJ_)ftsystem.$O
|
||||
|
||||
OBJECTS_LIST += $(FTSYS_OBJ)
|
||||
|
||||
$(FTSYS_OBJ): $(FTSYS_SRC) $(FREETYPE_H)
|
||||
$(FT_COMPILE) $T$@ $<
|
||||
|
||||
|
||||
# ftdebug component
|
||||
#
|
||||
ifndef FTDEBUG_SRC
|
||||
FTDEBUG_SRC = $(BASE_)ftdebug.c
|
||||
endif
|
||||
|
||||
FTDEBUG_OBJ = $(OBJ_)ftdebug.$O
|
||||
|
||||
OBJECTS_LIST += $(FTDEBUG_OBJ)
|
||||
|
||||
$(FTDEBUG_OBJ): $(FTDEBUG_SRC) $(FREETYPE_H)
|
||||
$(FT_COMPILE) $T$@ $<
|
||||
|
||||
|
||||
# Include all rule files from FreeType components.
|
||||
#
|
||||
include $(wildcard $(SRC)/*/rules.mk)
|
||||
|
||||
|
||||
# ftinit component
|
||||
#
|
||||
# The C source `ftinit.c' contains the FreeType initialization routines.
|
||||
# It is able to automatically register one or more drivers when the API
|
||||
# function FT_Init_FreeType() is called.
|
||||
#
|
||||
# The set of initial drivers is determined by the driver Makefiles
|
||||
# includes above. Each driver Makefile updates the FTINIT_xxx lists
|
||||
# which contain additional include paths and macros used to compile the
|
||||
# single `ftinit.c' source.
|
||||
#
|
||||
FTINIT_SRC := $(BASE_)ftinit.c
|
||||
FTINIT_OBJ := $(OBJ_)ftinit.$O
|
||||
|
||||
OBJECTS_LIST += $(FTINIT_OBJ)
|
||||
|
||||
$(FTINIT_OBJ): $(FTINIT_SRC) $(FREETYPE_H) $(FT_MODULE_LIST)
|
||||
$(FT_COMPILE) $T$@ $<
|
||||
|
||||
|
||||
# All FreeType library objects
|
||||
#
|
||||
# By default, we include the base layer extensions. These could be
|
||||
# omitted on builds which do not want them.
|
||||
#
|
||||
OBJ_M = $(BASE_OBJ_M) $(BASE_EXT_OBJ) $(DRV_OBJS_M)
|
||||
OBJ_S = $(BASE_OBJ_S) $(BASE_EXT_OBJ) $(DRV_OBJS_S)
|
||||
|
||||
|
||||
# The target `multi' on the Make command line indicates that we want to
|
||||
# compile each source file independently.
|
||||
#
|
||||
# Otherwise, each module/driver is compiled in a single object file through
|
||||
# source file inclusion (see `src/base/ftbase.c' or
|
||||
# `src/truetype/truetype.c' for examples).
|
||||
#
|
||||
BASE_OBJECTS := $(OBJECTS_LIST)
|
||||
|
||||
ifneq ($(findstring multi,$(MAKECMDGOALS)),)
|
||||
OBJECTS_LIST += $(OBJ_M)
|
||||
else
|
||||
OBJECTS_LIST += $(OBJ_S)
|
||||
endif
|
||||
|
||||
objects: $(OBJECTS_LIST)
|
||||
|
||||
library: $(PROJECT_LIBRARY)
|
||||
|
||||
.c.$O:
|
||||
$(FT_COMPILE) $T$@ $<
|
||||
|
||||
|
||||
# Standard cleaning and distclean rules. These are not accepted
|
||||
# on all systems though.
|
||||
#
|
||||
clean_project_std:
|
||||
-$(DELETE) $(BASE_OBJECTS) $(OBJ_M) $(OBJ_S) $(CLEAN)
|
||||
|
||||
distclean_project_std: clean_project_std
|
||||
-$(DELETE) $(PROJECT_LIBRARY)
|
||||
-$(DELETE) *.orig *~ core *.core $(DISTCLEAN)
|
||||
|
||||
# The Dos command shell does not support very long list of arguments, so
|
||||
# we are stuck with wildcards.
|
||||
#
|
||||
clean_project_dos:
|
||||
-$(DELETE) $(subst $(SEP),$(HOSTSEP),$(OBJ_))*.$O \
|
||||
$(CLEAN) $(NO_OUTPUT)
|
||||
|
||||
distclean_project_dos: clean_project_dos
|
||||
-$(DELETE) $(subst $(SEP),$(HOSTSEP),$(PROJECT_LIBRARY)) \
|
||||
$(DISTCLEAN) $(NO_OUTPUT)
|
||||
|
||||
# Remove configuration file (used for distclean).
|
||||
#
|
||||
remove_config_mk:
|
||||
-$(DELETE) $(subst $(SEP),$(HOSTSEP),$(CONFIG_MK)) $(NO_OUTPUT)
|
||||
|
||||
|
||||
# The `config.mk' file must define `clean_freetype' and
|
||||
# `distclean_freetype'. Implementations may use to relay these to either
|
||||
# the `std' or `dos' versions from above, or simply provide their own
|
||||
# implementation.
|
||||
#
|
||||
clean: clean_project
|
||||
distclean: distclean_project remove_config_mk
|
||||
|
||||
# EOF
|
||||
@@ -0,0 +1,39 @@
|
||||
#
|
||||
# Link instructions for Dos-like systems (Dos, Win32, OS/2)
|
||||
#
|
||||
|
||||
|
||||
# Copyright 1996-2000 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
|
||||
ifdef BUILD_PROJECT
|
||||
|
||||
# Now include the main sub-makefile. It contains all the rules used to
|
||||
# build the library with the previous variables defined.
|
||||
#
|
||||
include $(TOP)/builds/$(PROJECT).mk
|
||||
|
||||
# The cleanup targets.
|
||||
#
|
||||
clean_project: clean_project_dos
|
||||
distclean_project: distclean_project_dos
|
||||
|
||||
# This final rule is used to link all object files into a single library.
|
||||
# this is compiler-specific
|
||||
#
|
||||
$(PROJECT_LIBRARY): $(OBJECTS_LIST)
|
||||
ifdef CLEAN_LIBRARY
|
||||
-$(CLEAN_LIBRARY) $(NO_OUTPUT)
|
||||
endif
|
||||
$(LINK_LIBRARY)
|
||||
|
||||
endif
|
||||
|
||||
# EOF
|
||||
@@ -0,0 +1,39 @@
|
||||
#
|
||||
# Link instructions for standard systems
|
||||
#
|
||||
|
||||
|
||||
# Copyright 1996-2000 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
|
||||
ifdef BUILD_PROJECT
|
||||
|
||||
# Now include the main sub-makefile. It contains all the rules used to
|
||||
# build the library with the previous variables defined.
|
||||
#
|
||||
include $(TOP)/builds/$(PROJECT).mk
|
||||
|
||||
# The cleanup targets.
|
||||
#
|
||||
clean_project: clean_project_std
|
||||
distclean_project: distclean_project_std
|
||||
|
||||
# This final rule is used to link all object files into a single library.
|
||||
# this is compiler-specific
|
||||
#
|
||||
$(PROJECT_LIBRARY): $(OBJECTS_LIST)
|
||||
ifdef CLEAN_LIBRARY
|
||||
-$(CLEAN_LIBRARY) $(NO_OUTPUT)
|
||||
endif
|
||||
$(LINK_LIBRARY)
|
||||
|
||||
endif
|
||||
|
||||
# EOF
|
||||
@@ -0,0 +1,11 @@
|
||||
This folder contains supporting code and CodeWarrior Pro 4 project
|
||||
files to build the FreeType library.
|
||||
|
||||
Notes:
|
||||
The library will be built as a static lib in the obj/ folder.
|
||||
|
||||
Just van Rossum, <[email protected]>
|
||||
|
||||
DISCLAIMER: this subdirectory is *not* being maintained by the
|
||||
FreeType team, but by Just van Rossum. It's being released under
|
||||
the same terms as FreeType (see LICENSE.TXT).
|
||||
@@ -0,0 +1,76 @@
|
||||
#
|
||||
# FreeType 2 modules sub-Makefile
|
||||
#
|
||||
|
||||
|
||||
# Copyright 1996-2000 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
|
||||
# DO NOT INVOKE THIS MAKEFILE DIRECTLY! IT IS MEANT TO BE INCLUDED BY
|
||||
# OTHER MAKEFILES.
|
||||
|
||||
|
||||
# This file is in charge of handling the generation of the modules list
|
||||
# file.
|
||||
|
||||
.PHONY: make_module_list clean_module_list remake_module_list
|
||||
|
||||
# MODULE_LIST, as its name suggests, indicates where the modules list
|
||||
# resides. For now, it is in `include/freetype/config/ftmodule.h'.
|
||||
#
|
||||
ifndef MODULE_LIST
|
||||
MODULE_LIST := $(TOP)$(SEP)include$(SEP)$(PROJECT)$(SEP)config$(SEP)ftmodule.h
|
||||
endif
|
||||
|
||||
# To build the modules list, we invoke the `make_module_list' target.
|
||||
#
|
||||
# This rule is commented out by default since FreeType comes already with
|
||||
# a ftmodule.h file.
|
||||
#
|
||||
#$(MODULE_LIST): make_module_list
|
||||
|
||||
# Before the modules list file can be generated, we must remove the file in
|
||||
# order to `clean' the list.
|
||||
#
|
||||
clean_module_list:
|
||||
@-$(DELETE) $(subst $(SEP),$(HOSTSEP),$(MODULE_LIST))
|
||||
@-echo Regenerating the modules list in $(MODULE_LIST)...
|
||||
|
||||
make_module_list: clean_module_list
|
||||
@echo done.
|
||||
|
||||
|
||||
# Trailing spaces are protected with a `#' sign to avoid accidental
|
||||
# removing.
|
||||
#
|
||||
ifneq ($(findstring $(PLATFORM),dos win32 win16 os2),)
|
||||
OPEN_MODULE := @echo #
|
||||
CLOSE_MODULE := >> $(subst $(SEP),$(HOSTSEP),$(MODULE_LIST))
|
||||
else
|
||||
OPEN_MODULE := @echo "
|
||||
CLOSE_MODULE := " >> $(MODULE_LIST)
|
||||
endif
|
||||
|
||||
# $(OPEN_DRIVER) & $(CLOSE_DRIVER) are used to specify a given font driver
|
||||
# in the `module.mk' rules file.
|
||||
#
|
||||
OPEN_DRIVER := $(OPEN_MODULE)FT_USE_MODULE(
|
||||
CLOSE_DRIVER := )$(CLOSE_MODULE)
|
||||
|
||||
ECHO_DRIVER := @echo "* module: #
|
||||
ECHO_DRIVER_DESC := (
|
||||
ECHO_DRIVER_DONE := )"
|
||||
|
||||
# Each `module.mk' in the `src' sub-dirs is used to add one rule to the
|
||||
# target `make_module_list'.
|
||||
#
|
||||
include $(wildcard $(TOP)/src/*/module.mk)
|
||||
|
||||
# EOF
|
||||
@@ -0,0 +1,62 @@
|
||||
#
|
||||
# FreeType 2 configuration file to detect an OS/2 host platform.
|
||||
#
|
||||
|
||||
|
||||
# Copyright 1996-2000 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
|
||||
ifeq ($(PLATFORM),ansi)
|
||||
|
||||
ifdef OS2_SHELL
|
||||
|
||||
PLATFORM := os2
|
||||
COPY := copy
|
||||
DELETE := del
|
||||
|
||||
CONFIG_FILE := os2-gcc.mk # gcc-emx by default
|
||||
SEP := /
|
||||
|
||||
# additionally, we provide hooks for various other compilers
|
||||
#
|
||||
ifneq ($(findstring visualage,$(MAKECMDGOALS)),) # Visual Age C++
|
||||
CONFIG_FILE := os2-icc.mk
|
||||
SEP := $(BACKSLASH)
|
||||
CC := icc
|
||||
.PHONY: visualage
|
||||
endif
|
||||
|
||||
ifneq ($(findstring watcom,$(MAKECMDGOALS)),) # Watcom C/C++
|
||||
CONFIG_FILE := os2-wat.mk
|
||||
SEP := $(BACKSLASH)
|
||||
CC := wcc386
|
||||
.PHONY: watcom
|
||||
endif
|
||||
|
||||
ifneq ($(findstring borlandc,$(MAKECMDGOALS)),) # Borland C++ 32-bit
|
||||
CONFIG_FILE := os2-bcc.mk
|
||||
SEP := $(BACKSLASH)
|
||||
CC := bcc32
|
||||
.PHONY: borlandc
|
||||
endif
|
||||
|
||||
ifneq ($(findstring devel,$(MAKECMDGOALS)),) # development target
|
||||
CONFIG_FILE := os2-dev.mk
|
||||
CC := gcc
|
||||
SEP := /
|
||||
devel: setup
|
||||
endif
|
||||
|
||||
setup: dos_setup
|
||||
|
||||
endif # test OS2_SHELL
|
||||
endif # test PLATFORM
|
||||
|
||||
# EOF
|
||||
@@ -0,0 +1,83 @@
|
||||
#
|
||||
# FreeType 2 OS/2 specific definitions
|
||||
#
|
||||
|
||||
|
||||
# Copyright 1996-2000 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
|
||||
DELETE := del
|
||||
HOSTSEP := $(strip \ )
|
||||
BUILD := $(TOP)$(SEP)builds$(SEP)os2
|
||||
PLATFORM := os2
|
||||
|
||||
# except for GCC+emx on OS/2
|
||||
ifndef SEP
|
||||
SEP := $(HOSTSEP)
|
||||
endif
|
||||
|
||||
|
||||
# The directory where all object files are placed.
|
||||
#
|
||||
# This lets you build the library in your own directory with something like
|
||||
#
|
||||
# set TOP=.../path/to/freetype2/top/dir...
|
||||
# set OBJ_DIR=.../path/to/obj/dir
|
||||
# make -f %TOP%/Makefile setup [options]
|
||||
# make -f %TOP%/Makefile
|
||||
#
|
||||
ifndef OBJ_DIR
|
||||
OBJ_DIR := $(TOP)$(SEP)obj
|
||||
endif
|
||||
|
||||
|
||||
# The directory where all library files are placed.
|
||||
#
|
||||
# By default, this is the same as $(OBJ_DIR); however, this can be changed
|
||||
# to suit particular needs.
|
||||
#
|
||||
LIB_DIR := $(OBJ_DIR)
|
||||
|
||||
# The name of the final library file. Note that the DOS-specific Makefile
|
||||
# uses a shorter (8.3) name.
|
||||
#
|
||||
LIBRARY := $(PROJECT)
|
||||
|
||||
|
||||
# The NO_OUTPUT macro is used to ignore the output of commands.
|
||||
#
|
||||
NO_OUTPUT = 2> nul
|
||||
|
||||
|
||||
ifdef BUILD_LIBRARY
|
||||
|
||||
# Now include the main sub-makefile. It contains all the rules used to
|
||||
# build the library with the previous variables defined.
|
||||
#
|
||||
include $(TOP)/builds/$(PROJECT).mk
|
||||
|
||||
# The cleanup targets.
|
||||
#
|
||||
clean_project: clean_project_dos
|
||||
distclean_project: distclean_project_dos
|
||||
|
||||
# This final rule is used to link all object files into a single library.
|
||||
# It is part of the system-specific sub-Makefile because not all
|
||||
# librarians accept a simple syntax like
|
||||
#
|
||||
# librarian library_file {list of object files}
|
||||
#
|
||||
$(PROJECT_LIBRARY): $(OBJECTS_LIST)
|
||||
-$(CLEAN_LIBRARY) $(NO_OUTPUT)
|
||||
$(LINK_LIBRARY)
|
||||
|
||||
endif
|
||||
|
||||
# EOF
|
||||
@@ -0,0 +1,139 @@
|
||||
#
|
||||
# FreeType 2 configuration rules for OS/2 + gcc
|
||||
#
|
||||
# Development version without optimizations.
|
||||
#
|
||||
|
||||
|
||||
# Copyright 1996-2000 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
|
||||
ifndef TOP
|
||||
TOP := .
|
||||
endif
|
||||
|
||||
DELETE := del
|
||||
SEP := /
|
||||
HOSTSEP := $(strip \ )
|
||||
BUILD := $(TOP)/builds/os2
|
||||
PLATFORM := os2
|
||||
CC := gcc
|
||||
|
||||
|
||||
# The directory where all object files are placed.
|
||||
#
|
||||
# This lets you build the library in your own directory with something like
|
||||
#
|
||||
# set TOP=.../path/to/freetype2/top/dir...
|
||||
# set OBJ_DIR=.../path/to/obj/dir
|
||||
# make -f %TOP%/Makefile setup [options]
|
||||
# make -f %TOP%/Makefile
|
||||
#
|
||||
ifndef OBJ_DIR
|
||||
OBJ_DIR := $(TOP)$(SEP)obj
|
||||
endif
|
||||
|
||||
|
||||
# The directory where all library files are placed.
|
||||
#
|
||||
# By default, this is the same as $(OBJ_DIR); however, this can be changed
|
||||
# to suit particular needs.
|
||||
#
|
||||
LIB_DIR := $(OBJ_DIR)
|
||||
|
||||
|
||||
# The object file extension (for standard and static libraries). This can be
|
||||
# .o, .tco, .obj, etc., depending on the platform.
|
||||
#
|
||||
O := o
|
||||
SO := o
|
||||
|
||||
# The library file extension (for standard and static libraries). This can
|
||||
# be .a, .lib, etc., depending on the platform.
|
||||
#
|
||||
A := a
|
||||
SA := a
|
||||
|
||||
|
||||
# The name of the final library file. Note that the DOS-specific Makefile
|
||||
# uses a shorter (8.3) name.
|
||||
#
|
||||
LIBRARY := lib$(PROJECT)
|
||||
|
||||
|
||||
# Path inclusion flag. Some compilers use a different flag than `-I' to
|
||||
# specify an additional include path. Examples are `/i=' or `-J'.
|
||||
#
|
||||
I := -I
|
||||
|
||||
|
||||
# C flag used to define a macro before the compilation of a given source
|
||||
# object. Usually it is `-D' like in `-DDEBUG'.
|
||||
#
|
||||
D := -D
|
||||
|
||||
|
||||
# The link flag used to specify a given library file on link. Note that
|
||||
# this is only used to compile the demo programs, not the library itself.
|
||||
#
|
||||
L := -l
|
||||
|
||||
|
||||
# Target flag.
|
||||
#
|
||||
T := -o$(space)
|
||||
|
||||
|
||||
# C flags
|
||||
#
|
||||
# These should concern: debug output, optimization & warnings.
|
||||
#
|
||||
# Use the ANSIFLAGS variable to define the compiler flags used to enfore
|
||||
# ANSI compliance.
|
||||
#
|
||||
ifndef CFLAGS
|
||||
CFLAGS := -c -g -O0 -Wall
|
||||
endif
|
||||
|
||||
# ANSIFLAGS: Put there the flags used to make your compiler ANSI-compliant.
|
||||
#
|
||||
ANSIFLAGS := -ansi -pedantic
|
||||
|
||||
|
||||
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)/builds/freetype.mk
|
||||
|
||||
# The cleanup targets.
|
||||
#
|
||||
clean_freetype: clean_freetype_dos
|
||||
distclean_freetype: distclean_freetype_dos
|
||||
|
||||
# Librarian to use to build the static library
|
||||
#
|
||||
FT_LIBRARIAN := $(AR) -r
|
||||
|
||||
|
||||
# This final rule is used to link all object files into a single library.
|
||||
# It is part of the system-specific sub-Makefile because not all
|
||||
# librarians accept a simple syntax like
|
||||
#
|
||||
# librarian library_file {list of object files}
|
||||
#
|
||||
$(FT_LIBRARY): $(OBJECTS_LIST)
|
||||
-$(DELETE) $(subst $(SEP),$(HOSTSEP),$(FT_LIBRARY)) 2> nul
|
||||
$(FT_LIBRARIAN) $@ $(OBJECTS_LIST)
|
||||
|
||||
endif
|
||||
|
||||
# EOF
|
||||
@@ -0,0 +1,138 @@
|
||||
#
|
||||
# FreeType 2 configuration rules for OS/2 + gcc
|
||||
#
|
||||
|
||||
|
||||
# Copyright 1996-2000 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
|
||||
ifndef TOP
|
||||
TOP := .
|
||||
endif
|
||||
|
||||
DELETE := del
|
||||
SEP := /
|
||||
HOSTSEP := $(strip \ )
|
||||
BUILD := $(TOP)/builds/os2
|
||||
PLATFORM := os2
|
||||
CC := gcc
|
||||
|
||||
|
||||
# The directory where all object files are placed.
|
||||
#
|
||||
# This lets you build the library in your own directory with something like
|
||||
#
|
||||
# set TOP=.../path/to/freetype2/top/dir...
|
||||
# set OBJ_DIR=.../path/to/obj/dir
|
||||
# make -f %TOP%Makefile setup [options]
|
||||
# make -f %TOP%Makefile
|
||||
#
|
||||
ifndef OBJ_DIR
|
||||
OBJ_DIR := $(TOP)$(SEP)obj
|
||||
endif
|
||||
|
||||
|
||||
# The directory where all library files are placed.
|
||||
#
|
||||
# By default, this is the same as $(OBJ_DIR); however, this can be changed
|
||||
# to suit particular needs.
|
||||
#
|
||||
LIB_DIR := $(OBJ_DIR)
|
||||
|
||||
|
||||
# The object file extension (for standard and static libraries). This can be
|
||||
# .o, .tco, .obj, etc., depending on the platform.
|
||||
#
|
||||
O := o
|
||||
SO := o
|
||||
|
||||
|
||||
# The library file extension (for standard and static libraries). This can
|
||||
# be .a, .lib, etc., depending on the platform.
|
||||
#
|
||||
A := a
|
||||
SA := a
|
||||
|
||||
|
||||
# The name of the final library file. Note that the DOS-specific Makefile
|
||||
# uses a shorter (8.3) name.
|
||||
#
|
||||
LIBRARY := lib$(PROJECT)
|
||||
|
||||
|
||||
# Path inclusion flag. Some compilers use a different flag than `-I' to
|
||||
# specify an additional include path. Examples are `/i=' or `-J'.
|
||||
#
|
||||
I := -I
|
||||
|
||||
|
||||
# C flag used to define a macro before the compilation of a given source
|
||||
# object. Usually it is `-D' like in `-DDEBUG'.
|
||||
#
|
||||
D := -D
|
||||
|
||||
|
||||
# The link flag used to specify a given library file on link. Note that
|
||||
# this is only used to compile the demo programs, not the library itself.
|
||||
#
|
||||
L := -l
|
||||
|
||||
|
||||
# Target flag.
|
||||
#
|
||||
T := -o$(space)
|
||||
|
||||
|
||||
# C flags
|
||||
#
|
||||
# These should concern: debug output, optimization & warnings.
|
||||
#
|
||||
# Use the ANSIFLAGS variable to define the compiler flags used to enfore
|
||||
# ANSI compliance.
|
||||
#
|
||||
ifndef CFLAGS
|
||||
CFLAGS := -c -g -O6 -Wall
|
||||
endif
|
||||
|
||||
# ANSIFLAGS: Put there the flags used to make your compiler ANSI-compliant.
|
||||
#
|
||||
ANSIFLAGS := -ansi -pedantic
|
||||
|
||||
|
||||
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)/builds/freetype.mk
|
||||
|
||||
# The cleanup targets.
|
||||
#
|
||||
clean_freetype: clean_freetype_dos
|
||||
distclean_freetype: distclean_freetype_dos
|
||||
|
||||
# Librarian to use to build the static library
|
||||
#
|
||||
FT_LIBRARIAN := $(AR) -r
|
||||
|
||||
|
||||
# This final rule is used to link all object files into a single library.
|
||||
# It is part of the system-specific sub-Makefile because not all
|
||||
# librarians accept a simple syntax like
|
||||
#
|
||||
# librarian library_file {list of object files}
|
||||
#
|
||||
$(FT_LIBRARY): $(OBJECTS_LIST)
|
||||
-$(DELETE) $(subst $(SEP),$(HOSTSEP),$(FT_LIBRARY)) 2> nul
|
||||
$(FT_LIBRARIAN) $@ $(OBJECTS_LIST)
|
||||
|
||||
endif
|
||||
|
||||
# EOF
|
||||
@@ -0,0 +1,124 @@
|
||||
#
|
||||
# FreeType build system -- top-level sub-Makefile
|
||||
#
|
||||
|
||||
|
||||
# Copyright 1996-2000 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
|
||||
# This file is designed for GNU Make, do not use it with another Make tool!
|
||||
#
|
||||
# It works as follows:
|
||||
#
|
||||
# - When invoked for the first time, this Makefile will include the rules
|
||||
# found in `PROJECT/builds/detect.mk'. They are in charge of detecting
|
||||
# the current platform.
|
||||
#
|
||||
# A summary of the detection will be displayed, and the file `config.mk'
|
||||
# will be created in the current directory.
|
||||
#
|
||||
# - When invoked later, this Makefile will include the rules found in
|
||||
# `config.mk'. This sub-Makefile will define some system-specific
|
||||
# variables (like compiler, compilation flags, object suffix, etc.), then
|
||||
# include the rules found in `PROJECT/builds/PROJECT.mk', used to build
|
||||
# the library.
|
||||
#
|
||||
# See the comments in `builds/detect.mk' and `builds/PROJECT.mk' for more
|
||||
# details on host platform detection and library builds.
|
||||
|
||||
|
||||
.PHONY: setup distclean
|
||||
|
||||
# The `space' variable is used to avoid trailing spaces in defining the
|
||||
# `T' variable later.
|
||||
#
|
||||
empty :=
|
||||
space := $(empty) $(empty)
|
||||
|
||||
|
||||
ifndef CONFIG_MK
|
||||
CONFIG_MK := config.mk
|
||||
endif
|
||||
|
||||
# If no configuration sub-makefile is present, or if `setup' is the target
|
||||
# to be built, run the auto-detection rules to figure out which
|
||||
# configuration rules file to use.
|
||||
#
|
||||
# Note that the configuration file is put in the current directory, which is
|
||||
# not necessarily $(TOP).
|
||||
|
||||
# If `config.mk' is not present, set `check_platform'.
|
||||
#
|
||||
ifeq ($(wildcard $(CONFIG_MK)),)
|
||||
check_platform := 1
|
||||
endif
|
||||
|
||||
# If `setup' is one of the targets requested, set `check_platform'.
|
||||
#
|
||||
ifneq ($(findstring setup,$(MAKECMDGOALS)),)
|
||||
check_platform := 1
|
||||
endif
|
||||
|
||||
# Include the automatic host platform detection rules when we need to
|
||||
# check the platform.
|
||||
#
|
||||
ifdef check_platform
|
||||
|
||||
all: setup
|
||||
|
||||
ifdef USE_MODULES
|
||||
# If the module list $(MODULE_LIST) file is not present, generate it.
|
||||
#
|
||||
#modules: make_module_list setup
|
||||
endif
|
||||
|
||||
include $(TOP)/builds/detect.mk
|
||||
|
||||
ifdef USE_MODULES
|
||||
include $(TOP)/builds/modules.mk
|
||||
|
||||
ifeq ($(wildcard $(MODULE_LIST)),)
|
||||
setup: make_module_list
|
||||
endif
|
||||
endif
|
||||
|
||||
# This rule makes sense for Unix only to remove files created by a run
|
||||
# of the configure script which hasn't been successful (so that no
|
||||
# `config.mk' has been created). It uses the built-in $(RM) command of
|
||||
# GNU make.
|
||||
#
|
||||
distclean:
|
||||
$(RM) builds/unix/config.cache
|
||||
$(RM) builds/unix/config.log
|
||||
$(RM) builds/unix/config.status
|
||||
$(RM) builds/unix/unix-def.mk
|
||||
$(RM) builds/unix/unix-cc.mk
|
||||
|
||||
# IMPORTANT:
|
||||
#
|
||||
# `setup' must be defined by the host platform detection rules to create
|
||||
# the `config.mk' file in the current directory.
|
||||
|
||||
else
|
||||
|
||||
# A configuration sub-Makefile is present -- simply run it.
|
||||
#
|
||||
all: single
|
||||
|
||||
ifdef USE_MODULES
|
||||
modules: make_module_list
|
||||
endif
|
||||
|
||||
BUILD_PROJECT := yes
|
||||
include $(CONFIG_MK)
|
||||
|
||||
endif # test check_platform
|
||||
|
||||
# EOF
|
||||
@@ -0,0 +1,8 @@
|
||||
unix-def.mk
|
||||
unix-cc.mk
|
||||
config.status
|
||||
config.cache
|
||||
config.log
|
||||
libtool
|
||||
ftconfig.h
|
||||
freetype-config
|
||||
@@ -0,0 +1,458 @@
|
||||
## FreeType specific autoconf tests
|
||||
|
||||
AC_DEFUN(FT_MUNMAP_DECL,
|
||||
[AC_MSG_CHECKING([whether munmap must be declared])
|
||||
AC_CACHE_VAL(ft_cv_munmap_decl,
|
||||
[AC_TRY_COMPILE([
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include <sys/mman.h>],
|
||||
[char *(*pfn) = (char *(*))munmap],
|
||||
ft_cv_munmap_decl=no,
|
||||
ft_cv_munmap_decl=yes)])
|
||||
AC_MSG_RESULT($ft_cv_munmap_decl)
|
||||
if test $ft_cv_munmap_decl = yes; then
|
||||
AC_DEFINE(NEED_MUNMAP_DECL)
|
||||
fi])
|
||||
|
||||
AC_DEFUN(FT_MUNMAP_PARAM,
|
||||
[AC_MSG_CHECKING([for munmap's first parameter type])
|
||||
AC_TRY_COMPILE([
|
||||
#include <unistd.h>
|
||||
#include <sys/mman.h>
|
||||
int munmap(void *, size_t);],,
|
||||
AC_MSG_RESULT([void *]);AC_DEFINE(MUNMAP_USES_VOIDP),
|
||||
AC_MSG_RESULT([char *]))
|
||||
])
|
||||
|
||||
## libtool.m4 - Configure libtool for the target system. -*-Shell-script-*-
|
||||
## Copyright (C) 1996-1999 Free Software Foundation, Inc.
|
||||
## Originally by Gordon Matzigkeit <[email protected]>, 1996
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published by
|
||||
## the Free Software Foundation; either version 2 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but
|
||||
## WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
## General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program; if not, write to the Free Software
|
||||
## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
##
|
||||
## As a special exception to the GNU General Public License, if you
|
||||
## distribute this file as part of a program that contains a
|
||||
## configuration script generated by Autoconf, you may include it under
|
||||
## the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# serial 40 AC_PROG_LIBTOOL
|
||||
AC_DEFUN(AC_PROG_LIBTOOL,
|
||||
[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
|
||||
|
||||
# Save cache, so that ltconfig can load it
|
||||
AC_CACHE_SAVE
|
||||
|
||||
# Actually configure libtool. ac_aux_dir is where install-sh is found.
|
||||
CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
|
||||
LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
|
||||
LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \
|
||||
DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \
|
||||
${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
|
||||
$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $lt_target \
|
||||
|| AC_MSG_ERROR([libtool configure failed])
|
||||
|
||||
# Reload cache, that may have been modified by ltconfig
|
||||
AC_CACHE_LOAD
|
||||
|
||||
# This can be used to rebuild libtool when needed
|
||||
LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh"
|
||||
|
||||
# Always use our own libtool.
|
||||
LIBTOOL='$(SHELL) $(top_builddir)/libtool'
|
||||
AC_SUBST(LIBTOOL)dnl
|
||||
|
||||
# Redirect the config.log output again, so that the ltconfig log is not
|
||||
# clobbered by the next message.
|
||||
exec 5>>./config.log
|
||||
])
|
||||
|
||||
AC_DEFUN(AC_LIBTOOL_SETUP,
|
||||
[AC_PREREQ(2.13)dnl
|
||||
AC_REQUIRE([AC_ENABLE_SHARED])dnl
|
||||
AC_REQUIRE([AC_ENABLE_STATIC])dnl
|
||||
AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
|
||||
AC_REQUIRE([AC_CANONICAL_HOST])dnl
|
||||
AC_REQUIRE([AC_CANONICAL_BUILD])dnl
|
||||
AC_REQUIRE([AC_PROG_RANLIB])dnl
|
||||
AC_REQUIRE([AC_PROG_CC])dnl
|
||||
AC_REQUIRE([AC_PROG_LD])dnl
|
||||
AC_REQUIRE([AC_PROG_NM])dnl
|
||||
AC_REQUIRE([AC_PROG_LN_S])dnl
|
||||
dnl
|
||||
|
||||
case "$target" in
|
||||
NONE) lt_target="$host" ;;
|
||||
*) lt_target="$target" ;;
|
||||
esac
|
||||
|
||||
# Check for any special flags to pass to ltconfig.
|
||||
libtool_flags="--cache-file=$cache_file"
|
||||
test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
|
||||
test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
|
||||
test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install"
|
||||
test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
|
||||
test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
|
||||
ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN],
|
||||
[libtool_flags="$libtool_flags --enable-dlopen"])
|
||||
ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
|
||||
[libtool_flags="$libtool_flags --enable-win32-dll"])
|
||||
AC_ARG_ENABLE(libtool-lock,
|
||||
[ --disable-libtool-lock avoid locking (might break parallel builds)])
|
||||
test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock"
|
||||
test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
|
||||
|
||||
# Some flags need to be propagated to the compiler or linker for good
|
||||
# libtool support.
|
||||
case "$lt_target" in
|
||||
*-*-irix6*)
|
||||
# Find out which ABI we are using.
|
||||
echo '[#]line __oline__ "configure"' > conftest.$ac_ext
|
||||
if AC_TRY_EVAL(ac_compile); then
|
||||
case "`/usr/bin/file conftest.o`" in
|
||||
*32-bit*)
|
||||
LD="${LD-ld} -32"
|
||||
;;
|
||||
*N32*)
|
||||
LD="${LD-ld} -n32"
|
||||
;;
|
||||
*64-bit*)
|
||||
LD="${LD-ld} -64"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
rm -rf conftest*
|
||||
;;
|
||||
|
||||
*-*-sco3.2v5*)
|
||||
# On SCO OpenServer 5, we need -belf to get full-featured binaries.
|
||||
SAVE_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS -belf"
|
||||
AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
|
||||
[AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])])
|
||||
if test x"$lt_cv_cc_needs_belf" != x"yes"; then
|
||||
# this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
|
||||
CFLAGS="$SAVE_CFLAGS"
|
||||
fi
|
||||
;;
|
||||
|
||||
ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
|
||||
[*-*-cygwin* | *-*-mingw*)
|
||||
AC_CHECK_TOOL(DLLTOOL, dlltool, false)
|
||||
AC_CHECK_TOOL(AS, as, false)
|
||||
AC_CHECK_TOOL(OBJDUMP, objdump, false)
|
||||
;;
|
||||
])
|
||||
esac
|
||||
])
|
||||
|
||||
# AC_LIBTOOL_DLOPEN - enable checks for dlopen support
|
||||
AC_DEFUN(AC_LIBTOOL_DLOPEN, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])])
|
||||
|
||||
# AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's
|
||||
AC_DEFUN(AC_LIBTOOL_WIN32_DLL, [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])])
|
||||
|
||||
# AC_ENABLE_SHARED - implement the --enable-shared flag
|
||||
# Usage: AC_ENABLE_SHARED[(DEFAULT)]
|
||||
# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
|
||||
# `yes'.
|
||||
AC_DEFUN(AC_ENABLE_SHARED, [dnl
|
||||
define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
|
||||
AC_ARG_ENABLE(shared,
|
||||
changequote(<<, >>)dnl
|
||||
<< --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
|
||||
changequote([, ])dnl
|
||||
[p=${PACKAGE-default}
|
||||
case "$enableval" in
|
||||
yes) enable_shared=yes ;;
|
||||
no) enable_shared=no ;;
|
||||
*)
|
||||
enable_shared=no
|
||||
# Look at the argument we got. We use all the common list separators.
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
|
||||
for pkg in $enableval; do
|
||||
if test "X$pkg" = "X$p"; then
|
||||
enable_shared=yes
|
||||
fi
|
||||
done
|
||||
IFS="$ac_save_ifs"
|
||||
;;
|
||||
esac],
|
||||
enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
|
||||
])
|
||||
|
||||
# AC_DISABLE_SHARED - set the default shared flag to --disable-shared
|
||||
AC_DEFUN(AC_DISABLE_SHARED, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
|
||||
AC_ENABLE_SHARED(no)])
|
||||
|
||||
# AC_ENABLE_STATIC - implement the --enable-static flag
|
||||
# Usage: AC_ENABLE_STATIC[(DEFAULT)]
|
||||
# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
|
||||
# `yes'.
|
||||
AC_DEFUN(AC_ENABLE_STATIC, [dnl
|
||||
define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
|
||||
AC_ARG_ENABLE(static,
|
||||
changequote(<<, >>)dnl
|
||||
<< --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
|
||||
changequote([, ])dnl
|
||||
[p=${PACKAGE-default}
|
||||
case "$enableval" in
|
||||
yes) enable_static=yes ;;
|
||||
no) enable_static=no ;;
|
||||
*)
|
||||
enable_static=no
|
||||
# Look at the argument we got. We use all the common list separators.
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
|
||||
for pkg in $enableval; do
|
||||
if test "X$pkg" = "X$p"; then
|
||||
enable_static=yes
|
||||
fi
|
||||
done
|
||||
IFS="$ac_save_ifs"
|
||||
;;
|
||||
esac],
|
||||
enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
|
||||
])
|
||||
|
||||
# AC_DISABLE_STATIC - set the default static flag to --disable-static
|
||||
AC_DEFUN(AC_DISABLE_STATIC, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
|
||||
AC_ENABLE_STATIC(no)])
|
||||
|
||||
|
||||
# AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag
|
||||
# Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)]
|
||||
# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
|
||||
# `yes'.
|
||||
AC_DEFUN(AC_ENABLE_FAST_INSTALL, [dnl
|
||||
define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
|
||||
AC_ARG_ENABLE(fast-install,
|
||||
changequote(<<, >>)dnl
|
||||
<< --enable-fast-install[=PKGS] optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT],
|
||||
changequote([, ])dnl
|
||||
[p=${PACKAGE-default}
|
||||
case "$enableval" in
|
||||
yes) enable_fast_install=yes ;;
|
||||
no) enable_fast_install=no ;;
|
||||
*)
|
||||
enable_fast_install=no
|
||||
# Look at the argument we got. We use all the common list separators.
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
|
||||
for pkg in $enableval; do
|
||||
if test "X$pkg" = "X$p"; then
|
||||
enable_fast_install=yes
|
||||
fi
|
||||
done
|
||||
IFS="$ac_save_ifs"
|
||||
;;
|
||||
esac],
|
||||
enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl
|
||||
])
|
||||
|
||||
# AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install
|
||||
AC_DEFUN(AC_DISABLE_FAST_INSTALL, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
|
||||
AC_ENABLE_FAST_INSTALL(no)])
|
||||
|
||||
# AC_PROG_LD - find the path to the GNU or non-GNU linker
|
||||
AC_DEFUN(AC_PROG_LD,
|
||||
[AC_ARG_WITH(gnu-ld,
|
||||
[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
|
||||
test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
|
||||
AC_REQUIRE([AC_PROG_CC])dnl
|
||||
AC_REQUIRE([AC_CANONICAL_HOST])dnl
|
||||
AC_REQUIRE([AC_CANONICAL_BUILD])dnl
|
||||
ac_prog=ld
|
||||
if test "$ac_cv_prog_gcc" = yes; then
|
||||
# Check if gcc -print-prog-name=ld gives a path.
|
||||
AC_MSG_CHECKING([for ld used by GCC])
|
||||
ac_prog=`($CC -print-prog-name=ld) 2>&5`
|
||||
case "$ac_prog" in
|
||||
# Accept absolute paths.
|
||||
changequote(,)dnl
|
||||
[\\/]* | [A-Za-z]:[\\/]*)
|
||||
re_direlt='/[^/][^/]*/\.\./'
|
||||
changequote([,])dnl
|
||||
# Canonicalize the path of ld
|
||||
ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
|
||||
while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
|
||||
ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
|
||||
done
|
||||
test -z "$LD" && LD="$ac_prog"
|
||||
;;
|
||||
"")
|
||||
# If it fails, then pretend we aren't using GCC.
|
||||
ac_prog=ld
|
||||
;;
|
||||
*)
|
||||
# If it is relative, then search for the first ld in PATH.
|
||||
with_gnu_ld=unknown
|
||||
;;
|
||||
esac
|
||||
elif test "$with_gnu_ld" = yes; then
|
||||
AC_MSG_CHECKING([for GNU ld])
|
||||
else
|
||||
AC_MSG_CHECKING([for non-GNU ld])
|
||||
fi
|
||||
AC_CACHE_VAL(ac_cv_path_LD,
|
||||
[if test -z "$LD"; then
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
|
||||
for ac_dir in $PATH; do
|
||||
test -z "$ac_dir" && ac_dir=.
|
||||
if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
|
||||
ac_cv_path_LD="$ac_dir/$ac_prog"
|
||||
# Check to see if the program is GNU ld. I'd rather use --version,
|
||||
# but apparently some GNU ld's only accept -v.
|
||||
# Break only if it was the GNU/non-GNU ld that we prefer.
|
||||
if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
|
||||
test "$with_gnu_ld" != no && break
|
||||
else
|
||||
test "$with_gnu_ld" != yes && break
|
||||
fi
|
||||
fi
|
||||
done
|
||||
IFS="$ac_save_ifs"
|
||||
else
|
||||
ac_cv_path_LD="$LD" # Let the user override the test with a path.
|
||||
fi])
|
||||
LD="$ac_cv_path_LD"
|
||||
if test -n "$LD"; then
|
||||
AC_MSG_RESULT($LD)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
|
||||
AC_PROG_LD_GNU
|
||||
])
|
||||
|
||||
AC_DEFUN(AC_PROG_LD_GNU,
|
||||
[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
|
||||
[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
|
||||
if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
|
||||
ac_cv_prog_gnu_ld=yes
|
||||
else
|
||||
ac_cv_prog_gnu_ld=no
|
||||
fi])
|
||||
])
|
||||
|
||||
# AC_PROG_NM - find the path to a BSD-compatible name lister
|
||||
AC_DEFUN(AC_PROG_NM,
|
||||
[AC_MSG_CHECKING([for BSD-compatible nm])
|
||||
AC_CACHE_VAL(ac_cv_path_NM,
|
||||
[if test -n "$NM"; then
|
||||
# Let the user override the test.
|
||||
ac_cv_path_NM="$NM"
|
||||
else
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
|
||||
for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
|
||||
test -z "$ac_dir" && ac_dir=.
|
||||
if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext ; then
|
||||
# Check to see if the nm accepts a BSD-compat flag.
|
||||
# Adding the `sed 1q' prevents false positives on HP-UX, which says:
|
||||
# nm: unknown option "B" ignored
|
||||
if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
|
||||
ac_cv_path_NM="$ac_dir/nm -B"
|
||||
break
|
||||
elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
|
||||
ac_cv_path_NM="$ac_dir/nm -p"
|
||||
break
|
||||
else
|
||||
ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but
|
||||
continue # so that we can try to find one that supports BSD flags
|
||||
fi
|
||||
fi
|
||||
done
|
||||
IFS="$ac_save_ifs"
|
||||
test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
|
||||
fi])
|
||||
NM="$ac_cv_path_NM"
|
||||
AC_MSG_RESULT([$NM])
|
||||
])
|
||||
|
||||
# AC_CHECK_LIBM - check for math library
|
||||
AC_DEFUN(AC_CHECK_LIBM,
|
||||
[AC_REQUIRE([AC_CANONICAL_HOST])dnl
|
||||
LIBM=
|
||||
case "$lt_target" in
|
||||
*-*-beos* | *-*-cygwin*)
|
||||
# These system don't have libm
|
||||
;;
|
||||
*-ncr-sysv4.3*)
|
||||
AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
|
||||
AC_CHECK_LIB(m, main, LIBM="$LIBM -lm")
|
||||
;;
|
||||
*)
|
||||
AC_CHECK_LIB(m, main, LIBM="-lm")
|
||||
;;
|
||||
esac
|
||||
])
|
||||
|
||||
# AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for
|
||||
# the libltdl convenience library, adds --enable-ltdl-convenience to
|
||||
# the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor
|
||||
# is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed
|
||||
# to be `${top_builddir}/libltdl'. Make sure you start DIR with
|
||||
# '${top_builddir}/' (note the single quotes!) if your package is not
|
||||
# flat, and, if you're not using automake, define top_builddir as
|
||||
# appropriate in the Makefiles.
|
||||
AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
|
||||
case "$enable_ltdl_convenience" in
|
||||
no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
|
||||
"") enable_ltdl_convenience=yes
|
||||
ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
|
||||
esac
|
||||
LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdlc.la
|
||||
INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl'])
|
||||
])
|
||||
|
||||
# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for
|
||||
# the libltdl installable library, and adds --enable-ltdl-install to
|
||||
# the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor
|
||||
# is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed
|
||||
# to be `${top_builddir}/libltdl'. Make sure you start DIR with
|
||||
# '${top_builddir}/' (note the single quotes!) if your package is not
|
||||
# flat, and, if you're not using automake, define top_builddir as
|
||||
# appropriate in the Makefiles.
|
||||
# In the future, this macro may have to be called after AC_PROG_LIBTOOL.
|
||||
AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
|
||||
AC_CHECK_LIB(ltdl, main,
|
||||
[test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
|
||||
[if test x"$enable_ltdl_install" = xno; then
|
||||
AC_MSG_WARN([libltdl not installed, but installation disabled])
|
||||
else
|
||||
enable_ltdl_install=yes
|
||||
fi
|
||||
])
|
||||
if test x"$enable_ltdl_install" = x"yes"; then
|
||||
ac_configure_args="$ac_configure_args --enable-ltdl-install"
|
||||
LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdl.la
|
||||
INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl'])
|
||||
else
|
||||
ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
|
||||
LIBLTDL="-lltdl"
|
||||
INCLTDL=
|
||||
fi
|
||||
])
|
||||
|
||||
dnl old names
|
||||
AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl
|
||||
AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl
|
||||
AC_DEFUN(AM_ENABLE_STATIC, [indir([AC_ENABLE_STATIC], $@)])dnl
|
||||
AC_DEFUN(AM_DISABLE_SHARED, [indir([AC_DISABLE_SHARED], $@)])dnl
|
||||
AC_DEFUN(AM_DISABLE_STATIC, [indir([AC_DISABLE_STATIC], $@)])dnl
|
||||
AC_DEFUN(AM_PROG_LD, [indir([AC_PROG_LD])])dnl
|
||||
AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl
|
||||
|
||||
dnl This is just to silence aclocal about the macro not being used
|
||||
ifelse([AC_DISABLE_FAST_INSTALL])dnl
|
||||
@@ -0,0 +1,87 @@
|
||||
dnl This file is part of the FreeType project.
|
||||
dnl
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
dnl
|
||||
|
||||
AC_INIT(ftconfig.in)
|
||||
|
||||
dnl configuration file -- stay in 8.3 limit
|
||||
AC_CONFIG_HEADER(ftconfig.h:ftconfig.in)
|
||||
|
||||
version_info='6:1:0'
|
||||
AC_SUBST(version_info)
|
||||
|
||||
dnl checks for system type
|
||||
AC_CANONICAL_SYSTEM
|
||||
|
||||
dnl checks for programs
|
||||
AC_PROG_CC
|
||||
AC_PROG_CPP
|
||||
|
||||
dnl get Compiler flags right.
|
||||
if test "x$CC" = xgcc; then
|
||||
XX_CFLAGS="-Wall"
|
||||
XX_ANSIFLAGS="-pedantic -ansi"
|
||||
else
|
||||
case "$host" in
|
||||
*-dec-osf*)
|
||||
CFLAGS=
|
||||
XX_CFLAGS="-std1 -g3"
|
||||
XX_ANSIFLAGS=
|
||||
;;
|
||||
*)
|
||||
XX_CFLAGS=
|
||||
XX_ANSIFLAGS=
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
AC_SUBST(XX_CFLAGS)
|
||||
AC_SUBST(XX_ANSIFLAGS)
|
||||
|
||||
AC_CHECK_PROG(RMF, rm, rm -f)
|
||||
AC_CHECK_PROG(RMDIR, rmdir, rmdir)
|
||||
|
||||
dnl Since this file will be finally moved to another directory we make
|
||||
dnl the path of the install script absolute. This small code snippet has
|
||||
dnl been taken from automake's `ylwrap' script.
|
||||
AC_PROG_INSTALL
|
||||
case "$INSTALL" in
|
||||
/*)
|
||||
;;
|
||||
*/*)
|
||||
INSTALL="`pwd`/$INSTALL" ;;
|
||||
esac
|
||||
|
||||
dnl checks for header files
|
||||
AC_HEADER_STDC
|
||||
AC_CHECK_HEADERS(fcntl.h unistd.h)
|
||||
|
||||
dnl checks for typedefs, structures, and compiler characteristics
|
||||
AC_C_CONST
|
||||
AC_CHECK_SIZEOF(int)
|
||||
AC_CHECK_SIZEOF(long)
|
||||
|
||||
dnl checks for library functions
|
||||
|
||||
dnl Here we check whether we can use our mmap file component.
|
||||
AC_FUNC_MMAP
|
||||
if test "$ac_cv_func_mmap_fixed_mapped" != yes; then
|
||||
FTSYS_SRC='$(BASE_)ftsystem.c'
|
||||
else
|
||||
FTSYS_SRC='$(BUILD)/ftsystem.c'
|
||||
|
||||
FT_MUNMAP_DECL
|
||||
FT_MUNMAP_PARAM
|
||||
fi
|
||||
AC_SUBST(FTSYS_SRC)
|
||||
|
||||
AC_CHECK_FUNCS(memcpy memmove)
|
||||
|
||||
AM_PROG_LIBTOOL
|
||||
|
||||
dnl create the Unix-specific sub-Makefiles `builds/unix/unix-def.mk'
|
||||
dnl and 'builds/unix/unix-cc.mk' that will be used by the build system
|
||||
dnl
|
||||
AC_OUTPUT(unix-cc.mk:unix-cc.in unix-def.mk:unix-def.in freetype-config)
|
||||
|
||||
dnl end of configure.in
|
||||
@@ -0,0 +1,71 @@
|
||||
#
|
||||
# FreeType 2 configuration file to detect a UNIX host platform.
|
||||
#
|
||||
|
||||
|
||||
# Copyright 1996-2000 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
.PHONY: devel lcc setup unix
|
||||
|
||||
ifeq ($(PLATFORM),ansi)
|
||||
|
||||
has_init := $(strip $(wildcard /sbin/init))
|
||||
ifneq ($(has_init),)
|
||||
|
||||
PLATFORM := unix
|
||||
COPY := cp
|
||||
DELETE := rm -f
|
||||
|
||||
|
||||
# If `devel' is the requested target, we use a special configuration
|
||||
# file named `unix-dev.mk'. It disables optimization and libtool.
|
||||
#
|
||||
ifneq ($(findstring devel,$(MAKECMDGOALS)),)
|
||||
CONFIG_FILE := unix-dev.mk
|
||||
CC := gcc
|
||||
devel: setup
|
||||
else
|
||||
|
||||
# If `lccl' is the requested target, we use a special configuration
|
||||
# file named `unix-lcc.mk'. It disables libtool for LCC
|
||||
#
|
||||
ifneq ($(findstring lcc,$(MAKECMDGOALS)),)
|
||||
CONFIG_FILE := unix-lcc.mk
|
||||
CC := lcc
|
||||
lcc: setup
|
||||
else
|
||||
# If a Unix platform is detected, the configure script is called and
|
||||
# `unix-def.mk' together with `unix-cc.mk' is created.
|
||||
#
|
||||
# Arguments to `configure' should be in the CFG variable. Example:
|
||||
#
|
||||
# make CFG="--prefix=/usr --disable-static"
|
||||
#
|
||||
# If you need to set CFLAGS or LDFLAGS, do it here also.
|
||||
#
|
||||
# Feel free to add support for other platform specific compilers in
|
||||
# this directory (e.g. solaris.mk + changes here to detect the
|
||||
# platform).
|
||||
#
|
||||
CONFIG_FILE := unix.mk
|
||||
setup: unix-def.mk
|
||||
unix: setup
|
||||
endif
|
||||
endif
|
||||
|
||||
setup: std_setup
|
||||
|
||||
unix-def.mk: $(TOP)/builds/unix/unix-def.in
|
||||
cd builds/unix; $(USE_CFLAGS) ./configure $(CFG)
|
||||
|
||||
endif # test Unix
|
||||
endif # test PLATFORM
|
||||
|
||||
# EOF
|
||||
@@ -0,0 +1,400 @@
|
||||
/***************************************************************************/
|
||||
/* */
|
||||
/* ftoption.h */
|
||||
/* */
|
||||
/* User-selectable configuration macros (specification only). */
|
||||
/* */
|
||||
/* Copyright 1996-2000 by */
|
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used, */
|
||||
/* modified, and distributed under the terms of the FreeType project */
|
||||
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
|
||||
/* this file you indicate that you have read the license and */
|
||||
/* understand and accept it fully. */
|
||||
/* */
|
||||
/***************************************************************************/
|
||||
|
||||
|
||||
#ifndef __FTOPTION_H__
|
||||
#define __FTOPTION_H__
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* USER-SELECTABLE CONFIGURATION MACROS */
|
||||
/* */
|
||||
/* These macros can be toggled by developers to enable or disable */
|
||||
/* certain aspects of FreeType. This is a default file, where all major */
|
||||
/* options are enabled. */
|
||||
/* */
|
||||
/* Note that if some modifications are required for your build, we */
|
||||
/* advise you to put a modified copy of this file in your build */
|
||||
/* directory, rather than modifying it in-place. */
|
||||
/* */
|
||||
/* The build directory is normally `freetype/builds/<system>' and */
|
||||
/* contains build or system-specific files that are included in */
|
||||
/* priority when building the library. */
|
||||
/* */
|
||||
/*************************************************************************/
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
/**** ****/
|
||||
/**** G E N E R A L F R E E T Y P E 2 C O N F I G U R A T I O N ****/
|
||||
/**** ****/
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* Convenience functions support */
|
||||
/* */
|
||||
/* Some functions of the FreeType 2 API are provided as a convenience */
|
||||
/* for client applications and developers. However, they are not */
|
||||
/* required to build and run the library itself. */
|
||||
/* */
|
||||
/* By defining this configuration macro, you'll disable the */
|
||||
/* compilation of these functions at build time. This can be useful */
|
||||
/* to reduce the library's code size when you don't need any of */
|
||||
/* these functions. */
|
||||
/* */
|
||||
/* All convenience functions are declared as such in their */
|
||||
/* documentation. */
|
||||
/* */
|
||||
#undef FT_CONFIG_OPTION_NO_CONVENIENCE_FUNCS
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* Alternate Glyph Image Format support */
|
||||
/* */
|
||||
/* By default, the glyph images returned by the FreeType glyph loader */
|
||||
/* can either be a pixmap or a vectorial outline defined through */
|
||||
/* Bezier control points. When defining the following configuration */
|
||||
/* macro, some font drivers will be able to register alternate */
|
||||
/* glyph image formats. */
|
||||
/* */
|
||||
/* Unset this macro if you are sure that you will never use a font */
|
||||
/* driver with an alternate glyph format; this will reduce the size of */
|
||||
/* the base layer code. */
|
||||
/* */
|
||||
/* Note that a few Type 1 fonts, as well as Windows `vector' fonts */
|
||||
/* use a vector `plotter' format that isn't supported when this */
|
||||
/* macro is undefined. */
|
||||
/* */
|
||||
#define FT_CONFIG_OPTION_ALTERNATE_GLYPH_FORMATS
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* Glyph Postscript Names handling */
|
||||
/* */
|
||||
/* By default, FreeType 2 is compiled with the `PSNames' module. This */
|
||||
/* This module is in charge of converting a glyph name string into a */
|
||||
/* Unicode value, or return a Macintosh standard glyph name for the */
|
||||
/* use with the TrueType `post' table. */
|
||||
/* */
|
||||
/* Undefine this macro if you do not want `PSNames' compiled in your */
|
||||
/* build of FreeType. This has the following effects: */
|
||||
/* */
|
||||
/* - The TrueType driver will provide its own set of glyph names, */
|
||||
/* if you build it to support postscript names in the TrueType */
|
||||
/* `post' table. */
|
||||
/* */
|
||||
/* - The Type 1 driver will not be able to synthetize a Unicode */
|
||||
/* charmap out of the glyphs found in the fonts. */
|
||||
/* */
|
||||
/* You would normally undefine this configuration macro when building */
|
||||
/* a version of FreeType that doesn't contain a Type 1 or CFF driver. */
|
||||
/* */
|
||||
#define FT_CONFIG_OPTION_POSTSCRIPT_NAMES
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* Postscript Names to Unicode Values support */
|
||||
/* */
|
||||
/* By default, FreeType 2 is built with the `PSNames' module compiled */
|
||||
/* in. Among other things, the module is used to convert a glyph name */
|
||||
/* into a Unicode value. This is especially useful in order to */
|
||||
/* synthetize on the fly a Unicode charmap from the CFF/Type 1 driver */
|
||||
/* through a big table named the `Adobe Glyph List' (AGL). */
|
||||
/* */
|
||||
/* Undefine this macro if you do not want the Adobe Glyph List */
|
||||
/* compiled in your `PSNames' module. The Type 1 driver will not be */
|
||||
/* able to synthetize a Unicode charmap out of the glyphs found in the */
|
||||
/* fonts. */
|
||||
/* */
|
||||
#define FT_CONFIG_OPTION_ADOBE_GLYPH_LIST
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* Many compilers provide the non-ANSI `long long' 64-bit type. You can */
|
||||
/* activate it by defining the FTCALC_USE_LONG_LONG macro. Note that */
|
||||
/* this will produce many -ansi warnings during library compilation, and */
|
||||
/* that in many cases the generated code will not be smaller or faster! */
|
||||
/* */
|
||||
#undef FTCALC_USE_LONG_LONG
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* DLL export compilation */
|
||||
/* */
|
||||
/* When compiling FreeType as a DLL, some systems/compilers need a */
|
||||
/* special keyword in front OR after the return type of function */
|
||||
/* declarations. */
|
||||
/* */
|
||||
/* Two macros are used within the FreeType source code to define */
|
||||
/* exported library functions: FT_EXPORT and FT_EXPORT_DEF. */
|
||||
/* */
|
||||
/* FT_EXPORT( return_type ) */
|
||||
/* */
|
||||
/* is used in a function declaration, as in */
|
||||
/* */
|
||||
/* FT_EXPORT( FT_Error ) */
|
||||
/* FT_Init_FreeType( FT_Library* alibrary ); */
|
||||
/* */
|
||||
/* */
|
||||
/* FT_EXPORT_DEF( return_type ) */
|
||||
/* */
|
||||
/* is used in a function definition, as in */
|
||||
/* */
|
||||
/* FT_EXPORT_DEF( FT_Error ) */
|
||||
/* FT_Init_FreeType( FT_Library* alibrary ) */
|
||||
/* { */
|
||||
/* ... some code ... */
|
||||
/* return FT_Err_Ok; */
|
||||
/* } */
|
||||
/* */
|
||||
/* You can provide your own implementation of FT_EXPORT and */
|
||||
/* FT_EXPORT_DEF here if you want. If you leave them undefined, they */
|
||||
/* will be later automatically defined as `extern return_type' to */
|
||||
/* allow normal compilation. */
|
||||
/* */
|
||||
#undef FT_EXPORT
|
||||
#undef FT_EXPORT_DEF
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* Debug level */
|
||||
/* */
|
||||
/* FreeType can be compiled in debug or trace mode. In debug mode, */
|
||||
/* errors are reported through the `ftdebug' component. In trace */
|
||||
/* mode, additional messages are sent to the standard output during */
|
||||
/* execution. */
|
||||
/* */
|
||||
/* Define FT_DEBUG_LEVEL_ERROR to build the library in debug mode. */
|
||||
/* Define FT_DEBUG_LEVEL_TRACE to build it in trace mode. */
|
||||
/* */
|
||||
/* Don't define any of these macros to compile in `release' mode! */
|
||||
/* */
|
||||
#define FT_DEBUG_LEVEL_ERROR
|
||||
#define FT_DEBUG_LEVEL_TRACE
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* Computation Algorithms */
|
||||
/* */
|
||||
/* Used for debugging, this configuration macro should disappear */
|
||||
/* soon. */
|
||||
/* */
|
||||
#define FT_CONFIG_OPTION_OLD_CALCS
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* The size in bytes of the render pool used by the scan-line converter */
|
||||
/* to do all of its work. */
|
||||
/* */
|
||||
/* This must be greater than 4kByte. */
|
||||
/* */
|
||||
#define FT_RENDER_POOL_SIZE 16384
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* FT_MAX_MODULES */
|
||||
/* */
|
||||
/* The maximum number of modules that can be registered in a single */
|
||||
/* FreeType library object. 16 is the default. */
|
||||
/* */
|
||||
#define FT_MAX_MODULES 16
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* FT_MAX_EXTENSIONS */
|
||||
/* */
|
||||
/* The maximum number of extensions that can be registered in a single */
|
||||
/* font driver. 8 is the default. */
|
||||
/* */
|
||||
/* If you don't know what this means, you certainly do not need to */
|
||||
/* change this value. */
|
||||
/* */
|
||||
#define FT_MAX_EXTENSIONS 8
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
/**** ****/
|
||||
/**** S F N T D R I V E R C O N F I G U R A T I O N ****/
|
||||
/**** ****/
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* Define TT_CONFIG_OPTION_EMBEDDED_BITMAPS if you want to support */
|
||||
/* embedded bitmaps in all formats using the SFNT module (namely */
|
||||
/* TrueType & OpenType). */
|
||||
/* */
|
||||
#define TT_CONFIG_OPTION_EMBEDDED_BITMAPS
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* Define TT_CONFIG_OPTION_POSTSCRIPT_NAMES if you want to be able to */
|
||||
/* load and enumerate the glyph Postscript names in a TrueType or */
|
||||
/* OpenType file. */
|
||||
/* */
|
||||
/* Note that when you do not compile the `PSNames' module by undefining */
|
||||
/* the above FT_CONFIG_OPTION_POSTSCRIPT_NAMES, the `sfnt' module will */
|
||||
/* contain additional code used to read the PS Names table from a font. */
|
||||
/* */
|
||||
/* (By default, the module uses `PSNames' to extract glyph names.) */
|
||||
/* */
|
||||
#define TT_CONFIG_OPTION_POSTSCRIPT_NAMES
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* Define TT_CONFIG_OPTION_SFNT_NAMES if your applications need to */
|
||||
/* access the internal name table in a SFNT-based format like TrueType */
|
||||
/* or OpenType. The name table contains various strings used to */
|
||||
/* describe the font, like family name, copyright, version, etc. It */
|
||||
/* does not contain any glyph name though. */
|
||||
/* */
|
||||
/* Accessing SFNT names is done through the functions declared in */
|
||||
/* `freetype/ftnames.h'. */
|
||||
/* */
|
||||
#define TT_CONFIG_OPTION_SFNT_NAMES
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
/**** ****/
|
||||
/**** T R U E T Y P E D R I V E R C O N F I G U R A T I O N ****/
|
||||
/**** ****/
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* Define TT_CONFIG_OPTION_BYTECODE_INTERPRETER if you want to compile */
|
||||
/* a bytecode interpreter in the TrueType driver. Note that there are */
|
||||
/* important patent issues related to the use of the interpreter. */
|
||||
/* */
|
||||
/* By undefining this, you will only compile the code necessary to load */
|
||||
/* TrueType glyphs without hinting. */
|
||||
/* */
|
||||
#define TT_CONFIG_OPTION_BYTECODE_INTERPRETER
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* Define TT_CONFIG_OPTION_INTERPRETER_SWITCH to compile the TrueType */
|
||||
/* bytecode interpreter with a huge switch statement, rather than a call */
|
||||
/* table. This results in smaller and faster code for a number of */
|
||||
/* architectures. */
|
||||
/* */
|
||||
/* Note however that on some compiler/processor combinations, undefining */
|
||||
/* this macro will generate faster, though larger, code. */
|
||||
/* */
|
||||
#define TT_CONFIG_OPTION_INTERPRETER_SWITCH
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
/**** ****/
|
||||
/**** T Y P E 1 D R I V E R C O N F I G U R A T I O N ****/
|
||||
/**** ****/
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* T1_MAX_DICT_DEPTH is the maximal depth of nest dictionaries and */
|
||||
/* arrays in the Type 1 stream (see t1load.c). A minimum of 4 is */
|
||||
/* required. */
|
||||
/* */
|
||||
#define T1_MAX_DICT_DEPTH 5
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* T1_MAX_SUBRS_CALLS details the maximum number of nested sub-routine */
|
||||
/* calls during glyph loading. */
|
||||
/* */
|
||||
#define T1_MAX_SUBRS_CALLS 16
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* T1_MAX_CHARSTRING_OPERANDS is the charstring stack's capacity. A */
|
||||
/* minimum of 16 is required. */
|
||||
/* */
|
||||
/* The Chinese font MingTiEG-Medium (CNS 11643 character set) needs 256. */
|
||||
/* */
|
||||
#define T1_MAX_CHARSTRINGS_OPERANDS 256
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* Define T1_CONFIG_OPTION_DISABLE_HINTER if you want to generate a */
|
||||
/* driver with no hinter. This can be useful to debug the parser. */
|
||||
/* */
|
||||
#undef T1_CONFIG_OPTION_DISABLE_HINTER
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* Define this configuration macro if you want to prevent the */
|
||||
/* compilation of `t1afm', which is in charge of reading Type 1 AFM */
|
||||
/* files into an existing face. Note that if set, the T1 driver will be */
|
||||
/* unable to produce kerning distances. */
|
||||
/* */
|
||||
#undef T1_CONFIG_OPTION_NO_AFM
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* Define this configuration macro if you want to prevent the */
|
||||
/* compilation of the Multiple Masters font support in the Type 1 */
|
||||
/* driver. */
|
||||
/* */
|
||||
#undef T1_CONFIG_OPTION_NO_MM_SUPPORT
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* __FTOPTION_H__ */
|
||||
|
||||
|
||||
/* END */
|
||||
@@ -0,0 +1,90 @@
|
||||
#!/bin/sh
|
||||
|
||||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
exec_prefix_set=no
|
||||
|
||||
usage()
|
||||
{
|
||||
cat <<EOF
|
||||
Usage: freetype-config [OPTIONS] [LIBRARIES]
|
||||
Options:
|
||||
[--prefix[=DIR]]
|
||||
[--exec-prefix[=DIR]]
|
||||
[--version]
|
||||
[--libs]
|
||||
[--libtool]
|
||||
[--cflags]
|
||||
EOF
|
||||
exit $1
|
||||
}
|
||||
|
||||
if test $# -eq 0; then
|
||||
usage 1 1>&2
|
||||
fi
|
||||
|
||||
|
||||
while test $# -gt 0; do
|
||||
case "$1" in
|
||||
-*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
|
||||
*) optarg= ;;
|
||||
esac
|
||||
|
||||
case $1 in
|
||||
--prefix=*)
|
||||
prefix=$optarg
|
||||
;;
|
||||
--prefix)
|
||||
echo_prefix=yes
|
||||
;;
|
||||
--exec-prefix=*)
|
||||
exec_prefix=$optarg
|
||||
exec_prefix_set=yes
|
||||
;;
|
||||
--exec-prefix)
|
||||
echo_exec_prefix=yes
|
||||
;;
|
||||
--version)
|
||||
echo @version_info@
|
||||
exit 0
|
||||
;;
|
||||
--cflags)
|
||||
echo_cflags=yes
|
||||
;;
|
||||
--libs)
|
||||
echo_libs=yes
|
||||
;;
|
||||
--libtool)
|
||||
echo_libtool=yes
|
||||
;;
|
||||
*)
|
||||
usage 1 1>&2
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
if test "$exec_prefix_set" = "no"; then
|
||||
exec_prefix=$prefix
|
||||
fi
|
||||
|
||||
if test "$echo_prefix" = "yes"; then
|
||||
echo $prefix
|
||||
fi
|
||||
if test "$echo_exec_prefix" = "yes"; then
|
||||
echo $exec_prefix
|
||||
fi
|
||||
if test "$echo_cflags" = "yes"; then
|
||||
cflags="-I@includedir@/freetype2"
|
||||
echo $cflags $includes
|
||||
fi
|
||||
if test "$echo_libs" = "yes"; then
|
||||
libs="-lfreetype"
|
||||
echo -L@libdir@ $libs
|
||||
fi
|
||||
if test "$echo_libtool" = "yes"; then
|
||||
convlib="libfreetype.la"
|
||||
echo @libdir@/$convlib
|
||||
fi
|
||||
|
||||
# EOF
|
||||
@@ -0,0 +1,261 @@
|
||||
/***************************************************************************/
|
||||
/* */
|
||||
/* ftconfig.in */
|
||||
/* */
|
||||
/* UNIX-specific configuration file (specification only). */
|
||||
/* */
|
||||
/* Copyright 1996-2000 by */
|
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used, */
|
||||
/* modified, and distributed under the terms of the FreeType project */
|
||||
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
|
||||
/* this file you indicate that you have read the license and */
|
||||
/* understand and accept it fully. */
|
||||
/* */
|
||||
/***************************************************************************/
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* This header file contains a number of macro definitions that are used */
|
||||
/* by the rest of the engine. Most of the macros here are automatically */
|
||||
/* determined at compile time, and you should not need to change it to */
|
||||
/* port FreeType, except to compile the library with a non-ANSI */
|
||||
/* compiler. */
|
||||
/* */
|
||||
/* Note however that if some specific modifications are needed, we */
|
||||
/* advise you to place a modified copy in your build directory. */
|
||||
/* */
|
||||
/* The build directory is usually `freetype/builds/<system>', and */
|
||||
/* contains system-specific files that are always included first when */
|
||||
/* building the library. */
|
||||
/* */
|
||||
/*************************************************************************/
|
||||
|
||||
|
||||
#ifndef __FTCONFIG_H__
|
||||
#define __FTCONFIG_H__
|
||||
|
||||
#ifndef FT_BUILD_H
|
||||
# define FT_BUILD_H <freetype/config/ftbuild.h>
|
||||
#endif
|
||||
|
||||
|
||||
/* Include the header file containing all developer build options */
|
||||
#include FT_BUILD_H
|
||||
#include FT_CONFIG_OPTIONS_H
|
||||
|
||||
|
||||
FT_BEGIN_HEADER
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* PLATFORM-SPECIFIC CONFIGURATION MACROS */
|
||||
/* */
|
||||
/* These macros can be toggled to suit a specific system. The current */
|
||||
/* ones are defaults used to compile FreeType in an ANSI C environment */
|
||||
/* (16bit compilers are also supported). Copy this file to your own */
|
||||
/* `freetype/builds/<system>' directory, and edit it to port the engine. */
|
||||
/* */
|
||||
/*************************************************************************/
|
||||
|
||||
|
||||
#define HAVE_UNISTD_H 0
|
||||
#define HAVE_FCNTL_H 0
|
||||
|
||||
#define SIZEOF_INT 2
|
||||
#define SIZEOF_LONG 2
|
||||
|
||||
|
||||
#define FT_SIZEOF_INT SIZEOF_INT
|
||||
#define FT_SIZEOF_LONG SIZEOF_LONG
|
||||
|
||||
|
||||
/* Preferred alignment of data */
|
||||
#define FT_ALIGNMENT 8
|
||||
|
||||
|
||||
/* UNUSED is a macro used to indicate that a given parameter is not used */
|
||||
/* -- this is only used to get rid of unpleasant compiler warnings */
|
||||
#ifndef FT_UNUSED
|
||||
#define FT_UNUSED( arg ) ( (arg) = (arg) )
|
||||
#endif
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* AUTOMATIC CONFIGURATION MACROS */
|
||||
/* */
|
||||
/* These macros are computed from the ones defined above. Don't touch */
|
||||
/* their definition, unless you know precisely what you are doing. No */
|
||||
/* porter should need to mess with them. */
|
||||
/* */
|
||||
/*************************************************************************/
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* IntN types */
|
||||
/* */
|
||||
/* Used to guarantee the size of some specific integers. */
|
||||
/* */
|
||||
typedef signed short FT_Int16;
|
||||
typedef unsigned short FT_UInt16;
|
||||
|
||||
#if FT_SIZEOF_INT == 4
|
||||
|
||||
typedef signed int FT_Int32;
|
||||
typedef unsigned int FT_UInt32;
|
||||
|
||||
#elif FT_SIZEOF_LONG == 4
|
||||
|
||||
typedef signed long FT_Int32;
|
||||
typedef unsigned long FT_UInt32;
|
||||
|
||||
#else
|
||||
#error "no 32bit type found -- please check your configuration files"
|
||||
#endif
|
||||
|
||||
#if FT_SIZEOF_LONG == 8
|
||||
|
||||
/* FT_LONG64 must be defined if a 64-bit type is available */
|
||||
#define FT_LONG64
|
||||
#define FT_INT64 long
|
||||
|
||||
#else
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* Many compilers provide the non-ANSI `long long' 64-bit type. You can */
|
||||
/* activate it by defining the FTCALC_USE_LONG_LONG macro in */
|
||||
/* `ftoption.h'. */
|
||||
/* */
|
||||
/* Note that this will produce many -ansi warnings during library */
|
||||
/* compilation, and that in many cases, the generated code will be */
|
||||
/* neither smaller nor faster! */
|
||||
/* */
|
||||
#ifdef FTCALC_USE_LONG_LONG
|
||||
|
||||
#define FT_LONG64
|
||||
#define FT_INT64 long long
|
||||
|
||||
#endif /* FTCALC_USE_LONG_LONG */
|
||||
#endif /* FT_SIZEOF_LONG == 8 */
|
||||
|
||||
|
||||
#ifdef FT_MAKE_OPTION_SINGLE_OBJECT
|
||||
|
||||
#define FT_LOCAL static
|
||||
#define FT_LOCAL_DEF static
|
||||
|
||||
#else
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define FT_LOCAL extern "C"
|
||||
#define FT_LOCAL_DEF extern "C"
|
||||
#else
|
||||
#define FT_LOCAL extern
|
||||
#define FT_LOCAL_DEF extern
|
||||
#endif
|
||||
|
||||
#endif /* FT_MAKE_OPTION_SINGLE_OBJECT */
|
||||
|
||||
|
||||
#ifndef FT_BASE
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define FT_BASE( x ) extern "C" x
|
||||
#else
|
||||
#define FT_BASE( x ) extern x
|
||||
#endif
|
||||
|
||||
#endif /* !FT_BASE */
|
||||
|
||||
|
||||
#ifndef FT_BASE_DEF
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define FT_BASE_DEF( x ) extern "C" x
|
||||
#else
|
||||
#define FT_BASE_DEF( x ) extern x
|
||||
#endif
|
||||
|
||||
#endif /* !FT_BASE_DEF */
|
||||
|
||||
|
||||
#ifndef FT_EXPORT
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define FT_EXPORT( x ) extern "C" x
|
||||
#else
|
||||
#define FT_EXPORT( x ) extern x
|
||||
#endif
|
||||
|
||||
#endif /* !FT_EXPORT */
|
||||
|
||||
|
||||
#ifndef FT_EXPORT_DEF
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define FT_EXPORT_DEF( x ) extern "C" x
|
||||
#else
|
||||
#define FT_EXPORT_DEF( x ) extern x
|
||||
#endif
|
||||
|
||||
#endif /* !FT_EXPORT_DEF */
|
||||
|
||||
|
||||
#ifndef FT_EXPORT_VAR
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define FT_EXPORT_VAR( x ) extern "C" x
|
||||
#else
|
||||
#define FT_EXPORT_VAR( x ) extern x
|
||||
#endif
|
||||
|
||||
#endif /* !FT_EXPORT_VAR */
|
||||
|
||||
/* The following macros are needed to compile the library with a */
|
||||
/* C++ compiler. Note that we do this for convenience -- please */
|
||||
/* don't ask for more C++ features. */
|
||||
/* */
|
||||
|
||||
/* This is special. Within C++, you must specify `extern "C"' for */
|
||||
/* functions which are used via function pointers, and you also */
|
||||
/* must do that for structures which contain function pointers to */
|
||||
/* assure C linkage -- it's not possible to have (local) anonymous */
|
||||
/* functions which are accessed by (global) function pointers. */
|
||||
/* */
|
||||
/* */
|
||||
/* FT_CALLBACK_DEF is used to _define_ a callback function. */
|
||||
/* */
|
||||
/* FT_CALLBACK_TABLE is used to _declare_ a constant variable that */
|
||||
/* contains pointers to callback functions. */
|
||||
/* */
|
||||
/* FT_CALLBACK_TABLE_DEF is used to _define_ a constant variable */
|
||||
/* that contains pointers to callback functions. */
|
||||
/* */
|
||||
#ifdef __cplusplus
|
||||
|
||||
#define FT_CALLBACK_DEF extern "C"
|
||||
#define FT_CALLBACK_TABLE extern "C"
|
||||
#define FT_CALLBACK_TABLE_DEF extern "C"
|
||||
|
||||
#else
|
||||
|
||||
#define FT_CALLBACK_DEF static
|
||||
#define FT_CALLBACK_TABLE extern
|
||||
#define FT_CALLBACK_TABLE_DEF
|
||||
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
FT_END_HEADER
|
||||
|
||||
#endif /* __FTCONFIG_H__ */
|
||||
|
||||
|
||||
/* END */
|
||||
@@ -0,0 +1,334 @@
|
||||
/***************************************************************************/
|
||||
/* */
|
||||
/* ftsystem.c */
|
||||
/* */
|
||||
/* Unix-specific FreeType low-level system interface (body). */
|
||||
/* */
|
||||
/* Copyright 1996-2000 by */
|
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used, */
|
||||
/* modified, and distributed under the terms of the FreeType project */
|
||||
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
|
||||
/* this file you indicate that you have read the license and */
|
||||
/* understand and accept it fully. */
|
||||
/* */
|
||||
/***************************************************************************/
|
||||
|
||||
|
||||
#include <ftconfig.h>
|
||||
#include <freetype/internal/ftdebug.h>
|
||||
#include <freetype/ftsystem.h>
|
||||
#include <freetype/fterrors.h>
|
||||
#include <freetype/fttypes.h>
|
||||
#include <freetype/internal/ftobjs.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
/* memory-mapping includes and definitions */
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <sys/mman.h>
|
||||
#ifndef MAP_FILE
|
||||
#define MAP_FILE 0x00
|
||||
#endif
|
||||
|
||||
#ifdef MUNMAP_USES_VOIDP
|
||||
#define MUNMAP_ARG_CAST void *
|
||||
#else
|
||||
#define MUNMAP_ARG_CAST char *
|
||||
#endif
|
||||
|
||||
#ifdef NEED_MUNMAP_DECL
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#else
|
||||
extern
|
||||
#endif
|
||||
int munmap( char* addr,
|
||||
int len );
|
||||
|
||||
#define MUNMAP_ARG_CAST char *
|
||||
|
||||
#endif /* NEED_DECLARATION_MUNMAP */
|
||||
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
#ifdef HAVE_FCNTL_H
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* MEMORY MANAGEMENT INTERFACE */
|
||||
/* */
|
||||
/*************************************************************************/
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Function> */
|
||||
/* ft_alloc */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* The memory allocation function. */
|
||||
/* */
|
||||
/* <Input> */
|
||||
/* memory :: A pointer to the memory object. */
|
||||
/* size :: The requested size in bytes. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* block :: The address of newly allocated block. */
|
||||
/* */
|
||||
FT_CALLBACK_DEF
|
||||
void* ft_alloc( FT_Memory memory,
|
||||
long size )
|
||||
{
|
||||
FT_UNUSED( memory );
|
||||
|
||||
return malloc( size );
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Function> */
|
||||
/* ft_realloc */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* The memory reallocation function. */
|
||||
/* */
|
||||
/* <Input> */
|
||||
/* memory :: A pointer to the memory object. */
|
||||
/* */
|
||||
/* cur_size :: The current size of the allocated memory block. */
|
||||
/* */
|
||||
/* new_size :: The newly requested size in bytes. */
|
||||
/* */
|
||||
/* block :: The current address of the block in memory. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* The address of the reallocated memory block. */
|
||||
/* */
|
||||
FT_CALLBACK_DEF
|
||||
void* ft_realloc( FT_Memory memory,
|
||||
long cur_size,
|
||||
long new_size,
|
||||
void* block )
|
||||
{
|
||||
FT_UNUSED( memory );
|
||||
FT_UNUSED( cur_size );
|
||||
|
||||
return realloc( block, new_size );
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Function> */
|
||||
/* ft_free */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* The memory release function. */
|
||||
/* */
|
||||
/* <Input> */
|
||||
/* memory :: A pointer to the memory object. */
|
||||
/* */
|
||||
/* block :: The address of block in memory to be freed. */
|
||||
/* */
|
||||
FT_CALLBACK_DEF
|
||||
void ft_free( FT_Memory memory,
|
||||
void* block )
|
||||
{
|
||||
FT_UNUSED( memory );
|
||||
|
||||
free( block );
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* RESOURCE MANAGEMENT INTERFACE */
|
||||
/* */
|
||||
/*************************************************************************/
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* The macro FT_COMPONENT is used in trace mode. It is an implicit */
|
||||
/* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
|
||||
/* messages during execution. */
|
||||
/* */
|
||||
#undef FT_COMPONENT
|
||||
#define FT_COMPONENT trace_io
|
||||
|
||||
/* We use the macro STREAM_FILE for convenience to extract the */
|
||||
/* system-specific stream handle from a given FreeType stream object */
|
||||
#define STREAM_FILE( stream ) ( (FILE*)stream->descriptor.pointer )
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Function> */
|
||||
/* ft_close_stream */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* The function to close a stream. */
|
||||
/* */
|
||||
/* <Input> */
|
||||
/* stream :: A pointer to the stream object. */
|
||||
/* */
|
||||
FT_CALLBACK_DEF
|
||||
void ft_close_stream( FT_Stream stream )
|
||||
{
|
||||
munmap( (MUNMAP_ARG_CAST)stream->descriptor.pointer, stream->size );
|
||||
|
||||
stream->descriptor.pointer = NULL;
|
||||
stream->size = 0;
|
||||
stream->base = 0;
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Function> */
|
||||
/* FT_New_Stream */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* Creates a new stream object. */
|
||||
/* */
|
||||
/* <Input> */
|
||||
/* filepathname :: The name of the stream (usually a file) to be */
|
||||
/* opened. */
|
||||
/* */
|
||||
/* stream :: A pointer to the stream object. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
FT_EXPORT_DEF( FT_Error ) FT_New_Stream( const char* filepathname,
|
||||
FT_Stream stream )
|
||||
{
|
||||
int file;
|
||||
struct stat stat_buf;
|
||||
|
||||
|
||||
if ( !stream )
|
||||
return FT_Err_Invalid_Stream_Handle;
|
||||
|
||||
/* open the file */
|
||||
file = open( filepathname, O_RDONLY );
|
||||
if ( file < 0 )
|
||||
{
|
||||
FT_ERROR(( "FT_New_Stream:" ));
|
||||
FT_ERROR(( " could not open `%s'\n", filepathname ));
|
||||
return FT_Err_Cannot_Open_Resource;
|
||||
}
|
||||
|
||||
if ( fstat( file, &stat_buf ) < 0 )
|
||||
{
|
||||
FT_ERROR(( "FT_New_Stream:" ));
|
||||
FT_ERROR(( " could not `fstat' file `%s'\n", filepathname ));
|
||||
goto Fail_Map;
|
||||
}
|
||||
|
||||
stream->size = stat_buf.st_size;
|
||||
stream->pos = 0;
|
||||
stream->base = (unsigned char *)mmap( NULL,
|
||||
stream->size,
|
||||
PROT_READ,
|
||||
MAP_FILE | MAP_PRIVATE,
|
||||
file,
|
||||
0 );
|
||||
|
||||
if ( (long)stream->base == -1 )
|
||||
{
|
||||
FT_ERROR(( "FT_New_Stream:" ));
|
||||
FT_ERROR(( " could not `mmap' file `%s'\n", filepathname ));
|
||||
goto Fail_Map;
|
||||
}
|
||||
|
||||
close( file );
|
||||
|
||||
stream->descriptor.pointer = stream->base;
|
||||
stream->pathname.pointer = (char*)filepathname;
|
||||
|
||||
stream->close = ft_close_stream;
|
||||
stream->read = 0;
|
||||
|
||||
FT_TRACE1(( "FT_New_Stream:" ));
|
||||
FT_TRACE1(( " opened `%s' (%d bytes) successfully\n",
|
||||
filepathname, stream->size ));
|
||||
|
||||
return FT_Err_Ok;
|
||||
|
||||
Fail_Map:
|
||||
close( file );
|
||||
|
||||
stream->base = NULL;
|
||||
stream->size = 0;
|
||||
stream->pos = 0;
|
||||
|
||||
return FT_Err_Cannot_Open_Stream;
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Function> */
|
||||
/* FT_New_Memory */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* Creates a new memory object. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* A pointer to the new memory object. 0 in case of error. */
|
||||
/* */
|
||||
FT_EXPORT_DEF( FT_Memory ) FT_New_Memory( void )
|
||||
{
|
||||
FT_Memory memory;
|
||||
|
||||
|
||||
memory = (FT_Memory)malloc( sizeof ( *memory ) );
|
||||
if ( memory )
|
||||
{
|
||||
memory->user = 0;
|
||||
memory->alloc = ft_alloc;
|
||||
memory->realloc = ft_realloc;
|
||||
memory->free = ft_free;
|
||||
}
|
||||
|
||||
return memory;
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Function> */
|
||||
/* FT_Done_Memory */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* Discards memory manager. */
|
||||
/* */
|
||||
/* <Input> */
|
||||
/* memory :: A handle to the memory manager. */
|
||||
/* */
|
||||
FT_EXPORT_DEF( void ) FT_Done_Memory( FT_Memory memory )
|
||||
{
|
||||
free( memory );
|
||||
}
|
||||
|
||||
|
||||
/* END */
|
||||
@@ -0,0 +1,250 @@
|
||||
#! /bin/sh
|
||||
#
|
||||
# install - install a program, script, or datafile
|
||||
# This comes from X11R5 (mit/util/scripts/install.sh).
|
||||
#
|
||||
# Copyright 1991 by the Massachusetts Institute of Technology
|
||||
#
|
||||
# Permission to use, copy, modify, distribute, and sell this software and its
|
||||
# documentation for any purpose is hereby granted without fee, provided that
|
||||
# the above copyright notice appear in all copies and that both that
|
||||
# copyright notice and this permission notice appear in supporting
|
||||
# documentation, and that the name of M.I.T. not be used in advertising or
|
||||
# publicity pertaining to distribution of the software without specific,
|
||||
# written prior permission. M.I.T. makes no representations about the
|
||||
# suitability of this software for any purpose. It is provided "as is"
|
||||
# without express or implied warranty.
|
||||
#
|
||||
# Calling this script install-sh is preferred over install.sh, to prevent
|
||||
# `make' implicit rules from creating a file called install from it
|
||||
# when there is no Makefile.
|
||||
#
|
||||
# This script is compatible with the BSD install script, but was written
|
||||
# from scratch. It can only install one file at a time, a restriction
|
||||
# shared with many OS's install programs.
|
||||
|
||||
|
||||
# set DOITPROG to echo to test this script
|
||||
|
||||
# Don't use :- since 4.3BSD and earlier shells don't like it.
|
||||
doit="${DOITPROG-}"
|
||||
|
||||
|
||||
# put in absolute paths if you don't have them in your path; or use env. vars.
|
||||
|
||||
mvprog="${MVPROG-mv}"
|
||||
cpprog="${CPPROG-cp}"
|
||||
chmodprog="${CHMODPROG-chmod}"
|
||||
chownprog="${CHOWNPROG-chown}"
|
||||
chgrpprog="${CHGRPPROG-chgrp}"
|
||||
stripprog="${STRIPPROG-strip}"
|
||||
rmprog="${RMPROG-rm}"
|
||||
mkdirprog="${MKDIRPROG-mkdir}"
|
||||
|
||||
transformbasename=""
|
||||
transform_arg=""
|
||||
instcmd="$mvprog"
|
||||
chmodcmd="$chmodprog 0755"
|
||||
chowncmd=""
|
||||
chgrpcmd=""
|
||||
stripcmd=""
|
||||
rmcmd="$rmprog -f"
|
||||
mvcmd="$mvprog"
|
||||
src=""
|
||||
dst=""
|
||||
dir_arg=""
|
||||
|
||||
while [ x"$1" != x ]; do
|
||||
case $1 in
|
||||
-c) instcmd="$cpprog"
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-d) dir_arg=true
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-m) chmodcmd="$chmodprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-o) chowncmd="$chownprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-g) chgrpcmd="$chgrpprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-s) stripcmd="$stripprog"
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
|
||||
shift
|
||||
continue;;
|
||||
|
||||
*) if [ x"$src" = x ]
|
||||
then
|
||||
src=$1
|
||||
else
|
||||
# this colon is to work around a 386BSD /bin/sh bug
|
||||
:
|
||||
dst=$1
|
||||
fi
|
||||
shift
|
||||
continue;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ x"$src" = x ]
|
||||
then
|
||||
echo "install: no input file specified"
|
||||
exit 1
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
||||
if [ x"$dir_arg" != x ]; then
|
||||
dst=$src
|
||||
src=""
|
||||
|
||||
if [ -d $dst ]; then
|
||||
instcmd=:
|
||||
else
|
||||
instcmd=mkdir
|
||||
fi
|
||||
else
|
||||
|
||||
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
|
||||
# might cause directories to be created, which would be especially bad
|
||||
# if $src (and thus $dsttmp) contains '*'.
|
||||
|
||||
if [ -f $src -o -d $src ]
|
||||
then
|
||||
true
|
||||
else
|
||||
echo "install: $src does not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ x"$dst" = x ]
|
||||
then
|
||||
echo "install: no destination specified"
|
||||
exit 1
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
||||
# If destination is a directory, append the input filename; if your system
|
||||
# does not like double slashes in filenames, you may need to add some logic
|
||||
|
||||
if [ -d $dst ]
|
||||
then
|
||||
dst="$dst"/`basename $src`
|
||||
else
|
||||
true
|
||||
fi
|
||||
fi
|
||||
|
||||
## this sed command emulates the dirname command
|
||||
dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
|
||||
|
||||
# Make sure that the destination directory exists.
|
||||
# this part is taken from Noah Friedman's mkinstalldirs script
|
||||
|
||||
# Skip lots of stat calls in the usual case.
|
||||
if [ ! -d "$dstdir" ]; then
|
||||
defaultIFS='
|
||||
'
|
||||
IFS="${IFS-${defaultIFS}}"
|
||||
|
||||
oIFS="${IFS}"
|
||||
# Some sh's can't handle IFS=/ for some reason.
|
||||
IFS='%'
|
||||
set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
|
||||
IFS="${oIFS}"
|
||||
|
||||
pathcomp=''
|
||||
|
||||
while [ $# -ne 0 ] ; do
|
||||
pathcomp="${pathcomp}${1}"
|
||||
shift
|
||||
|
||||
if [ ! -d "${pathcomp}" ] ;
|
||||
then
|
||||
$mkdirprog "${pathcomp}"
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
||||
pathcomp="${pathcomp}/"
|
||||
done
|
||||
fi
|
||||
|
||||
if [ x"$dir_arg" != x ]
|
||||
then
|
||||
$doit $instcmd $dst &&
|
||||
|
||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
|
||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
|
||||
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
|
||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
|
||||
else
|
||||
|
||||
# If we're going to rename the final executable, determine the name now.
|
||||
|
||||
if [ x"$transformarg" = x ]
|
||||
then
|
||||
dstfile=`basename $dst`
|
||||
else
|
||||
dstfile=`basename $dst $transformbasename |
|
||||
sed $transformarg`$transformbasename
|
||||
fi
|
||||
|
||||
# don't allow the sed command to completely eliminate the filename
|
||||
|
||||
if [ x"$dstfile" = x ]
|
||||
then
|
||||
dstfile=`basename $dst`
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
||||
# Make a temp file name in the proper directory.
|
||||
|
||||
dsttmp=$dstdir/#inst.$$#
|
||||
|
||||
# Move or copy the file name to the temp name
|
||||
|
||||
$doit $instcmd $src $dsttmp &&
|
||||
|
||||
trap "rm -f ${dsttmp}" 0 &&
|
||||
|
||||
# and set any options; do chmod last to preserve setuid bits
|
||||
|
||||
# If any of these fail, we abort the whole thing. If we want to
|
||||
# ignore errors from any of these, just make sure not to ignore
|
||||
# errors from the above "$doit $instcmd $src $dsttmp" command.
|
||||
|
||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
|
||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
|
||||
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
|
||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
|
||||
|
||||
# Now rename the file to the real destination.
|
||||
|
||||
$doit $rmcmd -f $dstdir/$dstfile &&
|
||||
$doit $mvcmd $dsttmp $dstdir/$dstfile
|
||||
|
||||
fi &&
|
||||
|
||||
|
||||
exit 0
|
||||
@@ -0,0 +1,67 @@
|
||||
#
|
||||
# FreeType 2 installation instructions for Unix systems
|
||||
#
|
||||
|
||||
|
||||
# Copyright 1996-2000 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
|
||||
# Unix installation and deinstallation targets.
|
||||
install: $(PROJECT_LIBRARY)
|
||||
$(MKINSTALLDIRS) $(libdir) \
|
||||
$(includedir)/freetype2/freetype/config \
|
||||
$(includedir)/freetype2/freetype/internal \
|
||||
$(includedir)/freetype2/freetype/cache \
|
||||
$(bindir)
|
||||
$(LIBTOOL) --mode=install $(INSTALL) $(PROJECT_LIBRARY) $(libdir)
|
||||
-for P in $(PUBLIC_H) ; do \
|
||||
$(INSTALL_DATA) $$P $(includedir)/freetype2/freetype ; \
|
||||
done
|
||||
-for P in $(BASE_H) ; do \
|
||||
$(INSTALL_DATA) $$P $(includedir)/freetype2/freetype/internal ; \
|
||||
done
|
||||
-for P in $(CONFIG_H) ; do \
|
||||
$(INSTALL_DATA) $$P $(includedir)/freetype2/freetype/config ; \
|
||||
done
|
||||
-for P in $(CACHE_H) ; do \
|
||||
$(INSTALL_DATA) $$P $(includedir)/freetype2/freetype/cache ; \
|
||||
done
|
||||
$(INSTALL_SCRIPT) -m 755 $(BUILD)/freetype-config \
|
||||
$(bindir)/freetype-config
|
||||
|
||||
|
||||
uninstall:
|
||||
-$(LIBTOOL) --mode=uninstall $(RM) $(libdir)/$(PROJECT_LIBRARY)
|
||||
-$(DELETE) $(includedir)/freetype2/freetype/cache/*
|
||||
-$(DELDIR) $(includedir)/freetype2/freetype/cache
|
||||
-$(DELETE) $(includedir)/freetype2/freetype/config/*
|
||||
-$(DELDIR) $(includedir)/freetype2/freetype/config
|
||||
-$(DELETE) $(includedir)/freetype2/freetype/internal/*
|
||||
-$(DELDIR) $(includedir)/freetype2/freetype/internal
|
||||
-$(DELETE) $(includedir)/freetype2/freetype/*
|
||||
-$(DELDIR) $(includedir)/freetype2/freetype
|
||||
-$(DELDIR) $(includedir)/freetype2
|
||||
-$(DELETE) $(bindir)/freetype-config
|
||||
|
||||
|
||||
# Unix cleaning and distclean rules.
|
||||
#
|
||||
clean_project_unix:
|
||||
-$(DELETE) $(BASE_OBJECTS) $(OBJ_M) $(OBJ_S)
|
||||
-$(DELETE) $(patsubst %.$O,%.$(SO),$(BASE_OBJECTS) $(OBJ_M) $(OBJ_S)) \
|
||||
$(CLEAN)
|
||||
|
||||
distclean_project_unix: clean_project_unix
|
||||
-$(DELETE) $(PROJECT_LIBRARY)
|
||||
-$(DELETE) $(OBJ_DIR)/.libs/*
|
||||
-$(DELDIR) $(OBJ_DIR)/.libs
|
||||
-$(DELETE) *.orig *~ core *.core $(DISTCLEAN)
|
||||
|
||||
# EOF
|
||||
@@ -0,0 +1,40 @@
|
||||
#! /bin/sh
|
||||
# mkinstalldirs --- make directory hierarchy
|
||||
# Author: Noah Friedman <[email protected]>
|
||||
# Created: 1993-05-16
|
||||
# Public domain
|
||||
|
||||
# $Id$
|
||||
|
||||
errstatus=0
|
||||
|
||||
for file
|
||||
do
|
||||
set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
|
||||
shift
|
||||
|
||||
pathcomp=
|
||||
for d
|
||||
do
|
||||
pathcomp="$pathcomp$d"
|
||||
case "$pathcomp" in
|
||||
-* ) pathcomp=./$pathcomp ;;
|
||||
esac
|
||||
|
||||
if test ! -d "$pathcomp"; then
|
||||
echo "mkdir $pathcomp" 1>&2
|
||||
|
||||
mkdir "$pathcomp" || lasterr=$?
|
||||
|
||||
if test ! -d "$pathcomp"; then
|
||||
errstatus=$lasterr
|
||||
fi
|
||||
fi
|
||||
|
||||
pathcomp="$pathcomp/"
|
||||
done
|
||||
done
|
||||
|
||||
exit $errstatus
|
||||
|
||||
# mkinstalldirs ends here
|
||||
@@ -0,0 +1,81 @@
|
||||
# template for Unix-specific compiler definitions
|
||||
#
|
||||
|
||||
CC := @CC@
|
||||
|
||||
LIBTOOL := $(BUILD)/libtool
|
||||
|
||||
|
||||
# The object file extension (for standard and static libraries). This can be
|
||||
# .o, .tco, .obj, etc., depending on the platform.
|
||||
#
|
||||
O := lo
|
||||
SO := o
|
||||
|
||||
|
||||
# The library file extension (for standard and static libraries). This can
|
||||
# be .a, .lib, etc., depending on the platform.
|
||||
#
|
||||
A := la
|
||||
SA := a
|
||||
|
||||
|
||||
# The name of the final library file. Note that the DOS-specific Makefile
|
||||
# uses a shorter (8.3) name.
|
||||
#
|
||||
LIBRARY := lib$(PROJECT)
|
||||
|
||||
|
||||
# Path inclusion flag. Some compilers use a different flag than `-I' to
|
||||
# specify an additional include path. Examples are `/i=' or `-J'.
|
||||
#
|
||||
I := -I
|
||||
|
||||
|
||||
# C flag used to define a macro before the compilation of a given source
|
||||
# object. Usually it is `-D' like in `-DDEBUG'.
|
||||
#
|
||||
D := -D
|
||||
|
||||
|
||||
# The link flag used to specify a given library file on link. Note that
|
||||
# this is only used to compile the demo programs, not the library itself.
|
||||
#
|
||||
L := -l
|
||||
|
||||
|
||||
# Target flag.
|
||||
#
|
||||
T := -o # Don't remove this comment line! We need the space after `-o'.
|
||||
|
||||
|
||||
# C flags
|
||||
#
|
||||
# These should concern: debug output, optimization & warnings.
|
||||
#
|
||||
# Use the ANSIFLAGS variable to define the compiler flags used to enfore
|
||||
# ANSI compliance.
|
||||
#
|
||||
CFLAGS := -c @XX_CFLAGS@ @CFLAGS@
|
||||
|
||||
# ANSIFLAGS: Put there the flags used to make your compiler ANSI-compliant.
|
||||
#
|
||||
ANSIFLAGS := @XX_ANSIFLAGS@
|
||||
|
||||
# C compiler to use -- we use libtool!
|
||||
#
|
||||
#
|
||||
CCraw := $(CC)
|
||||
CC := $(LIBTOOL) --mode=compile $(CCraw)
|
||||
|
||||
# Linker flags.
|
||||
#
|
||||
LDFLAGS := @LDFLAGS@
|
||||
|
||||
|
||||
# Library linking
|
||||
#
|
||||
LINK_LIBRARY = $(LIBTOOL) --mode=link $(CCraw) -o $@ $(OBJECTS_LIST) \
|
||||
-rpath $(libdir) -version-info $(version_info)
|
||||
|
||||
# EOF
|
||||
@@ -0,0 +1,86 @@
|
||||
#
|
||||
# FreeType 2 configuration rules templates for Unix + configure
|
||||
#
|
||||
|
||||
|
||||
# Copyright 1996-2000 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
|
||||
ifndef TOP
|
||||
TOP := .
|
||||
endif
|
||||
TOP := $(shell cd $(TOP); pwd)
|
||||
|
||||
DELETE := @RMF@
|
||||
DELDIR := @RMDIR@
|
||||
SEP := /
|
||||
HOSTSEP := $(SEP)
|
||||
BUILD := $(TOP)/builds/unix
|
||||
PLATFORM := unix
|
||||
|
||||
# don't use `:=' here since the path stuff will be included after this file
|
||||
#
|
||||
FTSYS_SRC = @FTSYS_SRC@
|
||||
|
||||
INSTALL := @INSTALL@
|
||||
INSTALL_DATA := @INSTALL_DATA@
|
||||
INSTALL_PROGRAM := @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT := @INSTALL_SCRIPT@
|
||||
MKINSTALLDIRS := $(BUILD)/mkinstalldirs
|
||||
|
||||
DISTCLEAN += $(BUILD)/config.cache \
|
||||
$(BUILD)/config.log \
|
||||
$(BUILD)/config.status \
|
||||
$(BUILD)/unix-def.mk \
|
||||
$(BUILD)/unix-cc.mk \
|
||||
$(BUILD)/ftconfig.h \
|
||||
$(BUILD)/freetype-config \
|
||||
$(LIBTOOL)
|
||||
|
||||
|
||||
# Standard installation variables.
|
||||
#
|
||||
prefix := @prefix@
|
||||
exec_prefix := @exec_prefix@
|
||||
libdir := @libdir@
|
||||
bindir := @bindir@
|
||||
includedir := @includedir@
|
||||
|
||||
version_info := @version_info@
|
||||
|
||||
|
||||
# The directory where all object files are placed.
|
||||
#
|
||||
# This lets you build the library in your own directory with something like
|
||||
#
|
||||
# set TOP=.../path/to/freetype2/top/dir...
|
||||
# set OBJ_DIR=.../path/to/obj/dir
|
||||
# make -f $TOP/Makefile setup [options]
|
||||
# make -f $TOP/Makefile
|
||||
#
|
||||
ifndef OBJ_DIR
|
||||
OBJ_DIR := $(shell cd $(TOP)/obj; pwd)
|
||||
endif
|
||||
|
||||
|
||||
# The directory where all library files are placed.
|
||||
#
|
||||
# By default, this is the same as $(OBJ_DIR); however, this can be changed
|
||||
# to suit particular needs.
|
||||
#
|
||||
LIB_DIR := $(OBJ_DIR)
|
||||
|
||||
|
||||
# The NO_OUTPUT macro is appended to command lines in order to ignore
|
||||
# the output of some programs.
|
||||
#
|
||||
NO_OUTPUT := 2> /dev/null
|
||||
|
||||
# EOF
|
||||
@@ -0,0 +1,23 @@
|
||||
#
|
||||
# FreeType 2 Configuration rules for Unix + GCC
|
||||
#
|
||||
# Development version without optimizations & libtool
|
||||
# and no installation.
|
||||
#
|
||||
|
||||
|
||||
# Copyright 1996-2000 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
|
||||
include $(TOP)/builds/unix/unixddef.mk
|
||||
include $(TOP)/builds/compiler/gcc-dev.mk
|
||||
include $(TOP)/builds/link_std.mk
|
||||
|
||||
# EOF
|
||||
@@ -0,0 +1,23 @@
|
||||
#
|
||||
# FreeType 2 Configuration rules for Unix + LCC
|
||||
#
|
||||
# Development version without optimizations & libtool
|
||||
# and no installation.
|
||||
#
|
||||
|
||||
|
||||
# Copyright 1996-2000 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
|
||||
include $(TOP)/builds/unix/unixddef.mk
|
||||
include $(TOP)/builds/compiler/unix-lcc.mk
|
||||
include $(TOP)/builds/link_std.mk
|
||||
|
||||
# EOF
|
||||
@@ -0,0 +1,49 @@
|
||||
#
|
||||
# FreeType 2 configuration rules for UNIX platforms
|
||||
#
|
||||
|
||||
|
||||
# Copyright 1996-2000 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
|
||||
include $(TOP)/builds/unix/unix-def.mk
|
||||
include $(TOP)/builds/unix/unix-cc.mk
|
||||
|
||||
ifdef BUILD_PROJECT
|
||||
|
||||
# Now include the main sub-makefile. It contains all the rules used to
|
||||
# build the library with the previous variables defined.
|
||||
#
|
||||
include $(TOP)/builds/$(PROJECT).mk
|
||||
|
||||
|
||||
# The cleanup targets.
|
||||
#
|
||||
clean_project: clean_project_unix
|
||||
distclean_project: distclean_project_unix
|
||||
|
||||
|
||||
# This final rule is used to link all object files into a single library.
|
||||
# It is part of the system-specific sub-Makefile because not all
|
||||
# librarians accept a simple syntax like
|
||||
#
|
||||
# librarian library_file {list of object files}
|
||||
#
|
||||
$(PROJECT_LIBRARY): $(OBJECTS_LIST)
|
||||
ifdef CLEAN_LIBRARY
|
||||
-$(CLEAN_LIBRARY) $(NO_OUTPUT)
|
||||
endif
|
||||
$(LINK_LIBRARY)
|
||||
|
||||
endif
|
||||
|
||||
include $(TOP)/builds/unix/install.mk
|
||||
|
||||
# EOF
|
||||
@@ -0,0 +1,54 @@
|
||||
#
|
||||
# FreeType 2 configuration rules templates for
|
||||
# development under Unix with no configure script (gcc only)
|
||||
#
|
||||
|
||||
|
||||
# Copyright 1996-2000 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
|
||||
ifndef TOP
|
||||
TOP := .
|
||||
endif
|
||||
TOP := $(shell cd $(TOP); pwd)
|
||||
|
||||
DELETE := rm -f
|
||||
SEP := /
|
||||
HOSTSEP := $(SEP)
|
||||
# we use a special devel ftoption.h
|
||||
BUILD := $(TOP)/builds/unix/devel
|
||||
# do not set the platform to `unix', or libtool will trick you
|
||||
PLATFORM := unixdev
|
||||
|
||||
|
||||
# The directory where all object files are placed.
|
||||
#
|
||||
ifndef OBJ_DIR
|
||||
OBJ_DIR := $(shell cd $(TOP)/obj; pwd)
|
||||
endif
|
||||
|
||||
|
||||
# library file name
|
||||
#
|
||||
LIBRARY := lib$(PROJECT)
|
||||
|
||||
|
||||
# The directory where all library files are placed.
|
||||
#
|
||||
# By default, this is the same as $(OBJ_DIR); however, this can be changed
|
||||
# to suit particular needs.
|
||||
#
|
||||
LIB_DIR := $(OBJ_DIR)
|
||||
|
||||
|
||||
#
|
||||
NO_OUTPUT := 2> /dev/null
|
||||
|
||||
# EOF
|
||||
@@ -0,0 +1,268 @@
|
||||
|
||||
FreeType 2 compilation how-to
|
||||
=============================
|
||||
|
||||
|
||||
Introduction
|
||||
------------
|
||||
|
||||
Welcome to the FreeType 2 library. You'll find in this document
|
||||
instructions on how to compile the library on your favorite platform.
|
||||
|
||||
|
||||
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
|
||||
|
||||
|
||||
Note that on Unix, the first `make' invocation will run a configure
|
||||
script (which is located in `freetype2/builds/unix/'. You can also
|
||||
pass parameters to this script with the CFG variable, as in:
|
||||
|
||||
make CFG="--prefix=/usr/local"
|
||||
make
|
||||
|
||||
|
||||
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.
|
||||
|
||||
The FreeType 2 build system relies on many features special to GNU
|
||||
Make -- trying to build the library with any other Make tool will
|
||||
*fail*.
|
||||
|
||||
Make sure that you are invoking GNU Make from the command line, by
|
||||
typing something like:
|
||||
|
||||
make -v
|
||||
|
||||
to display its version number.
|
||||
|
||||
b. Invoke `make'
|
||||
|
||||
Go to the root directory of FreeType 2, 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), invoke GNU Make
|
||||
with
|
||||
|
||||
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 are satisfied by the new configuration summary, skip to
|
||||
step e.
|
||||
|
||||
d. Configure the build system for an unknown platform/compiler
|
||||
|
||||
The auto-detection/setup phase of the build system copies 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, 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 for compiler and linker invocation 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
|
||||
|
||||
|
||||
III. DETAILED COMPILATION PROCEDURE
|
||||
-----------------------------------
|
||||
|
||||
If you don't want to compile FreeType 2 from the command-line (for
|
||||
example if you use a graphical IDE on a Mac or Windows), you will
|
||||
need to understand how the FreeType files are organized.
|
||||
|
||||
FreeType 2 has a very modular design, and it is made of several
|
||||
components. Each component must be compiled as a stand-alone object
|
||||
file, even if 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
|
||||
ftextend.c - extensions support
|
||||
ftlist.c - simple list management
|
||||
ftobjs.c - object management
|
||||
ftoutln.c - simple outline processing
|
||||
ftstream.c - stream input
|
||||
|
||||
However, you can create a single object file by compiling the file
|
||||
`src/base/ftbase.c', which basically contains
|
||||
|
||||
#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:
|
||||
|
||||
src/autohint/autohint.c - the autohinting module
|
||||
src/base/ftbase.c - the base layer, high-level interface
|
||||
src/cache/ftcache.c - a glyph and image caching system
|
||||
(still experimental)
|
||||
src/cff/cff.c - the OpenType font driver
|
||||
src/cid/type1cid.c - the CID-keyed font driver
|
||||
src/psaux/psaux.c - the PS support module
|
||||
src/psnames/psnames.c - a support module to handle PS glyph
|
||||
names
|
||||
src/raster1/raster1.c - the monochrome raster module
|
||||
src/sfnt/sfnt.c - the `sfnt' module
|
||||
src/smooth/smooth.c - the anti-aliasing raster module
|
||||
src/truetype/truetype.c - the TrueType font driver
|
||||
src/type1/type1.c - the Type 1 font driver
|
||||
|
||||
The last module of FreeType 2, winfonts (implementing support for
|
||||
Windows FNT format), is a single file.
|
||||
|
||||
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
|
||||
|
||||
Finally, FreeType 2 contains some other components:
|
||||
|
||||
src/base/ftsystem.c - system-specific memory and i/o support
|
||||
src/base/ftinit.c - initialization layer
|
||||
src/base/ftdebug.c - debugging component (empty in release
|
||||
build)
|
||||
src/base/ftglyph.c - optional convenience functions
|
||||
|
||||
All font drivers are optional. The `sfnt', `psaux', and `psnames'
|
||||
modules are mandatory for certain drivers. However, you may need to
|
||||
update the list of drivers that are statically linked to the
|
||||
library, which is located in the configuration file
|
||||
`include/freetype/config/ftmodule.h'.
|
||||
|
||||
|
||||
IV. 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 still need to only compile the `wrapper' sources
|
||||
described above. Define the `FT_FLAT_COMPILE' macro when
|
||||
compiling. Here 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 -Ifreetype2/include ftsystem.c
|
||||
cc -c -DFT_FLAT_COMPILE -Ifreetype2/include ftinit.c
|
||||
cc -c -DFT_FLAT_COMPILE -Ifreetype2/include ftdebug.c
|
||||
cc -c -DFT_FLAT_COMPILE -Ifreetype2/include ftbase.c
|
||||
etc.
|
||||
|
||||
|
||||
End of file
|
||||
@@ -0,0 +1,164 @@
|
||||
The FreeType Project LICENSE
|
||||
----------------------------
|
||||
|
||||
2000-Feb-08
|
||||
|
||||
Copyright 1996-2000 by
|
||||
David Turner, Robert Wilhelm, and Werner Lemberg
|
||||
|
||||
|
||||
|
||||
Introduction
|
||||
============
|
||||
|
||||
The FreeType Project is distributed in several archive packages;
|
||||
some of them may contain, in addition to the FreeType font engine,
|
||||
various tools and contributions which rely on, or relate to, the
|
||||
FreeType Project.
|
||||
|
||||
This license applies to all files found in such packages, and
|
||||
which do not fall under their own explicit license. The license
|
||||
affects thus the FreeType font engine, the test programs,
|
||||
documentation and makefiles, at the very least.
|
||||
|
||||
This license was inspired by the BSD, Artistic, and IJG
|
||||
(Independent JPEG Group) licenses, which all encourage inclusion
|
||||
and use of free software in commercial and freeware products
|
||||
alike. As a consequence, its main points are that:
|
||||
|
||||
o We don't promise that this software works. However, we will be
|
||||
interested in any kind of bug reports. (`as is' distribution)
|
||||
|
||||
o You can use this software for whatever you want, in parts or
|
||||
full form, without having to pay us. (`royalty-free' usage)
|
||||
|
||||
o You may not pretend that you wrote this software. If you use
|
||||
it, or only parts of it, in a program, you must acknowledge
|
||||
somewhere in your documentation that you have used the
|
||||
FreeType code. (`credits')
|
||||
|
||||
We specifically permit and encourage the inclusion of this
|
||||
software, with or without modifications, in commercial products.
|
||||
We disclaim all warranties covering The FreeType Project and
|
||||
assume no liability related to The FreeType Project.
|
||||
|
||||
|
||||
Legal Terms
|
||||
===========
|
||||
|
||||
0. Definitions
|
||||
--------------
|
||||
|
||||
Throughout this license, the terms `package', `FreeType Project',
|
||||
and `FreeType archive' refer to the set of files originally
|
||||
distributed by the authors (David Turner, Robert Wilhelm, and
|
||||
Werner Lemberg) as the `FreeType Project', be they named as alpha,
|
||||
beta or final release.
|
||||
|
||||
`You' refers to the licensee, or person using the project, where
|
||||
`using' is a generic term including compiling the project's source
|
||||
code as well as linking it to form a `program' or `executable'.
|
||||
This program is referred to as `a program using the FreeType
|
||||
engine'.
|
||||
|
||||
This license applies to all files distributed in the original
|
||||
FreeType Project, including all source code, binaries and
|
||||
documentation, unless otherwise stated in the file in its
|
||||
original, unmodified form as distributed in the original archive.
|
||||
If you are unsure whether or not a particular file is covered by
|
||||
this license, you must contact us to verify this.
|
||||
|
||||
The FreeType Project is copyright (C) 1996-2000 by David Turner,
|
||||
Robert Wilhelm, and Werner Lemberg. All rights reserved except as
|
||||
specified below.
|
||||
|
||||
1. No Warranty
|
||||
--------------
|
||||
|
||||
THE FREETYPE PROJECT IS PROVIDED `AS IS' WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. IN NO EVENT WILL ANY OF THE AUTHORS OR COPYRIGHT HOLDERS
|
||||
BE LIABLE FOR ANY DAMAGES CAUSED BY THE USE OR THE INABILITY TO
|
||||
USE, OF THE FREETYPE PROJECT.
|
||||
|
||||
2. Redistribution
|
||||
-----------------
|
||||
|
||||
This license grants a worldwide, royalty-free, perpetual and
|
||||
irrevocable right and license to use, execute, perform, compile,
|
||||
display, copy, create derivative works of, distribute and
|
||||
sublicense the FreeType Project (in both source and object code
|
||||
forms) and derivative works thereof for any purpose; and to
|
||||
authorize others to exercise some or all of the rights granted
|
||||
herein, subject to the following conditions:
|
||||
|
||||
o Redistribution of source code must retain this license file
|
||||
(`LICENSE.TXT') unaltered; any additions, deletions or changes
|
||||
to the original files must be clearly indicated in
|
||||
accompanying documentation. The copyright notices of the
|
||||
unaltered, original files must be preserved in all copies of
|
||||
source files.
|
||||
|
||||
o Redistribution in binary form must provide a disclaimer that
|
||||
states that the software is based in part of the work of the
|
||||
FreeType Team, in the distribution documentation. We also
|
||||
encourage you to put an URL to the FreeType web page in your
|
||||
documentation, though this isn't mandatory.
|
||||
|
||||
These conditions apply to any software derived from or based on
|
||||
the FreeType Project, not just the unmodified files. If you use
|
||||
our work, you must acknowledge us. However, no fee need be paid
|
||||
to us.
|
||||
|
||||
3. Advertising
|
||||
--------------
|
||||
|
||||
Neither the FreeType authors and contributors nor you shall use
|
||||
the name of the other for commercial, advertising, or promotional
|
||||
purposes without specific prior written permission.
|
||||
|
||||
We suggest, but do not require, that you use one or more of the
|
||||
following phrases to refer to this software in your documentation
|
||||
or advertising materials: `FreeType Project', `FreeType Engine',
|
||||
`FreeType library', or `FreeType Distribution'.
|
||||
|
||||
As you have not signed this license, you are not required to
|
||||
accept it. However, as the FreeType Project is copyrighted
|
||||
material, only this license, or another one contracted with the
|
||||
authors, grants you the right to use, distribute, and modify it.
|
||||
Therefore, by using, distributing, or modifying the FreeType
|
||||
Project, you indicate that you understand and accept all the terms
|
||||
of this license.
|
||||
|
||||
4. Contacts
|
||||
-----------
|
||||
|
||||
There are two mailing lists related to FreeType:
|
||||
|
||||
o [email protected]
|
||||
|
||||
Discusses general use and applications of FreeType, as well as
|
||||
future and wanted additions to the library and distribution.
|
||||
If you are looking for support, start in this list if you
|
||||
haven't found anything to help you in the documentation.
|
||||
|
||||
o [email protected]
|
||||
|
||||
Discusses bugs, as well as engine internals, design issues,
|
||||
specific licenses, porting, etc.
|
||||
|
||||
o http://www.freetype.org
|
||||
|
||||
Holds the current FreeType web page, which will allow you to
|
||||
download our latest development version and read online
|
||||
documentation.
|
||||
|
||||
You can also contact us individually at:
|
||||
|
||||
David Turner <[email protected]>
|
||||
Robert Wilhelm <[email protected]>
|
||||
Werner Lemberg <[email protected]>
|
||||
|
||||
|
||||
--- end of LICENSE.TXT ---
|
||||
@@ -0,0 +1,339 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
|
||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
Appendix: How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) 19yy <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) 19yy name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Library General
|
||||
Public License instead of this License.
|
||||
@@ -0,0 +1,267 @@
|
||||
The FreeType 2 cache sub-system explained
|
||||
(c) 2000 David Turner
|
||||
|
||||
-----------------------------------------------
|
||||
|
||||
Introduction :
|
||||
--------------
|
||||
|
||||
this document describes the caching sub-system that comes
|
||||
with the FreeType library, version 2.0. Note that unlike
|
||||
the rest of the library, this code is still in beta stage
|
||||
and might still suffer slight changes in the future.
|
||||
|
||||
Its basic design shouldn't evolve though and is explained
|
||||
in this paper.
|
||||
|
||||
|
||||
I. Requirements and Design Goals:
|
||||
---------------------------------
|
||||
|
||||
The FT2 cache sub-system was designed to implement caching
|
||||
of glyph images. However, it is extremely flexible and can
|
||||
be easily extended to cache other kind of data like metrics,
|
||||
character maps, coverage tables, etc..
|
||||
|
||||
|
||||
II. Base Concepts:
|
||||
------------------
|
||||
|
||||
1. The cache manager object:
|
||||
|
||||
at the heart of the caching sub-system is a single object
|
||||
called the "cache manager". It is used to deal with FT_Face
|
||||
and FT_Size objects, as well as to manager a LRU list of
|
||||
abstract "cache nodes".
|
||||
|
||||
a. caching FT_Face and FT_Size objects:
|
||||
|
||||
each FT_Face object created by FreeType 2 can take from
|
||||
a few hundred bytes to several tens of kilobytes, depending
|
||||
on the original font's file format as well as its content.
|
||||
|
||||
there is no easy way to compute the size of a given FT_Face
|
||||
object, so it's always a good idea to assume that it is
|
||||
large and to want to limit the number of live face objects
|
||||
as much as possible.
|
||||
|
||||
similarly, each FT_Face can have one or more FT_Size childs,
|
||||
whose byte size depends heavily on the font format.
|
||||
|
||||
the first purpose of the cache manager is to provide a
|
||||
small cache for FT_Face and FT_Size objects. Basically,
|
||||
an application can use it as follows:
|
||||
|
||||
- each font face is described to the cache manager
|
||||
through a typeless pointer, called a FTC_FaceID.
|
||||
|
||||
the cache manager itself doesn't interpret or use
|
||||
the value of FTC_FaceIDs directly. Rather, it passes
|
||||
them to a user-provided function called a
|
||||
"face requester". see the defintion of the
|
||||
FTC_Face_Requester type in <freetype/ftcache.h>
|
||||
for details..
|
||||
|
||||
the face requester is in charge of translating a given
|
||||
face into into a real new FT_Face object that is
|
||||
returned to the cache manager. The latter will keep
|
||||
the face object alive as long as it needs to.
|
||||
|
||||
the face requester is unique and must be passed
|
||||
to the function named FTC_Manager_New used to
|
||||
create/initialise a new cache manager.
|
||||
|
||||
|
||||
- to lookup a given FT_Face, call the function
|
||||
FTC_Manager_Lookup_Face as in the following code:
|
||||
|
||||
FTC_Manager_Lookup_Face( manager,
|
||||
face_id,
|
||||
&face );
|
||||
|
||||
if the corresponding FT_Face object is kept in
|
||||
the cache manager's list, it will be returned
|
||||
directly. Otherwise, this function will call
|
||||
the user-provided face requester to create
|
||||
a new FT_Face object, add it to the manager's
|
||||
list to finally return it.
|
||||
|
||||
FT_Face objects are always destroyed by the cache
|
||||
manager. An application that uses the cache
|
||||
sub-system should never call FT_Done_Face !!
|
||||
|
||||
- to lookup a given FT_Size and FT_Face, call the
|
||||
function FTC_Manager_Lookup_Size, as in:
|
||||
|
||||
FTC_Manager_Lookup_Size( manager,
|
||||
ftc_font,
|
||||
&face,
|
||||
&size );
|
||||
|
||||
where "ftc_font" is a pointer to a FTC_Font descriptor
|
||||
(a structure containing a FTC_FaceIDs and character
|
||||
dimensions corresponding to the desired FT_Size).
|
||||
|
||||
note that the function returns both a FT_Face and
|
||||
a FT_Size object. You don't need to call
|
||||
FTC_Manager_Lookup_Face before it !!
|
||||
|
||||
also note that returned FT_Size objects are always
|
||||
destroyed by the cache manager. A client application
|
||||
that uses it should never call FT_Done_Size !!
|
||||
|
||||
|
||||
the big advantage of using FTC_FaceIDs is that is
|
||||
makes the caching sub-system completely independent
|
||||
of the way font files are installed / listed / managed
|
||||
in your application. In most implementations, a FTC_FaceID
|
||||
is really a pointer to an application-specific structure
|
||||
that describe the source font file + face index.
|
||||
|
||||
|
||||
b - manage a MRU list of abstract "cache nodes":
|
||||
|
||||
the second role of the cache manager is to hold and manager
|
||||
a list of abstract "cache nodes". The list is always sorted
|
||||
in most-recently-used order. The manager always ensure that
|
||||
the total size of nodes in memory doesn't over-reach a
|
||||
certain threshold, by eliminating "old" nodes when
|
||||
necessary.
|
||||
|
||||
the cache manager doesn't know much about the cache nodes:
|
||||
|
||||
- it knows how to move them in its list
|
||||
- it knows how to destroy them when they're too old
|
||||
- it knows how to "size" them (i.e. compute their byte
|
||||
size in memory)
|
||||
|
||||
|
||||
2. Cache objects:
|
||||
|
||||
the cache manager doesn't create new cache nodes however, this
|
||||
is the charge of what are called "cache objects".
|
||||
|
||||
Basically, each cache object is in charge of managing cache
|
||||
nodes of a certain type. Its role is to:
|
||||
|
||||
- provide a simple description of its cache nodes to the
|
||||
manager (i.e. through a FTC_CacheNode_Class structure)
|
||||
|
||||
- provide a high-level API that can be called by client
|
||||
applications to lookup cache nodes of the corresponding
|
||||
type.
|
||||
|
||||
this function usually creates new nodes when they're not
|
||||
available yet.
|
||||
|
||||
- also, and even though this is completely transparent to
|
||||
the applications and the cache manager, each cache object
|
||||
manages "node sets", where each set contains cache nodes
|
||||
usually correspond to the same font face + font size.
|
||||
|
||||
|
||||
For example, the cache sub-system currently comes with two
|
||||
distinct cache classes:
|
||||
|
||||
- a FTC_Image_Cache, which is used to cache FT_Glyph images
|
||||
(with one FT_Glyph per cache node).
|
||||
|
||||
|
||||
- a FTC_SBit_Cache, which is used to cache small glyph bitmaps
|
||||
("sbit" means "embedded bitmaps" in digital typography).
|
||||
|
||||
|
||||
the small bitmaps glyph is useful because storing one glyph
|
||||
image per cache node isn't memory efficient when the data
|
||||
associated to each node is very small. Indeed, each cache
|
||||
node has a minimal size of 20 bytes, which is huge when
|
||||
your data is an 8x8 monochrome bitmap :-)
|
||||
|
||||
Hence, a FTC_SBit_Cache is capable of storing several
|
||||
contiguous sbits in a single cache node, resulting in much
|
||||
higher cached glyphs / total cache size.
|
||||
|
||||
an application can lookup a FT_Glyph image with a FTC_Image_Cache
|
||||
by calling:
|
||||
|
||||
error = FTC_Image_Cache_Lookup( image_cache,
|
||||
ftc_font,
|
||||
glyph_index,
|
||||
&ft_glyph );
|
||||
|
||||
or a FTC_SBit (small bitmap descriptor) by calling:
|
||||
|
||||
error = FTC_SBit_Cache_Lookup( sbit_cache,
|
||||
ftc_font,
|
||||
glyph_index,
|
||||
&ftc_sbit );
|
||||
|
||||
III. Extending the cache sub-system:
|
||||
|
||||
It is possible to extend the current cache sub-system by
|
||||
providing your own cache class and register it in the cache
|
||||
manager. That might be useful to cache other kind of data
|
||||
in the sub-system, like glyph metrics (without images),
|
||||
|
||||
To do it, you'll need to read the cache sub-system public
|
||||
header files rather heavily :-) Fortunately, they're pretty
|
||||
well commented and should guide you to your goal.
|
||||
|
||||
Note that the cache sub-system already provides two "abstract
|
||||
cache" classes that can be re-used by your own implementation:
|
||||
|
||||
|
||||
1. The abstract "FTC_GlyphCache" class:
|
||||
|
||||
this code is used to implement an abstract "glyph cache",
|
||||
i.e. one that simply maps one glyph data per cache node.
|
||||
|
||||
it is sub-classed by FTC_Image_Cache, whose implementation
|
||||
only consists in simple code to store a FT_Glyph in each
|
||||
cache node.
|
||||
|
||||
you could sub-class it in your application to store glyph
|
||||
images in a different format, for example.
|
||||
|
||||
see the files <freetype/cache/ftcglyph.h> and
|
||||
"src/cache/ftcglyph.h" for details.
|
||||
|
||||
|
||||
2. The abstract "FTC_ChunkCache" class:
|
||||
|
||||
this code is used to implement an abstract "glyph chunk cache".
|
||||
it's very similar to a FTC_GlyphCache, except that it is capable
|
||||
of storing several glyph-specific elements per cache node.
|
||||
|
||||
it is sub-classed by FTC_SBit_Cache, whose implementation
|
||||
only consists in code to store a FTC_SBitRec record in each
|
||||
node element.
|
||||
|
||||
you could sub-class it in your application to store small
|
||||
glyph data, like metrics, glyph names, wathever.
|
||||
|
||||
see the files <freetype/cache/ftcchunk.h> and
|
||||
"src/cache/ftcchunk.h" for details..
|
||||
|
||||
|
||||
Note that the two abstract caches are rather complex because
|
||||
they use "glyph sets". Each glyph set corresponds to a single
|
||||
font face + font size combination. both caches are also
|
||||
glyph-specific, though it is perfectly possible to use
|
||||
broader selection criterion, here are a few examples:
|
||||
|
||||
- caching language coverage maps corresponding to
|
||||
a given font face + language combination
|
||||
|
||||
- caching charmaps, layout tables, and other global
|
||||
data..
|
||||
|
||||
- caching (font_face + font_size) specific "latin1"
|
||||
ascender + descender
|
||||
|
||||
|
||||
as you can see, a lot is possible with this design :-)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,710 @@
|
||||
|
||||
Conventions and Design in the FreeType 2 library
|
||||
------------------------------------------------
|
||||
|
||||
|
||||
Table of Contents
|
||||
|
||||
Introduction
|
||||
|
||||
I. Style and Formatting
|
||||
|
||||
1. Naming
|
||||
2. Declarations & Statements
|
||||
3. Blocks
|
||||
4. Macros
|
||||
5. Conventions
|
||||
|
||||
II. Design conventions
|
||||
|
||||
1. Modularity and Components Layout
|
||||
2. Configuration and Debugging
|
||||
|
||||
III. Usage conventions
|
||||
|
||||
1. Error handling
|
||||
2. Font File I/O
|
||||
3. Memory management
|
||||
4. Support for threaded environments
|
||||
5. Object Management
|
||||
|
||||
|
||||
|
||||
Introduction
|
||||
============
|
||||
|
||||
This text introduces the many conventions used within the FreeType 2
|
||||
library code. Please read it before trying any modifications or
|
||||
extensions of the source code.
|
||||
|
||||
|
||||
|
||||
I. Style and Formatting
|
||||
=======================
|
||||
|
||||
The following coding rules are extremely important to keep the
|
||||
library's source code homogeneously. Keep in mind the following
|
||||
points:
|
||||
|
||||
- `Humans read source code, not machines' (Donald Knuth)
|
||||
|
||||
The library source code should be as readable as possible, even
|
||||
by non-C experts. With `readable', two things are meant: First,
|
||||
the source code should be pleasant to the eye, with sufficient
|
||||
whitespace and newlines, to not look like a boring stack of
|
||||
characters stuck to each other. Second, the source should be
|
||||
_expressive_ enough about its goals. This convention contains
|
||||
rules that can help the source focus on its purpose, not on a
|
||||
particular implementation.
|
||||
|
||||
- `Paper is the _ultimate_ debugger' (David Turner :-)
|
||||
|
||||
There is nothing like sheets of paper (and a large floor) to
|
||||
help you understand the design of a library you're new to, or to
|
||||
debug it. The formatting style presented here is targeted at
|
||||
printing. For example, it is more than highly recommended to
|
||||
never produce a source line that is wider than 78 columns. More
|
||||
on this below.
|
||||
|
||||
|
||||
1. Naming
|
||||
---------
|
||||
|
||||
a. Long and expressive labels
|
||||
|
||||
Never hesitate to use long labels for your types, variables,
|
||||
etc.! Except maybe for things like very trivial types, the
|
||||
longest is the best, as it increases the source's
|
||||
_expressiveness_. Never forget that the role of a label is to
|
||||
express the `function' of the entity it represents, not its
|
||||
implementation!
|
||||
|
||||
NOTE: Hungarian notation is NOT expressive, as it sticks the
|
||||
`type' of a variable to its name. A label like `usFoo'
|
||||
rarely tells the use of the variable it represents.
|
||||
|
||||
And the state of a variable (global, static, dynamic)
|
||||
isn't helpful anymore.
|
||||
|
||||
Conclusion: Avoid Hungarian Notation in FreeType 2.
|
||||
|
||||
|
||||
When forging a name with several nouns
|
||||
(e.g. `number-of-points'), use an uppercase letter for the first
|
||||
letter of each word (except the first), like:
|
||||
|
||||
numberOfPoints
|
||||
|
||||
You are also welcome to introduce underscores `_' in your
|
||||
labels, especially when sticking large nouns together, as it
|
||||
`airs' the code greatly. E.g.:
|
||||
|
||||
`numberOfPoints' or `number_Of_Points'
|
||||
|
||||
`IncredibleFunction' or `Incredible_Function'
|
||||
|
||||
And finally, always put a capital letter after an underscore,
|
||||
except in variable labels that are all lowercase:
|
||||
|
||||
`number_of_points' is OK for a variable (_all_ lowercase label)
|
||||
|
||||
`incredible_function' is NOT for a function!
|
||||
^ ^
|
||||
|
||||
`Microsoft_windows' is a *shame*!
|
||||
^ ^
|
||||
|
||||
`Microsoft_Windows' isn't really better, but at least its a
|
||||
^ ^ correct function label within this
|
||||
convention ;-)
|
||||
|
||||
b. Data types
|
||||
|
||||
Try to use C types to the very least! Rely on internally
|
||||
defined equivalent types instead. For example, not all
|
||||
compilers agree on the sign of `char'; the size of `int' is
|
||||
platform-specific, etc.
|
||||
|
||||
There are equivalents to the most common types in the
|
||||
`fttypes.h' public header file, like `FT_Short', `FT_UShort',
|
||||
etc. Using the internal types will guarantee that you won't
|
||||
need to replace every occurence of `short' or whatever when
|
||||
compiling on a weird platform or with a weird compiler, and
|
||||
there are many more than you could think of...
|
||||
|
||||
c. Functions
|
||||
|
||||
The name of a function should always begin with a capital
|
||||
letter, as lowercase first letters are reserved for variables.
|
||||
The name of a function should be, again, _expressive_! Never
|
||||
hesitate to put long function names in your code: It will make
|
||||
the code much more readable.
|
||||
|
||||
Expressiveness doesn't necessarily imply lengthiness though; for
|
||||
instance, reading various data types from a file stream is
|
||||
performed using the following functions defined in the
|
||||
`ftstream.c' file of the `base' module:
|
||||
|
||||
FT_Get_Char(), FT_Get_Short(), FT_Get_Long(), etc.
|
||||
|
||||
Which is somewhat more readable than:
|
||||
|
||||
cget, sget, usget, lget, etc.
|
||||
|
||||
d. Variables
|
||||
|
||||
Variable names (at least meant for the public interface) should
|
||||
always begin with a lowercase letter. Lowercase first letters
|
||||
are reserved for variables in this convention, as it has been
|
||||
already explained above. You are still welcome to use long and
|
||||
expressive variable names.
|
||||
|
||||
Something like `numP' can express a number of pixels, porks,
|
||||
pancakes, and much more... Something like `num_points' won't.
|
||||
|
||||
Unfortunately (mostly due to the lazyness of the developers),
|
||||
short variable names are still used in many parts of the
|
||||
library. Volunteers are highly welcome to improve this...
|
||||
|
||||
As a side note, a field name of a structure counts as a variable
|
||||
name too.
|
||||
|
||||
|
||||
2. Declarations & Statements
|
||||
----------------------------
|
||||
|
||||
Try to align declarations and assignments in columns, if it proves
|
||||
logically. For example (taken from `ttraster.c'):
|
||||
|
||||
struct TProfile_
|
||||
{
|
||||
FT_F26Dot6 X; /* current coordinate during sweep */
|
||||
PProfile link; /* link to next profile - various purpose */
|
||||
PLong offset; /* start of profile's data in render pool */
|
||||
Int flow; /* profile orientation: asc/descending */
|
||||
Long height; /* profile's height in scanlines */
|
||||
Long start; /* profile's starting scanline */
|
||||
|
||||
UShort countL; /* number of lines to step before this */
|
||||
/* profile becomes drawable */
|
||||
|
||||
PProfile next; /* next profile in same contour, used */
|
||||
/* during drop-out control */
|
||||
};
|
||||
|
||||
instead of
|
||||
|
||||
struct TProfile_
|
||||
{
|
||||
FT_F26Dot6 X; /* current coordinate during sweep */
|
||||
PProfile link; /* link to next profile - various purpose */
|
||||
PLong offset; /* start of profile's data in render pool */
|
||||
Int flow; /* profile orientation: asc/descending */
|
||||
Long height; /* profile's height in scanlines */
|
||||
Long start; /* profile's starting scanline */
|
||||
UShort countL; /* number of lines to step before this */
|
||||
/* profile becomes drawable */
|
||||
PProfile next; /* next profile in same contour, used */
|
||||
/* during drop-out control */
|
||||
};
|
||||
|
||||
This comes from the fact that you are more interested in the field
|
||||
and its function than in its type.
|
||||
|
||||
Or:
|
||||
|
||||
x = i + 1;
|
||||
y += j;
|
||||
min = 100;
|
||||
|
||||
instead of
|
||||
|
||||
x=i+1;
|
||||
y+=j;
|
||||
min=100;
|
||||
|
||||
And don't hesitate to separate blocks of declarations with
|
||||
newlines to `distinguish' logical sections.
|
||||
|
||||
E.g., taken from an old source file, in the declarations of the
|
||||
CMap loader:
|
||||
|
||||
long n, num_SH;
|
||||
unsigned short u;
|
||||
long off;
|
||||
unsigned short l;
|
||||
long num_Seg;
|
||||
unsigned short* glArray;
|
||||
long table_start;
|
||||
int limit, i;
|
||||
|
||||
TCMapDir cmap_dir;
|
||||
TCMapDirEntry entry_;
|
||||
PCMapTable Plcmt;
|
||||
PCMap2SubHeader Plcmsub;
|
||||
PCMap4 Plcm4;
|
||||
PCMap4Segment segments;
|
||||
|
||||
instead of
|
||||
|
||||
long n, num_SH;
|
||||
unsigned short u;
|
||||
long off;
|
||||
unsigned short l;
|
||||
long num_Seg;
|
||||
unsigned short *glArray;
|
||||
long table_start;
|
||||
int limit, i;
|
||||
TCMapDir cmap_dir;
|
||||
TCMapDirEntry entry_;
|
||||
PCMapTable Plcmt;
|
||||
PCMap2SubHeader Plcmsub;
|
||||
PCMap4 Plcm4;
|
||||
PCMap4Segment segments;
|
||||
|
||||
|
||||
3. Blocks
|
||||
---------
|
||||
|
||||
Block separation is done with `{' and `}'. We do not use the K&R
|
||||
convention which becomes only useful with an extensive use of
|
||||
tabs. The `{' and its corresponding `}' should always be on the
|
||||
same column. It makes it easier to separate a block from the rest
|
||||
of the source, and it helps your _brain_ associate the accolades
|
||||
easily (ask any Lisp programmer on the topic!).
|
||||
|
||||
Use two spaces for the next indentation level.
|
||||
|
||||
Never use tabs in FreeType 2 code; their widths may vary with
|
||||
editors and systems.
|
||||
|
||||
Example:
|
||||
|
||||
if (condition_test) {
|
||||
waow mamma;
|
||||
I'm doing K&R format;
|
||||
just like the Linux kernel;
|
||||
} else {
|
||||
This test failed poorly;
|
||||
}
|
||||
|
||||
should be rather formatted as
|
||||
|
||||
if ( condition_test )
|
||||
{
|
||||
This code isn't stuck to the condition;
|
||||
read it on paper, you will find it more;
|
||||
pleasant to the eye;
|
||||
}
|
||||
else
|
||||
{
|
||||
Of course, this is a matter of taste;
|
||||
This is just the way it is in this convention;
|
||||
and you should follow it to be homogenuous with;
|
||||
the rest of the FreeType code;
|
||||
}
|
||||
|
||||
|
||||
4. Macros
|
||||
---------
|
||||
|
||||
Macros should be made of uppercase letters. If a macro label is
|
||||
forged from several words, it is possible to only uppercasify the
|
||||
first word, using an underscore to separate the nouns. This is
|
||||
used in in some files for macros like
|
||||
|
||||
GET_UShort(), USE_Stream(), etc.
|
||||
|
||||
The role of macros used throughout the engine is explained later
|
||||
in this document.
|
||||
|
||||
|
||||
5. Conventions
|
||||
--------------
|
||||
|
||||
Currently, FreeType 2 source code uses the following formatting
|
||||
rules:
|
||||
|
||||
. The data type is separated with two spaces from the variable,
|
||||
structure, or function name:
|
||||
|
||||
const char foo;
|
||||
|
||||
Usually, the `*' operator is concatenated to the data type:
|
||||
|
||||
FT_Int* pointer;
|
||||
|
||||
However, when declaring resp. defining an `output' parameter
|
||||
(i.e. a pointer which will be assigned by the function), the
|
||||
last `*' must be placed on the right in order to denote this, as
|
||||
in:
|
||||
|
||||
FT_New_Face( FT_Library library,
|
||||
FT_Face *aface );
|
||||
|
||||
where the `*' is used to indicate that `aface' is returned. In
|
||||
most cases, the name of such an output variable starts with `a'
|
||||
or `an' (`aface' instead of `face', `anlru' instead of `lru',
|
||||
etc.), following the English rules of the indefinite article.
|
||||
|
||||
. As mentioned above, multiple declarations are vertically
|
||||
aligned:
|
||||
|
||||
FT_Short foo;
|
||||
FT_Long bar;
|
||||
FT_GlyphSlot slot;
|
||||
|
||||
. Declarations are separated with two blank lines from the
|
||||
following code. This intentionally disturbs the code flow to
|
||||
make variable definitions more visible.
|
||||
|
||||
{
|
||||
char x, y;
|
||||
|
||||
|
||||
x = 3;
|
||||
y = 5;
|
||||
}
|
||||
|
||||
. An opening parenthesis follows a function directly without
|
||||
space; after a built-in C keyword, one space is used:
|
||||
|
||||
x = sin( y );
|
||||
y = sizeof ( long );
|
||||
|
||||
Except for casts, empty parameters, and the closing semicolon,
|
||||
parentheses are surrounded with space:
|
||||
|
||||
x = (char*)( foo + bar );
|
||||
y = rand();
|
||||
|
||||
. Binary operators are surrounded by spaces; unary operators have
|
||||
no space after it:
|
||||
|
||||
x = ( 3 + 4 ) / ( 7 - 2 );
|
||||
y = -( 3 + 4 ) * 7;
|
||||
|
||||
. Array arguments are not surrounded by spaces:
|
||||
|
||||
array[3] = array[1] + array[2];
|
||||
array[4] = array[1 + 3];
|
||||
|
||||
. Comma and semicolon have only space at the right side:
|
||||
|
||||
if ( x = 0; x < y; x++, y-- )
|
||||
do_something();
|
||||
|
||||
Exception:
|
||||
|
||||
for (;;)
|
||||
{
|
||||
...
|
||||
|
||||
. Don't use
|
||||
|
||||
if ( x == y ) a = b;
|
||||
|
||||
but
|
||||
|
||||
if ( x == y )
|
||||
a = b;
|
||||
|
||||
in general.
|
||||
|
||||
. Preprocessor directives are never indented and always start in
|
||||
the first column.
|
||||
|
||||
. All function/structure/variable definitions start at column
|
||||
three.
|
||||
|
||||
. All full-line comments (except the header of a file) start at
|
||||
column three (even comments for preprocessor directives).
|
||||
|
||||
. Labels are sticking out two positions to the left:
|
||||
|
||||
switch ( x )
|
||||
{
|
||||
case 1:
|
||||
do_something();
|
||||
break;
|
||||
default:
|
||||
do_nothing();
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
II. Design Conventions
|
||||
======================
|
||||
|
||||
|
||||
1. Modularity and Components Layout
|
||||
-----------------------------------
|
||||
|
||||
The FreeType 2 engine has been designed with portability in mind.
|
||||
This implies the ability to compile and run it on a great variety
|
||||
of systems and weird environments, unlike many packages where the
|
||||
word strictly means `runs on a bunch of Unix-like systems'. We
|
||||
have thus decided to stick to the following restrictions:
|
||||
|
||||
- The C version is written entirely in ANSI C.
|
||||
|
||||
- The library, if compiled with gcc, doesn't produce any warning
|
||||
with the `-ansi -pedantic' flags. Other compilers with better
|
||||
checks may produce ANSI warnings -- please report.
|
||||
|
||||
(NOTE: It can of course be compiled by an `average' C compiler,
|
||||
and even by a C++ one.)
|
||||
|
||||
- It only requires in its simplest form an ANSI libc to compile,
|
||||
and no utilities other than a C preprocessor, compiler, and
|
||||
linker.
|
||||
|
||||
- It consists of modules, starting with a `base' module which
|
||||
provides the API, some auxiliary modules used by the font
|
||||
drivers, the font driver modules itself, and the rasterizer
|
||||
modules.
|
||||
|
||||
- The very low-level components can be easily replaced by
|
||||
system-specific ones that do not rely on the standard libc.
|
||||
These components deal mainly with i/o, memory, and mutex
|
||||
operations.
|
||||
|
||||
- A client application only needs to include one header file named
|
||||
`freetype.h' to use the engine. Other public header files like
|
||||
`ftglyph.h' or `ftimage.h' provide functional extensions.
|
||||
|
||||
- All configuration options are gathered in two files,
|
||||
`ftconfig.h' and `ftoption.h'. The former contains the
|
||||
processor and OS specific configuration options, while the
|
||||
latter treats options that may be enabled or disabled by the
|
||||
user to enable and disable various features.
|
||||
|
||||
|
||||
2. Configuration and Debugging
|
||||
------------------------------
|
||||
|
||||
Configuration is covered by the `BUILD' documentation file.
|
||||
|
||||
Debugging is controlled by two macros in `ftoption.h',
|
||||
FT_DEBUG_LEVEL_ERROR and FT_DEBUG_LEVEL_TRACE; don't use them in
|
||||
code to be released. Check the source code of the `ftview.c'
|
||||
demonstration program (in the `ft2demos' package) how tracing can
|
||||
be used and activated.
|
||||
|
||||
|
||||
|
||||
III. Usage conventions
|
||||
======================
|
||||
|
||||
|
||||
1. Error Handling
|
||||
-----------------
|
||||
|
||||
Most functions directly return an error code. A return value of 0
|
||||
(FT_Err_Ok) means that no error occured, while a non-zero other
|
||||
value indicates a failure of any kind.
|
||||
|
||||
We use code like this in FreeType 2:
|
||||
|
||||
if ( ( rc = Perform_Action_1( parms_of_1 ) ) ||
|
||||
( rc = Perform_Action_2( parms_of_2 ) ) ||
|
||||
( rc = Perform_Action_3( parms_of_3 ) ) )
|
||||
goto Fail;
|
||||
|
||||
which is better but uses assignments within expressions, which are
|
||||
always delicate to manipulate in C (the risk of writing `=='
|
||||
exists, and would go unnoticed by a compiler). Moreover, the
|
||||
assignments are a bit redundant and don't express much things
|
||||
about the actions performed (they only speak of the error
|
||||
management issue).
|
||||
|
||||
That is why some macros have been defined for the most frequently
|
||||
used functions. They relate to low-level routines that are called
|
||||
very often (mainly i/o and memory handling functions). Each macro
|
||||
produces an implicit assignment to a variable called `error' and
|
||||
can be used instead as a simple function call. Example:
|
||||
|
||||
if ( PERFORM_Action_1( parms_of_1 ) ||
|
||||
PERFORM_Action_2( parms_of_2 ) ||
|
||||
PERFORM_Action_3( parms_of_3 ) )
|
||||
goto Fail;
|
||||
|
||||
with
|
||||
|
||||
#define PERFORM_Action_1( parms_1 ) \
|
||||
( error = Perform_Action_1( parms_1 ) )
|
||||
#define PERFORM_Action_2( parms_1 ) \
|
||||
( error = Perform_Action_2( parms_1 ) )
|
||||
#define PERFORM_Action_3( parms_1 ) \
|
||||
( error = Perform_Action_3( parms_1 ) )
|
||||
|
||||
defined in some header file.
|
||||
|
||||
There, the developer only needs to define a local `error' variable
|
||||
and use the macros directly in the code, without caring about the
|
||||
actual error handling performed. Another advantage is that the
|
||||
structure of source files remain very similar, even though the
|
||||
error handling may be different.
|
||||
|
||||
This convention is very close to the use of exceptions in
|
||||
languages like C++, Pascal, Java, etc. where the developer
|
||||
focuses on the actions to perform, and not on every little error
|
||||
checking.
|
||||
|
||||
|
||||
2. Font File I/O
|
||||
----------------
|
||||
|
||||
a. Streams
|
||||
|
||||
The engine uses `streams' to access the font files. A stream is
|
||||
a structure containing information used to access files through
|
||||
a system-specific i/o library.
|
||||
|
||||
The default implementation of streams uses the ANSI libc i/o
|
||||
functions. However, for the sake of embedding in light systems
|
||||
and independence of a complete C library, it is possible to
|
||||
re-implement the component for a specific system or OS, letting
|
||||
it use system calls.
|
||||
|
||||
b. Frames
|
||||
|
||||
TrueType is tied to the big-endian format, which implies that
|
||||
reading shorts or longs from the font file may need conversions
|
||||
depending on the target processor. To be able to easily detect
|
||||
read errors and allow simple conversion calls or macros, the
|
||||
engine is able to access a font file using `frames'.
|
||||
|
||||
A frame is simply a sequence of successive bytes taken from the
|
||||
input file at the current position. A frame is pre-loaded into
|
||||
memory by a call to the `ACCESS_Frame()' macro.
|
||||
|
||||
It is then possible to read all sizes of data through the
|
||||
`GET_xxx()' macros described above.
|
||||
|
||||
When all important data is read, the frame can be released by a
|
||||
call to `FORGET_Frame()'.
|
||||
|
||||
The benefits of frames are various. Consider these two
|
||||
approaches at extracting values:
|
||||
|
||||
if ( ( error = Read_Short( &var1 ) ) ||
|
||||
( error = Read_Long ( &var2 ) ) ||
|
||||
( error = Read_Long ( &var3 ) ) ||
|
||||
( error = Read_Short( &var4 ) ) )
|
||||
|
||||
return FAILURE;
|
||||
|
||||
and
|
||||
|
||||
/* Read the next 16 bytes */
|
||||
if ( ACCESS_Frame( 16L ) )
|
||||
return error; /* The Frame could not be read */
|
||||
|
||||
var1 = GET_Short(); /* extract values from the frame */
|
||||
var2 = GET_Long();
|
||||
var3 = GET_Long();
|
||||
var4 = GET_Short();
|
||||
|
||||
FORGET_Frame(); /* release the frame */
|
||||
|
||||
In the first case, there are four error assignments with four
|
||||
checks of the file read. This unnecessarily increases the size
|
||||
of the generated code. Moreover, you must be sure that `var1'
|
||||
and `var4' are short variables, `var2' and `var3' long ones, if
|
||||
you want to avoid bugs and/or compiler warnings.
|
||||
|
||||
In the second case, you perform only one check for the read, and
|
||||
exit immediately on failure. Then the values are extracted from
|
||||
the frame, as the result of function calls. This means that you
|
||||
can use automatic type conversion; there is no problem if
|
||||
e.g. `var1' and `var4' are longs, unlike previously.
|
||||
|
||||
Finally, frames are ideal when you are using memory-mapped
|
||||
files, as the frame is not really `pre-loaded' and never uses
|
||||
any `heap' space.
|
||||
|
||||
IMPORTANT: You CANNOT nest several frame accesses. There is
|
||||
only one frame available at a time for a specific
|
||||
instance.
|
||||
|
||||
It is also the programmer's responsibility to never
|
||||
extract more data than was pre-loaded in the frame!
|
||||
(But you usually know how many values you want to
|
||||
extract from the file before doing so).
|
||||
|
||||
|
||||
3. Memory Management
|
||||
--------------------
|
||||
|
||||
The library now has a component which uses an interface similar to
|
||||
malloc()/free().
|
||||
|
||||
* FT_Alloc()
|
||||
|
||||
To be used like malloc(), except that it returns an error code,
|
||||
not an address. Its arguments are the size of the requested
|
||||
block and the address of the target pointer to the `fresh'
|
||||
block. An error code is returned in case of failure (and this
|
||||
will also set the target pointer to NULL), 0 in case of success.
|
||||
|
||||
FT_Alloc() internally calls the ft_alloc() function defined in
|
||||
an FT_Memory object. All error checking is done by FT_Alloc()
|
||||
itself so that ft_alloc() directly calls malloc().
|
||||
|
||||
* FT_Realloc()
|
||||
|
||||
Similar to FT_Alloc(); it calls realloc() by default.
|
||||
|
||||
* FT_Free()
|
||||
|
||||
As you may have already guessed, FT_Free() is FT_Alloc()'s
|
||||
counterpart. It takes as argument the _target pointer's
|
||||
address_! You should _never_ pass the block's address directly,
|
||||
i.e. the pointer, to FT_Free().
|
||||
|
||||
Similar to FT_Alloc(), FT_Free() does the necessary error
|
||||
checking and calls free() by default.
|
||||
|
||||
As the pointers addresses needed as arguments are typed `void**',
|
||||
ftmemory.h provides some macros to help use the above functions
|
||||
more easily, these are:
|
||||
|
||||
MEM_Alloc() A version of FT_Alloc() that casts the argument
|
||||
pointer to (void**). Similar functions are
|
||||
MEM_Alloc_Array(), MEM_Realloc(), and
|
||||
MEM_Realloc_Array()
|
||||
|
||||
ALLOC() Same as MEM_Alloc(), but with an assignment to a
|
||||
variable called `error'. See the section `error
|
||||
handling' above for more info on this. Similar
|
||||
functions are REALLOC(), ALLOC_ARRAY(), and
|
||||
REALLOC_ARRAY().
|
||||
|
||||
FREE() A version of FT_Free() that casts the argument
|
||||
pointer to (void**).
|
||||
|
||||
MEM_Set() An alias for `memset()', which can be easily
|
||||
changed to anything else if you wish to use a
|
||||
different memory manager than the functions
|
||||
provided by the ANSI libc.
|
||||
|
||||
MEM_Copy() An alias of `memcpy()' or `bcopy()' used to move
|
||||
blocks of memory. You may change it to something
|
||||
different if necessary (e.g. not using libc).
|
||||
|
||||
MEM_Move() An alias of `memmove().' Change its definition if
|
||||
necessary.
|
||||
|
||||
|
||||
4. Support for threaded environments
|
||||
------------------------------------
|
||||
|
||||
Thread synchronisation has been dropped in FreeType 2. The
|
||||
library is already re-entrant, and if you really need two threads
|
||||
accessing the same FT_Library object, you should synchronize
|
||||
access to it yourself with a simple mutex.
|
||||
|
||||
|
||||
--- end of convntns.txt ---
|
||||
|
After Width: | Height: | Size: 2.0 KiB |
@@ -0,0 +1,160 @@
|
||||
<!doctype html public "-//w3c//dtd html 4.0 transitional//en"
|
||||
"http://www.w3.org/TR/REC-html40/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type"
|
||||
content="text/html; charset=iso-8859-1">
|
||||
<meta name="Author"
|
||||
content="David Turner">
|
||||
<title>The design of FreeType 2</title>
|
||||
</head>
|
||||
|
||||
<body text="#000000"
|
||||
bgcolor="#FFFFFF"
|
||||
link="#0000EF"
|
||||
vlink="#51188E"
|
||||
alink="#FF0000">
|
||||
|
||||
<h1 align=center>
|
||||
The design of FreeType 2
|
||||
</h1>
|
||||
|
||||
<h3 align=center>
|
||||
Copyright 1998-2000 David Turner (<a
|
||||
href="mailto:[email protected]">[email protected]</a>)<br>
|
||||
Copyright 2000 The FreeType Development Team (<a
|
||||
href="mailto:[email protected]">[email protected]</a>)
|
||||
</h3>
|
||||
|
||||
<center>
|
||||
<table width="65%">
|
||||
<tr><td>
|
||||
|
||||
<center>
|
||||
<table width="100%"
|
||||
border=0
|
||||
cellpadding=5>
|
||||
<tr bgcolor="#CCFFCC"
|
||||
valign=center>
|
||||
<td align=center
|
||||
width="30%">
|
||||
|
||||
</td>
|
||||
<td align=center
|
||||
width="30%">
|
||||
<a href="index.html">Contents</a>
|
||||
</td>
|
||||
<td align=center
|
||||
width="30%">
|
||||
<a href="design-2.html">Next</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</center>
|
||||
|
||||
<p><hr></p>
|
||||
|
||||
<table width="100%">
|
||||
<tr bgcolor="#ccccee"><td>
|
||||
<h1>
|
||||
Introduction
|
||||
</h1>
|
||||
</td></tr>
|
||||
</table>
|
||||
|
||||
<p>This document provides details on the design and implementation of the
|
||||
FreeType 2 library. Its goal is to allow developers to better
|
||||
understand the way how FreeType 2 is organized, in order to let them
|
||||
extend, customize, and debug it.</p>
|
||||
|
||||
<p>Before anything else, it is important to understand the
|
||||
<em>purpose</em> of this library, i.e., why it has been written:</p>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<p>It allows client applications to <em>access font files easily</em>,
|
||||
wherever they could be stored, and as independently of the font format
|
||||
as possible.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Easy <em>retrieval of global font data</em> most commonly found in
|
||||
normal font formats (i.e. global metrics, encoding/charmaps,
|
||||
etc.).</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>It allows easy <em>retrieval of individual glyph data</em>
|
||||
(metrics, images, name, anything else).</p>
|
||||
</li>
|
||||
<li>
|
||||
<p><em>Access to font format-specific "features"</em> whenever
|
||||
possible (e.g. SFNT tables, Multiple Masters, OpenType Layout tables,
|
||||
etc.).</p>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p>Its design has also severely been influenced by the following
|
||||
requirements:</p>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<p><em>High portability</em>. The library must be able to run on any
|
||||
kind of environment. This requirement introduces a few drastic
|
||||
choices that are part of FreeType 2's low-level system
|
||||
interface.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p><em>Extendability</em>. New features should be added with the
|
||||
least modifications in the library's code base. This requirement
|
||||
induces an extremely simple design where nearly all operations are
|
||||
provided by modules.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p><em>Customization</b>. It should be easy to build a version of the
|
||||
library that only contains the features needed by a specific project.
|
||||
This really is important when you need to integrate it in a font
|
||||
server for embedded graphics libraries.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p><em>Compactness</em> and <em>efficiency</em>. The primary target
|
||||
for this library are embedded systems with low cpu and memory
|
||||
resources.</p>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p>The rest of this document is divided in several sections. First, a few
|
||||
chapters will present the library's basic design as well as the
|
||||
objects/data managed internally by FreeType 2.</p>
|
||||
|
||||
<p>A later section is then dedicated to library customization, relating
|
||||
such topics as system-specific interfaces, how to write your own module
|
||||
and how to tailor library initialization & compilation to your needs.</p>
|
||||
|
||||
<p><hr></p>
|
||||
|
||||
<center>
|
||||
<table width="100%"
|
||||
border=0
|
||||
cellpadding=5>
|
||||
<tr bgcolor="#CCFFCC" valign=center>
|
||||
<td align=center
|
||||
width="30%">
|
||||
|
||||
</td>
|
||||
<td align=center
|
||||
width="30%">
|
||||
<a href="index.html">Contents</a>
|
||||
</td>
|
||||
<td align=center
|
||||
width="30%">
|
||||
<a href="design-3.html">Next</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</center>
|
||||
|
||||
</td></tr>
|
||||
</table>
|
||||
</center>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,187 @@
|
||||
<!doctype html public "-//w3c//dtd html 4.0 transitional//en"
|
||||
"http://www.w3.org/TR/REC-html40/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type"
|
||||
content="text/html; charset=iso-8859-1">
|
||||
<meta name="Author"
|
||||
content="David Turner">
|
||||
<title>The design of FreeType 2</title>
|
||||
</head>
|
||||
|
||||
<body text="#000000"
|
||||
bgcolor="#FFFFFF"
|
||||
link="#0000EF"
|
||||
vlink="#51188E"
|
||||
alink="#FF0000">
|
||||
|
||||
<h1 align=center>
|
||||
The design of FreeType 2
|
||||
</h1>
|
||||
|
||||
<h3 align=center>
|
||||
Copyright 1998-2000 David Turner (<a
|
||||
href="mailto:[email protected]">[email protected]</a>)<br>
|
||||
Copyright 2000 The FreeType Development Team (<a
|
||||
href="mailto:[email protected]">[email protected]</a>)
|
||||
</h3>
|
||||
|
||||
<center>
|
||||
<table width="65%">
|
||||
<tr><td>
|
||||
|
||||
<center>
|
||||
<table width="100%"
|
||||
border=0
|
||||
cellpadding=5>
|
||||
<tr bgcolor="#CCFFCC"
|
||||
valign=center>
|
||||
<td align=center
|
||||
width="30%">
|
||||
<a href="design-1.html">Previous</a>
|
||||
</td>
|
||||
<td align=center
|
||||
width="30%">
|
||||
<a href="index.html">Contents</a>
|
||||
</td>
|
||||
<td align=center
|
||||
width="30%">
|
||||
<a href="design-3.html">Next</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</center>
|
||||
|
||||
<p><hr></p>
|
||||
|
||||
<table width="100%">
|
||||
<tr bgcolor="#ccccee"><td>
|
||||
<h1>
|
||||
I. Components and APIs
|
||||
</h1>
|
||||
</td></tr>
|
||||
</table>
|
||||
|
||||
<p>It's better to describe FreeType 2 as a collection of
|
||||
<em>components</em>. Each one of them is a more or less abstract part of
|
||||
the library that is in charge of one specific task. We will now explicit
|
||||
the connections and relationships between them.</p>
|
||||
|
||||
<p>A first brief description of this system of components could be:</p>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<p>Client applications typically call the FreeType 2
|
||||
<b>high-level API</b>, whose functions are implemented in a single
|
||||
component called the <em>Base Layer</em>.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Depending on the context or the task, the base layer then calls one
|
||||
or more <em>module</em> components to perform the work. In most
|
||||
cases, the client application doesn't need to know which module was
|
||||
called.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>The base layer also contains a set of routines that are used for
|
||||
generic things like memory allocation, list processing, i/o stream
|
||||
parsing, fixed point computation, etc. these functions can also be
|
||||
called by a module at any time, and they form what is called the
|
||||
<b>low-level base API</b>.</p>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p>This is illustrated by the following graphics (note that component
|
||||
entry points are represented as colored triangles):</p>
|
||||
|
||||
<center>
|
||||
<img src="basic-design.png"
|
||||
width="394" height="313"
|
||||
alt="Basic FreeType design">
|
||||
</center>
|
||||
|
||||
<p>Now, a few additional things must be added to complete this
|
||||
picture:</p>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<p>Some parts of the base layer can be replaced for specific builds of
|
||||
the library, and can thus be considered as components themselves.
|
||||
This is the case for the <tt>ftsystem</tt> component, which is in
|
||||
charge of implementing memory management & input stream access, as
|
||||
well as <tt>ftinit</tt>, which is in charge of library initialization
|
||||
(i.e. implementing the <tt>FT_Init_FreeType()</tt> function).</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>FreeType 2 comes also with a set of <em>optional
|
||||
components</em>, which can be used either as a convenience for client
|
||||
applications (e.g. the <tt>ftglyph</tt> component, used to provide a
|
||||
simple API to manage glyph images independently of their internal
|
||||
representation), or to access format-specific features (e.g. the
|
||||
<tt>ftmm</tt> component used to access and manage Multiple Masters
|
||||
data in Type 1 fonts).</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Finally, a module is capable of calling functions provided by
|
||||
another module. This is very useful to share code and tables between
|
||||
several font driver modules (for example, the <tt>truetype</tt> and
|
||||
<tt>cff</tt> modules both use the routines provided by the
|
||||
<tt>sfnt</tt> module).</p>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p>Hence, a more complete picture would be:</p>
|
||||
|
||||
<center>
|
||||
<img src="detailed-design.png"
|
||||
width="390" height="429"
|
||||
alt="Detailed FreeType design">
|
||||
</center>
|
||||
|
||||
<p>Please take note of the following important points:</p>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<p>An optional component can use either the high-level or base API.
|
||||
This is the case of <tt>ftglyph</tt> in the above picture.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Some optional components can use module-specific interfaces ignored
|
||||
by the base layer. In the above example, <tt>ftmm</tt> directly
|
||||
accesses the Type 1 module to set/query data.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>A replacable component can provide a function of the high-level
|
||||
API. For example, <tt>ftinit</tt> provides
|
||||
<tt>FT_Init_FreeType()</tt> to client applications.</p>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p><hr></p>
|
||||
|
||||
<center>
|
||||
<table width="100%"
|
||||
border=0
|
||||
cellpadding=5>
|
||||
<tr bgcolor="#CCFFCC" valign=center>
|
||||
<td align=center
|
||||
width="30%">
|
||||
<a href="design-1.html">Previous</a>
|
||||
</td>
|
||||
<td align=center
|
||||
width="30%">
|
||||
<a href="index.html">Contents</a>
|
||||
</td>
|
||||
<td align=center
|
||||
width="30%">
|
||||
<a href="design-3.html">Next</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</center>
|
||||
|
||||
</td></tr>
|
||||
</table>
|
||||
</center>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,353 @@
|
||||
<!doctype html public "-//w3c//dtd html 4.0 transitional//en"
|
||||
"http://www.w3.org/TR/REC-html40/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type"
|
||||
content="text/html; charset=iso-8859-1">
|
||||
<meta name="Author"
|
||||
content="David Turner">
|
||||
<title>The design of FreeType 2</title>
|
||||
</head>
|
||||
|
||||
<body text="#000000"
|
||||
bgcolor="#FFFFFF"
|
||||
link="#0000EF"
|
||||
vlink="#51188E"
|
||||
alink="#FF0000">
|
||||
|
||||
<h1 align=center>
|
||||
The design of FreeType 2
|
||||
</h1>
|
||||
|
||||
<h3 align=center>
|
||||
Copyright 1998-2000 David Turner (<a
|
||||
href="mailto:[email protected]">[email protected]</a>)<br>
|
||||
Copyright 2000 The FreeType Development Team (<a
|
||||
href="mailto:[email protected]">[email protected]</a>)
|
||||
</h3>
|
||||
|
||||
<center>
|
||||
<table width="65%">
|
||||
<tr><td>
|
||||
|
||||
<center>
|
||||
<table width="100%"
|
||||
border=0
|
||||
cellpadding=5>
|
||||
<tr bgcolor="#CCFFCC"
|
||||
valign=center>
|
||||
<td align=center
|
||||
width="30%">
|
||||
<a href="design-2.html">Previous</a>
|
||||
</td>
|
||||
<td align=center
|
||||
width="30%">
|
||||
<a href="index.html">Contents</a>
|
||||
</td>
|
||||
<td align=center
|
||||
width="30%">
|
||||
<a href="design-4.html">Next</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</center>
|
||||
|
||||
<p><hr></p>
|
||||
|
||||
<table width="100%">
|
||||
<tr bgcolor="#ccccee"><td>
|
||||
<h1>
|
||||
II. Public Objects and Classes
|
||||
</h1>
|
||||
</td></tr>
|
||||
</table>
|
||||
|
||||
<p>We will now explain the abstractions provided by FreeType 2 to
|
||||
client applications to manage font files and data. As you would normally
|
||||
expect, these are implemented through objects/classes.</p>
|
||||
|
||||
<h2>
|
||||
1. Object Orientation in FreeType 2
|
||||
</h2>
|
||||
|
||||
<p>Though written in ANSI C, the library employs a few techniques,
|
||||
inherited from object-oriented programming, to make it easy to extend.
|
||||
Hence, the following conventions apply in the FreeType 2 source
|
||||
code:</p>
|
||||
|
||||
<ol>
|
||||
<li>
|
||||
<p>Each object type/class has a corresponding <em>structure
|
||||
type</em> <b>and</b> a corresponding <em>structure pointer
|
||||
type</em>. The latter is called the <em>handle type</em> for the
|
||||
type/class.</p>
|
||||
|
||||
<p>Consider that we need to manage objects of type "foo" in
|
||||
FreeType 2. We would define the following structure and handle
|
||||
types as follows:</p>
|
||||
|
||||
<font color="blue"><pre>
|
||||
typedef struct FT_FooRec_* FT_Foo;
|
||||
|
||||
typedef struct FT_FooRec_
|
||||
{
|
||||
// fields for the "foo" class
|
||||
...
|
||||
|
||||
} FT_FooRec;</pre>
|
||||
</font>
|
||||
|
||||
<p>As a convention, handle types use simple but meaningful
|
||||
identifiers beginning with <tt>FT_</tt>, as in <tt>FT_Foo</tt>,
|
||||
while structures use the same name with a <tt>Rec</tt> suffix
|
||||
appended to it ("Rec" is short for "record"). <em>Note that each
|
||||
class type has a corresponding handle type</em>.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Class derivation is achieved internally by wrapping base class
|
||||
structures into new ones. As an example, we define a "foobar" class
|
||||
that is derived from "foo". We would do something like:</p>
|
||||
|
||||
<font color="blue"><pre>
|
||||
typedef struct FT_FooBarRec_* FT_FooBar;
|
||||
|
||||
typedef struct FT_FooBarRec_
|
||||
{
|
||||
// the base "foo" class fields
|
||||
FT_FooRec root;
|
||||
|
||||
// fields proper to the "foobar" class
|
||||
...
|
||||
} FT_FooBarRec;</pre>
|
||||
</font>
|
||||
|
||||
<p>As you can see, we ensure that a "foobar" object is also a "foo"
|
||||
object by placing a <tt>FT_FooRec</tt> at the start of the
|
||||
<tt>FT_FooBarRec</tt> definition. It is called <b>root</b> by
|
||||
convention.</p>
|
||||
|
||||
<p>Note that a <tt>FT_FooBar</tt> handle also points to a "foo"
|
||||
object and can be typecasted to <tt>FT_Foo</tt>. Similarly, when
|
||||
the library returns a <tt>FT_Foo</tt> handle to client applications,
|
||||
the object can be really implemented as a <tt>FT_FooBar</tt> or any
|
||||
derived class from "foo".</p>
|
||||
</li>
|
||||
</ol>
|
||||
|
||||
<p>In the following sections of this chapter, we will refer to "the
|
||||
<tt>FT_Foo</tt> class" to indicate the type of objects handled through
|
||||
<tt>FT_Foo</tt> pointers, be they implemented as "foo" or "foobar".</p>
|
||||
|
||||
<hr>
|
||||
|
||||
<h2>
|
||||
2. The <tt>FT_Library</tt> class
|
||||
</h2>
|
||||
|
||||
<p>This type corresponds to a handle to a single instance of the
|
||||
library. Note that the corresponding structure <tt>FT_LibraryRec</tt>
|
||||
is not defined in public header files, making client applications unable
|
||||
to access its internal fields.</p>
|
||||
|
||||
<p>The library object is the <em>parent</em> of all other objects in
|
||||
FreeType 2. You need to create a new library instance before doing
|
||||
anything else with the library. Similarly, destroying it will
|
||||
automatically destroy all its children (i.e. faces and modules).</p>
|
||||
|
||||
<p>Typical client applications should call <tt>FT_Init_FreeType()</tt>
|
||||
in order to create a new library object, ready to be used for further
|
||||
actions.</p>
|
||||
|
||||
<p>Another alternative is to create a fresh new library instance by
|
||||
calling the function <tt>FT_New_Library()</tt>, defined in the
|
||||
<tt><freetype/ftmodule.h></tt> public header file. This function
|
||||
will however return an "empty" library instance with no module
|
||||
registered in it. You can "install" modules in the instance by calling
|
||||
<tt>FT_Add_Module()</tt> manually.</p>
|
||||
|
||||
<p>Calling <tt>FT_Init_FreeType()</tt> is a lot more convenient, because
|
||||
this function basically registers a set of default modules into each new
|
||||
library instance. The way this list is accessed and/or computed is
|
||||
determined at build time, and depends on the content of the
|
||||
<tt>ftinit</tt> component. This process is explained in details later
|
||||
in this document.</p>
|
||||
|
||||
<p>For now, one should consider that library objects are created with
|
||||
<tt>FT_Init_FreeType()</tt>, and destroyed along with all children with
|
||||
<tt>FT_Done_FreeType()</tt>.</p>
|
||||
|
||||
<hr>
|
||||
|
||||
<h2>
|
||||
3. The <tt>FT_Face</tt> class
|
||||
</h2>
|
||||
|
||||
<p>A face object corresponds to a single <em>font face</em>, i.e., a
|
||||
specific typeface with a specific style. For example, "Arial" and
|
||||
"Arial Italic" correspond to two distinct faces.</p>
|
||||
|
||||
<p>A face object is normally created through <tt>FT_New_Face()</tt>.
|
||||
This function takes the following parameters: an <tt>FT_Library</tt>
|
||||
handle, a C file pathname used to indicate which font file to open, an
|
||||
index used to decide which face to load from the file (a single file may
|
||||
contain several faces in certain cases), and the address of a
|
||||
<tt>FT_Face</tt> handle. It returns an error code:</p>
|
||||
|
||||
<font color="blue"><pre>
|
||||
FT_Error FT_New_Face( FT_Library library,
|
||||
const char* filepathname,
|
||||
FT_Long face_index,
|
||||
FT_Face* face );</pre>
|
||||
</font>
|
||||
|
||||
<p>In case of success, the function will return 0, and the handle
|
||||
pointed to by the <tt>face</tt> parameter will be set to a non-NULL
|
||||
value.</p>
|
||||
|
||||
<p>Note that the face object contains several fields used to describe
|
||||
global font data that can be accessed directly by client applications.
|
||||
For example, the total number of glyphs in the face, the face's family
|
||||
name, style name, the EM size for scalable formats, etc. For more
|
||||
details, look at the <tt>FT_FaceRec</tt> definition in the
|
||||
FreeType 2 API Reference.</p>
|
||||
|
||||
<hr>
|
||||
|
||||
<h2>
|
||||
4. The <tt>FT_Size</tt> class
|
||||
</h2>
|
||||
|
||||
<p>Each <tt>FT_Face</tt> object <em>has</em> one or more
|
||||
<tt>FT_Size</tt> objects. A <em>size object</em> is used to store data
|
||||
specific to a given character width and height. Each newly created face
|
||||
object has one size, which is directly accessible as
|
||||
<tt>face->size</tt>.</p>
|
||||
|
||||
<p>The contents of a size object can be changed by calling either
|
||||
<tt>FT_Set_Pixel_Sizes()</tt> or <tt>FT_Set_Char_Size()</tt>.</p>
|
||||
|
||||
<p>A new size object can be created with <tt>FT_New_Size()</tt>, and
|
||||
destroyed manually with </tt>FT_Done_Size()</tt>. Note that typical
|
||||
applications don't need to do this normally: they tend to use the
|
||||
default size object provided with each <tt>FT_Face</tt>.</p>
|
||||
|
||||
<p>The public fields of <tt>FT_Size</tt> objects are defined in a very
|
||||
small structure named <tt>FT_SizeRec</tt>. However, it is important to
|
||||
understand that some font drivers define their own derivatives of
|
||||
<tt>FT_Size</tt> to store important internal data that is re-computed
|
||||
each time the character size changes. Most of the time, these are
|
||||
size-specific <em>font hints</em>./p>
|
||||
|
||||
<p>For example, the TrueType driver stores the scaled CVT table that
|
||||
results from the execution of the "cvt" program in a <tt>TT_Size</tt>
|
||||
structure, while the Type 1 driver stores scaled global metrics
|
||||
(like blue zones) in a <tt>T1_Size</tt> object. Don't worry if you
|
||||
don't understand the current paragraph; most of this stuff is highly
|
||||
font format specific and doesn't need to be explained to client
|
||||
developers :-)</p>
|
||||
|
||||
<hr>
|
||||
|
||||
<h2>
|
||||
5. The <tt>FT_GlyphSlot</tt> class
|
||||
</h2>
|
||||
|
||||
<p>The purpose of a glyph slot is to provide a place where glyph images
|
||||
can be loaded one by one easily, independently of the glyph image format
|
||||
(bitmap, vector outline, or anything else).</p>
|
||||
|
||||
<p>Ideally, once a glyph slot is created, any glyph image can be loaded
|
||||
into it without additional memory allocation. In practice, this is only
|
||||
possible with certain formats like TrueType which explicitly provide
|
||||
data to compute a slot's maximum size.</p>
|
||||
|
||||
<p>Another reason for glyph slots is that they are also used to hold
|
||||
format-specific hints for a given glyphs as well as all other data
|
||||
necessary to correctly load the glyph.</p>
|
||||
|
||||
<p>The base <tt>FT_GlyphSlotRec</tt> structure only presents glyph
|
||||
metrics and images to client applications, while actual implementation
|
||||
may contain more sophisticated data.</p>
|
||||
|
||||
<p>As an example, the TrueType-specific <tt>TT_GlyphSlotRec</tt>
|
||||
structure contains additional fields to hold glyph-specific bytecode,
|
||||
transient outlines used during the hinting process, and a few other
|
||||
things.
|
||||
|
||||
The Type 1-specific <tt>T1_GlyphSlotRec</tt> structure holds glyph
|
||||
hints during glyph loading, as well as additional logic used to properly
|
||||
hint the glyphs when a native Type 1 hinter is used.</p>
|
||||
|
||||
<p>Finally, each face object has a single glyph slot that is directly
|
||||
accessible as <tt>face->glyph</tt>.</p>
|
||||
|
||||
<hr>
|
||||
|
||||
<h2>
|
||||
6. The <tt>FT_CharMap</tt> class
|
||||
</h2>
|
||||
|
||||
<p>The <tt>FT_CharMap</tt> type is used as a handle to character map
|
||||
objects, or <em>charmaps</em>. A charmap is simply some sort of table
|
||||
or dictionary which is used to translate character codes in a given
|
||||
encoding into glyph indices for the font.</p>
|
||||
|
||||
<p>A single face may contain several charmaps. Each one of them
|
||||
corresponds to a given character repertoire, like Unicode, Apple Roman,
|
||||
Windows codepages, and other encodings.</p>
|
||||
|
||||
<p>Each <tt>FT_CharMap</tt> object contains a "platform" and an
|
||||
"encoding" field used to identify precisely the character repertoire
|
||||
corresponding to it.</p>
|
||||
|
||||
<p>Each font format provides its own derivative of
|
||||
<tt>FT_CharMapRec</tt> and thus needs to implement these objects.</p>
|
||||
|
||||
<hr>
|
||||
|
||||
<h2>
|
||||
7. Objects relationships
|
||||
</h2>
|
||||
|
||||
<p>The following diagram summarizes what we have just said regarding the
|
||||
public objects managed by the library, as well as explicitely describes
|
||||
their relationships</p>
|
||||
|
||||
<center>
|
||||
<img src="simple-model.png"
|
||||
width=453 height=378
|
||||
alt="Simple library model">
|
||||
</center>
|
||||
|
||||
<p>Note that this picture will be updated at the end of the next
|
||||
chapter, related to <em>internal objects</em>.</p>
|
||||
|
||||
<p><hr></p>
|
||||
|
||||
<center>
|
||||
<table width="100%"
|
||||
border=0
|
||||
cellpadding=5>
|
||||
<tr bgcolor="#CCFFCC" valign=center>
|
||||
<td align=center
|
||||
width="30%">
|
||||
<a href="design-2.html">Previous</a>
|
||||
</td>
|
||||
<td align=center
|
||||
width="30%">
|
||||
<a href="index.html">Contents</a>
|
||||
</td>
|
||||
<td align=center
|
||||
width="30%">
|
||||
<a href="design-4.html">Next</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</center>
|
||||
|
||||
</td></tr>
|
||||
</table>
|
||||
</center>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,361 @@
|
||||
<!doctype html public "-//w3c//dtd html 4.0 transitional//en"
|
||||
"http://www.w3.org/TR/REC-html40/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type"
|
||||
content="text/html; charset=iso-8859-1">
|
||||
<meta name="Author"
|
||||
content="David Turner">
|
||||
<title>The design of FreeType 2</title>
|
||||
</head>
|
||||
|
||||
<body text="#000000"
|
||||
bgcolor="#FFFFFF"
|
||||
link="#0000EF"
|
||||
vlink="#51188E"
|
||||
alink="#FF0000">
|
||||
|
||||
<h1 align=center>
|
||||
The design of FreeType 2
|
||||
</h1>
|
||||
|
||||
<h3 align=center>
|
||||
Copyright 1998-2000 David Turner (<a
|
||||
href="mailto:[email protected]">[email protected]</a>)<br>
|
||||
Copyright 2000 The FreeType Development Team (<a
|
||||
href="mailto:[email protected]">[email protected]</a>)
|
||||
</h3>
|
||||
|
||||
<center>
|
||||
<table width="65%">
|
||||
<tr><td>
|
||||
|
||||
<center>
|
||||
<table width="100%"
|
||||
border=0
|
||||
cellpadding=5>
|
||||
<tr bgcolor="#CCFFCC"
|
||||
valign=center>
|
||||
<td align=center
|
||||
width="30%">
|
||||
<a href="design-3.html">Previous</a>
|
||||
</td>
|
||||
<td align=center
|
||||
width="30%">
|
||||
<a href="index.html">Contents</a>
|
||||
</td>
|
||||
<td align=center
|
||||
width="30%">
|
||||
<a href="design-5.html">Next</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</center>
|
||||
|
||||
<p><hr></p>
|
||||
|
||||
<table width="100%">
|
||||
<tr bgcolor="#ccccee"><td>
|
||||
<h1>
|
||||
III. Internal Objects and Classes
|
||||
</h1>
|
||||
</td></tr>
|
||||
</table>
|
||||
|
||||
<p>Let us have a look now at the <em>internal</em> objects that
|
||||
FreeType 2 uses, i.e., those not directly available to client
|
||||
applications, and see how they fit into the picture.</p>
|
||||
|
||||
<h2>
|
||||
1. Memory management
|
||||
</h2>
|
||||
|
||||
<p>All memory management operations are performed through three specific
|
||||
routines of the base layer, namely: <tt>FT_Alloc()</tt>,
|
||||
<tt>FT_Realloc()</tt>, and <tt>FT_Free()</tt>. Each one of these
|
||||
functions expects a <tt>FT_Memory</tt> handle as its first
|
||||
parameter.</p>
|
||||
|
||||
<p>The latter is a pointer to a simple object used to describe the
|
||||
current memory pool/manager. It contains a simple table of
|
||||
alloc/realloc/free functions. A memory manager is created at library
|
||||
initialization time by <tt>FT_Init_FreeType()</tt>, calling the function
|
||||
<tt>FT_New_Memory()</tt> provided by the <tt>ftsystem</tt>
|
||||
component.</p>
|
||||
|
||||
<p>By default, this manager uses the ANSI <tt>malloc()</tt>,
|
||||
<tt>realloc()</tt>, and <tt>free()</tt> functions. However, as
|
||||
<tt>ftsystem</tt> is a replaceable part of the base layer, a specific
|
||||
build of the library could provide a different default memory
|
||||
manager.</p>
|
||||
|
||||
<p>Even with a default build, client applications are still able to
|
||||
provide their own memory manager by not calling
|
||||
<tt>FT_Init_FreeType()</tt> but follow these simple steps:</p>
|
||||
|
||||
<ol>
|
||||
<li>
|
||||
<p>Create a new <tt>FT_Memory</tt> object by hand. The definition
|
||||
of <tt>FT_MemoryRec</tt> is located in the public file
|
||||
<tt><freetype/ftsystem.h></tt>.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Call <tt>FT_New_Library()</tt> to create a new library instance
|
||||
using your custom memory manager. This new library doesn't yet
|
||||
contain any registered modules.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Register the set of default modules by calling the function
|
||||
<tt>FT_Add_Default_Modules()</tt> provided by the <tt>ftinit</tt>
|
||||
component, or manually register your drivers by repeatedly
|
||||
calling <tt>FT_Add_Module()</tt>.</p>
|
||||
</li>
|
||||
</ol>
|
||||
|
||||
<hr>
|
||||
|
||||
<h2>
|
||||
2. Input streams
|
||||
</h2>
|
||||
|
||||
<p>Font files are always read through <tt>FT_Stream</tt> objects. The
|
||||
definition of <tt>FT_StreamRec</tt> is located in the public file
|
||||
<tt><freetype/ftsystem.h></tt>, which allows client developers to
|
||||
provide their own implementation of streams if they wish so.</p>
|
||||
|
||||
<p>The function <tt>FT_New_Face()</tt> will always automatically create
|
||||
a new stream object from the C pathname given as its second
|
||||
argument. This is achieved by calling the function
|
||||
<tt>FT_New_Stream()</tt> provided by the <tt>ftsystem</tt> component.
|
||||
As the latter is replaceable, the implementation of streams may vary
|
||||
greatly between platforms.</p>
|
||||
|
||||
<p>As an example, the default implementation of streams is located in
|
||||
the file <tt>src/base/ftsystem.c</tt> and uses the ANSI
|
||||
<tt>fopen()</tt>, <tt>fseek()</tt>, and <tt>fread()</tt> calls.
|
||||
However, the Unix build of FreeType 2 provides an alternative
|
||||
implementation that uses memory-mapped files, when available on the host
|
||||
platform, resulting in a significant access speed-up.</p>
|
||||
|
||||
<p>FreeType distinguishes between memory-based and disk-based streams.
|
||||
In the first case, all data is directly accessed in memory (e.g.
|
||||
ROM-based, write-only static data and memory-mapped files), while in the
|
||||
second, portions of the font files are read in chunks called
|
||||
<em>frames</em>, and temporarily buffered similarly through typical
|
||||
seek/read operations.</p>
|
||||
|
||||
<p>The FreeType stream sub-system also implements extremely efficient
|
||||
algorithms to very quickly load structures from font files while
|
||||
ensuring complete safety in the case of a "broken file".</p>
|
||||
|
||||
<p>The function <tt>FT_New_Memory_Face()</tt> can be used to directly
|
||||
create/open a <tt>FT_Face</tt> object from data that is readily
|
||||
available in memory (including ROM-based fonts).</p>
|
||||
|
||||
<p>Finally, in the case where a custom input stream is needed, client
|
||||
applications can use the function <tt>FT_Open_Face()</tt>, which can
|
||||
accept custom input streams. This may be useful in the case of
|
||||
compressed or remote font files, or even embedded font files that need
|
||||
to be extracted from certain documents.</p>
|
||||
|
||||
<p>Note that each face owns a single stream, which is also destroyed by
|
||||
<tt>FT_Done_Face()</tt>. Generally speaking, it is certainly
|
||||
<em>not</em> a good idea to keep numerous <tt>FT_Face</tt> objects
|
||||
opened.</p>
|
||||
|
||||
<hr>
|
||||
|
||||
<h2>
|
||||
3. Modules
|
||||
</h2>
|
||||
|
||||
<p>A FreeType 2 module is itself a piece of code. However, the
|
||||
library creates a single <tt>FT_Module</tt> object for each module that
|
||||
is registered when <tt>FT_Add_Module()</tt> is called.</p>
|
||||
|
||||
<p>The definition of <tt>FT_ModuleRec</tt> is not publicly available to
|
||||
client applications. However, each <em>module type</em> is described by
|
||||
a simple public structure named <tt>FT_Module_Class</tt>, defined in
|
||||
<tt><freetype/ftmodule.h></tt>, and is described later in this
|
||||
document:</p>
|
||||
|
||||
<p>You need a pointer to an <tt>FT_Module_Class</tt> structure when
|
||||
calling <tt>FT_Add_Module()</tt>, whose declaration is:</p>
|
||||
|
||||
<font color="blue"><pre>
|
||||
FT_Error FT_Add_Module( FT_Library library,
|
||||
const FT_Module_Class* clazz );</pre>
|
||||
</font>
|
||||
|
||||
<p>Calling this function will do the following:</p>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<p>It will check whether the library already holds a module object
|
||||
corresponding to the same module name as the one found in
|
||||
<tt>FT_Module_Class</tt>.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>If this is the case, it will compare the module version number to
|
||||
see whether it is possible to <em>upgrade</em> the module to a new
|
||||
version. If the module class's version number is smaller than the
|
||||
already installed one, the function returns immediately. Similarly,
|
||||
it checks that the version of FreeType 2 that is running is
|
||||
correct compared to the one required by the module.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>It creates a new <tt>FT_Module</tt> object, using data and flags
|
||||
of the module class to determine its byte size and how to properly
|
||||
initialize it.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>If a module initializer is present in the module class, it will
|
||||
be called to complete the module object's initialization.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>The new module is added to the library's list of "registered"
|
||||
modules. In case of an upgrade, the previous module object is
|
||||
simply destroyed.</p>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p>Note that this function doesn't return an <tt>FT_Module</tt> handle,
|
||||
given that module objects are completely internal to the library (and
|
||||
client applications shouldn't normally mess with them :-)</p>
|
||||
|
||||
<p>Finally, it is important to understand that FreeType 2
|
||||
recognizes and manages several kinds of modules. These will be
|
||||
explained in more details later in this document, but we will list for
|
||||
now the following types:</p>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<p><em>Renderer</em> modules are used to convert native glyph images
|
||||
to bitmaps/pixmaps. FreeType 2 comes with two renderer modules
|
||||
by default: one to generate monochrome bitmaps, the other to
|
||||
generate high-quality anti-aliased pixmaps.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p><em>Font driver</em> modules are used to support one or more font
|
||||
formats. Typically, each font driver provides a specific
|
||||
implementation/derivative of <tt>FT_Face</tt>, <tt>FT_Size</tt>,
|
||||
<tt>FT_GlyphSlot</tt>, as well as <tt>FT_CharMap</tt>.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p><em>Helper</em> modules are shared by several font drivers. For
|
||||
example, the <tt>sfnt</tt> module parses and manages tables found in
|
||||
SFNT-based font formats; it is then used by both the TrueType and
|
||||
OpenType font drivers.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Finally, the <em>auto-hinter</em> module has a specific place in
|
||||
the library's design, as its role is to process vectorial glyph
|
||||
outlines, independently of their native font format, to produce
|
||||
optimal results at small pixel sizes.</p>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p>Note that every <tt>FT_Face</tt> object is <em>owned</em> by the
|
||||
corresponding font driver, depending on the original font file's format.
|
||||
This means that all face objects are destroyed when a module is
|
||||
removed/unregistered from a library instance (typically by calling the
|
||||
<tt>FT_Remove_Module()</tt> function).</p>
|
||||
|
||||
<p><em>Because of this, you should always take care that no
|
||||
<tt>FT_Face</tt> object is opened when you upgrade or remove a module
|
||||
from a library, as this could cause unexpected object deletion!</em></p>
|
||||
|
||||
<hr>
|
||||
|
||||
<h2>
|
||||
4. Libraries
|
||||
</h2>
|
||||
|
||||
<p>We now come back to our well-known <tt>FT_Library</tt> object. From
|
||||
what have been said before, we already know that a library instance owns
|
||||
at least the following:</p>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<p>A memory manager object (<tt>FT_Memory</tt>), used for all
|
||||
allocation/releases within the instance.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>A list of <tt>FT_Module</tt> objects, corresponding to the
|
||||
"installed" or "registered" modules of the instance. This list can
|
||||
be changed at any time through <tt>FT_Add_Module()</tt> and
|
||||
<tt>FT_Remove_Module()</tt>.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Remember that face objects are owner by font drivers that are
|
||||
themselves modules owned by the library.</p>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p>There is however another object owned by the library instance that
|
||||
hasn't been described yet: the <em>raster pool</em>.</p>
|
||||
|
||||
<p>The <em>raster pool</em> is simply a block of memory of fixed size
|
||||
that is used internally as a "scratch area" for various memory-hungry
|
||||
transient operations, avoiding memory allocation. For example, it is
|
||||
used by each renderer when converting a vectorial glyph outline into a
|
||||
bitmap (actually, that's where its name comes from :-).</p>
|
||||
|
||||
<p>The size of the raster pool is fixed at initialisation time (it
|
||||
defaults to 16kByte) and cannot be changed at run-time (though we could
|
||||
fix this if there is a real need for that).</p>
|
||||
|
||||
<p>When a transient operation needs more memory than the pool's size, it
|
||||
can decide to either allocate a heap block as an exceptional condition,
|
||||
or sub-divide recursively the task to perform in order to never exceed
|
||||
the pool's threshold.</p>
|
||||
|
||||
<p>This extremely memory-conservative behaviour is certainly one of the
|
||||
keys to FreeType's performance in certain areas (most importantly in
|
||||
glyph rendering/scanline-conversion).</p>
|
||||
|
||||
<hr>
|
||||
|
||||
<h2>
|
||||
5. Summary
|
||||
</h2>
|
||||
|
||||
<p>Finally, the following picture illustrates what has been said in this
|
||||
section, as well as the previous, by presenting the complete object
|
||||
graph of FreeType 2's base design:</p>
|
||||
|
||||
<center>
|
||||
<img src="library-model.png"
|
||||
width=411 height=405
|
||||
alt="Complete library model">
|
||||
</center>
|
||||
|
||||
<p><hr></p>
|
||||
|
||||
<center>
|
||||
<table width="100%"
|
||||
border=0
|
||||
cellpadding=5>
|
||||
<tr bgcolor="#CCFFCC" valign=center>
|
||||
<td align=center
|
||||
width="30%">
|
||||
<a href="design-3.html">Previous</a>
|
||||
</td>
|
||||
<td align=center
|
||||
width="30%">
|
||||
<a href="index.html">Contents</a>
|
||||
</td>
|
||||
<td align=center
|
||||
width="30%">
|
||||
<a href="design-5.html">Next</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</center>
|
||||
|
||||
</td></tr>
|
||||
</table>
|
||||
</center>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,458 @@
|
||||
<!doctype html public "-//w3c//dtd html 4.0 transitional//en"
|
||||
"http://www.w3.org/TR/REC-html40/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type"
|
||||
content="text/html; charset=iso-8859-1">
|
||||
<meta name="Author"
|
||||
content="David Turner">
|
||||
<title>The design of FreeType 2</title>
|
||||
</head>
|
||||
|
||||
<body text="#000000"
|
||||
bgcolor="#FFFFFF"
|
||||
link="#0000EF"
|
||||
vlink="#51188E"
|
||||
alink="#FF0000">
|
||||
|
||||
<h1 align=center>
|
||||
The design of FreeType 2
|
||||
</h1>
|
||||
|
||||
<h3 align=center>
|
||||
Copyright 1998-2000 David Turner (<a
|
||||
href="mailto:[email protected]">[email protected]</a>)<br>
|
||||
Copyright 2000 The FreeType Development Team (<a
|
||||
href="mailto:[email protected]">[email protected]</a>)
|
||||
</h3>
|
||||
|
||||
<center>
|
||||
<table width="65%">
|
||||
<tr><td>
|
||||
|
||||
<center>
|
||||
<table width="100%"
|
||||
border=0
|
||||
cellpadding=5>
|
||||
<tr bgcolor="#CCFFCC"
|
||||
valign=center>
|
||||
<td align=center
|
||||
width="30%">
|
||||
<a href="design-4.html">Previous</a>
|
||||
</td>
|
||||
<td align=center
|
||||
width="30%">
|
||||
<a href="index.html">Contents</a>
|
||||
</td>
|
||||
<td align=center
|
||||
width="30%">
|
||||
<a href="design-6.html">Next</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</center>
|
||||
|
||||
<p><hr></p>
|
||||
|
||||
<table width="100%">
|
||||
<tr bgcolor="#ccccee"><td>
|
||||
<h1>
|
||||
IV. Module Classes
|
||||
</h1>
|
||||
</td></tr>
|
||||
</table>
|
||||
|
||||
<p>We will now try to explain more precisely the <em>types</em> of modules
|
||||
that FreeType 2 is capable of managing. Note that each one of them
|
||||
is decribed with more details in the following chapters of this
|
||||
document.</p>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<p><em>Renderer</em> modules are used to manage scalable glyph images.
|
||||
This means <em>transforming</em> them, computing their <em>bounding
|
||||
box</em>, and <em>converting</em> them to either <em>monochrome</em>
|
||||
or <em>anti-aliased</em> bitmaps</em>.</p>
|
||||
|
||||
<p>Note that FreeType 2 is capable of dealing with <em>any</em>
|
||||
kind of glyph images, as long as a renderer module is provided for it.
|
||||
The library comes by default with two renderers:</p>
|
||||
|
||||
<p><table cellpadding=8>
|
||||
<tr valign=top>
|
||||
<td>
|
||||
<tt>raster</tt>
|
||||
</td>
|
||||
<td>
|
||||
<p>Supports the conversion of vectorial outlines (described by a
|
||||
<tt>FT_Outline</tt> object) to <em>monochrome</em> bitmaps.
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td>
|
||||
<tt>smooth</tt>
|
||||
</td>
|
||||
<td>
|
||||
<p>Supports the conversion of the same outlines to high-quality
|
||||
<em>anti-aliased</em> pixmaps (using 256 levels of gray). Note
|
||||
that this renderer also supports direct span generation.</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table></p>
|
||||
|
||||
<li>
|
||||
<p><em>Font driver</em> modules are used to support one or more
|
||||
specific font format. By default, FreeType 2 comes with the
|
||||
following font drivers:</p>
|
||||
|
||||
<p><table cellpadding=8>
|
||||
<tr valign=top>
|
||||
<td>
|
||||
<tt>truetype</tt>
|
||||
</td>
|
||||
<td>
|
||||
<p>supports TrueType font files</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td>
|
||||
<tt>type1</tt>
|
||||
</td>
|
||||
<td>
|
||||
<p>supports Postscript Type 1 fonts, both in binary
|
||||
(<tt>.pfb</tt>) or ASCII (<tt>.pfa</tt>) formats, including
|
||||
Multiple Master fonts.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td>
|
||||
<tt>cid</tt>
|
||||
</td>
|
||||
<td>
|
||||
<p>supports Postscript CID-keyed fonts</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td>
|
||||
<tt>cff</tt>
|
||||
</td>
|
||||
<td>
|
||||
<p>supports OpenType, CFF as well as CEF fonts (CEF is a
|
||||
derivative of CFF used by Adobe in its SVG viewer)</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td>
|
||||
<tt>winfonts</tt>
|
||||
</td>
|
||||
<td>
|
||||
<p>supports Windows bitmap fonts (i.e. <tt>.fon</tt> and
|
||||
<tt>.fnt</tt>)</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table></p>
|
||||
|
||||
<p>Note that font drivers can support bitmapped or scalable glyph
|
||||
images. A given font driver that supports Bézier outlines
|
||||
through <tt>FT_Outline</tt> can also provide its own hinter, or rely
|
||||
on FreeType's <tt>autohinter</tt> module.</p>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<p><em>Helper</em> modules are used to hold shared code that is often
|
||||
used by several font drivers, or even other modules. Here are the
|
||||
default helpers:</p>
|
||||
|
||||
<p><table cellpadding=8>
|
||||
<tr valign=top>
|
||||
<td>
|
||||
<tt>sfnt</tt>
|
||||
</td>
|
||||
<td>
|
||||
used to support font formats based on the <tt>SFNT</tt> storage
|
||||
scheme: TrueType & OpenType fonts as well as other variants (like
|
||||
TrueType fonts that only contain embedded bitmaps)
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td>
|
||||
<tt>psnames</tt>
|
||||
</td>
|
||||
<td>
|
||||
used to provide various useful functions related to glyph names
|
||||
ordering and Postscript encodings/charsets. For example, this
|
||||
module is capable of automatically synthetizing a Unicode charmap
|
||||
from a Type 1 glyph name dictionary.
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td>
|
||||
<tt>psaux</tt>
|
||||
</td>
|
||||
<td>
|
||||
used to provide various useful functions related to Type 1
|
||||
charstring decoding, as this "feature" is needed by the
|
||||
<tt>type1</tt>, <tt>cid</tt>, and <tt>cff</tt> drivers.
|
||||
</td>
|
||||
</tr>
|
||||
</table></p>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<p>Finally, the <em>autohinter</em> module has a specific role in
|
||||
FreeType 2, as it can be used automatically during glyph loading
|
||||
to process individual glyph outlines when a font driver doesn't
|
||||
provide it's own hinting engine.</p>
|
||||
|
||||
<p>This module's purpose and design is also heavily described on the
|
||||
FreeType web site.</p>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p>We will now study how modules are described, then managed by the
|
||||
library.</p>
|
||||
|
||||
<h3>
|
||||
1. The <tt>FT_Module_Class</tt> structure
|
||||
</h3>
|
||||
|
||||
<p>As described later in this document, library initialization is
|
||||
performed by calling the <tt>FT_Init_FreeType()</tt> function. The
|
||||
latter is in charge of creating a new "empty" <tt>FT_Library</tt>
|
||||
object, then register each "default" module by repeatedly calling the
|
||||
<tt>FT_Add_Module()</tt> function.</p>
|
||||
|
||||
<p>Similarly, client applications can call <tt>FT_Add_Module()</tt> any
|
||||
time they wish in order to register a new module in the library. Let us
|
||||
take a look at this function's declaration:</p>
|
||||
|
||||
<font color="blue"><pre>
|
||||
extern FT_Error FT_Add_Module(
|
||||
FT_Library library,
|
||||
const FT_Module_Class* clazz );</pre>
|
||||
</font>
|
||||
|
||||
<p>As one can see, this function expects a handle to a library object,
|
||||
as well as a pointer to a <tt>FT_Module_Class</tt> structure. It
|
||||
returns an error code. In case of success, a new module object is
|
||||
created and added to the library. Note by the way that the module isn't
|
||||
returned directly by the call!</p>
|
||||
|
||||
<p>Here the definition of <tt>FT_Module_Class</tt>, with some
|
||||
explanation. The following code is taken from
|
||||
<tt><freetype/ftmodule.h></tt>:</p>
|
||||
|
||||
<font color="blue"><pre>
|
||||
typedef struct FT_Module_Class_
|
||||
{
|
||||
FT_ULong module_flags;
|
||||
FT_Int module_size;
|
||||
const FT_String* module_name;
|
||||
FT_Fixed module_version;
|
||||
FT_Fixed module_requires;
|
||||
|
||||
const void* module_interface;
|
||||
|
||||
FT_Module_Constructor module_init;
|
||||
FT_Module_Destructor module_done;
|
||||
FT_Module_Requester get_interface;
|
||||
|
||||
} FT_Module_Class;</pre>
|
||||
</font>
|
||||
|
||||
<p>A description of its fields:</p>
|
||||
|
||||
<p><table cellpadding=8>
|
||||
<tr valign=top>
|
||||
<td>
|
||||
<tt>module_flags</tt>
|
||||
</td>
|
||||
<td>
|
||||
<p>A set of bit flags used to describe the module's category. Valid
|
||||
values are:</p>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<tt>ft_module_font_driver</tt> if the module is a font driver
|
||||
</li>
|
||||
<li>
|
||||
<tt>ft_module_renderer</tt> if the module is a renderer
|
||||
</li>
|
||||
<li>
|
||||
<tt>ft_module_hinter</tt> if the module is an auto-hinter
|
||||
</li>
|
||||
<li>
|
||||
<tt>ft_module_driver_scalable</tt> if the module is a font
|
||||
driver supporting scalable glyph formats
|
||||
</li>
|
||||
<li>
|
||||
<tt>ft_module_driver_no_outlines</tt> if the module is a font
|
||||
driver supporting scalable glyph formats that <em>cannot</em> be
|
||||
described by an <tt>FT_Outline</tt> object
|
||||
</li>
|
||||
<li>
|
||||
<tt>ft_module_driver_has_hinter</tt> if the module is a font
|
||||
driver that provides its own hinting scheme/algorithm
|
||||
</li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td>
|
||||
<tt>module_size</tt>
|
||||
</td>
|
||||
<td>
|
||||
<p>An integer that gives the size in <em>bytes</em> of a given
|
||||
module object. This should <em>never</em> be less than
|
||||
<tt>sizeof(FT_ModuleRec)</tt>, but can be more if the module needs
|
||||
to sub-class the base <tt>FT_ModuleRec</tt> class.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td>
|
||||
<tt>module_name</tt>
|
||||
</td>
|
||||
<td>
|
||||
<p>The module's internal name, coded as a simple ASCII
|
||||
C string. There can't be two modules with the same name
|
||||
registered in a given <tt>FT_Library</tt> object. However,
|
||||
<tt>FT_Add_Module()</tt> uses the <tt>module_version</tt> field to
|
||||
detect module upgrades and perform them cleanly, even at
|
||||
run-time.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td>
|
||||
<tt>module_version</tt>
|
||||
</td>
|
||||
<td>
|
||||
<p>A 16.16 fixed float number giving the module's major and minor
|
||||
version numbers. It is used to determine whether a module needs to
|
||||
be upgraded when calling <tt>FT_Add_Module()</tt>.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td>
|
||||
<tt>module_requires</tt>
|
||||
</td>
|
||||
<td>
|
||||
<p>A 16.16 fixed float number giving the version of FreeType 2
|
||||
that is required to install this module. The default value is
|
||||
0x20000 for FreeType version 2.0</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td>
|
||||
<tt>module_requires</tt>
|
||||
</td>
|
||||
<td>
|
||||
<p>Most modules support one or more "interfaces", i.e. tables of
|
||||
function pointers. This field is used to point to the module's main
|
||||
interface, if there is one. It is a short-cut that prevents users
|
||||
of the module to call "get_interface()" each time they need to
|
||||
access one of the object's common entry points.</p>
|
||||
|
||||
<p>Note that is is optional, and can be set to NULL. Other
|
||||
interfaces can also be accessed through the <tt>get_interface()</tt>
|
||||
field.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td>
|
||||
<tt>module_init</tt>
|
||||
</td>
|
||||
<td>
|
||||
<p>A pointer to a function used to initialize the fields of a fresh
|
||||
new <tt>FT_Module</tt> object. It is called <em>after</em> the
|
||||
module's base fields have been set by the library, and is generally
|
||||
used to initialize the fields of <tt>FT_ModuleRec</tt>
|
||||
subclasses.</p>
|
||||
|
||||
<p>Most module classes set it to NULL to indicate that no extra
|
||||
initialization is necessary.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td>
|
||||
<tt>module_done</tt>
|
||||
</td>
|
||||
<td>
|
||||
<p>A pointer to a function used to finalize the fields of a given
|
||||
<tt>FT_Module</tt> object. Note that it is called <em>before</em>
|
||||
the library unsets the module's base fields, and is generally used
|
||||
to finalize the fields of <tt>FT_ModuleRec</tt> subclasses.</p>
|
||||
|
||||
<p>Most module classes set it to NULL to indicate that no extra
|
||||
finalization is necessary</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td>
|
||||
<tt>get_interface</tt>
|
||||
</td>
|
||||
<td>
|
||||
<p>A pointer to a function used to request the address of a given
|
||||
module interface. Set it to NULL if you don't need to support
|
||||
additional interfaces but the main one.</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table></p>
|
||||
|
||||
|
||||
<h3>
|
||||
2. The <tt>FT_Module</tt> type
|
||||
</h3>
|
||||
|
||||
<p>The <tt>FT_Module</tt> type is a handle (i.e. a pointer) to a given
|
||||
module object/instance, whose base structure is given by the internal
|
||||
<tt>FT_ModuleRec</tt> type. We will intentionally <em>not</em> describe
|
||||
this structure here, as there is no point to look so far into the
|
||||
library's design.</p>
|
||||
|
||||
<p>When <tt>FT_Add_Module</tt> is called, it first allocates a new
|
||||
module instance, using the <tt>module_size</tt> class field to determine
|
||||
its byte size. The function initializes the root <tt>FT_ModuleRec</tt>
|
||||
field, then calls the class-specific initializer <tt>module_init</tt>
|
||||
when this field is not set to NULL.</p>
|
||||
|
||||
<p>Note that the library defines several sub-classes of
|
||||
<tt>FT_ModuleRec</tt>, which are, as you could have guessed:</p>
|
||||
|
||||
<ul>
|
||||
<li><p><tt>FT_Renderer</tt> for renderer modules</p>
|
||||
<li><p><tt>FT_Driver</tt> for font driver modules</p>
|
||||
<li><p><tt>FT_AutoHinter</tt> for the auto-hinter</p>
|
||||
</ul>
|
||||
|
||||
<p>Helper modules use the base <tt>FT_ModuleRec</tt> type. We will
|
||||
describe these classes in the next chapters.</p>
|
||||
|
||||
<p><hr></p>
|
||||
|
||||
<center>
|
||||
<table width="100%"
|
||||
border=0
|
||||
cellpadding=5>
|
||||
<tr bgcolor="#CCFFCC" valign=center>
|
||||
<td align=center
|
||||
width="30%">
|
||||
<a href="design-4.html">Previous</a>
|
||||
</td>
|
||||
<td align=center
|
||||
width="30%">
|
||||
<a href="index.html">Contents</a>
|
||||
</td>
|
||||
<td align=center
|
||||
width="30%">
|
||||
<a href="design-6.html">Next</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</center>
|
||||
|
||||
</td></tr>
|
||||
</table>
|
||||
</center>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,94 @@
|
||||
<!doctype html public "-//w3c//dtd html 4.0 transitional//en"
|
||||
"http://www.w3.org/TR/REC-html40/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type"
|
||||
content="text/html; charset=iso-8859-1">
|
||||
<meta name="Author"
|
||||
content="David Turner">
|
||||
<title>The design of FreeType 2</title>
|
||||
</head>
|
||||
|
||||
<body text="#000000"
|
||||
bgcolor="#FFFFFF"
|
||||
link="#0000EF"
|
||||
vlink="#51188E"
|
||||
alink="#FF0000">
|
||||
|
||||
<h1 align=center>
|
||||
The design of FreeType 2
|
||||
</h1>
|
||||
|
||||
<h3 align=center>
|
||||
Copyright 1998-2000 David Turner (<a
|
||||
href="mailto:[email protected]">[email protected]</a>)<br>
|
||||
Copyright 2000 The FreeType Development Team (<a
|
||||
href="mailto:[email protected]">[email protected]</a>)
|
||||
</h3>
|
||||
|
||||
<center>
|
||||
<table width="65%">
|
||||
<tr><td>
|
||||
|
||||
<center>
|
||||
<table width="100%"
|
||||
border=0
|
||||
cellpadding=5>
|
||||
<tr bgcolor="#CCFFCC"
|
||||
valign=center>
|
||||
<td align=center
|
||||
width="30%">
|
||||
<a href="design-5.html">Previous</a>
|
||||
</td>
|
||||
<td align=center
|
||||
width="30%">
|
||||
<a href="index.html">Contents</a>
|
||||
</td>
|
||||
<td align=center
|
||||
width="30%">
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</center>
|
||||
|
||||
<p><hr></p>
|
||||
|
||||
<table width="100%">
|
||||
<tr bgcolor="#ccccee"><td>
|
||||
<h1>
|
||||
TO BE CONTINUED...
|
||||
</h1>
|
||||
</td></tr>
|
||||
</table>
|
||||
|
||||
|
||||
<p><hr></p>
|
||||
|
||||
<center>
|
||||
<table width="100%"
|
||||
border=0
|
||||
cellpadding=5>
|
||||
<tr bgcolor="#CCFFCC" valign=center>
|
||||
<td align=center
|
||||
width="30%">
|
||||
<a href=design-5.html">Previous</a>
|
||||
</td>
|
||||
<td align=center
|
||||
width="30%">
|
||||
<a href="index.html">Contents</a>
|
||||
</td>
|
||||
<td align=center
|
||||
width="30%">
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</center>
|
||||
|
||||
</td></tr>
|
||||
</table>
|
||||
</center>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
After Width: | Height: | Size: 2.4 KiB |
@@ -0,0 +1,81 @@
|
||||
<!doctype html public "-//w3c//dtd html 4.0 transitional//en"
|
||||
"http://www.w3.org/TR/REC-html40/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type"
|
||||
content="text/html; charset=iso-8859-1">
|
||||
<meta name="Author"
|
||||
content="David Turner">
|
||||
<title>The design of FreeType 2</title>
|
||||
</head>
|
||||
|
||||
<body text="#000000"
|
||||
bgcolor="#FFFFFF"
|
||||
link="#0000EF"
|
||||
vlink="#51188E"
|
||||
alink="#FF0000">
|
||||
|
||||
<h1 align=center>
|
||||
The design of FreeType 2
|
||||
</h1>
|
||||
|
||||
<h3 align=center>
|
||||
Copyright 1998-2000 David Turner (<a
|
||||
href="mailto:[email protected]">[email protected]</a>)<br>
|
||||
Copyright 2000 The FreeType Development Team (<a
|
||||
href="mailto:[email protected]">[email protected]</a>)
|
||||
</h3>
|
||||
|
||||
|
||||
<center>
|
||||
<table width="70%">
|
||||
<tr><td>
|
||||
|
||||
<p>This document describes the details of FreeType 2's internals.
|
||||
Read this carefully if you need to understand the innards of the library
|
||||
in order to hack or extend it.</p>
|
||||
|
||||
<table width="100%">
|
||||
<tr valign=center
|
||||
bgcolor="#CCCCFF">
|
||||
<td align=center>
|
||||
<h2>
|
||||
Table of Contents
|
||||
</h2>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<center>
|
||||
<table width="80%">
|
||||
<tr><td>
|
||||
|
||||
<h2>
|
||||
<a href="design-1.html">Introduction</a>
|
||||
</h2>
|
||||
|
||||
<h2>
|
||||
<a href="design-2.html">I. Components and APIs</a>
|
||||
</h2>
|
||||
|
||||
<h2>
|
||||
<a href="design-3.html">II. Public Objects and Classes</a>
|
||||
</h2>
|
||||
|
||||
<h2>
|
||||
<a href="design-4.html">III. Internal Objects and Classes</a>
|
||||
</h2>
|
||||
|
||||
<h2>
|
||||
<a href="design-5.html">IV. Module Classes</a>
|
||||
</h2>
|
||||
|
||||
</td></tr>
|
||||
</table>
|
||||
</center>
|
||||
|
||||
</td></tr>
|
||||
</table>
|
||||
</center>
|
||||
</body>
|
||||
</html>
|
||||
|
After Width: | Height: | Size: 4.2 KiB |
@@ -0,0 +1,639 @@
|
||||
<html>
|
||||
<head><title>FreeType 2 - Modules</title>
|
||||
<basefont face="Georgia, Arial, Helvetica, Geneva">
|
||||
<style content="text/css">
|
||||
P { text-align=justify }
|
||||
H1 { text-align=center }
|
||||
H2 { text-align=center }
|
||||
LI { text-align=justify }
|
||||
</style>
|
||||
</head>
|
||||
<body text=#000000 bgcolor=#ffffff>
|
||||
|
||||
<center><table width="500"><tr><td>
|
||||
|
||||
<center><h1>FreeType 2 Modules</h1></center>
|
||||
|
||||
<table width="100%" cellpadding=5><tr bgcolor="#ccccee"><td>
|
||||
<h1>Introduction</h1>
|
||||
</td></tr></table>
|
||||
|
||||
<p>
|
||||
The purpose of this document is to present in great details the way
|
||||
FreeType 2 uses and manages modules. Among other things, it answers
|
||||
the following questions:</p>
|
||||
|
||||
<ul>
|
||||
<li><p>
|
||||
what is a module, and what kind of modules are recognized
|
||||
by the library?
|
||||
</p></li>
|
||||
|
||||
<li><p>
|
||||
how are modules registered and managed by the library?
|
||||
</p></li>
|
||||
|
||||
<li><p>
|
||||
how to write a new module, especially new font drivers?
|
||||
</p></li>
|
||||
|
||||
<li><p>
|
||||
how to select specific modules for a given build of the
|
||||
library ?
|
||||
</p></li>
|
||||
|
||||
<li><p>
|
||||
how to compile modules as stand-alone DLLs / shared objects?
|
||||
</p></li>
|
||||
|
||||
</ul>
|
||||
|
||||
<table width="100%" cellpadding=5><tr bgcolor="#ccccee"><td>
|
||||
<h1>Overview</h1>
|
||||
</td></tr></table>
|
||||
|
||||
|
||||
<h3>1. Library design:</h3>
|
||||
|
||||
<p>The design of the library is pretty basic:</p>
|
||||
<ul>
|
||||
<li><p>
|
||||
client applications typically call the FreeType 2 high-level
|
||||
API, whose functions are implemented in a single component
|
||||
called the <em>Base Layer</em>.
|
||||
</p></li>
|
||||
|
||||
<li><p>
|
||||
depending on the context or the task, the base
|
||||
layer then calls one or more modules to perform the
|
||||
work. In most cases, the client application doesn't
|
||||
need to know what module was called.
|
||||
</p></li>
|
||||
|
||||
<li><p>
|
||||
the base layer also contains a set of routines that are
|
||||
used for generic things like memory allocation, list
|
||||
processing, i/o stream parsing, fixed point computation,
|
||||
etc.. these functions can also be called by a module
|
||||
at any, and they form what is called the "low-level
|
||||
base API".
|
||||
</p></li>
|
||||
</ul>
|
||||
|
||||
<p>This is illustrated by the following graphics:</p>
|
||||
|
||||
<center><img src="basic-design.png" width="312" height="312"></center>
|
||||
|
||||
<p>Note that, however, FT2 comes with a set of <em>optional</em>
|
||||
components that can be ommited from certain builds, and whose
|
||||
purpose vary between two situations:</p>
|
||||
|
||||
<ul>
|
||||
<li><p>
|
||||
some are located on top of the high-level API and provide
|
||||
convenience functions that make certain things easier
|
||||
for typical applications. They typically do not call
|
||||
modules directly, though they can use the low level
|
||||
base API for certain tasks.</p>
|
||||
|
||||
<p>As an example, see the the <tt>ftglyph</tt> component
|
||||
that is used to manipulate glyph images more conveniently
|
||||
than the default API.</p>
|
||||
</p></li>
|
||||
|
||||
<li><p>
|
||||
some other components complement the base layer, by providing
|
||||
additional routines. Most of them allow client applications
|
||||
to access format-specific data.</p>
|
||||
|
||||
<p>For example, the <tt>ftmm</tt> component provides high-level
|
||||
functions to specify Multiple Master coordinates for MM Type 1
|
||||
fonts.</p>
|
||||
</p></li>
|
||||
</ul>
|
||||
|
||||
<p>This is illustrated by the following graphics:</p>
|
||||
|
||||
<center><img src="detailed-design.png" width="365" height="392"></center>
|
||||
|
||||
<table width="100%" cellpadding=5><tr bgcolor="#ccccee"><td>
|
||||
<h1>Module Classes</h1>
|
||||
</td></tr></table>
|
||||
|
||||
<p>
|
||||
The library is capable of managing and using several kinds of
|
||||
modules:</p>
|
||||
|
||||
<ul>
|
||||
<li><p>
|
||||
<b>renderer</b> modules are used to convert scalable glyph images
|
||||
to bitmaps. FreeType 2 comes by default with two of them:</p>
|
||||
|
||||
<center><table cellpadding=5><tr valign=top><td>
|
||||
<p><b><tt>raster1</tt></b></p>
|
||||
</td><td>
|
||||
<p>supports the conversion of vectorial outlines (described by a
|
||||
<tt>FT_Outline</tt> object) to <em>monochrome</em> bitmaps.
|
||||
</td></tr><tr valign=top><td></p>
|
||||
|
||||
<p><b><tt>smooth</tt></b></p>
|
||||
</td><td>
|
||||
<p>supports the conversion of the same outlines to high-quality
|
||||
<em>anti-aliased</em> pixmaps.</p>
|
||||
</td></tr></table></center>
|
||||
|
||||
|
||||
<p>The specification and interface of renderers is described in
|
||||
details within this document.</p>
|
||||
|
||||
<p>Note that most font formats use <tt>FT_Outline</tt> objects
|
||||
to describe scalable glyph images. However, FT2 is flexible
|
||||
and allows specific modules to register and support other
|
||||
formats. As an example, it's (at least theorically :-) perfectly
|
||||
possible to write a renderer module that is capable of directly
|
||||
converting MetaFont glyph definitions to bitmaps or pixmaps !
|
||||
(of course, this assumes that you also write a MetaFont font
|
||||
driver to load the definitions :-).
|
||||
</p></li>
|
||||
|
||||
<li><p>
|
||||
<b>font driver</b> modules are used to support one or more specific
|
||||
font format. By default, FT2 comes with the following modules:</p>
|
||||
|
||||
<center><table cellpadding=5><tr valign=top><td>
|
||||
<p><tt><b>truetype</b></tt></p>
|
||||
</td><td>
|
||||
<p>supports TrueType font files</p>
|
||||
</td></tr><tr valign=top><td>
|
||||
|
||||
<p><tt><b>type1</b></tt></p>
|
||||
</td><td>
|
||||
<p>supports Postscript Type 1 fonts, both in binary (.pfb) or ASCII
|
||||
(.pfa) formats, including Multiple Master fonts.</p>
|
||||
</td></tr><tr valign=top><td>
|
||||
|
||||
<p><tt><b>cid</b></tt></p>
|
||||
</td><td>
|
||||
<p>supports Postscript CID-keyed fonts</p>
|
||||
</td></tr><tr valign=top><td>
|
||||
|
||||
<p><tt><b>cff</b></tt></p>
|
||||
</td><td>
|
||||
<p>supports OpenType, CFF as well as CEF fonts (CEF is a derivative
|
||||
of CFF used by Adobe in its SVG viewer).</p>
|
||||
</td></tr><tr valign=top><td>
|
||||
|
||||
<p><tt><b>winfonts</b></tt></p>
|
||||
</td><td>
|
||||
<p>supports Windows bitmap fonts (i.e. ".FON" and ".FNT").</p>
|
||||
</td></tr>
|
||||
|
||||
</td></tr></table></center>
|
||||
|
||||
<p>Note that font drivers can support bitmapped or scalable glyph
|
||||
images. A given font driver that supports bezier outlines through
|
||||
the <tt>FT_Outline</tt> can also provide its own hinter, or rely
|
||||
on FreeType's <b>autohinter</b> module.
|
||||
</p></li>
|
||||
|
||||
<li><p>
|
||||
<b>helper</b> modules are used to hold shared code that is
|
||||
often used by several font drivers, or even other modules.
|
||||
Here are a few examples of helper modules that come with
|
||||
FreeType 2:</p>
|
||||
|
||||
<table cellpadding=5><tr valign=top><td>
|
||||
<b><tt>sfnt</tt></b>
|
||||
</td><td>
|
||||
used to support font formats based on the "<tt>SFNT</tt>"
|
||||
storage scheme. This means TrueType & OpenType fonts as
|
||||
well as other variants (like TrueType fonts that only
|
||||
contain embedded bitmaps).
|
||||
</td></tr><tr valign=top><td>
|
||||
|
||||
<b><tt>psnames</tt></b>
|
||||
</td><td>
|
||||
used to provide various useful function related to glyph
|
||||
names ordering and Postscript encodings/charsets. For example,
|
||||
this module is capable of automatically synthetizing a Unicode
|
||||
charmap from a Type 1 glyph name dictionary.
|
||||
</td></tr></table></center>
|
||||
</p></li>
|
||||
|
||||
|
||||
<li><p>
|
||||
finally, the <b>autohinter</b> module has a specific role in
|
||||
FreeType 2, as it can be used automatically during glyph loading
|
||||
to process individual glyph outlines when a font driver doesn't
|
||||
provide it's own hinting engine.
|
||||
</p></li>
|
||||
</ul>
|
||||
|
||||
<p>We will now study how modules are described, then managed by
|
||||
the library.</p>
|
||||
|
||||
<h3>1. The <tt>FT_Module_Class</tt> structure:</h3>
|
||||
|
||||
<p>As described later in this document, library initialisation is
|
||||
performed by calling the <tt>FT_Init_FreeType</tt> function. The
|
||||
latter is in charge of creating a new "empty" <tt>FT_Library</tt>
|
||||
object, then register each "default" module by repeatedly calling
|
||||
the <tt>FT_Add_Module</tt> function.</p>
|
||||
|
||||
<p>Similarly, client applications can call <tt>FT_Add_Module</tt>
|
||||
any time they wish in order to register a new module in the library.
|
||||
Let's take a look at this function's declaration:</p>
|
||||
|
||||
<pre><font color="blue">
|
||||
extern FT_Error FT_Add_Module( FT_Library library,
|
||||
const FT_Module_Class* clazz );
|
||||
</font></pre>
|
||||
|
||||
<p>As one can see, this function expects a handle to a library object,
|
||||
as well as a pointer to a <tt>FT_Module_Class</tt> structure. It
|
||||
returns an error code. In case of success, a new module object is
|
||||
created and added to the library. Note by the way that the module
|
||||
isn't returned directly by the call !.</p>
|
||||
|
||||
<p>Let's study the definition of <tt>FT_Module_Class</tt>, and explain it
|
||||
a bit. The following code is taken from
|
||||
<tt><freetype/ftmodule.h></tt>:</p>
|
||||
|
||||
<pre><font color="blue">
|
||||
typedef struct FT_Module_Class_
|
||||
{
|
||||
FT_ULong module_flags;
|
||||
FT_Int module_size;
|
||||
const FT_String* module_name;
|
||||
FT_Fixed module_version;
|
||||
FT_Fixed module_requires;
|
||||
|
||||
const void* module_interface;
|
||||
|
||||
FT_Module_Constructor module_init;
|
||||
FT_Module_Destructor module_done;
|
||||
FT_Module_Requester get_interface;
|
||||
|
||||
} FT_Module_Class;
|
||||
</font></pre>
|
||||
|
||||
<p>here's a description of its fields:</p>
|
||||
|
||||
<center><table cellpadding=5><tr valign=top><td>
|
||||
<p><b>module_flags</b></p>
|
||||
</td><td>
|
||||
<p>this is a set of bit flags used to describe the module's
|
||||
category. Valid values are:</p>
|
||||
<ul>
|
||||
<li><p>
|
||||
<b>ft_module_font_driver</b> if the module is a font driver
|
||||
</p></li>
|
||||
|
||||
<li><p>
|
||||
<b>ft_module_renderer</b> if the module is a renderer
|
||||
</p></li>
|
||||
|
||||
<li><p>
|
||||
<b>ft_module_hinter</b> if the module is an auto-hinter
|
||||
</p></li>
|
||||
|
||||
<li><p>
|
||||
<b>ft_module_driver_scalable</b> if the module is a font
|
||||
driver supporting scalable glyph formats.
|
||||
</p></li>
|
||||
|
||||
<li><p>
|
||||
<b>ft_module_driver_no_outlines</b> if the module is a
|
||||
font driver supporting scalable glyph formats that <em>cannot</em>
|
||||
be described by a <tt>FT_Outline</tt> object
|
||||
</p></li>
|
||||
|
||||
<li><p>
|
||||
<b>ft_module_driver_has_hinter</b> if the module is a font
|
||||
driver that provides its own hinting scheme/algorithm
|
||||
</p></li>
|
||||
</ul>
|
||||
</td></tr><tr valign=top><td>
|
||||
|
||||
<p><b>module_size</b></p>
|
||||
</td><td>
|
||||
<p>an integer that gives the size in <em>bytes</em> of a given module
|
||||
object. This should <em>never</em> be less than
|
||||
<tt>sizeof(FT_ModuleRec)</tt>, but can be more when the module
|
||||
needs to sub-class the base <tt>FT_ModuleRec</tt> class.</p>
|
||||
</td></tr><tr valign=top><td>
|
||||
|
||||
<p><b>module_name</b></p>
|
||||
</td><td>
|
||||
<p>this is the module's internal name, coded as a simple ASCII C
|
||||
string. There can't be two modules with the same name registered
|
||||
in a given <tt>FT_Library</tt> object. However, <tt>FT_Add_Module</tt>
|
||||
uses the <b>module_version</b> field to detect module upgrades
|
||||
and perform them cleanly, even at run-time.</p>
|
||||
</td></tr><tr valign=top><td>
|
||||
|
||||
<p><b>module_version</b></p>
|
||||
</td><td>
|
||||
<p>a 16.16 fixed float number giving the module's major and minor
|
||||
version numbers. It is used to determine wether a module needs
|
||||
to be upgraded when calling <tt>FT_Add_Module</tt>.</p>
|
||||
</td></tr><tr valign=top><td>
|
||||
|
||||
<p><b>module_requires</b></p>
|
||||
</td><td>
|
||||
<p>a 16.16 fixed float number giving the version of FreeType 2 that
|
||||
is required to install this module. By default, should be 0x20000
|
||||
for FreeType 2.0</p>
|
||||
</td></tr><tr valign=top><td>
|
||||
|
||||
<p><b>module_requires</b></p>
|
||||
</td><td>
|
||||
<p>most modules support one or more "interfaces", i.e. tables of function
|
||||
pointers. This field is used to point to the module's main interface,
|
||||
where there is one. It's a short-cut that prevents users of the module
|
||||
to call "get_interface" each time they need to access one of the object's
|
||||
common entry points.</p>
|
||||
|
||||
<p>Note that is is optional, and can be set to NULL. Other interfaces
|
||||
can also be accessed through the <b>get_interface</b> field.</p>
|
||||
</td></tr><tr valign=top><td>
|
||||
|
||||
<p><b>module_init</b></p>
|
||||
</td><td>
|
||||
<p>this is a pointer to a function used to initialise the fields of
|
||||
a fresh new <tt>FT_Module</tt> object. It is called <em>after</em> the module's
|
||||
base fields have been set by the library, and is generally used to
|
||||
initialise the fields of <tt>FT_ModuleRec</tt> subclasses.</p>
|
||||
|
||||
<p>Most module classes set it to NULL to indicate that no extra
|
||||
initialisation is necessary</p>
|
||||
</td></tr><tr valign=top><td>
|
||||
|
||||
<p><b>module_done</b></p>
|
||||
</td><td>
|
||||
<p>this is a pointer to a function used to finalise the fields of
|
||||
a given <tt>FT_Module</tt> object. Note that it is called <em>before</em> the
|
||||
library unsets the module's base fields, and is generally used to
|
||||
finalize the fields of <tt>FT_ModuleRec</tt> subclasses.</p>
|
||||
|
||||
<p>Most module classes set it to NULL to indicate that no extra
|
||||
finalisation is necessary</p>
|
||||
</td></tr><tr valign=top><td>
|
||||
|
||||
<p><b>get_interface</b></p>
|
||||
</td><td>
|
||||
<p>this is a pointer to a function used to request the address of
|
||||
a given module interface. Set it to NULL if you don't need to support
|
||||
additional interfaces but the main one.</p>
|
||||
</td></tr><tr valign=top><td>
|
||||
|
||||
</td></tr></table></center>
|
||||
|
||||
|
||||
<h3>2. The <tt>FT_Module</tt> type:</h3>
|
||||
|
||||
<p>the <tt>FT_Module</tt> type is a handle (i.e. a pointer) to a given
|
||||
module object / instance, whose base structure is given by the
|
||||
internal <tt>FT_ModuleRec</tt> type (we will not detail its
|
||||
structure here).</p>
|
||||
|
||||
<p>When <tt>FT_Add_Module</tt> is called, it first allocate a new
|
||||
module instance, using the <tt><b>module_size</b></tt> class
|
||||
field to determine its byte size. The function initializes
|
||||
a the root <tt>FT_ModuleRec</tt> fields, then calls
|
||||
the class-specific initializer <tt><b>module_init</b></tt>
|
||||
when this field is not set to NULL.</p>
|
||||
|
||||
|
||||
|
||||
|
||||
<table width="100%" cellpadding=5><tr bgcolor="#ccccee"><td>
|
||||
<h1>Renderer Modules</h1>
|
||||
</td></tr></table>
|
||||
|
||||
<p>As said previously, <b>renderers</b> are used to convert scalable
|
||||
glyph images to bitmaps or pixmaps. Each renderer module is defined
|
||||
through a <b>renderer class</b>, whose definition is found in the
|
||||
file <tt><freetype/ftrender.h></tt>. However, a few concepts
|
||||
need to be explained before having a detailed look at this structure.
|
||||
</p>
|
||||
|
||||
<h3>1. Glyph formats:</h3>
|
||||
|
||||
<p>Each glyph image that is loaded by FreeType (either through
|
||||
<tt>FT_Load_Glyph</tt> or <tt>FT_Load_Char</tt>), has a given
|
||||
<em>image format</em>, described by the field
|
||||
<tt>face->glyph->format</tt>. It is a 32-byte integer that
|
||||
can take any value. However, the file <tt><freetype/ftimage.h></tt>
|
||||
defines at least the following values:</p>
|
||||
|
||||
<center><table cellpadding=5>
|
||||
<tr valign=top><td>
|
||||
<tt><b>ft_glyph_format_bitmap</b></tt>
|
||||
</td><td>
|
||||
this value is used to indicate that the glyph image is a bitmap or pixmap.
|
||||
Its content can then be accessed directly from
|
||||
<tt>face->glyph->bitmap</tt> after the glyph was loaded.
|
||||
</td></tr>
|
||||
|
||||
<tr valign=top><td>
|
||||
<tt><b>ft_glyph_format_outline</b></tt>
|
||||
</td><td>
|
||||
this value is used to indicate that the glyph image is a scalable vectorial
|
||||
outline, that can be described by a <tt>FT_Outline</tt> object. Its content
|
||||
can be accessed directly from
|
||||
<tt>face->glyph->outline</tt> after the glyph was loaded.
|
||||
this is the format that is commonly returned by TrueType, Type1 and
|
||||
OpenType / CFF fonts.
|
||||
</td></tr>
|
||||
|
||||
<tr valign=top><td>
|
||||
<tt><b>ft_glyph_format_plotter</b></tt>
|
||||
</td><td>
|
||||
this value is equivalent to <tt><b>ft_glyph_format_outline</b></tt> except
|
||||
that the outline stored corresponds to path strokes, instead of filled
|
||||
outlines. It can be returned from certain Type 1 fonts (notably the Hershey
|
||||
collection of free fonts).
|
||||
</td></tr>
|
||||
|
||||
<tr valign=top><td>
|
||||
<tt><b>ft_glyph_format_composite</b></tt>
|
||||
</td><td>
|
||||
this value is used to indicate that the glyph image is really a "compound"
|
||||
of several other "sub-glyphs". This value is only returned when a glyph
|
||||
is loaded with the <tt><b>FT_LOAD_NO_RECURSE</b></tt> flag. The list of
|
||||
subglyphs that make up the composite can be accessed directly as
|
||||
<tt>face->glyph->subglyphs</tt> after the glyph was loaded.
|
||||
</td></tr>
|
||||
|
||||
</table></center>
|
||||
|
||||
<p>Note that this is only a list of pre-defined formats supported by
|
||||
FreeType. Nothing prevents an application to install a new font
|
||||
driver that creates other kinds of glyph images. For example, one
|
||||
could imagine a MetaFont font driver, that would be capable to
|
||||
parse font definition files and create in-memory "glyph programs",
|
||||
that could be returned in <tt>face->glyph->other</tt>.</p>
|
||||
|
||||
<h3>2. The <tt>FT_Outline</tt> type:</h3>
|
||||
|
||||
<p>This structure, which is also defined, and heavily commented, in
|
||||
the file <tt><freetype/ftimage.h></tt>, is used to hold
|
||||
a scalable glyph image that is made of one or more contours, each
|
||||
contour being described by line segments or bezier arcs (either
|
||||
quadratic or cubic). The outline itself is stored in a compact
|
||||
way that makes processing it easy.</p>
|
||||
|
||||
<p>Points are placed in a 2D plane that uses the y-upwards convention,
|
||||
and their coordinates are stored in 1/64th of pixels (also known
|
||||
as the 26.6 fixed point format). Pixels correspond to single squares
|
||||
whose borders are on integer coordinates (i.e. mutiples of 64).
|
||||
In other words, pixel centers are located on half pixel coordinates.</p>
|
||||
|
||||
<p>Outlines can be very easily transformed (translated, rotated, etc..)
|
||||
before being converted to bitmap, which allows for sophisticated
|
||||
use of text. FreeType 2 comes by default with two "outline renderer"
|
||||
modules:</p>
|
||||
|
||||
<p><ul>
|
||||
<li><b>raster1</b>, used to convert them to monochrome bitmaps</li>
|
||||
<li><b>smooth</b>, used to convert them to high-quality anti-aliased
|
||||
pixmaps</li>
|
||||
</ul></p>
|
||||
|
||||
<h3>3. Bitmaps and scan-conversion:</h3>
|
||||
|
||||
<p>Bitmaps and pixmaps are described through a <tt>FT_Bitmap</tt>
|
||||
structure, which is defined and heavily commented in
|
||||
<tt><freetype/ftimage.h></tt>
|
||||
|
||||
|
||||
<pre><font color="blue">
|
||||
typedef struct FT_Renderer_Class_
|
||||
{
|
||||
FT_Module_Class root;
|
||||
|
||||
FT_Glyph_Format glyph_format;
|
||||
|
||||
FTRenderer_render render_glyph;
|
||||
FTRenderer_transform transform_glyph;
|
||||
FTRenderer_getCBox get_glyph_cbox;
|
||||
FTRenderer_setMode set_mode;
|
||||
|
||||
FT_Raster_Funcs* raster_class;
|
||||
|
||||
} FT_Renderer_Class;
|
||||
</font></pre>
|
||||
|
||||
<table width="100%" cellpadding=5><tr bgcolor="#ccccee"><td>
|
||||
<h1>Font Driver Modules</h1>
|
||||
</td></tr></table>
|
||||
|
||||
<table width="100%" cellpadding=5><tr bgcolor="#ccccee"><td>
|
||||
<h1>Library Initialisation & Dynamic Builds</h1>
|
||||
</td></tr></table>
|
||||
|
||||
<p>By default, all components of FreeType 2 are compiled independently,
|
||||
then grouped into a single static library file that can be installed
|
||||
or used directly to compile client applications</p>
|
||||
|
||||
<p>Such applications must normally call the <tt>FT_Init_FreeType</tt>
|
||||
function before using the library. This function is in charge of
|
||||
two things:</p>
|
||||
|
||||
<ul>
|
||||
<li><p>
|
||||
First, it creates a <tt>FT_Library</tt> object (by calling
|
||||
the public function <tt>FT_New_Library</tt>). This new
|
||||
object is "empty" and has no module registered in it.
|
||||
</p></li>
|
||||
|
||||
<li><p>
|
||||
Then, it registers all "default modules" by repeatedly calling
|
||||
<tt>FT_Add_Module</tt>.
|
||||
</p></li>
|
||||
</ul>
|
||||
|
||||
<p>It is important to notice that the default implementation of
|
||||
<tt>FT_Init_FreeType</tt>, which is located in the source
|
||||
file <tt>"src/base/ftinit.c"</tt> always uses a <em>static</em>
|
||||
list of modules that is generated at compile time from the
|
||||
configuration file <tt><freetype/config/ftmodule.h></tt>.
|
||||
</p>
|
||||
|
||||
<p>There are cases where this may be inadequate. For example, one
|
||||
might want to compile modules as independent DLLs in a specific
|
||||
location (like <tt>"/usr/lib/freetype/module/"</tt>), and have
|
||||
the library initialisation function load the modules dynamically
|
||||
by parsing the directory's content</p>
|
||||
|
||||
<p>This is possible, and we're going to explain how to do it.</p>
|
||||
|
||||
|
||||
<h4>a. Building the library as a DLL (i.e. "shared object" on Unix)</h4>
|
||||
|
||||
<p>But first of all, let's explain how to build FreeType 2 as a single
|
||||
DLL or shared object, i.e. one that includes the base layer, all
|
||||
default modules and optional components into a single file.</p>
|
||||
|
||||
<p>When building dynamic libraries, certain compilers require specific
|
||||
directives to <em>declare</em> exported DLL entry points. For example, the
|
||||
"<tt>__cdecl</tt>" directive is required by Win32 compilers, as it forces
|
||||
the use of the "C" parameter passing convention (instead of "smarter"
|
||||
schemes, which usually use registers and the stack to pass parameters).</p>
|
||||
|
||||
<p>To make matter worse, some of these compilers require the directive
|
||||
before the function's return type, while some others want it between
|
||||
the return type and the function's identifier.</p>
|
||||
|
||||
<p>To allow such compilations, the <tt>FT_EXPORT_DEF()</tt> macro is
|
||||
used in all public header files in order to declare each high-level
|
||||
API function of FreeType 2, as in the following example, taken from
|
||||
<tt><freetype/freetype.h></tt>:</p>
|
||||
|
||||
<pre><font color="blue">
|
||||
FT_EXPORT_DEF(FT_Error) FT_Init_FreeType( void );
|
||||
</font></pre>
|
||||
|
||||
<p>the definition of <tt>FT_EXPORT_DEF(x)</tt> defaults to <tt>"extern x"</tt>,
|
||||
except when a specific definition is given in the library's system-specific
|
||||
configuration file <tt><freetype/config/ftconfig.h></tt>. This
|
||||
allows project builders to specify the exact compilation directive
|
||||
they need.</p>
|
||||
|
||||
<p>Similarly, the <tt>FT_EXPORT_FUNC(x)</tt> macro is defined and used to
|
||||
<em>define</em> exported functions within the FreeType 2 source code.
|
||||
However, it is only used at compilation time.</p>
|
||||
|
||||
|
||||
<p>Note that on Unix, there is no need for specific exportation directives.
|
||||
However, the code must be compiled in a special way, named Position
|
||||
Independent Code ("PIC"), which is normally selected through specific
|
||||
compiler flags (like "-PIC" with gcc).</p>
|
||||
|
||||
|
||||
<h4>b. Building modules as DLLs</h4>
|
||||
|
||||
<p>In order to build modules as dynamic libraries, we first need to compile
|
||||
the base layer (and optional components) as a single DLL. This is very
|
||||
similar to the case we just described, except that we also need to
|
||||
export all functions that are part of the "low level base API",
|
||||
as these will get called by the modules in various cases.</p>
|
||||
|
||||
<p>Similarly to the high-level API, all functions of the low-level base
|
||||
API are declared in the internal header files of FreeType 2 with the
|
||||
<tt>BASE_DEF(x)</tt> macro. The latter is similar to
|
||||
<tt>FT_EXPORT_DEF</tt> and defaults to <tt>"extern x"</tt> unless
|
||||
you specify a specific definition in
|
||||
<tt><freetype/config/ftconfig.h></tt>.</p>
|
||||
<p>
|
||||
|
||||
<hr>
|
||||
|
||||
<table width="100%" cellpadding=5><tr bgcolor="#ccccee"><td>
|
||||
<h1>Conclusion</h1>
|
||||
</td></tr></table>
|
||||
|
||||
</td></tr></table></center>
|
||||
</body>
|
||||
</html>
|
||||
|
After Width: | Height: | Size: 4.0 KiB |
@@ -0,0 +1,825 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# DocMaker is a very simple program used to generate HTML documentation
|
||||
# from the source files of the FreeType packages.
|
||||
#
|
||||
# I should really be using regular expressions to do this, but hey,
|
||||
# i'm too lazy right now, and the damn thing seems to work :-)
|
||||
# - David
|
||||
#
|
||||
|
||||
import fileinput, sys, string
|
||||
|
||||
html_header = """
|
||||
<html>
|
||||
<header>
|
||||
<title>FreeType 2 API Reference</title>
|
||||
<basefont face="Georgia, Arial, Helvetica, Geneva">
|
||||
<style content="text/css">
|
||||
P { text-align=justify }
|
||||
H1 { text-align=center }
|
||||
H2 { text-align=center }
|
||||
LI { text-align=justify }
|
||||
</style>
|
||||
</header>
|
||||
<body text="#000000"
|
||||
bgcolor="#FFFFFF"
|
||||
link="#0000EF"
|
||||
vlink="#51188E"
|
||||
alink="#FF0000">
|
||||
<center><h1>FreeType 2 API Reference</h1></center>
|
||||
"""
|
||||
|
||||
html_footer = """
|
||||
</body>
|
||||
</html>
|
||||
"""
|
||||
|
||||
code_header = """
|
||||
<font color=blue><pre>
|
||||
"""
|
||||
|
||||
code_footer = """
|
||||
</pre></font>
|
||||
"""
|
||||
|
||||
para_header = "<p>"
|
||||
para_footer = "</p>"
|
||||
|
||||
block_header = """<center><hr width="550"><table width="550"><tr><td>"""
|
||||
block_footer = "</table></center>"
|
||||
|
||||
source_header = """<center><table width="550"><tr bgcolor="#D6E8FF" width="100%"><td><pre>
|
||||
"""
|
||||
source_footer = """</pre></table></center>
|
||||
<br><br>
|
||||
"""
|
||||
|
||||
# The FreeType 2 reference is extracted from the source files. These contain
|
||||
# various comment blocks that follow one of the following formats:
|
||||
#
|
||||
# /**************************
|
||||
# *
|
||||
# * FORMAT1
|
||||
# *
|
||||
# *
|
||||
# *
|
||||
# *
|
||||
# *************************/
|
||||
#
|
||||
# /**************************/
|
||||
# /* */
|
||||
# /* FORMAT2 */
|
||||
# /* */
|
||||
# /* */
|
||||
# /* */
|
||||
# /* */
|
||||
#
|
||||
# /**************************/
|
||||
# /* */
|
||||
# /* FORMAT3 */
|
||||
# /* */
|
||||
# /* */
|
||||
# /* */
|
||||
# /* */
|
||||
# /**************************/
|
||||
#
|
||||
# Each block contains a list of markers, each one can be followed by
|
||||
# some arbitrary text or a list of fields. Here's an example:
|
||||
#
|
||||
# <Struct>
|
||||
# MyStruct
|
||||
#
|
||||
# <Description>
|
||||
# this structure holds some data
|
||||
#
|
||||
# <Fields>
|
||||
# x :: horizontal coordinate
|
||||
# y :: vertical coordinate
|
||||
#
|
||||
#
|
||||
# This example defines three markers: 'Struct', 'Description' & 'Fields'
|
||||
# The first two markers contain arbitrary text, while the last one contains
|
||||
# a list of field
|
||||
#
|
||||
# each field is simple of the format: WORD :: TEXT....
|
||||
#
|
||||
# Note that typically, each comment block is followed by some source
|
||||
# code declaration that may need to be kept in the reference..
|
||||
#
|
||||
# Note that markers can alternatively be written as "@MARKER:"
|
||||
# instead of "<MAKRER>". All marker identifiers are converted to
|
||||
# lower case during parsing, in order to simply sorting..
|
||||
#
|
||||
# We associate with each block the following source lines that do not
|
||||
# begin with a comment. For example, the following:
|
||||
#
|
||||
# /**********************************
|
||||
# *
|
||||
# * <mytag> blabla
|
||||
# *
|
||||
# */
|
||||
#
|
||||
# bla_bla_bla
|
||||
# bilip_bilip
|
||||
#
|
||||
# /* - this comment acts as a separator - */
|
||||
#
|
||||
# blo_blo_blo
|
||||
#
|
||||
#
|
||||
# will only keep the first two lines of sources with
|
||||
# the "blabla" block
|
||||
#
|
||||
# However, the comment will be kept, with following source lines
|
||||
# if it contains a starting '#' or '@' as in:
|
||||
#
|
||||
# /*@.....*/
|
||||
# /*#.....*/
|
||||
# /* @.....*/
|
||||
# /* #.....*/
|
||||
#
|
||||
|
||||
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# The DocCode class is used to store source code lines
|
||||
#
|
||||
# self.lines contains a set of source code lines that will
|
||||
# be dumped as HTML in a <PRE> tag.
|
||||
#
|
||||
# the object is filled line by line by the parser, it strips the
|
||||
# leading "margin" space from each input line before storing it
|
||||
# in self.lines
|
||||
#
|
||||
class DocCode:
|
||||
|
||||
def __init__( self, margin = 0 ):
|
||||
self.lines = []
|
||||
self.margin = margin
|
||||
|
||||
def add( self, line ):
|
||||
# remove margin whitespace
|
||||
if string.strip( line[: self.margin] ) == "":
|
||||
line = line[self.margin :]
|
||||
self.lines.append( line )
|
||||
|
||||
|
||||
def dump( self ):
|
||||
for line in self.lines:
|
||||
print "--" + line
|
||||
print ""
|
||||
|
||||
def get_identifier( self ):
|
||||
# this function should never be called
|
||||
return "UNKNOWN_CODE_IDENTIFIER!!"
|
||||
|
||||
def dump_html( self ):
|
||||
|
||||
# clean the last empty lines
|
||||
l = len( self.lines ) - 1
|
||||
while l > 0 and string.strip( self.lines[l - 1] ) == "":
|
||||
l = l - 1
|
||||
|
||||
print code_header
|
||||
for line in self.lines[0 : l]:
|
||||
print line
|
||||
print code_footer
|
||||
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# The DocParagraph is used to store text paragraphs
|
||||
# self.words is simply a list of words for the paragraph
|
||||
#
|
||||
# the paragraph is filled line by line by the parser..
|
||||
#
|
||||
class DocParagraph:
|
||||
|
||||
def __init__( self ):
|
||||
self.words = []
|
||||
|
||||
def add( self, line ):
|
||||
# get rid of unwanted spaces in the paragraph
|
||||
#
|
||||
# the following line is the same as
|
||||
#
|
||||
# self.words.extend( string.split( line ) )
|
||||
#
|
||||
# but older Python versions don't have the `extend' attribute
|
||||
#
|
||||
last = len(self.words)
|
||||
self.words[last:last] = string.split( line )
|
||||
|
||||
# this function is used to retrieve the first word of a given
|
||||
# paragraph..
|
||||
def get_identifier( self ):
|
||||
if self.words:
|
||||
return self.words[0]
|
||||
|
||||
# should never happen
|
||||
return "UNKNOWN_PARA_IDENTIFIER!!"
|
||||
|
||||
|
||||
def dump( self ):
|
||||
|
||||
max_width = 50
|
||||
cursor = 0
|
||||
line = ""
|
||||
|
||||
for word in self.words:
|
||||
|
||||
if cursor + len( word ) + 1 > max_width:
|
||||
print line
|
||||
cursor = 0
|
||||
line = ""
|
||||
|
||||
line = line + word + " "
|
||||
cursor = cursor + len( word ) + 1
|
||||
|
||||
if cursor > 0:
|
||||
print line
|
||||
|
||||
#print "§" #for debugging only
|
||||
|
||||
|
||||
def dump_html( self ):
|
||||
|
||||
print para_header
|
||||
self.dump()
|
||||
print para_footer
|
||||
|
||||
|
||||
###########################################################################
|
||||
#
|
||||
# DocContent is used to store the content of a given marker.
|
||||
#
|
||||
# the "self.items" list contains (field,elements) record, where
|
||||
# "field" corresponds to a given structure fields or function
|
||||
# parameter (indicated by a "::"), or NULL for a normal section
|
||||
# of text/code
|
||||
#
|
||||
# hence, the following example:
|
||||
#
|
||||
# <MyMarker>
|
||||
# this is an example of what can be put in a content section,
|
||||
#
|
||||
# a second line of example text
|
||||
#
|
||||
# x :: a simple test field, with some content
|
||||
# y :: even before, this field has some code content
|
||||
# {
|
||||
# y = x+2;
|
||||
# }
|
||||
#
|
||||
# should be stored as
|
||||
# [ ( None, [ DocParagraph, DocParagraph] ),
|
||||
# ( "x", [ DocParagraph ] ),
|
||||
# ( "y", [ DocParagraph, DocCode ] ) ]
|
||||
#
|
||||
# in self.items
|
||||
#
|
||||
# the DocContent object is entirely built at creation time, you must
|
||||
# pass a list of input text lines lin the "lines_list" parameter..
|
||||
#
|
||||
#
|
||||
class DocContent:
|
||||
|
||||
def __init__( self, lines_list ):
|
||||
self.items = []
|
||||
code_mode = 0
|
||||
code_margin = 0
|
||||
text = []
|
||||
paragraph = None # represents the current DocParagraph
|
||||
code = None # represents the current DocCode
|
||||
|
||||
elements = [] # the list of elements for the current field,
|
||||
# contains DocParagraph or DocCode objects
|
||||
|
||||
field = None # the current field
|
||||
|
||||
for aline in lines_list:
|
||||
|
||||
if code_mode == 0:
|
||||
line = string.lstrip( aline )
|
||||
l = len( line )
|
||||
margin = len( aline ) - l
|
||||
|
||||
# if the line is empty, this is the end of the current
|
||||
# paragraph
|
||||
if l == 0 or line == '{':
|
||||
|
||||
if paragraph:
|
||||
elements.append( paragraph )
|
||||
paragraph = None
|
||||
|
||||
if line == "":
|
||||
continue
|
||||
|
||||
code_mode = 1
|
||||
code_margin = margin
|
||||
code = None
|
||||
continue
|
||||
|
||||
words = string.split( line )
|
||||
|
||||
# test for a field delimiter on the start of the line, i.e.
|
||||
# the token `::'
|
||||
#
|
||||
if len( words ) >= 2 and words[1] == "::":
|
||||
|
||||
# start a new field - complete current paragraph if any
|
||||
if paragraph:
|
||||
elements.append( paragraph )
|
||||
paragraph = None
|
||||
|
||||
# append previous "field" to self.items
|
||||
self.items.append( ( field, elements ) )
|
||||
|
||||
# start new field and elements list
|
||||
field = words[0]
|
||||
elements = []
|
||||
words = words[2 :]
|
||||
|
||||
# append remaining words to current paragraph
|
||||
if len( words ) > 0:
|
||||
line = string.join( words )
|
||||
if not paragraph:
|
||||
paragraph = DocParagraph()
|
||||
paragraph.add( line )
|
||||
|
||||
else:
|
||||
# we're in code mode..
|
||||
line = aline
|
||||
|
||||
# the code block ends with a line that has a single '}' on it
|
||||
# that is located at the same column that the opening
|
||||
# accolade..
|
||||
if line == " " * code_margin + '}':
|
||||
|
||||
if code:
|
||||
elements.append( code )
|
||||
code = None
|
||||
|
||||
code_mode = 0
|
||||
code_margin = 0
|
||||
|
||||
# otherwise, add the line to the current paragraph
|
||||
else:
|
||||
if not code:
|
||||
code = DocCode()
|
||||
code.add( line )
|
||||
|
||||
if paragraph:
|
||||
elements.append( paragraph )
|
||||
|
||||
if code:
|
||||
elements.append( code )
|
||||
|
||||
self.items.append( ( field, elements ) )
|
||||
|
||||
|
||||
def get_identifier( self ):
|
||||
if self.items:
|
||||
item = self.items[0]
|
||||
for element in item[1]:
|
||||
return element.get_identifier()
|
||||
|
||||
# should never happen
|
||||
return "UNKNOWN_CONTENT_IDENTIFIER!!"
|
||||
|
||||
|
||||
def dump( self ):
|
||||
for item in self.items:
|
||||
field = item[0]
|
||||
if field:
|
||||
print "<field " + field + ">"
|
||||
|
||||
for element in item[1]:
|
||||
element.dump()
|
||||
|
||||
if field:
|
||||
print "</field> "
|
||||
|
||||
def dump_html( self ):
|
||||
|
||||
n = len( self.items )
|
||||
in_table = 0
|
||||
|
||||
for i in range( n ):
|
||||
item = self.items[i]
|
||||
field = item[0]
|
||||
|
||||
if not field:
|
||||
|
||||
if in_table:
|
||||
print "</td></tr></table>"
|
||||
in_table = 0
|
||||
|
||||
for element in item[1]:
|
||||
element.dump_html()
|
||||
else:
|
||||
if not in_table:
|
||||
print "<table cellpadding=4><tr valign=top><td>"
|
||||
in_table = 1
|
||||
else:
|
||||
print "</td></tr><tr valign=top><td>"
|
||||
|
||||
print "<b>" + field + "</b></td><td>"
|
||||
|
||||
for element in item[1]:
|
||||
element.dump_html()
|
||||
|
||||
if in_table:
|
||||
print "</td></tr></table>"
|
||||
|
||||
|
||||
######################################################################################
|
||||
#
|
||||
#
|
||||
# The DocBlock class is used to store a given comment block. It contains
|
||||
# a list of markers, as well as a list of contents for each marker.
|
||||
#
|
||||
# "self.items" is a list of ( marker, contents ) elements, where
|
||||
# 'marker' is a lowercase marker string, and 'contents' is a DocContent
|
||||
# object
|
||||
#
|
||||
# "self.source" is simply a list of text lines taken from the
|
||||
# uncommented source itself..
|
||||
#
|
||||
# finally, "self.identifier" is a simple identifier used to
|
||||
# uniquely identify the block
|
||||
#
|
||||
class DocBlock:
|
||||
|
||||
def __init__( self, block_line_list = [], source_line_list = [] ):
|
||||
self.items = [] # current ( marker, contents ) list
|
||||
self.identifier = None
|
||||
marker = None # current marker
|
||||
content = [] # current content lines list
|
||||
alphanum = string.letters + string.digits + "_"
|
||||
|
||||
for line in block_line_list:
|
||||
line2 = string.lstrip( line )
|
||||
l = len( line2 )
|
||||
margin = len( line ) - l
|
||||
|
||||
if l > 3:
|
||||
ender = None
|
||||
if line2[0] == '<':
|
||||
ender = '>'
|
||||
elif line2[0] == '@':
|
||||
ender = ':'
|
||||
|
||||
if ender:
|
||||
i = 1
|
||||
while i < l and line2[i] in alphanum:
|
||||
i = i + 1
|
||||
if i < l and line2[i] == ender:
|
||||
if marker and content:
|
||||
self.add( marker, content )
|
||||
marker = line2[1 : i]
|
||||
content = []
|
||||
line2 = string.lstrip( line2[i + 1 :] )
|
||||
l = len( line2 )
|
||||
line = " " * margin + line2
|
||||
|
||||
content.append( line )
|
||||
|
||||
if marker and content:
|
||||
self.add( marker, content )
|
||||
|
||||
self.source = []
|
||||
if self.items:
|
||||
self.source = source_line_list
|
||||
|
||||
|
||||
# this function is used to add a new element to self.items
|
||||
# 'marker' is a marker string, or None
|
||||
# 'lines' is a list of text lines used to compute a list of
|
||||
# DocContent objects
|
||||
#
|
||||
def add( self, marker, lines ):
|
||||
|
||||
# remove the first and last empty lines from the content list
|
||||
l = len( lines )
|
||||
if l > 0:
|
||||
i = 0
|
||||
while l > 0 and string.strip( lines[l - 1] ) == "":
|
||||
l = l - 1
|
||||
while i < l and string.strip( lines[i] ) == "":
|
||||
i = i + 1
|
||||
lines = lines[i : l]
|
||||
l = len( lines )
|
||||
|
||||
# add a new marker only if its marker and its content list aren't empty
|
||||
if l > 0 and marker:
|
||||
content = DocContent(lines)
|
||||
self.items.append( ( string.lower(marker), content ) )
|
||||
if not self.identifier:
|
||||
self.identifier = content.get_identifier()
|
||||
|
||||
|
||||
|
||||
def dump( self ):
|
||||
for i in range( len( self.items ) ):
|
||||
print "[" + self.items[i][0] + "]"
|
||||
content = self.items[i][1]
|
||||
content.dump()
|
||||
|
||||
def dump_html( self ):
|
||||
|
||||
types = [ 'type', 'struct', 'functype', 'function', 'constant',
|
||||
'enum', 'macro' ]
|
||||
|
||||
if not self.items:
|
||||
return
|
||||
|
||||
# start of a block
|
||||
print block_header
|
||||
|
||||
print "<h2>" + self.identifier + "</h2>"
|
||||
|
||||
# print source code
|
||||
if not self.source:
|
||||
return
|
||||
|
||||
lines = self.source
|
||||
l = len( lines ) - 1
|
||||
while l >= 0 and string.strip( lines[l] ) == "":
|
||||
l = l - 1
|
||||
print source_header
|
||||
for line in lines[0 : l + 1]:
|
||||
print line
|
||||
print source_footer
|
||||
|
||||
# dump each (marker,content) element
|
||||
for element in self.items:
|
||||
|
||||
marker = element[0]
|
||||
content = element[1]
|
||||
|
||||
if marker == "description":
|
||||
print "<ul>"
|
||||
content.dump_html()
|
||||
print "</ul>"
|
||||
|
||||
elif not (marker in types):
|
||||
print "<h4>" + marker + "</h4>"
|
||||
print "<ul>"
|
||||
content.dump_html()
|
||||
print "</ul>"
|
||||
|
||||
print ""
|
||||
|
||||
print block_footer
|
||||
|
||||
|
||||
# filter a given list of DocBlocks. Returns a new list
|
||||
# of DocBlock objects that only contains element whose
|
||||
# "type" (i.e. first marker) is in the "types" parameter
|
||||
#
|
||||
def filter_blocks( block_list, types ):
|
||||
|
||||
new_list = []
|
||||
for block in block_list:
|
||||
if block.items:
|
||||
element = block.items[0]
|
||||
marker = element[0]
|
||||
if marker in types:
|
||||
new_list.append( block )
|
||||
|
||||
return new_list
|
||||
|
||||
|
||||
# perform a lexicographical comparison of two DocBlock
|
||||
# objects. Returns -1, 0 or 1
|
||||
#
|
||||
def block_lexicographical_compare( b1, b2 ):
|
||||
if not b1.identifier:
|
||||
return -1
|
||||
if not b2.identifier:
|
||||
return 1
|
||||
|
||||
id1 = string.lower(b1.identifier)
|
||||
id2 = string.lower(b2.identifier)
|
||||
if id1 < id2:
|
||||
return -1
|
||||
elif id1 == id2:
|
||||
return 0
|
||||
else:
|
||||
return 1
|
||||
|
||||
|
||||
def block_make_list( source_block_list ):
|
||||
list = []
|
||||
|
||||
for block in source_block_list:
|
||||
docblock = DocBlock( block[0], block[1] )
|
||||
list.append( docblock )
|
||||
|
||||
return list
|
||||
|
||||
|
||||
# dump a list block as a single HTML page
|
||||
#
|
||||
def dump_html_1( block_list ):
|
||||
|
||||
print html_header
|
||||
|
||||
for block in block_list:
|
||||
block.dump_html()
|
||||
|
||||
print html_footer
|
||||
|
||||
|
||||
|
||||
|
||||
def make_block_list():
|
||||
"""parse a file and extract comments blocks from it"""
|
||||
|
||||
list = []
|
||||
block = []
|
||||
format = 0
|
||||
|
||||
# we use "format" to store the state of our parser:
|
||||
#
|
||||
# 0 - wait for beginning of comment
|
||||
# 1 - parse comment format 1
|
||||
# 2 - parse comment format 2
|
||||
#
|
||||
# 4 - wait for beginning of source (or comment ??)
|
||||
# 5 - process source
|
||||
#
|
||||
|
||||
comment = []
|
||||
source = []
|
||||
state = 0
|
||||
|
||||
for line in fileinput.input():
|
||||
|
||||
l = len( line )
|
||||
if l > 0 and line[l - 1] == '\012':
|
||||
line = line[0 : l - 1]
|
||||
|
||||
# stripped version of the line
|
||||
line2 = string.strip( line )
|
||||
l = len( line2 )
|
||||
|
||||
# if this line begins with a comment and we are processing some
|
||||
# source, exit to state 0
|
||||
#
|
||||
# unless we encounter something like:
|
||||
#
|
||||
# /*@.....
|
||||
# /*#.....
|
||||
#
|
||||
# /* @.....
|
||||
# /* #.....
|
||||
#
|
||||
if format >= 4 and l > 2 and line2[0 : 2] == '/*':
|
||||
if l < 4 or ( line2[3] != '@' and line2[3:4] != ' @' and
|
||||
line2[3] != '#' and line2[3:4] != ' #'):
|
||||
list.append( ( block, source ) )
|
||||
format = 0
|
||||
|
||||
if format == 0: #### wait for beginning of comment ####
|
||||
|
||||
if l > 3 and line2[0 : 3] == '/**':
|
||||
i = 3
|
||||
while i < l and line2[i] == '*':
|
||||
i = i + 1
|
||||
|
||||
if i == l:
|
||||
# this is '/**' followed by any number of '*', the
|
||||
# beginning of a Format 1 block
|
||||
#
|
||||
block = []
|
||||
source = []
|
||||
format = 1
|
||||
|
||||
elif i == l - 1 and line2[i] == '/':
|
||||
# this is '/**' followed by any number of '*', followed
|
||||
# by a '/', i.e. the beginning of a Format 2 or 3 block
|
||||
#
|
||||
block = []
|
||||
source = []
|
||||
format = 2
|
||||
|
||||
##############################################################
|
||||
#
|
||||
# FORMAT 1
|
||||
#
|
||||
elif format == 1:
|
||||
|
||||
# if the line doesn't begin with a "*", something went
|
||||
# wrong, and we must exit, and forget the current block..
|
||||
if l == 0 or line2[0] != '*':
|
||||
block = []
|
||||
format = 0
|
||||
|
||||
# otherwise, we test for an end of block, which is an
|
||||
# arbitrary number of '*', followed by '/'
|
||||
else:
|
||||
i = 1
|
||||
while i < l and line2[i] == '*':
|
||||
i = i + 1
|
||||
|
||||
# test for the end of the block
|
||||
if i < l and line2[i] == '/':
|
||||
if block != []:
|
||||
format = 4
|
||||
else:
|
||||
format = 0
|
||||
else:
|
||||
# otherwise simply append line to current block
|
||||
block.append( line2[i:] )
|
||||
|
||||
continue
|
||||
|
||||
##############################################################
|
||||
#
|
||||
# FORMAT 2
|
||||
#
|
||||
elif format == 2:
|
||||
|
||||
# if the line doesn't begin with '/*' and end with '*/',
|
||||
# this is the end of the format 2 format
|
||||
if l < 4 or line2[: 2] != '/*' or line2[-2 :] != '*/':
|
||||
if block != []:
|
||||
format = 4
|
||||
else:
|
||||
format = 0
|
||||
else:
|
||||
# remove the start and end comment delimiters, then
|
||||
# right-strip the line
|
||||
line2 = string.rstrip( line2[2 : -2] )
|
||||
|
||||
# check for end of a format2 block, i.e. a run of '*'
|
||||
if string.count( line2, '*' ) == l - 4:
|
||||
if block != []:
|
||||
format = 4
|
||||
else:
|
||||
format = 0
|
||||
else:
|
||||
# otherwise, add the line to the current block
|
||||
block.append( line2 )
|
||||
|
||||
continue
|
||||
|
||||
|
||||
|
||||
if format >= 4: #### source processing ####
|
||||
|
||||
if l > 0:
|
||||
format = 5
|
||||
|
||||
if format == 5:
|
||||
source.append( line )
|
||||
|
||||
|
||||
if format >= 4:
|
||||
list.append( [block, source] )
|
||||
|
||||
return list
|
||||
|
||||
|
||||
|
||||
# This function is only used for debugging
|
||||
#
|
||||
def dump_block_list( list ):
|
||||
"""dump a comment block list"""
|
||||
for block in list:
|
||||
print "----------------------------------------"
|
||||
for line in block[0]:
|
||||
print line
|
||||
for line in block[1]:
|
||||
print line
|
||||
|
||||
print "---------the end-----------------------"
|
||||
|
||||
|
||||
|
||||
def main( argv ):
|
||||
"""main program loop"""
|
||||
sys.stderr.write( "extracting comment blocks from sources...\n" )
|
||||
list = make_block_list()
|
||||
list = block_make_list(list)
|
||||
|
||||
list2 = filter_blocks( list, ['type','macro','enum','constant', 'functype'] )
|
||||
#list2 = list
|
||||
list2.sort( block_lexicographical_compare )
|
||||
|
||||
dump_html_1( list2 )
|
||||
#dump_doc_blocks( list )
|
||||
#dump_block_lists( list )
|
||||
#dump_html_1( list )
|
||||
|
||||
|
||||
# If called from the command line
|
||||
if __name__ == '__main__':
|
||||
main( sys.argv )
|
||||
|
||||
|
||||
# eof
|
||||
@@ -0,0 +1,352 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>FreeType 2 Introduction</title>
|
||||
<basefont face="Georgia, Arial, Helvetica, Geneva">
|
||||
<style content="text/css">
|
||||
P { text-align=justify }
|
||||
H1 { text-align=center }
|
||||
H2 { text-align=center }
|
||||
LI { text-align=justify }
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body text="#000000"
|
||||
bgcolor="#FFFFFF"
|
||||
link="#0000EF"
|
||||
vlink="#51188E"
|
||||
alink="#FF0000">
|
||||
|
||||
|
||||
<font size=1>http://www.freetype.org</font><p>
|
||||
|
||||
<center>
|
||||
<a href="freetype.html">
|
||||
<img src="image/freetype.jpg" width=550 height=105 alt="The FreeType Project" border=0></a>
|
||||
<h1>An Introduction to FreeType 2</h1>
|
||||
</center>
|
||||
|
||||
<center><table width=750 cellspacing=10 cellpadding=30><tr><td>
|
||||
<hr><p>
|
||||
|
||||
DOCUMENT INDEX:<br>
|
||||
<ul>
|
||||
<li><a href="#what">What is FreeType 2 ?</a>
|
||||
<li><a href="#features">Features</a>
|
||||
<li><a href="#requirements">Requirements</a>
|
||||
<li><a href="#patents">Patents issues</a>
|
||||
</ul><p>
|
||||
|
||||
|
||||
<hr><p>
|
||||
|
||||
<table width="100%" cellspacing=5><tr bgcolor="#CCCCEE"><td>
|
||||
<h2 align=center><a name="what">What is FreeType 2 ?</h2>
|
||||
</td></tr><tr><td>
|
||||
|
||||
<p>The FreeType project is a team of volunteers who develop free, portable
|
||||
and high-quality software solutions for digital typography. We specifically
|
||||
target embedded systems and focus on bringing small, efficient and
|
||||
ubiquitous products.</p>
|
||||
|
||||
<p>the FreeType 2 library is our new software font engine. It has been
|
||||
designed to provide the following important features:</p>
|
||||
|
||||
<ul>
|
||||
<li><p>
|
||||
<b>A universal and simple API to manage font files:</b><br>
|
||||
<ul>
|
||||
<p>The FreeType 2 API is simple and easy to use. It supports both
|
||||
bitmapped and scalable fonts and is well-suited to manage font
|
||||
files of all formats. Unlike other font libraries, FreeType 2
|
||||
returns and manages outline font data (images & metrics).</p>
|
||||
</ul>
|
||||
</p></li>
|
||||
|
||||
<li><p>
|
||||
<b>Support for several font formats through loadable modules:</b><br>
|
||||
<ul>
|
||||
<p>FreeType 2 uses <em>"font drivers"</em>. Each driver is a loadable
|
||||
module used to support one specific font format. Each driver can also
|
||||
provide specific extensions used to access format-specific features of
|
||||
the font.</p>
|
||||
</ul>
|
||||
</p></li>
|
||||
|
||||
|
||||
<li><p>
|
||||
<b>High-quality anti-aliasing:</b><br>
|
||||
<ul>
|
||||
<p>FreeType 2 produces etremely smooth outlines at small sizes, with its new
|
||||
anti-aliasing renderer, which produces bitmaps with 256-levels of gray.
|
||||
It uses a new algorithm that has been specifically designed to render
|
||||
small complex shapes (like glyphs) at high speed. Indeed, it's even
|
||||
faster than the monochrome renderer for small character sizes (under
|
||||
20 pixels) !!
|
||||
</p>
|
||||
</ul>
|
||||
|
||||
|
||||
<li><b>High portability & performance:</b><br>
|
||||
<ul>
|
||||
<p>The FreeType 2 source code is written in ANSI C and runs on any
|
||||
platform with a compliant compiler. Client applications can
|
||||
provide their own memory manager or input stream to the library
|
||||
(which means that font files can come from any place: disk,
|
||||
memory, compressed file, network, etc..).
|
||||
</p>
|
||||
</ul>
|
||||
|
||||
</ul>
|
||||
|
||||
<p>Note that <em>the beta of FreeType 2 is available <b>now</b></em>. For more
|
||||
info, check our <a href="download.html">Download page</a> or see the source
|
||||
and its diffs through our <a href="cgi-bin/cvsweb.cgi">CVS Web interface</a>.
|
||||
</p>
|
||||
</ul>
|
||||
|
||||
</td></tr></table>
|
||||
|
||||
<table width="100%" cellspacing=5><tr bgcolor="#CCCCEE"><td>
|
||||
<h2 align=center><a name="features">Features</h2>
|
||||
</td></tr><tr><td>
|
||||
|
||||
<h3>Supported font formats</h3>
|
||||
|
||||
<p>FreeType 2 readily supports the following font formats:</p>
|
||||
|
||||
<ul>
|
||||
<li>TrueType files (.ttf) and collections (.ttc)</li>
|
||||
<li>Type 1 font files both in ASCII (.pfa) or binary (.pfb) format</li>
|
||||
<li>Type 1 Multiple Master fonts. The FreeType 2 API also provides
|
||||
routines to manage design instances easily</li>
|
||||
<li>Type 1 CID-keyed fonts</li>
|
||||
<li>OpenType/CFF (.otf) fonts</li>
|
||||
<li>CFF/Type 2 fonts</li>
|
||||
<li>Adobe CEF fonts (.cef), used to embed fonts in SVG documents
|
||||
with the Adobe SVG viewer plugin.</li>
|
||||
<li>Windows FNT/FON bitmap fonts</li>
|
||||
</ul>
|
||||
|
||||
<p>Note that Apple's TrueType GX fonts are supported as normal TTFs,
|
||||
(the advanced tables are ignored).</p>
|
||||
|
||||
<p>Besides, it's possible to add support for new font formats by providing
|
||||
a specific <em>font driver</em> module. Modules can be added either at
|
||||
build time (when recompiling the library), or at <em>run-time</em>;
|
||||
this allows, for example, applications to register their own
|
||||
font driver to support program-specific formats.</p>
|
||||
|
||||
|
||||
<h3>Patent-free automatic hinter</h3>
|
||||
|
||||
<p>TrueType fonts are normally renderered (hinted) with the help of a
|
||||
specific bytecode where the behaviour of a few opcodes is patented by
|
||||
Apple. We're currently in contact with Apple to discuss the importance
|
||||
of such patents and their use in open source projects like FreeType.
|
||||
</p>
|
||||
|
||||
<p>In the meantime, we have developped our own alternative technology that
|
||||
is capable of automatically hinting scalable glyph images. It is
|
||||
now part of the FreeType 2 source tree as the "autohint" module,
|
||||
and is used to hint glyphs when the bytecode interpreter is disabled
|
||||
(through a configuration macro when building the engine). Note that
|
||||
the auto-hinter is also used to handle glyphs in other formats like
|
||||
CFF and Type 1.</p>
|
||||
|
||||
<p>The auto-hinter provides pretty good results (in some cases, it even
|
||||
significantly improves the output of poorly hinted fonts) but we'll
|
||||
continue to improve it with each new release of FreeType to achieve
|
||||
the highest possible quality.</p>
|
||||
|
||||
|
||||
<h3>Modular design:</h3>
|
||||
|
||||
<p>The design of FreeType 2 is extremely modular as most features are
|
||||
supported through optional modules. This means it's easily possible to
|
||||
only compile the features you need. As each module is between
|
||||
10 and 20 Kb in size, it's possible to build a bare-bones
|
||||
font engine that supports anti-aliasing in about 30 Kb !!</p>
|
||||
|
||||
<p>Configuration is performed by modifications of only two header
|
||||
files (one to select global features, another one to select modules)
|
||||
and don't need tweaking of source code. Note that it is however
|
||||
possible to provide your own implementation of certain components.</p>
|
||||
|
||||
<p>For example, when building on Unix, the engine will automatically
|
||||
use memory-mapped files when available on the target platform,
|
||||
thus significantly increasing font file i/o.</p>
|
||||
|
||||
|
||||
<p>Due to its very flexible design, it is possible to add, remove and
|
||||
upgrade modules at run-time.</p>
|
||||
|
||||
|
||||
|
||||
<h3>Advanced glyph management</h3>
|
||||
|
||||
<p>The API comes with a standard extension used to extract individual
|
||||
glyph images from font files. These images can be bitmaps, scalable
|
||||
bezier outlines or even anything else. (e.g. bi-color or metafont
|
||||
glyphs, as long as they're supported by a module).</p>
|
||||
|
||||
<p>Each scalable glyph image can be transformed, measured and
|
||||
rendered into a monochrome or anti-aliased bitmaps easily
|
||||
through a uniform interface.
|
||||
|
||||
This allows client applications to easily cache glyphs or
|
||||
perform text rendering effects with minimal difficulty
|
||||
(look at the FreeType 2 Tutorial to see how to render
|
||||
rotated text with very few lines of code).
|
||||
</p>
|
||||
|
||||
|
||||
|
||||
<h3>Advanced font access</h3>
|
||||
|
||||
<p>The FreeType 2 API is useful to retrieve advanced information from
|
||||
various fonts:</p>
|
||||
|
||||
<ul>
|
||||
<li>vertical metrics are available whenever found in the font file</li>
|
||||
|
||||
<li>kerning distances are available when found in the font file. It
|
||||
is also possible to "attach" a given additional file to a given
|
||||
font face. This is useful to load kerning distances from an
|
||||
.afm file into a Type 1 face for example.</li>
|
||||
|
||||
<li>provides ASCII glyph names whenever available in the font
|
||||
(TrueType, OpenType, Type1, etc..)</li>
|
||||
|
||||
<li>provides access to important tables for SFNT-based font formats
|
||||
(i.e. TrueType, OpenType, CEF, etc..), like the name table,
|
||||
font header, maximum profile, etc...</li>
|
||||
|
||||
<li>automatic synthesis of Unicode-based character maps for
|
||||
those fonts or formats that do not provide one. This is
|
||||
extremely useful with Type 1 fonts which are normally
|
||||
limited to a stupid 256-characters encoding.</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h3>Simple & clean API</h3>
|
||||
|
||||
<p>The FreeType 2 high-level API is simple and straightforward, as it
|
||||
has been specifically designed to make the most commmon font operations
|
||||
easy</p>
|
||||
|
||||
<p>As a comparison, the number of function calls needed to perform a
|
||||
the tasks of font face creation/opening and glyph loading/rendering
|
||||
has been reduced by a factor of 4 !!</p>
|
||||
|
||||
<p>The API is also independent of any font-format specific issue, though
|
||||
it provides standard extensions to access format-specific tables and
|
||||
information. More extensions can also be easily added through new
|
||||
modules</p>
|
||||
|
||||
|
||||
<h3>Robust & Portable code</h3>
|
||||
|
||||
<p>Because it is written in industry-standard ANSI C, FreeType 2 compiles
|
||||
on all platforms with a compliant compiler. Because the default build
|
||||
only relies on the C library, it is free of any system-specific
|
||||
dependencies, even if it is possible to "enhance" certain components
|
||||
by providing a specific implementation.</p>
|
||||
|
||||
<p>The code doesn't use global or static variables. Client applications
|
||||
can provide their own memory manager. Font files can be read from
|
||||
a disk file, memory, or through a client-provided input stream. This
|
||||
allows to support compressed font files, remote fonts, fonts embedded
|
||||
in other streams (e.g. Type42 fonts), etc..</p>
|
||||
|
||||
<p>An advanced i/o sub-system is used to optimise file access, as well
|
||||
as reduce memory usage of the library when the file is memory-based
|
||||
( ROM, RAM, memory-mapped ).</p>
|
||||
|
||||
|
||||
<h3>Open Source & Vendor Independence</h3>
|
||||
|
||||
<p>Finally, FreeType 2 is released under its own BSD-like open source
|
||||
license, one of the less restricting licenses available, and this
|
||||
means that:</p>
|
||||
|
||||
<ul>
|
||||
<li><p>
|
||||
It can be included in all kinds of products, be they proprietary
|
||||
or not.
|
||||
</p></li>
|
||||
|
||||
<li><p>
|
||||
As any module can be added or replaced anytime, any third party
|
||||
vendor has the ability to provide its own set of modules (under
|
||||
its own license) in order to support proprietary font formats or
|
||||
more advanced features (e.g. a new auto-hinter, or a new
|
||||
anti-aliasing renderer for LCDs or TV screens).
|
||||
</p></li>
|
||||
</ul>
|
||||
|
||||
<p>One could even imagine an application using the FreeType 2 API with
|
||||
a "wrapper" module used to access system-specific fonts (like through
|
||||
the Windows GDI). This would mean native font support with more portable
|
||||
application code (as simply changing the wrapper module would be required
|
||||
to port the application to another system).</p>
|
||||
|
||||
</td></tr></table>
|
||||
|
||||
<table width="100%" cellspacing=5><tr bgcolor="#CCCCEE"><td>
|
||||
<h2 align=center><a name="requirements">Requirements</h2>
|
||||
</td></tr><tr><td>
|
||||
|
||||
<p>FreeType 2 is written in ANSI C and should compile with no problems
|
||||
on a great variety of platforms. We have taken care of removing all
|
||||
compilation warnings from major compliant compilers. Detailed compilation
|
||||
instructions are provided in the software archive.</p>
|
||||
|
||||
<p>This version of the library has been succesfully compiled and run
|
||||
under the following systems: Dos, OS/2, Windows, Macintosh, Unix
|
||||
(including the 64-bits DEC Unix, a.k.a. "True64"). You should not
|
||||
encounter major problems compiling it on any other kind of platform.
|
||||
In all cases, contact us if you do.</p>
|
||||
|
||||
<p>Note that a small set of demonstration programs is also separately
|
||||
available. They include a tiny graphics sub-system that is used to
|
||||
display and show-off the library's capabilities on the following
|
||||
platforms: X11, MacOS, OS/2 & Windows.</p>
|
||||
|
||||
<p>Please visit our <a href="http://www.freetype.org/download.html">
|
||||
Download section</a> to access the software archives.</p>
|
||||
|
||||
</ul>
|
||||
|
||||
</td></tr></table>
|
||||
|
||||
<table width="100%" cellspacing=5><tr bgcolor="#CCCCEE"><td>
|
||||
<h2 align=center><a name="patents">Patents issues</h2>
|
||||
</td></tr><tr><td>
|
||||
|
||||
<p>The FreeType 2 source code includes a TrueType bytecode interpreter that
|
||||
is covered by the Apple patents. However, this piece of code is never
|
||||
compiled by default in this release (unlike in previous betas) making
|
||||
a default build of the library <em>entirely patent-free !!</em></p>
|
||||
|
||||
<p>Note that in order to compile the interpreter, one needs to define
|
||||
the configuration macro <tt><b>TT_CONFIG_OPTION_BYTECODE_INTERPRETER</b></tt> configuration
|
||||
macro in the file "<tt>ftoption.h</tt>". More details are available in
|
||||
the software archive. Note that the use of the interpreter is normally
|
||||
protected by US, UK and French patents. In the event you'd absolutely
|
||||
need it, you may have to <a href="mailto:[email protected]">contact
|
||||
Apple legal department</a> for licensing conditions, depending on your
|
||||
location and the places you distribute/sell your products.</p>
|
||||
|
||||
<p>Please do not ask us any detailed information regarding licensing, as
|
||||
we're still discussing with Apple this issue, we're unable to inform
|
||||
the public of what's currently going on..</p>
|
||||
|
||||
</td></tr></table>
|
||||
|
||||
<hr>
|
||||
<p>
|
||||
<a href="index.html">Back to FreeType homepage</a><p>
|
||||
|
||||
</td></tr></table>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,729 @@
|
||||
<!doctype html public "-//w3c//dtd html 4.0 transitional//en"
|
||||
"http://www.w3.org/TR/REC-html40/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type"
|
||||
content="text/html; charset=iso-8859-1">
|
||||
<meta name="Author"
|
||||
content="David Turner">
|
||||
<title>FreeType 2 FAQ</title>
|
||||
</head>
|
||||
|
||||
<body text="#000000"
|
||||
bgcolor="#FFFFFF"
|
||||
link="#0000EF"
|
||||
vlink="#51188E"
|
||||
alink="#FF0000">
|
||||
|
||||
|
||||
<font size=1>http://www.freetype.org</font><p>
|
||||
|
||||
<h1 align=center>
|
||||
<a href="freetype.html">
|
||||
<img src="image/freetype.jpg"
|
||||
width=550 height=105
|
||||
alt="The FreeType Project"
|
||||
border=0></a>
|
||||
<h1>The FreeType 2 FAQ</h1>
|
||||
</h1>
|
||||
|
||||
<center>
|
||||
<table width="75%">
|
||||
<tr><td>
|
||||
|
||||
<hr><p>
|
||||
|
||||
Document index
|
||||
|
||||
<ul>
|
||||
<li><a href="#general">General</a>
|
||||
<ul><p>
|
||||
<li>
|
||||
<a href="#general-dead">I thought the FreeType project was dead.
|
||||
Is this true?</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#general-long">Why did it take so long to release
|
||||
FreeType 2?</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#general-unix">Is FreeType 2 a Unix-only
|
||||
project?</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#general-x11">When will X11 support anti-aliased
|
||||
glyphs?</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#general-ft1">Is FreeType 2 backwards compatible
|
||||
to FreeType 1.x?</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#general-edit">Can I use FreeType 2 to edit fonts
|
||||
or create new ones?</a>
|
||||
</li>
|
||||
</p></ul>
|
||||
</li>
|
||||
<li><a href="#builds">Compilation & Configuration</a>
|
||||
<ul><p>
|
||||
<li>
|
||||
<a href="#builds-compile">How do I compile the FreeType 2
|
||||
library?</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#builds-config">How do I configure my library build?</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#builds-modules">How do I select the modules I need?</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#builds-flat">How do I compile all FreeType 2 files
|
||||
in a single directory?</a>
|
||||
</li>
|
||||
</p></ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#autohint">The FreeType 2 autohinter</a>
|
||||
<ul><p>
|
||||
<li>
|
||||
<a href="#autohint-license">Under which license is the auto-hinter
|
||||
released?</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#autohint-work">How does auto-hinting work in
|
||||
FreeType 2?</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#autohint-cjk">Why doesn't the auto-hinter work well
|
||||
with CJK fonts?</a>
|
||||
</li>
|
||||
</p></ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#other">Other questions</a>
|
||||
<ul><p>
|
||||
<li>
|
||||
<a href="#other-color">How can I set the color of text rendered
|
||||
by FreeType?</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#other-depth">Can I use FreeType to draw text on a pixmap
|
||||
with arbitrary depth?</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#other-size">I set the pixel size to 8x8, but the
|
||||
resulting glyphs are larger than that. Why?</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#other-bbox">How can I compute the bounding box of a text
|
||||
string without loading its glyphs?</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#other-antialias">Which anti-aliasing algorithm is
|
||||
used in the FreeType 2 renderer?</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#other-opentype">When will FreeType 2 support
|
||||
OpenType?</a>
|
||||
</li>
|
||||
</p></ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p><hr></p>
|
||||
|
||||
<table width="100%">
|
||||
<tr bgcolor="#CCCCEE"><td>
|
||||
<h2 align=center>
|
||||
<a name="general">General questions & answers
|
||||
</h2>
|
||||
</td></tr>
|
||||
<tr><td>
|
||||
|
||||
<a name="general-dead">
|
||||
<h3>
|
||||
I.1 I though the FreeType project was dead. Is this true?
|
||||
</h3>
|
||||
|
||||
<p>Well, not exactly :-) It's true that the TrueType patents
|
||||
issues have been less than a graceful event to handle but it didn't not
|
||||
really killed the project per se, as Apple hasn't made an official
|
||||
statement yet regarding the use of the patented "technology" in open
|
||||
source projects (or other products).</p>
|
||||
|
||||
<p>We have thus continued updating FreeType 1.x, and started
|
||||
developing FreeType 2 with the idea of providing this time a
|
||||
completely patent free font engine. However, we largely preferred not
|
||||
to broadly communicate about it until we've got a satisfying
|
||||
implementation to show.</p>
|
||||
|
||||
<hr>
|
||||
<a name="general-long">
|
||||
<h3>
|
||||
I.2 Why did it take so long to release FreeType 2?
|
||||
</h3>
|
||||
|
||||
<p>Several factors come to mind. The first one is that FreeType 2
|
||||
is a much more complex and dense project that was mostly developed
|
||||
during non-working hours. And surely some important changes in the life
|
||||
(like marriage, new jobs and kids) of some the FreeType developers
|
||||
cannot be ignored :-)</p>
|
||||
|
||||
<p>A second one is that a first version of the library was designed one
|
||||
year ago (and already worked with a multitude of font drivers), though
|
||||
with a design that was judged by its authors as well as beta testers as
|
||||
not enough flexible or consistent. In short, it worked well but we were
|
||||
not exactly proud of it (call us perfectionists). It has then be
|
||||
significantly reworked to become what we are now distributing as
|
||||
FreeType 2</p>
|
||||
|
||||
<p>Finally, it would have been hard to distribute such a library without
|
||||
an alternative technology to replace the patented bytecode interpreter.
|
||||
This involved significant research work that could only be performed
|
||||
correctly full-time, and we had to found a company to fund such a
|
||||
development and still make it available under a BSD-like license. Huge
|
||||
thanks to <a href="http://www.catharon.com">Catharon Productions,
|
||||
Inc.</a> for their commitment to this project.</p>
|
||||
|
||||
<p>And of course, we added support for more font files, and we will
|
||||
continue to as long as the specifications are available and that we find
|
||||
an interest in it. For example, FreeType 2 is to date the only
|
||||
software library available on the market that supports the new Adobe
|
||||
"CEF" font format.</p>
|
||||
|
||||
<hr>
|
||||
<a name="general-unix">
|
||||
<h3>
|
||||
I.3 Is FreeType 2 a Unix-only project?
|
||||
</h3>
|
||||
|
||||
<p>Absolutely not, even though many people still seem to think
|
||||
so :-) FreeType 2, just like version 1.x, can be compiled
|
||||
on any platform with an ANSI compiler. Some beta versions of the
|
||||
library are even heavily used in brand new OSes (see the <a
|
||||
href="http://www.atheos.cx">AtheOS</a> screenshots for examples).</p>
|
||||
|
||||
<p>The library is itself mainly developed on several platforms (Windows
|
||||
& Linux, though a great deal has also been achieved on OS/2) and the
|
||||
code is highly generic and modular to adapt even the most strict
|
||||
environments like low-memory embedded systems.</p>
|
||||
|
||||
<hr>
|
||||
<a name="general-x11">
|
||||
<h3>
|
||||
I.4 When will X11/XFree support anti-aliased text?
|
||||
</h3>
|
||||
|
||||
<p>This question isn't exactly related to FreeType as we have no direct
|
||||
connection to the XFree people, but we have been asked so frequently
|
||||
about it that it deserves a prominent place in this FAQ :-)</p>
|
||||
|
||||
<p>FreeType has been capable of anti-aliasing since version 1.0.
|
||||
The reason why XFree doesn't support it is directly related to the
|
||||
limitations of the design and specification of X11. More
|
||||
specifically:</p>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
X11 assumes that all glyph images are monochrome bitmaps, hence the
|
||||
X font library and server are unable to send anything else to
|
||||
the X server.
|
||||
</li>
|
||||
<li>
|
||||
Even if the X font library/server was able to generate
|
||||
anti-aliased bitmaps (and this has been already done through
|
||||
extensions), the X rendering model doesn't allow translucent
|
||||
composition of "gray" pixmaps onto an arbitrary drawable.
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p>As both the font and rendering models of X11 are limited, it is
|
||||
basically impossible to draw anti-aliased glyphs without performing
|
||||
<em>huge</em> hacks within the server.</p>
|
||||
|
||||
<p>Note that Keith Packard, from XFree86 fame, has recently started
|
||||
working on a new rendering model for X11 in order to support new
|
||||
features (mainly transparency and anti-aliased fonts). This will be
|
||||
provided through protocol extensions. The question of knowing whether
|
||||
legacy X applications will be able to display anti-aliased text is still
|
||||
very uncertain.</p>
|
||||
|
||||
<hr>
|
||||
<a name="general-ft1">
|
||||
<h3>
|
||||
I.5 Is FreeType 2 backwards compatible with FreeType 1.x?
|
||||
</h3>
|
||||
|
||||
<p>Not directly, though we had the project to provide an optional binary
|
||||
compatibility layer on top of it in order to easily re-link applications
|
||||
with the new version. However, this idea has been dropped as it is
|
||||
possible to install and use the two versions independently on any system
|
||||
(read: no namespace conflicts).</p>
|
||||
|
||||
<p>The FreeType 2 API is a lot simpler than the one in 1.x
|
||||
while being much more powerful. We thus encourage you to adapt your
|
||||
source code to it as this should not involve much work.</p>
|
||||
|
||||
<hr>
|
||||
<a name="general-edit">
|
||||
<h3>
|
||||
I.6 Can I use FreeType 2 to edit fonts or create new ones?
|
||||
</h3>
|
||||
|
||||
<p>The answer is a definitive <b>no</b>, because the library was
|
||||
specifically designed to <em>read</em> font files with small code size
|
||||
and very low memory usage.</p>
|
||||
|
||||
<p>We thus do not plan to support editing or creation in the font engine
|
||||
in any way, as this would imply a complete rewrite. This doesn't mean
|
||||
that we won't introduce a font editing/creation library in the future,
|
||||
as this really depends on how many people are asking for it (or how much
|
||||
they would be willing to pay for it), as well as the time of the
|
||||
FreeType developers.</p>
|
||||
|
||||
<p>Do not expect anything in this direction until we officially announce
|
||||
something though. There are other axes of development for this project
|
||||
(like text-layout capabilities, glyph caching, etc.) that may be more
|
||||
important to us at the moment.</p>
|
||||
</td></tr>
|
||||
</table>
|
||||
|
||||
<br>
|
||||
|
||||
<table width="100%">
|
||||
<tr bgcolor="#CCCCEE"><td>
|
||||
<h2 align=center>
|
||||
<a name="builds">Compilation & Configuration
|
||||
</h2>
|
||||
</td></tr>
|
||||
<tr><td>
|
||||
|
||||
<a name="builds-compile">
|
||||
<h3>
|
||||
II.1 How do I compile the FreeType 2 library?
|
||||
</h3>
|
||||
|
||||
<p>The library can be compiled in various ways, and a detailed
|
||||
documentation is available in the file <tt>freetype2/docs/BUILD</tt>.
|
||||
However, we will summarize the process to a few cases:</p>
|
||||
|
||||
<h4>
|
||||
a. Using the command-line 2 build system
|
||||
</h4>
|
||||
|
||||
<p>The engine comes with a sophisticated build system that is used to
|
||||
configure and compile a build of the library. You will need <em>GNU
|
||||
Make</em> installed on your platform (<b>Note:</b> It will
|
||||
<em>not</em> work with other Make tools).</p>
|
||||
|
||||
<p>Basically, you will need to invoke <tt>make</tt> a first time in
|
||||
the top-level FreeType 2 directory in order to set up the build.
|
||||
This will detect your current platform and choose a configuration
|
||||
sub-makefile to drive the build. A specific compiler can be selected
|
||||
on some platforms by providing an additional target. For example, on
|
||||
Win32:</p>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<b><tt>make visualc</tt></b> will select the Visual C++
|
||||
compiler
|
||||
</li>
|
||||
<li>
|
||||
<b><tt>make lcc</tt></b> will select the Win32-lcc compiler
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p>Note that on Unix, when the first time make is called, a configure
|
||||
script located in <tt>freetype2/builds/unix</tt> will be run in order
|
||||
to automatically detect the platform & compiler.</p>
|
||||
|
||||
<p>A summary will be displayed showing the detected platform and
|
||||
compiler selected. You will then be able to start the build by
|
||||
invoking <tt>make</tt> a second time. In case of problem, consult the
|
||||
<tt>BUILD</tt> document.</p>
|
||||
|
||||
<h4>
|
||||
b. Direct compilation
|
||||
</h4>
|
||||
|
||||
<p>You can also directly compile the library from the command line by
|
||||
using these simple rules:</p>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
You should place the directories <tt>freetype2/include</tt> and
|
||||
<tt>freetype2/src</tt> in your include path in order to compile
|
||||
any component of the library. You can also add the
|
||||
system-specific build directory (i.e.
|
||||
<tt>builds/<em>system</em>/</tt>) in the case where an alternate
|
||||
implementation of some of the components is available there (e.g.
|
||||
the memory-mapped i/o implementation on some Unix systems).
|
||||
</li>
|
||||
<li>
|
||||
The components of the library are located in sub-directories of
|
||||
<tt>src</tt>, for example: <tt>src/base</tt>,
|
||||
<tt>src/truetype</tt>, etc.
|
||||
</li>
|
||||
<li>
|
||||
Each component is normally compiled through a single C file that
|
||||
<em>wraps</em> other sources in the component's directory. For
|
||||
example, you should build the TrueType font driver by compiling
|
||||
the file <tt>src/truetype/truetype.c</tt>. The list of
|
||||
C files to compile for a feature-complete build of the
|
||||
library is given in the <tt>BUILD</tt> document.
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h4>
|
||||
c. Using a graphical IDE
|
||||
</h4>
|
||||
|
||||
<p>Well, the process is vastly similar to the one described in b.,
|
||||
except that you need to set the include paths, source code paths, etc.
|
||||
in dialog boxes before running the compilation.</p>
|
||||
|
||||
<hr>
|
||||
<a name="builds-config">
|
||||
<h3>
|
||||
II.2 How do I configure my build of the library?
|
||||
</h3>
|
||||
|
||||
<p>Each build of the library is configured through two header files
|
||||
located in <tt>include/freetype/config</tt>:</p>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<tt>ftoption.h</tt>
|
||||
<br>
|
||||
This file contains various configuration macros whose definition can
|
||||
be toggled on a per-build basis. Each macro is heavily commented in
|
||||
this file's comment, and we invite you to refer to it directly.
|
||||
</li>
|
||||
<li>
|
||||
<tt>ftmodule.h</tt>
|
||||
<br>
|
||||
This file contains the list of all the modules that are initially
|
||||
registered (added) when the function <tt>FT_Init_FreeType()</tt> is
|
||||
called. See the next answer to know how to change it and why it may
|
||||
be important.
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p>Alternatively, some specific implementations of some FreeType 2
|
||||
components can be provided in a <tt>builds/<em>system</em>/</tt>
|
||||
directory (e.g. the Unix-specific <tt>ftsystem.c</tt> that uses
|
||||
memory-mapped file for i/o).</p>
|
||||
|
||||
<hr>
|
||||
<a name="builds-modules">
|
||||
<h3>
|
||||
II.3 How do I select the modules I need in my build?
|
||||
</h3>
|
||||
|
||||
<p>The function <tt>FT_Init_FreeType()</tt> creates a new instance of
|
||||
the FreeType 2 library and registers a set of "default" modules
|
||||
before returning to the calling application. Its default implementation
|
||||
is in the file <tt>src/base/ftinit.c</tt>.</p>
|
||||
|
||||
<p>The list of default modules used by <tt>ftinit.c</tt> is located in
|
||||
the configuration file <tt>include/freetype/config/ftmodule.h</tt>.
|
||||
Normally, it is automatically generated by the build system by invoking
|
||||
the "<tt><b>make modules</b></tt>" command in the top level
|
||||
FreeType 2 directory (Note: this only works with GNU Make; you can
|
||||
edit the file by hand otherwise). It does so by parsing all
|
||||
sub-directories of <tt>src</tt> that contain a file named
|
||||
<tt>module.mk</tt>.</p>
|
||||
|
||||
<p>Note that a specific port or project is free to provide its own
|
||||
implementation of <tt>ftinit.c</tt> in order to ensure a different
|
||||
initialization sequence. For example, one could do something like:</p>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
Compile each module as a shared library (DLL or <tt>.so</tt>) with a
|
||||
common "entry point" to retrieve a pointer to its module class
|
||||
(there is already some code that allows this when compiling each
|
||||
module).
|
||||
</li>
|
||||
<li>
|
||||
Place these modules in a directory like
|
||||
<tt>/usr/lib/freetype2/modules/</tt>.
|
||||
</li>
|
||||
<li>
|
||||
Provide an implementation of <tt>ftinit.c</tt> that would scan the
|
||||
directory for valid modules.
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p>This example only emphasizes the flexibility that is left to
|
||||
developers when building the library.</p>
|
||||
|
||||
<hr>
|
||||
<a name="builds-flat">
|
||||
<h3>
|
||||
II.4 How do I compile all FreeType 2 files in a single
|
||||
directory?
|
||||
</h3>
|
||||
|
||||
<p>Some projects may need, for the sake of simplicity or ease of
|
||||
building, to compile the FreeType 2 library with all source files
|
||||
copied to a single directory. This is possible.</p>
|
||||
|
||||
<p>To do so, you have to copy all source files located under
|
||||
<tt>src</tt> to your own directory (you must retain the include files in
|
||||
a distinct hierarchy though), then compile each of the FreeType 2
|
||||
component with the macro <tt>FT_FLAT_COMPILE</tt>. This will change the
|
||||
way <tt>#include</tt> works during the build.</p>
|
||||
|
||||
</td></tr>
|
||||
</table>
|
||||
|
||||
<br>
|
||||
|
||||
<table width="100%">
|
||||
<tr bgcolor="#CCCCEE"><td>
|
||||
<h2 align=center>
|
||||
<a name="autohint">The FreeType 2 auto-hinter
|
||||
</h2>
|
||||
</td></tr>
|
||||
<tr><td>
|
||||
|
||||
<a name="autohint-license">
|
||||
<h3>
|
||||
III.1 Under which license is the FreeType 2 auto-hinter released?
|
||||
</h3>
|
||||
|
||||
<p>The auto-hinter was initially designed and implemented under contract
|
||||
for <a href="http://www.catharon.com">Catharon Productions, Inc</a>
|
||||
which gladly accepted to released it under an open-source license
|
||||
compatible with the FreeType one.</p>
|
||||
|
||||
<p>This license can be found in
|
||||
<tt>src/autohint/CatharonLicense.txt</tt> and requires that you cite
|
||||
Catharon Productions in your documentation (just like you do with
|
||||
FreeType) when using the auto-hinting module.</p>
|
||||
|
||||
<p>Other than that, you still have the same freedom than with the good
|
||||
old FreeType license. Enjoy!</p>
|
||||
|
||||
<hr>
|
||||
<a name="autohint-work">
|
||||
<h3>
|
||||
III.2 How does the auto-hinter work?
|
||||
</h3>
|
||||
|
||||
<p>Well, a complete description would be difficult. Have a look at the
|
||||
dedicated <a href="autohinting/index.html">auto-hinter pages</a> on the
|
||||
FreeType site, as they describe most of its details with graphics and
|
||||
explanations. You could also look at the source code if you want
|
||||
to :-)</p>
|
||||
|
||||
<p>To give a few details, the auto-hinter is used to perform
|
||||
grid-fitting on scalable font formats that use Bézier outlines as
|
||||
their primary glyph image format (this means nearly all scalable font
|
||||
formats today). If a given font driver doesn't provide its own hinter,
|
||||
the auto-hinter is used by default. If a format-specific hinter is
|
||||
provided, it is still possible to use the auto-hinter using the
|
||||
<tt>FT_LOAD_FORCE_AUTOHINT</tt> bit flag when calling
|
||||
<tt>FT_Load_Glyph()</tt>.</p>
|
||||
|
||||
<p>The auto-hinter currently doesn't use external hints to do its job,
|
||||
as it automatically computes global metrics (when it "opens" a font for
|
||||
the first time) and glyph "hints" from their outline. Note that we plan
|
||||
the ability to specify external hints, given that it is based on a
|
||||
constraint system. That could be used to support native hints in
|
||||
Type 1/Type 2 fonts, for example.</p>
|
||||
|
||||
<hr>
|
||||
<a name="autohint-cjk">
|
||||
<h3>
|
||||
III.3 Why does the auto-hinter doesn't work correctly with CJK
|
||||
fonts?
|
||||
</h3>
|
||||
|
||||
<p>The auto-hinter was first designed to manage and hint Latin-based
|
||||
fonts, as they consist of most of the fonts available today. It doesn't
|
||||
hint Asian fonts, as well as a few other complex scripts, because we
|
||||
didn't put enough research on the topic yet. Hinting CJK isn't really
|
||||
more difficult than Latin, just different, with a set of different
|
||||
constraints (basically, more distortion of glyphs is acceptable as long
|
||||
as certain features like triple-stem positions are respected more
|
||||
strictly).</p>
|
||||
|
||||
<p>We thus plan to handle such a case in the near future. Please be
|
||||
patient.</p>
|
||||
</td></tr>
|
||||
</table>
|
||||
|
||||
<br>
|
||||
|
||||
<table width="100%">
|
||||
<tr bgcolor="#CCCCEE"><td>
|
||||
<h2 align=center>
|
||||
<a name="other">Other questions
|
||||
</h2>
|
||||
</td></tr>
|
||||
<tr><td>
|
||||
|
||||
<a name="other-depth">
|
||||
<h3>
|
||||
IV.1 Can I use FreeType to draw text on a pixmap with arbitratry depth?
|
||||
</h3>
|
||||
|
||||
<p>Not directly, as FreeType is a font library, not a general purpose
|
||||
graphics library or text rendering service. However, note that the
|
||||
anti-aliased renderer allows you to convert a vectorial glyph outline
|
||||
into a list of "spans" (i.e. horizontal pixel segments with same
|
||||
coverage) that can be rendered through user-provided callbacks.</p>
|
||||
|
||||
<p>By providing the appropriate span callback, you can render
|
||||
anti-aliased text to any kind of surface. You can also use any color or
|
||||
fill pattern/image if you want to. This process is called <em>direct
|
||||
rendering</em>. For more information, please read the documentation
|
||||
contained in the following files:</p>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<p><tt><freetype/ftimage.h></tt> contains the definition of
|
||||
the <tt>FT_Raster_Params</tt> type used with direct rendering.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p><tt><freetype/ftoutln.h></tt> contains the definition of
|
||||
the <tt>FT_Outline_Render()</tt> function that can be used to
|
||||
convert vectorial outlines to span lists.</p>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p>Here's some code that uses them:</p>
|
||||
|
||||
<font color="blue"><pre>
|
||||
FT_Raster_Params params;
|
||||
FT_Outline outline;
|
||||
|
||||
|
||||
... load vectorial glyph in "outline" ...
|
||||
|
||||
params.flags = ft_raster_flag_aa | ft_raster_flag_direct;
|
||||
params.gray_spans = (FT_Raster_Span_Func)your_own_span_function_here;
|
||||
params.user = your_own_data_pointer;
|
||||
|
||||
error = FT_Outline_Render( library, &outline, &params );</pre>
|
||||
</font>
|
||||
|
||||
<p>Note that direct rendering is <em>not</em> available with monochrome
|
||||
output, as the current renderer uses a two-pass algorithm to generate
|
||||
glyphs with correct drop-out control.</p>
|
||||
|
||||
<hr>
|
||||
<a name="other-color">
|
||||
<h3>
|
||||
IV.2 How can I set the color of text rendered by FreeType?
|
||||
</h3>
|
||||
|
||||
<p>Basically, you can't do that, because FreeType is simply a font
|
||||
library. In general, you will need to use your favorite graphics
|
||||
library to draw the FreeType glyphs with the appropriate color.</p>
|
||||
|
||||
<p>Note that for anti-aliased glyphs, you can "set the color" by using
|
||||
<em>direct rendering</em> as described in <a href="#other-depth">this
|
||||
answer</a>.</p>
|
||||
|
||||
<hr>
|
||||
<a name="other-size">
|
||||
<h3>
|
||||
IV.3 I set the pixel size to 8x8, but the resulting glyphs are larger
|
||||
(or smaller) than that. Why?
|
||||
</h3>
|
||||
|
||||
<p>A lot of people have difficulties to understand this topic, because
|
||||
they think of glyphs as fixed-width resp. fixed-height "cells", like
|
||||
those of fonts used in terminals/consoles. This assumption is simply
|
||||
not valid with most "modern" font formats, even bitmapped-based ones
|
||||
like <tt>PCF</tt> or <tt>BDF</tt>.</p>
|
||||
|
||||
<p>Be aware that the <em>character size</em> that is set either through
|
||||
<tt>FT_Set_Char_Size()</tt> or <tt>FT_Set_Pixel_Sizes()</tt> isn't
|
||||
directly related to the dimension of the glyph bitmaps generated.</p>
|
||||
|
||||
<p>Rather, the character size is indeed the size of <em>an abstract
|
||||
square</em>, called the <em>EM</em>, used by typographers to design
|
||||
fonts. Scaling two distinct fonts to the same character size, be it
|
||||
expressed in points or pixels, will generally result in bitmaps with
|
||||
<em>distinct dimensions</em>!</p>
|
||||
|
||||
<p>Note that historically, the EM corresponded to the width of a capital
|
||||
"M" in Latin typefaces. However, later improvements in typography led
|
||||
to designs that greatly detract from this rule. Today, it is not
|
||||
possible to connect the EM size to a specific font "feature" in a
|
||||
reliable way.</p>
|
||||
|
||||
<hr>
|
||||
<a name="other-bbox">
|
||||
<h3>
|
||||
IV.4 How can I compute the bounding box of a given string of text
|
||||
without loading its glyphs before?
|
||||
</h3>
|
||||
|
||||
<p>A lot of people want to be able to compute the size in pixels of a
|
||||
simple string of text with minimal overhead. For example, that can be
|
||||
useful to draw centered text within a button. (to be continued...)</p>
|
||||
|
||||
<hr>
|
||||
<a name="other-antialias">
|
||||
<h3>
|
||||
IV.5 Which anti-aliasing algorithm is used by FreeType 2?</h3>
|
||||
|
||||
<p>The algorithm has been specifically designed for FreeType. It is
|
||||
based on ideas that were originally found in the implementation of the
|
||||
<a href="http://www.levien.com/libart">libArt</a> graphics library to
|
||||
compute the <em>exact pixel coverage</em> of a vector image with
|
||||
absolutely no sub-sampling/filtering.</p>
|
||||
|
||||
<p>However, these two implementations are radically distinct and use
|
||||
vastly different models. The FreeType 2 renderer is optimized
|
||||
specifically for rendering small complex shapes, like glyphs, at very
|
||||
high speed while using very few memory; while libArt shines at general
|
||||
shape/polygon processing, especially large ones.</p>
|
||||
|
||||
<p>The FreeType 2 anti-aliasing renderer is indeed <em>faster</em>
|
||||
than the monochrome renderer for small character sizes (typically
|
||||
<20 pixels). The reason is that the monochrome renderer must
|
||||
perform two passes on the outline in order to perform drop-out control
|
||||
according to the TrueType specification (we could drop this requirement
|
||||
later though).</p>
|
||||
|
||||
<p>We will try to document its design in a later document, though this
|
||||
is not a priority for now.</p>
|
||||
|
||||
<hr>
|
||||
<a name="other-opentype">
|
||||
<h3>
|
||||
IV.6 When will FreeType 2 support OpenType?
|
||||
</h3>
|
||||
|
||||
<p>Well, the engine already reads OpenType/CFF files perfectly. What it
|
||||
doesn't do is handle "OpenType Layout" tables yet.</p>
|
||||
|
||||
<p>FreeType 1 comes with a set of extensions that are used to load
|
||||
and manage OpenType Layout tables. It even has a demonstration program
|
||||
named <tt>ftstrtto</tt> to show its capabilities.</p>
|
||||
|
||||
<p>For FreeType 2, we have decided that the layout operations
|
||||
provided through these tables are better placed in a specific
|
||||
text-layout library, (many people having asked for such a thing). This
|
||||
new engine will not depend on FreeType2 explicitly and will be developed
|
||||
as a separate project. We plan to announce it in a few weeks with all
|
||||
gory details, once the definitive 2.0 release of FreeType has been
|
||||
made.</p>
|
||||
|
||||
</td></tr>
|
||||
</table>
|
||||
|
||||
<p><hr></p>
|
||||
|
||||
<a href="index.html">Back to FreeType homepage</a><p>
|
||||
|
||||
</td></tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 2.9 KiB |