[CHG] FreeType updated to version 2.4.2

This commit is contained in:
Crayon2000 2010-08-08 21:27:38 +00:00
parent 5d78a7117d
commit 69d4eab793
15 changed files with 1018 additions and 821 deletions

View file

@ -1,361 +1,361 @@
# #
# FreeType 2 library sub-Makefile # FreeType 2 library sub-Makefile
# #
# Copyright 1996-2000, 2001, 2002, 2003, 2004, 2005, 2006, 2008 by # Copyright 1996-2000, 2001, 2002, 2003, 2004, 2005, 2006, 2008 by
# David Turner, Robert Wilhelm, and Werner Lemberg. # David Turner, Robert Wilhelm, and Werner Lemberg.
# #
# This file is part of the FreeType project, and may only be used, modified, # This file is part of the FreeType project, and may only be used, modified,
# and distributed under the terms of the FreeType project license, # and distributed under the terms of the FreeType project license,
# LICENSE.TXT. By continuing to use, modify, or distribute this file you # LICENSE.TXT. By continuing to use, modify, or distribute this file you
# indicate that you have read the license and understand and accept it # indicate that you have read the license and understand and accept it
# fully. # fully.
# DO NOT INVOKE THIS MAKEFILE DIRECTLY! IT IS MEANT TO BE INCLUDED BY # DO NOT INVOKE THIS MAKEFILE DIRECTLY! IT IS MEANT TO BE INCLUDED BY
# OTHER MAKEFILES. # OTHER MAKEFILES.
# The following variables (set by other Makefile components, in the # The following variables (set by other Makefile components, in the
# environment, or on the command line) are used: # environment, or on the command line) are used:
# #
# BUILD_DIR The architecture dependent directory, # BUILD_DIR The architecture dependent directory,
# e.g. `$(TOP_DIR)/builds/unix'. Added to INCLUDES also. # e.g. `$(TOP_DIR)/builds/unix'. Added to INCLUDES also.
# #
# OBJ_DIR The directory in which object files are created. # OBJ_DIR The directory in which object files are created.
# #
# LIB_DIR The directory in which the library is created. # LIB_DIR The directory in which the library is created.
# #
# DOC_DIR The directory in which the API reference is created. # DOC_DIR The directory in which the API reference is created.
# #
# INCLUDES A list of directories to be included additionally. # INCLUDES A list of directories to be included additionally.
# #
# DEVEL_DIR Development directory which is added to the INCLUDES # DEVEL_DIR Development directory which is added to the INCLUDES
# variable before the standard include directories. # variable before the standard include directories.
# #
# CFLAGS Compilation flags. This overrides the default settings # CFLAGS Compilation flags. This overrides the default settings
# in the platform-specific configuration files. # in the platform-specific configuration files.
# #
# FTSYS_SRC If set, its value is used as the name of a replacement # FTSYS_SRC If set, its value is used as the name of a replacement
# file for `src/base/ftsystem.c'. # file for `src/base/ftsystem.c'.
# #
# FTDEBUG_SRC If set, its value is used as the name of a replacement # 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 for `src/base/ftdebug.c'. [For a normal build, this
# file does nothing.] # file does nothing.]
# #
# FTMODULE_H The file which contains the list of module classes for # FTMODULE_H The file which contains the list of module classes for
# the current build. Usually, this is automatically # the current build. Usually, this is automatically
# created by `modules.mk'. # created by `modules.mk'.
# #
# BASE_OBJ_S # BASE_OBJ_S
# BASE_OBJ_M A list of base objects (for single object and multiple # BASE_OBJ_M A list of base objects (for single object and multiple
# object builds, respectively). Set up in # object builds, respectively). Set up in
# `src/base/rules.mk'. # `src/base/rules.mk'.
# #
# BASE_EXT_OBJ A list of base extension objects. Set up in # BASE_EXT_OBJ A list of base extension objects. Set up in
# `src/base/rules.mk'. # `src/base/rules.mk'.
# #
# DRV_OBJ_S # DRV_OBJ_S
# DRV_OBJ_M A list of driver objects (for single object and multiple # DRV_OBJ_M A list of driver objects (for single object and multiple
# object builds, respectively). Set up cumulatively in # object builds, respectively). Set up cumulatively in
# `src/<driver>/rules.mk'. # `src/<driver>/rules.mk'.
# #
# CLEAN # CLEAN
# DISTCLEAN The sub-makefiles can append additional stuff to these two # DISTCLEAN The sub-makefiles can append additional stuff to these two
# variables which is to be removed for the `clean' resp. # variables which is to be removed for the `clean' resp.
# `distclean' target. # `distclean' target.
# #
# TOP_DIR, SEP, # TOP_DIR, SEP,
# COMPILER_SEP, # COMPILER_SEP,
# LIBRARY, CC, # LIBRARY, CC,
# A, I, O, T Check `config.mk' for details. # A, I, O, T Check `config.mk' for details.
# The targets `objects' and `library' are defined at the end of this # The targets `objects' and `library' are defined at the end of this
# Makefile after all other rules have been included. # Makefile after all other rules have been included.
# #
.PHONY: single multi objects library refdoc .PHONY: single multi objects library refdoc
# default target -- build single objects and library # default target -- build single objects and library
# #
single: objects library single: objects library
# `multi' target -- build multiple objects and library # `multi' target -- build multiple objects and library
# #
multi: objects library multi: objects library
# The FreeType source directory, usually `./src'. # The FreeType source directory, usually `./src'.
# #
SRC_DIR := $(TOP_DIR)/src SRC_DIR := $(TOP_DIR)/src
# The directory where the base layer components are placed, usually # The directory where the base layer components are placed, usually
# `./src/base'. # `./src/base'.
# #
BASE_DIR := $(SRC_DIR)/base BASE_DIR := $(SRC_DIR)/base
# Other derived directories. # Other derived directories.
# #
PUBLIC_DIR := $(TOP_DIR)/include/freetype PUBLIC_DIR := $(TOP_DIR)/include/freetype
INTERNAL_DIR := $(PUBLIC_DIR)/internal INTERNAL_DIR := $(PUBLIC_DIR)/internal
SERVICES_DIR := $(INTERNAL_DIR)/services SERVICES_DIR := $(INTERNAL_DIR)/services
CONFIG_DIR := $(PUBLIC_DIR)/config CONFIG_DIR := $(PUBLIC_DIR)/config
# The documentation directory. # The documentation directory.
# #
DOC_DIR ?= $(TOP_DIR)/docs/reference DOC_DIR ?= $(TOP_DIR)/docs/reference
# The final name of the library file. # The final name of the library file.
# #
PROJECT_LIBRARY := $(LIB_DIR)/$(LIBRARY).$A PROJECT_LIBRARY := $(LIB_DIR)/$(LIBRARY).$A
# include paths # include paths
# #
# IMPORTANT NOTE: The architecture-dependent directory must ALWAYS be placed # IMPORTANT NOTE: The architecture-dependent directory must ALWAYS be placed
# before the standard include list. Porters are then able to # before the standard include list. Porters are then able to
# put their own version of some of the FreeType components # put their own version of some of the FreeType components
# in the `freetype/builds/<system>' directory, as these # in the `freetype/builds/<system>' directory, as these
# files will override the default sources. # files will override the default sources.
# #
INCLUDES := $(subst /,$(COMPILER_SEP),$(OBJ_DIR) \ INCLUDES := $(subst /,$(COMPILER_SEP),$(OBJ_DIR) \
$(DEVEL_DIR) \ $(DEVEL_DIR) \
$(BUILD_DIR) \ $(BUILD_DIR) \
$(TOP_DIR)/include) $(TOP_DIR)/include)
INCLUDE_FLAGS := $(INCLUDES:%=$I%) INCLUDE_FLAGS := $(INCLUDES:%=$I%)
# C flags used for the compilation of an object file. This must include at # C flags used for the compilation of an object file. This must include at
# least the paths for the `base' and `builds/<system>' directories; # least the paths for the `base' and `builds/<system>' directories;
# debug/optimization/warning flags + ansi compliance if needed. # debug/optimization/warning flags + ansi compliance if needed.
# #
# $(INCLUDE_FLAGS) should come before $(CFLAGS) to avoid problems with # $(INCLUDE_FLAGS) should come before $(CFLAGS) to avoid problems with
# old FreeType versions. # old FreeType versions.
# #
# Note what we also define the macro FT2_BUILD_LIBRARY when building # Note what we also define the macro FT2_BUILD_LIBRARY when building
# FreeType. This is required to let our sources include the internal # FreeType. This is required to let our sources include the internal
# headers (something forbidden by clients). # headers (something forbidden by clients).
# #
# Finally, we define FT_CONFIG_MODULES_H so that the compiler uses the # Finally, we define FT_CONFIG_MODULES_H so that the compiler uses the
# generated version of `ftmodule.h' in $(OBJ_DIR). If there is an # generated version of `ftmodule.h' in $(OBJ_DIR). If there is an
# `ftoption.h' files in $(OBJ_DIR), define FT_CONFIG_OPTIONS_H too. # `ftoption.h' files in $(OBJ_DIR), define FT_CONFIG_OPTIONS_H too.
# #
ifneq ($(wildcard $(OBJ_DIR)/ftoption.h),) ifneq ($(wildcard $(OBJ_DIR)/ftoption.h),)
FTOPTION_H := $(OBJ_DIR)/ftoption.h FTOPTION_H := $(OBJ_DIR)/ftoption.h
FTOPTION_FLAG := $DFT_CONFIG_OPTIONS_H="<ftoption.h>" FTOPTION_FLAG := $DFT_CONFIG_OPTIONS_H="<ftoption.h>"
endif endif
FT_CFLAGS = $(CPPFLAGS) \ FT_CFLAGS = $(CPPFLAGS) \
$(INCLUDE_FLAGS) \ $(INCLUDE_FLAGS) \
$(CFLAGS) \ $(CFLAGS) \
$DFT2_BUILD_LIBRARY \ $DFT2_BUILD_LIBRARY \
$DFT_CONFIG_MODULES_H="<ftmodule.h>" \ $DFT_CONFIG_MODULES_H="<ftmodule.h>" \
$(FTOPTION_FLAG) $(FTOPTION_FLAG)
FT_CC = $(CC) $(FT_CFLAGS) FT_CC = $(CC) $(FT_CFLAGS)
FT_COMPILE = $(CC) $(ANSIFLAGS) $(FT_CFLAGS) FT_COMPILE = $(CC) $(ANSIFLAGS) $(FT_CFLAGS)
# Include the `exports' rules file. # Include the `exports' rules file.
# #
include $(TOP_DIR)/builds/exports.mk include $(TOP_DIR)/builds/exports.mk
# Initialize the list of objects. # Initialize the list of objects.
# #
OBJECTS_LIST := OBJECTS_LIST :=
# Define $(PUBLIC_H) as the list of all public header files located in # Define $(PUBLIC_H) as the list of all public header files located in
# `$(TOP_DIR)/include/freetype'. $(INTERNAL_H), and $(CONFIG_H) are defined # `$(TOP_DIR)/include/freetype'. $(INTERNAL_H), and $(CONFIG_H) are defined
# similarly. # similarly.
# #
# This is used to simplify the dependency rules -- if one of these files # This is used to simplify the dependency rules -- if one of these files
# changes, the whole library is recompiled. # changes, the whole library is recompiled.
# #
PUBLIC_H := $(wildcard $(PUBLIC_DIR)/*.h) PUBLIC_H := $(wildcard $(PUBLIC_DIR)/*.h)
INTERNAL_H := $(wildcard $(INTERNAL_DIR)/*.h) \ INTERNAL_H := $(wildcard $(INTERNAL_DIR)/*.h) \
$(wildcard $(SERVICES_DIR)/*.h) $(wildcard $(SERVICES_DIR)/*.h)
CONFIG_H := $(wildcard $(CONFIG_DIR)/*.h) \ CONFIG_H := $(wildcard $(CONFIG_DIR)/*.h) \
$(wildcard $(BUILD_DIR)/freetype/config/*.h) \ $(wildcard $(BUILD_DIR)/freetype/config/*.h) \
$(FTMODULE_H) \ $(FTMODULE_H) \
$(FTOPTION_H) $(FTOPTION_H)
DEVEL_H := $(wildcard $(TOP_DIR)/devel/*.h) DEVEL_H := $(wildcard $(TOP_DIR)/devel/*.h)
FREETYPE_H := $(PUBLIC_H) $(INTERNAL_H) $(CONFIG_H) $(DEVEL_H) FREETYPE_H := $(PUBLIC_H) $(INTERNAL_H) $(CONFIG_H) $(DEVEL_H)
# ftsystem component # ftsystem component
# #
FTSYS_SRC ?= $(BASE_DIR)/ftsystem.c FTSYS_SRC ?= $(BASE_DIR)/ftsystem.c
FTSYS_OBJ := $(OBJ_DIR)/ftsystem.$O FTSYS_OBJ := $(OBJ_DIR)/ftsystem.$O
OBJECTS_LIST += $(FTSYS_OBJ) OBJECTS_LIST += $(FTSYS_OBJ)
$(FTSYS_OBJ): $(FTSYS_SRC) $(FREETYPE_H) $(FTSYS_OBJ): $(FTSYS_SRC) $(FREETYPE_H)
$(FT_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<) $(FT_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<)
# ftdebug component # ftdebug component
# #
FTDEBUG_SRC ?= $(BASE_DIR)/ftdebug.c FTDEBUG_SRC ?= $(BASE_DIR)/ftdebug.c
FTDEBUG_OBJ := $(OBJ_DIR)/ftdebug.$O FTDEBUG_OBJ := $(OBJ_DIR)/ftdebug.$O
OBJECTS_LIST += $(FTDEBUG_OBJ) OBJECTS_LIST += $(FTDEBUG_OBJ)
$(FTDEBUG_OBJ): $(FTDEBUG_SRC) $(FREETYPE_H) $(FTDEBUG_OBJ): $(FTDEBUG_SRC) $(FREETYPE_H)
$(FT_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<) $(FT_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<)
# Include all rule files from FreeType components. # Include all rule files from FreeType components.
# #
include $(SRC_DIR)/base/rules.mk include $(SRC_DIR)/base/rules.mk
include $(patsubst %,$(SRC_DIR)/%/rules.mk,$(MODULES)) include $(patsubst %,$(SRC_DIR)/%/rules.mk,$(MODULES))
# ftinit component # ftinit component
# #
# The C source `ftinit.c' contains the FreeType initialization routines. # The C source `ftinit.c' contains the FreeType initialization routines.
# It is able to automatically register one or more drivers when the API # It is able to automatically register one or more drivers when the API
# function FT_Init_FreeType() is called. # function FT_Init_FreeType() is called.
# #
# The set of initial drivers is determined by the driver Makefiles # The set of initial drivers is determined by the driver Makefiles
# includes above. Each driver Makefile updates the FTINIT_xxx lists # includes above. Each driver Makefile updates the FTINIT_xxx lists
# which contain additional include paths and macros used to compile the # which contain additional include paths and macros used to compile the
# single `ftinit.c' source. # single `ftinit.c' source.
# #
FTINIT_SRC := $(BASE_DIR)/ftinit.c FTINIT_SRC := $(BASE_DIR)/ftinit.c
FTINIT_OBJ := $(OBJ_DIR)/ftinit.$O FTINIT_OBJ := $(OBJ_DIR)/ftinit.$O
OBJECTS_LIST += $(FTINIT_OBJ) OBJECTS_LIST += $(FTINIT_OBJ)
$(FTINIT_OBJ): $(FTINIT_SRC) $(FREETYPE_H) $(FTINIT_OBJ): $(FTINIT_SRC) $(FREETYPE_H)
$(FT_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<) $(FT_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<)
# All FreeType library objects. # All FreeType library objects.
# #
OBJ_M := $(BASE_OBJ_M) $(BASE_EXT_OBJ) $(DRV_OBJS_M) OBJ_M := $(BASE_OBJ_M) $(BASE_EXT_OBJ) $(DRV_OBJS_M)
OBJ_S := $(BASE_OBJ_S) $(BASE_EXT_OBJ) $(DRV_OBJS_S) OBJ_S := $(BASE_OBJ_S) $(BASE_EXT_OBJ) $(DRV_OBJS_S)
# The target `multi' on the Make command line indicates that we want to # The target `multi' on the Make command line indicates that we want to
# compile each source file independently. # compile each source file independently.
# #
# Otherwise, each module/driver is compiled in a single object file through # Otherwise, each module/driver is compiled in a single object file through
# source file inclusion (see `src/base/ftbase.c' or # source file inclusion (see `src/base/ftbase.c' or
# `src/truetype/truetype.c' for examples). # `src/truetype/truetype.c' for examples).
# #
BASE_OBJECTS := $(OBJECTS_LIST) BASE_OBJECTS := $(OBJECTS_LIST)
ifneq ($(findstring multi,$(MAKECMDGOALS)),) ifneq ($(findstring multi,$(MAKECMDGOALS)),)
OBJECTS_LIST += $(OBJ_M) OBJECTS_LIST += $(OBJ_M)
else else
OBJECTS_LIST += $(OBJ_S) OBJECTS_LIST += $(OBJ_S)
endif endif
objects: $(OBJECTS_LIST) objects: $(OBJECTS_LIST)
library: $(PROJECT_LIBRARY) library: $(PROJECT_LIBRARY)
dll: $(PROJECT_LIBRARY) exported_symbols dll: $(PROJECT_LIBRARY) exported_symbols
.c.$O: .c.$O:
$(FT_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<) $(FT_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<)
ifneq ($(findstring refdoc,$(MAKECMDGOALS)),) ifneq ($(findstring refdoc,$(MAKECMDGOALS)),)
# poor man's `sed' emulation with make's built-in string functions # poor man's `sed' emulation with make's built-in string functions
work := $(strip $(shell $(CAT) $(PUBLIC_DIR)/freetype.h)) work := $(strip $(shell $(CAT) $(PUBLIC_DIR)/freetype.h))
work := $(subst |,x,$(work)) work := $(subst |,x,$(work))
work := $(subst $(space),|,$(work)) work := $(subst $(space),|,$(work))
work := $(subst \#define|FREETYPE_MAJOR|,$(space),$(work)) work := $(subst \#define|FREETYPE_MAJOR|,$(space),$(work))
work := $(word 2,$(work)) work := $(word 2,$(work))
major := $(subst |,$(space),$(work)) major := $(subst |,$(space),$(work))
major := $(firstword $(major)) major := $(firstword $(major))
work := $(subst \#define|FREETYPE_MINOR|,$(space),$(work)) work := $(subst \#define|FREETYPE_MINOR|,$(space),$(work))
work := $(word 2,$(work)) work := $(word 2,$(work))
minor := $(subst |,$(space),$(work)) minor := $(subst |,$(space),$(work))
minor := $(firstword $(minor)) minor := $(firstword $(minor))
work := $(subst \#define|FREETYPE_PATCH|,$(space),$(work)) work := $(subst \#define|FREETYPE_PATCH|,$(space),$(work))
work := $(word 2,$(work)) work := $(word 2,$(work))
patch := $(subst |,$(space),$(work)) patch := $(subst |,$(space),$(work))
patch := $(firstword $(patch)) patch := $(firstword $(patch))
version := $(major).$(minor).$(patch) version := $(major).$(minor).$(patch)
endif endif
# We write-protect the docmaker directory to suppress generation # We write-protect the docmaker directory to suppress generation
# of .pyc files. # of .pyc files.
# #
refdoc: refdoc:
-chmod -w $(SRC_DIR)/tools/docmaker -chmod -w $(SRC_DIR)/tools/docmaker
python $(SRC_DIR)/tools/docmaker/docmaker.py \ python $(SRC_DIR)/tools/docmaker/docmaker.py \
--prefix=ft2 \ --prefix=ft2 \
--title=FreeType-$(version) \ --title=FreeType-$(version) \
--output=$(DOC_DIR) \ --output=$(DOC_DIR) \
$(PUBLIC_DIR)/*.h \ $(PUBLIC_DIR)/*.h \
$(PUBLIC_DIR)/config/*.h \ $(PUBLIC_DIR)/config/*.h \
$(PUBLIC_DIR)/cache/*.h $(PUBLIC_DIR)/cache/*.h
-chmod +w $(SRC_DIR)/tools/docmaker -chmod +w $(SRC_DIR)/tools/docmaker
.PHONY: clean_project_std distclean_project_std .PHONY: clean_project_std distclean_project_std
# Standard cleaning and distclean rules. These are not accepted # Standard cleaning and distclean rules. These are not accepted
# on all systems though. # on all systems though.
# #
clean_project_std: clean_project_std:
-$(DELETE) $(BASE_OBJECTS) $(OBJ_M) $(OBJ_S) $(CLEAN) -$(DELETE) $(BASE_OBJECTS) $(OBJ_M) $(OBJ_S) $(CLEAN)
distclean_project_std: clean_project_std distclean_project_std: clean_project_std
-$(DELETE) $(PROJECT_LIBRARY) -$(DELETE) $(PROJECT_LIBRARY)
-$(DELETE) *.orig *~ core *.core $(DISTCLEAN) -$(DELETE) *.orig *~ core *.core $(DISTCLEAN)
.PHONY: clean_project_dos distclean_project_dos .PHONY: clean_project_dos distclean_project_dos
# The Dos command shell does not support very long list of arguments, so # The Dos command shell does not support very long list of arguments, so
# we are stuck with wildcards. # we are stuck with wildcards.
# #
# Don't break the command lines with \; this prevents the "del" command from # Don't break the command lines with \; this prevents the "del" command from
# working correctly on Win9x. # working correctly on Win9x.
# #
clean_project_dos: clean_project_dos:
-$(DELETE) $(subst /,$(SEP),$(OBJ_DIR)/*.$O $(CLEAN) $(NO_OUTPUT)) -$(DELETE) $(subst /,$(SEP),$(OBJ_DIR)/*.$O $(CLEAN) $(NO_OUTPUT))
distclean_project_dos: clean_project_dos distclean_project_dos: clean_project_dos
-$(DELETE) $(subst /,$(SEP),$(PROJECT_LIBRARY) $(DISTCLEAN) $(NO_OUTPUT)) -$(DELETE) $(subst /,$(SEP),$(PROJECT_LIBRARY) $(DISTCLEAN) $(NO_OUTPUT))
.PHONY: remove_config_mk remove_ftmodule_h .PHONY: remove_config_mk remove_ftmodule_h
# Remove configuration file (used for distclean). # Remove configuration file (used for distclean).
# #
remove_config_mk: remove_config_mk:
-$(DELETE) $(subst /,$(SEP),$(CONFIG_MK) $(NO_OUTPUT)) -$(DELETE) $(subst /,$(SEP),$(CONFIG_MK) $(NO_OUTPUT))
# Remove module list (used for distclean). # Remove module list (used for distclean).
# #
remove_ftmodule_h: remove_ftmodule_h:
-$(DELETE) $(subst /,$(SEP),$(FTMODULE_H) $(NO_OUTPUT)) -$(DELETE) $(subst /,$(SEP),$(FTMODULE_H) $(NO_OUTPUT))
.PHONY: clean distclean .PHONY: clean distclean
# The `config.mk' file must define `clean_freetype' and # The `config.mk' file must define `clean_freetype' and
# `distclean_freetype'. Implementations may use to relay these to either # `distclean_freetype'. Implementations may use to relay these to either
# the `std' or `dos' versions from above, or simply provide their own # the `std' or `dos' versions from above, or simply provide their own
# implementation. # implementation.
# #
clean: clean_project clean: clean_project
distclean: distclean_project remove_config_mk remove_ftmodule_h distclean: distclean_project remove_config_mk remove_ftmodule_h
-$(DELETE) $(subst /,$(SEP),$(DOC_DIR)/*.html $(NO_OUTPUT)) -$(DELETE) $(subst /,$(SEP),$(DOC_DIR)/*.html $(NO_OUTPUT))
# EOF # EOF

View file

@ -1,79 +1,79 @@
# #
# FreeType 2 modules sub-Makefile # FreeType 2 modules sub-Makefile
# #
# Copyright 1996-2000, 2003, 2006, 2008 by # Copyright 1996-2000, 2003, 2006, 2008 by
# David Turner, Robert Wilhelm, and Werner Lemberg. # David Turner, Robert Wilhelm, and Werner Lemberg.
# #
# This file is part of the FreeType project, and may only be used, modified, # This file is part of the FreeType project, and may only be used, modified,
# and distributed under the terms of the FreeType project license, # and distributed under the terms of the FreeType project license,
# LICENSE.TXT. By continuing to use, modify, or distribute this file you # LICENSE.TXT. By continuing to use, modify, or distribute this file you
# indicate that you have read the license and understand and accept it # indicate that you have read the license and understand and accept it
# fully. # fully.
# DO NOT INVOKE THIS MAKEFILE DIRECTLY! IT IS MEANT TO BE INCLUDED BY # DO NOT INVOKE THIS MAKEFILE DIRECTLY! IT IS MEANT TO BE INCLUDED BY
# OTHER MAKEFILES. # OTHER MAKEFILES.
# This file is in charge of handling the generation of the modules list # This file is in charge of handling the generation of the modules list
# file. # file.
# Build the modules list. # Build the modules list.
# #
$(FTMODULE_H): $(MODULES_CFG) $(FTMODULE_H): $(MODULES_CFG)
$(FTMODULE_H_INIT) $(FTMODULE_H_INIT)
$(FTMODULE_H_CREATE) $(FTMODULE_H_CREATE)
$(FTMODULE_H_DONE) $(FTMODULE_H_DONE)
ifneq ($(findstring $(PLATFORM),dos win32 win16 os2),) ifneq ($(findstring $(PLATFORM),dos win32 win16 os2),)
OPEN_MODULE := @echo$(space) OPEN_MODULE := @echo$(space)
CLOSE_MODULE := >> $(subst /,$(SEP),$(FTMODULE_H)) CLOSE_MODULE := >> $(subst /,$(SEP),$(FTMODULE_H))
REMOVE_MODULE := @-$(DELETE) $(subst /,$(SEP),$(FTMODULE_H)) REMOVE_MODULE := @-$(DELETE) $(subst /,$(SEP),$(FTMODULE_H))
else else
OPEN_MODULE := @echo " OPEN_MODULE := @echo "
CLOSE_MODULE := " >> $(FTMODULE_H) CLOSE_MODULE := " >> $(FTMODULE_H)
REMOVE_MODULE := @-$(DELETE) $(FTMODULE_H) REMOVE_MODULE := @-$(DELETE) $(FTMODULE_H)
endif endif
define FTMODULE_H_INIT define FTMODULE_H_INIT
$(REMOVE_MODULE) $(REMOVE_MODULE)
@-echo Generating modules list in $(FTMODULE_H)... @-echo Generating modules list in $(FTMODULE_H)...
$(OPEN_MODULE)/* This is a generated file. */$(CLOSE_MODULE) $(OPEN_MODULE)/* This is a generated file. */$(CLOSE_MODULE)
endef endef
# It is no mistake that the final closing parenthesis is on the # It is no mistake that the final closing parenthesis is on the
# next line -- it produces proper newlines during the expansion # next line -- it produces proper newlines during the expansion
# of `foreach'. # of `foreach'.
# #
define FTMODULE_H_CREATE define FTMODULE_H_CREATE
$(foreach COMMAND,$(FTMODULE_H_COMMANDS),$($(COMMAND)) $(foreach COMMAND,$(FTMODULE_H_COMMANDS),$($(COMMAND))
) )
endef endef
define FTMODULE_H_DONE define FTMODULE_H_DONE
$(OPEN_MODULE)/* EOF */$(CLOSE_MODULE) $(OPEN_MODULE)/* EOF */$(CLOSE_MODULE)
@echo done. @echo done.
endef endef
# $(OPEN_DRIVER) & $(CLOSE_DRIVER) are used to specify a given font driver # $(OPEN_DRIVER) & $(CLOSE_DRIVER) are used to specify a given font driver
# in the `module.mk' rules file. # in the `module.mk' rules file.
# #
OPEN_DRIVER := $(OPEN_MODULE)FT_USE_MODULE( OPEN_DRIVER := $(OPEN_MODULE)FT_USE_MODULE(
CLOSE_DRIVER := )$(CLOSE_MODULE) CLOSE_DRIVER := )$(CLOSE_MODULE)
ECHO_DRIVER := @echo "* module:$(space) ECHO_DRIVER := @echo "* module:$(space)
ECHO_DRIVER_DESC := ( ECHO_DRIVER_DESC := (
ECHO_DRIVER_DONE := )" ECHO_DRIVER_DONE := )"
# Each `module.mk' in the `src/*' subdirectories adds a variable with # Each `module.mk' in the `src/*' subdirectories adds a variable with
# commands to $(FTMODULE_H_COMMANDS). Note that we can't use SRC_DIR here. # commands to $(FTMODULE_H_COMMANDS). Note that we can't use SRC_DIR here.
# #
-include $(patsubst %,$(TOP_DIR)/src/%/module.mk,$(MODULES)) -include $(patsubst %,$(TOP_DIR)/src/%/module.mk,$(MODULES))
# EOF # EOF

View file

@ -363,7 +363,7 @@ FT_BEGIN_HEADER
#endif /* __arm__ && !__thumb__ && !( __CC_ARM || __ARMCC__ ) */ #endif /* __arm__ && !__thumb__ && !( __CC_ARM || __ARMCC__ ) */
#if defined( i386 ) #if defined( __i386__ )
#define FT_MULFIX_ASSEMBLER FT_MulFix_i386 #define FT_MULFIX_ASSEMBLER FT_MulFix_i386
/* documentation is in freetype.h */ /* documentation is in freetype.h */

View file

@ -1952,6 +1952,9 @@ FT_BEGIN_HEADER
/* Each new face object created with this function also owns a */ /* Each new face object created with this function also owns a */
/* default @FT_Size object, accessible as `face->size'. */ /* default @FT_Size object, accessible as `face->size'. */
/* */ /* */
/* See the discussion of reference counters in the description of */
/* @FT_Reference_Face. */
/* */
FT_EXPORT( FT_Error ) FT_EXPORT( FT_Error )
FT_Open_Face( FT_Library library, FT_Open_Face( FT_Library library,
const FT_Open_Args* args, const FT_Open_Args* args,
@ -2016,6 +2019,33 @@ FT_BEGIN_HEADER
FT_Open_Args* parameters ); FT_Open_Args* parameters );
/*************************************************************************/
/* */
/* <Function> */
/* FT_Reference_Face */
/* */
/* <Description> */
/* A counter gets initialized to~1 at the time an @FT_Face structure */
/* is created. This function increments the counter. @FT_Done_Face */
/* then only destroys a face if the counter is~1, otherwise it simply */
/* decrements the counter. */
/* */
/* This function helps in managing life-cycles of structures which */
/* reference @FT_Face objects. */
/* */
/* <Input> */
/* face :: A handle to a target face object. */
/* */
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
/* <Since> */
/* 2.4.2 */
/* */
FT_EXPORT( FT_Error )
FT_Reference_Face( FT_Face face );
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* <Function> */ /* <Function> */
@ -2031,6 +2061,10 @@ FT_BEGIN_HEADER
/* <Return> */ /* <Return> */
/* FreeType error code. 0~means success. */ /* FreeType error code. 0~means success. */
/* */ /* */
/* <Note> */
/* See the discussion of reference counters in the description of */
/* @FT_Reference_Face. */
/* */
FT_EXPORT( FT_Error ) FT_EXPORT( FT_Error )
FT_Done_Face( FT_Face face ); FT_Done_Face( FT_Face face );
@ -3774,7 +3808,7 @@ FT_BEGIN_HEADER
*/ */
#define FREETYPE_MAJOR 2 #define FREETYPE_MAJOR 2
#define FREETYPE_MINOR 4 #define FREETYPE_MINOR 4
#define FREETYPE_PATCH 1 #define FREETYPE_PATCH 2
/*************************************************************************/ /*************************************************************************/

View file

@ -58,7 +58,7 @@ FT_BEGIN_HEADER
/**************************************************************************** /****************************************************************************
* *
* @func: * @enum:
* FT_LcdFilter * FT_LcdFilter
* *
* @description: * @description:

View file

@ -249,6 +249,33 @@ FT_BEGIN_HEADER
FT_Module module ); FT_Module module );
/*************************************************************************/
/* */
/* <Function> */
/* FT_Reference_Library */
/* */
/* <Description> */
/* A counter gets initialized to~1 at the time an @FT_Library */
/* structure is created. This function increments the counter. */
/* @FT_Done_Library then only destroys a library if the counter is~1, */
/* otherwise it simply decrements the counter. */
/* */
/* This function helps in managing life-cycles of structures which */
/* reference @FT_Library objects. */
/* */
/* <Input> */
/* library :: A handle to a target library object. */
/* */
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
/* <Since> */
/* 2.4.2 */
/* */
FT_EXPORT( FT_Error )
FT_Reference_Library( FT_Library library );
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* <Function> */ /* <Function> */
@ -275,6 +302,10 @@ FT_BEGIN_HEADER
/* <Return> */ /* <Return> */
/* FreeType error code. 0~means success. */ /* FreeType error code. 0~means success. */
/* */ /* */
/* <Note> */
/* See the discussion of reference counters in the description of */
/* @FT_Reference_Library. */
/* */
FT_EXPORT( FT_Error ) FT_EXPORT( FT_Error )
FT_New_Library( FT_Memory memory, FT_New_Library( FT_Memory memory,
FT_Library *alibrary ); FT_Library *alibrary );
@ -295,6 +326,10 @@ FT_BEGIN_HEADER
/* <Return> */ /* <Return> */
/* FreeType error code. 0~means success. */ /* FreeType error code. 0~means success. */
/* */ /* */
/* <Note> */
/* See the discussion of reference counters in the description of */
/* @FT_Reference_Library. */
/* */
FT_EXPORT( FT_Error ) FT_EXPORT( FT_Error )
FT_Done_Library( FT_Library library ); FT_Done_Library( FT_Library library );

View file

@ -4,7 +4,7 @@
/* */ /* */
/* The FreeType private base classes (specification). */ /* The FreeType private base classes (specification). */
/* */ /* */
/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2008 by */ /* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2008, 2010 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@ -311,6 +311,12 @@ FT_BEGIN_HEADER
/* in the case when the unpatented hinter is compiled within the */ /* in the case when the unpatented hinter is compiled within the */
/* library. */ /* library. */
/* */ /* */
/* refcount :: */
/* A counter initialized to~1 at the time an @FT_Face structure is */
/* created. @FT_Reference_Face increments this counter, and */
/* @FT_Done_Face only destroys a face if the counter is~1, */
/* otherwise it simply decrements it. */
/* */
typedef struct FT_Face_InternalRec_ typedef struct FT_Face_InternalRec_
{ {
#ifdef FT_CONFIG_OPTION_OLD_INTERNALS #ifdef FT_CONFIG_OPTION_OLD_INTERNALS
@ -328,6 +334,7 @@ FT_BEGIN_HEADER
#endif #endif
FT_Bool ignore_unpatented_hinter; FT_Bool ignore_unpatented_hinter;
FT_UInt refcount;
} FT_Face_InternalRec; } FT_Face_InternalRec;
@ -805,10 +812,28 @@ FT_BEGIN_HEADER
/* */ /* */
/* debug_hooks :: XXX */ /* debug_hooks :: XXX */
/* */ /* */
/* lcd_filter :: If subpixel rendering is activated, the */
/* selected LCD filter mode. */
/* */
/* lcd_extra :: If subpixel rendering is activated, the number */
/* of extra pixels needed for the LCD filter. */
/* */
/* lcd_weights :: If subpixel rendering is activated, the LCD */
/* filter weights, if any. */
/* */
/* lcd_filter_func :: If subpixel rendering is activated, the LCD */
/* filtering callback function. */
/* */
/* pic_container :: Contains global structs and tables, instead */ /* pic_container :: Contains global structs and tables, instead */
/* of defining them globallly. */ /* of defining them globallly. */
/* */ /* */
/* refcount :: A counter initialized to~1 at the time an */
/* @FT_Library structure is created. */
/* @FT_Reference_Library increments this counter, */
/* and @FT_Done_Library only destroys a library */
/* if the counter is~1, otherwise it simply */
/* decrements it. */
/* */
typedef struct FT_LibraryRec_ typedef struct FT_LibraryRec_
{ {
FT_Memory memory; /* library's memory manager */ FT_Memory memory; /* library's memory manager */
@ -843,6 +868,8 @@ FT_BEGIN_HEADER
FT_PIC_Container pic_container; FT_PIC_Container pic_container;
#endif #endif
FT_UInt refcount;
} FT_LibraryRec; } FT_LibraryRec;

View file

@ -1,250 +1,250 @@
# modules.cfg # modules.cfg
# #
# Copyright 2005, 2006, 2007, 2009 by # Copyright 2005, 2006, 2007, 2009 by
# David Turner, Robert Wilhelm, and Werner Lemberg. # David Turner, Robert Wilhelm, and Werner Lemberg.
# #
# This file is part of the FreeType project, and may only be used, modified, # This file is part of the FreeType project, and may only be used, modified,
# and distributed under the terms of the FreeType project license, # and distributed under the terms of the FreeType project license,
# LICENSE.TXT. By continuing to use, modify, or distribute this file you # LICENSE.TXT. By continuing to use, modify, or distribute this file you
# indicate that you have read the license and understand and accept it # indicate that you have read the license and understand and accept it
# fully. # fully.
# #
# #
# In case you compile the FreeType library with GNU make or makepp, this # In case you compile the FreeType library with GNU make or makepp, this
# file controls which components are built into the library. Otherwise, # file controls which components are built into the library. Otherwise,
# please read this file for information on the various modules and its # please read this file for information on the various modules and its
# dependencies, then follow the instructions in the file `docs/INSTALL.ANY'. # dependencies, then follow the instructions in the file `docs/INSTALL.ANY'.
# #
# To deactivate a module, simply comment out the corresponding line. To # To deactivate a module, simply comment out the corresponding line. To
# activate a module, remove the comment character. # activate a module, remove the comment character.
# #
# Note that many modules and components are further controlled with macros # Note that many modules and components are further controlled with macros
# in the file `include/freetype/config/ftoption.h'. # in the file `include/freetype/config/ftoption.h'.
#### ####
#### font modules -- at least one is required #### font modules -- at least one is required
#### ####
#### The order given here (from top to down) is the order used for testing #### The order given here (from top to down) is the order used for testing
#### font formats in the compiled library. #### font formats in the compiled library.
#### ####
# TrueType font driver. # TrueType font driver.
# #
# This driver needs the `sfnt' module. # This driver needs the `sfnt' module.
FONT_MODULES += truetype FONT_MODULES += truetype
# PostScript Type 1 font driver. # PostScript Type 1 font driver.
# #
# This driver needs the `psaux', `pshinter', and `psnames' modules. # This driver needs the `psaux', `pshinter', and `psnames' modules.
FONT_MODULES += type1 FONT_MODULES += type1
# CFF/OpenType font driver. # CFF/OpenType font driver.
# #
# This driver needs the `sfnt', `pshinter', and `psnames' modules. # This driver needs the `sfnt', `pshinter', and `psnames' modules.
FONT_MODULES += cff FONT_MODULES += cff
# Type 1 CID-keyed font driver. # Type 1 CID-keyed font driver.
# #
# This driver needs the `psaux', `pshinter', and `psnames' modules. # This driver needs the `psaux', `pshinter', and `psnames' modules.
FONT_MODULES += cid FONT_MODULES += cid
# PFR/TrueDoc font driver. See optional extension ftpfr.c below also. # PFR/TrueDoc font driver. See optional extension ftpfr.c below also.
FONT_MODULES += pfr FONT_MODULES += pfr
# PostScript Type 42 font driver. # PostScript Type 42 font driver.
# #
# This driver needs the `truetype' module. # This driver needs the `truetype' module.
FONT_MODULES += type42 FONT_MODULES += type42
# Windows FONT/FNT font driver. See optional extension ftwinfnt.c below # Windows FONT/FNT font driver. See optional extension ftwinfnt.c below
# also. # also.
FONT_MODULES += winfonts FONT_MODULES += winfonts
# PCF font driver. # PCF font driver.
FONT_MODULES += pcf FONT_MODULES += pcf
# BDF font driver. See optional extension ftbdf.c below also. # BDF font driver. See optional extension ftbdf.c below also.
FONT_MODULES += bdf FONT_MODULES += bdf
# SFNT files support. If used without `truetype' or `cff', it supports # SFNT files support. If used without `truetype' or `cff', it supports
# bitmap-only fonts within an SFNT wrapper. # bitmap-only fonts within an SFNT wrapper.
# #
# This driver needs the `psnames' module. # This driver needs the `psnames' module.
FONT_MODULES += sfnt FONT_MODULES += sfnt
#### ####
#### hinting modules #### hinting modules
#### ####
# FreeType's auto hinter. # FreeType's auto hinter.
HINTING_MODULES += autofit HINTING_MODULES += autofit
# PostScript hinter. # PostScript hinter.
HINTING_MODULES += pshinter HINTING_MODULES += pshinter
# The TrueType hinting engine doesn't have a module of its own but is # The TrueType hinting engine doesn't have a module of its own but is
# controlled in file include/freetype/config/ftoption.h # controlled in file include/freetype/config/ftoption.h
# (TT_CONFIG_OPTION_BYTECODE_INTERPRETER and friends). # (TT_CONFIG_OPTION_BYTECODE_INTERPRETER and friends).
#### ####
#### raster modules -- at least one is required for vector font formats #### raster modules -- at least one is required for vector font formats
#### ####
# Monochrome rasterizer. # Monochrome rasterizer.
RASTER_MODULES += raster RASTER_MODULES += raster
# Anti-aliasing rasterizer. # Anti-aliasing rasterizer.
RASTER_MODULES += smooth RASTER_MODULES += smooth
#### ####
#### auxiliary modules #### auxiliary modules
#### ####
# FreeType's cache sub-system (quite stable but still in beta -- this means # FreeType's cache sub-system (quite stable but still in beta -- this means
# that its public API is subject to change if necessary). See # that its public API is subject to change if necessary). See
# include/freetype/ftcache.h. Needs ftglyph.c. # include/freetype/ftcache.h. Needs ftglyph.c.
AUX_MODULES += cache AUX_MODULES += cache
# TrueType GX/AAT table validation. Needs ftgxval.c below. # TrueType GX/AAT table validation. Needs ftgxval.c below.
# AUX_MODULES += gxvalid # AUX_MODULES += gxvalid
# Support for streams compressed with gzip (files with suffix .gz). # Support for streams compressed with gzip (files with suffix .gz).
# #
# See include/freetype/ftgzip.h for the API. # See include/freetype/ftgzip.h for the API.
AUX_MODULES += gzip AUX_MODULES += gzip
# Support for streams compressed with LZW (files with suffix .Z). # Support for streams compressed with LZW (files with suffix .Z).
# #
# See include/freetype/ftlzw.h for the API. # See include/freetype/ftlzw.h for the API.
AUX_MODULES += lzw AUX_MODULES += lzw
# OpenType table validation. Needs ftotval.c below. # OpenType table validation. Needs ftotval.c below.
# #
# AUX_MODULES += otvalid # AUX_MODULES += otvalid
# Auxiliary PostScript driver component to share common code. # Auxiliary PostScript driver component to share common code.
# #
# This module depends on `psnames'. # This module depends on `psnames'.
AUX_MODULES += psaux AUX_MODULES += psaux
# Support for PostScript glyph names. # Support for PostScript glyph names.
# #
# This module can be controlled in ftconfig.h # This module can be controlled in ftconfig.h
# (FT_CONFIG_OPTION_POSTSCRIPT_NAMES). # (FT_CONFIG_OPTION_POSTSCRIPT_NAMES).
AUX_MODULES += psnames AUX_MODULES += psnames
#### ####
#### base module extensions #### base module extensions
#### ####
# Exact bounding box calculation. # Exact bounding box calculation.
# #
# See include/freetype/ftbbox.h for the API. # See include/freetype/ftbbox.h for the API.
BASE_EXTENSIONS += ftbbox.c BASE_EXTENSIONS += ftbbox.c
# Access BDF-specific strings. Needs BDF font driver. # Access BDF-specific strings. Needs BDF font driver.
# #
# See include/freetype/ftbdf.h for the API. # See include/freetype/ftbdf.h for the API.
BASE_EXTENSIONS += ftbdf.c BASE_EXTENSIONS += ftbdf.c
# Utility functions for converting 1bpp, 2bpp, 4bpp, and 8bpp bitmaps into # Utility functions for converting 1bpp, 2bpp, 4bpp, and 8bpp bitmaps into
# 8bpp format, and for emboldening of bitmap glyphs. # 8bpp format, and for emboldening of bitmap glyphs.
# #
# See include/freetype/ftbitmap.h for the API. # See include/freetype/ftbitmap.h for the API.
BASE_EXTENSIONS += ftbitmap.c BASE_EXTENSIONS += ftbitmap.c
# Access CID font information. # Access CID font information.
# #
# See include/freetype/ftcid.h for the API. # See include/freetype/ftcid.h for the API.
BASE_EXTENSIONS += ftcid.c BASE_EXTENSIONS += ftcid.c
# Access FSType information. Needs fttype1.c. # Access FSType information. Needs fttype1.c.
# #
# See include/freetype/freetype.h for the API. # See include/freetype/freetype.h for the API.
BASE_EXTENSIONS += ftfstype.c BASE_EXTENSIONS += ftfstype.c
# Support for GASP table queries. # Support for GASP table queries.
# #
# See include/freetype/ftgasp.h for the API. # See include/freetype/ftgasp.h for the API.
BASE_EXTENSIONS += ftgasp.c BASE_EXTENSIONS += ftgasp.c
# Convenience functions to handle glyphs. Needs ftbitmap.c. # Convenience functions to handle glyphs. Needs ftbitmap.c.
# #
# See include/freetype/ftglyph.h for the API. # See include/freetype/ftglyph.h for the API.
BASE_EXTENSIONS += ftglyph.c BASE_EXTENSIONS += ftglyph.c
# Interface for gxvalid module. # Interface for gxvalid module.
# #
# See include/freetype/ftgxval.h for the API. # See include/freetype/ftgxval.h for the API.
BASE_EXTENSIONS += ftgxval.c BASE_EXTENSIONS += ftgxval.c
# Support for LCD color filtering of subpixel bitmaps. # Support for LCD color filtering of subpixel bitmaps.
# #
# See include/freetype/ftlcdfil.h for the API. # See include/freetype/ftlcdfil.h for the API.
BASE_EXTENSIONS += ftlcdfil.c BASE_EXTENSIONS += ftlcdfil.c
# Multiple Master font interface. # Multiple Master font interface.
# #
# See include/freetype/ftmm.h for the API. # See include/freetype/ftmm.h for the API.
BASE_EXTENSIONS += ftmm.c BASE_EXTENSIONS += ftmm.c
# Interface for otvalid module. # Interface for otvalid module.
# #
# See include/freetype/ftotval.h for the API. # See include/freetype/ftotval.h for the API.
BASE_EXTENSIONS += ftotval.c BASE_EXTENSIONS += ftotval.c
# Support for FT_Face_CheckTrueTypePatents. # Support for FT_Face_CheckTrueTypePatents.
# #
# See include/freetype/freetype.h for the API. # See include/freetype/freetype.h for the API.
BASE_EXTENSIONS += ftpatent.c BASE_EXTENSIONS += ftpatent.c
# Interface for accessing PFR-specific data. Needs PFR font driver. # Interface for accessing PFR-specific data. Needs PFR font driver.
# #
# See include/freetype/ftpfr.h for the API. # See include/freetype/ftpfr.h for the API.
BASE_EXTENSIONS += ftpfr.c BASE_EXTENSIONS += ftpfr.c
# Path stroker. Needs ftglyph.c. # Path stroker. Needs ftglyph.c.
# #
# See include/freetype/ftstroke.h for the API. # See include/freetype/ftstroke.h for the API.
BASE_EXTENSIONS += ftstroke.c BASE_EXTENSIONS += ftstroke.c
# Support for synthetic embolding and slanting of fonts. Needs ftbitmap.c. # Support for synthetic embolding and slanting of fonts. Needs ftbitmap.c.
# #
# See include/freetype/ftsynth.h for the API. # See include/freetype/ftsynth.h for the API.
BASE_EXTENSIONS += ftsynth.c BASE_EXTENSIONS += ftsynth.c
# Interface to access data specific to PostScript Type 1 and Type 2 (CFF) # Interface to access data specific to PostScript Type 1 and Type 2 (CFF)
# fonts. # fonts.
# #
# See include/freetype/t1tables.h for the API. # See include/freetype/t1tables.h for the API.
BASE_EXTENSIONS += fttype1.c BASE_EXTENSIONS += fttype1.c
# Interface for accessing data specific to Windows FNT files. Needs winfnt # Interface for accessing data specific to Windows FNT files. Needs winfnt
# driver. # driver.
# #
# See include/freetype/ftwinfnt.h for the API. # See include/freetype/ftwinfnt.h for the API.
BASE_EXTENSIONS += ftwinfnt.c BASE_EXTENSIONS += ftwinfnt.c
# Support functions for X11. # Support functions for X11.
# #
# See include/freetype/ftxf86.h for the API. # See include/freetype/ftxf86.h for the API.
BASE_EXTENSIONS += ftxf86.c BASE_EXTENSIONS += ftxf86.c
#### ####
#### The components `ftsystem.c' (for memory allocation and stream I/O #### The components `ftsystem.c' (for memory allocation and stream I/O
#### management) and `ftdebug.c' (for emitting debug messages to the user) #### management) and `ftdebug.c' (for emitting debug messages to the user)
#### are controlled with the following variables. #### are controlled with the following variables.
#### ####
#### ftsystem.c: $(FTSYS_SRC) #### ftsystem.c: $(FTSYS_SRC)
#### ftdebug.c: $(FTDEBUG_SRC) #### ftdebug.c: $(FTDEBUG_SRC)
#### ####
#### Please refer to docs/CUSTOMIZE for details. #### Please refer to docs/CUSTOMIZE for details.
#### ####
# EOF # EOF

View file

@ -142,7 +142,7 @@
if ( !args ) if ( !args )
return FT_Err_Invalid_Argument; return FT_Err_Invalid_Argument;
memory = library->memory; memory = library->memory;
if ( FT_NEW( stream ) ) if ( FT_NEW( stream ) )
goto Exit; goto Exit;
@ -1574,6 +1574,7 @@
FT_TRACE3(( "POST fragment[%d]: offsets=0x%08x, rlen=0x%08x, flags=0x%04x\n", FT_TRACE3(( "POST fragment[%d]: offsets=0x%08x, rlen=0x%08x, flags=0x%04x\n",
i, offsets[i], rlen, flags )); i, offsets[i], rlen, flags ));
/* postpone the check of rlen longer than buffer until FT_Stream_Read() */
if ( ( flags >> 8 ) == 0 ) /* Comment, should not be loaded */ if ( ( flags >> 8 ) == 0 ) /* Comment, should not be loaded */
continue; continue;
@ -1613,6 +1614,10 @@
pfb_data[pfb_pos++] = 0; pfb_data[pfb_pos++] = 0;
} }
error = FT_Err_Cannot_Open_Resource;
if ( pfb_pos > pfb_len || pfb_pos + rlen > pfb_len )
goto Exit2;
error = FT_Stream_Read( stream, (FT_Byte *)pfb_data + pfb_pos, rlen ); error = FT_Stream_Read( stream, (FT_Byte *)pfb_data + pfb_pos, rlen );
if ( error ) if ( error )
goto Exit2; goto Exit2;
@ -1960,9 +1965,9 @@
FT_Error error; FT_Error error;
FT_Driver driver; FT_Driver driver;
FT_Memory memory; FT_Memory memory;
FT_Stream stream = 0; FT_Stream stream = NULL;
FT_Face face = 0; FT_Face face = NULL;
FT_ListNode node = 0; FT_ListNode node = NULL;
FT_Bool external_stream; FT_Bool external_stream;
FT_Module* cur; FT_Module* cur;
FT_Module* limit; FT_Module* limit;
@ -2186,6 +2191,8 @@
internal->transform_delta.x = 0; internal->transform_delta.x = 0;
internal->transform_delta.y = 0; internal->transform_delta.y = 0;
internal->refcount = 1;
} }
if ( aface ) if ( aface )
@ -2271,6 +2278,17 @@
} }
/* documentation is in freetype.h */
FT_EXPORT_DEF( FT_Error )
FT_Reference_Face( FT_Face face )
{
face->internal->refcount++;
return FT_Err_Ok;
}
/* documentation is in freetype.h */ /* documentation is in freetype.h */
FT_EXPORT_DEF( FT_Error ) FT_EXPORT_DEF( FT_Error )
@ -2285,22 +2303,29 @@
error = FT_Err_Invalid_Face_Handle; error = FT_Err_Invalid_Face_Handle;
if ( face && face->driver ) if ( face && face->driver )
{ {
driver = face->driver; face->internal->refcount--;
memory = driver->root.memory; if ( face->internal->refcount > 0 )
/* find face in driver's list */
node = FT_List_Find( &driver->faces_list, face );
if ( node )
{
/* remove face object from the driver's list */
FT_List_Remove( &driver->faces_list, node );
FT_FREE( node );
/* now destroy the object proper */
destroy_face( memory, face, driver );
error = FT_Err_Ok; error = FT_Err_Ok;
else
{
driver = face->driver;
memory = driver->root.memory;
/* find face in driver's list */
node = FT_List_Find( &driver->faces_list, face );
if ( node )
{
/* remove face object from the driver's list */
FT_List_Remove( &driver->faces_list, node );
FT_FREE( node );
/* now destroy the object proper */
destroy_face( memory, face, driver );
error = FT_Err_Ok;
}
} }
} }
return error; return error;
} }
@ -4262,13 +4287,24 @@
/*************************************************************************/ /*************************************************************************/
/* documentation is in ftmodapi.h */
FT_EXPORT_DEF( FT_Error )
FT_Reference_Library( FT_Library library )
{
library->refcount++;
return FT_Err_Ok;
}
/* documentation is in ftmodapi.h */ /* documentation is in ftmodapi.h */
FT_EXPORT_DEF( FT_Error ) FT_EXPORT_DEF( FT_Error )
FT_New_Library( FT_Memory memory, FT_New_Library( FT_Memory memory,
FT_Library *alibrary ) FT_Library *alibrary )
{ {
FT_Library library = 0; FT_Library library = NULL;
FT_Error error; FT_Error error;
@ -4304,6 +4340,8 @@
library->version_minor = FREETYPE_MINOR; library->version_minor = FREETYPE_MINOR;
library->version_patch = FREETYPE_PATCH; library->version_patch = FREETYPE_PATCH;
library->refcount = 1;
/* That's ok now */ /* That's ok now */
*alibrary = library; *alibrary = library;
@ -4360,40 +4398,64 @@
if ( !library ) if ( !library )
return FT_Err_Invalid_Library_Handle; return FT_Err_Invalid_Library_Handle;
library->refcount--;
if ( library->refcount > 0 )
goto Exit;
memory = library->memory; memory = library->memory;
/* Discard client-data */ /* Discard client-data */
if ( library->generic.finalizer ) if ( library->generic.finalizer )
library->generic.finalizer( library ); library->generic.finalizer( library );
/* Close all faces in the library. If we don't do /*
* this, we can have some subtle memory leaks. * Close all faces in the library. If we don't do this, we can have
* some subtle memory leaks.
*
* Example: * Example:
* *
* - the cff font driver uses the pshinter module in cff_size_done * - the cff font driver uses the pshinter module in cff_size_done
* - if the pshinter module is destroyed before the cff font driver, * - if the pshinter module is destroyed before the cff font driver,
* opened FT_Face objects managed by the driver are not properly * opened FT_Face objects managed by the driver are not properly
* destroyed, resulting in a memory leak * destroyed, resulting in a memory leak
*
* Some faces are dependent on other faces, like Type42 faces that
* depend on TrueType faces synthesized internally.
*
* The order of drivers should be specified in driver_name[].
*/ */
{ {
FT_UInt n; FT_UInt m, n;
const char* driver_name[] = { "type42", NULL };
for ( n = 0; n < library->num_modules; n++ ) for ( m = 0;
m < sizeof ( driver_name ) / sizeof ( driver_name[0] );
m++ )
{ {
FT_Module module = library->modules[n]; for ( n = 0; n < library->num_modules; n++ )
FT_List faces;
if ( ( module->clazz->module_flags & FT_MODULE_FONT_DRIVER ) == 0 )
continue;
faces = &FT_DRIVER(module)->faces_list;
while ( faces->head )
{ {
FT_Done_Face( FT_FACE( faces->head->data ) ); FT_Module module = library->modules[n];
if ( faces->head ) const char* module_name = module->clazz->module_name;
FT_TRACE0(( "FT_Done_Library: failed to free some faces\n" )); FT_List faces;
if ( driver_name[m] &&
ft_strcmp( module_name, driver_name[m] ) != 0 )
continue;
if ( ( module->clazz->module_flags & FT_MODULE_FONT_DRIVER ) == 0 )
continue;
FT_TRACE7(( "FT_Done_Library: close faces for %s\n", module_name ));
faces = &FT_DRIVER( module )->faces_list;
while ( faces->head )
{
FT_Done_Face( FT_FACE( faces->head->data ) );
if ( faces->head )
FT_TRACE0(( "FT_Done_Library: failed to free some faces\n" ));
}
} }
} }
} }
@ -4435,6 +4497,8 @@
#endif #endif
FT_FREE( library ); FT_FREE( library );
Exit:
return FT_Err_Ok; return FT_Err_Ok;
} }

View file

@ -287,7 +287,7 @@
{ {
/* check current and new position */ /* check current and new position */
if ( stream->pos >= stream->size || if ( stream->pos >= stream->size ||
stream->pos + count > stream->size ) stream->size - stream->pos < count )
{ {
FT_ERROR(( "FT_Stream_EnterFrame:" FT_ERROR(( "FT_Stream_EnterFrame:"
" invalid i/o; pos = 0x%lx, count = %lu, size = 0x%lx\n", " invalid i/o; pos = 0x%lx, count = %lu, size = 0x%lx\n",

View file

@ -2280,6 +2280,8 @@
/* subsequent `pop' operands should add the arguments, */ /* subsequent `pop' operands should add the arguments, */
/* this is the implementation described for `unknown' other */ /* this is the implementation described for `unknown' other */
/* subroutines in the Type1 spec. */ /* subroutines in the Type1 spec. */
/* */
/* XXX Fix return arguments (see discussion below). */
args -= 2 + ( args[-2] >> 16 ); args -= 2 + ( args[-2] >> 16 );
if ( args < stack ) if ( args < stack )
goto Stack_Underflow; goto Stack_Underflow;
@ -2292,6 +2294,22 @@
FT_TRACE4(( " pop (invalid op)\n" )); FT_TRACE4(( " pop (invalid op)\n" ));
/* XXX Increasing `args' is wrong: After a certain number of */
/* `pop's we get a stack overflow. Reason for doing it is */
/* code like this (actually found in a CFF font): */
/* */
/* 17 1 3 callothersubr */
/* pop */
/* callsubr */
/* */
/* Since we handle `callothersubr' as a no-op, and */
/* `callsubr' needs at least one argument, `pop' can't be a */
/* no-op too as it basically should be. */
/* */
/* The right solution would be to provide real support for */
/* `callothersubr' as done in `t1decode.c', however, given */
/* the fact that CFF fonts with `pop' are invalid, it is */
/* questionable whether it is worth the time. */
args++; args++;
break; break;
@ -2455,7 +2473,10 @@
return CFF_Err_Unimplemented_Feature; return CFF_Err_Unimplemented_Feature;
} }
decoder->top = args; decoder->top = args;
if ( decoder->top - stack >= CFF_MAX_OPERANDS )
goto Stack_Overflow;
} /* general operator processing */ } /* general operator processing */
@ -2728,48 +2749,53 @@
/* now load the unscaled outline */ /* now load the unscaled outline */
error = cff_get_glyph_data( face, glyph_index, error = cff_get_glyph_data( face, glyph_index,
&charstring, &charstring_len ); &charstring, &charstring_len );
if ( !error ) if ( error )
{ goto Glyph_Build_Finished;
error = cff_decoder_prepare( &decoder, size, glyph_index );
if ( !error )
{
error = cff_decoder_parse_charstrings( &decoder,
charstring,
charstring_len );
cff_free_glyph_data( face, &charstring, charstring_len ); error = cff_decoder_prepare( &decoder, size, glyph_index );
if ( error )
goto Glyph_Build_Finished;
error = cff_decoder_parse_charstrings( &decoder,
charstring,
charstring_len );
cff_free_glyph_data( face, &charstring, charstring_len );
if ( error )
goto Glyph_Build_Finished;
#ifdef FT_CONFIG_OPTION_INCREMENTAL #ifdef FT_CONFIG_OPTION_INCREMENTAL
/* Control data and length may not be available for incremental */ /* Control data and length may not be available for incremental */
/* fonts. */ /* fonts. */
if ( face->root.internal->incremental_interface ) if ( face->root.internal->incremental_interface )
{ {
glyph->root.control_data = 0; glyph->root.control_data = 0;
glyph->root.control_len = 0; glyph->root.control_len = 0;
} }
else else
#endif /* FT_CONFIG_OPTION_INCREMENTAL */ #endif /* FT_CONFIG_OPTION_INCREMENTAL */
/* We set control_data and control_len if charstrings is loaded. */ /* We set control_data and control_len if charstrings is loaded. */
/* See how charstring loads at cff_index_access_element() in */ /* See how charstring loads at cff_index_access_element() in */
/* cffload.c. */ /* cffload.c. */
{ {
CFF_Index csindex = &cff->charstrings_index; CFF_Index csindex = &cff->charstrings_index;
if ( csindex->offsets ) if ( csindex->offsets )
{ {
glyph->root.control_data = csindex->bytes + glyph->root.control_data = csindex->bytes +
csindex->offsets[glyph_index] - 1; csindex->offsets[glyph_index] - 1;
glyph->root.control_len = charstring_len; glyph->root.control_len = charstring_len;
}
}
} }
} }
/* save new glyph tables */ Glyph_Build_Finished:
cff_builder_done( &decoder.builder ); /* save new glyph tables, if no error */
if ( !error )
cff_builder_done( &decoder.builder );
/* XXX: anything to do for broken glyph entry? */
} }
#ifdef FT_CONFIG_OPTION_INCREMENTAL #ifdef FT_CONFIG_OPTION_INCREMENTAL

View file

@ -1931,18 +1931,21 @@
y1 = SCALED( point[-2].y ); y1 = SCALED( point[-2].y );
x2 = SCALED( point[-1].x ); x2 = SCALED( point[-1].x );
y2 = SCALED( point[-1].y ); y2 = SCALED( point[-1].y );
x3 = SCALED( point[ 0].x );
y3 = SCALED( point[ 0].y );
if ( flipped ) if ( flipped )
{ {
SWAP_( x1, y1 ); SWAP_( x1, y1 );
SWAP_( x2, y2 ); SWAP_( x2, y2 );
SWAP_( x3, y3 );
} }
if ( point <= limit ) if ( point <= limit )
{ {
x3 = SCALED( point[0].x );
y3 = SCALED( point[0].y );
if ( flipped )
SWAP_( x3, y3 );
if ( Cubic_To( RAS_VARS x1, y1, x2, y2, x3, y3 ) ) if ( Cubic_To( RAS_VARS x1, y1, x2, y2, x3, y3 ) )
goto Fail; goto Fail;
continue; continue;
@ -2495,7 +2498,7 @@
PByte p; PByte p;
p = bits - e1*ras.target.pitch; p = bits - e1 * ras.target.pitch;
if ( ras.target.pitch > 0 ) if ( ras.target.pitch > 0 )
p += ( ras.target.rows - 1 ) * ras.target.pitch; p += ( ras.target.rows - 1 ) * ras.target.pitch;

View file

@ -224,9 +224,10 @@
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* A simple bounds-checking macro. */ /* Two simple bounds-checking macros. */
/* */ /* */
#define BOUNDS( x, n ) ( (FT_UInt)(x) >= (FT_UInt)(n) ) #define BOUNDS( x, n ) ( (FT_UInt)(x) >= (FT_UInt)(n) )
#define BOUNDSL( x, n ) ( (FT_ULong)(x) >= (FT_ULong)(n) )
#undef SUCCESS #undef SUCCESS
#define SUCCESS 0 #define SUCCESS 0
@ -3281,39 +3282,39 @@
args[0] = FT_PIX_CEIL( args[0] ); args[0] = FT_PIX_CEIL( args[0] );
#define DO_RS \ #define DO_RS \
{ \ { \
FT_ULong I = (FT_ULong)args[0]; \ FT_ULong I = (FT_ULong)args[0]; \
\ \
\ \
if ( BOUNDS( I, CUR.storeSize ) ) \ if ( BOUNDSL( I, CUR.storeSize ) ) \
{ \ { \
if ( CUR.pedantic_hinting ) \ if ( CUR.pedantic_hinting ) \
{ \ { \
ARRAY_BOUND_ERROR; \ ARRAY_BOUND_ERROR; \
} \ } \
else \ else \
args[0] = 0; \ args[0] = 0; \
} \ } \
else \ else \
args[0] = CUR.storage[I]; \ args[0] = CUR.storage[I]; \
} }
#define DO_WS \ #define DO_WS \
{ \ { \
FT_ULong I = (FT_ULong)args[0]; \ FT_ULong I = (FT_ULong)args[0]; \
\ \
\ \
if ( BOUNDS( I, CUR.storeSize ) ) \ if ( BOUNDSL( I, CUR.storeSize ) ) \
{ \ { \
if ( CUR.pedantic_hinting ) \ if ( CUR.pedantic_hinting ) \
{ \ { \
ARRAY_BOUND_ERROR; \ ARRAY_BOUND_ERROR; \
} \ } \
} \ } \
else \ else \
CUR.storage[I] = args[1]; \ CUR.storage[I] = args[1]; \
} }
@ -3322,7 +3323,7 @@
FT_ULong I = (FT_ULong)args[0]; \ FT_ULong I = (FT_ULong)args[0]; \
\ \
\ \
if ( BOUNDS( I, CUR.cvtSize ) ) \ if ( BOUNDSL( I, CUR.cvtSize ) ) \
{ \ { \
if ( CUR.pedantic_hinting ) \ if ( CUR.pedantic_hinting ) \
{ \ { \
@ -3341,7 +3342,7 @@
FT_ULong I = (FT_ULong)args[0]; \ FT_ULong I = (FT_ULong)args[0]; \
\ \
\ \
if ( BOUNDS( I, CUR.cvtSize ) ) \ if ( BOUNDSL( I, CUR.cvtSize ) ) \
{ \ { \
if ( CUR.pedantic_hinting ) \ if ( CUR.pedantic_hinting ) \
{ \ { \
@ -3358,7 +3359,7 @@
FT_ULong I = (FT_ULong)args[0]; \ FT_ULong I = (FT_ULong)args[0]; \
\ \
\ \
if ( BOUNDS( I, CUR.cvtSize ) ) \ if ( BOUNDSL( I, CUR.cvtSize ) ) \
{ \ { \
if ( CUR.pedantic_hinting ) \ if ( CUR.pedantic_hinting ) \
{ \ { \
@ -4679,7 +4680,7 @@
/* first of all, check the index */ /* first of all, check the index */
F = args[0]; F = args[0];
if ( BOUNDS( F, CUR.maxFunc + 1 ) ) if ( BOUNDSL( F, CUR.maxFunc + 1 ) )
goto Fail; goto Fail;
/* Except for some old Apple fonts, all functions in a TrueType */ /* Except for some old Apple fonts, all functions in a TrueType */
@ -4755,7 +4756,7 @@
/* first of all, check the index */ /* first of all, check the index */
F = args[1]; F = args[1];
if ( BOUNDS( F, CUR.maxFunc + 1 ) ) if ( BOUNDSL( F, CUR.maxFunc + 1 ) )
goto Fail; goto Fail;
/* Except for some old Apple fonts, all functions in a TrueType */ /* Except for some old Apple fonts, all functions in a TrueType */
@ -5030,7 +5031,7 @@
L = (FT_ULong)args[0]; L = (FT_ULong)args[0];
if ( BOUNDS( L, CUR.zp2.n_points ) ) if ( BOUNDSL( L, CUR.zp2.n_points ) )
{ {
if ( CUR.pedantic_hinting ) if ( CUR.pedantic_hinting )
{ {
@ -5114,8 +5115,8 @@
K = (FT_UShort)args[1]; K = (FT_UShort)args[1];
L = (FT_UShort)args[0]; L = (FT_UShort)args[0];
if( BOUNDS( L, CUR.zp0.n_points ) || if ( BOUNDS( L, CUR.zp0.n_points ) ||
BOUNDS( K, CUR.zp1.n_points ) ) BOUNDS( K, CUR.zp1.n_points ) )
{ {
if ( CUR.pedantic_hinting ) if ( CUR.pedantic_hinting )
{ {
@ -5769,12 +5770,12 @@
static void static void
Ins_SHZ( INS_ARG ) Ins_SHZ( INS_ARG )
{ {
TT_GlyphZoneRec zp; TT_GlyphZoneRec zp;
FT_UShort refp; FT_UShort refp;
FT_F26Dot6 dx, FT_F26Dot6 dx,
dy; dy;
FT_UShort last_point, i; FT_UShort last_point, i;
if ( BOUNDS( args[0], 2 ) ) if ( BOUNDS( args[0], 2 ) )
@ -5976,8 +5977,8 @@
cvtEntry = (FT_ULong)args[1]; cvtEntry = (FT_ULong)args[1];
point = (FT_UShort)args[0]; point = (FT_UShort)args[0];
if ( BOUNDS( point, CUR.zp0.n_points ) || if ( BOUNDS( point, CUR.zp0.n_points ) ||
BOUNDS( cvtEntry, CUR.cvtSize ) ) BOUNDSL( cvtEntry, CUR.cvtSize ) )
{ {
if ( CUR.pedantic_hinting ) if ( CUR.pedantic_hinting )
CUR.error = TT_Err_Invalid_Reference; CUR.error = TT_Err_Invalid_Reference;
@ -6169,7 +6170,7 @@
/* XXX: UNDOCUMENTED! cvt[-1] = 0 always */ /* XXX: UNDOCUMENTED! cvt[-1] = 0 always */
if ( BOUNDS( point, CUR.zp1.n_points ) || if ( BOUNDS( point, CUR.zp1.n_points ) ||
BOUNDS( cvtEntry, CUR.cvtSize + 1 ) || BOUNDSL( cvtEntry, CUR.cvtSize + 1 ) ||
BOUNDS( CUR.GS.rp0, CUR.zp0.n_points ) ) BOUNDS( CUR.GS.rp0, CUR.zp0.n_points ) )
{ {
if ( CUR.pedantic_hinting ) if ( CUR.pedantic_hinting )
@ -6420,8 +6421,8 @@
p1 = (FT_UShort)args[0]; p1 = (FT_UShort)args[0];
p2 = (FT_UShort)args[1]; p2 = (FT_UShort)args[1];
if ( BOUNDS( args[0], CUR.zp1.n_points ) || if ( BOUNDS( p1, CUR.zp1.n_points ) ||
BOUNDS( args[1], CUR.zp0.n_points ) ) BOUNDS( p2, CUR.zp0.n_points ) )
{ {
if ( CUR.pedantic_hinting ) if ( CUR.pedantic_hinting )
CUR.error = TT_Err_Invalid_Reference; CUR.error = TT_Err_Invalid_Reference;
@ -6950,7 +6951,7 @@
A = (FT_ULong)CUR.stack[CUR.args + 1]; A = (FT_ULong)CUR.stack[CUR.args + 1];
B = CUR.stack[CUR.args]; B = CUR.stack[CUR.args];
if ( BOUNDS( A, CUR.cvtSize ) ) if ( BOUNDSL( A, CUR.cvtSize ) )
{ {
if ( CUR.pedantic_hinting ) if ( CUR.pedantic_hinting )
{ {

View file

@ -150,7 +150,7 @@ FT_BEGIN_HEADER
FT_Bool step_ins; /* true if the interpreter must */ FT_Bool step_ins; /* true if the interpreter must */
/* increment IP after ins. exec */ /* increment IP after ins. exec */
FT_Long cvtSize; FT_ULong cvtSize;
FT_Long* cvt; FT_Long* cvt;
FT_UInt glyphSize; /* glyph instructions buffer size */ FT_UInt glyphSize; /* glyph instructions buffer size */

View file

@ -4,7 +4,7 @@
/* */ /* */
/* Type 42 font parser (body). */ /* Type 42 font parser (body). */
/* */ /* */
/* Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */ /* Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 by */
/* Roberto Alameda. */ /* Roberto Alameda. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@ -577,6 +577,12 @@
} }
string_size = T1_ToInt( parser ); string_size = T1_ToInt( parser );
if ( string_size < 0 )
{
FT_ERROR(( "t42_parse_sfnts: invalid string size\n" ));
error = T42_Err_Invalid_File_Format;
goto Fail;
}
T1_Skip_PS_Token( parser ); /* `RD' */ T1_Skip_PS_Token( parser ); /* `RD' */
if ( parser->root.error ) if ( parser->root.error )
@ -584,13 +590,14 @@
string_buf = parser->root.cursor + 1; /* one space after `RD' */ string_buf = parser->root.cursor + 1; /* one space after `RD' */
parser->root.cursor += string_size + 1; if ( limit - parser->root.cursor < string_size )
if ( parser->root.cursor >= limit )
{ {
FT_ERROR(( "t42_parse_sfnts: too many binary data\n" )); FT_ERROR(( "t42_parse_sfnts: too many binary data\n" ));
error = T42_Err_Invalid_File_Format; error = T42_Err_Invalid_File_Format;
goto Fail; goto Fail;
} }
else
parser->root.cursor += string_size + 1;
} }
if ( !string_buf ) if ( !string_buf )