summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Baptiste Queru <jbq@google.com>2009-07-25 17:48:01 -0700
committerJean-Baptiste Queru <jbq@google.com>2009-07-25 17:48:01 -0700
commitdc280eeb0aa3d55aaf6584c86623bf999ebd1736 (patch)
tree14b8437e23a816c57512fe472fdef4c7875c2eba
parent885cd2c19cbf73725d51f6b184d087b28343de1e (diff)
parent77f63d23f7d380b0ff02c18fd6a154ab9063128a (diff)
downloadandroid_external_freetype-dc280eeb0aa3d55aaf6584c86623bf999ebd1736.tar.gz
android_external_freetype-dc280eeb0aa3d55aaf6584c86623bf999ebd1736.tar.bz2
android_external_freetype-dc280eeb0aa3d55aaf6584c86623bf999ebd1736.zip
Merge korg/donut into korg/master
-rw-r--r--Android.mk16
-rw-r--r--include/freetype/config/ftconfig.h169
-rw-r--r--include/freetype/config/ftheader.h77
-rw-r--r--include/freetype/config/ftmodule.h20
-rw-r--r--include/freetype/config/ftoption.h46
-rw-r--r--include/freetype/config/ftstdlib.h10
-rw-r--r--include/freetype/freetype.h696
-rw-r--r--include/freetype/ftadvanc.h136
-rw-r--r--include/freetype/ftbbox.h4
-rw-r--r--include/freetype/ftbdf.h89
-rw-r--r--include/freetype/ftbitmap.h41
-rw-r--r--include/freetype/ftcache.h76
-rw-r--r--include/freetype/ftchapters.h1
-rw-r--r--include/freetype/ftcid.h76
-rw-r--r--include/freetype/ftgasp.h11
-rw-r--r--include/freetype/ftglyph.h82
-rw-r--r--include/freetype/ftgxval.h10
-rw-r--r--include/freetype/ftgzip.h2
-rw-r--r--include/freetype/ftimage.h190
-rw-r--r--include/freetype/ftincrem.h8
-rw-r--r--include/freetype/ftlcdfil.h12
-rw-r--r--include/freetype/ftlist.h14
-rw-r--r--include/freetype/ftlzw.h2
-rw-r--r--include/freetype/ftmac.h16
-rw-r--r--include/freetype/ftmm.h28
-rw-r--r--include/freetype/ftmodapi.h26
-rw-r--r--include/freetype/ftotval.h2
-rw-r--r--include/freetype/ftoutln.h70
-rw-r--r--include/freetype/ftpfr.h16
-rw-r--r--include/freetype/ftrender.h8
-rw-r--r--include/freetype/ftsizes.h12
-rw-r--r--include/freetype/ftsnames.h8
-rw-r--r--include/freetype/ftstroke.h58
-rw-r--r--include/freetype/ftsynth.h27
-rw-r--r--include/freetype/ftsystem.h8
-rw-r--r--include/freetype/fttypes.h18
-rw-r--r--include/freetype/ftwinfnt.h6
-rw-r--r--include/freetype/ftxf86.h4
-rw-r--r--include/freetype/internal/ftdebug.h8
-rw-r--r--include/freetype/internal/ftdriver.h5
-rw-r--r--include/freetype/internal/ftgloadr.h8
-rw-r--r--include/freetype/internal/ftobjs.h1
-rw-r--r--include/freetype/internal/psaux.h9
-rw-r--r--include/freetype/internal/services/svcid.h11
-rw-r--r--include/freetype/internal/services/svpsinfo.h7
-rw-r--r--include/freetype/internal/services/svttcmap.h9
-rw-r--r--include/freetype/internal/t1types.h24
-rw-r--r--include/freetype/t1tables.h36
-rw-r--r--include/freetype/ttnameid.h273
-rw-r--r--include/freetype/tttables.h36
-rw-r--r--include/freetype/tttags.h9
-rw-r--r--src/autofit/afcjk.c44
-rw-r--r--src/autofit/afhints.c8
-rw-r--r--src/autofit/aflatin.c50
-rw-r--r--src/autofit/aflatin2.c10
-rw-r--r--src/autofit/aftypes.h7
-rw-r--r--src/base/ftadvanc.c122
-rw-r--r--src/base/ftbase.c5
-rw-r--r--src/base/ftbase.h57
-rw-r--r--src/base/ftbitmap.c35
-rw-r--r--src/base/ftcalc.c152
-rw-r--r--src/base/ftdbgmem.c7
-rw-r--r--src/base/ftdebug.c2
-rw-r--r--src/base/ftglyph.c64
-rw-r--r--src/base/ftinit.c6
-rw-r--r--src/base/ftlcdfil.c12
-rw-r--r--src/base/ftmm.c4
-rw-r--r--src/base/ftobjs.c321
-rw-r--r--src/base/ftoutln.c62
-rw-r--r--src/base/ftpatent.c4
-rw-r--r--src/base/ftrfork.c18
-rw-r--r--src/base/ftstream.c5
-rw-r--r--src/base/ftstroke.c137
-rw-r--r--src/base/ftsynth.c30
-rw-r--r--src/base/ftsystem.c4
-rw-r--r--src/cff/cffdrivr.c110
-rw-r--r--src/cff/cffgload.c497
-rw-r--r--src/cff/cffgload.h3
-rw-r--r--src/cff/cffload.c15
-rw-r--r--src/cff/cffload.h5
-rw-r--r--src/cff/cffobjs.c243
-rw-r--r--src/cff/cffparse.c17
-rw-r--r--src/psaux/afmparse.c9
-rw-r--r--src/psaux/psobjs.c46
-rw-r--r--src/psaux/t1decode.c17
-rw-r--r--src/pshinter/pshalgo.c4
-rw-r--r--src/psnames/psmodule.c95
-rw-r--r--src/psnames/pstables.h9
-rw-r--r--src/raster/ftmisc.h5
-rw-r--r--src/raster/ftraster.c447
-rw-r--r--src/sfnt/sfdriver.c29
-rw-r--r--src/sfnt/sfobjs.c278
-rw-r--r--src/sfnt/ttcmap.c160
-rw-r--r--src/sfnt/ttkern.c29
-rw-r--r--src/sfnt/ttload.c181
-rw-r--r--src/sfnt/ttmtx.c14
-rw-r--r--src/sfnt/ttpost.c15
-rw-r--r--src/sfnt/ttsbit.c23
-rw-r--r--src/sfnt/ttsbit.h4
-rw-r--r--src/sfnt/ttsbit0.c129
-rw-r--r--src/smooth/ftgrays.c285
-rw-r--r--src/smooth/ftsmooth.c8
-rw-r--r--src/truetype/ttdriver.c40
-rw-r--r--src/truetype/ttgload.c78
-rw-r--r--src/truetype/ttgload.h6
-rw-r--r--src/truetype/ttgxvar.c14
-rw-r--r--src/truetype/ttinterp.c35
-rw-r--r--src/truetype/ttobjs.c94
-rw-r--r--src/truetype/ttobjs.h6
-rw-r--r--src/truetype/ttpload.c59
110 files changed, 4137 insertions, 2569 deletions
diff --git a/Android.mk b/Android.mk
index 1ebddfa..70b2e46 100644
--- a/Android.mk
+++ b/Android.mk
@@ -1,10 +1,10 @@
# this is now the default FreeType build for Android
#
ifndef USE_FREETYPE
-USE_FREETYPE := 2.3.6
+USE_FREETYPE := 2.3.9
endif
-ifeq ($(USE_FREETYPE),2.3.6)
+ifeq ($(USE_FREETYPE),2.3.9)
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
@@ -23,7 +23,6 @@ LOCAL_SRC_FILES:= \
src/base/ftsystem.c \
src/base/ftinit.c \
src/base/ftgasp.c \
- src/base/ftadvanc.c \
src/raster/raster.c \
src/sfnt/sfnt.c \
src/smooth/smooth.c \
@@ -42,13 +41,6 @@ LOCAL_CFLAGS += -fPIC -DPIC
LOCAL_CFLAGS += "-DDARWIN_NO_CARBON"
LOCAL_CFLAGS += "-DFT2_BUILD_LIBRARY"
-# only enable this if you want to enable our ugly font hack
-# to be able to switch the system's font hinting at runtime
-# through our modified Development Settings. the change will
-# only happen when you reboot or restart an application
-#
-LOCAL_CFLAGS += -DANDROID_FONT_HACK=1
-
# enable the FreeType internal memory debugger in the simulator
# you need to define the FT2_DEBUG_MEMORY environment variable
# when running the program to activate it. It will dump memory
@@ -67,9 +59,7 @@ endif
# of the product
#LOCAL_CFLAGS += "-DTT_CONFIG_OPTION_BYTECODE_INTERPRETER"
-ifeq ($(TARGET_BUILD_TYPE),release)
- LOCAL_CFLAGS += -O2
-endif
+LOCAL_CFLAGS += -O2
LOCAL_MODULE:= libft2
diff --git a/include/freetype/config/ftconfig.h b/include/freetype/config/ftconfig.h
index 8336be5..3c0b8b1 100644
--- a/include/freetype/config/ftconfig.h
+++ b/include/freetype/config/ftconfig.h
@@ -4,7 +4,7 @@
/* */
/* ANSI-specific configuration file (specification only). */
/* */
-/* Copyright 1996-2001, 2002, 2003, 2004, 2006, 2007 by */
+/* Copyright 1996-2001, 2002, 2003, 2004, 2006, 2007, 2008 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -43,8 +43,10 @@
#include FT_CONFIG_OPTIONS_H
#include FT_CONFIG_STANDARD_LIBRARY_H
+
FT_BEGIN_HEADER
+
/*************************************************************************/
/* */
/* PLATFORM-SPECIFIC CONFIGURATION MACROS */
@@ -133,6 +135,14 @@ FT_BEGIN_HEADER
#else
#define FT_MACINTOSH 1
#endif
+
+#elif defined( __SC__ ) || defined( __MRC__ )
+ /* Classic MacOS compilers */
+#include "ConditionalMacros.h"
+#if TARGET_OS_MAC
+#define FT_MACINTOSH 1
+#endif
+
#endif
@@ -164,6 +174,7 @@ FT_BEGIN_HEADER
/* A typedef for a 16bit unsigned integer type. */
/* */
typedef unsigned short FT_UInt16;
+
/* */
@@ -210,6 +221,7 @@ FT_BEGIN_HEADER
#error "no 32bit type found -- please check your configuration files"
#endif
+
/* look up an integer type that is at least 32 bits */
#if FT_SIZEOF_INT >= (32 / FT_CHAR_BIT)
@@ -223,68 +235,6 @@ FT_BEGIN_HEADER
#endif
-#if !defined(FT_CONFIG_OPTION_NO_ASSEMBLER)
-/* provide assembler fragments for performance-critical
- * functions. these must be defined static __inline__
- * with GCC
- */
-#if defined(__GNUC__)
-
-# if defined(__arm__) && !defined(__thumb__)
-# define FT_MULFIX_ASSEMBLER FT_MulFix_arm
- static __inline__ FT_Int32
- FT_MulFix_arm( FT_Int32 a, FT_Int32 b )
- {
- register FT_Int32 t, t2;
- asm __volatile__ (
- "smull %1, %2, %4, %3\n\t" /* (lo=%1,hi=%2) = a*b */
- "mov %0, %2, asr #31\n\t" /* %0 = (hi >> 31) */
- "add %0, %0, #0x8000\n\t" /* %0 += 0x8000 */
- "adds %1, %1, %0\n\t" /* %1 += %0 */
- "adc %2, %2, #0\n\t" /* %2 += carry */
- "mov %0, %1, lsr #16\n\t" /* %0 = %1 >> 16 */
- "orr %0, %2, lsl #16\n\t" /* %0 |= %2 << 16 */
- : "=r"(a), "=&r"(t2), "=&r"(t)
- : "r"(a), "r"(b)
- );
- return a;
- }
-# endif
-
-# if defined(i386)
-# define FT__MULFIX_ASSEMBLER FT_MulFix_i386
- static __inline__ FT_Int32
- FT_MulFix_i386( FT_Int32 a, FT_Int32 b )
- {
- register FT_Int32 result;
-
- __asm__ __volatile__ (
- "imul %%edx\n"
- "movl %%edx, %%ecx\n"
- "sarl $31, %%ecx\n"
- "addl $0x8000, %%ecx\n"
- "addl %%ecx, %%eax\n"
- "adcl $0, %%edx\n"
- "shrl $16, %%eax\n"
- "shll $16, %%edx\n"
- "addl %%edx, %%eax\n"
- : "=a"(result)
- : "a"(a), "d"(b)
- : "%ecx"
- );
- return result;
- }
-# endif
-
-#endif /* __GNUC__ */
-#endif /* !NO_ASSEMBLER */
-
-#ifdef FT_CONFIG_OPTION_INLINE_MULFIX
-# ifdef FT_MULFIX_ASSEMBLER
-# define FT_MULFIX_INLINED FT_MULFIX_ASSEMBLER
-# endif
-#endif
-
/* determine whether we have a 64-bit int type for platforms without */
/* Autoconf */
@@ -327,17 +277,12 @@ FT_BEGIN_HEADER
#endif /* FT_SIZEOF_LONG == (64 / FT_CHAR_BIT) */
-#define FT_BEGIN_STMNT do {
-#define FT_END_STMNT } while ( 0 )
-#define FT_DUMMY_STMNT FT_BEGIN_STMNT FT_END_STMNT
-
-
/*************************************************************************/
/* */
/* A 64-bit data type will create compilation problems if you compile */
- /* in strict ANSI mode. To avoid them, we disable their use if */
- /* __STDC__ is defined. You can however ignore this rule by */
- /* defining the FT_CONFIG_OPTION_FORCE_INT64 configuration macro. */
+ /* in strict ANSI mode. To avoid them, we disable its use if __STDC__ */
+ /* is defined. You can however ignore this rule by defining the */
+ /* FT_CONFIG_OPTION_FORCE_INT64 configuration macro. */
/* */
#if defined( FT_LONG64 ) && !defined( FT_CONFIG_OPTION_FORCE_INT64 )
@@ -352,6 +297,86 @@ FT_BEGIN_HEADER
#endif /* FT_LONG64 && !FT_CONFIG_OPTION_FORCE_INT64 */
+#define FT_BEGIN_STMNT do {
+#define FT_END_STMNT } while ( 0 )
+#define FT_DUMMY_STMNT FT_BEGIN_STMNT FT_END_STMNT
+
+
+#ifndef FT_CONFIG_OPTION_NO_ASSEMBLER
+ /* Provide assembler fragments for performance-critical functions. */
+ /* These must be defined `static __inline__' with GCC. */
+
+#ifdef __GNUC__
+
+#if defined( __arm__ ) && !defined( __thumb__ )
+#define FT_MULFIX_ASSEMBLER FT_MulFix_arm
+
+ /* documentation is in freetype.h */
+
+ static __inline__ FT_Int32
+ FT_MulFix_arm( FT_Int32 a,
+ FT_Int32 b )
+ {
+ register FT_Int32 t, t2;
+
+
+ asm __volatile__ (
+ "smull %1, %2, %4, %3\n\t" /* (lo=%1,hi=%2) = a*b */
+ "mov %0, %2, asr #31\n\t" /* %0 = (hi >> 31) */
+ "add %0, %0, #0x8000\n\t" /* %0 += 0x8000 */
+ "adds %1, %1, %0\n\t" /* %1 += %0 */
+ "adc %2, %2, #0\n\t" /* %2 += carry */
+ "mov %0, %1, lsr #16\n\t" /* %0 = %1 >> 16 */
+ "orr %0, %2, lsl #16\n\t" /* %0 |= %2 << 16 */
+ : "=r"(a), "=&r"(t2), "=&r"(t)
+ : "r"(a), "r"(b) );
+ return a;
+ }
+
+#endif /* __arm__ && !__thumb__ */
+
+#if defined( i386 )
+#define FT_MULFIX_ASSEMBLER FT_MulFix_i386
+
+ /* documentation is in freetype.h */
+
+ static __inline__ FT_Int32
+ FT_MulFix_i386( FT_Int32 a,
+ FT_Int32 b )
+ {
+ register FT_Int32 result;
+
+
+ __asm__ __volatile__ (
+ "imul %%edx\n"
+ "movl %%edx, %%ecx\n"
+ "sarl $31, %%ecx\n"
+ "addl $0x8000, %%ecx\n"
+ "addl %%ecx, %%eax\n"
+ "adcl $0, %%edx\n"
+ "shrl $16, %%eax\n"
+ "shll $16, %%edx\n"
+ "addl %%edx, %%eax\n"
+ : "=a"(result), "=d"(b)
+ : "a"(a), "d"(b)
+ : "%ecx", "cc" );
+ return result;
+ }
+
+#endif /* i386 */
+
+#endif /* __GNUC__ */
+
+#endif /* !FT_CONFIG_OPTION_NO_ASSEMBLER */
+
+
+#ifdef FT_CONFIG_OPTION_INLINE_MULFIX
+#ifdef FT_MULFIX_ASSEMBLER
+#define FT_MULFIX_INLINED FT_MULFIX_ASSEMBLER
+#endif
+#endif
+
+
#ifdef FT_MAKE_OPTION_SINGLE_OBJECT
#define FT_LOCAL( x ) static x
@@ -384,7 +409,7 @@ FT_BEGIN_HEADER
#ifndef FT_BASE_DEF
#ifdef __cplusplus
-#define FT_BASE_DEF( x ) extern "C" x
+#define FT_BASE_DEF( x ) x
#else
#define FT_BASE_DEF( x ) x
#endif
diff --git a/include/freetype/config/ftheader.h b/include/freetype/config/ftheader.h
index 0279a3f..b63945d 100644
--- a/include/freetype/config/ftheader.h
+++ b/include/freetype/config/ftheader.h
@@ -74,7 +74,7 @@
/* */
/* <Description> */
/* The following macros are defined to the name of specific */
- /* FreeType 2 header files. They can be used directly in #include */
+ /* FreeType~2 header files. They can be used directly in #include */
/* statements as in: */
/* */
/* { */
@@ -85,11 +85,11 @@
/* */
/* There are several reasons why we are now using macros to name */
/* public header files. The first one is that such macros are not */
- /* limited to the infamous 8.3 naming rule required by DOS (and */
+ /* limited to the infamous 8.3~naming rule required by DOS (and */
/* `FT_MULTIPLE_MASTERS_H' is a lot more meaningful than `ftmm.h'). */
/* */
/* The second reason is that it allows for more flexibility in the */
- /* way FreeType 2 is installed on a given system. */
+ /* way FreeType~2 is installed on a given system. */
/* */
/*************************************************************************/
@@ -103,7 +103,7 @@
*
* @description:
* A macro used in #include statements to name the file containing
- * FreeType 2 configuration data.
+ * FreeType~2 configuration data.
*
*/
#ifndef FT_CONFIG_CONFIG_H
@@ -118,7 +118,7 @@
*
* @description:
* A macro used in #include statements to name the file containing
- * FreeType 2 interface to the standard C library functions.
+ * FreeType~2 interface to the standard C library functions.
*
*/
#ifndef FT_CONFIG_STANDARD_LIBRARY_H
@@ -133,7 +133,7 @@
*
* @description:
* A macro used in #include statements to name the file containing
- * FreeType 2 project-specific configuration options.
+ * FreeType~2 project-specific configuration options.
*
*/
#ifndef FT_CONFIG_OPTIONS_H
@@ -148,7 +148,7 @@
*
* @description:
* A macro used in #include statements to name the file containing the
- * list of FreeType 2 modules that are statically linked to new library
+ * list of FreeType~2 modules that are statically linked to new library
* instances in @FT_Init_FreeType.
*
*/
@@ -167,7 +167,7 @@
*
* @description:
* A macro used in #include statements to name the file containing the
- * base FreeType 2 API.
+ * base FreeType~2 API.
*
*/
#define FT_FREETYPE_H <freetype/freetype.h>
@@ -180,7 +180,7 @@
*
* @description:
* A macro used in #include statements to name the file containing the
- * list of FreeType 2 error codes (and messages).
+ * list of FreeType~2 error codes (and messages).
*
* It is included by @FT_FREETYPE_H.
*
@@ -195,7 +195,7 @@
*
* @description:
* A macro used in #include statements to name the file containing the
- * list of FreeType 2 module error offsets (and messages).
+ * list of FreeType~2 module error offsets (and messages).
*
*/
#define FT_MODULE_ERRORS_H <freetype/ftmoderr.h>
@@ -208,7 +208,7 @@
*
* @description:
* A macro used in #include statements to name the file containing the
- * FreeType 2 interface to low-level operations (i.e., memory management
+ * FreeType~2 interface to low-level operations (i.e., memory management
* and stream i/o).
*
* It is included by @FT_FREETYPE_H.
@@ -240,7 +240,7 @@
*
* @description:
* A macro used in #include statements to name the file containing the
- * basic data types defined by FreeType 2.
+ * basic data types defined by FreeType~2.
*
* It is included by @FT_FREETYPE_H.
*
@@ -255,7 +255,7 @@
*
* @description:
* A macro used in #include statements to name the file containing the
- * list management API of FreeType 2.
+ * list management API of FreeType~2.
*
* (Most applications will never need to include this file.)
*
@@ -270,7 +270,7 @@
*
* @description:
* A macro used in #include statements to name the file containing the
- * scalable outline management API of FreeType 2.
+ * scalable outline management API of FreeType~2.
*
*/
#define FT_OUTLINE_H <freetype/ftoutln.h>
@@ -296,7 +296,7 @@
*
* @description:
* A macro used in #include statements to name the file containing the
- * module management API of FreeType 2.
+ * module management API of FreeType~2.
*
*/
#define FT_MODULE_H <freetype/ftmodapi.h>
@@ -309,7 +309,7 @@
*
* @description:
* A macro used in #include statements to name the file containing the
- * renderer module management API of FreeType 2.
+ * renderer module management API of FreeType~2.
*
*/
#define FT_RENDER_H <freetype/ftrender.h>
@@ -322,7 +322,7 @@
*
* @description:
* A macro used in #include statements to name the file containing the
- * types and API specific to the Type 1 format.
+ * types and API specific to the Type~1 format.
*
*/
#define FT_TYPE1_TABLES_H <freetype/t1tables.h>
@@ -382,6 +382,8 @@
*
*/
#define FT_BDF_H <freetype/ftbdf.h>
+
+
/*************************************************************************
*
* @macro:
@@ -481,7 +483,7 @@
*
* @description:
* A macro used in #include statements to name the file containing the
- * API of the optional FreeType 2 cache sub-system.
+ * API of the optional FreeType~2 cache sub-system.
*
*/
#define FT_CACHE_H <freetype/ftcache.h>
@@ -494,7 +496,7 @@
*
* @description:
* A macro used in #include statements to name the file containing the
- * `glyph image' API of the FreeType 2 cache sub-system.
+ * `glyph image' API of the FreeType~2 cache sub-system.
*
* It is used to define a cache for @FT_Glyph elements. You can also
* use the API defined in @FT_CACHE_SMALL_BITMAPS_H if you only need to
@@ -514,7 +516,7 @@
*
* @description:
* A macro used in #include statements to name the file containing the
- * `small bitmaps' API of the FreeType 2 cache sub-system.
+ * `small bitmaps' API of the FreeType~2 cache sub-system.
*
* It is used to define a cache for small glyph bitmaps in a relatively
* memory-efficient way. You can also use the API defined in
@@ -535,7 +537,7 @@
*
* @description:
* A macro used in #include statements to name the file containing the
- * `charmap' API of the FreeType 2 cache sub-system.
+ * `charmap' API of the FreeType~2 cache sub-system.
*
* This macro is deprecated. Simply include @FT_CACHE_H to have all
* charmap-based cache declarations.
@@ -551,7 +553,7 @@
*
* @description:
* A macro used in #include statements to name the file containing the
- * Macintosh-specific FreeType 2 API. The latter is used to access
+ * Macintosh-specific FreeType~2 API. The latter is used to access
* fonts embedded in resource forks.
*
* This header file must be explicitly included by client applications
@@ -568,7 +570,7 @@
*
* @description:
* A macro used in #include statements to name the file containing the
- * optional multiple-masters management API of FreeType 2.
+ * optional multiple-masters management API of FreeType~2.
*
*/
#define FT_MULTIPLE_MASTERS_H <freetype/ftmm.h>
@@ -581,7 +583,7 @@
*
* @description:
* A macro used in #include statements to name the file containing the
- * optional FreeType 2 API which accesses embedded `name' strings in
+ * optional FreeType~2 API which accesses embedded `name' strings in
* SFNT-based font formats (i.e., TrueType and OpenType).
*
*/
@@ -595,7 +597,7 @@
*
* @description:
* A macro used in #include statements to name the file containing the
- * optional FreeType 2 API which validates OpenType tables (BASE, GDEF,
+ * optional FreeType~2 API which validates OpenType tables (BASE, GDEF,
* GPOS, GSUB, JSTF).
*
*/
@@ -609,7 +611,7 @@
*
* @description:
* A macro used in #include statements to name the file containing the
- * optional FreeType 2 API which validates TrueTypeGX/AAT tables (feat,
+ * optional FreeType~2 API which validates TrueTypeGX/AAT tables (feat,
* mort, morx, bsln, just, kern, opbd, trak, prop).
*
*/
@@ -623,7 +625,7 @@
*
* @description:
* A macro used in #include statements to name the file containing the
- * FreeType 2 API which accesses PFR-specific data.
+ * FreeType~2 API which accesses PFR-specific data.
*
*/
#define FT_PFR_H <freetype/ftpfr.h>
@@ -636,7 +638,7 @@
*
* @description:
* A macro used in #include statements to name the file containing the
- * FreeType 2 API which provides functions to stroke outline paths.
+ * FreeType~2 API which provides functions to stroke outline paths.
*/
#define FT_STROKER_H <freetype/ftstroke.h>
@@ -648,7 +650,7 @@
*
* @description:
* A macro used in #include statements to name the file containing the
- * FreeType 2 API which performs artificial obliquing and emboldening.
+ * FreeType~2 API which performs artificial obliquing and emboldening.
*/
#define FT_SYNTHESIS_H <freetype/ftsynth.h>
@@ -660,7 +662,7 @@
*
* @description:
* A macro used in #include statements to name the file containing the
- * FreeType 2 API which provides functions specific to the XFree86 and
+ * FreeType~2 API which provides functions specific to the XFree86 and
* X.Org X11 servers.
*/
#define FT_XFREE86_H <freetype/ftxf86.h>
@@ -673,7 +675,7 @@
*
* @description:
* A macro used in #include statements to name the file containing the
- * FreeType 2 API which performs trigonometric computations (e.g.,
+ * FreeType~2 API which performs trigonometric computations (e.g.,
* cosines and arc tangents).
*/
#define FT_TRIGONOMETRY_H <freetype/fttrigon.h>
@@ -686,7 +688,7 @@
*
* @description:
* A macro used in #include statements to name the file containing the
- * FreeType 2 API which performs color filtering for subpixel rendering.
+ * FreeType~2 API which performs color filtering for subpixel rendering.
*/
#define FT_LCD_FILTER_H <freetype/ftlcdfil.h>
@@ -698,7 +700,7 @@
*
* @description:
* A macro used in #include statements to name the file containing the
- * FreeType 2 API which performs color filtering for subpixel rendering.
+ * FreeType~2 API which performs color filtering for subpixel rendering.
*/
#define FT_UNPATENTED_HINTING_H <freetype/ttunpat.h>
@@ -710,7 +712,7 @@
*
* @description:
* A macro used in #include statements to name the file containing the
- * FreeType 2 API which performs color filtering for subpixel rendering.
+ * FreeType~2 API which performs color filtering for subpixel rendering.
*/
#define FT_INCREMENTAL_H <freetype/ftincrem.h>
@@ -722,7 +724,7 @@
*
* @description:
* A macro used in #include statements to name the file containing the
- * FreeType 2 API which returns entries from the TrueType GASP table.
+ * FreeType~2 API which returns entries from the TrueType GASP table.
*/
#define FT_GASP_H <freetype/ftgasp.h>
@@ -734,9 +736,10 @@
*
* @description:
* A macro used in #include statements to name the file containing the
- * FreeType 2 API which returns individual and ranged glyph advances
+ * FreeType~2 API which returns individual and ranged glyph advances.
*/
-#define FT_ADVANCES_H <freetype/ftadvanc.h>
+#define FT_ADVANCES_H <freetype/ftadvanc.h>
+
/* */
diff --git a/include/freetype/config/ftmodule.h b/include/freetype/config/ftmodule.h
index 4b629bb..e145790 100644
--- a/include/freetype/config/ftmodule.h
+++ b/include/freetype/config/ftmodule.h
@@ -10,15 +10,15 @@
*
*/
-FT_USE_MODULE(autofit_module_class)
-FT_USE_MODULE(tt_driver_class)
-FT_USE_MODULE(cff_driver_class)
-FT_USE_MODULE(psnames_module_class)
-FT_USE_MODULE(pshinter_module_class)
-FT_USE_MODULE(ft_raster1_renderer_class)
-FT_USE_MODULE(sfnt_module_class)
-FT_USE_MODULE(ft_smooth_renderer_class)
-FT_USE_MODULE(ft_smooth_lcd_renderer_class)
-FT_USE_MODULE(ft_smooth_lcdv_renderer_class)
+FT_USE_MODULE( FT_Module_Class, autofit_module_class )
+FT_USE_MODULE( FT_Driver_ClassRec, tt_driver_class )
+FT_USE_MODULE( FT_Driver_ClassRec, cff_driver_class )
+FT_USE_MODULE( FT_Module_Class, psnames_module_class )
+FT_USE_MODULE( FT_Module_Class, pshinter_module_class )
+FT_USE_MODULE( FT_Renderer_Class, ft_raster1_renderer_class )
+FT_USE_MODULE( FT_Module_Class, sfnt_module_class )
+FT_USE_MODULE( FT_Renderer_Class, ft_smooth_renderer_class )
+FT_USE_MODULE( FT_Renderer_Class, ft_smooth_lcd_renderer_class )
+FT_USE_MODULE( FT_Renderer_Class, ft_smooth_lcdv_renderer_class )
/* EOF */
diff --git a/include/freetype/config/ftoption.h b/include/freetype/config/ftoption.h
index a92e19b..597a2bb 100644
--- a/include/freetype/config/ftoption.h
+++ b/include/freetype/config/ftoption.h
@@ -112,25 +112,26 @@ FT_BEGIN_HEADER
/* file `ftconfig.h' either statically or through the */
/* `configure' script on supported platforms. */
/* */
-#undef FT_CONFIG_OPTION_FORCE_INT64
+#undef FT_CONFIG_OPTION_FORCE_INT64
/*************************************************************************/
/* */
- /* When this macro is defined, do not try to use an assembler version */
- /* of performance-critical functions (e.g. FT_MulFix). you should only */
- /* do that to verify that the assembler function works properly, or even */
- /* to benchmarks the various implementations... */
+ /* If this macro is defined, do not try to use an assembler version of */
+ /* performance-critical functions (e.g. FT_MulFix). You should only do */
+ /* that to verify that the assembler function works properly, or to */
+ /* execute benchmark tests of the various implementations. */
/* #define FT_CONFIG_OPTION_NO_ASSEMBLER */
+
/*************************************************************************/
/* */
- /* When this macro is defined, try to use an inlined assembler version */
- /* of the FT_MulFix function, which appears to be a hotspot when loading */
- /* and hinting glyphs. */
+ /* If this macro is defined, try to use an inlined assembler version of */
+ /* the `FT_MulFix' function, which is a `hotspot' when loading and */
+ /* hinting glyphs, and which should be executed as fast as possible. */
/* */
- /* note that if your compiler/cpu isn't supported, this will default to */
- /* the standard and portable implementation found in src/base/ftcalc.c */
+ /* Note that if your compiler or CPU is not supported, this will default */
+ /* to the standard and portable implementation found in `ftcalc.c'. */
/* */
#define FT_CONFIG_OPTION_INLINE_MULFIX
@@ -183,7 +184,7 @@ FT_BEGIN_HEADER
/* Do not #undef this macro here since the build system might define */
/* it for certain configurations only. */
/* */
-/* #define FT_CONFIG_OPTION_SYSTEM_ZLIB */
+/* #define FT_CONFIG_OPTION_SYSTEM_ZLIB */
/*************************************************************************/
@@ -224,27 +225,27 @@ FT_BEGIN_HEADER
/* Do not #undef these macros here since the build system might define */
/* them for certain configurations only. */
/* */
-/* #define FT_EXPORT(x) extern x */
-/* #define FT_EXPORT_DEF(x) x */
+/* #define FT_EXPORT(x) extern x */
+/* #define FT_EXPORT_DEF(x) x */
/*************************************************************************/
/* */
/* Glyph Postscript Names handling */
/* */
- /* By default, FreeType 2 is compiled with the `PSNames' module. This */
+ /* By default, FreeType 2 is compiled with the `psnames' module. 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 */
+ /* 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 */
+ /* - The Type 1 driver will not be able to synthesize a Unicode */
/* charmap out of the glyphs found in the fonts. */
/* */
/* You would normally undefine this configuration macro when building */
@@ -260,12 +261,12 @@ FT_BEGIN_HEADER
/* 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 */
+ /* synthesize 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 */
+ /* able to synthesize a Unicode charmap out of the glyphs found in the */
/* fonts. */
/* */
#define FT_CONFIG_OPTION_ADOBE_GLYPH_LIST
@@ -487,9 +488,9 @@ FT_BEGIN_HEADER
/* If you define TT_CONFIG_OPTION_UNPATENTED_HINTING, a special version */
/* of the TrueType bytecode interpreter is used that doesn't implement */
/* any of the patented opcodes and algorithms. Note that the */
- /* the TT_CONFIG_OPTION_UNPATENTED_HINTING macro is *ignored* if you */
- /* define TT_CONFIG_OPTION_BYTECODE_INTERPRETER; with other words, */
- /* either define TT_CONFIG_OPTION_BYTECODE_INTERPRETER or */
+ /* TT_CONFIG_OPTION_UNPATENTED_HINTING macro is *ignored* if you define */
+ /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER; in other words, either define */
+ /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER or */
/* TT_CONFIG_OPTION_UNPATENTED_HINTING but not both at the same time. */
/* */
/* This macro is only useful for a small number of font files (mostly */
@@ -673,11 +674,12 @@ FT_BEGIN_HEADER
/*
- * This variable is defined if either unpatented or native TrueType
+ * This macro is defined if either unpatented or native TrueType
* hinting is requested by the definitions above.
*/
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
#define TT_USE_BYTECODE_INTERPRETER
+#undef TT_CONFIG_OPTION_UNPATENTED_HINTING
#elif defined TT_CONFIG_OPTION_UNPATENTED_HINTING
#define TT_USE_BYTECODE_INTERPRETER
#endif
diff --git a/include/freetype/config/ftstdlib.h b/include/freetype/config/ftstdlib.h
index f923f3e..ce5557a 100644
--- a/include/freetype/config/ftstdlib.h
+++ b/include/freetype/config/ftstdlib.h
@@ -5,7 +5,7 @@
/* ANSI-specific library and header configuration file (specification */
/* only). */
/* */
-/* Copyright 2002, 2003, 2004, 2005, 2006, 2007 by */
+/* Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -54,12 +54,6 @@
/* In these case, `ftconfig.h' will refuse to compile anyway with a */
/* message like `couldn't find 32-bit type' or something similar. */
/* */
- /* IMPORTANT NOTE: We do not define aliases for heap management and */
- /* i/o routines (i.e. malloc/free/fopen/fread/...) */
- /* since these functions should all be encapsulated */
- /* by platform-specific implementations of */
- /* `ftsystem.c'. */
- /* */
/**********************************************************************/
@@ -124,8 +118,6 @@
#define ft_qsort qsort
-#define ft_exit exit /* only used to exit from unhandled exceptions */
-
/**********************************************************************/
/* */
diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h
index a569f5d..364388b 100644
--- a/include/freetype/freetype.h
+++ b/include/freetype/freetype.h
@@ -4,7 +4,7 @@
/* */
/* FreeType high-level API and common types (specification only). */
/* */
-/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by */
+/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -25,14 +25,6 @@
#endif
- /*************************************************************************/
- /* */
- /* The `raster' component duplicates some of the declarations in */
- /* freetype.h for stand-alone use if _FREETYPE_ isn't defined. */
- /* */
- /*************************************************************************/
-
-
#ifndef __FREETYPE_H__
#define __FREETYPE_H__
@@ -60,8 +52,8 @@ FT_BEGIN_HEADER
/* */
/* <Description> */
/* FreeType assumes that structures allocated by the user and passed */
- /* as arguments are zeroed out except for the actual data. With */
- /* other words, it is recommended to use `calloc' (or variants of it) */
+ /* as arguments are zeroed out except for the actual data. In other */
+ /* words, it is recommended to use `calloc' (or variants of it) */
/* instead of `malloc' for allocation. */
/* */
/*************************************************************************/
@@ -86,10 +78,10 @@ FT_BEGIN_HEADER
/* Base Interface */
/* */
/* <Abstract> */
- /* The FreeType 2 base font interface. */
+ /* The FreeType~2 base font interface. */
/* */
/* <Description> */
- /* This section describes the public high-level API of FreeType 2. */
+ /* This section describes the public high-level API of FreeType~2. */
/* */
/* <Order> */
/* FT_Library */
@@ -191,6 +183,15 @@ FT_BEGIN_HEADER
/* FT_Set_Charmap */
/* FT_Get_Charmap_Index */
/* */
+ /* FT_FSTYPE_INSTALLABLE_EMBEDDING */
+ /* FT_FSTYPE_RESTRICTED_LICENSE_EMBEDDING */
+ /* FT_FSTYPE_PREVIEW_AND_PRINT_EMBEDDING */
+ /* FT_FSTYPE_EDITABLE_EMBEDDING */
+ /* FT_FSTYPE_NO_SUBSETTING */
+ /* FT_FSTYPE_BITMAP_EMBEDDING_ONLY */
+ /* */
+ /* FT_Get_FSType_Flags */
+ /* */
/*************************************************************************/
@@ -386,8 +387,8 @@ FT_BEGIN_HEADER
/* Use @FT_Done_Face to destroy it (along with its slot and sizes). */
/* */
/* <Also> */
- /* The @FT_FaceRec details the publicly accessible fields of a given */
- /* face object. */
+ /* See @FT_FaceRec for the publicly accessible fields of a given face */
+ /* object. */
/* */
typedef struct FT_FaceRec_* FT_Face;
@@ -416,8 +417,8 @@ FT_BEGIN_HEADER
/* activated at any given time per face. */
/* */
/* <Also> */
- /* The @FT_SizeRec structure details the publicly accessible fields */
- /* of a given size object. */
+ /* See @FT_SizeRec for the publicly accessible fields of a given size */
+ /* object. */
/* */
typedef struct FT_SizeRec_* FT_Size;
@@ -429,7 +430,7 @@ FT_BEGIN_HEADER
/* */
/* <Description> */
/* A handle to a given `glyph slot'. A slot is a container where it */
- /* is possible to load any one of the glyphs contained in its parent */
+ /* is possible to load any of the glyphs contained in its parent */
/* face. */
/* */
/* In other words, each time you call @FT_Load_Glyph or */
@@ -438,7 +439,7 @@ FT_BEGIN_HEADER
/* other control information. */
/* */
/* <Also> */
- /* @FT_GlyphSlotRec details the publicly accessible glyph fields. */
+ /* See @FT_GlyphSlotRec for the publicly accessible glyph fields. */
/* */
typedef struct FT_GlyphSlotRec_* FT_GlyphSlot;
@@ -469,8 +470,8 @@ FT_BEGIN_HEADER
/* the list and automatically activates it. */
/* */
/* <Also> */
- /* The @FT_CharMapRec details the publicly accessible fields of a */
- /* given character map. */
+ /* See @FT_CharMapRec for the publicly accessible fields of a given */
+ /* character map. */
/* */
typedef struct FT_CharMapRec_* FT_CharMap;
@@ -485,7 +486,7 @@ FT_BEGIN_HEADER
/* used to define `encoding' identifiers (see @FT_Encoding). */
/* */
/* <Note> */
- /* Since many 16bit compilers don't like 32bit enumerations, you */
+ /* Since many 16-bit compilers don't like 32-bit enumerations, you */
/* should redefine this macro in case of problems to something like */
/* this: */
/* */
@@ -526,123 +527,123 @@ FT_BEGIN_HEADER
/* Other encodings might be defined in the future. */
/* */
/* <Values> */
- /* FT_ENCODING_NONE :: */
- /* The encoding value 0 is reserved. */
+ /* FT_ENCODING_NONE :: */
+ /* The encoding value~0 is reserved. */
/* */
- /* FT_ENCODING_UNICODE :: */
- /* Corresponds to the Unicode character set. This value covers */
- /* all versions of the Unicode repertoire, including ASCII and */
- /* Latin-1. Most fonts include a Unicode charmap, but not all */
- /* of them. */
+ /* FT_ENCODING_UNICODE :: */
+ /* Corresponds to the Unicode character set. This value covers */
+ /* all versions of the Unicode repertoire, including ASCII and */
+ /* Latin-1. Most fonts include a Unicode charmap, but not all */
+ /* of them. */
/* */
- /* FT_ENCODING_MS_SYMBOL :: */
- /* Corresponds to the Microsoft Symbol encoding, used to encode */
- /* mathematical symbols in the 32..255 character code range. For */
- /* more information, see `http://www.ceviz.net/symbol.htm'. */
+ /* FT_ENCODING_MS_SYMBOL :: */
+ /* Corresponds to the Microsoft Symbol encoding, used to encode */
+ /* mathematical symbols in the 32..255 character code range. For */
+ /* more information, see `http://www.ceviz.net/symbol.htm'. */
/* */
- /* FT_ENCODING_SJIS :: */
- /* Corresponds to Japanese SJIS encoding. More info at */
- /* at `http://langsupport.japanreference.com/encoding.shtml'. */
- /* See note on multi-byte encodings below. */
+ /* FT_ENCODING_SJIS :: */
+ /* Corresponds to Japanese SJIS encoding. More info at */
+ /* at `http://langsupport.japanreference.com/encoding.shtml'. */
+ /* See note on multi-byte encodings below. */
/* */
- /* FT_ENCODING_GB2312 :: */
- /* Corresponds to an encoding system for Simplified Chinese as used */
- /* used in mainland China. */
+ /* FT_ENCODING_GB2312 :: */
+ /* Corresponds to an encoding system for Simplified Chinese as used */
+ /* used in mainland China. */
/* */
- /* FT_ENCODING_BIG5 :: */
- /* Corresponds to an encoding system for Traditional Chinese as used */
- /* in Taiwan and Hong Kong. */
+ /* FT_ENCODING_BIG5 :: */
+ /* Corresponds to an encoding system for Traditional Chinese as */
+ /* used in Taiwan and Hong Kong. */
/* */
- /* FT_ENCODING_WANSUNG :: */
- /* Corresponds to the Korean encoding system known as Wansung. */
- /* For more information see */
- /* `http://www.microsoft.com/typography/unicode/949.txt'. */
+ /* FT_ENCODING_WANSUNG :: */
+ /* Corresponds to the Korean encoding system known as Wansung. */
+ /* For more information see */
+ /* `http://www.microsoft.com/typography/unicode/949.txt'. */
/* */
- /* FT_ENCODING_JOHAB :: */
- /* The Korean standard character set (KS C-5601-1992), which */
- /* corresponds to MS Windows code page 1361. This character set */
- /* includes all possible Hangeul character combinations. */
+ /* FT_ENCODING_JOHAB :: */
+ /* The Korean standard character set (KS~C 5601-1992), which */
+ /* corresponds to MS Windows code page 1361. This character set */
+ /* includes all possible Hangeul character combinations. */
/* */
- /* FT_ENCODING_ADOBE_LATIN_1 :: */
- /* Corresponds to a Latin-1 encoding as defined in a Type 1 */
- /* Postscript font. It is limited to 256 character codes. */
+ /* FT_ENCODING_ADOBE_LATIN_1 :: */
+ /* Corresponds to a Latin-1 encoding as defined in a Type~1 */
+ /* PostScript font. It is limited to 256 character codes. */
/* */
- /* FT_ENCODING_ADOBE_STANDARD :: */
- /* Corresponds to the Adobe Standard encoding, as found in Type 1, */
- /* CFF, and OpenType/CFF fonts. It is limited to 256 character */
- /* codes. */
+ /* FT_ENCODING_ADOBE_STANDARD :: */
+ /* Corresponds to the Adobe Standard encoding, as found in Type~1, */
+ /* CFF, and OpenType/CFF fonts. It is limited to 256 character */
+ /* codes. */
/* */
- /* FT_ENCODING_ADOBE_EXPERT :: */
- /* Corresponds to the Adobe Expert encoding, as found in Type 1, */
- /* CFF, and OpenType/CFF fonts. It is limited to 256 character */
- /* codes. */
+ /* FT_ENCODING_ADOBE_EXPERT :: */
+ /* Corresponds to the Adobe Expert encoding, as found in Type~1, */
+ /* CFF, and OpenType/CFF fonts. It is limited to 256 character */
+ /* codes. */
/* */
- /* FT_ENCODING_ADOBE_CUSTOM :: */
- /* Corresponds to a custom encoding, as found in Type 1, CFF, and */
- /* OpenType/CFF fonts. It is limited to 256 character codes. */
+ /* FT_ENCODING_ADOBE_CUSTOM :: */
+ /* Corresponds to a custom encoding, as found in Type~1, CFF, and */
+ /* OpenType/CFF fonts. It is limited to 256 character codes. */
/* */
- /* FT_ENCODING_APPLE_ROMAN :: */
- /* Corresponds to the 8-bit Apple roman encoding. Many TrueType and */
- /* OpenType fonts contain a charmap for this encoding, since older */
- /* versions of Mac OS are able to use it. */
+ /* FT_ENCODING_APPLE_ROMAN :: */
+ /* Corresponds to the 8-bit Apple roman encoding. Many TrueType */
+ /* and OpenType fonts contain a charmap for this encoding, since */
+ /* older versions of Mac OS are able to use it. */
/* */
- /* FT_ENCODING_OLD_LATIN_2 :: */
- /* This value is deprecated and was never used nor reported by */
- /* FreeType. Don't use or test for it. */
+ /* FT_ENCODING_OLD_LATIN_2 :: */
+ /* This value is deprecated and was never used nor reported by */
+ /* FreeType. Don't use or test for it. */
/* */
- /* FT_ENCODING_MS_SJIS :: */
- /* Same as FT_ENCODING_SJIS. Deprecated. */
+ /* FT_ENCODING_MS_SJIS :: */
+ /* Same as FT_ENCODING_SJIS. Deprecated. */
/* */
- /* FT_ENCODING_MS_GB2312 :: */
- /* Same as FT_ENCODING_GB2312. Deprecated. */
+ /* FT_ENCODING_MS_GB2312 :: */
+ /* Same as FT_ENCODING_GB2312. Deprecated. */
/* */
- /* FT_ENCODING_MS_BIG5 :: */
- /* Same as FT_ENCODING_BIG5. Deprecated. */
+ /* FT_ENCODING_MS_BIG5 :: */
+ /* Same as FT_ENCODING_BIG5. Deprecated. */
/* */
- /* FT_ENCODING_MS_WANSUNG :: */
- /* Same as FT_ENCODING_WANSUNG. Deprecated. */
+ /* FT_ENCODING_MS_WANSUNG :: */
+ /* Same as FT_ENCODING_WANSUNG. Deprecated. */
/* */
- /* FT_ENCODING_MS_JOHAB :: */
- /* Same as FT_ENCODING_JOHAB. Deprecated. */
+ /* FT_ENCODING_MS_JOHAB :: */
+ /* Same as FT_ENCODING_JOHAB. Deprecated. */
/* */
/* <Note> */
- /* By default, FreeType automatically synthetizes a Unicode charmap */
- /* for Postscript fonts, using their glyph names dictionaries. */
- /* However, it also reports the encodings defined explicitly in the */
- /* font file, for the cases when they are needed, with the Adobe */
- /* values as well. */
- /* */
- /* FT_ENCODING_NONE is set by the BDF and PCF drivers if the charmap */
- /* is neither Unicode nor ISO-8859-1 (otherwise it is set to */
- /* FT_ENCODING_UNICODE). Use @FT_Get_BDF_Charset_ID to find out which */
- /* encoding is really present. If, for example, the `cs_registry' */
- /* field is `KOI8' and the `cs_encoding' field is `R', the font is */
- /* encoded in KOI8-R. */
- /* */
- /* FT_ENCODING_NONE is always set (with a single exception) by the */
- /* winfonts driver. Use @FT_Get_WinFNT_Header and examine the */
- /* `charset' field of the @FT_WinFNT_HeaderRec structure to find out */
- /* which encoding is really present. For example, */
- /* @FT_WinFNT_ID_CP1251 (204) means Windows code page 1251 (for */
- /* Russian). */
- /* */
- /* FT_ENCODING_NONE is set if `platform_id' is @TT_PLATFORM_MACINTOSH */
- /* and `encoding_id' is not @TT_MAC_ID_ROMAN (otherwise it is set to */
- /* FT_ENCODING_APPLE_ROMAN). */
- /* */
- /* If `platform_id' is @TT_PLATFORM_MACINTOSH, use the function c */
- /* @FT_Get_CMap_Language_ID to query the Mac language ID which may be */
- /* needed to be able to distinguish Apple encoding variants. See */
- /* */
- /* http://www.unicode.org/Public/MAPPINGS/VENDORS/APPLE/README.TXT */
- /* */
- /* to get an idea how to do that. Basically, if the language ID is 0, */
- /* don't use it, otherwise subtract 1 from the language ID. Then */
- /* examine `encoding_id'. If, for example, `encoding_id' is */
- /* @TT_MAC_ID_ROMAN and the language ID (minus 1) is */
- /* `TT_MAC_LANGID_GREEK', it is the Greek encoding, not Roman. */
- /* @TT_MAC_ID_ARABIC with `TT_MAC_LANGID_FARSI' means the Farsi */
- /* variant the Arabic encoding. */
+ /* By default, FreeType automatically synthesizes a Unicode charmap */
+ /* for PostScript fonts, using their glyph names dictionaries. */
+ /* However, it also reports the encodings defined explicitly in the */
+ /* font file, for the cases when they are needed, with the Adobe */
+ /* values as well. */
+ /* */
+ /* FT_ENCODING_NONE is set by the BDF and PCF drivers if the charmap */
+ /* is neither Unicode nor ISO-8859-1 (otherwise it is set to */
+ /* FT_ENCODING_UNICODE). Use @FT_Get_BDF_Charset_ID to find out */
+ /* which encoding is really present. If, for example, the */
+ /* `cs_registry' field is `KOI8' and the `cs_encoding' field is `R', */
+ /* the font is encoded in KOI8-R. */
+ /* */
+ /* FT_ENCODING_NONE is always set (with a single exception) by the */
+ /* winfonts driver. Use @FT_Get_WinFNT_Header and examine the */
+ /* `charset' field of the @FT_WinFNT_HeaderRec structure to find out */
+ /* which encoding is really present. For example, */
+ /* @FT_WinFNT_ID_CP1251 (204) means Windows code page 1251 (for */
+ /* Russian). */
+ /* */
+ /* FT_ENCODING_NONE is set if `platform_id' is @TT_PLATFORM_MACINTOSH */
+ /* and `encoding_id' is not @TT_MAC_ID_ROMAN (otherwise it is set to */
+ /* FT_ENCODING_APPLE_ROMAN). */
+ /* */
+ /* If `platform_id' is @TT_PLATFORM_MACINTOSH, use the function */
+ /* @FT_Get_CMap_Language_ID to query the Mac language ID which may */
+ /* be needed to be able to distinguish Apple encoding variants. See */
+ /* */
+ /* http://www.unicode.org/Public/MAPPINGS/VENDORS/APPLE/README.TXT */
+ /* */
+ /* to get an idea how to do that. Basically, if the language ID */
+ /* is~0, don't use it, otherwise subtract 1 from the language ID. */
+ /* Then examine `encoding_id'. If, for example, `encoding_id' is */
+ /* @TT_MAC_ID_ROMAN and the language ID (minus~1) is */
+ /* `TT_MAC_LANGID_GREEK', it is the Greek encoding, not Roman. */
+ /* @TT_MAC_ID_ARABIC with `TT_MAC_LANGID_FARSI' means the Farsi */
+ /* variant the Arabic encoding. */
/* */
typedef enum FT_Encoding_
{
@@ -753,7 +754,7 @@ FT_BEGIN_HEADER
/* An opaque handle to an `FT_Face_InternalRec' structure, used to */
/* model private data of a given @FT_Face object. */
/* */
- /* This structure might change between releases of FreeType 2 and is */
+ /* This structure might change between releases of FreeType~2 and is */
/* not generally available to client applications. */
/* */
typedef struct FT_Face_InternalRec_* FT_Face_Internal;
@@ -774,7 +775,7 @@ FT_BEGIN_HEADER
/* a font file. */
/* */
/* face_index :: The index of the face in the font file. It */
- /* is set to 0 if there is only one face in */
+ /* is set to~0 if there is only one face in */
/* the font file. */
/* */
/* face_flags :: A set of bit flags that give important */
@@ -790,6 +791,9 @@ FT_BEGIN_HEADER
/* `num_fixed_sizes'), it is set to the number */
/* of outline glyphs. */
/* */
+ /* For CID-keyed fonts, this value gives the */
+ /* highest CID used in the font. */
+ /* */
/* family_name :: The face's family name. This is an ASCII */
/* string, usually in English, which describes */
/* the typeface's family (like `Times New */
@@ -838,9 +842,13 @@ FT_BEGIN_HEADER
/* descender'. Only relevant for scalable */
/* formats. */
/* */
+ /* Note that the bounding box might be off by */
+ /* (at least) one pixel for hinted fonts. See */
+ /* @FT_Size_Metrics for further discussion. */
+ /* */
/* units_per_EM :: The number of font units per EM square for */
/* this face. This is typically 2048 for */
- /* TrueType fonts, and 1000 for Type 1 fonts. */
+ /* TrueType fonts, and 1000 for Type~1 fonts. */
/* Only relevant for scalable formats. */
/* */
/* ascender :: The typographic ascender of the face, */
@@ -876,7 +884,7 @@ FT_BEGIN_HEADER
/* scalable formats. */
/* */
/* underline_position :: The position, in font units, of the */
- /* underline line for this face. It's the */
+ /* underline line for this face. It is the */
/* center of the underlining stem. Only */
/* relevant for scalable formats. */
/* */
@@ -891,8 +899,8 @@ FT_BEGIN_HEADER
/* charmap :: The current active charmap for this face. */
/* */
/* <Note> */
- /* Fields may be changed after a call to @FT_Attach_File or */
- /* @FT_Attach_Stream. */
+ /* Fields may be changed after a call to @FT_Attach_File or */
+ /* @FT_Attach_Stream. */
/* */
typedef struct FT_FaceRec_
{
@@ -1030,6 +1038,27 @@ FT_BEGIN_HEADER
/* exist make FT_Load_Glyph return successfully; in all other cases */
/* you get an `FT_Err_Invalid_Argument' error. */
/* */
+ /* Note that CID-keyed fonts which are in an SFNT wrapper don't */
+ /* have this flag set since the glyphs are accessed in the normal */
+ /* way (using contiguous indices); the `CID-ness' isn't visible to */
+ /* the application. */
+ /* */
+ /* FT_FACE_FLAG_TRICKY :: */
+ /* Set if the font is `tricky', this is, it always needs the */
+ /* font format's native hinting engine to get a reasonable result. */
+ /* A typical example is the Chinese font `mingli.ttf' which uses */
+ /* TrueType bytecode instructions to move and scale all of its */
+ /* subglyphs. */
+ /* */
+ /* It is not possible to autohint such fonts using */
+ /* @FT_LOAD_FORCE_AUTOHINT; it will also ignore */
+ /* @FT_LOAD_NO_HINTING. You have to set both FT_LOAD_NO_HINTING */
+ /* and @FT_LOAD_NO_AUTOHINT to really disable hinting; however, you */
+ /* probably never want this except for demonstration purposes. */
+ /* */
+ /* Currently, there are six TrueType fonts in the list of tricky */
+ /* fonts; they are hard-coded in file `ttobjs.c'. */
+ /* */
#define FT_FACE_FLAG_SCALABLE ( 1L << 0 )
#define FT_FACE_FLAG_FIXED_SIZES ( 1L << 1 )
#define FT_FACE_FLAG_FIXED_WIDTH ( 1L << 2 )
@@ -1043,8 +1072,7 @@ FT_BEGIN_HEADER
#define FT_FACE_FLAG_EXTERNAL_STREAM ( 1L << 10 )
#define FT_FACE_FLAG_HINTER ( 1L << 11 )
#define FT_FACE_FLAG_CID_KEYED ( 1L << 12 )
-
- /* */
+#define FT_FACE_FLAG_TRICKY ( 1L << 13 )
/*************************************************************************
@@ -1099,7 +1127,7 @@ FT_BEGIN_HEADER
*
* @description:
* A macro that returns true whenever a face object contains a scalable
- * font face (true for TrueType, Type 1, Type 42, CID, OpenType/CFF,
+ * font face (true for TrueType, Type~1, Type~42, CID, OpenType/CFF,
* and PFR font formats.
*
*/
@@ -1155,8 +1183,6 @@ FT_BEGIN_HEADER
#define FT_HAS_FIXED_SIZES( face ) \
( face->face_flags & FT_FACE_FLAG_FIXED_SIZES )
- /* */
-
/*************************************************************************
*
@@ -1217,9 +1243,23 @@ FT_BEGIN_HEADER
( face->face_flags & FT_FACE_FLAG_CID_KEYED )
+ /*************************************************************************
+ *
+ * @macro:
+ * FT_IS_TRICKY( face )
+ *
+ * @description:
+ * A macro that returns true whenever a face represents a `tricky' font.
+ * See the discussion of @FT_FACE_FLAG_TRICKY for more details.
+ *
+ */
+#define FT_IS_TRICKY( face ) \
+ ( face->face_flags & FT_FACE_FLAG_TRICKY )
+
+
/*************************************************************************/
/* */
- /* <Constant> */
+ /* <Const> */
/* FT_STYLE_FLAG_XXX */
/* */
/* <Description> */
@@ -1437,7 +1477,7 @@ FT_BEGIN_HEADER
/* Only relevant for outline glyphs. */
/* */
/* advance :: This is the transformed advance width for the */
- /* glyph. */
+ /* glyph (in 26.6 fractional pixel format). */
/* */
/* format :: This field indicates the format of the image */
/* contained in the glyph slot. Typically */
@@ -1461,7 +1501,7 @@ FT_BEGIN_HEADER
/* bitmap_top :: This is the bitmap's top bearing expressed in */
/* integer pixels. Remember that this is the */
/* distance from the baseline to the top-most */
- /* glyph scanline, upwards y-coordinates being */
+ /* glyph scanline, upwards y~coordinates being */
/* *positive*. */
/* */
/* outline :: The outline descriptor for the current glyph */
@@ -1484,7 +1524,7 @@ FT_BEGIN_HEADER
/* */
/* control_data :: Certain font drivers can also return the */
/* control data for a given glyph image (e.g. */
- /* TrueType bytecode, Type 1 charstrings, etc.). */
+ /* TrueType bytecode, Type~1 charstrings, etc.). */
/* This field is a pointer to such data. */
/* */
/* control_len :: This is the length in bytes of the control */
@@ -1506,15 +1546,15 @@ FT_BEGIN_HEADER
/* <Note> */
/* If @FT_Load_Glyph is called with default flags (see */
/* @FT_LOAD_DEFAULT) the glyph image is loaded in the glyph slot in */
- /* its native format (e.g., an outline glyph for TrueType and Type 1 */
+ /* its native format (e.g., an outline glyph for TrueType and Type~1 */
/* formats). */
/* */
/* This image can later be converted into a bitmap by calling */
/* @FT_Render_Glyph. This function finds the current renderer for */
- /* the native image's format then invokes it. */
+ /* the native image's format, then invokes it. */
/* */
/* The renderer is in charge of transforming the native image through */
- /* the slot's face transformation fields, then convert it into a */
+ /* the slot's face transformation fields, then converting it into a */
/* bitmap that is returned in `slot->bitmap'. */
/* */
/* Note that `slot->bitmap_left' and `slot->bitmap_top' are also used */
@@ -1609,7 +1649,7 @@ FT_BEGIN_HEADER
/* alibrary :: A handle to a new library object. */
/* */
/* <Return> */
- /* FreeType error code. 0 means success. */
+ /* FreeType error code. 0~means success. */
/* */
FT_EXPORT( FT_Error )
FT_Init_FreeType( FT_Library *alibrary );
@@ -1628,7 +1668,7 @@ FT_BEGIN_HEADER
/* library :: A handle to the target library object. */
/* */
/* <Return> */
- /* FreeType error code. 0 means success. */
+ /* FreeType error code. 0~means success. */
/* */
FT_EXPORT( FT_Error )
FT_Done_FreeType( FT_Library library );
@@ -1644,26 +1684,26 @@ FT_BEGIN_HEADER
/* @FT_Open_Args structure. */
/* */
/* <Values> */
- /* FT_OPEN_MEMORY :: This is a memory-based stream. */
+ /* FT_OPEN_MEMORY :: This is a memory-based stream. */
/* */
- /* FT_OPEN_STREAM :: Copy the stream from the `stream' field. */
+ /* FT_OPEN_STREAM :: Copy the stream from the `stream' field. */
/* */
- /* FT_OPEN_PATHNAME :: Create a new input stream from a C */
- /* path name. */
+ /* FT_OPEN_PATHNAME :: Create a new input stream from a C~path */
+ /* name. */
/* */
- /* FT_OPEN_DRIVER :: Use the `driver' field. */
+ /* FT_OPEN_DRIVER :: Use the `driver' field. */
/* */
- /* FT_OPEN_PARAMS :: Use the `num_params' and `params' fields. */
+ /* FT_OPEN_PARAMS :: Use the `num_params' and `params' fields. */
/* */
- /* ft_open_memory :: Deprecated; use @FT_OPEN_MEMORY instead. */
+ /* ft_open_memory :: Deprecated; use @FT_OPEN_MEMORY instead. */
/* */
- /* ft_open_stream :: Deprecated; use @FT_OPEN_STREAM instead. */
+ /* ft_open_stream :: Deprecated; use @FT_OPEN_STREAM instead. */
/* */
- /* ft_open_pathname :: Deprecated; use @FT_OPEN_PATHNAME instead. */
+ /* ft_open_pathname :: Deprecated; use @FT_OPEN_PATHNAME instead. */
/* */
- /* ft_open_driver :: Deprecated; use @FT_OPEN_DRIVER instead. */
+ /* ft_open_driver :: Deprecated; use @FT_OPEN_DRIVER instead. */
/* */
- /* ft_open_params :: Deprecated; use @FT_OPEN_PARAMS instead. */
+ /* ft_open_params :: Deprecated; use @FT_OPEN_PARAMS instead. */
/* */
/* <Note> */
/* The `FT_OPEN_MEMORY', `FT_OPEN_STREAM', and `FT_OPEN_PATHNAME' */
@@ -1688,8 +1728,8 @@ FT_BEGIN_HEADER
/* FT_Parameter */
/* */
/* <Description> */
- /* A simple structure used to pass more or less generic parameters */
- /* to @FT_Open_Face. */
+ /* A simple structure used to pass more or less generic parameters to */
+ /* @FT_Open_Face. */
/* */
/* <Fields> */
/* tag :: A four-byte identification tag. */
@@ -1731,7 +1771,7 @@ FT_BEGIN_HEADER
/* */
/* driver :: This field is exclusively used by @FT_Open_Face; */
/* it simply specifies the font driver to use to open */
- /* the face. If set to 0, FreeType tries to load the */
+ /* the face. If set to~0, FreeType tries to load the */
/* face with each one of the drivers in its list. */
/* */
/* num_params :: The number of extra parameters. */
@@ -1762,7 +1802,7 @@ FT_BEGIN_HEADER
/* `num_params' and `params' is used. They are ignored otherwise. */
/* */
/* Ideally, both the `pathname' and `params' fields should be tagged */
- /* as `const'; this is missing for API backwards compatibility. With */
+ /* as `const'; this is missing for API backwards compatibility. In */
/* other words, applications should treat them as read-only. */
/* */
typedef struct FT_Open_Args_
@@ -1794,7 +1834,7 @@ FT_BEGIN_HEADER
/* pathname :: A path to the font file. */
/* */
/* face_index :: The index of the face within the font. The first */
- /* face has index 0. */
+ /* face has index~0. */
/* */
/* <Output> */
/* aface :: A handle to a new face object. If `face_index' is */
@@ -1802,7 +1842,7 @@ FT_BEGIN_HEADER
/* See @FT_Open_Face for more details. */
/* */
/* <Return> */
- /* FreeType error code. 0 means success. */
+ /* FreeType error code. 0~means success. */
/* */
FT_EXPORT( FT_Error )
FT_New_Face( FT_Library library,
@@ -1829,7 +1869,7 @@ FT_BEGIN_HEADER
/* file_size :: The size of the memory chunk used by the font data. */
/* */
/* face_index :: The index of the face within the font. The first */
- /* face has index 0. */
+ /* face has index~0. */
/* */
/* <Output> */
/* aface :: A handle to a new face object. If `face_index' is */
@@ -1837,7 +1877,7 @@ FT_BEGIN_HEADER
/* See @FT_Open_Face for more details. */
/* */
/* <Return> */
- /* FreeType error code. 0 means success. */
+ /* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* You must not deallocate the memory before calling @FT_Done_Face. */
@@ -1867,7 +1907,7 @@ FT_BEGIN_HEADER
/* be filled by the caller. */
/* */
/* face_index :: The index of the face within the font. The first */
- /* face has index 0. */
+ /* face has index~0. */
/* */
/* <Output> */
/* aface :: A handle to a new face object. If `face_index' is */
@@ -1875,7 +1915,7 @@ FT_BEGIN_HEADER
/* See note below. */
/* */
/* <Return> */
- /* FreeType error code. 0 means success. */
+ /* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* Unlike FreeType 1.x, this function automatically creates a glyph */
@@ -1884,7 +1924,7 @@ FT_BEGIN_HEADER
/* */
/* FT_Open_Face can be used to quickly check whether the font */
/* format of a given font resource is supported by FreeType. If the */
- /* `face_index' field is negative, the function's return value is 0 */
+ /* `face_index' field is negative, the function's return value is~0 */
/* if the font format is recognized, or non-zero otherwise; */
/* the function returns a more or less empty face handle in `*aface' */
/* (if `aface' isn't NULL). The only useful field in this special */
@@ -1917,7 +1957,7 @@ FT_BEGIN_HEADER
/* filepathname :: The pathname. */
/* */
/* <Return> */
- /* FreeType error code. 0 means success. */
+ /* FreeType error code. 0~means success. */
/* */
FT_EXPORT( FT_Error )
FT_Attach_File( FT_Face face,
@@ -1932,7 +1972,7 @@ FT_BEGIN_HEADER
/* <Description> */
/* `Attach' data to a face object. Normally, this is used to read */
/* additional information for the face object. For example, you can */
- /* attach an AFM file that comes with a Type 1 font to get the */
+ /* attach an AFM file that comes with a Type~1 font to get the */
/* kerning values and other metrics. */
/* */
/* <InOut> */
@@ -1943,7 +1983,7 @@ FT_BEGIN_HEADER
/* the caller. */
/* */
/* <Return> */
- /* FreeType error code. 0 means success. */
+ /* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* The meaning of the `attach' (i.e., what really happens when the */
@@ -1972,7 +2012,7 @@ FT_BEGIN_HEADER
/* face :: A handle to a target face object. */
/* */
/* <Return> */
- /* FreeType error code. 0 means success. */
+ /* FreeType error code. 0~means success. */
/* */
FT_EXPORT( FT_Error )
FT_Done_Face( FT_Face face );
@@ -1994,7 +2034,7 @@ FT_BEGIN_HEADER
/* `available_sizes' field of @FT_FaceRec structure. */
/* */
/* <Return> */
- /* FreeType error code. 0 means success. */
+ /* FreeType error code. 0~means success. */
/* */
FT_EXPORT( FT_Error )
FT_Select_Size( FT_Face face,
@@ -2080,8 +2120,8 @@ FT_BEGIN_HEADER
/* value. */
/* */
/* <Note> */
- /* If `width' is zero, then the horizontal scaling value is set */
- /* equal to the vertical scaling value, and vice versa. */
+ /* If `width' is zero, then the horizontal scaling value is set equal */
+ /* to the vertical scaling value, and vice versa. */
/* */
typedef struct FT_Size_RequestRec_
{
@@ -2120,7 +2160,7 @@ FT_BEGIN_HEADER
/* req :: A pointer to a @FT_Size_RequestRec. */
/* */
/* <Return> */
- /* FreeType error code. 0 means success. */
+ /* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* Although drivers may select the bitmap strike matching the */
@@ -2155,7 +2195,7 @@ FT_BEGIN_HEADER
/* vert_resolution :: The vertical resolution in dpi. */
/* */
/* <Return> */
- /* FreeType error code. 0 means success. */
+ /* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* If either the character width or height is zero, it is set equal */
@@ -2167,7 +2207,8 @@ FT_BEGIN_HEADER
/* A character width or height smaller than 1pt is set to 1pt; if */
/* both resolution values are zero, they are set to 72dpi. */
/* */
-
+ /* Don't use this function if you are using the FreeType cache API. */
+ /* */
FT_EXPORT( FT_Error )
FT_Set_Char_Size( FT_Face face,
FT_F26Dot6 char_width,
@@ -2194,7 +2235,7 @@ FT_BEGIN_HEADER
/* pixel_height :: The nominal height, in pixels. */
/* */
/* <Return> */
- /* FreeType error code. 0 means success. */
+ /* FreeType error code. 0~means success. */
/* */
FT_EXPORT( FT_Error )
FT_Set_Pixel_Sizes( FT_Face face,
@@ -2227,7 +2268,7 @@ FT_BEGIN_HEADER
/* whether to hint the outline, etc). */
/* */
/* <Return> */
- /* FreeType error code. 0 means success. */
+ /* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* The loaded glyph may be transformed. See @FT_Set_Transform for */
@@ -2268,7 +2309,7 @@ FT_BEGIN_HEADER
/* whether to hint the outline, etc). */
/* */
/* <Return> */
- /* FreeType error code. 0 means success. */
+ /* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* This function simply calls @FT_Get_Char_Index and @FT_Load_Glyph. */
@@ -2290,7 +2331,7 @@ FT_BEGIN_HEADER
*
* @values:
* FT_LOAD_DEFAULT ::
- * Corresponding to 0, this value is used as the default glyph load
+ * Corresponding to~0, this value is used as the default glyph load
* operation. In this case, the following happens:
*
* 1. FreeType looks for a bitmap for the glyph corresponding to the
@@ -2380,10 +2421,10 @@ FT_BEGIN_HEADER
* FT_LOAD_MONOCHROME ::
* This flag is used with @FT_LOAD_RENDER to indicate that you want to
* render an outline glyph to a 1-bit monochrome bitmap glyph, with
- * 8 pixels packed into each byte of the bitmap data.
+ * 8~pixels packed into each byte of the bitmap data.
*
* Note that this has no effect on the hinting algorithm used. You
- * should use @FT_LOAD_TARGET_MONO instead so that the
+ * should rather use @FT_LOAD_TARGET_MONO so that the
* monochrome-optimized hinting algorithm is used.
*
* FT_LOAD_LINEAR_DESIGN ::
@@ -2394,12 +2435,6 @@ FT_BEGIN_HEADER
* FT_LOAD_NO_AUTOHINT ::
* Disable auto-hinter. See also the note below.
*
- *
- * FT_LOAD_ADVANCE_ONLY ::
- * Try to only load the glyph advance, and nothing else. when set, the
- * content of face->glyph might be garbage, except for the
- * face->glyph.advance vector.
- *
* @note:
* By default, hinting is enabled and the font's native hinter (see
* @FT_FACE_FLAG_HINTER) is preferred over the auto-hinter. You can
@@ -2408,8 +2443,12 @@ FT_BEGIN_HEADER
* @FT_LOAD_NO_AUTOHINT in case you don't want the auto-hinter to be
* used at all.
*
+ * See the description of @FT_FACE_FLAG_TRICKY for a special exception
+ * (affecting only a handful of Asian fonts).
+ *
* Besides deciding which hinter to use, you can also decide which
* hinting algorithm to use. See @FT_LOAD_TARGET_XXX for details.
+ *
*/
#define FT_LOAD_DEFAULT 0x0
#define FT_LOAD_NO_SCALE 0x1
@@ -2426,13 +2465,13 @@ FT_BEGIN_HEADER
#define FT_LOAD_MONOCHROME 0x1000
#define FT_LOAD_LINEAR_DESIGN 0x2000
#define FT_LOAD_NO_AUTOHINT 0x8000U
-#define FT_LOAD_ADVANCE_ONLY 0x10000U
-
- /* used internally only by certain font drivers ! */
-#define FT_LOAD_SBITS_ONLY 0x4000
/* */
+ /* used internally only by certain font drivers! */
+#define FT_LOAD_ADVANCE_ONLY 0x100
+#define FT_LOAD_SBITS_ONLY 0x4000
+
/**************************************************************************
*
@@ -2460,7 +2499,7 @@ FT_BEGIN_HEADER
* FT_LOAD_TARGET_LIGHT ::
* A lighter hinting algorithm for non-monochrome modes. Many
* generated glyphs are more fuzzy but better resemble its original
- * shape. A bit like rendering on Mac OS X.
+ * shape. A bit like rendering on Mac OS~X.
*
* As a special exception, this target implies @FT_LOAD_FORCE_AUTOHINT.
*
@@ -2496,15 +2535,15 @@ FT_BEGIN_HEADER
*
* FT_Render_Glyph( face->glyph, FT_RENDER_MODE_LCD );
* }
+ *
*/
+#define FT_LOAD_TARGET_( x ) ( (FT_Int32)( (x) & 15 ) << 16 )
-#define FT_LOAD_TARGET_( x ) ( (FT_Int32)( (x) & 15 ) << 16 )
-
-#define FT_LOAD_TARGET_NORMAL FT_LOAD_TARGET_( FT_RENDER_MODE_NORMAL )
-#define FT_LOAD_TARGET_LIGHT FT_LOAD_TARGET_( FT_RENDER_MODE_LIGHT )
-#define FT_LOAD_TARGET_MONO FT_LOAD_TARGET_( FT_RENDER_MODE_MONO )
-#define FT_LOAD_TARGET_LCD FT_LOAD_TARGET_( FT_RENDER_MODE_LCD )
-#define FT_LOAD_TARGET_LCD_V FT_LOAD_TARGET_( FT_RENDER_MODE_LCD_V )
+#define FT_LOAD_TARGET_NORMAL FT_LOAD_TARGET_( FT_RENDER_MODE_NORMAL )
+#define FT_LOAD_TARGET_LIGHT FT_LOAD_TARGET_( FT_RENDER_MODE_LIGHT )
+#define FT_LOAD_TARGET_MONO FT_LOAD_TARGET_( FT_RENDER_MODE_MONO )
+#define FT_LOAD_TARGET_LCD FT_LOAD_TARGET_( FT_RENDER_MODE_LCD )
+#define FT_LOAD_TARGET_LCD_V FT_LOAD_TARGET_( FT_RENDER_MODE_LCD_V )
/**************************************************************************
@@ -2517,11 +2556,8 @@ FT_BEGIN_HEADER
* @FT_LOAD_TARGET_XXX value.
*
*/
-
#define FT_LOAD_TARGET_MODE( x ) ( (FT_Render_Mode)( ( (x) >> 16 ) & 15 ) )
- /* */
-
/*************************************************************************/
/* */
@@ -2537,9 +2573,9 @@ FT_BEGIN_HEADER
/* face :: A handle to the source face object. */
/* */
/* <Input> */
- /* matrix :: A pointer to the transformation's 2x2 matrix. Use 0 for */
+ /* matrix :: A pointer to the transformation's 2x2 matrix. Use~0 for */
/* the identity matrix. */
- /* delta :: A pointer to the translation vector. Use 0 for the null */
+ /* delta :: A pointer to the translation vector. Use~0 for the null */
/* vector. */
/* */
/* <Note> */
@@ -2564,17 +2600,19 @@ FT_BEGIN_HEADER
/* */
/* <Description> */
/* An enumeration type that lists the render modes supported by */
- /* FreeType 2. Each mode corresponds to a specific type of scanline */
+ /* FreeType~2. Each mode corresponds to a specific type of scanline */
/* conversion performed on the outline. */
/* */
- /* For bitmap fonts the `bitmap->pixel_mode' field in the */
- /* @FT_GlyphSlotRec structure gives the format of the returned */
- /* bitmap. */
+ /* For bitmap fonts and embedded bitmaps the `bitmap->pixel_mode' */
+ /* field in the @FT_GlyphSlotRec structure gives the format of the */
+ /* returned bitmap. */
+ /* */
+ /* All modes except @FT_RENDER_MODE_MONO use 256 levels of opacity. */
/* */
/* <Values> */
/* FT_RENDER_MODE_NORMAL :: */
/* This is the default render mode; it corresponds to 8-bit */
- /* anti-aliased bitmaps, using 256 levels of opacity. */
+ /* anti-aliased bitmaps. */
/* */
/* FT_RENDER_MODE_LIGHT :: */
/* This is equivalent to @FT_RENDER_MODE_NORMAL. It is only */
@@ -2583,26 +2621,32 @@ FT_BEGIN_HEADER
/* @FT_LOAD_TARGET_XXX for details. */
/* */
/* FT_RENDER_MODE_MONO :: */
- /* This mode corresponds to 1-bit bitmaps. */
+ /* This mode corresponds to 1-bit bitmaps (with 2~levels of */
+ /* opacity). */
/* */
/* FT_RENDER_MODE_LCD :: */
/* This mode corresponds to horizontal RGB and BGR sub-pixel */
- /* displays, like LCD-screens. It produces 8-bit bitmaps that are */
- /* 3 times the width of the original glyph outline in pixels, and */
+ /* displays like LCD screens. It produces 8-bit bitmaps that are */
+ /* 3~times the width of the original glyph outline in pixels, and */
/* which use the @FT_PIXEL_MODE_LCD mode. */
/* */
/* FT_RENDER_MODE_LCD_V :: */
/* This mode corresponds to vertical RGB and BGR sub-pixel displays */
/* (like PDA screens, rotated LCD displays, etc.). It produces */
- /* 8-bit bitmaps that are 3 times the height of the original */
+ /* 8-bit bitmaps that are 3~times the height of the original */
/* glyph outline in pixels and use the @FT_PIXEL_MODE_LCD_V mode. */
/* */
/* <Note> */
- /* The LCD-optimized glyph bitmaps produced by FT_Render_Glyph can be */
- /* filtered to reduce color-fringes by using @FT_Library_SetLcdFilter */
- /* (not active in the default builds). It is up to the caller to */
- /* either call @FT_Library_SetLcdFilter (if available) or do the */
- /* filtering itself. */
+ /* The LCD-optimized glyph bitmaps produced by FT_Render_Glyph can be */
+ /* filtered to reduce color-fringes by using @FT_Library_SetLcdFilter */
+ /* (not active in the default builds). It is up to the caller to */
+ /* either call @FT_Library_SetLcdFilter (if available) or do the */
+ /* filtering itself. */
+ /* */
+ /* The selected render mode only affects vector glyphs of a font. */
+ /* Embedded bitmaps often have a different pixel mode like */
+ /* @FT_PIXEL_MODE_MONO. You can use @FT_Bitmap_Convert to transform */
+ /* them into 8-bit pixmaps. */
/* */
typedef enum FT_Render_Mode_
{
@@ -2627,8 +2671,8 @@ FT_BEGIN_HEADER
/* @FT_Render_Mode values instead. */
/* */
/* <Values> */
- /* ft_render_mode_normal :: see @FT_RENDER_MODE_NORMAL */
- /* ft_render_mode_mono :: see @FT_RENDER_MODE_MONO */
+ /* ft_render_mode_normal :: see @FT_RENDER_MODE_NORMAL */
+ /* ft_render_mode_mono :: see @FT_RENDER_MODE_MONO */
/* */
#define ft_render_mode_normal FT_RENDER_MODE_NORMAL
#define ft_render_mode_mono FT_RENDER_MODE_MONO
@@ -2654,7 +2698,7 @@ FT_BEGIN_HEADER
/* list of possible values. */
/* */
/* <Return> */
- /* FreeType error code. 0 means success. */
+ /* FreeType error code. 0~means success. */
/* */
FT_EXPORT( FT_Error )
FT_Render_Glyph( FT_GlyphSlot slot,
@@ -2672,7 +2716,7 @@ FT_BEGIN_HEADER
/* */
/* <Values> */
/* FT_KERNING_DEFAULT :: Return scaled and grid-fitted kerning */
- /* distances (value is 0). */
+ /* distances (value is~0). */
/* */
/* FT_KERNING_UNFITTED :: Return scaled but un-grid-fitted kerning */
/* distances. */
@@ -2750,7 +2794,7 @@ FT_BEGIN_HEADER
/* and in pixels for fixed-sizes formats. */
/* */
/* <Return> */
- /* FreeType error code. 0 means success. */
+ /* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* Only horizontal layouts (left-to-right & right-to-left) are */
@@ -2775,17 +2819,17 @@ FT_BEGIN_HEADER
/* Return the track kerning for a given face object at a given size. */
/* */
/* <Input> */
- /* face :: A handle to a source face object. */
+ /* face :: A handle to a source face object. */
/* */
- /* point_size :: The point size in 16.16 fractional points. */
+ /* point_size :: The point size in 16.16 fractional points. */
/* */
- /* degree :: The degree of tightness. */
+ /* degree :: The degree of tightness. */
/* */
/* <Output> */
- /* akerning :: The kerning in 16.16 fractional points. */
+ /* akerning :: The kerning in 16.16 fractional points. */
/* */
/* <Return> */
- /* FreeType error code. 0 means success. */
+ /* FreeType error code. 0~means success. */
/* */
FT_EXPORT( FT_Error )
FT_Get_Track_Kerning( FT_Face face,
@@ -2801,7 +2845,7 @@ FT_BEGIN_HEADER
/* */
/* <Description> */
/* Retrieve the ASCII name of a given glyph in a face. This only */
- /* works for those faces where @FT_HAS_GLYPH_NAMES(face) returns 1. */
+ /* works for those faces where @FT_HAS_GLYPH_NAMES(face) returns~1. */
/* */
/* <Input> */
/* face :: A handle to a source face object. */
@@ -2816,12 +2860,12 @@ FT_BEGIN_HEADER
/* copied to. */
/* */
/* <Return> */
- /* FreeType error code. 0 means success. */
+ /* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* An error is returned if the face doesn't provide glyph names or if */
/* the glyph index is invalid. In all cases of failure, the first */
- /* byte of `buffer' is set to 0 to indicate an empty name. */
+ /* byte of `buffer' is set to~0 to indicate an empty name. */
/* */
/* The glyph name is truncated to fit within the buffer if it is too */
/* long. The returned string is always zero-terminated. */
@@ -2843,14 +2887,14 @@ FT_BEGIN_HEADER
/* FT_Get_Postscript_Name */
/* */
/* <Description> */
- /* Retrieve the ASCII Postscript name of a given face, if available. */
- /* This only works with Postscript and TrueType fonts. */
+ /* Retrieve the ASCII PostScript name of a given face, if available. */
+ /* This only works with PostScript and TrueType fonts. */
/* */
/* <Input> */
/* face :: A handle to the source face object. */
/* */
/* <Return> */
- /* A pointer to the face's Postscript name. NULL if unavailable. */
+ /* A pointer to the face's PostScript name. NULL if unavailable. */
/* */
/* <Note> */
/* The returned pointer is owned by the face and is destroyed with */
@@ -2876,7 +2920,7 @@ FT_BEGIN_HEADER
/* encoding :: A handle to the selected encoding. */
/* */
/* <Return> */
- /* FreeType error code. 0 means success. */
+ /* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* This function returns an error if no charmap in the face */
@@ -2908,14 +2952,14 @@ FT_BEGIN_HEADER
/* charmap :: A handle to the selected charmap. */
/* */
/* <Return> */
- /* FreeType error code. 0 means success. */
+ /* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* This function returns an error if the charmap is not part of */
/* the face (i.e., if it is not listed in the `face->charmaps' */
/* table). */
/* */
- /* It also fails if a type 14 charmap is selected. */
+ /* It also fails if a type~14 charmap is selected. */
/* */
FT_EXPORT( FT_Error )
FT_Set_Charmap( FT_Face face,
@@ -2958,13 +3002,13 @@ FT_BEGIN_HEADER
/* charcode :: The character code. */
/* */
/* <Return> */
- /* The glyph index. 0 means `undefined character code'. */
+ /* The glyph index. 0~means `undefined character code'. */
/* */
/* <Note> */
/* If you use FreeType to manipulate the contents of font files */
/* directly, be aware that the glyph index returned by this function */
/* doesn't always correspond to the internal indices used within */
- /* the file. This is done to ensure that value 0 always corresponds */
+ /* the file. This is done to ensure that value~0 always corresponds */
/* to the `missing glyph'. */
/* */
FT_EXPORT( FT_UInt )
@@ -2986,7 +3030,7 @@ FT_BEGIN_HEADER
/* face :: A handle to the source face object. */
/* */
/* <Output> */
- /* agindex :: Glyph index of first character code. 0 if charmap is */
+ /* agindex :: Glyph index of first character code. 0~if charmap is */
/* empty. */
/* */
/* <Return> */
@@ -3011,9 +3055,9 @@ FT_BEGIN_HEADER
/* } */
/* } */
/* */
- /* Note that `*agindex' is set to 0 if the charmap is empty. The */
- /* result itself can be 0 in two cases: if the charmap is empty or */
- /* when the value 0 is the first valid character code. */
+ /* Note that `*agindex' is set to~0 if the charmap is empty. The */
+ /* result itself can be~0 in two cases: if the charmap is empty or */
+ /* if the value~0 is the first valid character code. */
/* */
FT_EXPORT( FT_ULong )
FT_Get_First_Char( FT_Face face,
@@ -3035,7 +3079,7 @@ FT_BEGIN_HEADER
/* char_code :: The starting character code. */
/* */
/* <Output> */
- /* agindex :: Glyph index of first character code. 0 if charmap */
+ /* agindex :: Glyph index of next character code. 0~if charmap */
/* is empty. */
/* */
/* <Return> */
@@ -3046,7 +3090,7 @@ FT_BEGIN_HEADER
/* over all character codes available in a given charmap. See the */
/* note for this function for a simple code example. */
/* */
- /* Note that `*agindex' is set to 0 when there are no more codes in */
+ /* Note that `*agindex' is set to~0 when there are no more codes in */
/* the charmap. */
/* */
FT_EXPORT( FT_ULong )
@@ -3070,7 +3114,7 @@ FT_BEGIN_HEADER
/* glyph_name :: The glyph name. */
/* */
/* <Return> */
- /* The glyph index. 0 means `undefined character code'. */
+ /* The glyph index. 0~means `undefined character code'. */
/* */
FT_EXPORT( FT_UInt )
FT_Get_Name_Index( FT_Face face,
@@ -3112,15 +3156,16 @@ FT_BEGIN_HEADER
*
* @description:
* Retrieve a description of a given subglyph. Only use it if
- * `glyph->format' is @FT_GLYPH_FORMAT_COMPOSITE, or an error is
- * returned.
+ * `glyph->format' is @FT_GLYPH_FORMAT_COMPOSITE; an error is
+ * returned otherwise.
*
* @input:
* glyph ::
* The source glyph slot.
*
* sub_index ::
- * The index of subglyph. Must be less than `glyph->num_subglyphs'.
+ * The index of the subglyph. Must be less than
+ * `glyph->num_subglyphs'.
*
* @output:
* p_index ::
@@ -3139,7 +3184,7 @@ FT_BEGIN_HEADER
* The subglyph transformation (if any).
*
* @return:
- * FreeType error code. 0 means success.
+ * FreeType error code. 0~means success.
*
* @note:
* The values of `*p_arg1', `*p_arg2', and `*p_transform' must be
@@ -3155,6 +3200,90 @@ FT_BEGIN_HEADER
FT_Int *p_arg1,
FT_Int *p_arg2,
FT_Matrix *p_transform );
+
+
+ /*************************************************************************/
+ /* */
+ /* <Enum> */
+ /* FT_FSTYPE_XXX */
+ /* */
+ /* <Description> */
+ /* A list of bit flags used in the `fsType' field of the OS/2 table */
+ /* in a TrueType or OpenType font and the `FSType' entry in a */
+ /* PostScript font. These bit flags are returned by */
+ /* @FT_Get_FSType_Flags; they inform client applications of embedding */
+ /* and subsetting restrictions associated with a font. */
+ /* */
+ /* See http://www.adobe.com/devnet/acrobat/pdfs/FontPolicies.pdf for */
+ /* more details. */
+ /* */
+ /* <Values> */
+ /* FT_FSTYPE_INSTALLABLE_EMBEDDING :: */
+ /* Fonts with no fsType bit set may be embedded and permanently */
+ /* installed on the remote system by an application. */
+ /* */
+ /* FT_FSTYPE_RESTRICTED_LICENSE_EMBEDDING :: */
+ /* Fonts that have only this bit set must not be modified, embedded */
+ /* or exchanged in any manner without first obtaining permission of */
+ /* the font software copyright owner. */
+ /* */
+ /* FT_FSTYPE_PREVIEW_AND_PRINT_EMBEDDING :: */
+ /* If this bit is set, the font may be embedded and temporarily */
+ /* loaded on the remote system. Documents containing Preview & */
+ /* Print fonts must be opened `read-only'; no edits can be applied */
+ /* to the document. */
+ /* */
+ /* FT_FSTYPE_EDITABLE_EMBEDDING :: */
+ /* If this bit is set, the font may be embedded but must only be */
+ /* installed temporarily on other systems. In contrast to Preview */
+ /* & Print fonts, documents containing editable fonts may be opened */
+ /* for reading, editing is permitted, and changes may be saved. */
+ /* */
+ /* FT_FSTYPE_NO_SUBSETTING :: */
+ /* If this bit is set, the font may not be subsetted prior to */
+ /* embedding. */
+ /* */
+ /* FT_FSTYPE_BITMAP_EMBEDDING_ONLY :: */
+ /* If this bit is set, only bitmaps contained in the font may be */
+ /* embedded; no outline data may be embedded. If there are no */
+ /* bitmaps available in the font, then the font is unembeddable. */
+ /* */
+ /* <Note> */
+ /* While the fsType flags can indicate that a font may be embedded, a */
+ /* license with the font vendor may be separately required to use the */
+ /* font in this way. */
+ /* */
+#define FT_FSTYPE_INSTALLABLE_EMBEDDING 0x0000
+#define FT_FSTYPE_RESTRICTED_LICENSE_EMBEDDING 0x0002
+#define FT_FSTYPE_PREVIEW_AND_PRINT_EMBEDDING 0x0004
+#define FT_FSTYPE_EDITABLE_EMBEDDING 0x0008
+#define FT_FSTYPE_NO_SUBSETTING 0x0100
+#define FT_FSTYPE_BITMAP_EMBEDDING_ONLY 0x0200
+
+
+ /*************************************************************************/
+ /* */
+ /* <Function> */
+ /* FT_Get_FSType_Flags */
+ /* */
+ /* <Description> */
+ /* Return the fsType flags for a font. */
+ /* */
+ /* <Input> */
+ /* face :: A handle to the source face object. */
+ /* */
+ /* <Return> */
+ /* The fsType flags, @FT_FSTYPE_XXX. */
+ /* */
+ /* <Note> */
+ /* Use this function rather than directly reading the `fs_type' field */
+ /* in the @PS_FontInfoRec structure which is only guaranteed to */
+ /* return the correct results for Type~1 fonts. */
+ /* */
+ FT_EXPORT( FT_UShort )
+ FT_Get_FSType_Flags( FT_Face face );
+
+
/*************************************************************************/
/* */
/* <Section> */
@@ -3164,8 +3293,8 @@ FT_BEGIN_HEADER
/* Glyph Variants */
/* */
/* <Abstract> */
- /* The FreeType 2 interface to Unicode Ideographic Variation */
- /* Sequences (IVS), using the SFNT cmap format 14. */
+ /* The FreeType~2 interface to Unicode Ideographic Variation */
+ /* Sequences (IVS), using the SFNT cmap format~14. */
/* */
/* <Description> */
/* Many CJK characters have variant forms. They are a sort of grey */
@@ -3179,10 +3308,10 @@ FT_BEGIN_HEADER
/* An IVS is registered and unique; for further details please refer */
/* to Unicode Technical Report #37, the Ideographic Variation */
/* Database. To date (October 2007), the character with the most */
- /* variants is U+908A, having 8 such IVS. */
+ /* variants is U+908A, having 8~such IVS. */
/* */
/* Adobe and MS decided to support IVS with a new cmap subtable */
- /* (format 14). It is an odd subtable because it is not a mapping of */
+ /* (format~14). It is an odd subtable because it is not a mapping of */
/* input code points to glyphs, but contains lists of all variants */
/* supported by the font. */
/* */
@@ -3214,7 +3343,7 @@ FT_BEGIN_HEADER
/* The Unicode code point of the variation selector. */
/* */
/* <Return> */
- /* The glyph index. 0 means either `undefined character code', or */
+ /* The glyph index. 0~means either `undefined character code', or */
/* `undefined selector code', or `no variation selector cmap */
/* subtable', or `current CharMap is not Unicode'. */
/* */
@@ -3222,7 +3351,7 @@ FT_BEGIN_HEADER
/* If you use FreeType to manipulate the contents of font files */
/* directly, be aware that the glyph index returned by this function */
/* doesn't always correspond to the internal indices used within */
- /* the file. This is done to ensure that value 0 always corresponds */
+ /* the file. This is done to ensure that value~0 always corresponds */
/* to the `missing glyph'. */
/* */
/* This function is only meaningful if */
@@ -3259,7 +3388,7 @@ FT_BEGIN_HEADER
/* The Unicode codepoint of the variation selector. */
/* */
/* <Return> */
- /* 1 if found in the standard (Unicode) cmap, 0 if found in the */
+ /* 1~if found in the standard (Unicode) cmap, 0~if found in the */
/* variation selector cmap, or -1 if it is not a variant. */
/* */
/* <Note> */
@@ -3293,7 +3422,7 @@ FT_BEGIN_HEADER
/* no valid variant selector cmap subtable. */
/* */
/* <Note> */
- /* The last item in the array is 0; the array is owned by the */
+ /* The last item in the array is~0; the array is owned by the */
/* @FT_Face object but can be overwritten or released on the next */
/* call to a FreeType function. */
/* */
@@ -3326,7 +3455,7 @@ FT_BEGIN_HEADER
/* is empty. */
/* */
/* <Note> */
- /* The last item in the array is 0; the array is owned by the */
+ /* The last item in the array is~0; the array is owned by the */
/* @FT_Face object but can be overwritten or released on the next */
/* call to a FreeType function. */
/* */
@@ -3360,7 +3489,7 @@ FT_BEGIN_HEADER
/* is no valid cmap or the variant selector is invalid. */
/* */
/* <Note> */
- /* The last item in the array is 0; the array is owned by the */
+ /* The last item in the array is~0; the array is owned by the */
/* @FT_Face object but can be overwritten or released on the next */
/* call to a FreeType function. */
/* */
@@ -3430,6 +3559,12 @@ FT_BEGIN_HEADER
FT_Long c );
+ /* */
+
+ /* The following #if 0 ... #endif is for the documentation formatter, */
+ /* hiding the internal `FT_MULFIX_INLINED' macro. */
+
+#if 0
/*************************************************************************/
/* */
/* <Function> */
@@ -3459,14 +3594,22 @@ FT_BEGIN_HEADER
/* _second_ argument of this function; this can make a great */
/* difference. */
/* */
+ FT_EXPORT( FT_Long )
+ FT_MulFix( FT_Long a,
+ FT_Long b );
+
+ /* */
+#endif
+
#ifdef FT_MULFIX_INLINED
-# define FT_MulFix(a,b) FT_MULFIX_INLINED(a,b)
+#define FT_MulFix( a, b ) FT_MULFIX_INLINED( a, b )
#else
FT_EXPORT( FT_Long )
FT_MulFix( FT_Long a,
FT_Long b );
#endif
+
/*************************************************************************/
/* */
/* <Function> */
@@ -3486,8 +3629,8 @@ FT_BEGIN_HEADER
/* The result of `(a*0x10000)/b'. */
/* */
/* <Note> */
- /* The optimization for FT_DivFix() is simple: If (a << 16) fits in */
- /* 32 bits, then the division is computed directly. Otherwise, we */
+ /* The optimization for FT_DivFix() is simple: If (a~<<~16) fits in */
+ /* 32~bits, then the division is computed directly. Otherwise, we */
/* use a specialized version of @FT_MulDiv. */
/* */
FT_EXPORT( FT_Long )
@@ -3594,26 +3737,27 @@ FT_BEGIN_HEADER
/*************************************************************************
*
- * @enum:
- * FREETYPE_XXX
+ * @enum:
+ * FREETYPE_XXX
*
- * @description:
- * These three macros identify the FreeType source code version.
- * Use @FT_Library_Version to access them at runtime.
+ * @description:
+ * These three macros identify the FreeType source code version.
+ * Use @FT_Library_Version to access them at runtime.
*
- * @values:
- * FREETYPE_MAJOR :: The major version number.
- * FREETYPE_MINOR :: The minor version number.
- * FREETYPE_PATCH :: The patch level.
+ * @values:
+ * FREETYPE_MAJOR :: The major version number.
+ * FREETYPE_MINOR :: The minor version number.
+ * FREETYPE_PATCH :: The patch level.
+ *
+ * @note:
+ * The version number of FreeType if built as a dynamic link library
+ * with the `libtool' package is _not_ controlled by these three
+ * macros.
*
- * @note:
- * The version number of FreeType if built as a dynamic link library
- * with the `libtool' package is _not_ controlled by these three
- * macros.
*/
#define FREETYPE_MAJOR 2
#define FREETYPE_MINOR 3
-#define FREETYPE_PATCH 6
+#define FREETYPE_PATCH 9
/*************************************************************************/
@@ -3670,8 +3814,8 @@ FT_BEGIN_HEADER
/* face :: A face handle. */
/* */
/* <Return> */
- /* 1 if this is a TrueType font that uses one of the patented */
- /* opcodes, 0 otherwise. */
+ /* 1~if this is a TrueType font that uses one of the patented */
+ /* opcodes, 0~otherwise. */
/* */
/* <Since> */
/* 2.3.5 */
@@ -3697,7 +3841,7 @@ FT_BEGIN_HEADER
/* */
/* <Return> */
/* The old setting value. This will always be false if this is not */
- /* a SFNT font, or if the unpatented hinter is not compiled in this */
+ /* an SFNT font, or if the unpatented hinter is not compiled in this */
/* instance of the library. */
/* */
/* <Since> */
diff --git a/include/freetype/ftadvanc.h b/include/freetype/ftadvanc.h
index 108b1ce..b2451be 100644
--- a/include/freetype/ftadvanc.h
+++ b/include/freetype/ftadvanc.h
@@ -2,9 +2,9 @@
/* */
/* ftadvanc.h */
/* */
-/* FreeType access the glyph advances (specification only). */
+/* Quick computation of advance widths (specification only). */
/* */
-/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007 by */
+/* Copyright 2008 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -15,33 +15,64 @@
/* */
/***************************************************************************/
-#ifndef __FREETYPE_ADVANCE_H__
-#define __FREETYPE_ADVANCE_H__
+
+#ifndef __FTADVANC_H__
+#define __FTADVANC_H__
+
#include <ft2build.h>
#include FT_FREETYPE_H
+#ifdef FREETYPE_H
+#error "freetype.h of FreeType 1 has been loaded!"
+#error "Please fix the directory search order for header files"
+#error "so that freetype.h of FreeType 2 is found first."
+#endif
+
+
+FT_BEGIN_HEADER
+
+
+ /**************************************************************************
+ *
+ * @section:
+ * quick_advance
+ *
+ * @title:
+ * Quick retrieval of advance values
+ *
+ * @abstract:
+ * Retrieve horizontal and vertical advance values without processing
+ * glyph outlines, if possible.
+ *
+ * @description:
+ * This section contains functions to quickly extract advance values
+ * without handling glyph outlines, if possible.
+ */
+
+
/*************************************************************************/
/* */
/* <Const> */
/* FT_ADVANCE_FLAG_FAST_ONLY */
/* */
/* <Description> */
- /* a bit-flag to be or-ed to the 'flags' parameter of the */
- /* @FT_Get_Advance and @FT_Get_Advances. */
+ /* A bit-flag to be OR-ed with the `flags' parameter of the */
+ /* @FT_Get_Advance and @FT_Get_Advances functions. */
/* */
- /* when set, it indicates that you want these functions to fail */
- /* if the corresponding hinting mode or font driver doesn't */
- /* allow for very quick advance computation. */
+ /* If set, it indicates that you want these functions to fail if the */
+ /* corresponding hinting mode or font driver doesn't allow for very */
+ /* quick advance computation. */
/* */
- /* typically, unscaled, unhinted, bitmapped and light-hinted glyphs */
- /* can have their advance width(s) computed very quickly. */
+ /* Typically, glyphs which are either unscaled, unhinted, bitmapped, */
+ /* or light-hinted can have their advance width computed very */
+ /* quickly. */
/* */
- /* not so for normal and bytecode hinted modes, which require */
- /* loading/scaling/hinting the glyph outline instead, which is */
- /* extremely slow by comparison */
+ /* Normal and bytecode hinted modes, which require loading, scaling, */
+ /* and hinting of the glyph outline, are extremely slow by */
+ /* comparison. */
/* */
-#define FT_ADVANCE_FLAG_FAST_ONLY 0x20000000U
+#define FT_ADVANCE_FLAG_FAST_ONLY 0x20000000UL
/*************************************************************************/
@@ -50,82 +81,99 @@
/* FT_Get_Advance */
/* */
/* <Description> */
- /* Retrieve the advance of a given glyph outline in a FT_Face. */
- /* by default, the unhinted advance is returned in font units */
+ /* Retrieve the advance value of a given glyph outline in an */
+ /* @FT_Face. By default, the unhinted advance is returned in font */
+ /* units. */
/* */
/* <Input> */
- /* face :: source FT_Face handle */
- /* gindex :: glyph index */
- /* load_flags :: a set of bit-flags similar to those used */
- /* when calling @FT_Load_Glyph, used to determine */
- /* what kind of advances you need. */
+ /* face :: The source @FT_Face handle. */
+ /* */
+ /* gindex :: The glyph index. */
+ /* */
+ /* load_flags :: A set of bit flags similar to those used when */
+ /* calling @FT_Load_Glyph, used to determine what kind */
+ /* of advances you need. */
/* <Output> */
- /* padvance :: the advance value, in either font units or 16.16 */
+ /* padvance :: The advance value, in either font units or 16.16 */
/* format. */
/* */
- /* if @FT_LOAD_VERTICAL_LAYOUT is set, this is the */
+ /* If @FT_LOAD_VERTICAL_LAYOUT is set, this is the */
/* vertical advance corresponding to a vertical layout. */
- /* otherwise, it's the horizontal advance in an */
+ /* Otherwise, it is the horizontal advance in a */
/* horizontal layout. */
+ /* */
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
/* <Note> */
/* This function may fail if you use @FT_ADVANCE_FLAG_FAST_ONLY and */
- /* if the corresponding's font backend doesn't have a quick way to */
+ /* if the corresponding font backend doesn't have a quick way to */
/* retrieve the advances. */
/* */
- /* A scaled advance is returned in 16.16 format, but isn't */
- /* transformed by the affine transform specified by @FT_Set_Transform */
+ /* A scaled advance is returned in 16.16 format but isn't transformed */
+ /* by the affine transformation specified by @FT_Set_Transform. */
/* */
FT_EXPORT( FT_Error )
FT_Get_Advance( FT_Face face,
FT_UInt gindex,
- FT_UInt load_flags,
+ FT_Int32 load_flags,
FT_Fixed *padvance );
+
/*************************************************************************/
/* */
/* <Function> */
/* FT_Get_Advances */
/* */
/* <Description> */
- /* Retrieve the advance of several glyph outlines in a FT_Face. */
- /* by default, the unhinted advances are returned in font units */
+ /* Retrieve the advance values of several glyph outlines in an */
+ /* @FT_Face. By default, the unhinted advances are returned in font */
+ /* units. */
/* */
/* <Input> */
- /* face :: source FT_Face handle */
- /* start :: first glyph index */
- /* count :: number of advances you want to retrieve */
- /* load_flags :: a set of bit-flags similar to those used when */
+ /* face :: The source @FT_Face handle. */
+ /* */
+ /* start :: The first glyph index. */
+ /* */
+ /* count :: The number of advance values you want to retrieve. */
+ /* */
+ /* load_flags :: A set of bit flags similar to those used when */
/* calling @FT_Load_Glyph. */
/* */
/* <Output> */
- /* padvance :: the advances, in either font units or 16.16 format. */
- /* this array must contain at least 'count' elements */
+ /* padvance :: The advances, in either font units or 16.16 format. */
+ /* This array must contain at least `count' elements. */
/* */
- /* if @FT_LOAD_VERTICAL_LAYOUT is set, these are the */
+ /* If @FT_LOAD_VERTICAL_LAYOUT is set, these are the */
/* vertical advances corresponding to a vertical layout. */
- /* otherwise, they are the horizontal advances in an */
+ /* Otherwise, they are the horizontal advances in a */
/* horizontal layout. */
+ /* */
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
/* <Note> */
/* This function may fail if you use @FT_ADVANCE_FLAG_FAST_ONLY and */
- /* if the corresponding's font backend doesn't have a quick way to */
+ /* if the corresponding font backend doesn't have a quick way to */
/* retrieve the advances. */
/* */
- /* Scaled advances are returned in 16.16 format, but aren't */
- /* transformed by the affine transform specified by @FT_Set_Transform */
+ /* Scaled advances are returned in 16.16 format but aren't */
+ /* transformed by the affine transformation specified by */
+ /* @FT_Set_Transform. */
/* */
FT_EXPORT( FT_Error )
FT_Get_Advances( FT_Face face,
FT_UInt start,
FT_UInt count,
- FT_UInt load_flags,
+ FT_Int32 load_flags,
FT_Fixed *padvances );
/* */
-#endif /* __FREETYPE_ADVANCE_H__ */
+
+FT_END_HEADER
+
+#endif /* __FTADVANC_H__ */
+
+
+/* END */
diff --git a/include/freetype/ftbbox.h b/include/freetype/ftbbox.h
index 050194c..01fe3fb 100644
--- a/include/freetype/ftbbox.h
+++ b/include/freetype/ftbbox.h
@@ -58,7 +58,7 @@ FT_BEGIN_HEADER
/* FT_Outline_Get_BBox */
/* */
/* <Description> */
- /* Computes the exact bounding box of an outline. This is slower */
+ /* Compute the exact bounding box of an outline. This is slower */
/* than computing the control box. However, it uses an advanced */
/* algorithm which returns _very_ quickly when the two boxes */
/* coincide. Otherwise, the outline Bézier arcs are traversed to */
@@ -71,7 +71,7 @@ FT_BEGIN_HEADER
/* abbox :: The outline's exact bounding box. */
/* */
/* <Return> */
- /* FreeType error code. 0 means success. */
+ /* FreeType error code. 0~means success. */
/* */
FT_EXPORT( FT_Error )
FT_Outline_Get_BBox( FT_Outline* outline,
diff --git a/include/freetype/ftbdf.h b/include/freetype/ftbdf.h
index 9555694..4f8baf8 100644
--- a/include/freetype/ftbdf.h
+++ b/include/freetype/ftbdf.h
@@ -4,7 +4,7 @@
/* */
/* FreeType API for accessing BDF-specific strings (specification). */
/* */
-/* Copyright 2002, 2003, 2004, 2006 by */
+/* Copyright 2002, 2003, 2004, 2006, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -38,38 +38,39 @@ FT_BEGIN_HEADER
/* bdf_fonts */
/* */
/* <Title> */
- /* BDF Files */
+ /* BDF and PCF Files */
/* */
/* <Abstract> */
- /* BDF specific API. */
+ /* BDF and PCF specific API. */
/* */
/* <Description> */
- /* This section contains the declaration of BDF specific functions. */
+ /* This section contains the declaration of functions specific to BDF */
+ /* and PCF fonts. */
/* */
/*************************************************************************/
- /**********************************************************************
- *
- * @enum:
- * FT_PropertyType
- *
- * @description:
- * A list of BDF property types.
- *
- * @values:
- * BDF_PROPERTY_TYPE_NONE ::
- * Value 0 is used to indicate a missing property.
- *
- * BDF_PROPERTY_TYPE_ATOM ::
- * Property is a string atom.
- *
- * BDF_PROPERTY_TYPE_INTEGER ::
- * Property is a 32-bit signed integer.
- *
- * BDF_PROPERTY_TYPE_CARDINAL ::
- * Property is a 32-bit unsigned integer.
- */
+ /**********************************************************************
+ *
+ * @enum:
+ * FT_PropertyType
+ *
+ * @description:
+ * A list of BDF property types.
+ *
+ * @values:
+ * BDF_PROPERTY_TYPE_NONE ::
+ * Value~0 is used to indicate a missing property.
+ *
+ * BDF_PROPERTY_TYPE_ATOM ::
+ * Property is a string atom.
+ *
+ * BDF_PROPERTY_TYPE_INTEGER ::
+ * Property is a 32-bit signed integer.
+ *
+ * BDF_PROPERTY_TYPE_CARDINAL ::
+ * Property is a 32-bit unsigned integer.
+ */
typedef enum BDF_PropertyType_
{
BDF_PROPERTY_TYPE_NONE = 0,
@@ -80,15 +81,15 @@ FT_BEGIN_HEADER
} BDF_PropertyType;
- /**********************************************************************
- *
- * @type:
- * BDF_Property
- *
- * @description:
- * A handle to a @BDF_PropertyRec structure to model a given
- * BDF/PCF property.
- */
+ /**********************************************************************
+ *
+ * @type:
+ * BDF_Property
+ *
+ * @description:
+ * A handle to a @BDF_PropertyRec structure to model a given
+ * BDF/PCF property.
+ */
typedef struct BDF_PropertyRec_* BDF_Property;
@@ -132,7 +133,7 @@ FT_BEGIN_HEADER
* FT_Get_BDF_Charset_ID
*
* @description:
- * Retrieves a BDF font character set identity, according to
+ * Retrieve a BDF font character set identity, according to
* the BDF specification.
*
* @input:
@@ -141,13 +142,13 @@ FT_BEGIN_HEADER
*
* @output:
* acharset_encoding ::
- * Charset encoding, as a C string, owned by the face.
+ * Charset encoding, as a C~string, owned by the face.
*
* acharset_registry ::
- * Charset registry, as a C string, owned by the face.
+ * Charset registry, as a C~string, owned by the face.
*
* @return:
- * FreeType error code. 0 means success.
+ * FreeType error code. 0~means success.
*
* @note:
* This function only works with BDF faces, returning an error otherwise.
@@ -164,7 +165,7 @@ FT_BEGIN_HEADER
* FT_Get_BDF_Property
*
* @description:
- * Retrieves a BDF property from a BDF or PCF font file.
+ * Retrieve a BDF property from a BDF or PCF font file.
*
* @input:
* face :: A handle to the input face.
@@ -175,13 +176,21 @@ FT_BEGIN_HEADER
* aproperty :: The property.
*
* @return:
- * FreeType error code. 0 means success.
+ * FreeType error code. 0~means success.
*
* @note:
* This function works with BDF _and_ PCF fonts. It returns an error
* otherwise. It also returns an error if the property is not in the
* font.
*
+ * A `property' is a either key-value pair within the STARTPROPERTIES
+ * ... ENDPROPERTIES block of a BDF font or a key-value pair from the
+ * `info->props' array within a `FontRec' structure of a PCF font.
+ *
+ * Integer properties are always stored as `signed' within PCF fonts;
+ * consequently, @BDF_PROPERTY_TYPE_CARDINAL is a possible return value
+ * for BDF fonts only.
+ *
* In case of error, `aproperty->type' is always set to
* @BDF_PROPERTY_TYPE_NONE.
*/
diff --git a/include/freetype/ftbitmap.h b/include/freetype/ftbitmap.h
index 337d888..9274236 100644
--- a/include/freetype/ftbitmap.h
+++ b/include/freetype/ftbitmap.h
@@ -2,10 +2,9 @@
/* */
/* ftbitmap.h */
/* */
-/* FreeType utility functions for converting 1bpp, 2bpp, 4bpp, and 8bpp */
-/* bitmaps into 8bpp format (specification). */
+/* FreeType utility functions for bitmaps (specification). */
/* */
-/* Copyright 2004, 2005, 2006 by */
+/* Copyright 2004, 2005, 2006, 2008 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -72,7 +71,7 @@ FT_BEGIN_HEADER
/* FT_Bitmap_Copy */
/* */
/* <Description> */
- /* Copies an bitmap into another one. */
+ /* Copy a bitmap into another one. */
/* */
/* <Input> */
/* library :: A handle to a library object. */
@@ -83,7 +82,7 @@ FT_BEGIN_HEADER
/* target :: A handle to the target bitmap. */
/* */
/* <Return> */
- /* FreeType error code. 0 means success. */
+ /* FreeType error code. 0~means success. */
/* */
FT_EXPORT( FT_Error )
FT_Bitmap_Copy( FT_Library library,
@@ -114,14 +113,14 @@ FT_BEGIN_HEADER
/* bitmap :: A handle to the target bitmap. */
/* */
/* <Return> */
- /* FreeType error code. 0 means success. */
+ /* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* The current implementation restricts `xStrength' to be less than */
- /* or equal to 8 if bitmap is of pixel_mode @FT_PIXEL_MODE_MONO. */
+ /* or equal to~8 if bitmap is of pixel_mode @FT_PIXEL_MODE_MONO. */
/* */
/* If you want to embolden the bitmap owned by a @FT_GlyphSlotRec, */
- /* you should call `FT_GlyphSlot_Own_Bitmap' on the slot first. */
+ /* you should call @FT_GlyphSlot_Own_Bitmap on the slot first. */
/* */
FT_EXPORT( FT_Error )
FT_Bitmap_Embolden( FT_Library library,
@@ -152,7 +151,7 @@ FT_BEGIN_HEADER
/* target :: The target bitmap. */
/* */
/* <Return> */
- /* FreeType error code. 0 means success. */
+ /* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* It is possible to call @FT_Bitmap_Convert multiple times without */
@@ -173,6 +172,28 @@ FT_BEGIN_HEADER
/*************************************************************************/
/* */
/* <Function> */
+ /* FT_GlyphSlot_Own_Bitmap */
+ /* */
+ /* <Description> */
+ /* Make sure that a glyph slot owns `slot->bitmap'. */
+ /* */
+ /* <Input> */
+ /* slot :: The glyph slot. */
+ /* */
+ /* <Return> */
+ /* FreeType error code. 0~means success. */
+ /* */
+ /* <Note> */
+ /* This function is to be used in combination with */
+ /* @FT_Bitmap_Embolden. */
+ /* */
+ FT_EXPORT( FT_Error )
+ FT_GlyphSlot_Own_Bitmap( FT_GlyphSlot slot );
+
+
+ /*************************************************************************/
+ /* */
+ /* <Function> */
/* FT_Bitmap_Done */
/* */
/* <Description> */
@@ -184,7 +205,7 @@ FT_BEGIN_HEADER
/* bitmap :: The bitmap object to be freed. */
/* */
/* <Return> */
- /* FreeType error code. 0 means success. */
+ /* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* The `library' argument is taken to have access to FreeType's */
diff --git a/include/freetype/ftcache.h b/include/freetype/ftcache.h
index 805df78..0916d70 100644
--- a/include/freetype/ftcache.h
+++ b/include/freetype/ftcache.h
@@ -36,10 +36,10 @@ FT_BEGIN_HEADER
* Cache Sub-System
*
* <Abstract>
- * How to cache face, size, and glyph data with FreeType 2.
+ * How to cache face, size, and glyph data with FreeType~2.
*
* <Description>
- * This section describes the FreeType 2 cache sub-system, which is used
+ * This section describes the FreeType~2 cache sub-system, which is used
* to limit the number of concurrently opened @FT_Face and @FT_Size
* objects, as well as caching information like character maps and glyph
* images while limiting their maximum memory usage.
@@ -193,7 +193,7 @@ FT_BEGIN_HEADER
* A new @FT_Face handle.
*
* <Return>
- * FreeType error code. 0 means success.
+ * FreeType error code. 0~means success.
*
* <Note>
* The third parameter `req_data' is the same as the one passed by the
@@ -260,7 +260,7 @@ FT_BEGIN_HEADER
/* */
/* <Description> */
/* An opaque handle to a cache node object. Each cache node is */
- /* reference-counted. A node with a count of 0 might be flushed */
+ /* reference-counted. A node with a count of~0 might be flushed */
/* out of a full cache whenever a lookup request is performed. */
/* */
/* If you lookup nodes, you have the ability to `acquire' them, i.e., */
@@ -279,19 +279,19 @@ FT_BEGIN_HEADER
/* FTC_Manager_New */
/* */
/* <Description> */
- /* Creates a new cache manager. */
+ /* Create a new cache manager. */
/* */
/* <Input> */
/* library :: The parent FreeType library handle to use. */
/* */
/* max_faces :: Maximum number of opened @FT_Face objects managed by */
- /* this cache instance. Use 0 for defaults. */
+ /* this cache instance. Use~0 for defaults. */
/* */
/* max_sizes :: Maximum number of opened @FT_Size objects managed by */
- /* this cache instance. Use 0 for defaults. */
+ /* this cache instance. Use~0 for defaults. */
/* */
/* max_bytes :: Maximum number of bytes to use for cached data nodes. */
- /* Use 0 for defaults. Note that this value does not */
+ /* Use~0 for defaults. Note that this value does not */
/* account for managed @FT_Face and @FT_Size objects. */
/* */
/* requester :: An application-provided callback used to translate */
@@ -301,11 +301,11 @@ FT_BEGIN_HEADER
/* each time it is called (see @FTC_Face_Requester). */
/* */
/* <Output> */
- /* amanager :: A handle to a new manager object. 0 in case of */
+ /* amanager :: A handle to a new manager object. 0~in case of */
/* failure. */
/* */
/* <Return> */
- /* FreeType error code. 0 means success. */
+ /* FreeType error code. 0~means success. */
/* */
FT_EXPORT( FT_Error )
FTC_Manager_New( FT_Library library,
@@ -323,7 +323,7 @@ FT_BEGIN_HEADER
/* FTC_Manager_Reset */
/* */
/* <Description> */
- /* Empties a given cache manager. This simply gets rid of all the */
+ /* Empty a given cache manager. This simply gets rid of all the */
/* currently cached @FT_Face and @FT_Size objects within the manager. */
/* */
/* <InOut> */
@@ -339,7 +339,7 @@ FT_BEGIN_HEADER
/* FTC_Manager_Done */
/* */
/* <Description> */
- /* Destroys a given manager after emptying it. */
+ /* Destroy a given manager after emptying it. */
/* */
/* <Input> */
/* manager :: A handle to the target cache manager object. */
@@ -354,7 +354,7 @@ FT_BEGIN_HEADER
/* FTC_Manager_LookupFace */
/* */
/* <Description> */
- /* Retrieves the @FT_Face object that corresponds to a given face ID */
+ /* Retrieve the @FT_Face object that corresponds to a given face ID */
/* through a cache manager. */
/* */
/* <Input> */
@@ -366,7 +366,7 @@ FT_BEGIN_HEADER
/* aface :: A handle to the face object. */
/* */
/* <Return> */
- /* FreeType error code. 0 means success. */
+ /* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* The returned @FT_Face object is always owned by the manager. You */
@@ -415,10 +415,10 @@ FT_BEGIN_HEADER
/* interpreted as integer pixel character sizes. */
/* Otherwise, they are expressed as 1/64th of points. */
/* */
- /* x_res :: Only used when `pixel' is value 0 to indicate the */
+ /* x_res :: Only used when `pixel' is value~0 to indicate the */
/* horizontal resolution in dpi. */
/* */
- /* y_res :: Only used when `pixel' is value 0 to indicate the */
+ /* y_res :: Only used when `pixel' is value~0 to indicate the */
/* vertical resolution in dpi. */
/* */
/* <Note> */
@@ -466,7 +466,7 @@ FT_BEGIN_HEADER
/* asize :: A handle to the size object. */
/* */
/* <Return> */
- /* FreeType error code. 0 means success. */
+ /* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* The returned @FT_Size object is always owned by the manager. You */
@@ -580,7 +580,7 @@ FT_BEGIN_HEADER
* A new cache handle. NULL in case of error.
*
* @return:
- * FreeType error code. 0 means success.
+ * FreeType error code. 0~means success.
*
* @note:
* Like all other caches, this one will be destroyed with the cache
@@ -609,13 +609,14 @@ FT_BEGIN_HEADER
* The source face ID.
*
* cmap_index ::
- * The index of the charmap in the source face.
+ * The index of the charmap in the source face. Any negative value
+ * means to use the cache @FT_Face's default charmap.
*
* char_code ::
* The character code (in the corresponding charmap).
*
* @return:
- * Glyph index. 0 means `no glyph'.
+ * Glyph index. 0~means `no glyph'.
*
*/
FT_EXPORT( FT_UInt )
@@ -721,7 +722,7 @@ FT_BEGIN_HEADER
/* FTC_ImageCache_New */
/* */
/* <Description> */
- /* Creates a new glyph image cache. */
+ /* Create a new glyph image cache. */
/* */
/* <Input> */
/* manager :: The parent manager for the image cache. */
@@ -730,7 +731,7 @@ FT_BEGIN_HEADER
/* acache :: A handle to the new glyph image cache object. */
/* */
/* <Return> */
- /* FreeType error code. 0 means success. */
+ /* FreeType error code. 0~means success. */
/* */
FT_EXPORT( FT_Error )
FTC_ImageCache_New( FTC_Manager manager,
@@ -743,7 +744,7 @@ FT_BEGIN_HEADER
/* FTC_ImageCache_Lookup */
/* */
/* <Description> */
- /* Retrieves a given glyph image from a glyph image cache. */
+ /* Retrieve a given glyph image from a glyph image cache. */
/* */
/* <Input> */
/* cache :: A handle to the source glyph image cache. */
@@ -753,7 +754,7 @@ FT_BEGIN_HEADER
/* gindex :: The glyph index to retrieve. */
/* */
/* <Output> */
- /* aglyph :: The corresponding @FT_Glyph object. 0 in case of */
+ /* aglyph :: The corresponding @FT_Glyph object. 0~in case of */
/* failure. */
/* */
/* anode :: Used to return the address of of the corresponding cache */
@@ -761,7 +762,7 @@ FT_BEGIN_HEADER
/* below). */
/* */
/* <Return> */
- /* FreeType error code. 0 means success. */
+ /* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* The returned glyph is owned and managed by the glyph image cache. */
@@ -806,7 +807,7 @@ FT_BEGIN_HEADER
/* gindex :: The glyph index to retrieve. */
/* */
/* <Output> */
- /* aglyph :: The corresponding @FT_Glyph object. 0 in case of */
+ /* aglyph :: The corresponding @FT_Glyph object. 0~in case of */
/* failure. */
/* */
/* anode :: Used to return the address of of the corresponding */
@@ -814,7 +815,7 @@ FT_BEGIN_HEADER
/* (see note below). */
/* */
/* <Return> */
- /* FreeType error code. 0 means success. */
+ /* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* The returned glyph is owned and managed by the glyph image cache. */
@@ -832,6 +833,9 @@ FT_BEGIN_HEADER
/* call to one of the caching sub-system APIs. Don't assume that it */
/* is persistent! */
/* */
+ /* Calls to @FT_Set_Char_Size and friends have no effect on cached */
+ /* glyphs; you should always use the FreeType cache API instead. */
+ /* */
FT_EXPORT( FT_Error )
FTC_ImageCache_LookupScaler( FTC_ImageCache cache,
FTC_Scaler scaler,
@@ -873,11 +877,11 @@ FT_BEGIN_HEADER
/* top :: The vertical distance from the pen position (on the */
/* baseline) to the upper bitmap border (a.k.a. `top */
/* side bearing'). The distance is positive for upwards */
- /* Y coordinates. */
+ /* y~coordinates. */
/* */
/* format :: The format of the glyph bitmap (monochrome or gray). */
/* */
- /* max_grays :: Maximum gray level value (in the range 1 to 255). */
+ /* max_grays :: Maximum gray level value (in the range 1 to~255). */
/* */
/* pitch :: The number of bytes per bitmap line. May be positive */
/* or negative. */
@@ -926,7 +930,7 @@ FT_BEGIN_HEADER
/* FTC_SBitCache_New */
/* */
/* <Description> */
- /* Creates a new cache to store small glyph bitmaps. */
+ /* Create a new cache to store small glyph bitmaps. */
/* */
/* <Input> */
/* manager :: A handle to the source cache manager. */
@@ -935,7 +939,7 @@ FT_BEGIN_HEADER
/* acache :: A handle to the new sbit cache. NULL in case of error. */
/* */
/* <Return> */
- /* FreeType error code. 0 means success. */
+ /* FreeType error code. 0~means success. */
/* */
FT_EXPORT( FT_Error )
FTC_SBitCache_New( FTC_Manager manager,
@@ -948,7 +952,7 @@ FT_BEGIN_HEADER
/* FTC_SBitCache_Lookup */
/* */
/* <Description> */
- /* Looks up a given small glyph bitmap in a given sbit cache and */
+ /* Look up a given small glyph bitmap in a given sbit cache and */
/* `lock' it to prevent its flushing from the cache until needed. */
/* */
/* <Input> */
@@ -966,7 +970,7 @@ FT_BEGIN_HEADER
/* below). */
/* */
/* <Return> */
- /* FreeType error code. 0 means success. */
+ /* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* The small bitmap descriptor and its bit buffer are owned by the */
@@ -974,7 +978,7 @@ FT_BEGIN_HEADER
/* as well disappear from memory on the next cache lookup, so don't */
/* treat them as persistent data. */
/* */
- /* The descriptor's `buffer' field is set to 0 to indicate a missing */
+ /* The descriptor's `buffer' field is set to~0 to indicate a missing */
/* glyph bitmap. */
/* */
/* If `anode' is _not_ NULL, it receives the address of the cache */
@@ -1021,7 +1025,7 @@ FT_BEGIN_HEADER
/* (see note below). */
/* */
/* <Return> */
- /* FreeType error code. 0 means success. */
+ /* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* The small bitmap descriptor and its bit buffer are owned by the */
@@ -1029,7 +1033,7 @@ FT_BEGIN_HEADER
/* as well disappear from memory on the next cache lookup, so don't */
/* treat them as persistent data. */
/* */
- /* The descriptor's `buffer' field is set to 0 to indicate a missing */
+ /* The descriptor's `buffer' field is set to~0 to indicate a missing */
/* glyph bitmap. */
/* */
/* If `anode' is _not_ NULL, it receives the address of the cache */
diff --git a/include/freetype/ftchapters.h b/include/freetype/ftchapters.h
index 4c61824..7775a6b 100644
--- a/include/freetype/ftchapters.h
+++ b/include/freetype/ftchapters.h
@@ -90,6 +90,7 @@
/* computations */
/* list_processing */
/* outline_processing */
+/* quick_advance */
/* bitmap_handling */
/* raster */
/* glyph_stroker */
diff --git a/include/freetype/ftcid.h b/include/freetype/ftcid.h
index f0387f0..203a30c 100644
--- a/include/freetype/ftcid.h
+++ b/include/freetype/ftcid.h
@@ -4,7 +4,7 @@
/* */
/* FreeType API for accessing CID font information (specification). */
/* */
-/* Copyright 2007 by Dereg Clegg. */
+/* Copyright 2007, 2009 by Dereg Clegg, Michael Toftdal. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
@@ -64,16 +64,16 @@ FT_BEGIN_HEADER
*
* @output:
* registry ::
- * The registry, as a C string, owned by the face.
+ * The registry, as a C~string, owned by the face.
*
* ordering ::
- * The ordering, as a C string, owned by the face.
+ * The ordering, as a C~string, owned by the face.
*
* supplement ::
* The supplement.
*
* @return:
- * FreeType error code. 0 means success.
+ * FreeType error code. 0~means success.
*
* @note:
* This function only works with CID faces, returning an error
@@ -88,6 +88,74 @@ FT_BEGIN_HEADER
const char* *ordering,
FT_Int *supplement);
+
+ /**********************************************************************
+ *
+ * @function:
+ * FT_Get_CID_Is_Internally_CID_Keyed
+ *
+ * @description:
+ * Retrieve the type of the input face, CID keyed or not. In
+ * constrast to the @FT_IS_CID_KEYED macro this function returns
+ * successfully also for CID-keyed fonts in an SNFT wrapper.
+ *
+ * @input:
+ * face ::
+ * A handle to the input face.
+ *
+ * @output:
+ * is_cid ::
+ * The type of the face as an @FT_Bool.
+ *
+ * @return:
+ * FreeType error code. 0~means success.
+ *
+ * @note:
+ * This function only works with CID faces and OpenType fonts,
+ * returning an error otherwise.
+ *
+ * @since:
+ * 2.3.9
+ */
+ FT_EXPORT( FT_Error )
+ FT_Get_CID_Is_Internally_CID_Keyed( FT_Face face,
+ FT_Bool *is_cid );
+
+
+ /**********************************************************************
+ *
+ * @function:
+ * FT_Get_CID_From_Glyph_Index
+ *
+ * @description:
+ * Retrieve the CID of the input glyph index.
+ *
+ * @input:
+ * face ::
+ * A handle to the input face.
+ *
+ * glyph_index ::
+ * The input glyph index.
+ *
+ * @output:
+ * cid ::
+ * The CID as an @FT_UInt.
+ *
+ * @return:
+ * FreeType error code. 0~means success.
+ *
+ * @note:
+ * This function only works with CID faces and OpenType fonts,
+ * returning an error otherwise.
+ *
+ * @since:
+ * 2.3.9
+ */
+ FT_EXPORT( FT_Error )
+ FT_Get_CID_From_Glyph_Index( FT_Face face,
+ FT_UInt glyph_index,
+ FT_UInt *cid );
+
/* */
FT_END_HEADER
diff --git a/include/freetype/ftgasp.h b/include/freetype/ftgasp.h
index 2692c31..91a769e 100644
--- a/include/freetype/ftgasp.h
+++ b/include/freetype/ftgasp.h
@@ -22,6 +22,13 @@
#include <ft2build.h>
#include FT_FREETYPE_H
+#ifdef FREETYPE_H
+#error "freetype.h of FreeType 1 has been loaded!"
+#error "Please fix the directory search order for header files"
+#error "so that freetype.h of FreeType 2 is found first."
+#endif
+
+
/***************************************************************************
*
* @section:
@@ -31,11 +38,11 @@
* Gasp Table
*
* @abstract:
- * Retrieving TrueType `gasp' table entries
+ * Retrieving TrueType `gasp' table entries.
*
* @description:
* The function @FT_Get_Gasp can be used to query a TrueType or OpenType
- * font for specific entries in their `gasp' table, if any. This is
+ * font for specific entries in its `gasp' table, if any. This is
* mainly useful when implementing native TrueType hinting with the
* bytecode interpreter to duplicate the Windows text rendering results.
*/
diff --git a/include/freetype/ftglyph.h b/include/freetype/ftglyph.h
index 832f49c..cacccf0 100644
--- a/include/freetype/ftglyph.h
+++ b/include/freetype/ftglyph.h
@@ -4,7 +4,7 @@
/* */
/* FreeType convenience functions to handle glyphs (specification). */
/* */
-/* Copyright 1996-2001, 2002, 2003, 2006 by */
+/* Copyright 1996-2001, 2002, 2003, 2006, 2008, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -145,7 +145,7 @@ FT_BEGIN_HEADER
/* */
/* top :: The top-side bearing, i.e., the vertical distance from */
/* the current pen position to the top border of the glyph */
- /* bitmap. This distance is positive for upwards-y! */
+ /* bitmap. This distance is positive for upwards~y! */
/* */
/* bitmap :: A descriptor for the bitmap. */
/* */
@@ -194,7 +194,7 @@ FT_BEGIN_HEADER
/* outline :: A descriptor for the outline. */
/* */
/* <Note> */
- /* You can typecast a @FT_Glyph to @FT_OutlineGlyph if you have */
+ /* You can typecast an @FT_Glyph to @FT_OutlineGlyph if you have */
/* `glyph->format == FT_GLYPH_FORMAT_OUTLINE'. This lets you access */
/* the outline's content easily. */
/* */
@@ -219,7 +219,8 @@ FT_BEGIN_HEADER
/* FT_Get_Glyph */
/* */
/* <Description> */
- /* A function used to extract a glyph image from a slot. */
+ /* A function used to extract a glyph image from a slot. Note that */
+ /* the created @FT_Glyph object must be released with @FT_Done_Glyph. */
/* */
/* <Input> */
/* slot :: A handle to the source glyph slot. */
@@ -228,7 +229,7 @@ FT_BEGIN_HEADER
/* aglyph :: A handle to the glyph object. */
/* */
/* <Return> */
- /* FreeType error code. 0 means success. */
+ /* FreeType error code. 0~means success. */
/* */
FT_EXPORT( FT_Error )
FT_Get_Glyph( FT_GlyphSlot slot,
@@ -248,11 +249,11 @@ FT_BEGIN_HEADER
/* source :: A handle to the source glyph object. */
/* */
/* <Output> */
- /* target :: A handle to the target glyph object. 0 in case of */
+ /* target :: A handle to the target glyph object. 0~in case of */
/* error. */
/* */
/* <Return> */
- /* FreeType error code. 0 means success. */
+ /* FreeType error code. 0~means success. */
/* */
FT_EXPORT( FT_Error )
FT_Glyph_Copy( FT_Glyph source,
@@ -265,7 +266,7 @@ FT_BEGIN_HEADER
/* FT_Glyph_Transform */
/* */
/* <Description> */
- /* Transforms a glyph image if its format is scalable. */
+ /* Transform a glyph image if its format is scalable. */
/* */
/* <InOut> */
/* glyph :: A handle to the target glyph object. */
@@ -375,7 +376,7 @@ FT_BEGIN_HEADER
/* expressed in 1/64th of pixels if it is grid-fitted. */
/* */
/* <Note> */
- /* Coordinates are relative to the glyph origin, using the Y-upwards */
+ /* Coordinates are relative to the glyph origin, using the y~upwards */
/* convention. */
/* */
/* If the glyph has been loaded with @FT_LOAD_NO_SCALE, `bbox_mode' */
@@ -421,17 +422,17 @@ FT_BEGIN_HEADER
/* FT_Glyph_To_Bitmap */
/* */
/* <Description> */
- /* Converts a given glyph object to a bitmap glyph object. */
+ /* Convert a given glyph object to a bitmap glyph object. */
/* */
/* <InOut> */
/* the_glyph :: A pointer to a handle to the target glyph. */
/* */
/* <Input> */
- /* render_mode :: An enumeration that describe how the data is */
+ /* render_mode :: An enumeration that describes how the data is */
/* rendered. */
/* */
/* origin :: A pointer to a vector used to translate the glyph */
- /* image before rendering. Can be 0 (if no */
+ /* image before rendering. Can be~0 (if no */
/* translation). The origin is expressed in */
/* 26.6 pixels. */
/* */
@@ -440,15 +441,17 @@ FT_BEGIN_HEADER
/* never destroyed in case of error. */
/* */
/* <Return> */
- /* FreeType error code. 0 means success. */
+ /* FreeType error code. 0~means success. */
/* */
/* <Note> */
+ /* This function does nothing if the glyph format isn't scalable. */
+ /* */
/* The glyph image is translated with the `origin' vector before */
/* rendering. */
/* */
/* The first parameter is a pointer to an @FT_Glyph handle, that will */
- /* be replaced by this function. Typically, you would use (omitting */
- /* error handling): */
+ /* be _replaced_ by this function (with newly allocated data). */
+ /* Typically, you would use (omitting error handling): */
/* */
/* */
/* { */
@@ -462,12 +465,12 @@ FT_BEGIN_HEADER
/* // extract glyph image */
/* error = FT_Get_Glyph( face->glyph, &glyph ); */
/* */
- /* // convert to a bitmap (default render mode + destroy old) */
+ /* // convert to a bitmap (default render mode + destroying old) */
/* if ( glyph->format != FT_GLYPH_FORMAT_BITMAP ) */
/* { */
/* error = FT_Glyph_To_Bitmap( &glyph, FT_RENDER_MODE_DEFAULT, */
/* 0, 1 ); */
- /* if ( error ) // glyph unchanged */
+ /* if ( error ) // `glyph' unchanged */
/* ... */
/* } */
/* */
@@ -482,7 +485,42 @@ FT_BEGIN_HEADER
/* } */
/* */
/* */
- /* This function does nothing if the glyph format isn't scalable. */
+ /* Here another example, again without error handling: */
+ /* */
+ /* */
+ /* { */
+ /* FT_Glyph glyphs[MAX_GLYPHS] */
+ /* */
+ /* */
+ /* ... */
+ /* */
+ /* for ( idx = 0; i < MAX_GLYPHS; i++ ) */
+ /* error = FT_Load_Glyph( face, idx, FT_LOAD_DEFAULT ) || */
+ /* FT_Get_Glyph ( face->glyph, &glyph[idx] ); */
+ /* */
+ /* ... */
+ /* */
+ /* for ( idx = 0; i < MAX_GLYPHS; i++ ) */
+ /* { */
+ /* FT_Glyph bitmap = glyphs[idx]; */
+ /* */
+ /* */
+ /* ... */
+ /* */
+ /* // after this call, `bitmap' no longer points into */
+ /* // the `glyphs' array (and the old value isn't destroyed) */
+ /* FT_Glyph_To_Bitmap( &bitmap, FT_RENDER_MODE_MONO, 0, 0 ); */
+ /* */
+ /* ... */
+ /* */
+ /* FT_Done_Glyph( bitmap ); */
+ /* } */
+ /* */
+ /* ... */
+ /* */
+ /* for ( idx = 0; i < MAX_GLYPHS; i++ ) */
+ /* FT_Done_Glyph( glyphs[idx] ); */
+ /* } */
/* */
FT_EXPORT( FT_Error )
FT_Glyph_To_Bitmap( FT_Glyph* the_glyph,
@@ -497,7 +535,7 @@ FT_BEGIN_HEADER
/* FT_Done_Glyph */
/* */
/* <Description> */
- /* Destroys a given glyph. */
+ /* Destroy a given glyph. */
/* */
/* <Input> */
/* glyph :: A handle to the target glyph object. */
@@ -524,7 +562,7 @@ FT_BEGIN_HEADER
/* FT_Matrix_Multiply */
/* */
/* <Description> */
- /* Performs the matrix operation `b = a*b'. */
+ /* Perform the matrix operation `b = a*b'. */
/* */
/* <Input> */
/* a :: A pointer to matrix `a'. */
@@ -546,14 +584,14 @@ FT_BEGIN_HEADER
/* FT_Matrix_Invert */
/* */
/* <Description> */
- /* Inverts a 2x2 matrix. Returns an error if it can't be inverted. */
+ /* Invert a 2x2 matrix. Return an error if it can't be inverted. */
/* */
/* <InOut> */
/* matrix :: A pointer to the target matrix. Remains untouched in */
/* case of error. */
/* */
/* <Return> */
- /* FreeType error code. 0 means success. */
+ /* FreeType error code. 0~means success. */
/* */
FT_EXPORT( FT_Error )
FT_Matrix_Invert( FT_Matrix* matrix );
diff --git a/include/freetype/ftgxval.h b/include/freetype/ftgxval.h
index c7ea861..497015c 100644
--- a/include/freetype/ftgxval.h
+++ b/include/freetype/ftgxval.h
@@ -202,7 +202,7 @@ FT_BEGIN_HEADER
* The array itself must be allocated by a client.
*
* @return:
- * FreeType error code. 0 means success.
+ * FreeType error code. 0~means success.
*
* @note:
* This function only works with TrueTypeGX fonts, returning an error
@@ -285,14 +285,14 @@ FT_BEGIN_HEADER
* FT_ClassicKern_Validate
*
* @description:
- * Validate classic (16bit format) kern table to assure that the offsets
+ * Validate classic (16-bit format) kern table to assure that the offsets
* and indices are valid. The idea is that a higher-level library which
* actually does the text layout can access those tables without error
* checking (which can be quite time consuming).
*
* The `kern' table validator in @FT_TrueTypeGX_Validate deals with both
- * the new 32bit format and the classic 16bit format, while
- * FT_ClassicKern_Validate only supports the classic 16bit format.
+ * the new 32-bit format and the classic 16-bit format, while
+ * FT_ClassicKern_Validate only supports the classic 16-bit format.
*
* @input:
* face ::
@@ -307,7 +307,7 @@ FT_BEGIN_HEADER
* A pointer to the kern table.
*
* @return:
- * FreeType error code. 0 means success.
+ * FreeType error code. 0~means success.
*
* @note:
* After use, the application should deallocate the buffers pointed to by
diff --git a/include/freetype/ftgzip.h b/include/freetype/ftgzip.h
index 9893437..acbc4f0 100644
--- a/include/freetype/ftgzip.h
+++ b/include/freetype/ftgzip.h
@@ -66,7 +66,7 @@ FT_BEGIN_HEADER
* The source stream.
*
* @return:
- * FreeType error code. 0 means success.
+ * FreeType error code. 0~means success.
*
* @note:
* The source stream must be opened _before_ calling this function.
diff --git a/include/freetype/ftimage.h b/include/freetype/ftimage.h
index 56acb17..ccc2f71 100644
--- a/include/freetype/ftimage.h
+++ b/include/freetype/ftimage.h
@@ -53,7 +53,7 @@ FT_BEGIN_HEADER
/* <Description> */
/* The type FT_Pos is a 32-bit integer used to store vectorial */
/* coordinates. Depending on the context, these can represent */
- /* distances in integer font units, or 16,16, or 26.6 fixed float */
+ /* distances in integer font units, or 16.16, or 26.6 fixed float */
/* pixel coordinates. */
/* */
typedef signed long FT_Pos;
@@ -119,39 +119,40 @@ FT_BEGIN_HEADER
/* */
/* <Values> */
/* FT_PIXEL_MODE_NONE :: */
- /* Value 0 is reserved. */
+ /* Value~0 is reserved. */
/* */
/* FT_PIXEL_MODE_MONO :: */
- /* A monochrome bitmap, using 1 bit per pixel. Note that pixels */
+ /* A monochrome bitmap, using 1~bit per pixel. Note that pixels */
/* are stored in most-significant order (MSB), which means that */
/* the left-most pixel in a byte has value 128. */
/* */
/* FT_PIXEL_MODE_GRAY :: */
/* An 8-bit bitmap, generally used to represent anti-aliased glyph */
/* images. Each pixel is stored in one byte. Note that the number */
- /* of value `gray' levels is stored in the `num_bytes' field of */
- /* the @FT_Bitmap structure (it generally is 256). */
+ /* of `gray' levels is stored in the `num_grays' field of the */
+ /* @FT_Bitmap structure (it generally is 256). */
/* */
/* FT_PIXEL_MODE_GRAY2 :: */
- /* A 2-bit/pixel bitmap, used to represent embedded anti-aliased */
- /* bitmaps in font files according to the OpenType specification. */
- /* We haven't found a single font using this format, however. */
+ /* A 2-bit per pixel bitmap, used to represent embedded */
+ /* anti-aliased bitmaps in font files according to the OpenType */
+ /* specification. We haven't found a single font using this */
+ /* format, however. */
/* */
/* FT_PIXEL_MODE_GRAY4 :: */
- /* A 4-bit/pixel bitmap, used to represent embedded anti-aliased */
+ /* A 4-bit per pixel bitmap, representing embedded anti-aliased */
/* bitmaps in font files according to the OpenType specification. */
/* We haven't found a single font using this format, however. */
/* */
/* FT_PIXEL_MODE_LCD :: */
- /* An 8-bit bitmap, used to represent RGB or BGR decimated glyph */
- /* images used for display on LCD displays; the bitmap is three */
- /* times wider than the original glyph image. See also */
+ /* An 8-bit bitmap, representing RGB or BGR decimated glyph images */
+ /* used for display on LCD displays; the bitmap is three times */
+ /* wider than the original glyph image. See also */
/* @FT_RENDER_MODE_LCD. */
/* */
/* FT_PIXEL_MODE_LCD_V :: */
- /* An 8-bit bitmap, used to represent RGB or BGR decimated glyph */
- /* images used for display on rotated LCD displays; the bitmap */
- /* is three times taller than the original glyph image. See also */
+ /* An 8-bit bitmap, representing RGB or BGR decimated glyph images */
+ /* used for display on rotated LCD displays; the bitmap is three */
+ /* times taller than the original glyph image. See also */
/* @FT_RENDER_MODE_LCD_V. */
/* */
typedef enum FT_Pixel_Mode_
@@ -207,10 +208,10 @@ FT_BEGIN_HEADER
/* used with ft_pixel_mode_pal4 and ft_pixel_mode_pal8. */
/* */
/* <Values> */
- /* ft_palette_mode_rgb :: The palette is an array of 3-bytes RGB */
+ /* ft_palette_mode_rgb :: The palette is an array of 3-byte RGB */
/* records. */
/* */
- /* ft_palette_mode_rgba :: The palette is an array of 4-bytes RGBA */
+ /* ft_palette_mode_rgba :: The palette is an array of 4-byte RGBA */
/* records. */
/* */
/* <Note> */
@@ -317,11 +318,11 @@ FT_BEGIN_HEADER
/* elements, giving the outline's point coordinates. */
/* */
/* tags :: A pointer to an array of `n_points' chars, giving */
- /* each outline point's type. If bit 0 is unset, the */
+ /* each outline point's type. If bit~0 is unset, the */
/* point is `off' the curve, i.e., a Bézier control */
/* point, while it is `on' when set. */
/* */
- /* Bit 1 is meaningful for `off' points only. If set, */
+ /* Bit~1 is meaningful for `off' points only. If set, */
/* it indicates a third-order Bézier arc control point; */
/* and a second-order control point if unset. */
/* */
@@ -352,67 +353,73 @@ FT_BEGIN_HEADER
/*************************************************************************/
/* */
/* <Enum> */
- /* FT_OUTLINE_FLAGS */
+ /* FT_OUTLINE_FLAGS */
/* */
/* <Description> */
/* A list of bit-field constants use for the flags in an outline's */
/* `flags' field. */
/* */
/* <Values> */
- /* FT_OUTLINE_NONE :: Value 0 is reserved. */
- /* */
- /* FT_OUTLINE_OWNER :: If set, this flag indicates that the */
- /* outline's field arrays (i.e., */
- /* `points', `flags' & `contours') are */
- /* `owned' by the outline object, and */
- /* should thus be freed when it is */
- /* destroyed. */
- /* */
- /* FT_OUTLINE_EVEN_ODD_FILL :: By default, outlines are filled using */
- /* the non-zero winding rule. If set to */
- /* 1, the outline will be filled using */
- /* the even-odd fill rule (only works */
- /* with the smooth raster). */
- /* */
- /* FT_OUTLINE_REVERSE_FILL :: By default, outside contours of an */
- /* outline are oriented in clock-wise */
- /* direction, as defined in the TrueType */
- /* specification. This flag is set if */
- /* the outline uses the opposite */
- /* direction (typically for Type 1 */
- /* fonts). This flag is ignored by the */
- /* scan-converter. */
- /* */
- /* FT_OUTLINE_IGNORE_DROPOUTS :: By default, the scan converter will */
- /* try to detect drop-outs in an outline */
- /* and correct the glyph bitmap to */
- /* ensure consistent shape continuity. */
- /* If set, this flag hints the scan-line */
- /* converter to ignore such cases. */
- /* */
- /* FT_OUTLINE_HIGH_PRECISION :: This flag indicates that the */
- /* scan-line converter should try to */
- /* convert this outline to bitmaps with */
- /* the highest possible quality. It is */
- /* typically set for small character */
- /* sizes. Note that this is only a */
- /* hint, that might be completely */
- /* ignored by a given scan-converter. */
- /* */
- /* FT_OUTLINE_SINGLE_PASS :: This flag is set to force a given */
- /* scan-converter to only use a single */
- /* pass over the outline to render a */
- /* bitmap glyph image. Normally, it is */
- /* set for very large character sizes. */
- /* It is only a hint, that might be */
- /* completely ignored by a given */
- /* scan-converter. */
+ /* FT_OUTLINE_NONE :: */
+ /* Value~0 is reserved. */
+ /* */
+ /* FT_OUTLINE_OWNER :: */
+ /* If set, this flag indicates that the outline's field arrays */
+ /* (i.e., `points', `flags', and `contours') are `owned' by the */
+ /* outline object, and should thus be freed when it is destroyed. */
+ /* */
+ /* FT_OUTLINE_EVEN_ODD_FILL :: */
+ /* By default, outlines are filled using the non-zero winding rule. */
+ /* If set to 1, the outline will be filled using the even-odd fill */
+ /* rule (only works with the smooth raster). */
+ /* */
+ /* FT_OUTLINE_REVERSE_FILL :: */
+ /* By default, outside contours of an outline are oriented in */
+ /* clock-wise direction, as defined in the TrueType specification. */
+ /* This flag is set if the outline uses the opposite direction */
+ /* (typically for Type~1 fonts). This flag is ignored by the scan */
+ /* converter. */
+ /* */
+ /* FT_OUTLINE_IGNORE_DROPOUTS :: */
+ /* By default, the scan converter will try to detect drop-outs in */
+ /* an outline and correct the glyph bitmap to ensure consistent */
+ /* shape continuity. If set, this flag hints the scan-line */
+ /* converter to ignore such cases. */
+ /* */
+ /* FT_OUTLINE_SMART_DROPOUTS :: */
+ /* Select smart dropout control. If unset, use simple dropout */
+ /* control. Ignored if @FT_OUTLINE_IGNORE_DROPOUTS is set. */
+ /* */
+ /* FT_OUTLINE_INCLUDE_STUBS :: */
+ /* If set, turn pixels on for `stubs', otherwise exclude them. */
+ /* Ignored if @FT_OUTLINE_IGNORE_DROPOUTS is set. */
+ /* */
+ /* FT_OUTLINE_HIGH_PRECISION :: */
+ /* This flag indicates that the scan-line converter should try to */
+ /* convert this outline to bitmaps with the highest possible */
+ /* quality. It is typically set for small character sizes. Note */
+ /* that this is only a hint that might be completely ignored by a */
+ /* given scan-converter. */
+ /* */
+ /* FT_OUTLINE_SINGLE_PASS :: */
+ /* This flag is set to force a given scan-converter to only use a */
+ /* single pass over the outline to render a bitmap glyph image. */
+ /* Normally, it is set for very large character sizes. It is only */
+ /* a hint that might be completely ignored by a given */
+ /* scan-converter. */
+ /* */
+ /* <Note> */
+ /* Please refer to the description of the `SCANTYPE' instruction in */
+ /* the OpenType specification (in file `ttinst1.doc') how simple */
+ /* drop-outs, smart drop-outs, and stubs are defined. */
/* */
#define FT_OUTLINE_NONE 0x0
#define FT_OUTLINE_OWNER 0x1
#define FT_OUTLINE_EVEN_ODD_FILL 0x2
#define FT_OUTLINE_REVERSE_FILL 0x4
#define FT_OUTLINE_IGNORE_DROPOUTS 0x8
+#define FT_OUTLINE_SMART_DROPOUTS 0x10
+#define FT_OUTLINE_INCLUDE_STUBS 0x20
#define FT_OUTLINE_HIGH_PRECISION 0x100
#define FT_OUTLINE_SINGLE_PASS 0x200
@@ -483,7 +490,7 @@ FT_BEGIN_HEADER
/* decomposition function. */
/* */
/* <Return> */
- /* Error code. 0 means success. */
+ /* Error code. 0~means success. */
/* */
typedef int
(*FT_Outline_MoveToFunc)( const FT_Vector* to,
@@ -510,7 +517,7 @@ FT_BEGIN_HEADER
/* decomposition function. */
/* */
/* <Return> */
- /* Error code. 0 means success. */
+ /* Error code. 0~means success. */
/* */
typedef int
(*FT_Outline_LineToFunc)( const FT_Vector* to,
@@ -541,7 +548,7 @@ FT_BEGIN_HEADER
/* the decomposition function. */
/* */
/* <Return> */
- /* Error code. 0 means success. */
+ /* Error code. 0~means success. */
/* */
typedef int
(*FT_Outline_ConicToFunc)( const FT_Vector* control,
@@ -573,7 +580,7 @@ FT_BEGIN_HEADER
/* the decomposition function. */
/* */
/* <Return> */
- /* Error code. 0 means success. */
+ /* Error code. 0~means success. */
/* */
typedef int
(*FT_Outline_CubicToFunc)( const FT_Vector* control1,
@@ -619,7 +626,7 @@ FT_BEGIN_HEADER
/* y' = (x << shift) - delta */
/* } */
/* */
- /* Set the value of `shift' and `delta' to 0 to get the original */
+ /* Set the value of `shift' and `delta' to~0 to get the original */
/* point coordinates. */
/* */
typedef struct FT_Outline_Funcs_
@@ -652,7 +659,7 @@ FT_BEGIN_HEADER
/* This macro converts four-letter tags to an unsigned long type. */
/* */
/* <Note> */
- /* Since many 16bit compilers don't like 32bit enumerations, you */
+ /* Since many 16-bit compilers don't like 32-bit enumerations, you */
/* should redefine this macro in case of problems to something like */
/* this: */
/* */
@@ -684,7 +691,7 @@ FT_BEGIN_HEADER
/* */
/* <Values> */
/* FT_GLYPH_FORMAT_NONE :: */
- /* The value 0 is reserved. */
+ /* The value~0 is reserved. */
/* */
/* FT_GLYPH_FORMAT_COMPOSITE :: */
/* The glyph image is a composite of several other images. This */
@@ -704,7 +711,7 @@ FT_BEGIN_HEADER
/* */
/* FT_GLYPH_FORMAT_PLOTTER :: */
/* The glyph image is a vectorial path with no inside and outside */
- /* contours. Some Type 1 fonts, like those in the Hershey family, */
+ /* contours. Some Type~1 fonts, like those in the Hershey family, */
/* contain glyphs in this format. These are described as */
/* @FT_Outline, but FreeType isn't currently capable of rendering */
/* them correctly. */
@@ -816,10 +823,11 @@ FT_BEGIN_HEADER
/* */
/* <Note> */
/* This structure is used by the span drawing callback type named */
- /* @FT_SpanFunc which takes the y-coordinate of the span as a */
+ /* @FT_SpanFunc which takes the y~coordinate of the span as a */
/* a parameter. */
/* */
- /* The coverage value is always between 0 and 255. */
+ /* The coverage value is always between 0 and 255. If you want less */
+ /* gray values, the callback function has to reduce them. */
/* */
typedef struct FT_Span_
{
@@ -841,7 +849,7 @@ FT_BEGIN_HEADER
/* spans on each scan line. */
/* */
/* <Input> */
- /* y :: The scanline's y-coordinate. */
+ /* y :: The scanline's y~coordinate. */
/* */
/* count :: The number of spans to draw on this scanline. */
/* */
@@ -858,8 +866,8 @@ FT_BEGIN_HEADER
/* */
/* Note that the `count' field cannot be greater than a fixed value */
/* defined by the `FT_MAX_GRAY_SPANS' configuration macro in */
- /* `ftoption.h'. By default, this value is set to 32, which means */
- /* that if there are more than 32 spans on a given scanline, the */
+ /* `ftoption.h'. By default, this value is set to~32, which means */
+ /* that if there are more than 32~spans on a given scanline, the */
/* callback is called several times with the same `y' parameter in */
/* order to draw all callbacks. */
/* */
@@ -889,14 +897,14 @@ FT_BEGIN_HEADER
/* per-se the TrueType spec. */
/* */
/* <Input> */
- /* y :: The pixel's y-coordinate. */
+ /* y :: The pixel's y~coordinate. */
/* */
- /* x :: The pixel's x-coordinate. */
+ /* x :: The pixel's x~coordinate. */
/* */
/* user :: User-supplied data that is passed to the callback. */
/* */
/* <Return> */
- /* 1 if the pixel is `set', 0 otherwise. */
+ /* 1~if the pixel is `set', 0~otherwise. */
/* */
typedef int
(*FT_Raster_BitTest_Func)( int y,
@@ -917,14 +925,14 @@ FT_BEGIN_HEADER
/* drop-out control according to the TrueType specification. */
/* */
/* <Input> */
- /* y :: The pixel's y-coordinate. */
+ /* y :: The pixel's y~coordinate. */
/* */
- /* x :: The pixel's x-coordinate. */
+ /* x :: The pixel's x~coordinate. */
/* */
/* user :: User-supplied data that is passed to the callback. */
/* */
/* <Return> */
- /* 1 if the pixel is `set', 0 otherwise. */
+ /* 1~if the pixel is `set', 0~otherwise. */
/* */
typedef void
(*FT_Raster_BitSet_Func)( int y,
@@ -1064,7 +1072,7 @@ FT_BEGIN_HEADER
/* raster :: A handle to the new raster object. */
/* */
/* <Return> */
- /* Error code. 0 means success. */
+ /* Error code. 0~means success. */
/* */
/* <Note> */
/* The `memory' parameter is a typeless pointer in order to avoid */
@@ -1164,8 +1172,8 @@ FT_BEGIN_HEADER
/* FT_Raster_RenderFunc */
/* */
/* <Description> */
- /* Invokes a given raster to scan-convert a given glyph image into a */
- /* target bitmap. */
+ /* Invoke a given raster to scan-convert a given glyph image into a */
+ /* target bitmap. */
/* */
/* <Input> */
/* raster :: A handle to the raster object. */
@@ -1174,7 +1182,7 @@ FT_BEGIN_HEADER
/* store the rendering parameters. */
/* */
/* <Return> */
- /* Error code. 0 means success. */
+ /* Error code. 0~means success. */
/* */
/* <Note> */
/* The exact format of the source image depends on the raster's glyph */
diff --git a/include/freetype/ftincrem.h b/include/freetype/ftincrem.h
index 6dd2f55..96abede 100644
--- a/include/freetype/ftincrem.h
+++ b/include/freetype/ftincrem.h
@@ -49,7 +49,7 @@ FT_BEGIN_HEADER
*
* Apart from that, all other tables are loaded normally from the font
* file. This mode is useful when FreeType is used within another
- * engine, e.g., a Postscript Imaging Processor.
+ * engine, e.g., a PostScript Imaging Processor.
*
* To enable this mode, you must use @FT_Open_Face, passing an
* @FT_Parameter with the @FT_PARAM_TAG_INCREMENTAL tag and an
@@ -67,7 +67,7 @@ FT_BEGIN_HEADER
* @description:
* An opaque type describing a user-provided object used to implement
* `incremental' glyph loading within FreeType. This is used to support
- * embedded fonts in certain environments (e.g., Postscript interpreters),
+ * embedded fonts in certain environments (e.g., PostScript interpreters),
* where the glyph data isn't in the font file, or must be overridden by
* different values.
*
@@ -142,7 +142,7 @@ FT_BEGIN_HEADER
*
* Note that the format of the glyph's data bytes depends on the font
* file format. For TrueType, it must correspond to the raw bytes within
- * the `glyf' table. For Postscript formats, it must correspond to the
+ * the `glyf' table. For PostScript formats, it must correspond to the
* *unencrypted* charstring bytes, without any `lenIV' header. It is
* undefined for any other format.
*
@@ -160,7 +160,7 @@ FT_BEGIN_HEADER
* accessed as a read-only byte block).
*
* @return:
- * FreeType error code. 0 means success.
+ * FreeType error code. 0~means success.
*
* @note:
* If this function returns successfully the method
diff --git a/include/freetype/ftlcdfil.h b/include/freetype/ftlcdfil.h
index 01d9780..c6201b3 100644
--- a/include/freetype/ftlcdfil.h
+++ b/include/freetype/ftlcdfil.h
@@ -23,6 +23,12 @@
#include <ft2build.h>
#include FT_FREETYPE_H
+#ifdef FREETYPE_H
+#error "freetype.h of FreeType 1 has been loaded!"
+#error "Please fix the directory search order for header files"
+#error "so that freetype.h of FreeType 2 is found first."
+#endif
+
FT_BEGIN_HEADER
@@ -119,7 +125,7 @@ FT_BEGIN_HEADER
* well on most LCD screens.
*
* @return:
- * FreeType error code. 0 means success.
+ * FreeType error code. 0~means success.
*
* @note:
* This feature is always disabled by default. Clients must make an
@@ -141,8 +147,8 @@ FT_BEGIN_HEADER
* If this feature is activated, the dimensions of LCD glyph bitmaps are
* either larger or taller than the dimensions of the corresponding
* outline with regards to the pixel grid. For example, for
- * @FT_RENDER_MODE_LCD, the filter adds up to 3 pixels to the left, and
- * up to 3 pixels to the right.
+ * @FT_RENDER_MODE_LCD, the filter adds up to 3~pixels to the left, and
+ * up to 3~pixels to the right.
*
* The bitmap offset values are adjusted correctly, so clients shouldn't
* need to modify their layout and glyph positioning code when enabling
diff --git a/include/freetype/ftlist.h b/include/freetype/ftlist.h
index f3223ee..93b05fc 100644
--- a/include/freetype/ftlist.h
+++ b/include/freetype/ftlist.h
@@ -81,7 +81,7 @@ FT_BEGIN_HEADER
/* FT_List_Find */
/* */
/* <Description> */
- /* Finds the list node for a given listed object. */
+ /* Find the list node for a given listed object. */
/* */
/* <Input> */
/* list :: A pointer to the parent list. */
@@ -101,7 +101,7 @@ FT_BEGIN_HEADER
/* FT_List_Add */
/* */
/* <Description> */
- /* Appends an element to the end of a list. */
+ /* Append an element to the end of a list. */
/* */
/* <InOut> */
/* list :: A pointer to the parent list. */
@@ -118,7 +118,7 @@ FT_BEGIN_HEADER
/* FT_List_Insert */
/* */
/* <Description> */
- /* Inserts an element at the head of a list. */
+ /* Insert an element at the head of a list. */
/* */
/* <InOut> */
/* list :: A pointer to parent list. */
@@ -135,7 +135,7 @@ FT_BEGIN_HEADER
/* FT_List_Remove */
/* */
/* <Description> */
- /* Removes a node from a list. This function doesn't check whether */
+ /* Remove a node from a list. This function doesn't check whether */
/* the node is in the list! */
/* */
/* <Input> */
@@ -155,7 +155,7 @@ FT_BEGIN_HEADER
/* FT_List_Up */
/* */
/* <Description> */
- /* Moves a node to the head/top of a list. Used to maintain LRU */
+ /* Move a node to the head/top of a list. Used to maintain LRU */
/* lists. */
/* */
/* <InOut> */
@@ -193,7 +193,7 @@ FT_BEGIN_HEADER
/* FT_List_Iterate */
/* */
/* <Description> */
- /* Parses a list and calls a given iterator function on each element. */
+ /* Parse a list and calls a given iterator function on each element. */
/* Note that parsing is stopped as soon as one of the iterator calls */
/* returns a non-zero value. */
/* */
@@ -242,7 +242,7 @@ FT_BEGIN_HEADER
/* FT_List_Finalize */
/* */
/* <Description> */
- /* Destroys all elements in the list as well as the list itself. */
+ /* Destroy all elements in the list as well as the list itself. */
/* */
/* <Input> */
/* list :: A handle to the list. */
diff --git a/include/freetype/ftlzw.h b/include/freetype/ftlzw.h
index d950653..00d4016 100644
--- a/include/freetype/ftlzw.h
+++ b/include/freetype/ftlzw.h
@@ -63,7 +63,7 @@ FT_BEGIN_HEADER
* source :: The source stream.
*
* @return:
- * FreeType error code. 0 means success.
+ * FreeType error code. 0~means success.
*
* @note:
* The source stream must be opened _before_ calling this function.
diff --git a/include/freetype/ftmac.h b/include/freetype/ftmac.h
index 1752d13..ab5bab5 100644
--- a/include/freetype/ftmac.h
+++ b/include/freetype/ftmac.h
@@ -85,7 +85,7 @@ FT_BEGIN_HEADER
/* aface :: A handle to a new face object. */
/* */
/* <Return> */
- /* FreeType error code. 0 means success. */
+ /* FreeType error code. 0~means success. */
/* */
/* <Notes> */
/* This function can be used to create @FT_Face objects from fonts */
@@ -124,7 +124,7 @@ FT_BEGIN_HEADER
/* @FT_New_Face_From_FSSpec. */
/* */
/* <Return> */
- /* FreeType error code. 0 means success. */
+ /* FreeType error code. 0~means success. */
/* */
FT_EXPORT( FT_Error )
FT_GetFile_From_Mac_Name( const char* fontName,
@@ -152,7 +152,7 @@ FT_BEGIN_HEADER
/* @FT_New_Face_From_FSSpec. */
/* */
/* <Return> */
- /* FreeType error code. 0 means success. */
+ /* FreeType error code. 0~means success. */
/* */
FT_EXPORT( FT_Error )
FT_GetFile_From_Mac_ATS_Name( const char* fontName,
@@ -183,7 +183,7 @@ FT_BEGIN_HEADER
/* face_index :: Index of the face. For passing to @FT_New_Face. */
/* */
/* <Return> */
- /* FreeType error code. 0 means success. */
+ /* FreeType error code. 0~means success. */
/* */
FT_EXPORT( FT_Error )
FT_GetFilePath_From_Mac_ATS_Name( const char* fontName,
@@ -209,12 +209,12 @@ FT_BEGIN_HEADER
/* spec :: FSSpec to the font file. */
/* */
/* face_index :: The index of the face within the resource. The */
- /* first face has index 0. */
+ /* first face has index~0. */
/* <Output> */
/* aface :: A handle to a new face object. */
/* */
/* <Return> */
- /* FreeType error code. 0 means success. */
+ /* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* @FT_New_Face_From_FSSpec is identical to @FT_New_Face except */
@@ -244,12 +244,12 @@ FT_BEGIN_HEADER
/* spec :: FSRef to the font file. */
/* */
/* face_index :: The index of the face within the resource. The */
- /* first face has index 0. */
+ /* first face has index~0. */
/* <Output> */
/* aface :: A handle to a new face object. */
/* */
/* <Return> */
- /* FreeType error code. 0 means success. */
+ /* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* @FT_New_Face_From_FSRef is identical to @FT_New_Face except */
diff --git a/include/freetype/ftmm.h b/include/freetype/ftmm.h
index a9ccfe7..3aefb9e 100644
--- a/include/freetype/ftmm.h
+++ b/include/freetype/ftmm.h
@@ -4,7 +4,7 @@
/* */
/* FreeType Multiple Master font interface (specification). */
/* */
-/* Copyright 1996-2001, 2003, 2004, 2006 by */
+/* Copyright 1996-2001, 2003, 2004, 2006, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -44,7 +44,7 @@ FT_BEGIN_HEADER
/* setting design axis coordinates. */
/* */
/* George Williams has extended this interface to make it work with */
- /* both Type 1 Multiple Masters fonts and GX distortable (var) */
+ /* both Type~1 Multiple Masters fonts and GX distortable (var) */
/* fonts. Some of these routines only work with MM fonts, others */
/* will work with both types. They are similar enough that a */
/* consistent interface makes sense. */
@@ -91,12 +91,12 @@ FT_BEGIN_HEADER
/* This structure can't be used for GX var fonts. */
/* */
/* <Fields> */
- /* num_axis :: Number of axes. Cannot exceed 4. */
+ /* num_axis :: Number of axes. Cannot exceed~4. */
/* */
/* num_designs :: Number of designs; should be normally 2^num_axis */
- /* even though the Type 1 specification strangely */
+ /* even though the Type~1 specification strangely */
/* allows for intermediate designs to be present. This */
- /* number cannot exceed 16. */
+ /* number cannot exceed~16. */
/* */
/* axis :: A table of axis descriptors. */
/* */
@@ -187,7 +187,7 @@ FT_BEGIN_HEADER
/* Some fields are specific to one format and not to the other. */
/* */
/* <Fields> */
- /* num_axis :: The number of axes. The maximum value is 4 for */
+ /* num_axis :: The number of axes. The maximum value is~4 for */
/* MM; no limit in GX. */
/* */
/* num_designs :: The number of designs; should be normally */
@@ -227,7 +227,7 @@ FT_BEGIN_HEADER
/* FT_Get_Multi_Master */
/* */
/* <Description> */
- /* Retrieves the Multiple Master descriptor of a given font. */
+ /* Retrieve the Multiple Master descriptor of a given font. */
/* */
/* This function can't be used with GX fonts. */
/* */
@@ -238,7 +238,7 @@ FT_BEGIN_HEADER
/* amaster :: The Multiple Masters descriptor. */
/* */
/* <Return> */
- /* FreeType error code. 0 means success. */
+ /* FreeType error code. 0~means success. */
/* */
FT_EXPORT( FT_Error )
FT_Get_Multi_Master( FT_Face face,
@@ -251,18 +251,18 @@ FT_BEGIN_HEADER
/* FT_Get_MM_Var */
/* */
/* <Description> */
- /* Retrieves the Multiple Master/GX var descriptor of a given font. */
+ /* Retrieve the Multiple Master/GX var descriptor of a given font. */
/* */
/* <Input> */
/* face :: A handle to the source face. */
/* */
/* <Output> */
- /* amaster :: The Multiple Masters descriptor. */
+ /* amaster :: The Multiple Masters/GX var descriptor. */
/* Allocates a data structure, which the user must free */
/* (a single call to FT_FREE will do it). */
/* */
/* <Return> */
- /* FreeType error code. 0 means success. */
+ /* FreeType error code. 0~means success. */
/* */
FT_EXPORT( FT_Error )
FT_Get_MM_Var( FT_Face face,
@@ -290,7 +290,7 @@ FT_BEGIN_HEADER
/* coords :: An array of design coordinates. */
/* */
/* <Return> */
- /* FreeType error code. 0 means success. */
+ /* FreeType error code. 0~means success. */
/* */
FT_EXPORT( FT_Error )
FT_Set_MM_Design_Coordinates( FT_Face face,
@@ -317,7 +317,7 @@ FT_BEGIN_HEADER
/* coords :: An array of design coordinates. */
/* */
/* <Return> */
- /* FreeType error code. 0 means success. */
+ /* FreeType error code. 0~means success. */
/* */
FT_EXPORT( FT_Error )
FT_Set_Var_Design_Coordinates( FT_Face face,
@@ -345,7 +345,7 @@ FT_BEGIN_HEADER
/* between 0 and 1.0). */
/* */
/* <Return> */
- /* FreeType error code. 0 means success. */
+ /* FreeType error code. 0~means success. */
/* */
FT_EXPORT( FT_Error )
FT_Set_MM_Blend_Coordinates( FT_Face face,
diff --git a/include/freetype/ftmodapi.h b/include/freetype/ftmodapi.h
index 7d813eb..b051d34 100644
--- a/include/freetype/ftmodapi.h
+++ b/include/freetype/ftmodapi.h
@@ -179,7 +179,7 @@ FT_BEGIN_HEADER
/* FT_Add_Module */
/* */
/* <Description> */
- /* Adds a new module to a given library instance. */
+ /* Add a new module to a given library instance. */
/* */
/* <InOut> */
/* library :: A handle to the library object. */
@@ -188,7 +188,7 @@ FT_BEGIN_HEADER
/* clazz :: A pointer to class descriptor for the module. */
/* */
/* <Return> */
- /* FreeType error code. 0 means success. */
+ /* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* An error will be returned if a module already exists by that name, */
@@ -205,7 +205,7 @@ FT_BEGIN_HEADER
/* FT_Get_Module */
/* */
/* <Description> */
- /* Finds a module by its name. */
+ /* Find a module by its name. */
/* */
/* <Input> */
/* library :: A handle to the library object. */
@@ -213,7 +213,7 @@ FT_BEGIN_HEADER
/* module_name :: The module's name (as an ASCII string). */
/* */
/* <Return> */
- /* A module handle. 0 if none was found. */
+ /* A module handle. 0~if none was found. */
/* */
/* <Note> */
/* FreeType's internal modules aren't documented very well, and you */
@@ -230,7 +230,7 @@ FT_BEGIN_HEADER
/* FT_Remove_Module */
/* */
/* <Description> */
- /* Removes a given module from a library instance. */
+ /* Remove a given module from a library instance. */
/* */
/* <InOut> */
/* library :: A handle to a library object. */
@@ -239,7 +239,7 @@ FT_BEGIN_HEADER
/* module :: A handle to a module object. */
/* */
/* <Return> */
- /* FreeType error code. 0 means success. */
+ /* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* The module object is destroyed by the function in case of success. */
@@ -266,7 +266,7 @@ FT_BEGIN_HEADER
/* alibrary :: A pointer to handle of a new library object. */
/* */
/* <Return> */
- /* FreeType error code. 0 means success. */
+ /* FreeType error code. 0~means success. */
/* */
FT_EXPORT( FT_Error )
FT_New_Library( FT_Memory memory,
@@ -279,14 +279,14 @@ FT_BEGIN_HEADER
/* FT_Done_Library */
/* */
/* <Description> */
- /* Discards a given library object. This closes all drivers and */
+ /* Discard a given library object. This closes all drivers and */
/* discards all resource objects. */
/* */
/* <Input> */
/* library :: A handle to the target library. */
/* */
/* <Return> */
- /* FreeType error code. 0 means success. */
+ /* FreeType error code. 0~means success. */
/* */
FT_EXPORT( FT_Error )
FT_Done_Library( FT_Library library );
@@ -303,7 +303,7 @@ FT_BEGIN_HEADER
/* FT_Set_Debug_Hook */
/* */
/* <Description> */
- /* Sets a debug hook function for debugging the interpreter of a font */
+ /* Set a debug hook function for debugging the interpreter of a font */
/* format. */
/* */
/* <InOut> */
@@ -318,7 +318,7 @@ FT_BEGIN_HEADER
/* */
/* <Note> */
/* Currently, four debug hook slots are available, but only two (for */
- /* the TrueType and the Type 1 interpreter) are defined. */
+ /* the TrueType and the Type~1 interpreter) are defined. */
/* */
/* Since the internal headers of FreeType are no longer installed, */
/* the symbol `FT_DEBUG_HOOK_TRUETYPE' isn't available publicly. */
@@ -336,7 +336,7 @@ FT_BEGIN_HEADER
/* FT_Add_Default_Modules */
/* */
/* <Description> */
- /* Adds the set of default drivers to a given library object. */
+ /* Add the set of default drivers to a given library object. */
/* This is only useful when you create a library object with */
/* @FT_New_Library (usually to plug a custom memory manager). */
/* */
@@ -412,7 +412,7 @@ FT_BEGIN_HEADER
* FT_Get_TrueType_Engine_Type
*
* @description:
- * Return a @FT_TrueTypeEngineType value to indicate which level of
+ * Return an @FT_TrueTypeEngineType value to indicate which level of
* the TrueType virtual machine a given library instance supports.
*
* @input:
diff --git a/include/freetype/ftotval.h b/include/freetype/ftotval.h
index 8733882..027f2e8 100644
--- a/include/freetype/ftotval.h
+++ b/include/freetype/ftotval.h
@@ -145,7 +145,7 @@ FT_BEGIN_HEADER
* A pointer to the JSTF table.
*
* @return:
- * FreeType error code. 0 means success.
+ * FreeType error code. 0~means success.
*
* @note:
* This function only works with OpenType fonts, returning an error
diff --git a/include/freetype/ftoutln.h b/include/freetype/ftoutln.h
index 873e64b..d7d01e8 100644
--- a/include/freetype/ftoutln.h
+++ b/include/freetype/ftoutln.h
@@ -5,7 +5,7 @@
/* Support for the FT_Outline type used to store glyph shapes of */
/* most scalable font formats (specification). */
/* */
-/* Copyright 1996-2001, 2002, 2003, 2005, 2006, 2007, 2008 by */
+/* Copyright 1996-2001, 2002, 2003, 2005, 2006, 2007, 2008, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -84,7 +84,7 @@ FT_BEGIN_HEADER
/* FT_Outline_Decompose */
/* */
/* <Description> */
- /* Walks over an outline's structure to decompose it into individual */
+ /* Walk over an outline's structure to decompose it into individual */
/* segments and Bézier arcs. This function is also able to emit */
/* `move to' and `close to' operations to indicate the start and end */
/* of new contours in the outline. */
@@ -92,7 +92,7 @@ FT_BEGIN_HEADER
/* <Input> */
/* outline :: A pointer to the source target. */
/* */
- /* func_interface :: A table of `emitters', i.e,. function pointers */
+ /* func_interface :: A table of `emitters', i.e., function pointers */
/* called during decomposition to indicate path */
/* operations. */
/* */
@@ -103,7 +103,7 @@ FT_BEGIN_HEADER
/* decomposition. */
/* */
/* <Return> */
- /* FreeType error code. 0 means success. */
+ /* FreeType error code. 0~means success. */
/* */
FT_EXPORT( FT_Error )
FT_Outline_Decompose( FT_Outline* outline,
@@ -117,7 +117,7 @@ FT_BEGIN_HEADER
/* FT_Outline_New */
/* */
/* <Description> */
- /* Creates a new outline of a given size. */
+ /* Create a new outline of a given size. */
/* */
/* <Input> */
/* library :: A handle to the library object from where the */
@@ -130,11 +130,10 @@ FT_BEGIN_HEADER
/* numContours :: The maximal number of contours within the outline. */
/* */
/* <Output> */
- /* anoutline :: A handle to the new outline. NULL in case of */
- /* error. */
+ /* anoutline :: A handle to the new outline. */
/* */
/* <Return> */
- /* FreeType error code. 0 means success. */
+ /* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* The reason why this function takes a `library' parameter is simply */
@@ -160,7 +159,7 @@ FT_BEGIN_HEADER
/* FT_Outline_Done */
/* */
/* <Description> */
- /* Destroys an outline created with @FT_Outline_New. */
+ /* Destroy an outline created with @FT_Outline_New. */
/* */
/* <Input> */
/* library :: A handle of the library object used to allocate the */
@@ -169,7 +168,7 @@ FT_BEGIN_HEADER
/* outline :: A pointer to the outline object to be discarded. */
/* */
/* <Return> */
- /* FreeType error code. 0 means success. */
+ /* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* If the outline's `owner' field is not set, only the outline */
@@ -200,7 +199,7 @@ FT_BEGIN_HEADER
/* outline :: A handle to a source outline. */
/* */
/* <Return> */
- /* FreeType error code. 0 means success. */
+ /* FreeType error code. 0~means success. */
/* */
FT_EXPORT( FT_Error )
FT_Outline_Check( FT_Outline* outline );
@@ -212,7 +211,7 @@ FT_BEGIN_HEADER
/* FT_Outline_Get_CBox */
/* */
/* <Description> */
- /* Returns an outline's `control box'. The control box encloses all */
+ /* Return an outline's `control box'. The control box encloses all */
/* the outline's points, including Bézier control points. Though it */
/* coincides with the exact bounding box for most glyphs, it can be */
/* slightly larger in some situations (like when rotating an outline */
@@ -240,7 +239,7 @@ FT_BEGIN_HEADER
/* FT_Outline_Translate */
/* */
/* <Description> */
- /* Applies a simple translation to the points of an outline. */
+ /* Apply a simple translation to the points of an outline. */
/* */
/* <InOut> */
/* outline :: A pointer to the target outline descriptor. */
@@ -262,7 +261,7 @@ FT_BEGIN_HEADER
/* FT_Outline_Copy */
/* */
/* <Description> */
- /* Copies an outline into another one. Both objects must have the */
+ /* Copy an outline into another one. Both objects must have the */
/* same sizes (number of points & number of contours) when this */
/* function is called. */
/* */
@@ -273,7 +272,7 @@ FT_BEGIN_HEADER
/* target :: A handle to the target outline. */
/* */
/* <Return> */
- /* FreeType error code. 0 means success. */
+ /* FreeType error code. 0~means success. */
/* */
FT_EXPORT( FT_Error )
FT_Outline_Copy( const FT_Outline* source,
@@ -286,7 +285,7 @@ FT_BEGIN_HEADER
/* FT_Outline_Transform */
/* */
/* <Description> */
- /* Applies a simple 2x2 matrix to all of an outline's points. Useful */
+ /* Apply a simple 2x2 matrix to all of an outline's points. Useful */
/* for applying rotations, slanting, flipping, etc. */
/* */
/* <InOut> */
@@ -310,7 +309,7 @@ FT_BEGIN_HEADER
/* FT_Outline_Embolden */
/* */
/* <Description> */
- /* Emboldens an outline. The new outline will be at most 4 times */
+ /* Embolden an outline. The new outline will be at most 4~times */
/* `strength' pixels wider and higher. You may think of the left and */
/* bottom borders as unchanged. */
/* */
@@ -325,7 +324,7 @@ FT_BEGIN_HEADER
/* 26.6 pixel format. */
/* */
/* <Return> */
- /* FreeType error code. 0 means success. */
+ /* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* The used algorithm to increase or decrease the thickness of the */
@@ -333,6 +332,9 @@ FT_BEGIN_HEADER
/* situations like acute angles or intersections are sometimes */
/* handled incorrectly. */
/* */
+ /* If you need `better' metrics values you should call */
+ /* @FT_Outline_Get_CBox ot @FT_Outline_Get_BBox. */
+ /* */
/* Example call: */
/* */
/* { */
@@ -352,14 +354,14 @@ FT_BEGIN_HEADER
/* FT_Outline_Reverse */
/* */
/* <Description> */
- /* Reverses the drawing direction of an outline. This is used to */
+ /* Reverse the drawing direction of an outline. This is used to */
/* ensure consistent fill conventions for mirrored glyphs. */
/* */
/* <InOut> */
/* outline :: A pointer to the target outline descriptor. */
/* */
/* <Note> */
- /* This functions toggles the bit flag @FT_OUTLINE_REVERSE_FILL in */
+ /* This function toggles the bit flag @FT_OUTLINE_REVERSE_FILL in */
/* the outline's `flags' field. */
/* */
/* It shouldn't be used by a normal client application, unless it */
@@ -375,7 +377,7 @@ FT_BEGIN_HEADER
/* FT_Outline_Get_Bitmap */
/* */
/* <Description> */
- /* Renders an outline within a bitmap. The outline's image is simply */
+ /* Render an outline within a bitmap. The outline's image is simply */
/* OR-ed to the target bitmap. */
/* */
/* <Input> */
@@ -387,14 +389,19 @@ FT_BEGIN_HEADER
/* abitmap :: A pointer to the target bitmap descriptor. */
/* */
/* <Return> */
- /* FreeType error code. 0 means success. */
+ /* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* This function does NOT CREATE the bitmap, it only renders an */
- /* outline image within the one you pass to it! */
+ /* outline image within the one you pass to it! Consequently, the */
+ /* various fields in `abitmap' should be set accordingly. */
/* */
/* It will use the raster corresponding to the default glyph format. */
/* */
+ /* The value of the `num_grays' field in `abitmap' is ignored. If */
+ /* you select the gray-level rasterizer, and you want less than 256 */
+ /* gray levels, you have to use @FT_Outline_Render directly. */
+ /* */
FT_EXPORT( FT_Error )
FT_Outline_Get_Bitmap( FT_Library library,
FT_Outline* outline,
@@ -407,8 +414,8 @@ FT_BEGIN_HEADER
/* FT_Outline_Render */
/* */
/* <Description> */
- /* Renders an outline within a bitmap using the current scan-convert. */
- /* This functions uses an @FT_Raster_Params structure as an argument, */
+ /* Render an outline within a bitmap using the current scan-convert. */
+ /* This function uses an @FT_Raster_Params structure as an argument, */
/* allowing advanced features like direct composition, translucency, */
/* etc. */
/* */
@@ -422,7 +429,7 @@ FT_BEGIN_HEADER
/* describe the rendering operation. */
/* */
/* <Return> */
- /* FreeType error code. 0 means success. */
+ /* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* You should know what you are doing and how @FT_Raster_Params works */
@@ -432,6 +439,11 @@ FT_BEGIN_HEADER
/* converter is called, which means that the value you give to it is */
/* actually ignored. */
/* */
+ /* The gray-level rasterizer always uses 256 gray levels. If you */
+ /* want less gray levels, you have to provide your own span callback. */
+ /* See the @FT_RASTER_FLAG_DIRECT value of the `flags' field in the */
+ /* @FT_Raster_Params structure for more details. */
+ /* */
FT_EXPORT( FT_Error )
FT_Outline_Render( FT_Library library,
FT_Outline* outline,
@@ -446,7 +458,7 @@ FT_BEGIN_HEADER
* @description:
* A list of values used to describe an outline's contour orientation.
*
- * The TrueType and Postscript specifications use different conventions
+ * The TrueType and PostScript specifications use different conventions
* to determine whether outline contours should be filled or unfilled.
*
* @values:
@@ -455,7 +467,7 @@ FT_BEGIN_HEADER
* be filled, and counter-clockwise ones must be unfilled.
*
* FT_ORIENTATION_POSTSCRIPT ::
- * According to the Postscript specification, counter-clockwise contours
+ * According to the PostScript specification, counter-clockwise contours
* must be filled, and clockwise ones must be unfilled.
*
* FT_ORIENTATION_FILL_RIGHT ::
@@ -465,7 +477,7 @@ FT_BEGIN_HEADER
*
* FT_ORIENTATION_FILL_LEFT ::
* This is identical to @FT_ORIENTATION_POSTSCRIPT, but is used to
- * remember that in Postscript, everything that is to the left of
+ * remember that in PostScript, everything that is to the left of
* the drawing direction of a contour must be filled.
*
* FT_ORIENTATION_NONE ::
diff --git a/include/freetype/ftpfr.h b/include/freetype/ftpfr.h
index e2801fd..0b7b7d4 100644
--- a/include/freetype/ftpfr.h
+++ b/include/freetype/ftpfr.h
@@ -4,7 +4,7 @@
/* */
/* FreeType API for accessing PFR-specific data (specification only). */
/* */
-/* Copyright 2002, 2003, 2004, 2006 by */
+/* Copyright 2002, 2003, 2004, 2006, 2008, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -62,8 +62,8 @@ FT_BEGIN_HEADER
*
* @output:
* aoutline_resolution ::
- * Outline resolution. This is equivalent to `face->units_per_EM'.
- * Optional (parameter can be NULL).
+ * Outline resolution. This is equivalent to `face->units_per_EM'
+ * for non-PFR fonts. Optional (parameter can be NULL).
*
* ametrics_resolution ::
* Metrics resolution. This is equivalent to `outline_resolution'
@@ -73,14 +73,14 @@ FT_BEGIN_HEADER
* A 16.16 fixed-point number used to scale distance expressed
* in metrics units to device sub-pixels. This is equivalent to
* `face->size->x_scale', but for metrics only. Optional (parameter
- * can be NULL)
+ * can be NULL).
*
* ametrics_y_scale ::
* Same as `ametrics_x_scale' but for the vertical direction.
- * optional (parameter can be NULL)
+ * optional (parameter can be NULL).
*
* @return:
- * FreeType error code. 0 means success.
+ * FreeType error code. 0~means success.
*
* @note:
* If the input face is not a PFR, this function will return an error.
@@ -115,7 +115,7 @@ FT_BEGIN_HEADER
* avector :: A kerning vector.
*
* @return:
- * FreeType error code. 0 means success.
+ * FreeType error code. 0~means success.
*
* @note:
* This function always return distances in original PFR metrics
@@ -150,7 +150,7 @@ FT_BEGIN_HEADER
* aadvance :: The glyph advance in metrics units.
*
* @return:
- * FreeType error code. 0 means success.
+ * FreeType error code. 0~means success.
*
* @note:
* You can use the `x_scale' or `y_scale' results of @FT_Get_PFR_Metrics
diff --git a/include/freetype/ftrender.h b/include/freetype/ftrender.h
index 9ed828e..41c31ea 100644
--- a/include/freetype/ftrender.h
+++ b/include/freetype/ftrender.h
@@ -167,7 +167,7 @@ FT_BEGIN_HEADER
/* FT_Get_Renderer */
/* */
/* <Description> */
- /* Retrieves the current renderer for a given glyph format. */
+ /* Retrieve the current renderer for a given glyph format. */
/* */
/* <Input> */
/* library :: A handle to the library object. */
@@ -175,7 +175,7 @@ FT_BEGIN_HEADER
/* format :: The glyph format. */
/* */
/* <Return> */
- /* A renderer handle. 0 if none found. */
+ /* A renderer handle. 0~if none found. */
/* */
/* <Note> */
/* An error will be returned if a module already exists by that name, */
@@ -195,7 +195,7 @@ FT_BEGIN_HEADER
/* FT_Set_Renderer */
/* */
/* <Description> */
- /* Sets the current renderer to use, and set additional mode. */
+ /* Set the current renderer to use, and set additional mode. */
/* */
/* <InOut> */
/* library :: A handle to the library object. */
@@ -208,7 +208,7 @@ FT_BEGIN_HEADER
/* parameters :: Additional parameters. */
/* */
/* <Return> */
- /* FreeType error code. 0 means success. */
+ /* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* In case of success, the renderer will be used to convert glyph */
diff --git a/include/freetype/ftsizes.h b/include/freetype/ftsizes.h
index 622df16..3e548cc 100644
--- a/include/freetype/ftsizes.h
+++ b/include/freetype/ftsizes.h
@@ -4,7 +4,7 @@
/* */
/* FreeType size objects management (specification). */
/* */
-/* Copyright 1996-2001, 2003, 2004, 2006 by */
+/* Copyright 1996-2001, 2003, 2004, 2006, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -89,7 +89,7 @@ FT_BEGIN_HEADER
/* asize :: A handle to a new size object. */
/* */
/* <Return> */
- /* FreeType error code. 0 means success. */
+ /* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* You need to call @FT_Activate_Size in order to select the new size */
@@ -115,7 +115,7 @@ FT_BEGIN_HEADER
/* size :: A handle to a target size object. */
/* */
/* <Return> */
- /* FreeType error code. 0 means success. */
+ /* FreeType error code. 0~means success. */
/* */
FT_EXPORT( FT_Error )
FT_Done_Size( FT_Size size );
@@ -129,8 +129,8 @@ FT_BEGIN_HEADER
/* <Description> */
/* Even though it is possible to create several size objects for a */
/* given face (see @FT_New_Size for details), functions like */
- /* @FT_Load_Glyph or @FT_Load_Char only use the last-created one to */
- /* determine the `current character pixel size'. */
+ /* @FT_Load_Glyph or @FT_Load_Char only use the one which has been */
+ /* activated last to determine the `current character pixel size'. */
/* */
/* This function can be used to `activate' a previously created size */
/* object. */
@@ -139,7 +139,7 @@ FT_BEGIN_HEADER
/* size :: A handle to a target size object. */
/* */
/* <Return> */
- /* FreeType error code. 0 means success. */
+ /* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* If `face' is the size's parent face object, this function changes */
diff --git a/include/freetype/ftsnames.h b/include/freetype/ftsnames.h
index 003cbcd..477e1e3 100644
--- a/include/freetype/ftsnames.h
+++ b/include/freetype/ftsnames.h
@@ -48,7 +48,7 @@ FT_BEGIN_HEADER
/* Access the names embedded in TrueType and OpenType files. */
/* */
/* <Description> */
- /* The TrueType and OpenType specification allow the inclusion of */
+ /* The TrueType and OpenType specifications allow the inclusion of */
/* a special `names table' in font files. This table contains */
/* textual (and internationalized) information regarding the font, */
/* like family name, copyright, version, etc. */
@@ -114,7 +114,7 @@ FT_BEGIN_HEADER
/* FT_Get_Sfnt_Name_Count */
/* */
/* <Description> */
- /* Retrieves the number of name strings in the SFNT `name' table. */
+ /* Retrieve the number of name strings in the SFNT `name' table. */
/* */
/* <Input> */
/* face :: A handle to the source face. */
@@ -132,7 +132,7 @@ FT_BEGIN_HEADER
/* FT_Get_Sfnt_Name */
/* */
/* <Description> */
- /* Retrieves a string of the SFNT `name' table for a given index. */
+ /* Retrieve a string of the SFNT `name' table for a given index. */
/* */
/* <Input> */
/* face :: A handle to the source face. */
@@ -143,7 +143,7 @@ FT_BEGIN_HEADER
/* aname :: The indexed @FT_SfntName structure. */
/* */
/* <Return> */
- /* FreeType error code. 0 means success. */
+ /* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* The `string' array returned in the `aname' structure is not */
diff --git a/include/freetype/ftstroke.h b/include/freetype/ftstroke.h
index 26e3120..ae90500 100644
--- a/include/freetype/ftstroke.h
+++ b/include/freetype/ftstroke.h
@@ -4,7 +4,7 @@
/* */
/* FreeType path stroker (specification). */
/* */
-/* Copyright 2002, 2003, 2004, 2005, 2006, 2008 by */
+/* Copyright 2002, 2003, 2004, 2005, 2006, 2008, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -171,7 +171,7 @@ FT_BEGIN_HEADER
* The source outline handle.
*
* @return:
- * The border index. @FT_STROKER_BORDER_LEFT for empty or invalid
+ * The border index. @FT_STROKER_BORDER_RIGHT for empty or invalid
* outlines.
*/
FT_EXPORT( FT_StrokerBorder )
@@ -216,7 +216,7 @@ FT_BEGIN_HEADER
* A new stroker object handle. NULL in case of error.
*
* @return:
- * FreeType error code. 0 means success.
+ * FreeType error code. 0~means success.
*/
FT_EXPORT( FT_Error )
FT_Stroker_New( FT_Library library,
@@ -249,7 +249,7 @@ FT_BEGIN_HEADER
* expressed as 16.16 fixed point value.
*
* @note:
- * The radius is expressed in the same units that the outline
+ * The radius is expressed in the same units as the outline
* coordinates.
*/
FT_EXPORT( void )
@@ -297,18 +297,18 @@ FT_BEGIN_HEADER
* The source outline.
*
* opened ::
- * A boolean. If 1, the outline is treated as an open path instead
+ * A boolean. If~1, the outline is treated as an open path instead
* of a closed one.
*
* @return:
- * FreeType error code. 0 means success.
+ * FreeType error code. 0~means success.
*
* @note:
- * If `opened' is 0 (the default), the outline is treated as a closed
- * path, and the stroker will generate two distinct `border' outlines.
+ * If `opened' is~0 (the default), the outline is treated as a closed
+ * path, and the stroker generates two distinct `border' outlines.
*
- * If `opened' is 1, the outline is processed as an open path, and the
- * stroker will generate a single `stroke' outline.
+ * If `opened' is~1, the outline is processed as an open path, and the
+ * stroker generates a single `stroke' outline.
*
* This function calls @FT_Stroker_Rewind automatically.
*/
@@ -334,10 +334,10 @@ FT_BEGIN_HEADER
* A pointer to the start vector.
*
* open ::
- * A boolean. If 1, the sub-path is treated as an open one.
+ * A boolean. If~1, the sub-path is treated as an open one.
*
* @return:
- * FreeType error code. 0 means success.
+ * FreeType error code. 0~means success.
*
* @note:
* This function is useful when you need to stroke a path that is
@@ -362,11 +362,11 @@ FT_BEGIN_HEADER
* The target stroker handle.
*
* @return:
- * FreeType error code. 0 means success.
+ * FreeType error code. 0~means success.
*
* @note:
* You should call this function after @FT_Stroker_BeginSubPath.
- * If the subpath was not `opened', this function will `draw' a
+ * If the subpath was not `opened', this function `draws' a
* single line segment to the start position when needed.
*/
FT_EXPORT( FT_Error )
@@ -390,7 +390,7 @@ FT_BEGIN_HEADER
* A pointer to the destination point.
*
* @return:
- * FreeType error code. 0 means success.
+ * FreeType error code. 0~means success.
*
* @note:
* You should call this function between @FT_Stroker_BeginSubPath and
@@ -421,7 +421,7 @@ FT_BEGIN_HEADER
* A pointer to the destination point.
*
* @return:
- * FreeType error code. 0 means success.
+ * FreeType error code. 0~means success.
*
* @note:
* You should call this function between @FT_Stroker_BeginSubPath and
@@ -456,7 +456,7 @@ FT_BEGIN_HEADER
* A pointer to the destination point.
*
* @return:
- * FreeType error code. 0 means success.
+ * FreeType error code. 0~means success.
*
* @note:
* You should call this function between @FT_Stroker_BeginSubPath and
@@ -476,7 +476,7 @@ FT_BEGIN_HEADER
*
* @description:
* Call this function once you have finished parsing your paths
- * with the stroker. It will return the number of points and
+ * with the stroker. It returns the number of points and
* contours necessary to export one of the `border' or `stroke'
* outlines generated by the stroker.
*
@@ -495,7 +495,7 @@ FT_BEGIN_HEADER
* The number of contours.
*
* @return:
- * FreeType error code. 0 means success.
+ * FreeType error code. 0~means success.
*
* @note:
* When an outline, or a sub-path, is `closed', the stroker generates
@@ -525,8 +525,8 @@ FT_BEGIN_HEADER
* export the corresponding border to your own @FT_Outline
* structure.
*
- * Note that this function will append the border points and
- * contours to your outline, but will not try to resize its
+ * Note that this function appends the border points and
+ * contours to your outline, but does not try to resize its
* arrays.
*
* @input:
@@ -583,7 +583,7 @@ FT_BEGIN_HEADER
* The number of contours.
*
* @return:
- * FreeType error code. 0 means success.
+ * FreeType error code. 0~means success.
*/
FT_EXPORT( FT_Error )
FT_Stroker_GetCounts( FT_Stroker stroker,
@@ -600,8 +600,8 @@ FT_BEGIN_HEADER
* Call this function after @FT_Stroker_GetBorderCounts to
* export the all borders to your own @FT_Outline structure.
*
- * Note that this function will append the border points and
- * contours to your outline, but will not try to resize its
+ * Note that this function appends the border points and
+ * contours to your outline, but does not try to resize its
* arrays.
*
* @input:
@@ -649,11 +649,11 @@ FT_BEGIN_HEADER
* A stroker handle.
*
* destroy ::
- * A Boolean. If 1, the source glyph object is destroyed
+ * A Boolean. If~1, the source glyph object is destroyed
* on success.
*
* @return:
- * FreeType error code. 0 means success.
+ * FreeType error code. 0~means success.
*
* @note:
* The source glyph is untouched in case of error.
@@ -682,15 +682,15 @@ FT_BEGIN_HEADER
* A stroker handle.
*
* inside ::
- * A Boolean. If 1, return the inside border, otherwise
+ * A Boolean. If~1, return the inside border, otherwise
* the outside border.
*
* destroy ::
- * A Boolean. If 1, the source glyph object is destroyed
+ * A Boolean. If~1, the source glyph object is destroyed
* on success.
*
* @return:
- * FreeType error code. 0 means success.
+ * FreeType error code. 0~means success.
*
* @note:
* The source glyph is untouched in case of error.
diff --git a/include/freetype/ftsynth.h b/include/freetype/ftsynth.h
index 36984bf..a068b79 100644
--- a/include/freetype/ftsynth.h
+++ b/include/freetype/ftsynth.h
@@ -5,7 +5,7 @@
/* FreeType synthesizing code for emboldening and slanting */
/* (specification). */
/* */
-/* Copyright 2000-2001, 2003, 2006 by */
+/* Copyright 2000-2001, 2003, 2006, 2008 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -23,7 +23,7 @@
/*************************************************************************/
/*************************************************************************/
/********* *********/
- /********* WARNING, THIS IS ALPHA CODE, THIS API *********/
+ /********* WARNING, THIS IS ALPHA CODE! THIS API *********/
/********* IS DUE TO CHANGE UNTIL STRICTLY NOTIFIED BY THE *********/
/********* FREETYPE DEVELOPMENT TEAM *********/
/********* *********/
@@ -34,6 +34,13 @@
/*************************************************************************/
+ /* Main reason for not lifting the functions in this module to a */
+ /* `standard' API is that the used parameters for emboldening and */
+ /* slanting are not configurable. Consider the functions as a */
+ /* code resource which should be copied into the application and */
+ /* adapted to the particular needs. */
+
+
#ifndef __FTSYNTH_H__
#define __FTSYNTH_H__
@@ -50,20 +57,20 @@
FT_BEGIN_HEADER
- /* Make sure slot owns slot->bitmap. */
- FT_EXPORT( FT_Error )
- FT_GlyphSlot_Own_Bitmap( FT_GlyphSlot slot );
-
- /* Do not use this function directly! Copy the code to */
- /* your application and modify it to suit your need. */
+ /* Embolden a glyph by a `reasonable' value (which is highly a matter of */
+ /* taste). This function is actually a convenience function, providing */
+ /* a wrapper for @FT_Outline_Embolden and @FT_Bitmap_Embolden. */
+ /* */
+ /* For emboldened outlines the metrics are estimates only; if you need */
+ /* precise values you should call @FT_Outline_Get_CBox. */
FT_EXPORT( void )
FT_GlyphSlot_Embolden( FT_GlyphSlot slot );
-
+ /* Slant an outline glyph to the right by about 12 degrees. */
FT_EXPORT( void )
FT_GlyphSlot_Oblique( FT_GlyphSlot slot );
- /* */
+ /* */
FT_END_HEADER
diff --git a/include/freetype/ftsystem.h b/include/freetype/ftsystem.h
index 59cd019..a95b2c7 100644
--- a/include/freetype/ftsystem.h
+++ b/include/freetype/ftsystem.h
@@ -82,7 +82,7 @@ FT_BEGIN_HEADER
* The size in bytes to allocate.
*
* @return:
- * Address of new memory block. 0 in case of failure.
+ * Address of new memory block. 0~in case of failure.
*
*/
typedef void*
@@ -133,7 +133,7 @@ FT_BEGIN_HEADER
* The block's current address.
*
* @return:
- * New block address. 0 in case of memory shortage.
+ * New block address. 0~in case of memory shortage.
*
* @note:
* In case of error, the old block must still be available.
@@ -152,7 +152,7 @@ FT_BEGIN_HEADER
* FT_MemoryRec
*
* @description:
- * A structure used to describe a given memory manager to FreeType 2.
+ * A structure used to describe a given memory manager to FreeType~2.
*
* @fields:
* user ::
@@ -240,7 +240,7 @@ FT_BEGIN_HEADER
*
* @note:
* This function might be called to perform a seek or skip operation
- * with a `count' of 0.
+ * with a `count' of~0.
*
*/
typedef unsigned long
diff --git a/include/freetype/fttypes.h b/include/freetype/fttypes.h
index a60aa54..54f08e3 100644
--- a/include/freetype/fttypes.h
+++ b/include/freetype/fttypes.h
@@ -43,7 +43,7 @@ FT_BEGIN_HEADER
/* The basic data types defined by the library. */
/* */
/* <Description> */
- /* This section contains the basic data types defined by FreeType 2, */
+ /* This section contains the basic data types defined by FreeType~2, */
/* ranging from simple scalar types to bitmap descriptors. More */
/* font-specific structures are defined in a different section. */
/* */
@@ -99,7 +99,7 @@ FT_BEGIN_HEADER
/* */
/* <Description> */
/* A typedef of unsigned char, used for simple booleans. As usual, */
- /* values 1 and 0 represent true and false, respectively. */
+ /* values 1 and~0 represent true and false, respectively. */
/* */
typedef unsigned char FT_Bool;
@@ -167,7 +167,7 @@ FT_BEGIN_HEADER
/* FT_Tag */
/* */
/* <Description> */
- /* A typedef for 32bit tags (as used in the SFNT format). */
+ /* A typedef for 32-bit tags (as used in the SFNT format). */
/* */
typedef FT_UInt32 FT_Tag;
@@ -290,7 +290,7 @@ FT_BEGIN_HEADER
/* FT_Error */
/* */
/* <Description> */
- /* The FreeType error code type. A value of 0 is always interpreted */
+ /* The FreeType error code type. A value of~0 is always interpreted */
/* as a successful operation. */
/* */
typedef int FT_Error;
@@ -313,7 +313,7 @@ FT_BEGIN_HEADER
/* FT_Offset */
/* */
/* <Description> */
- /* This is equivalent to the ANSI C `size_t' type, i.e., the largest */
+ /* This is equivalent to the ANSI~C `size_t' type, i.e., the largest */
/* _unsigned_ integer type used to express a file size or position, */
/* or a memory block size. */
/* */
@@ -326,7 +326,7 @@ FT_BEGIN_HEADER
/* FT_PtrDist */
/* */
/* <Description> */
- /* This is equivalent to the ANSI C `ptrdiff_t' type, i.e., the */
+ /* This is equivalent to the ANSI~C `ptrdiff_t' type, i.e., the */
/* largest _signed_ integer type used to express the distance */
/* between two pointers. */
/* */
@@ -413,7 +413,7 @@ FT_BEGIN_HEADER
/* FT_Generic_Finalizer */
/* */
/* <Description> */
- /* Describes a function used to destroy the `client' data of any */
+ /* Describe a function used to destroy the `client' data of any */
/* FreeType object. See the description of the @FT_Generic type for */
/* details of usage. */
/* */
@@ -470,8 +470,8 @@ FT_BEGIN_HEADER
/* TrueType tables into an unsigned long to be used within FreeType. */
/* */
/* <Note> */
- /* The produced values *must* be 32bit integers. Don't redefine this */
- /* macro. */
+ /* The produced values *must* be 32-bit integers. Don't redefine */
+ /* this macro. */
/* */
#define FT_MAKE_TAG( _x1, _x2, _x3, _x4 ) \
( ( (FT_ULong)_x1 << 24 ) | \
diff --git a/include/freetype/ftwinfnt.h b/include/freetype/ftwinfnt.h
index 951b0c4..ea33353 100644
--- a/include/freetype/ftwinfnt.h
+++ b/include/freetype/ftwinfnt.h
@@ -111,11 +111,11 @@ FT_BEGIN_HEADER
* ordering and minor deviations).
*
* FT_WinFNT_ID_CP949 ::
- * A superset of Korean Hangul KS C 5601-1987 (with different
+ * A superset of Korean Hangul KS~C 5601-1987 (with different
* ordering and minor deviations).
*
* FT_WinFNT_ID_CP950 ::
- * A superset of traditional Chinese Big 5 ETen (with different
+ * A superset of traditional Chinese Big~5 ETen (with different
* ordering and minor deviations).
*
* FT_WinFNT_ID_CP1250 ::
@@ -248,7 +248,7 @@ FT_BEGIN_HEADER
* aheader :: The WinFNT header.
*
* @return:
- * FreeType error code. 0 means success.
+ * FreeType error code. 0~means success.
*
* @note:
* This function only works with Windows FNT faces, returning an error
diff --git a/include/freetype/ftxf86.h b/include/freetype/ftxf86.h
index ea82abb..ae9ff07 100644
--- a/include/freetype/ftxf86.h
+++ b/include/freetype/ftxf86.h
@@ -60,8 +60,8 @@ FT_BEGIN_HEADER
/* <Description> */
/* Return a string describing the format of a given face, using values */
/* which can be used as an X11 FONT_PROPERTY. Possible values are */
- /* `TrueType', `Type 1', `BDF', `PCF', `Type 42', `CID Type 1', `CFF', */
- /* `PFR', and `Windows FNT'. */
+ /* `TrueType', `Type~1', `BDF', `PCF', `Type~42', `CID~Type~1', `CFF', */
+ /* `PFR', and `Windows~FNT'. */
/* */
/* <Input> */
/* face :: */
diff --git a/include/freetype/internal/ftdebug.h b/include/freetype/internal/ftdebug.h
index d40af4f..7baae35 100644
--- a/include/freetype/internal/ftdebug.h
+++ b/include/freetype/internal/ftdebug.h
@@ -4,7 +4,7 @@
/* */
/* Debugging and logging component (specification). */
/* */
-/* Copyright 1996-2001, 2002, 2004, 2006, 2007, 2008 by */
+/* Copyright 1996-2001, 2002, 2004, 2006, 2007, 2008, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -92,7 +92,7 @@ FT_BEGIN_HEADER
#else /* !FT_DEBUG_LEVEL_TRACE */
-#define FT_TRACE( level, varformat ) do ; while ( 0 ) /* nothing */
+#define FT_TRACE( level, varformat ) do { } while ( 0 ) /* nothing */
#endif /* !FT_DEBUG_LEVEL_TRACE */
@@ -178,7 +178,7 @@ FT_BEGIN_HEADER
#else /* !FT_DEBUG_LEVEL_ERROR */
-#define FT_ERROR( varformat ) do ; while ( 0 ) /* nothing */
+#define FT_ERROR( varformat ) do { } while ( 0 ) /* nothing */
#endif /* !FT_DEBUG_LEVEL_ERROR */
@@ -201,7 +201,7 @@ FT_BEGIN_HEADER
#else /* !FT_DEBUG_LEVEL_ERROR */
-#define FT_ASSERT( condition ) do ; while ( 0 )
+#define FT_ASSERT( condition ) do { } while ( 0 )
#endif /* !FT_DEBUG_LEVEL_ERROR */
diff --git a/include/freetype/internal/ftdriver.h b/include/freetype/internal/ftdriver.h
index f37864a..854abad 100644
--- a/include/freetype/internal/ftdriver.h
+++ b/include/freetype/internal/ftdriver.h
@@ -23,6 +23,7 @@
#include <ft2build.h>
#include FT_MODULE_H
+
FT_BEGIN_HEADER
@@ -90,12 +91,14 @@ FT_BEGIN_HEADER
(*FT_CharMap_CharNextFunc)( FT_CharMap charmap,
FT_Long charcode );
+
typedef FT_Error
(*FT_Face_GetKerningFunc)( FT_Face face,
FT_UInt left_glyph,
FT_UInt right_glyph,
FT_Vector* kerning );
+
typedef FT_Error
(*FT_Face_AttachFunc)( FT_Face face,
FT_Stream stream );
@@ -105,7 +108,7 @@ FT_BEGIN_HEADER
(*FT_Face_GetAdvancesFunc)( FT_Face face,
FT_UInt first,
FT_UInt count,
- FT_UInt flags,
+ FT_Int32 flags,
FT_Fixed* advances );
diff --git a/include/freetype/internal/ftgloadr.h b/include/freetype/internal/ftgloadr.h
index 9f47c0b..548481a 100644
--- a/include/freetype/internal/ftgloadr.h
+++ b/include/freetype/internal/ftgloadr.h
@@ -67,11 +67,11 @@ FT_BEGIN_HEADER
typedef struct FT_GlyphLoadRec_
{
- FT_Outline outline; /* outline */
- FT_Vector* extra_points; /* extra points table */
+ FT_Outline outline; /* outline */
+ FT_Vector* extra_points; /* extra points table */
FT_Vector* extra_points2; /* second extra points table */
- FT_UInt num_subglyphs; /* number of subglyphs */
- FT_SubGlyph subglyphs; /* subglyphs */
+ FT_UInt num_subglyphs; /* number of subglyphs */
+ FT_SubGlyph subglyphs; /* subglyphs */
} FT_GlyphLoadRec, *FT_GlyphLoad;
diff --git a/include/freetype/internal/ftobjs.h b/include/freetype/internal/ftobjs.h
index 167224a..1f22343 100644
--- a/include/freetype/internal/ftobjs.h
+++ b/include/freetype/internal/ftobjs.h
@@ -193,6 +193,7 @@ FT_BEGIN_HEADER
FT_CMap_DoneFunc done;
FT_CMap_CharIndexFunc char_index;
FT_CMap_CharNextFunc char_next;
+
/* Subsequent entries are special ones for format 14 -- the variant */
/* selector subtable which behaves like no other */
diff --git a/include/freetype/internal/psaux.h b/include/freetype/internal/psaux.h
index 67b7a42..7fb4c99 100644
--- a/include/freetype/internal/psaux.h
+++ b/include/freetype/internal/psaux.h
@@ -5,7 +5,7 @@
/* Auxiliary functions and data structures related to PostScript fonts */
/* (specification). */
/* */
-/* Copyright 1996-2001, 2002, 2003, 2004, 2006, 2008 by */
+/* Copyright 1996-2001, 2002, 2003, 2004, 2006, 2008, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -197,6 +197,7 @@ FT_BEGIN_HEADER
{
T1_FIELD_LOCATION_CID_INFO,
T1_FIELD_LOCATION_FONT_DICT,
+ T1_FIELD_LOCATION_FONT_EXTRA,
T1_FIELD_LOCATION_FONT_INFO,
T1_FIELD_LOCATION_PRIVATE,
T1_FIELD_LOCATION_BBOX,
@@ -227,7 +228,11 @@ FT_BEGIN_HEADER
FT_UInt array_max; /* maximal number of elements for */
/* array */
FT_UInt count_offset; /* offset of element count for */
- /* arrays */
+ /* arrays; must not be zero if in */
+ /* use -- in other words, a */
+ /* `num_FOO' element must not */
+ /* start the used structure if we */
+ /* parse a `FOO' array */
FT_UInt dict; /* where we expect it */
} T1_FieldRec;
diff --git a/include/freetype/internal/services/svcid.h b/include/freetype/internal/services/svcid.h
index 47fef62..2e391f2 100644
--- a/include/freetype/internal/services/svcid.h
+++ b/include/freetype/internal/services/svcid.h
@@ -4,7 +4,7 @@
/* */
/* The FreeType CID font services (specification). */
/* */
-/* Copyright 2007 by Derek Clegg. */
+/* Copyright 2007, 2009 by Derek Clegg, Michael Toftdal. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
@@ -31,10 +31,19 @@ FT_BEGIN_HEADER
const char* *registry,
const char* *ordering,
FT_Int *supplement );
+ typedef FT_Error
+ (*FT_CID_GetIsInternallyCIDKeyedFunc)( FT_Face face,
+ FT_Bool *is_cid );
+ typedef FT_Error
+ (*FT_CID_GetCIDFromGlyphIndexFunc)( FT_Face face,
+ FT_UInt glyph_index,
+ FT_UInt *cid );
FT_DEFINE_SERVICE( CID )
{
FT_CID_GetRegistryOrderingSupplementFunc get_ros;
+ FT_CID_GetIsInternallyCIDKeyedFunc get_is_cid;
+ FT_CID_GetCIDFromGlyphIndexFunc get_cid_from_glyph_index;
};
/* */
diff --git a/include/freetype/internal/services/svpsinfo.h b/include/freetype/internal/services/svpsinfo.h
index 63f5db9..124c6f9 100644
--- a/include/freetype/internal/services/svpsinfo.h
+++ b/include/freetype/internal/services/svpsinfo.h
@@ -4,7 +4,7 @@
/* */
/* The FreeType PostScript info service (specification). */
/* */
-/* Copyright 2003, 2004 by */
+/* Copyright 2003, 2004, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -33,6 +33,10 @@ FT_BEGIN_HEADER
(*PS_GetFontInfoFunc)( FT_Face face,
PS_FontInfoRec* afont_info );
+ typedef FT_Error
+ (*PS_GetFontExtraFunc)( FT_Face face,
+ PS_FontExtraRec* afont_extra );
+
typedef FT_Int
(*PS_HasGlyphNamesFunc)( FT_Face face );
@@ -44,6 +48,7 @@ FT_BEGIN_HEADER
FT_DEFINE_SERVICE( PsInfo )
{
PS_GetFontInfoFunc ps_get_font_info;
+ PS_GetFontExtraFunc ps_get_font_extra;
PS_HasGlyphNamesFunc ps_has_glyph_names;
PS_GetFontPrivateFunc ps_get_font_private;
};
diff --git a/include/freetype/internal/services/svttcmap.h b/include/freetype/internal/services/svttcmap.h
index 1e02d15..553ecb0 100644
--- a/include/freetype/internal/services/svttcmap.h
+++ b/include/freetype/internal/services/svttcmap.h
@@ -7,7 +7,7 @@
/* Copyright 2003 by */
/* Masatake YAMATO, Redhat K.K. */
/* */
-/* Copyright 2003 by */
+/* Copyright 2003, 2008 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -49,6 +49,13 @@ FT_BEGIN_HEADER
/* The language ID used in Mac fonts. Definitions of values are in */
/* freetype/ttnameid.h. */
/* */
+ /* format :: */
+ /* The cmap format. OpenType 1.5 defines the formats 0 (byte */
+ /* encoding table), 2~(high-byte mapping through table), 4~(segment */
+ /* mapping to delta values), 6~(trimmed table mapping), 8~(mixed */
+ /* 16-bit and 32-bit coverage), 10~(trimmed array), 12~(segmented */
+ /* coverage), and 14 (Unicode Variation Sequences). */
+ /* */
typedef struct TT_CMapInfo_
{
FT_ULong language;
diff --git a/include/freetype/internal/t1types.h b/include/freetype/internal/t1types.h
index 047c6d5..ff021b0 100644
--- a/include/freetype/internal/t1types.h
+++ b/include/freetype/internal/t1types.h
@@ -5,7 +5,7 @@
/* Basic Type1/Type2 type definitions and interface (specification */
/* only). */
/* */
-/* Copyright 1996-2001, 2002, 2003, 2004, 2006 by */
+/* Copyright 1996-2001, 2002, 2003, 2004, 2006, 2008, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -87,11 +87,24 @@ FT_BEGIN_HEADER
} T1_EncodingType;
+ /* used to hold extra data of PS_FontInfoRec that
+ * cannot be stored in the publicly defined structure.
+ *
+ * Note these can't be blended with multiple-masters.
+ */
+ typedef struct PS_FontExtraRec_
+ {
+ FT_UShort fs_type;
+
+ } PS_FontExtraRec;
+
+
typedef struct T1_FontRec_
{
- PS_FontInfoRec font_info; /* font info dictionary */
- PS_PrivateRec private_dict; /* private dictionary */
- FT_String* font_name; /* top-level dictionary */
+ PS_FontInfoRec font_info; /* font info dictionary */
+ PS_FontExtraRec font_extra; /* font info extra fields */
+ PS_PrivateRec private_dict; /* private dictionary */
+ FT_String* font_name; /* top-level dictionary */
T1_EncodingType encoding_type;
T1_EncodingRec encoding;
@@ -231,7 +244,10 @@ FT_BEGIN_HEADER
void* psnames;
void* psaux;
CID_FaceInfoRec cid;
+ PS_FontExtraRec font_extra;
+#if 0
void* afm_data;
+#endif
CID_Subrs subrs;
/* since version 2.1 - interface to PostScript hinter */
diff --git a/include/freetype/t1tables.h b/include/freetype/t1tables.h
index bd11f33..5e2a393 100644
--- a/include/freetype/t1tables.h
+++ b/include/freetype/t1tables.h
@@ -5,7 +5,7 @@
/* Basic Type 1/Type 2 tables definitions and interface (specification */
/* only). */
/* */
-/* Copyright 1996-2001, 2002, 2003, 2004, 2006, 2008 by */
+/* Copyright 1996-2001, 2002, 2003, 2004, 2006, 2008, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -43,7 +43,7 @@ FT_BEGIN_HEADER
/* Type 1 Tables */
/* */
/* <Abstract> */
- /* Type 1 (PostScript) specific font tables. */
+ /* Type~1 (PostScript) specific font tables. */
/* */
/* <Description> */
/* This section contains the definition of Type 1-specific tables, */
@@ -62,8 +62,8 @@ FT_BEGIN_HEADER
/* PS_FontInfoRec */
/* */
/* <Description> */
- /* A structure used to model a Type1/Type2 FontInfo dictionary. Note */
- /* that for Multiple Master fonts, each instance has its own */
+ /* A structure used to model a Type~1 or Type~2 FontInfo dictionary. */
+ /* Note that for Multiple Master fonts, each instance has its own */
/* FontInfo dictionary. */
/* */
typedef struct PS_FontInfoRec_
@@ -111,9 +111,9 @@ FT_BEGIN_HEADER
/* PS_PrivateRec */
/* */
/* <Description> */
- /* A structure used to model a Type1/Type2 private dictionary. Note */
- /* that for Multiple Master fonts, each instance has its own Private */
- /* dictionary. */
+ /* A structure used to model a Type~1 or Type~2 private dictionary. */
+ /* Note that for Multiple Master fonts, each instance has its own */
+ /* Private dictionary. */
/* */
typedef struct PS_PrivateRec_
{
@@ -408,7 +408,7 @@ FT_BEGIN_HEADER
* FT_Has_PS_Glyph_Names
*
* @description:
- * Return true if a given face provides reliable Postscript glyph
+ * Return true if a given face provides reliable PostScript glyph
* names. This is similar to using the @FT_HAS_GLYPH_NAMES macro,
* except that certain fonts (mostly TrueType) contain incorrect
* glyph name tables.
@@ -435,24 +435,24 @@ FT_BEGIN_HEADER
*
* @description:
* Retrieve the @PS_FontInfoRec structure corresponding to a given
- * Postscript font.
+ * PostScript font.
*
* @input:
* face ::
- * Postscript face handle.
+ * PostScript face handle.
*
* @output:
* afont_info ::
* Output font info structure pointer.
*
* @return:
- * FreeType error code. 0 means success.
+ * FreeType error code. 0~means success.
*
* @note:
* The string pointers within the font info structure are owned by
* the face and don't need to be freed by the caller.
*
- * If the font's format is not Postscript-based, this function will
+ * If the font's format is not PostScript-based, this function will
* return the `FT_Err_Invalid_Argument' error code.
*
*/
@@ -468,25 +468,25 @@ FT_BEGIN_HEADER
*
* @description:
* Retrieve the @PS_PrivateRec structure corresponding to a given
- * Postscript font.
+ * PostScript font.
*
* @input:
* face ::
- * Postscript face handle.
+ * PostScript face handle.
*
* @output:
* afont_private ::
* Output private dictionary structure pointer.
*
* @return:
- * FreeType error code. 0 means success.
+ * FreeType error code. 0~means success.
*
* @note:
- * The string pointers within the font info structure are owned by
+ * The string pointers within the @PS_PrivateRec structure are owned by
* the face and don't need to be freed by the caller.
*
- * If the font's format is not Postscript-based, this function will
- * return the `FT_Err_Invalid_Argument' error code.
+ * If the font's format is not PostScript-based, this function returns
+ * the `FT_Err_Invalid_Argument' error code.
*
*/
FT_EXPORT( FT_Error )
diff --git a/include/freetype/ttnameid.h b/include/freetype/ttnameid.h
index 0cddba1..cbeac78 100644
--- a/include/freetype/ttnameid.h
+++ b/include/freetype/ttnameid.h
@@ -303,7 +303,7 @@ FT_BEGIN_HEADER
* TT_ADOBE_ID_CUSTOM ::
* Adobe custom encoding.
* TT_ADOBE_ID_LATIN_1 ::
- * Adobe Latin 1 encoding.
+ * Adobe Latin~1 encoding.
*/
#define TT_ADOBE_ID_STANDARD 0
@@ -835,16 +835,18 @@ FT_BEGIN_HEADER
/* This is new in OpenType 1.3 */
#define TT_NAME_ID_CID_FINDFONT_NAME 20
+ /* This is new in OpenType 1.5 */
+#define TT_NAME_ID_WWS_FAMILY 21
+#define TT_NAME_ID_WWS_SUBFAMILY 22
+
/*************************************************************************/
/* */
/* Bit mask values for the Unicode Ranges from the TTF `OS2 ' table. */
/* */
- /* Updated 02-Jul-2000. */
+ /* Updated 08-Nov-2008. */
/* */
- /* General Scripts Area */
-
/* Bit 0 Basic Latin */
#define TT_UCR_BASIC_LATIN (1L << 0) /* U+0020-U+007E */
/* Bit 1 C1 Controls and Latin-1 Supplement */
@@ -853,27 +855,44 @@ FT_BEGIN_HEADER
#define TT_UCR_LATIN_EXTENDED_A (1L << 2) /* U+0100-U+017F */
/* Bit 3 Latin Extended-B */
#define TT_UCR_LATIN_EXTENDED_B (1L << 3) /* U+0180-U+024F */
- /* Bit 4 IPA Extensions */
+ /* Bit 4 IPA Extensions */
+ /* Phonetic Extensions */
+ /* Phonetic Extensions Supplement */
#define TT_UCR_IPA_EXTENSIONS (1L << 4) /* U+0250-U+02AF */
+ /* U+1D00-U+1D7F */
+ /* U+1D80-U+1DBF */
/* Bit 5 Spacing Modifier Letters */
+ /* Modifier Tone Letters */
#define TT_UCR_SPACING_MODIFIER (1L << 5) /* U+02B0-U+02FF */
- /* Bit 6 Combining Diacritical Marks */
+ /* U+A700-U+A71F */
+ /* Bit 6 Combining Diacritical Marks */
+ /* Combining Diacritical Marks Supplement */
#define TT_UCR_COMBINING_DIACRITICS (1L << 6) /* U+0300-U+036F */
+ /* U+1DC0-U+1DFF */
/* Bit 7 Greek and Coptic */
#define TT_UCR_GREEK (1L << 7) /* U+0370-U+03FF */
- /* Bit 8 is reserved (was: Greek Symbols and Coptic) */
- /* Bit 9 Cyrillic + */
- /* Cyrillic Supplementary */
+ /* Bit 8 Coptic */
+#define TT_UCR_COPTIC (1L << 8) /* U+2C80-U+2CFF */
+ /* Bit 9 Cyrillic */
+ /* Cyrillic Supplement */
+ /* Cyrillic Extended-A */
+ /* Cyrillic Extended-B */
#define TT_UCR_CYRILLIC (1L << 9) /* U+0400-U+04FF */
/* U+0500-U+052F */
+ /* U+2DE0-U+2DFF */
+ /* U+A640-U+A69F */
/* Bit 10 Armenian */
#define TT_UCR_ARMENIAN (1L << 10) /* U+0530-U+058F */
/* Bit 11 Hebrew */
#define TT_UCR_HEBREW (1L << 11) /* U+0590-U+05FF */
- /* Bit 12 is reserved (was: Hebrew Extended) */
- /* Bit 13 Arabic */
+ /* Bit 12 Vai */
+#define TT_UCR_VAI (1L << 12) /* U+A500-U+A63F */
+ /* Bit 13 Arabic */
+ /* Arabic Supplement */
#define TT_UCR_ARABIC (1L << 13) /* U+0600-U+06FF */
- /* Bit 14 is reserved (was: Arabic Extended) */
+ /* U+0750-U+077F */
+ /* Bit 14 NKo */
+#define TT_UCR_NKO (1L << 14) /* U+07C0-U+07FF */
/* Bit 15 Devanagari */
#define TT_UCR_DEVANAGARI (1L << 15) /* U+0900-U+097F */
/* Bit 16 Bengali */
@@ -896,20 +915,26 @@ FT_BEGIN_HEADER
#define TT_UCR_THAI (1L << 24) /* U+0E00-U+0E7F */
/* Bit 25 Lao */
#define TT_UCR_LAO (1L << 25) /* U+0E80-U+0EFF */
- /* Bit 26 Georgian */
+ /* Bit 26 Georgian */
+ /* Georgian Supplement */
#define TT_UCR_GEORGIAN (1L << 26) /* U+10A0-U+10FF */
- /* Bit 27 is reserved (was Georgian Extended) */
+ /* U+2D00-U+2D2F */
+ /* Bit 27 Balinese */
+#define TT_UCR_BALINESE (1L << 27) /* U+1B00-U+1B7F */
/* Bit 28 Hangul Jamo */
#define TT_UCR_HANGUL_JAMO (1L << 28) /* U+1100-U+11FF */
/* Bit 29 Latin Extended Additional */
+ /* Latin Extended-C */
+ /* Latin Extended-D */
#define TT_UCR_LATIN_EXTENDED_ADDITIONAL (1L << 29) /* U+1E00-U+1EFF */
+ /* U+2C60-U+2C7F */
+ /* U+A720-U+A7FF */
/* Bit 30 Greek Extended */
#define TT_UCR_GREEK_EXTENDED (1L << 30) /* U+1F00-U+1FFF */
-
- /* Symbols Area */
-
- /* Bit 31 General Punctuation */
+ /* Bit 31 General Punctuation */
+ /* Supplemental Punctuation */
#define TT_UCR_GENERAL_PUNCTUATION (1L << 31) /* U+2000-U+206F */
+ /* U+2E00-U+2E7F */
/* Bit 32 Superscripts And Subscripts */
#define TT_UCR_SUPERSCRIPTS_SUBSCRIPTS (1L << 0) /* U+2070-U+209F */
/* Bit 33 Currency Symbols */
@@ -920,16 +945,18 @@ FT_BEGIN_HEADER
#define TT_UCR_LETTERLIKE_SYMBOLS (1L << 3) /* U+2100-U+214F */
/* Bit 36 Number Forms */
#define TT_UCR_NUMBER_FORMS (1L << 4) /* U+2150-U+218F */
- /* Bit 37 Arrows + */
- /* Supplemental Arrows-A + */
- /* Supplemental Arrows-B */
+ /* Bit 37 Arrows */
+ /* Supplemental Arrows-A */
+ /* Supplemental Arrows-B */
+ /* Miscellaneous Symbols and Arrows */
#define TT_UCR_ARROWS (1L << 5) /* U+2190-U+21FF */
/* U+27F0-U+27FF */
/* U+2900-U+297F */
- /* Bit 38 Mathematical Operators + */
- /* Supplemental Mathematical Operators + */
- /* Miscellaneous Mathematical Symbols-A + */
- /* Miscellaneous Mathematical Symbols-B */
+ /* U+2B00-U+2BFF */
+ /* Bit 38 Mathematical Operators */
+ /* Supplemental Mathematical Operators */
+ /* Miscellaneous Mathematical Symbols-A */
+ /* Miscellaneous Mathematical Symbols-B */
#define TT_UCR_MATHEMATICAL_OPERATORS (1L << 6) /* U+2200-U+22FF */
/* U+2A00-U+2AFF */
/* U+27C0-U+27EF */
@@ -952,60 +979,53 @@ FT_BEGIN_HEADER
#define TT_UCR_MISCELLANEOUS_SYMBOLS (1L << 14) /* U+2600-U+26FF */
/* Bit 47 Dingbats */
#define TT_UCR_DINGBATS (1L << 15) /* U+2700-U+27BF */
-
- /* CJK Phonetics and Symbols Area */
-
/* Bit 48 CJK Symbols and Punctuation */
#define TT_UCR_CJK_SYMBOLS (1L << 16) /* U+3000-U+303F */
/* Bit 49 Hiragana */
#define TT_UCR_HIRAGANA (1L << 17) /* U+3040-U+309F */
- /* Bit 50 Katakana + */
- /* Katakana Phonetic Extensions */
+ /* Bit 50 Katakana */
+ /* Katakana Phonetic Extensions */
#define TT_UCR_KATAKANA (1L << 18) /* U+30A0-U+30FF */
/* U+31F0-U+31FF */
- /* Bit 51 Bopomofo + */
- /* Bopomofo Extended */
+ /* Bit 51 Bopomofo */
+ /* Bopomofo Extended */
#define TT_UCR_BOPOMOFO (1L << 19) /* U+3100-U+312F */
/* U+31A0-U+31BF */
/* Bit 52 Hangul Compatibility Jamo */
#define TT_UCR_HANGUL_COMPATIBILITY_JAMO (1L << 20) /* U+3130-U+318F */
- /* Bit 53 Kanbun */
-#define TT_UCR_CJK_MISC (1L << 21) /* U+3190-U+319F */
-#define TT_UCR_KANBUN TT_UCR_CJK_MISC
+ /* Bit 53 Phags-Pa */
+#define TT_UCR_CJK_MISC (1L << 21) /* U+A840-U+A87F */
+#define TT_UCR_KANBUN TT_UCR_CJK_MISC /* deprecated */
+#define TT_UCR_PHAGSPA
/* Bit 54 Enclosed CJK Letters and Months */
#define TT_UCR_ENCLOSED_CJK_LETTERS_MONTHS (1L << 22) /* U+3200-U+32FF */
/* Bit 55 CJK Compatibility */
#define TT_UCR_CJK_COMPATIBILITY (1L << 23) /* U+3300-U+33FF */
-
- /* Hangul Syllables Area */
-
- /* Bit 56 Hangul */
+ /* Bit 56 Hangul Syllables */
#define TT_UCR_HANGUL (1L << 24) /* U+AC00-U+D7A3 */
-
- /* Surrogates Area */
-
- /* Bit 57 High Surrogates + */
- /* High Private Use Surrogates + */
- /* Low Surrogates */
+ /* Bit 57 High Surrogates */
+ /* High Private Use Surrogates */
+ /* Low Surrogates */
+ /* */
+ /* According to OpenType specs v.1.3+, */
+ /* setting bit 57 implies that there is */
+ /* at least one codepoint beyond the */
+ /* Basic Multilingual Plane that is */
+ /* supported by this font. So it really */
+ /* means >= U+10000 */
#define TT_UCR_SURROGATES (1L << 25) /* U+D800-U+DB7F */
/* U+DB80-U+DBFF */
/* U+DC00-U+DFFF */
- /* According to OpenType specs v.1.3+, setting bit 57 implies that there */
- /* is at least one codepoint beyond the Basic Multilingual Plane that is */
- /* supported by this font. So it really means: >= U+10000 */
-
- /* Bit 58 is reserved for Unicode SubRanges */
-
- /* CJK Ideographs Area */
-
- /* Bit 59 CJK Unified Ideographs + */
- /* CJK Radicals Supplement + */
- /* Kangxi Radicals + */
- /* Ideographic Description Characters + */
- /* CJK Unified Ideographs Extension A */
- /* CJK Unified Ideographs Extension A + */
- /* CJK Unified Ideographs Extension B + */
- /* Kanbun */
+#define TT_UCR_NON_PLANE_0 TT_UCR_SURROGATES
+ /* Bit 58 Phoenician */
+#define TT_UCR_PHOENICIAN (1L << 26) /*U+10900-U+1091F*/
+ /* Bit 59 CJK Unified Ideographs */
+ /* CJK Radicals Supplement */
+ /* Kangxi Radicals */
+ /* Ideographic Description Characters */
+ /* CJK Unified Ideographs Extension A */
+ /* CJK Unified Ideographs Extension B */
+ /* Kanbun */
#define TT_UCR_CJK_UNIFIED_IDEOGRAPHS (1L << 27) /* U+4E00-U+9FFF */
/* U+2E80-U+2EFF */
/* U+2F00-U+2FDF */
@@ -1013,17 +1033,13 @@ FT_BEGIN_HEADER
/* U+3400-U+4DB5 */
/*U+20000-U+2A6DF*/
/* U+3190-U+319F */
-
- /* Private Use Area */
-
/* Bit 60 Private Use */
#define TT_UCR_PRIVATE_USE (1L << 28) /* U+E000-U+F8FF */
-
- /* Compatibility Area and Specials */
-
- /* Bit 61 CJK Compatibility Ideographs + */
- /* CJK Compatibility Ideographs Supplement */
-#define TT_UCR_CJK_COMPATIBILITY_IDEOGRAPHS (1L << 29) /* U+F900-U+FAFF */
+ /* Bit 61 CJK Strokes */
+ /* CJK Compatibility Ideographs */
+ /* CJK Compatibility Ideographs Supplement */
+#define TT_UCR_CJK_COMPATIBILITY_IDEOGRAPHS (1L << 29) /* U+31C0-U+31EF */
+ /* U+F900-U+FAFF */
/*U+2F800-U+2FA1F*/
/* Bit 62 Alphabetic Presentation Forms */
#define TT_UCR_ALPHABETIC_PRESENTATION_FORMS (1L << 30) /* U+FB00-U+FB4F */
@@ -1031,8 +1047,10 @@ FT_BEGIN_HEADER
#define TT_UCR_ARABIC_PRESENTATIONS_A (1L << 31) /* U+FB50-U+FDFF */
/* Bit 64 Combining Half Marks */
#define TT_UCR_COMBINING_HALF_MARKS (1L << 0) /* U+FE20-U+FE2F */
- /* Bit 65 CJK Compatibility Forms */
-#define TT_UCR_CJK_COMPATIBILITY_FORMS (1L << 1) /* U+FE30-U+FE4F */
+ /* Bit 65 Vertical forms */
+ /* CJK Compatibility Forms */
+#define TT_UCR_CJK_COMPATIBILITY_FORMS (1L << 1) /* U+FE10-U+FE1F */
+ /* U+FE30-U+FE4F */
/* Bit 66 Small Form Variants */
#define TT_UCR_SMALL_FORM_VARIANTS (1L << 2) /* U+FE50-U+FE6F */
/* Bit 67 Arabic Presentation Forms-B */
@@ -1051,8 +1069,12 @@ FT_BEGIN_HEADER
#define TT_UCR_SINHALA (1L << 9) /* U+0D80-U+0DFF */
/* Bit 74 Myanmar */
#define TT_UCR_MYANMAR (1L << 10) /* U+1000-U+109F */
- /* Bit 75 Ethiopic */
+ /* Bit 75 Ethiopic */
+ /* Ethiopic Supplement */
+ /* Ethiopic Extended */
#define TT_UCR_ETHIOPIC (1L << 11) /* U+1200-U+137F */
+ /* U+1380-U+139F */
+ /* U+2D80-U+2DDF */
/* Bit 76 Cherokee */
#define TT_UCR_CHEROKEE (1L << 12) /* U+13A0-U+13FF */
/* Bit 77 Unified Canadian Aboriginal Syllabics */
@@ -1061,20 +1083,22 @@ FT_BEGIN_HEADER
#define TT_UCR_OGHAM (1L << 14) /* U+1680-U+169F */
/* Bit 79 Runic */
#define TT_UCR_RUNIC (1L << 15) /* U+16A0-U+16FF */
- /* Bit 80 Khmer */
+ /* Bit 80 Khmer */
+ /* Khmer Symbols */
#define TT_UCR_KHMER (1L << 16) /* U+1780-U+17FF */
+ /* U+19E0-U+19FF */
/* Bit 81 Mongolian */
#define TT_UCR_MONGOLIAN (1L << 17) /* U+1800-U+18AF */
/* Bit 82 Braille Patterns */
#define TT_UCR_BRAILLE (1L << 18) /* U+2800-U+28FF */
- /* Bit 83 Yi Syllables + */
- /* Yi Radicals */
+ /* Bit 83 Yi Syllables */
+ /* Yi Radicals */
#define TT_UCR_YI (1L << 19) /* U+A000-U+A48F */
/* U+A490-U+A4CF */
- /* Bit 84 Tagalog + */
- /* Hanunoo + */
- /* Buhid + */
- /* Tagbanwa */
+ /* Bit 84 Tagalog */
+ /* Hanunoo */
+ /* Buhid */
+ /* Tagbanwa */
#define TT_UCR_PHILIPPINE (1L << 20) /* U+1700-U+171F */
/* U+1720-U+173F */
/* U+1740-U+175F */
@@ -1085,20 +1109,97 @@ FT_BEGIN_HEADER
#define TT_UCR_GOTHIC (1L << 22) /*U+10330-U+1034F*/
/* Bit 87 Deseret */
#define TT_UCR_DESERET (1L << 23) /*U+10400-U+1044F*/
- /* Bit 88 Byzantine Musical Symbols + */
- /* Musical Symbols */
+ /* Bit 88 Byzantine Musical Symbols */
+ /* Musical Symbols */
+ /* Ancient Greek Musical Notation */
#define TT_UCR_MUSICAL_SYMBOLS (1L << 24) /*U+1D000-U+1D0FF*/
/*U+1D100-U+1D1FF*/
+ /*U+1D200-U+1D24F*/
/* Bit 89 Mathematical Alphanumeric Symbols */
#define TT_UCR_MATH_ALPHANUMERIC_SYMBOLS (1L << 25) /*U+1D400-U+1D7FF*/
- /* Bit 90 Private Use (plane 15) + */
- /* Private Use (plane 16) */
+ /* Bit 90 Private Use (plane 15) */
+ /* Private Use (plane 16) */
#define TT_UCR_PRIVATE_USE_SUPPLEMENTARY (1L << 26) /*U+F0000-U+FFFFD*/
/*U+100000-U+10FFFD*/
- /* Bit 91 Variation Selectors */
+ /* Bit 91 Variation Selectors */
+ /* Variation Selectors Supplement */
#define TT_UCR_VARIATION_SELECTORS (1L << 27) /* U+FE00-U+FE0F */
+ /*U+E0100-U+E01EF*/
/* Bit 92 Tags */
#define TT_UCR_TAGS (1L << 28) /*U+E0000-U+E007F*/
+ /* Bit 93 Limbu */
+#define TT_UCR_LIMBU (1L << 29) /* U+1900-U+194F */
+ /* Bit 94 Tai Le */
+#define TT_UCR_TAI_LE (1L << 30) /* U+1950-U+197F */
+ /* Bit 95 New Tai Lue */
+#define TT_UCR_NEW_TAI_LUE (1L << 31) /* U+1980-U+19DF */
+ /* Bit 96 Buginese */
+#define TT_UCR_BUGINESE (1L << 0) /* U+1A00-U+1A1F */
+ /* Bit 97 Glagolitic */
+#define TT_UCR_GLAGOLITIC (1L << 1) /* U+2C00-U+2C5F */
+ /* Bit 98 Tifinagh */
+#define TT_UCR_TIFINAGH (1L << 2) /* U+2D30-U+2D7F */
+ /* Bit 99 Yijing Hexagram Symbols */
+#define TT_UCR_YIJING (1L << 3) /* U+4DC0-U+4DFF */
+ /* Bit 100 Syloti Nagri */
+#define TT_UCR_SYLOTI_NAGRI (1L << 4) /* U+A800-U+A82F */
+ /* Bit 101 Linear B Syllabary */
+ /* Linear B Ideograms */
+ /* Aegean Numbers */
+#define TT_UCR_LINEAR_B (1L << 5) /*U+10000-U+1007F*/
+ /*U+10080-U+100FF*/
+ /*U+10100-U+1013F*/
+ /* Bit 102 Ancient Greek Numbers */
+#define TT_UCR_ANCIENT_GREEK_NUMBERS (1L << 6) /*U+10140-U+1018F*/
+ /* Bit 103 Ugaritic */
+#define TT_UCR_UGARITIC (1L << 7) /*U+10380-U+1039F*/
+ /* Bit 104 Old Persian */
+#define TT_UCR_OLD_PERSIAN (1L << 8) /*U+103A0-U+103DF*/
+ /* Bit 105 Shavian */
+#define TT_UCR_SHAVIAN (1L << 9) /*U+10450-U+1047F*/
+ /* Bit 106 Osmanya */
+#define TT_UCR_OSMANYA (1L << 10) /*U+10480-U+104AF*/
+ /* Bit 107 Cypriot Syllabary */
+#define TT_UCR_CYPRIOT_SYLLABARY (1L << 11) /*U+10800-U+1083F*/
+ /* Bit 108 Kharoshthi */
+#define TT_UCR_KHAROSHTHI (1L << 12) /*U+10A00-U+10A5F*/
+ /* Bit 109 Tai Xuan Jing Symbols */
+#define TT_UCR_TAI_XUAN_JING (1L << 13) /*U+1D300-U+1D35F*/
+ /* Bit 110 Cuneiform */
+ /* Cuneiform Numbers and Punctuation */
+#define TT_UCR_CUNEIFORM (1L << 14) /*U+12000-U+123FF*/
+ /*U+12400-U+1247F*/
+ /* Bit 111 Counting Rod Numerals */
+#define TT_UCR_COUNTING_ROD_NUMERALS (1L << 15) /*U+1D360-U+1D37F*/
+ /* Bit 112 Sundanese */
+#define TT_UCR_SUNDANESE (1L << 16) /* U+1B80-U+1BBF */
+ /* Bit 113 Lepcha */
+#define TT_UCR_LEPCHA (1L << 17) /* U+1C00-U+1C4F */
+ /* Bit 114 Ol Chiki */
+#define TT_UCR_OL_CHIKI (1L << 18) /* U+1C50-U+1C7F */
+ /* Bit 115 Saurashtra */
+#define TT_UCR_SAURASHTRA (1L << 19) /* U+A880-U+A8DF */
+ /* Bit 116 Kayah Li */
+#define TT_UCR_KAYAH_LI (1L << 20) /* U+A900-U+A92F */
+ /* Bit 117 Rejang */
+#define TT_UCR_REJANG (1L << 21) /* U+A930-U+A95F */
+ /* Bit 118 Cham */
+#define TT_UCR_CHAM (1L << 22) /* U+AA00-U+AA5F */
+ /* Bit 119 Ancient Symbols */
+#define TT_UCR_ANCIENT_SYMBOLS (1L << 23) /*U+10190-U+101CF*/
+ /* Bit 120 Phaistos Disc */
+#define TT_UCR_PHAISTOS_DISC (1L << 24) /*U+101D0-U+101FF*/
+ /* Bit 121 Carian */
+ /* Lycian */
+ /* Lydian */
+#define TT_UCR_OLD_ANATOLIAN (1L << 25) /*U+102A0-U+102DF*/
+ /*U+10280-U+1029F*/
+ /*U+10920-U+1093F*/
+ /* Bit 122 Domino Tiles */
+ /* Mahjong Tiles */
+#define TT_UCR_GAME_TILES (1L << 26) /*U+1F030-U+1F09F*/
+ /*U+1F000-U+1F02F*/
+ /* Bit 123-127 Reserved for process-internal usage */
/*************************************************************************/
@@ -1117,7 +1218,7 @@ FT_BEGIN_HEADER
/* */
/* Here some alias #defines in order to be clearer. */
/* */
- /* These are not always #defined to stay within the 31 character limit */
+ /* These are not always #defined to stay within the 31~character limit */
/* which some compilers have. */
/* */
/* Credits go to Dave Hoo <dhoo@flash.net> for pointing out that modern */
diff --git a/include/freetype/tttables.h b/include/freetype/tttables.h
index 79edb0e..c12b172 100644
--- a/include/freetype/tttables.h
+++ b/include/freetype/tttables.h
@@ -5,7 +5,7 @@
/* Basic SFNT/TrueType tables definitions and interface */
/* (specification only). */
/* */
-/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2008 by */
+/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2008, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -156,9 +156,9 @@ FT_BEGIN_HEADER
/* caret_Slope_Run :: The run coefficient of the cursor's */
/* slope. */
/* */
- /* Reserved :: 8 reserved bytes. */
+ /* Reserved :: 8~reserved bytes. */
/* */
- /* metric_Data_Format :: Always 0. */
+ /* metric_Data_Format :: Always~0. */
/* */
/* number_Of_HMetrics :: Number of HMetrics entries in the `hmtx' */
/* table -- this value can be smaller than */
@@ -281,9 +281,9 @@ FT_BEGIN_HEADER
/* This value is `reserved' in vmtx */
/* version 1.0. */
/* */
- /* Reserved :: 8 reserved bytes. */
+ /* Reserved :: 8~reserved bytes. */
/* */
- /* metric_Data_Format :: Always 0. */
+ /* metric_Data_Format :: Always~0. */
/* */
/* number_Of_HMetrics :: Number of VMetrics entries in the */
/* `vmtx' table -- this value can be */
@@ -406,9 +406,9 @@ FT_BEGIN_HEADER
/* TT_Postscript */
/* */
/* <Description> */
- /* A structure used to model a TrueType Postscript table. All fields */
+ /* A structure used to model a TrueType PostScript table. All fields */
/* comply to the TrueType specification. This structure does not */
- /* reference the Postscript glyph names, which can be nevertheless */
+ /* reference the PostScript glyph names, which can be nevertheless */
/* accessed with the `ttpost' module. */
/* */
typedef struct TT_Postscript_
@@ -578,7 +578,7 @@ FT_BEGIN_HEADER
/* FT_Get_Sfnt_Table */
/* */
/* <Description> */
- /* Returns a pointer to a given SFNT table within a face. */
+ /* Return a pointer to a given SFNT table within a face. */
/* */
/* <Input> */
/* face :: A handle to the source. */
@@ -586,7 +586,7 @@ FT_BEGIN_HEADER
/* tag :: The index of the SFNT table. */
/* */
/* <Return> */
- /* A type-less pointer to the table. This will be 0 in case of */
+ /* A type-less pointer to the table. This will be~0 in case of */
/* error, or if the corresponding table was not found *OR* loaded */
/* from the file. */
/* */
@@ -608,14 +608,14 @@ FT_BEGIN_HEADER
* FT_Load_Sfnt_Table
*
* @description:
- * Loads any font table into client memory.
+ * Load any font table into client memory.
*
* @input:
* face ::
* A handle to the source face.
*
* tag ::
- * The four-byte tag of the table to load. Use the value 0 if you want
+ * The four-byte tag of the table to load. Use the value~0 if you want
* to access the whole font file. Otherwise, you can use one of the
* definitions found in the @FT_TRUETYPE_TAGS_H file, or forge a new
* one with @FT_MAKE_TAG.
@@ -633,18 +633,18 @@ FT_BEGIN_HEADER
* If the `length' parameter is NULL, then try to load the whole table.
* Return an error code if it fails.
*
- * Else, if `*length' is 0, exit immediately while returning the
+ * Else, if `*length' is~0, exit immediately while returning the
* table's (or file) full size in it.
*
* Else the number of bytes to read from the table or file, from the
* starting offset.
*
* @return:
- * FreeType error code. 0 means success.
+ * FreeType error code. 0~means success.
*
* @note:
* If you need to determine the table's length you should first call this
- * function with `*length' set to 0, as in the following example:
+ * function with `*length' set to~0, as in the following example:
*
* {
* FT_ULong length = 0;
@@ -674,7 +674,7 @@ FT_BEGIN_HEADER
* FT_Sfnt_Table_Info
*
* @description:
- * Returns information on an SFNT table.
+ * Return information on an SFNT table.
*
* @input:
* face ::
@@ -692,10 +692,10 @@ FT_BEGIN_HEADER
* The length of the SFNT table.
*
* @return:
- * FreeType error code. 0 means success.
+ * FreeType error code. 0~means success.
*
* @note:
- * SFNT tables with length zero are treated as missing by Windows.
+ * SFNT tables with length zero are treated as missing.
*
*/
FT_EXPORT( FT_Error )
@@ -720,7 +720,7 @@ FT_BEGIN_HEADER
/* */
/* <Return> */
/* The language ID of `charmap'. If `charmap' doesn't belong to a */
- /* TrueType/sfnt face, just return 0 as the default value. */
+ /* TrueType/sfnt face, just return~0 as the default value. */
/* */
FT_EXPORT( FT_ULong )
FT_Get_CMap_Language_ID( FT_CharMap charmap );
diff --git a/include/freetype/tttags.h b/include/freetype/tttags.h
index 5a79008..307ce4b 100644
--- a/include/freetype/tttags.h
+++ b/include/freetype/tttags.h
@@ -4,7 +4,7 @@
/* */
/* Tags for TrueType and OpenType tables (specification only). */
/* */
-/* Copyright 1996-2001, 2004, 2005, 2007 by */
+/* Copyright 1996-2001, 2004, 2005, 2007, 2008 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -41,6 +41,7 @@ FT_BEGIN_HEADER
#define TTAG_bloc FT_MAKE_TAG( 'b', 'l', 'o', 'c' )
#define TTAG_bsln FT_MAKE_TAG( 'b', 's', 'l', 'n' )
#define TTAG_CFF FT_MAKE_TAG( 'C', 'F', 'F', ' ' )
+#define TTAG_CID FT_MAKE_TAG( 'C', 'I', 'D', ' ' )
#define TTAG_cmap FT_MAKE_TAG( 'c', 'm', 'a', 'p' )
#define TTAG_cvar FT_MAKE_TAG( 'c', 'v', 'a', 'r' )
#define TTAG_cvt FT_MAKE_TAG( 'c', 'v', 't', ' ' )
@@ -49,6 +50,7 @@ FT_BEGIN_HEADER
#define TTAG_EBLC FT_MAKE_TAG( 'E', 'B', 'L', 'C' )
#define TTAG_EBSC FT_MAKE_TAG( 'E', 'B', 'S', 'C' )
#define TTAG_feat FT_MAKE_TAG( 'f', 'e', 'a', 't' )
+#define TTAG_FOND FT_MAKE_TAG( 'F', 'O', 'N', 'D' )
#define TTAG_fpgm FT_MAKE_TAG( 'f', 'p', 'g', 'm' )
#define TTAG_fvar FT_MAKE_TAG( 'f', 'v', 'a', 'r' )
#define TTAG_gasp FT_MAKE_TAG( 'g', 'a', 's', 'p' )
@@ -67,6 +69,7 @@ FT_BEGIN_HEADER
#define TTAG_lcar FT_MAKE_TAG( 'l', 'c', 'a', 'r' )
#define TTAG_loca FT_MAKE_TAG( 'l', 'o', 'c', 'a' )
#define TTAG_LTSH FT_MAKE_TAG( 'L', 'T', 'S', 'H' )
+#define TTAG_LWFN FT_MAKE_TAG( 'L', 'W', 'F', 'N' )
#define TTAG_MATH FT_MAKE_TAG( 'M', 'A', 'T', 'H' )
#define TTAG_maxp FT_MAKE_TAG( 'm', 'a', 'x', 'p' )
#define TTAG_META FT_MAKE_TAG( 'M', 'E', 'T', 'A' )
@@ -79,14 +82,18 @@ FT_BEGIN_HEADER
#define TTAG_OS2 FT_MAKE_TAG( 'O', 'S', '/', '2' )
#define TTAG_OTTO FT_MAKE_TAG( 'O', 'T', 'T', 'O' )
#define TTAG_PCLT FT_MAKE_TAG( 'P', 'C', 'L', 'T' )
+#define TTAG_POST FT_MAKE_TAG( 'P', 'O', 'S', 'T' )
#define TTAG_post FT_MAKE_TAG( 'p', 'o', 's', 't' )
#define TTAG_prep FT_MAKE_TAG( 'p', 'r', 'e', 'p' )
#define TTAG_prop FT_MAKE_TAG( 'p', 'r', 'o', 'p' )
+#define TTAG_sfnt FT_MAKE_TAG( 's', 'f', 'n', 't' )
#define TTAG_SING FT_MAKE_TAG( 'S', 'I', 'N', 'G' )
#define TTAG_trak FT_MAKE_TAG( 't', 'r', 'a', 'k' )
#define TTAG_true FT_MAKE_TAG( 't', 'r', 'u', 'e' )
#define TTAG_ttc FT_MAKE_TAG( 't', 't', 'c', ' ' )
#define TTAG_ttcf FT_MAKE_TAG( 't', 't', 'c', 'f' )
+#define TTAG_TYP1 FT_MAKE_TAG( 'T', 'Y', 'P', '1' )
+#define TTAG_typ1 FT_MAKE_TAG( 't', 'y', 'p', '1' )
#define TTAG_VDMX FT_MAKE_TAG( 'V', 'D', 'M', 'X' )
#define TTAG_vhea FT_MAKE_TAG( 'v', 'h', 'e', 'a' )
#define TTAG_vmtx FT_MAKE_TAG( 'v', 'm', 't', 'x' )
diff --git a/src/autofit/afcjk.c b/src/autofit/afcjk.c
index 7e9438b..fabe921 100644
--- a/src/autofit/afcjk.c
+++ b/src/autofit/afcjk.c
@@ -1436,29 +1436,29 @@
static const AF_Script_UniRangeRec af_cjk_uniranges[] =
{
#if 0
- { 0x0100, 0xFFFF }, /* why this? */
+ { 0x0100UL, 0xFFFFUL }, /* why this? */
#endif
- { 0x2E80, 0x2EFF }, /* CJK Radicals Supplement */
- { 0x2F00, 0x2FDF }, /* Kangxi Radicals */
- { 0x3000, 0x303F }, /* CJK Symbols and Punctuation */
- { 0x3040, 0x309F }, /* Hiragana */
- { 0x30A0, 0x30FF }, /* Katakana */
- { 0x3100, 0x312F }, /* Bopomofo */
- { 0x3130, 0x318F }, /* Hangul Compatibility Jamo */
- { 0x31A0, 0x31BF }, /* Bopomofo Extended */
- { 0x31C0, 0x31EF }, /* CJK Strokes */
- { 0x31F0, 0x31FF }, /* Katakana Phonetic Extensions */
- { 0x3200, 0x32FF }, /* Enclosed CJK Letters and Months */
- { 0x3300, 0x33FF }, /* CJK Compatibility */
- { 0x3400, 0x4DBF }, /* CJK Unified Ideographs Extension A */
- { 0x4DC0, 0x4DFF }, /* Yijing Hexagram Symbols */
- { 0x4E00, 0x9FFF }, /* CJK Unified Ideographs */
- { 0xF900, 0xFAFF }, /* CJK Compatibility Ideographs */
- { 0xFE30, 0xFE4F }, /* CJK Compatibility Forms */
- { 0xFF00, 0xFFEF }, /* Halfwidth and Fullwidth Forms */
- { 0x20000, 0x2A6DF }, /* CJK Unified Ideographs Extension B */
- { 0x2F800, 0x2FA1F }, /* CJK Compatibility Ideographs Supplement */
- { 0, 0 }
+ { 0x2E80UL, 0x2EFFUL }, /* CJK Radicals Supplement */
+ { 0x2F00UL, 0x2FDFUL }, /* Kangxi Radicals */
+ { 0x3000UL, 0x303FUL }, /* CJK Symbols and Punctuation */
+ { 0x3040UL, 0x309FUL }, /* Hiragana */
+ { 0x30A0UL, 0x30FFUL }, /* Katakana */
+ { 0x3100UL, 0x312FUL }, /* Bopomofo */
+ { 0x3130UL, 0x318FUL }, /* Hangul Compatibility Jamo */
+ { 0x31A0UL, 0x31BFUL }, /* Bopomofo Extended */
+ { 0x31C0UL, 0x31EFUL }, /* CJK Strokes */
+ { 0x31F0UL, 0x31FFUL }, /* Katakana Phonetic Extensions */
+ { 0x3200UL, 0x32FFUL }, /* Enclosed CJK Letters and Months */
+ { 0x3300UL, 0x33FFUL }, /* CJK Compatibility */
+ { 0x3400UL, 0x4DBFUL }, /* CJK Unified Ideographs Extension A */
+ { 0x4DC0UL, 0x4DFFUL }, /* Yijing Hexagram Symbols */
+ { 0x4E00UL, 0x9FFFUL }, /* CJK Unified Ideographs */
+ { 0xF900UL, 0xFAFFUL }, /* CJK Compatibility Ideographs */
+ { 0xFE30UL, 0xFE4FUL }, /* CJK Compatibility Forms */
+ { 0xFF00UL, 0xFFEFUL }, /* Halfwidth and Fullwidth Forms */
+ { 0x20000UL, 0x2A6DFUL }, /* CJK Unified Ideographs Extension B */
+ { 0x2F800UL, 0x2FA1FUL }, /* CJK Compatibility Ideographs Supplement */
+ { 0UL, 0UL }
};
diff --git a/src/autofit/afhints.c b/src/autofit/afhints.c
index 4828706..8ab1761 100644
--- a/src/autofit/afhints.c
+++ b/src/autofit/afhints.c
@@ -4,7 +4,7 @@
/* */
/* Auto-fitter hinting routines (body). */
/* */
-/* Copyright 2003, 2004, 2005, 2006, 2007 by */
+/* Copyright 2003, 2004, 2005, 2006, 2007, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -127,7 +127,7 @@
#ifdef AF_DEBUG
-#include <stdio.h>
+#include FT_CONFIG_STANDARD_LIBRARY_H
static const char*
af_dir_str( AF_Direction dir )
@@ -203,14 +203,14 @@
if ( flags & AF_EDGE_ROUND )
{
- memcpy( temp + pos, "round", 5 );
+ ft_memcpy( temp + pos, "round", 5 );
pos += 5;
}
if ( flags & AF_EDGE_SERIF )
{
if ( pos > 0 )
temp[pos++] = ' ';
- memcpy( temp + pos, "serif", 5 );
+ ft_memcpy( temp + pos, "serif", 5 );
pos += 5;
}
if ( pos == 0 )
diff --git a/src/autofit/aflatin.c b/src/autofit/aflatin.c
index b70da06..09f9a98 100644
--- a/src/autofit/aflatin.c
+++ b/src/autofit/aflatin.c
@@ -4,7 +4,7 @@
/* */
/* Auto-fitter hinting routines for latin script (body). */
/* */
-/* Copyright 2003, 2004, 2005, 2006, 2007 by */
+/* Copyright 2003, 2004, 2005, 2006, 2007, 2008 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -2124,27 +2124,33 @@
static const AF_Script_UniRangeRec af_latin_uniranges[] =
{
- { 0x0020, 0x007F }, /* Basic Latin (no control characters) */
- { 0x00A0, 0x00FF }, /* Latin-1 Supplement (no control characters) */
- { 0x0100, 0x017F }, /* Latin Extended-A */
- { 0x0180, 0x024F }, /* Latin Extended-B */
- { 0x0250, 0x02AF }, /* IPA Extensions */
- { 0x02B0, 0x02FF }, /* Spacing Modifier Letters */
- { 0x0300, 0x036F }, /* Combining Diacritical Marks */
- { 0x0370, 0x03FF }, /* Greek and Coptic */
- { 0x0400, 0x04FF }, /* Cyrillic */
- { 0x0500, 0x052F }, /* Cyrillic Supplement */
- { 0x1D00, 0x1D7F }, /* Phonetic Extensions */
- { 0x1D80, 0x1DBF }, /* Phonetic Extensions Supplement */
- { 0x1DC0, 0x1DFF }, /* Combining Diacritical Marks Supplement */
- { 0x1E00, 0x1EFF }, /* Latin Extended Additional */
- { 0x1F00, 0x1FFF }, /* Greek Extended */
- { 0x2000, 0x206F }, /* General Punctuation */
- { 0x2070, 0x209F }, /* Superscripts and Subscripts */
- { 0x20A0, 0x20CF }, /* Currency Symbols */
- { 0x2150, 0x218F }, /* Number Forms */
- { 0x2460, 0x24FF }, /* Enclosed Alphanumerics */
- { 0 , 0 }
+ { 0x0020 , 0x007F }, /* Basic Latin (no control chars) */
+ { 0x00A0 , 0x00FF }, /* Latin-1 Supplement (no control chars) */
+ { 0x0100 , 0x017F }, /* Latin Extended-A */
+ { 0x0180 , 0x024F }, /* Latin Extended-B */
+ { 0x0250 , 0x02AF }, /* IPA Extensions */
+ { 0x02B0 , 0x02FF }, /* Spacing Modifier Letters */
+ { 0x0300 , 0x036F }, /* Combining Diacritical Marks */
+ { 0x0370 , 0x03FF }, /* Greek and Coptic */
+ { 0x0400 , 0x04FF }, /* Cyrillic */
+ { 0x0500 , 0x052F }, /* Cyrillic Supplement */
+ { 0x1D00 , 0x1D7F }, /* Phonetic Extensions */
+ { 0x1D80 , 0x1DBF }, /* Phonetic Extensions Supplement */
+ { 0x1DC0 , 0x1DFF }, /* Combining Diacritical Marks Supplement */
+ { 0x1E00 , 0x1EFF }, /* Latin Extended Additional */
+ { 0x1F00 , 0x1FFF }, /* Greek Extended */
+ { 0x2000 , 0x206F }, /* General Punctuation */
+ { 0x2070 , 0x209F }, /* Superscripts and Subscripts */
+ { 0x20A0 , 0x20CF }, /* Currency Symbols */
+ { 0x2150 , 0x218F }, /* Number Forms */
+ { 0x2460 , 0x24FF }, /* Enclosed Alphanumerics */
+ { 0x2C60 , 0x2C7F }, /* Latin Extended-C */
+ { 0x2DE0 , 0x2DFF }, /* Cyrillic Extended-A */
+ { 0xA640U , 0xA69FU }, /* Cyrillic Extended-B */
+ { 0xA720U , 0xA7FFU }, /* Latin Extended-D */
+ { 0xFB00U , 0xFB06U }, /* Alphab. Present. Forms (Latin Ligs) */
+ { 0x1D400UL, 0x1D7FFUL }, /* Mathematical Alphanumeric Symbols */
+ { 0 , 0 }
};
diff --git a/src/autofit/aflatin2.c b/src/autofit/aflatin2.c
index 0b41774..14327b1 100644
--- a/src/autofit/aflatin2.c
+++ b/src/autofit/aflatin2.c
@@ -4,7 +4,7 @@
/* */
/* Auto-fitter hinting routines for latin script (body). */
/* */
-/* Copyright 2003, 2004, 2005, 2006, 2007 by */
+/* Copyright 2003, 2004, 2005, 2006, 2007, 2008 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -944,6 +944,9 @@
}
}
}
+#if 0
+ }
+#endif
/* now, compute the `serif' segments */
for ( seg1 = segments; seg1 < segment_limit; seg1++ )
@@ -2150,7 +2153,10 @@
if ( before >= edges && before < edge &&
after < edge_limit && after > edge )
{
- edge->pos = before->pos +
+ if ( after->opos == before->opos )
+ edge->pos = before->pos;
+ else
+ edge->pos = before->pos +
FT_MulDiv( edge->opos - before->opos,
after->pos - before->pos,
after->opos - before->opos );
diff --git a/src/autofit/aftypes.h b/src/autofit/aftypes.h
index 56811f0..626a388 100644
--- a/src/autofit/aftypes.h
+++ b/src/autofit/aftypes.h
@@ -4,7 +4,7 @@
/* */
/* Auto-fitter types (specification only). */
/* */
-/* Copyright 2003, 2004, 2005, 2006, 2007, 2008 by */
+/* Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -58,7 +58,8 @@ FT_BEGIN_HEADER
#ifdef AF_DEBUG
-#include <stdio.h>
+#include FT_CONFIG_STANDARD_LIBRARY_H
+
#define AF_LOG( x ) do { if ( _af_debug ) printf x; } while ( 0 )
extern int _af_debug;
@@ -69,7 +70,7 @@ extern void* _af_debug_hints;
#else /* !AF_DEBUG */
-#define AF_LOG( x ) do ; while ( 0 ) /* nothing */
+#define AF_LOG( x ) do { } while ( 0 ) /* nothing */
#endif /* !AF_DEBUG */
diff --git a/src/base/ftadvanc.c b/src/base/ftadvanc.c
index 626a0cf..504f9d2 100644
--- a/src/base/ftadvanc.c
+++ b/src/base/ftadvanc.c
@@ -1,71 +1,97 @@
+/***************************************************************************/
+/* */
+/* ftadvanc.c */
+/* */
+/* Quick computation of advance widths (body). */
+/* */
+/* Copyright 2008, 2009 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 <ft2build.h>
#include FT_ADVANCES_H
#include FT_INTERNAL_OBJECTS_H
+
static FT_Error
_ft_face_scale_advances( FT_Face face,
FT_Fixed* advances,
FT_UInt count,
- FT_UInt flags )
+ FT_Int32 flags )
{
FT_Fixed scale;
FT_UInt nn;
- if ( (flags & FT_LOAD_NO_SCALE) )
+
+ if ( flags & FT_LOAD_NO_SCALE )
return FT_Err_Ok;
if ( face->size == NULL )
return FT_Err_Invalid_Size_Handle;
- if ( !(flags & FT_LOAD_VERTICAL_LAYOUT) )
- scale = face->size->metrics.x_scale;
- else
+ if ( flags & FT_LOAD_VERTICAL_LAYOUT )
scale = face->size->metrics.y_scale;
+ else
+ scale = face->size->metrics.x_scale;
- /* this must be the same computation than to get linearHori/VertAdvance
- * (see FT_Load_Glyph() implementation in src/base/ftobjs.c */
- for (nn = 0; nn < count; nn++)
+ /* this must be the same scaling as to get linear{Hori,Vert}Advance */
+ /* (see `FT_Load_Glyph' implementation in src/base/ftobjs.c) */
+
+ for ( nn = 0; nn < count; nn++ )
advances[nn] = FT_MulDiv( advances[nn], scale, 64 );
- return 0;
+ return FT_Err_Ok;
}
-/* at the moment, we can perform fast advance retrieval only in
- the following cases:
+ /* at the moment, we can perform fast advance retrieval only in */
+ /* the following cases: */
+ /* */
+ /* - unscaled load */
+ /* - unhinted load */
+ /* - light-hinted load */
+
+#define LOAD_ADVANCE_FAST_CHECK( flags ) \
+ ( flags & ( FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING ) || \
+ FT_LOAD_TARGET_MODE( flags ) == FT_RENDER_MODE_LIGHT )
- - unscaled load
- - unhinted load
- - light-hinted load
- */
-#define LOAD_ADVANCE_FAST_CHECK(flags) \
- (((flags & (FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING)) != 0) || \
- FT_LOAD_TARGET_MODE(flags) == FT_RENDER_MODE_LIGHT)
- FT_EXPORT_DEF(FT_Error)
+ /* documentation is in ftadvanc.h */
+
+ FT_EXPORT_DEF( FT_Error )
FT_Get_Advance( FT_Face face,
FT_UInt gindex,
- FT_UInt flags,
+ FT_Int32 flags,
FT_Fixed *padvance )
{
FT_Face_GetAdvancesFunc func;
+
if ( !face )
return FT_Err_Invalid_Face_Handle;
- if (gindex >= (FT_UInt) face->num_glyphs )
+ if ( gindex >= (FT_UInt)face->num_glyphs )
return FT_Err_Invalid_Glyph_Index;
func = face->driver->clazz->get_advances;
- if (func != NULL && LOAD_ADVANCE_FAST_CHECK(flags))
+ if ( func && LOAD_ADVANCE_FAST_CHECK( flags ) )
{
FT_Error error;
+
error = func( face, gindex, 1, flags, padvance );
- if (!error)
+ if ( !error )
return _ft_face_scale_advances( face, padvance, 1, flags );
- if (error != FT_Err_Unimplemented_Feature)
+ if ( error != FT_ERROR_BASE( FT_Err_Unimplemented_Feature ) )
return error;
}
@@ -73,55 +99,65 @@
}
- FT_EXPORT_DEF(FT_Error)
+ /* documentation is in ftadvanc.h */
+
+ FT_EXPORT_DEF( FT_Error )
FT_Get_Advances( FT_Face face,
FT_UInt start,
FT_UInt count,
- FT_UInt flags,
+ FT_Int32 flags,
FT_Fixed *padvances )
{
FT_Face_GetAdvancesFunc func;
FT_UInt num, end, nn;
- FT_Error error = 0;
+ FT_Error error = FT_Err_Ok;
+
if ( !face )
return FT_Err_Invalid_Face_Handle;
- num = (FT_UInt) face->num_glyphs;
+ num = (FT_UInt)face->num_glyphs;
end = start + count;
- if (start >= num || end < start || end > num)
+ if ( start >= num || end < start || end > num )
return FT_Err_Invalid_Glyph_Index;
- if (count == 0)
- return FT_Err_Ok;
+ if ( count == 0 )
+ return FT_Err_Ok;
func = face->driver->clazz->get_advances;
- if (func != NULL && LOAD_ADVANCE_FAST_CHECK(flags))
+ if ( func && LOAD_ADVANCE_FAST_CHECK( flags ) )
{
error = func( face, start, count, flags, padvances );
- if (!error) goto Exit;
+ if ( !error )
+ goto Exit;
- if (error != FT_Err_Unimplemented_Feature)
+ if ( error != FT_ERROR_BASE( FT_Err_Unimplemented_Feature ) )
return error;
}
- error = 0;
+ error = FT_Err_Ok;
- if ((flags & FT_ADVANCE_FLAG_FAST_ONLY) != 0)
+ if ( flags & FT_ADVANCE_FLAG_FAST_ONLY )
return FT_Err_Unimplemented_Feature;
flags |= FT_LOAD_ADVANCE_ONLY;
- for (nn = 0; nn < count; nn++)
+ for ( nn = 0; nn < count; nn++ )
{
- error = FT_Load_Glyph( face, start+nn, flags );
- if (error) break;
+ error = FT_Load_Glyph( face, start + nn, flags );
+ if ( error )
+ break;
- padvances[nn] = (flags & FT_LOAD_VERTICAL_LAYOUT)
- ? face->glyph->advance.x
- : face->glyph->advance.y;
+ padvances[nn] = ( flags & FT_LOAD_VERTICAL_LAYOUT )
+ ? face->glyph->advance.y
+ : face->glyph->advance.x;
}
- if (error) return error;
+
+ if ( error )
+ return error;
Exit:
return _ft_face_scale_advances( face, padvances, count, flags );
}
+
+
+/* END */
diff --git a/src/base/ftbase.c b/src/base/ftbase.c
index 300e02d..d1fe6e6 100644
--- a/src/base/ftbase.c
+++ b/src/base/ftbase.c
@@ -4,7 +4,7 @@
/* */
/* Single object library component (body only). */
/* */
-/* Copyright 1996-2001, 2002, 2003, 2004, 2006, 2007 by */
+/* Copyright 1996-2001, 2002, 2003, 2004, 2006, 2007, 2008 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -20,6 +20,7 @@
#define FT_MAKE_OPTION_SINGLE_OBJECT
+#include "ftadvanc.c"
#include "ftcalc.c"
#include "ftdbgmem.c"
#include "ftgloadr.c"
@@ -31,7 +32,7 @@
#include "fttrigon.c"
#include "ftutil.c"
-#if defined( __APPLE__ ) && !defined ( DARWIN_NO_CARBON )
+#if defined( FT_MACINTOSH ) && !defined ( DARWIN_NO_CARBON )
#include "ftmac.c"
#endif
diff --git a/src/base/ftbase.h b/src/base/ftbase.h
new file mode 100644
index 0000000..9cae85d
--- /dev/null
+++ b/src/base/ftbase.h
@@ -0,0 +1,57 @@
+/***************************************************************************/
+/* */
+/* ftbase.h */
+/* */
+/* The FreeType private functions used in base module (specification). */
+/* */
+/* Copyright 2008 by */
+/* David Turner, Robert Wilhelm, Werner Lemberg, and suzuki toshiya. */
+/* */
+/* 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 __FTBASE_H__
+#define __FTBASE_H__
+
+
+#include <ft2build.h>
+#include FT_INTERNAL_OBJECTS_H
+
+
+FT_BEGIN_HEADER
+
+
+ /* Assume the stream is sfnt-wrapped PS Type1 or sfnt-wrapped CID-keyed */
+ /* font, and try to load a face specified by the face_index. */
+ FT_LOCAL_DEF( FT_Error )
+ open_face_PS_from_sfnt_stream( FT_Library library,
+ FT_Stream stream,
+ FT_Long face_index,
+ FT_Int num_params,
+ FT_Parameter *params,
+ FT_Face *aface );
+
+
+ /* Create a new FT_Face given a buffer and a driver name. */
+ /* From ftmac.c. */
+ FT_LOCAL_DEF( FT_Error )
+ open_face_from_buffer( FT_Library library,
+ FT_Byte* base,
+ FT_ULong size,
+ FT_Long face_index,
+ const char* driver_name,
+ FT_Face *aface );
+
+
+FT_END_HEADER
+
+#endif /* __FTBASE_H__ */
+
+
+/* END */
diff --git a/src/base/ftbitmap.c b/src/base/ftbitmap.c
index 4c1cdf2..8810cfa 100644
--- a/src/base/ftbitmap.c
+++ b/src/base/ftbitmap.c
@@ -2,10 +2,9 @@
/* */
/* ftbitmap.c */
/* */
-/* FreeType utility functions for converting 1bpp, 2bpp, 4bpp, and 8bpp */
-/* bitmaps into 8bpp format (body). */
+/* FreeType utility functions for bitmaps (body). */
/* */
-/* Copyright 2004, 2005, 2006, 2007 by */
+/* Copyright 2004, 2005, 2006, 2007, 2008, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -19,6 +18,7 @@
#include <ft2build.h>
#include FT_BITMAP_H
+#include FT_IMAGE_H
#include FT_INTERNAL_OBJECTS_H
@@ -388,6 +388,8 @@
case FT_PIXEL_MODE_GRAY:
case FT_PIXEL_MODE_GRAY2:
case FT_PIXEL_MODE_GRAY4:
+ case FT_PIXEL_MODE_LCD:
+ case FT_PIXEL_MODE_LCD_V:
{
FT_Int pad;
FT_Long old_size;
@@ -482,6 +484,8 @@
case FT_PIXEL_MODE_GRAY:
+ case FT_PIXEL_MODE_LCD:
+ case FT_PIXEL_MODE_LCD_V:
{
FT_Int width = source->width;
FT_Byte* s = source->buffer;
@@ -606,6 +610,31 @@
/* documentation is in ftbitmap.h */
FT_EXPORT_DEF( FT_Error )
+ FT_GlyphSlot_Own_Bitmap( FT_GlyphSlot slot )
+ {
+ if ( slot && slot->format == FT_GLYPH_FORMAT_BITMAP &&
+ !( slot->internal->flags & FT_GLYPH_OWN_BITMAP ) )
+ {
+ FT_Bitmap bitmap;
+ FT_Error error;
+
+
+ FT_Bitmap_New( &bitmap );
+ error = FT_Bitmap_Copy( slot->library, &slot->bitmap, &bitmap );
+ if ( error )
+ return error;
+
+ slot->bitmap = bitmap;
+ slot->internal->flags |= FT_GLYPH_OWN_BITMAP;
+ }
+
+ return FT_Err_Ok;
+ }
+
+
+ /* documentation is in ftbitmap.h */
+
+ FT_EXPORT_DEF( FT_Error )
FT_Bitmap_Done( FT_Library library,
FT_Bitmap *bitmap )
{
diff --git a/src/base/ftcalc.c b/src/base/ftcalc.c
index 9193c32..04295a6 100644
--- a/src/base/ftcalc.c
+++ b/src/base/ftcalc.c
@@ -33,12 +33,13 @@
#include <ft2build.h>
+#include FT_GLYPH_H
#include FT_INTERNAL_CALC_H
#include FT_INTERNAL_DEBUG_H
#include FT_INTERNAL_OBJECTS_H
-#ifdef FT_MULFIX_INLINED
-#undef FT_MulFix
+#ifdef FT_MULFIX_INLINED
+#undef FT_MulFix
#endif
/* we need to define a 64-bits data type here */
@@ -196,18 +197,32 @@
FT_Long b )
{
#ifdef FT_MULFIX_ASSEMBLER
- return FT_MULFIX_ASSEMBLER(a,b);
+
+ return FT_MULFIX_ASSEMBLER( a, b );
+
#else
+
FT_Int s = 1;
FT_Long c;
- if ( a < 0 ) { a = -a; s = -1; }
- if ( b < 0 ) { b = -b; s = -s; }
+ if ( a < 0 )
+ {
+ a = -a;
+ s = -1;
+ }
+
+ if ( b < 0 )
+ {
+ b = -b;
+ s = -s;
+ }
c = (FT_Long)( ( (FT_Int64)a * b + 0x8000L ) >> 16 );
- return ( s > 0 ) ? c : -c ;
-#endif
+
+ return ( s > 0 ) ? c : -c;
+
+#endif /* FT_MULFIX_ASSEMBLER */
}
@@ -420,8 +435,18 @@
FT_Long b )
{
#ifdef FT_MULFIX_ASSEMBLER
- return FT_MULFIX_ASSEMBLER(a,b);
-#else
+
+ return FT_MULFIX_ASSEMBLER( a, b );
+
+#elif 0
+
+ /*
+ * This code is nonportable. See comment below.
+ *
+ * However, on a platform where right-shift of a signed quantity fills
+ * the leftmost bits by copying the sign bit, it might be faster.
+ */
+
FT_Long sa, sb;
FT_ULong ua, ub;
@@ -429,6 +454,24 @@
if ( a == 0 || b == 0x10000L )
return a;
+ /*
+ * This is a clever way of converting a signed number `a' into its
+ * absolute value (stored back into `a') and its sign. The sign is
+ * stored in `sa'; 0 means `a' was positive or zero, and -1 means `a'
+ * was negative. (Similarly for `b' and `sb').
+ *
+ * Unfortunately, it doesn't work (at least not portably).
+ *
+ * It makes the assumption that right-shift on a negative signed value
+ * fills the leftmost bits by copying the sign bit. This is wrong.
+ * According to K&R 2nd ed, section `A7.8 Shift Operators' on page 206,
+ * the result of right-shift of a negative signed value is
+ * implementation-defined. At least one implementation fills the
+ * leftmost bits with 0s (i.e., it is exactly the same as an unsigned
+ * right shift). This means that when `a' is negative, `sa' ends up
+ * with the value 1 rather than -1. After that, everything else goes
+ * wrong.
+ */
sa = ( a >> ( sizeof ( a ) * 8 - 1 ) );
a = ( a ^ sa ) - sa;
sb = ( b >> ( sizeof ( b ) * 8 - 1 ) );
@@ -452,7 +495,37 @@
ua = (FT_ULong)(( ua ^ sa ) - sa);
return (FT_Long)ua;
-#endif
+
+#else /* 0 */
+
+ FT_Long s;
+ FT_ULong ua, ub;
+
+
+ if ( a == 0 || b == 0x10000L )
+ return a;
+
+ s = a; a = FT_ABS( a );
+ s ^= b; b = FT_ABS( b );
+
+ ua = (FT_ULong)a;
+ ub = (FT_ULong)b;
+
+ if ( ua <= 2048 && ub <= 1048576L )
+ ua = ( ua * ub + 0x8000UL ) >> 16;
+ else
+ {
+ FT_ULong al = ua & 0xFFFFUL;
+
+
+ ua = ( ua >> 16 ) * ub + al * ( ub >> 16 ) +
+ ( ( al * ( ub & 0xFFFFUL ) + 0x8000UL ) >> 16 );
+ }
+
+ return ( s < 0 ? -(FT_Long)ua : (FT_Long)ua );
+
+#endif /* 0 */
+
}
@@ -466,8 +539,8 @@
FT_UInt32 q;
- s = a; a = FT_ABS(a);
- s ^= b; b = FT_ABS(b);
+ s = a; a = FT_ABS( a );
+ s ^= b; b = FT_ABS( b );
if ( b == 0 )
{
@@ -618,6 +691,61 @@
#endif /* FT_LONG64 */
+
+
+ /* documentation is in ftglyph.h */
+
+ FT_EXPORT_DEF( void )
+ FT_Matrix_Multiply( const FT_Matrix* a,
+ FT_Matrix *b )
+ {
+ FT_Fixed xx, xy, yx, yy;
+
+
+ if ( !a || !b )
+ return;
+
+ xx = FT_MulFix( a->xx, b->xx ) + FT_MulFix( a->xy, b->yx );
+ xy = FT_MulFix( a->xx, b->xy ) + FT_MulFix( a->xy, b->yy );
+ yx = FT_MulFix( a->yx, b->xx ) + FT_MulFix( a->yy, b->yx );
+ yy = FT_MulFix( a->yx, b->xy ) + FT_MulFix( a->yy, b->yy );
+
+ b->xx = xx; b->xy = xy;
+ b->yx = yx; b->yy = yy;
+ }
+
+
+ /* documentation is in ftglyph.h */
+
+ FT_EXPORT_DEF( FT_Error )
+ FT_Matrix_Invert( FT_Matrix* matrix )
+ {
+ FT_Pos delta, xx, yy;
+
+
+ if ( !matrix )
+ return FT_Err_Invalid_Argument;
+
+ /* compute discriminant */
+ delta = FT_MulFix( matrix->xx, matrix->yy ) -
+ FT_MulFix( matrix->xy, matrix->yx );
+
+ if ( !delta )
+ return FT_Err_Invalid_Argument; /* matrix can't be inverted */
+
+ matrix->xy = - FT_DivFix( matrix->xy, delta );
+ matrix->yx = - FT_DivFix( matrix->yx, delta );
+
+ xx = matrix->xx;
+ yy = matrix->yy;
+
+ matrix->xx = FT_DivFix( yy, delta );
+ matrix->yy = FT_DivFix( xx, delta );
+
+ return FT_Err_Ok;
+ }
+
+
/* documentation is in ftcalc.h */
FT_BASE_DEF( void )
diff --git a/src/base/ftdbgmem.c b/src/base/ftdbgmem.c
index 52a5c20..8b2a330 100644
--- a/src/base/ftdbgmem.c
+++ b/src/base/ftdbgmem.c
@@ -4,7 +4,7 @@
/* */
/* Memory debugger (body). */
/* */
-/* Copyright 2001, 2002, 2003, 2004, 2005, 2006 by */
+/* Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -33,8 +33,7 @@
* memory, however.
*/
-#include <stdio.h>
-#include <stdlib.h>
+#include FT_CONFIG_STANDARD_LIBRARY_H
FT_BASE_DEF( const char* ) _ft_debug_file = 0;
FT_BASE_DEF( long ) _ft_debug_lineno = 0;
@@ -990,7 +989,7 @@
#else /* !FT_DEBUG_MEMORY */
/* ANSI C doesn't like empty source files */
- const FT_Byte _debug_mem_dummy = 0;
+ static const FT_Byte _debug_mem_dummy = 0;
#endif /* !FT_DEBUG_MEMORY */
diff --git a/src/base/ftdebug.c b/src/base/ftdebug.c
index 356c8c2..2adbeab 100644
--- a/src/base/ftdebug.c
+++ b/src/base/ftdebug.c
@@ -46,7 +46,7 @@
#include FT_INTERNAL_DEBUG_H
-#if defined( FT_DEBUG_LEVEL_ERROR )
+#ifdef FT_DEBUG_LEVEL_ERROR
/* documentation is in ftdebug.h */
diff --git a/src/base/ftglyph.c b/src/base/ftglyph.c
index db0e79f..4130cb1 100644
--- a/src/base/ftglyph.c
+++ b/src/base/ftglyph.c
@@ -4,7 +4,7 @@
/* */
/* FreeType convenience functions to handle glyphs (body). */
/* */
-/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2007 by */
+/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2007, 2008 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -48,68 +48,6 @@
/*************************************************************************/
/*************************************************************************/
/**** ****/
- /**** Convenience functions ****/
- /**** ****/
- /*************************************************************************/
- /*************************************************************************/
-
-
- /* documentation is in ftglyph.h */
-
- FT_EXPORT_DEF( void )
- FT_Matrix_Multiply( const FT_Matrix* a,
- FT_Matrix *b )
- {
- FT_Fixed xx, xy, yx, yy;
-
-
- if ( !a || !b )
- return;
-
- xx = FT_MulFix( a->xx, b->xx ) + FT_MulFix( a->xy, b->yx );
- xy = FT_MulFix( a->xx, b->xy ) + FT_MulFix( a->xy, b->yy );
- yx = FT_MulFix( a->yx, b->xx ) + FT_MulFix( a->yy, b->yx );
- yy = FT_MulFix( a->yx, b->xy ) + FT_MulFix( a->yy, b->yy );
-
- b->xx = xx; b->xy = xy;
- b->yx = yx; b->yy = yy;
- }
-
-
- /* documentation is in ftglyph.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Matrix_Invert( FT_Matrix* matrix )
- {
- FT_Pos delta, xx, yy;
-
-
- if ( !matrix )
- return FT_Err_Invalid_Argument;
-
- /* compute discriminant */
- delta = FT_MulFix( matrix->xx, matrix->yy ) -
- FT_MulFix( matrix->xy, matrix->yx );
-
- if ( !delta )
- return FT_Err_Invalid_Argument; /* matrix can't be inverted */
-
- matrix->xy = - FT_DivFix( matrix->xy, delta );
- matrix->yx = - FT_DivFix( matrix->yx, delta );
-
- xx = matrix->xx;
- yy = matrix->yy;
-
- matrix->xx = FT_DivFix( yy, delta );
- matrix->yy = FT_DivFix( xx, delta );
-
- return FT_Err_Ok;
- }
-
-
- /*************************************************************************/
- /*************************************************************************/
- /**** ****/
/**** FT_BitmapGlyph support ****/
/**** ****/
/*************************************************************************/
diff --git a/src/base/ftinit.c b/src/base/ftinit.c
index 7af19c3..dac30b0 100644
--- a/src/base/ftinit.c
+++ b/src/base/ftinit.c
@@ -55,9 +55,9 @@
#undef FT_USE_MODULE
#ifdef __cplusplus
-#define FT_USE_MODULE( x ) extern "C" const FT_Module_Class x;
+#define FT_USE_MODULE( type, x ) extern "C" const type x;
#else
-#define FT_USE_MODULE( x ) extern const FT_Module_Class x;
+#define FT_USE_MODULE( type, x ) extern const type x;
#endif
@@ -65,7 +65,7 @@
#undef FT_USE_MODULE
-#define FT_USE_MODULE( x ) (const FT_Module_Class*)&(x),
+#define FT_USE_MODULE( type, x ) (const FT_Module_Class*)&(x),
static
const FT_Module_Class* const ft_default_modules[] =
diff --git a/src/base/ftlcdfil.c b/src/base/ftlcdfil.c
index 5f1fa0b..8064011 100644
--- a/src/base/ftlcdfil.c
+++ b/src/base/ftlcdfil.c
@@ -4,7 +4,7 @@
/* */
/* FreeType API for color filtering of subpixel bitmap glyphs (body). */
/* */
-/* Copyright 2006, 2008 by */
+/* Copyright 2006, 2008, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -266,7 +266,7 @@
#endif /* USE_LEGACY */
- FT_EXPORT( FT_Error )
+ FT_EXPORT_DEF( FT_Error )
FT_Library_SetLcdFilter( FT_Library library,
FT_LcdFilter filter )
{
@@ -296,13 +296,13 @@
#elif defined( FT_FORCE_LIGHT_LCD_FILTER )
- memcpy( library->lcd_weights, light_filter, 5 );
+ ft_memcpy( library->lcd_weights, light_filter, 5 );
library->lcd_filter_func = _ft_lcd_filter_fir;
library->lcd_extra = 2;
#else
- memcpy( library->lcd_weights, default_filter, 5 );
+ ft_memcpy( library->lcd_weights, default_filter, 5 );
library->lcd_filter_func = _ft_lcd_filter_fir;
library->lcd_extra = 2;
@@ -311,7 +311,7 @@
break;
case FT_LCD_FILTER_LIGHT:
- memcpy( library->lcd_weights, light_filter, 5 );
+ ft_memcpy( library->lcd_weights, light_filter, 5 );
library->lcd_filter_func = _ft_lcd_filter_fir;
library->lcd_extra = 2;
break;
@@ -335,7 +335,7 @@
#else /* !FT_CONFIG_OPTION_SUBPIXEL_RENDERING */
- FT_EXPORT( FT_Error )
+ FT_EXPORT_DEF( FT_Error )
FT_Library_SetLcdFilter( FT_Library library,
FT_LcdFilter filter )
{
diff --git a/src/base/ftmm.c b/src/base/ftmm.c
index 586d5e8..0307729 100644
--- a/src/base/ftmm.c
+++ b/src/base/ftmm.c
@@ -4,7 +4,7 @@
/* */
/* Multiple Master font support (body). */
/* */
-/* Copyright 1996-2001, 2003, 2004 by */
+/* Copyright 1996-2001, 2003, 2004, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -52,7 +52,7 @@
*aservice,
MULTI_MASTERS );
- if ( aservice )
+ if ( *aservice )
error = FT_Err_Ok;
}
diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
index f167b2f..72dea33 100644
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -4,7 +4,7 @@
/* */
/* The FreeType private base classes (body). */
/* */
-/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by */
+/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -26,6 +26,7 @@
#include FT_INTERNAL_STREAM_H
#include FT_INTERNAL_SFNT_H /* for SFNT_Load_Table_Func */
#include FT_TRUETYPE_TABLES_H
+#include FT_TRUETYPE_TAGS_H
#include FT_TRUETYPE_IDS_H
#include FT_OUTLINE_H
@@ -36,13 +37,11 @@
#include FT_SERVICE_KERNING_H
#include FT_SERVICE_TRUETYPE_ENGINE_H
-#ifdef ANDROID_FONT_HACK
-#include <unistd.h>
-#include <fcntl.h>
-#endif
+#include "ftbase.h"
#define GRID_FIT_METRICS
+
FT_BASE_DEF( FT_Pointer )
ft_service_list_lookup( FT_ServiceDesc service_descriptors,
const char* service_id )
@@ -133,13 +132,14 @@
FT_Stream stream;
+ *astream = 0;
+
if ( !library )
return FT_Err_Invalid_Library_Handle;
if ( !args )
return FT_Err_Invalid_Argument;
- *astream = 0;
memory = library->memory;
if ( FT_NEW( stream ) )
@@ -201,6 +201,12 @@
}
+ /*************************************************************************/
+ /* */
+ /* 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_objs
@@ -249,7 +255,7 @@
FT_BASE_DEF( void )
ft_glyphslot_free_bitmap( FT_GlyphSlot slot )
{
- if ( slot->internal->flags & FT_GLYPH_OWN_BITMAP )
+ if ( slot->internal && ( slot->internal->flags & FT_GLYPH_OWN_BITMAP ) )
{
FT_Memory memory = FT_FACE_MEMORY( slot->face );
@@ -547,7 +553,7 @@
FT_Driver driver;
FT_GlyphSlot slot;
FT_Library library;
- FT_Bool autohint = 0;
+ FT_Bool autohint = FALSE;
FT_Module hinter;
@@ -577,38 +583,6 @@
load_flags &= ~FT_LOAD_RENDER;
}
-#ifdef ANDROID_FONT_HACK
- else
- {
- static int hack_mode;
-
- if (hack_mode == 0) {
- do {
- int fd = open("/data/misc/font-hack", O_RDONLY);
- char buff[2];
- int ret;
-
- hack_mode = 1; /*means light node by default */
- if (fd < 0)
- break;
-
- ret = read(fd, buff, 1);
- if (ret == 1)
- hack_mode = 1 + (buff[0] - '0');
-
- close(fd);
- } while (0);
- }
-
- switch (hack_mode)
- {
- case 1:
- load_flags &= 0xfff0ffff;
- load_flags |= FT_LOAD_TARGET_LIGHT;
- break;
- }
- }
-#endif
/*
* Determine whether we need to auto-hint or not.
@@ -623,22 +597,22 @@
*
* - Otherwise, auto-hint for LIGHT hinting mode.
*
- * - Exception: The font requires the unpatented
- * bytecode interpreter to load properly.
+ * - Exception: The font is `tricky' and requires
+ * the native hinter to load properly.
*/
- autohint = 0;
- if ( hinter &&
- ( load_flags & FT_LOAD_NO_HINTING ) == 0 &&
- ( load_flags & FT_LOAD_NO_AUTOHINT ) == 0 &&
- FT_DRIVER_IS_SCALABLE( driver ) &&
- FT_DRIVER_USES_OUTLINES( driver ) &&
- face->internal->transform_matrix.yy > 0 &&
- face->internal->transform_matrix.yx == 0 )
+ if ( hinter &&
+ !( load_flags & FT_LOAD_NO_HINTING ) &&
+ !( load_flags & FT_LOAD_NO_AUTOHINT ) &&
+ FT_DRIVER_IS_SCALABLE( driver ) &&
+ FT_DRIVER_USES_OUTLINES( driver ) &&
+ !FT_IS_TRICKY( face ) &&
+ face->internal->transform_matrix.yy > 0 &&
+ face->internal->transform_matrix.yx == 0 )
{
- if ( ( load_flags & FT_LOAD_FORCE_AUTOHINT ) != 0 ||
- !FT_DRIVER_HAS_HINTER( driver ) )
- autohint = 1;
+ if ( ( load_flags & FT_LOAD_FORCE_AUTOHINT ) ||
+ !FT_DRIVER_HAS_HINTER( driver ) )
+ autohint = TRUE;
else
{
FT_Render_Mode mode = FT_LOAD_TARGET_MODE( load_flags );
@@ -646,7 +620,7 @@
if ( mode == FT_RENDER_MODE_LIGHT ||
face->internal->ignore_unpatented_hinter )
- autohint = 1;
+ autohint = TRUE;
}
}
@@ -729,7 +703,7 @@
/* compute the linear advance in 16.16 pixels */
if ( ( load_flags & FT_LOAD_LINEAR_DESIGN ) == 0 &&
- ( face->face_flags & FT_FACE_FLAG_SCALABLE ) )
+ ( FT_IS_SCALABLE( face ) ) )
{
FT_Size_Metrics* metrics = &face->size->metrics;
@@ -1147,7 +1121,7 @@
/* there's a Mac-specific extended implementation of FT_New_Face() */
/* in src/base/ftmac.c */
-#ifndef FT_MACINTOSH
+#if !defined( FT_MACINTOSH ) || defined( DARWIN_NO_CARBON )
/* documentation is in freetype.h */
@@ -1166,11 +1140,12 @@
args.flags = FT_OPEN_PATHNAME;
args.pathname = (char*)pathname;
+ args.stream = NULL;
return FT_Open_Face( library, &args, face_index, aface );
}
-#endif /* !FT_MACINTOSH */
+#endif /* defined( FT_MACINTOSH ) && !defined( DARWIN_NO_CARBON ) */
/* documentation is in freetype.h */
@@ -1192,12 +1167,13 @@
args.flags = FT_OPEN_MEMORY;
args.memory_base = file_base;
args.memory_size = file_size;
+ args.stream = NULL;
return FT_Open_Face( library, &args, face_index, aface );
}
-#if !defined( FT_MACINTOSH ) && defined( FT_CONFIG_OPTION_MAC_FONTS )
+#ifdef FT_CONFIG_OPTION_MAC_FONTS
/* The behavior here is very similar to that in base/ftmac.c, but it */
/* is designed to work on non-mac systems, so no mac specific calls. */
@@ -1226,9 +1202,9 @@
/* we don't really have access to it. */
- /* Finalizer for a memory stream; gets called by FT_Done_Face().
- It frees the memory it uses. */
- /* from ftmac.c */
+ /* Finalizer for a memory stream; gets called by FT_Done_Face(). */
+ /* It frees the memory it uses. */
+ /* From ftmac.c. */
static void
memory_stream_close( FT_Stream stream )
{
@@ -1244,7 +1220,7 @@
/* Create a new memory stream from a buffer and a size. */
- /* from ftmac.c */
+ /* From ftmac.c. */
static FT_Error
new_memory_stream( FT_Library library,
FT_Byte* base,
@@ -1281,7 +1257,7 @@
/* Create a new FT_Face given a buffer and a driver name. */
/* from ftmac.c */
- static FT_Error
+ FT_LOCAL_DEF( FT_Error )
open_face_from_buffer( FT_Library library,
FT_Byte* base,
FT_ULong size,
@@ -1314,20 +1290,172 @@
args.driver = FT_Get_Module( library, driver_name );
}
+#ifdef FT_MACINTOSH
+ /* At this point, face_index has served its purpose; */
+ /* whoever calls this function has already used it to */
+ /* locate the correct font data. We should not propagate */
+ /* this index to FT_Open_Face() (unless it is negative). */
+
+ if ( face_index > 0 )
+ face_index = 0;
+#endif
+
error = FT_Open_Face( library, &args, face_index, aface );
if ( error == FT_Err_Ok )
(*aface)->face_flags &= ~FT_FACE_FLAG_EXTERNAL_STREAM;
else
+#ifdef FT_MACINTOSH
+ FT_Stream_Free( stream, 0 );
+#else
{
FT_Stream_Close( stream );
FT_FREE( stream );
}
+#endif
return error;
}
+ /* Look up `TYP1' or `CID ' table from sfnt table directory. */
+ /* `offset' and `length' must exclude the binary header in tables. */
+
+ /* Type 1 and CID-keyed font drivers should recognize sfnt-wrapped */
+ /* format too. Here, since we can't expect that the TrueType font */
+ /* driver is loaded unconditially, we must parse the font by */
+ /* ourselves. We are only interested in the name of the table and */
+ /* the offset. */
+
+ static FT_Error
+ ft_lookup_PS_in_sfnt_stream( FT_Stream stream,
+ FT_Long face_index,
+ FT_ULong* offset,
+ FT_ULong* length,
+ FT_Bool* is_sfnt_cid )
+ {
+ FT_Error error;
+ FT_UShort numTables;
+ FT_Long pstable_index;
+ FT_ULong tag;
+ int i;
+
+
+ *offset = 0;
+ *length = 0;
+ *is_sfnt_cid = FALSE;
+
+ /* TODO: support for sfnt-wrapped PS/CID in TTC format */
+
+ /* version check for 'typ1' (should be ignored?) */
+ if ( FT_READ_ULONG( tag ) )
+ return error;
+ if ( tag != TTAG_typ1 )
+ return FT_Err_Unknown_File_Format;
+
+ if ( FT_READ_USHORT( numTables ) )
+ return error;
+ if ( FT_STREAM_SKIP( 2 * 3 ) ) /* skip binary search header */
+ return error;
+
+ pstable_index = -1;
+ *is_sfnt_cid = FALSE;
+
+ for ( i = 0; i < numTables; i++ )
+ {
+ if ( FT_READ_ULONG( tag ) || FT_STREAM_SKIP( 4 ) ||
+ FT_READ_ULONG( *offset ) || FT_READ_ULONG( *length ) )
+ return error;
+
+ if ( tag == TTAG_CID )
+ {
+ pstable_index++;
+ *offset += 22;
+ *length -= 22;
+ *is_sfnt_cid = TRUE;
+ if ( face_index < 0 )
+ return FT_Err_Ok;
+ }
+ else if ( tag == TTAG_TYP1 )
+ {
+ pstable_index++;
+ *offset += 24;
+ *length -= 24;
+ *is_sfnt_cid = FALSE;
+ if ( face_index < 0 )
+ return FT_Err_Ok;
+ }
+ if ( face_index >= 0 && pstable_index == face_index )
+ return FT_Err_Ok;
+ }
+ return FT_Err_Table_Missing;
+ }
+
+
+ FT_LOCAL_DEF( FT_Error )
+ open_face_PS_from_sfnt_stream( FT_Library library,
+ FT_Stream stream,
+ FT_Long face_index,
+ FT_Int num_params,
+ FT_Parameter *params,
+ FT_Face *aface )
+ {
+ FT_Error error;
+ FT_Memory memory = library->memory;
+ FT_ULong offset, length;
+ FT_Long pos;
+ FT_Bool is_sfnt_cid;
+ FT_Byte* sfnt_ps;
+
+ FT_UNUSED( num_params );
+ FT_UNUSED( params );
+
+
+ pos = FT_Stream_Pos( stream );
+
+ error = ft_lookup_PS_in_sfnt_stream( stream,
+ face_index,
+ &offset,
+ &length,
+ &is_sfnt_cid );
+ if ( error )
+ goto Exit;
+
+ if ( FT_Stream_Seek( stream, pos + offset ) )
+ goto Exit;
+
+ if ( FT_ALLOC( sfnt_ps, (FT_Long)length ) )
+ goto Exit;
+
+ error = FT_Stream_Read( stream, (FT_Byte *)sfnt_ps, length );
+ if ( error )
+ goto Exit;
+
+ error = open_face_from_buffer( library,
+ sfnt_ps,
+ length,
+ face_index < 0 ? face_index : 0,
+ is_sfnt_cid ? "cid" : "type1",
+ aface );
+ Exit:
+ {
+ FT_Error error1;
+
+
+ if ( error == FT_Err_Unknown_File_Format )
+ {
+ error1 = FT_Stream_Seek( stream, pos );
+ if ( error1 )
+ return error1;
+ }
+
+ return error;
+ }
+ }
+
+
+#if !defined( FT_MACINTOSH ) || defined( DARWIN_NO_CARBON )
+
/* The resource header says we've got resource_cnt `POST' (type1) */
/* resources in this file. They all need to be coalesced into */
/* one lump which gets passed on to the type1 driver. */
@@ -1482,17 +1610,25 @@
if ( rlen == -1 )
return FT_Err_Cannot_Open_Resource;
+ error = open_face_PS_from_sfnt_stream( library,
+ stream,
+ face_index,
+ 0, NULL,
+ aface );
+ if ( !error )
+ goto Exit;
+
+ /* rewind sfnt stream before open_face_PS_from_sfnt_stream() */
+ if ( FT_Stream_Seek( stream, flag_offset + 4 ) )
+ goto Exit;
+
if ( FT_ALLOC( sfnt_data, (FT_Long)rlen ) )
return error;
error = FT_Stream_Read( stream, (FT_Byte *)sfnt_data, rlen );
if ( error )
goto Exit;
- is_cff = rlen > 4 && sfnt_data[0] == 'O' &&
- sfnt_data[1] == 'T' &&
- sfnt_data[2] == 'T' &&
- sfnt_data[3] == 'O';
-
+ is_cff = rlen > 4 && !ft_memcmp( sfnt_data, "OTTO", 4 );
error = open_face_from_buffer( library,
sfnt_data,
rlen,
@@ -1531,7 +1667,7 @@
error = FT_Raccess_Get_DataOffsets( library, stream,
map_offset, rdara_pos,
- FT_MAKE_TAG( 'P', 'O', 'S', 'T' ),
+ TTAG_POST,
&data_offsets, &count );
if ( !error )
{
@@ -1546,7 +1682,7 @@
error = FT_Raccess_Get_DataOffsets( library, stream,
map_offset, rdara_pos,
- FT_MAKE_TAG( 's', 'f', 'n', 't' ),
+ TTAG_sfnt,
&data_offsets, &count );
if ( !error )
{
@@ -1637,7 +1773,7 @@
FT_Error errors[FT_RACCESS_N_RULES];
FT_Open_Args args2;
- FT_Stream stream2;
+ FT_Stream stream2 = 0;
FT_Raccess_Guess( library, stream,
@@ -1692,7 +1828,7 @@
}
- /* Check for some macintosh formats. */
+ /* Check for some macintosh formats without Carbon framework. */
/* Is this a macbinary file? If so look at the resource fork. */
/* Is this a mac dfont file? */
/* Is this an old style resource fork? (in data) */
@@ -1735,6 +1871,7 @@
face_index, aface, args );
return error;
}
+#endif
#endif /* !FT_MACINTOSH && FT_CONFIG_OPTION_MAC_FONTS */
@@ -1750,7 +1887,7 @@
FT_Error error;
FT_Driver driver;
FT_Memory memory;
- FT_Stream stream;
+ FT_Stream stream = 0;
FT_Face face = 0;
FT_ListNode node = 0;
FT_Bool external_stream;
@@ -1833,6 +1970,28 @@
if ( !error )
goto Success;
+#ifdef FT_CONFIG_OPTION_MAC_FONTS
+ if ( ft_strcmp( cur[0]->clazz->module_name, "truetype" ) == 0 &&
+ FT_ERROR_BASE( error ) == FT_Err_Table_Missing )
+ {
+ /* TrueType but essential tables are missing */
+ if ( FT_Stream_Seek( stream, 0 ) )
+ break;
+
+ error = open_face_PS_from_sfnt_stream( library,
+ stream,
+ face_index,
+ num_params,
+ params,
+ aface );
+ if ( !error )
+ {
+ FT_Stream_Free( stream, external_stream );
+ return error;
+ }
+ }
+#endif
+
if ( FT_ERROR_BASE( error ) != FT_Err_Unknown_File_Format )
goto Fail3;
}
@@ -2308,8 +2467,8 @@
}
else
{
- metrics->x_scale = 1L << 22;
- metrics->y_scale = 1L << 22;
+ metrics->x_scale = 1L << 16;
+ metrics->y_scale = 1L << 16;
metrics->ascender = bsize->y_ppem;
metrics->descender = 0;
metrics->height = bsize->height << 6;
@@ -2420,8 +2579,8 @@
else
{
FT_ZERO( metrics );
- metrics->x_scale = 1L << 22;
- metrics->y_scale = 1L << 22;
+ metrics->x_scale = 1L << 16;
+ metrics->y_scale = 1L << 16;
}
}
@@ -3302,11 +3461,11 @@
if ( size == NULL )
- return FT_Err_Bad_Argument;
+ return FT_Err_Invalid_Argument;
face = size->face;
if ( face == NULL || face->driver == NULL )
- return FT_Err_Bad_Argument;
+ return FT_Err_Invalid_Argument;
/* we don't need anything more complex than that; all size objects */
/* are already listed by the face */
@@ -4054,7 +4213,11 @@
faces = &FT_DRIVER(module)->faces_list;
while ( faces->head )
+ {
FT_Done_Face( FT_FACE( faces->head->data ) );
+ if ( faces->head )
+ FT_ERROR(( "FT_Done_Library: failed to free some faces\n" ));
+ }
}
}
diff --git a/src/base/ftoutln.c b/src/base/ftoutln.c
index 2bae857..49ef82e 100644
--- a/src/base/ftoutln.c
+++ b/src/base/ftoutln.c
@@ -4,7 +4,7 @@
/* */
/* FreeType outline management (body). */
/* */
-/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007 by */
+/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -26,6 +26,7 @@
#include <ft2build.h>
#include FT_OUTLINE_H
#include FT_INTERNAL_OBJECTS_H
+#include FT_INTERNAL_DEBUG_H
#include FT_TRIGONOMETRY_H
@@ -83,21 +84,25 @@
FT_Int last; /* index of last point in contour */
+ FT_TRACE5(( "FT_Outline_Decompose: Outline %d\n", n ));
+
last = outline->contours[n];
if ( last < 0 )
goto Invalid_Outline;
limit = outline->points + last;
- v_start = outline->points[first];
- v_last = outline->points[last];
+ v_start = outline->points[first];
+ v_start.x = SCALED( v_start.x );
+ v_start.y = SCALED( v_start.y );
- v_start.x = SCALED( v_start.x ); v_start.y = SCALED( v_start.y );
- v_last.x = SCALED( v_last.x ); v_last.y = SCALED( v_last.y );
+ v_last = outline->points[last];
+ v_last.x = SCALED( v_last.x );
+ v_last.y = SCALED( v_last.y );
v_control = v_start;
point = outline->points + first;
- tags = outline->tags + first;
+ tags = outline->tags + first;
tag = FT_CURVE_TAG( tags[0] );
/* A contour cannot start with a cubic control point! */
@@ -128,6 +133,8 @@
tags--;
}
+ FT_TRACE5(( " move to (%.2f, %.2f)\n",
+ v_start.x / 64.0, v_start.y / 64.0 ));
error = func_interface->move_to( &v_start, user );
if ( error )
goto Exit;
@@ -148,6 +155,8 @@
vec.x = SCALED( point->x );
vec.y = SCALED( point->y );
+ FT_TRACE5(( " line to (%.2f, %.2f)\n",
+ vec.x / 64.0, vec.y / 64.0 ));
error = func_interface->line_to( &vec, user );
if ( error )
goto Exit;
@@ -174,6 +183,10 @@
if ( tag == FT_CURVE_TAG_ON )
{
+ FT_TRACE5(( " conic to (%.2f, %.2f)"
+ " with control (%.2f, %.2f)\n",
+ vec.x / 64.0, vec.y / 64.0,
+ v_control.x / 64.0, v_control.y / 64.0 ));
error = func_interface->conic_to( &v_control, &vec, user );
if ( error )
goto Exit;
@@ -186,6 +199,10 @@
v_middle.x = ( v_control.x + vec.x ) / 2;
v_middle.y = ( v_control.y + vec.y ) / 2;
+ FT_TRACE5(( " conic to (%.2f, %.2f)"
+ " with control (%.2f, %.2f)\n",
+ v_middle.x / 64.0, v_middle.y / 64.0,
+ v_control.x / 64.0, v_control.y / 64.0 ));
error = func_interface->conic_to( &v_control, &v_middle, user );
if ( error )
goto Exit;
@@ -194,6 +211,10 @@
goto Do_Conic;
}
+ FT_TRACE5(( " conic to (%.2f, %.2f)"
+ " with control (%.2f, %.2f)\n",
+ v_start.x / 64.0, v_start.y / 64.0,
+ v_control.x / 64.0, v_control.y / 64.0 ));
error = func_interface->conic_to( &v_control, &v_start, user );
goto Close;
@@ -209,8 +230,11 @@
point += 2;
tags += 2;
- vec1.x = SCALED( point[-2].x ); vec1.y = SCALED( point[-2].y );
- vec2.x = SCALED( point[-1].x ); vec2.y = SCALED( point[-1].y );
+ vec1.x = SCALED( point[-2].x );
+ vec1.y = SCALED( point[-2].y );
+
+ vec2.x = SCALED( point[-1].x );
+ vec2.y = SCALED( point[-1].y );
if ( point <= limit )
{
@@ -220,12 +244,22 @@
vec.x = SCALED( point->x );
vec.y = SCALED( point->y );
+ FT_TRACE5(( " cubic to (%.2f, %.2f)"
+ " with controls (%.2f, %.2f) and (%.2f, %.2f)\n",
+ vec.x / 64.0, vec.y / 64.0,
+ vec1.x / 64.0, vec1.y / 64.0,
+ vec2.x / 64.0, vec2.y / 64.0 ));
error = func_interface->cubic_to( &vec1, &vec2, &vec, user );
if ( error )
goto Exit;
continue;
}
+ FT_TRACE5(( " cubic to (%.2f, %.2f)"
+ " with controls (%.2f, %.2f) and (%.2f, %.2f)\n",
+ v_start.x / 64.0, v_start.y / 64.0,
+ vec1.x / 64.0, vec1.y / 64.0,
+ vec2.x / 64.0, vec2.y / 64.0 ));
error = func_interface->cubic_to( &vec1, &vec2, &v_start, user );
goto Close;
}
@@ -233,6 +267,8 @@
}
/* close the contour with a line segment */
+ FT_TRACE5(( " line to (%.2f, %.2f)\n",
+ v_start.x / 64.0, v_start.y / 64.0 ));
error = func_interface->line_to( &v_start, user );
Close:
@@ -242,9 +278,11 @@
first = last + 1;
}
- return 0;
+ FT_TRACE5(( "FT_Outline_Decompose: Done\n", n ));
+ return FT_Err_Ok;
Exit:
+ FT_TRACE5(( "FT_Outline_Decompose: Error %d\n", error ));
return error;
Invalid_Outline:
@@ -558,7 +596,7 @@
FT_Raster_Params* params )
{
FT_Error error;
- FT_Bool update = 0;
+ FT_Bool update = FALSE;
FT_Renderer renderer;
FT_ListNode node;
@@ -589,7 +627,7 @@
/* format */
renderer = FT_Lookup_Renderer( library, FT_GLYPH_FORMAT_OUTLINE,
&node );
- update = 1;
+ update = TRUE;
}
/* if we changed the current renderer for the glyph image format */
@@ -1007,7 +1045,7 @@
}
}
- if ( xmin == 32768 )
+ if ( xmin == 32768L )
return FT_ORIENTATION_TRUETYPE;
ray_y[0] = ( xmin_ymin * 3 + xmin_ymax ) >> 2;
diff --git a/src/base/ftpatent.c b/src/base/ftpatent.c
index d63f191..9f129d8 100644
--- a/src/base/ftpatent.c
+++ b/src/base/ftpatent.c
@@ -5,7 +5,7 @@
/* FreeType API for checking patented TrueType bytecode instructions */
/* (body). */
/* */
-/* Copyright 2007 by David Turner. */
+/* Copyright 2007, 2008 by David Turner. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
@@ -260,7 +260,7 @@
FT_Face_SetUnpatentedHinting( FT_Face face,
FT_Bool value )
{
- FT_Bool result = 0;
+ FT_Bool result = FALSE;
#if defined( TT_CONFIG_OPTION_UNPATENTED_HINTING ) && \
diff --git a/src/base/ftrfork.c b/src/base/ftrfork.c
index 5a835ee..d59a076 100644
--- a/src/base/ftrfork.c
+++ b/src/base/ftrfork.c
@@ -4,7 +4,7 @@
/* */
/* Embedded resource forks accessor (body). */
/* */
-/* Copyright 2004, 2005, 2006, 2007 by */
+/* Copyright 2004, 2005, 2006, 2007, 2008, 2009 by */
/* Masatake YAMATO and Redhat K.K. */
/* */
/* FT_Raccess_Get_HeaderInfo() and raccess_guess_darwin_hfsplus() are */
@@ -399,7 +399,10 @@
char **result_file_name,
FT_Long *result_offset )
{
- FT_Int32 magic = ( 0x00 << 24 | 0x05 << 16 | 0x16 << 8 | 0x07 );
+ FT_Int32 magic = ( 0x00 << 24 ) |
+ ( 0x05 << 16 ) |
+ ( 0x16 << 8 ) |
+ 0x07;
*result_file_name = NULL;
@@ -418,7 +421,10 @@
char **result_file_name,
FT_Long *result_offset )
{
- FT_Int32 magic = (0x00 << 24 | 0x05 << 16 | 0x16 << 8 | 0x00);
+ FT_Int32 magic = ( 0x00 << 24 ) |
+ ( 0x05 << 16 ) |
+ ( 0x16 << 8 ) |
+ 0x00;
*result_file_name = NULL;
@@ -703,8 +709,12 @@
return FT_Err_Ok;
}
else
- FT_Stream_Skip( stream, 4 + 4 ); /* offset + length */
+ {
+ error = FT_Stream_Skip( stream, 4 + 4 ); /* offset + length */
+ if ( error )
+ return error;
}
+ }
return FT_Err_Unknown_File_Format;
}
diff --git a/src/base/ftstream.c b/src/base/ftstream.c
index 569e46c..cff67e0 100644
--- a/src/base/ftstream.c
+++ b/src/base/ftstream.c
@@ -707,12 +707,13 @@
{
FT_Error error;
FT_Bool frame_accessed = 0;
- FT_Byte* cursor = stream->cursor;
-
+ FT_Byte* cursor;
if ( !fields || !stream )
return FT_Err_Invalid_Argument;
+ cursor = stream->cursor;
+
error = FT_Err_Ok;
do
{
diff --git a/src/base/ftstroke.c b/src/base/ftstroke.c
index 5dfee8b..3f5421f 100644
--- a/src/base/ftstroke.c
+++ b/src/base/ftstroke.c
@@ -4,7 +4,7 @@
/* */
/* FreeType path stroker (body). */
/* */
-/* Copyright 2002, 2003, 2004, 2005, 2006, 2008 by */
+/* Copyright 2002, 2003, 2004, 2005, 2006, 2008, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -261,7 +261,7 @@
{
FT_UInt old_max = border->max_points;
FT_UInt new_max = border->num_points + new_points;
- FT_Error error = 0;
+ FT_Error error = FT_Err_Ok;
if ( new_max > old_max )
@@ -279,6 +279,7 @@
border->max_points = cur_max;
}
+
Exit:
return error;
}
@@ -346,7 +347,7 @@
}
border->start = -1;
- border->movable = 0;
+ border->movable = FALSE;
}
@@ -355,7 +356,7 @@
FT_Vector* to,
FT_Bool movable )
{
- FT_Error error = 0;
+ FT_Error error = FT_Err_Ok;
FT_ASSERT( border->start >= 0 );
@@ -410,7 +411,7 @@
border->num_points += 2;
}
- border->movable = 0;
+ border->movable = FALSE;
return error;
}
@@ -443,7 +444,7 @@
border->num_points += 3;
}
- border->movable = 0;
+ border->movable = FALSE;
return error;
}
@@ -461,7 +462,7 @@
FT_Angle total, angle, step, rotate, next, theta;
FT_Vector a, b, a2, b2;
FT_Fixed length;
- FT_Error error = 0;
+ FT_Error error = FT_Err_Ok;
/* compute start point */
@@ -527,12 +528,12 @@
{
/* close current open path if any ? */
if ( border->start >= 0 )
- ft_stroke_border_close( border, 0 );
+ ft_stroke_border_close( border, FALSE );
border->start = border->num_points;
- border->movable = 0;
+ border->movable = FALSE;
- return ft_stroke_border_lineto( border, to, 0 );
+ return ft_stroke_border_lineto( border, to, FALSE );
}
@@ -547,7 +548,7 @@
border->num_points = 0;
border->max_points = 0;
border->start = -1;
- border->valid = 0;
+ border->valid = FALSE;
}
@@ -556,7 +557,7 @@
{
border->num_points = 0;
border->start = -1;
- border->valid = 0;
+ border->valid = FALSE;
}
@@ -572,7 +573,7 @@
border->num_points = 0;
border->max_points = 0;
border->start = -1;
- border->valid = 0;
+ border->valid = FALSE;
}
@@ -581,7 +582,7 @@
FT_UInt *anum_points,
FT_UInt *anum_contours )
{
- FT_Error error = 0;
+ FT_Error error = FT_Err_Ok;
FT_UInt num_points = 0;
FT_UInt num_contours = 0;
@@ -605,9 +606,6 @@
if ( tags[0] & FT_STROKE_TAG_END )
{
- if ( in_contour == 0 )
- goto Fail;
-
in_contour = 0;
num_contours++;
}
@@ -616,7 +614,7 @@
if ( in_contour != 0 )
goto Fail;
- border->valid = 1;
+ border->valid = TRUE;
Exit:
*anum_points = num_points;
@@ -798,7 +796,7 @@
{
FT_Angle total, rotate;
FT_Fixed radius = stroker->radius;
- FT_Error error = 0;
+ FT_Error error = FT_Err_Ok;
FT_StrokeBorder border = stroker->borders + side;
@@ -813,7 +811,7 @@
radius,
stroker->angle_in + rotate,
total );
- border->movable = 0;
+ border->movable = FALSE;
return error;
}
@@ -824,7 +822,7 @@
FT_Angle angle,
FT_Int side )
{
- FT_Error error = 0;
+ FT_Error error = FT_Err_Ok;
if ( stroker->line_cap == FT_STROKER_LINECAP_ROUND )
@@ -849,7 +847,7 @@
delta.x += stroker->center.x + delta2.x;
delta.y += stroker->center.y + delta2.y;
- error = ft_stroke_border_lineto( border, &delta, 0 );
+ error = ft_stroke_border_lineto( border, &delta, FALSE );
if ( error )
goto Exit;
@@ -859,7 +857,7 @@
delta.x += delta2.x + stroker->center.x;
delta.y += delta2.y + stroker->center.y;
- error = ft_stroke_border_lineto( border, &delta, 0 );
+ error = ft_stroke_border_lineto( border, &delta, FALSE );
}
Exit:
@@ -876,7 +874,7 @@
FT_Angle phi, theta, rotate;
FT_Fixed length, thcos, sigma;
FT_Vector delta;
- FT_Error error = 0;
+ FT_Error error = FT_Err_Ok;
rotate = FT_SIDE_TO_ROTATE( side );
@@ -900,7 +898,7 @@
stroker->angle_out + rotate );
delta.x += stroker->center.x;
delta.y += stroker->center.y;
- border->movable = 0;
+ border->movable = FALSE;
}
else
{
@@ -911,7 +909,7 @@
delta.y += stroker->center.y;
}
- error = ft_stroke_border_lineto( border, &delta, 0 );
+ error = ft_stroke_border_lineto( border, &delta, FALSE );
return error;
}
@@ -928,9 +926,7 @@
if ( stroker->line_join == FT_STROKER_LINEJOIN_ROUND )
- {
error = ft_stroker_arcto( stroker, side );
- }
else
{
/* this is a mitered or beveled corner */
@@ -943,7 +939,7 @@
rotate = FT_SIDE_TO_ROTATE( side );
miter = FT_BOOL( stroker->line_join == FT_STROKER_LINEJOIN_MITER );
- theta = FT_Angle_Diff( stroker->angle_in, stroker->angle_out );
+ theta = FT_Angle_Diff( stroker->angle_in, stroker->angle_out );
if ( theta == FT_ANGLE_PI )
{
theta = rotate;
@@ -959,7 +955,7 @@
sigma = FT_MulFix( stroker->miter_limit, thcos );
if ( sigma >= 0x10000L )
- miter = 0;
+ miter = FALSE;
if ( miter ) /* this is a miter (broken angle) */
{
@@ -983,7 +979,7 @@
delta.x += middle.x;
delta.y += middle.y;
- error = ft_stroke_border_lineto( border, &delta, 0 );
+ error = ft_stroke_border_lineto( border, &delta, FALSE );
if ( error )
goto Exit;
@@ -992,7 +988,7 @@
delta.x += middle.x;
delta.y += middle.y;
- error = ft_stroke_border_lineto( border, &delta, 0 );
+ error = ft_stroke_border_lineto( border, &delta, FALSE );
if ( error )
goto Exit;
@@ -1001,7 +997,7 @@
delta.x += stroker->center.x;
delta.y += stroker->center.y;
- error = ft_stroke_border_lineto( border, &delta, 1 );
+ error = ft_stroke_border_lineto( border, &delta, TRUE );
}
else /* this is a bevel (intersection) */
@@ -1016,8 +1012,9 @@
delta.x += stroker->center.x;
delta.y += stroker->center.y;
- error = ft_stroke_border_lineto( border, &delta, 0 );
- if (error) goto Exit;
+ error = ft_stroke_border_lineto( border, &delta, FALSE );
+ if ( error )
+ goto Exit;
/* now add end point */
FT_Vector_From_Polar( &delta, stroker->radius,
@@ -1025,7 +1022,7 @@
delta.x += stroker->center.x;
delta.y += stroker->center.y;
- error = ft_stroke_border_lineto( border, &delta, 1 );
+ error = ft_stroke_border_lineto( border, &delta, TRUE );
}
}
@@ -1037,7 +1034,7 @@
static FT_Error
ft_stroker_process_corner( FT_Stroker stroker )
{
- FT_Error error = 0;
+ FT_Error error = FT_Err_Ok;
FT_Angle turn;
FT_Int inside_side;
@@ -1069,7 +1066,7 @@
/* add two points to the left and right borders corresponding to the */
- /* start of the subpath.. */
+ /* start of the subpath */
static FT_Error
ft_stroker_subpath_start( FT_Stroker stroker,
FT_Angle start_angle )
@@ -1099,7 +1096,7 @@
/* save angle for last cap */
stroker->subpath_angle = start_angle;
- stroker->first_point = 0;
+ stroker->first_point = FALSE;
Exit:
return error;
@@ -1112,7 +1109,7 @@
FT_Stroker_LineTo( FT_Stroker stroker,
FT_Vector* to )
{
- FT_Error error = 0;
+ FT_Error error = FT_Err_Ok;
FT_StrokeBorder border;
FT_Vector delta;
FT_Angle angle;
@@ -1143,7 +1140,7 @@
goto Exit;
}
- /* now add a line segment to both the "inside" and "outside" paths */
+ /* now add a line segment to both the `inside' and `outside' paths */
for ( border = stroker->borders, side = 1; side >= 0; side--, border++ )
{
@@ -1153,7 +1150,7 @@
point.x = to->x + delta.x;
point.y = to->y + delta.y;
- error = ft_stroke_border_lineto( border, &point, 1 );
+ error = ft_stroke_border_lineto( border, &point, TRUE );
if ( error )
goto Exit;
@@ -1176,12 +1173,12 @@
FT_Vector* control,
FT_Vector* to )
{
- FT_Error error = 0;
+ FT_Error error = FT_Err_Ok;
FT_Vector bez_stack[34];
FT_Vector* arc;
FT_Vector* limit = bez_stack + 30;
FT_Angle start_angle;
- FT_Bool first_arc = 1;
+ FT_Bool first_arc = TRUE;
arc = bez_stack;
@@ -1206,7 +1203,7 @@
if ( first_arc )
{
- first_arc = 0;
+ first_arc = FALSE;
start_angle = angle_in;
@@ -1275,12 +1272,12 @@
FT_Vector* control2,
FT_Vector* to )
{
- FT_Error error = 0;
+ FT_Error error = FT_Err_Ok;
FT_Vector bez_stack[37];
FT_Vector* arc;
FT_Vector* limit = bez_stack + 32;
FT_Angle start_angle;
- FT_Bool first_arc = 1;
+ FT_Bool first_arc = TRUE;
arc = bez_stack;
@@ -1308,7 +1305,7 @@
if ( first_arc )
{
- first_arc = 0;
+ first_arc = FALSE;
/* process corner if necessary */
start_angle = angle_in;
@@ -1386,15 +1383,16 @@
{
/* We cannot process the first point, because there is not enough */
/* information regarding its corner/cap. The latter will be processed */
- /* in the "end_subpath" routine. */
+ /* in the `FT_Stroker_EndSubPath' routine. */
/* */
- stroker->first_point = 1;
- stroker->center = *to;
- stroker->subpath_open = open;
+ stroker->first_point = TRUE;
+ stroker->center = *to;
+ stroker->subpath_open = open;
- /* record the subpath start point index for each border */
+ /* record the subpath start point for each border */
stroker->subpath_start = *to;
- return 0;
+
+ return FT_Err_Ok;
}
@@ -1402,10 +1400,10 @@
ft_stroker_add_reverse_left( FT_Stroker stroker,
FT_Bool open )
{
- FT_StrokeBorder right = stroker->borders + 0;
- FT_StrokeBorder left = stroker->borders + 1;
+ FT_StrokeBorder right = stroker->borders + 0;
+ FT_StrokeBorder left = stroker->borders + 1;
FT_Int new_points;
- FT_Error error = 0;
+ FT_Error error = FT_Err_Ok;
FT_ASSERT( left->start >= 0 );
@@ -1452,8 +1450,8 @@
left->num_points = left->start;
right->num_points += new_points;
- right->movable = 0;
- left->movable = 0;
+ right->movable = FALSE;
+ left->movable = FALSE;
}
Exit:
@@ -1467,7 +1465,8 @@
FT_EXPORT_DEF( FT_Error )
FT_Stroker_EndSubPath( FT_Stroker stroker )
{
- FT_Error error = 0;
+ FT_Error error = FT_Err_Ok;
+
if ( stroker->subpath_open )
{
@@ -1480,8 +1479,8 @@
if ( error )
goto Exit;
- /* add reversed points from "left" to "right" */
- error = ft_stroker_add_reverse_left( stroker, 1 );
+ /* add reversed points from `left' to `right' */
+ error = ft_stroker_add_reverse_left( stroker, TRUE );
if ( error )
goto Exit;
@@ -1494,7 +1493,7 @@
/* Now end the right subpath accordingly. The left one is */
/* rewind and doesn't need further processing. */
- ft_stroke_border_close( right, 0 );
+ ft_stroke_border_close( right, FALSE );
}
else
{
@@ -1536,8 +1535,8 @@
}
/* then end our two subpaths */
- ft_stroke_border_close( stroker->borders + 0, 1 );
- ft_stroke_border_close( stroker->borders + 1, 0 );
+ ft_stroke_border_close( stroker->borders + 0, TRUE );
+ ft_stroke_border_close( stroker->borders + 1, FALSE );
}
Exit:
@@ -1692,7 +1691,7 @@
v_control = v_start;
point = outline->points + first;
- tags = outline->tags + first;
+ tags = outline->tags + first;
tag = FT_CURVE_TAG( tags[0] );
/* A contour cannot start with a cubic control point! */
@@ -1836,7 +1835,7 @@
first = last + 1;
}
- return 0;
+ return FT_Err_Ok;
Exit:
return error;
@@ -1884,7 +1883,7 @@
FT_UInt num_points, num_contours;
- error = FT_Stroker_ParseOutline( stroker, outline, 0 );
+ error = FT_Stroker_ParseOutline( stroker, outline, FALSE );
if ( error )
goto Fail;
@@ -1967,7 +1966,7 @@
border = FT_STROKER_BORDER_LEFT;
}
- error = FT_Stroker_ParseOutline( stroker, outline, 0 );
+ error = FT_Stroker_ParseOutline( stroker, outline, FALSE );
if ( error )
goto Fail;
diff --git a/src/base/ftsynth.c b/src/base/ftsynth.c
index ff88ce9..443d272 100644
--- a/src/base/ftsynth.c
+++ b/src/base/ftsynth.c
@@ -68,36 +68,13 @@
/*************************************************************************/
- FT_EXPORT_DEF( FT_Error )
- FT_GlyphSlot_Own_Bitmap( FT_GlyphSlot slot )
- {
- if ( slot && slot->format == FT_GLYPH_FORMAT_BITMAP &&
- !( slot->internal->flags & FT_GLYPH_OWN_BITMAP ) )
- {
- FT_Bitmap bitmap;
- FT_Error error;
-
-
- FT_Bitmap_New( &bitmap );
- error = FT_Bitmap_Copy( slot->library, &slot->bitmap, &bitmap );
- if ( error )
- return error;
-
- slot->bitmap = bitmap;
- slot->internal->flags |= FT_GLYPH_OWN_BITMAP;
- }
-
- return FT_Err_Ok;
- }
-
-
/* documentation is in ftsynth.h */
FT_EXPORT_DEF( void )
FT_GlyphSlot_Embolden( FT_GlyphSlot slot )
{
FT_Library library = slot->library;
- FT_Face face = FT_SLOT_FACE( slot );
+ FT_Face face = slot->face;
FT_Error error;
FT_Pos xstr, ystr;
@@ -123,10 +100,11 @@
}
else if ( slot->format == FT_GLYPH_FORMAT_BITMAP )
{
- xstr = FT_PIX_FLOOR( xstr );
+ /* round to full pixels */
+ xstr &= ~63;
if ( xstr == 0 )
xstr = 1 << 6;
- ystr = FT_PIX_FLOOR( ystr );
+ ystr &= ~63;
error = FT_GlyphSlot_Own_Bitmap( slot );
if ( error )
diff --git a/src/base/ftsystem.c b/src/base/ftsystem.c
index f61a3ed..f64908f 100644
--- a/src/base/ftsystem.c
+++ b/src/base/ftsystem.c
@@ -4,7 +4,7 @@
/* */
/* ANSI-specific FreeType low-level system interface (body). */
/* */
-/* Copyright 1996-2001, 2002, 2006 by */
+/* Copyright 1996-2001, 2002, 2006, 2008 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -294,7 +294,7 @@
#ifdef FT_DEBUG_MEMORY
ft_mem_debug_done( memory );
#endif
- memory->free( memory, memory );
+ ft_sfree( memory );
}
diff --git a/src/cff/cffdrivr.c b/src/cff/cffdrivr.c
index 68de8dc..3dd86f2 100644
--- a/src/cff/cffdrivr.c
+++ b/src/cff/cffdrivr.c
@@ -4,7 +4,7 @@
/* */
/* OpenType font driver implementation (body). */
/* */
-/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007 by */
+/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -38,6 +38,7 @@
#include FT_SERVICE_XFREE86_NAME_H
#include FT_SERVICE_GLYPH_DICT_H
+
/*************************************************************************/
/* */
/* The macro FT_COMPONENT is used in trace mode. It is an implicit */
@@ -186,36 +187,39 @@
}
- FT_CALLBACK_DEF(FT_Error)
- cff_get_advances( FT_Face ftface,
+ FT_CALLBACK_DEF( FT_Error )
+ cff_get_advances( FT_Face face,
FT_UInt start,
FT_UInt count,
- FT_UInt flags,
+ FT_Int32 flags,
FT_Fixed* advances )
{
- CFF_Face face = (CFF_Face) ftface;
FT_UInt nn;
- FT_Error error = 0;
- FT_GlyphSlot slot = face->root.glyph;
+ FT_Error error = CFF_Err_Ok;
+ FT_GlyphSlot slot = face->glyph;
+
flags |= FT_LOAD_ADVANCE_ONLY;
- for (nn = 0; nn < count; nn++)
+ for ( nn = 0; nn < count; nn++ )
{
- error = Load_Glyph( slot, face->root.size, start+nn, flags );
- if (error) break;
+ error = Load_Glyph( slot, face->size, start + nn, flags );
+ if ( error )
+ break;
- advances[nn] = (flags & FT_LOAD_VERTICAL_LAYOUT)
- ? slot->advance.y
- : slot->advance.x;
+ advances[nn] = ( flags & FT_LOAD_VERTICAL_LAYOUT )
+ ? slot->linearVertAdvance
+ : slot->linearHoriAdvance;
}
+
return error;
}
- /*
- * GLYPH DICT SERVICE
- *
- */
+
+ /*
+ * GLYPH DICT SERVICE
+ *
+ */
static FT_Error
cff_get_glyph_name( CFF_Face face,
@@ -366,7 +370,8 @@
cff->font_info = font_info;
}
- *afont_info = *cff->font_info;
+ if ( cff )
+ *afont_info = *cff->font_info;
Fail:
return error;
@@ -376,6 +381,7 @@
static const FT_Service_PsInfoRec cff_service_ps_info =
{
(PS_GetFontInfoFunc) cff_ps_get_font_info,
+ (PS_GetFontExtraFunc) NULL,
(PS_HasGlyphNamesFunc) cff_ps_has_glyph_names,
(PS_GetFontPrivateFunc)NULL /* unsupported with CFF fonts */
};
@@ -421,6 +427,7 @@
cmap_info->language = 0;
+ cmap_info->format = 0;
if ( cmap->clazz != &cff_cmap_encoding_class_rec &&
cmap->clazz != &cff_cmap_unicode_class_rec )
@@ -500,9 +507,74 @@
}
+ static FT_Error
+ cff_get_is_cid( CFF_Face face,
+ FT_Bool *is_cid )
+ {
+ FT_Error error = CFF_Err_Ok;
+ CFF_Font cff = (CFF_Font)face->extra.data;
+
+
+ *is_cid = 0;
+
+ if ( cff )
+ {
+ CFF_FontRecDict dict = &cff->top_font.font_dict;
+
+
+ if ( dict->cid_registry != 0xFFFFU )
+ *is_cid = 1;
+ }
+
+ return error;
+ }
+
+
+ static FT_Error
+ cff_get_cid_from_glyph_index( CFF_Face face,
+ FT_UInt glyph_index,
+ FT_UInt *cid )
+ {
+ FT_Error error = CFF_Err_Ok;
+ CFF_Font cff;
+
+
+ cff = (CFF_Font)face->extra.data;
+
+ if ( cff )
+ {
+ FT_UInt c;
+ CFF_FontRecDict dict = &cff->top_font.font_dict;
+
+
+ if ( dict->cid_registry == 0xFFFFU )
+ {
+ error = CFF_Err_Invalid_Argument;
+ goto Fail;
+ }
+
+ if ( glyph_index > cff->num_glyphs )
+ {
+ error = CFF_Err_Invalid_Argument;
+ goto Fail;
+ }
+
+ c = cff->charset.sids[glyph_index];
+
+ if ( cid )
+ *cid = c;
+ }
+
+ Fail:
+ return error;
+ }
+
+
static const FT_Service_CIDRec cff_service_cid_info =
{
- (FT_CID_GetRegistryOrderingSupplementFunc)cff_get_ros
+ (FT_CID_GetRegistryOrderingSupplementFunc)cff_get_ros,
+ (FT_CID_GetIsInternallyCIDKeyedFunc) cff_get_is_cid,
+ (FT_CID_GetCIDFromGlyphIndexFunc) cff_get_cid_from_glyph_index
};
diff --git a/src/cff/cffgload.c b/src/cff/cffgload.c
index 3296d12..2718a27 100644
--- a/src/cff/cffgload.c
+++ b/src/cff/cffgload.c
@@ -4,7 +4,7 @@
/* */
/* OpenType Glyph Loader (body). */
/* */
-/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by */
+/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -110,8 +110,11 @@
cff_op_callgsubr,
cff_op_return,
- cff_op_hsbw, /* Type 1 opcode: invalid but seen in real life */
- cff_op_closepath, /* ditto */
+ /* Type 1 opcodes: invalid but seen in real life */
+ cff_op_hsbw,
+ cff_op_closepath,
+ cff_op_callothersubr,
+ cff_op_pop,
/* do not remove */
cff_op_max
@@ -123,6 +126,11 @@
#define CFF_COUNT_EXACT 0x40
#define CFF_COUNT_CLEAR_STACK 0x20
+ /* count values which have the `CFF_COUNT_CHECK_WIDTH' flag set are */
+ /* used for checking the width and requested numbers of arguments */
+ /* only; they are set to zero afterwards */
+
+ /* the other two flags are informative only and unused currently */
static const FT_Byte cff_argument_counts[] =
{
@@ -193,6 +201,8 @@
0,
2, /* hsbw */
+ 0,
+ 0,
0
};
@@ -379,11 +389,6 @@
decoder->hint_mode = hint_mode;
}
- FT_LOCAL_DEF( void )
- cff_decoder_set_width_only( CFF_Decoder* decoder )
- {
- decoder->width_only = 1;
- }
/* this function is used to select the subfont */
/* and the locals subrs array */
@@ -411,8 +416,11 @@
goto Exit;
}
+ FT_TRACE4(( "glyph index %d (subfont %d):\n", glyph_index, fd_index ));
+
sub = cff->subfonts[fd_index];
- if ( builder->hints_funcs )
+
+ if ( builder->hints_funcs && size )
{
CFF_Internal internal = (CFF_Internal)size->root.internal;
@@ -421,6 +429,10 @@
builder->hints_globals = (void *)internal->subfonts[fd_index];
}
}
+#ifdef FT_DEBUG_LEVEL_TRACE
+ else
+ FT_TRACE4(( "glyph index %d:\n", glyph_index ));
+#endif
decoder->num_locals = sub->num_local_subrs;
decoder->locals = sub->local_subrs;
@@ -948,6 +960,11 @@
}
else
{
+ /* The specification says that normally arguments are to be taken */
+ /* from the bottom of the stack. However, this seems not to be */
+ /* correct, at least for Acroread 7.0.8 on GNU/Linux: It pops the */
+ /* arguments similar to a PS interpreter. */
+
FT_Fixed* args = decoder->top;
FT_Int num_args = (FT_Int)( args - decoder->stack );
FT_Int req_args;
@@ -1032,6 +1049,12 @@
case 15:
op = cff_op_eq;
break;
+ case 16:
+ op = cff_op_callothersubr;
+ break;
+ case 17:
+ op = cff_op_pop;
+ break;
case 18:
op = cff_op_drop;
break;
@@ -1134,6 +1157,7 @@
default:
;
}
+
if ( op == cff_op_unknown )
goto Syntax_Error;
@@ -1141,8 +1165,6 @@
req_args = cff_argument_counts[op];
if ( req_args & CFF_COUNT_CHECK_WIDTH )
{
- args = stack;
-
if ( num_args > 0 && decoder->read_width )
{
/* If `nominal_width' is non-zero, the number is really a */
@@ -1176,7 +1198,7 @@
case cff_op_endchar:
/* If there is a width specified for endchar, we either have */
/* 1 argument or 5 arguments. We like to argue. */
- set_width_ok = ( ( num_args == 5 ) || ( num_args == 1 ) );
+ set_width_ok = ( num_args == 5 ) || ( num_args == 1 );
break;
default:
@@ -1189,15 +1211,14 @@
decoder->glyph_width = decoder->nominal_width +
( stack[0] >> 16 );
- if (decoder->width_only)
+ if ( decoder->width_only )
{
- /* we only want the advance width, stop here */
+ /* we only want the advance width; stop here */
break;
}
/* Consumed an argument. */
num_args--;
- args++;
}
}
@@ -1211,6 +1232,14 @@
args -= req_args;
num_args -= req_args;
+ /* At this point, `args' points to the first argument of the */
+ /* operand in case `req_args' isn't zero. Otherwise, we have */
+ /* to adjust `args' manually. */
+
+ /* Note that we only pop arguments from the stack which we */
+ /* really need and can digest so that we can continue in case */
+ /* of superfluous stack elements. */
+
switch ( op )
{
case cff_op_hstem:
@@ -1218,15 +1247,16 @@
case cff_op_hstemhm:
case cff_op_vstemhm:
/* the number of arguments is always even here */
- FT_TRACE4(( op == cff_op_hstem ? " hstem" :
- ( op == cff_op_vstem ? " vstem" :
- ( op == cff_op_hstemhm ? " hstemhm" : " vstemhm" ) ) ));
+ FT_TRACE4((
+ op == cff_op_hstem ? " hstem\n" :
+ ( op == cff_op_vstem ? " vstem\n" :
+ ( op == cff_op_hstemhm ? " hstemhm\n" : " vstemhm\n" ) ) ));
if ( hinter )
hinter->stems( hinter->hints,
( op == cff_op_hstem || op == cff_op_hstemhm ),
num_args / 2,
- args );
+ args - ( num_args & ~1 ) );
decoder->num_hints += num_args / 2;
args = stack;
@@ -1246,7 +1276,7 @@
hinter->stems( hinter->hints,
0,
num_args / 2,
- args );
+ args - ( num_args & ~1 ) );
decoder->num_hints += num_args / 2;
}
@@ -1269,12 +1299,14 @@
FT_UInt maskbyte;
- FT_TRACE4(( " " ));
+ FT_TRACE4(( " (maskbytes: " ));
for ( maskbyte = 0;
maskbyte < (FT_UInt)(( decoder->num_hints + 7 ) >> 3);
maskbyte++, ip++ )
FT_TRACE4(( "0x%02X", *ip ));
+
+ FT_TRACE4(( ")\n" ));
}
#else
ip += ( decoder->num_hints + 7 ) >> 3;
@@ -1285,44 +1317,44 @@
break;
case cff_op_rmoveto:
- FT_TRACE4(( " rmoveto" ));
+ FT_TRACE4(( " rmoveto\n" ));
cff_builder_close_contour( builder );
builder->path_begun = 0;
- x += args[0];
- y += args[1];
+ x += args[-2];
+ y += args[-1];
args = stack;
break;
case cff_op_vmoveto:
- FT_TRACE4(( " vmoveto" ));
+ FT_TRACE4(( " vmoveto\n" ));
cff_builder_close_contour( builder );
builder->path_begun = 0;
- y += args[0];
+ y += args[-1];
args = stack;
break;
case cff_op_hmoveto:
- FT_TRACE4(( " hmoveto" ));
+ FT_TRACE4(( " hmoveto\n" ));
cff_builder_close_contour( builder );
builder->path_begun = 0;
- x += args[0];
+ x += args[-1];
args = stack;
break;
case cff_op_rlineto:
- FT_TRACE4(( " rlineto" ));
+ FT_TRACE4(( " rlineto\n" ));
if ( cff_builder_start_point ( builder, x, y ) ||
check_points( builder, num_args / 2 ) )
goto Fail;
- if ( num_args < 2 || num_args & 1 )
+ if ( num_args < 2 )
goto Stack_Underflow;
- args = stack;
+ args -= num_args & ~1;
while ( args < decoder->top )
{
x += args[0];
@@ -1339,8 +1371,11 @@
FT_Int phase = ( op == cff_op_hlineto );
- FT_TRACE4(( op == cff_op_hlineto ? " hlineto"
- : " vlineto" ));
+ FT_TRACE4(( op == cff_op_hlineto ? " hlineto\n"
+ : " vlineto\n" ));
+
+ if ( num_args < 1 )
+ goto Stack_Underflow;
if ( cff_builder_start_point ( builder, x, y ) ||
check_points( builder, num_args ) )
@@ -1365,125 +1400,164 @@
break;
case cff_op_rrcurveto:
- FT_TRACE4(( " rrcurveto" ));
+ {
+ FT_Int nargs;
- /* check number of arguments; must be a multiple of 6 */
- if ( num_args % 6 != 0 )
- goto Stack_Underflow;
- if ( cff_builder_start_point ( builder, x, y ) ||
- check_points( builder, num_args / 2 ) )
- goto Fail;
+ FT_TRACE4(( " rrcurveto\n" ));
- args = stack;
- while ( args < decoder->top )
- {
- x += args[0];
- y += args[1];
- cff_builder_add_point( builder, x, y, 0 );
- x += args[2];
- y += args[3];
- cff_builder_add_point( builder, x, y, 0 );
- x += args[4];
- y += args[5];
- cff_builder_add_point( builder, x, y, 1 );
- args += 6;
+ if ( num_args < 6 )
+ goto Stack_Underflow;
+
+ nargs = num_args - num_args % 6;
+
+ if ( cff_builder_start_point ( builder, x, y ) ||
+ check_points( builder, nargs / 2 ) )
+ goto Fail;
+
+ args -= nargs;
+ while ( args < decoder->top )
+ {
+ x += args[0];
+ y += args[1];
+ cff_builder_add_point( builder, x, y, 0 );
+ x += args[2];
+ y += args[3];
+ cff_builder_add_point( builder, x, y, 0 );
+ x += args[4];
+ y += args[5];
+ cff_builder_add_point( builder, x, y, 1 );
+ args += 6;
+ }
+ args = stack;
}
- args = stack;
break;
case cff_op_vvcurveto:
- FT_TRACE4(( " vvcurveto" ));
+ {
+ FT_Int nargs;
- if ( cff_builder_start_point( builder, x, y ) )
- goto Fail;
- args = stack;
- if ( num_args & 1 )
- {
- x += args[0];
- args++;
- num_args--;
- }
+ FT_TRACE4(( " vvcurveto\n" ));
- if ( num_args % 4 != 0 )
- goto Stack_Underflow;
+ if ( num_args < 4 )
+ goto Stack_Underflow;
- if ( check_points( builder, 3 * ( num_args / 4 ) ) )
- goto Fail;
+ /* if num_args isn't of the form 4n or 4n+1, */
+ /* we reduce it to 4n+1 */
- while ( args < decoder->top )
- {
- y += args[0];
- cff_builder_add_point( builder, x, y, 0 );
- x += args[1];
- y += args[2];
- cff_builder_add_point( builder, x, y, 0 );
- y += args[3];
- cff_builder_add_point( builder, x, y, 1 );
- args += 4;
+ nargs = num_args - num_args % 4;
+ if ( num_args - nargs > 0 )
+ nargs += 1;
+
+ if ( cff_builder_start_point( builder, x, y ) )
+ goto Fail;
+
+ args -= nargs;
+
+ if ( nargs & 1 )
+ {
+ x += args[0];
+ args++;
+ nargs--;
+ }
+
+ if ( check_points( builder, 3 * ( nargs / 4 ) ) )
+ goto Fail;
+
+ while ( args < decoder->top )
+ {
+ y += args[0];
+ cff_builder_add_point( builder, x, y, 0 );
+ x += args[1];
+ y += args[2];
+ cff_builder_add_point( builder, x, y, 0 );
+ y += args[3];
+ cff_builder_add_point( builder, x, y, 1 );
+ args += 4;
+ }
+ args = stack;
}
- args = stack;
break;
case cff_op_hhcurveto:
- FT_TRACE4(( " hhcurveto" ));
+ {
+ FT_Int nargs;
- if ( cff_builder_start_point( builder, x, y ) )
- goto Fail;
- args = stack;
- if ( num_args & 1 )
- {
- y += args[0];
- args++;
- num_args--;
- }
+ FT_TRACE4(( " hhcurveto\n" ));
- if ( num_args % 4 != 0 )
- goto Stack_Underflow;
+ if ( num_args < 4 )
+ goto Stack_Underflow;
- if ( check_points( builder, 3 * ( num_args / 4 ) ) )
- goto Fail;
+ /* if num_args isn't of the form 4n or 4n+1, */
+ /* we reduce it to 4n+1 */
- while ( args < decoder->top )
- {
- x += args[0];
- cff_builder_add_point( builder, x, y, 0 );
- x += args[1];
- y += args[2];
- cff_builder_add_point( builder, x, y, 0 );
- x += args[3];
- cff_builder_add_point( builder, x, y, 1 );
- args += 4;
+ nargs = num_args - num_args % 4;
+ if ( num_args - nargs > 0 )
+ nargs += 1;
+
+ if ( cff_builder_start_point( builder, x, y ) )
+ goto Fail;
+
+ args -= nargs;
+ if ( nargs & 1 )
+ {
+ y += args[0];
+ args++;
+ nargs--;
+ }
+
+ if ( check_points( builder, 3 * ( nargs / 4 ) ) )
+ goto Fail;
+
+ while ( args < decoder->top )
+ {
+ x += args[0];
+ cff_builder_add_point( builder, x, y, 0 );
+ x += args[1];
+ y += args[2];
+ cff_builder_add_point( builder, x, y, 0 );
+ x += args[3];
+ cff_builder_add_point( builder, x, y, 1 );
+ args += 4;
+ }
+ args = stack;
}
- args = stack;
break;
case cff_op_vhcurveto:
case cff_op_hvcurveto:
{
FT_Int phase;
+ FT_Int nargs;
- FT_TRACE4(( op == cff_op_vhcurveto ? " vhcurveto"
- : " hvcurveto" ));
+ FT_TRACE4(( op == cff_op_vhcurveto ? " vhcurveto\n"
+ : " hvcurveto\n" ));
if ( cff_builder_start_point( builder, x, y ) )
goto Fail;
- args = stack;
- if ( num_args < 4 || ( num_args % 4 ) > 1 )
+ if ( num_args < 4 )
goto Stack_Underflow;
- if ( check_points( builder, ( num_args / 4 ) * 3 ) )
+ /* if num_args isn't of the form 8n, 8n+1, 8n+4, or 8n+5, */
+ /* we reduce it to the largest one which fits */
+
+ nargs = num_args - num_args % 4;
+ if ( num_args - nargs > 0 )
+ nargs += 1;
+
+ args -= nargs;
+ if ( check_points( builder, ( nargs / 4 ) * 3 ) )
goto Stack_Underflow;
phase = ( op == cff_op_hvcurveto );
- while ( num_args >= 4 )
+ while ( nargs >= 4 )
{
- num_args -= 4;
+ nargs -= 4;
if ( phase )
{
x += args[0];
@@ -1492,7 +1566,7 @@
y += args[2];
cff_builder_add_point( builder, x, y, 0 );
y += args[3];
- if ( num_args == 1 )
+ if ( nargs == 1 )
x += args[4];
cff_builder_add_point( builder, x, y, 1 );
}
@@ -1504,7 +1578,7 @@
y += args[2];
cff_builder_add_point( builder, x, y, 0 );
x += args[3];
- if ( num_args == 1 )
+ if ( nargs == 1 )
y += args[4];
cff_builder_add_point( builder, x, y, 1 );
}
@@ -1517,19 +1591,23 @@
case cff_op_rlinecurve:
{
- FT_Int num_lines = ( num_args - 6 ) / 2;
+ FT_Int num_lines;
+ FT_Int nargs;
- FT_TRACE4(( " rlinecurve" ));
+ FT_TRACE4(( " rlinecurve\n" ));
- if ( num_args < 8 || ( num_args - 6 ) & 1 )
+ if ( num_args < 8 )
goto Stack_Underflow;
+ nargs = num_args & ~1;
+ num_lines = ( nargs - 6 ) / 2;
+
if ( cff_builder_start_point( builder, x, y ) ||
check_points( builder, num_lines + 3 ) )
goto Fail;
- args = stack;
+ args -= nargs;
/* first, add the line segments */
while ( num_lines > 0 )
@@ -1557,19 +1635,24 @@
case cff_op_rcurveline:
{
- FT_Int num_curves = ( num_args - 2 ) / 6;
+ FT_Int num_curves;
+ FT_Int nargs;
- FT_TRACE4(( " rcurveline" ));
+ FT_TRACE4(( " rcurveline\n" ));
- if ( num_args < 8 || ( num_args - 2 ) % 6 )
+ if ( num_args < 8 )
goto Stack_Underflow;
+ nargs = num_args - 2;
+ nargs = nargs - nargs % 6 + 2;
+ num_curves = ( nargs - 2 ) / 6;
+
if ( cff_builder_start_point ( builder, x, y ) ||
- check_points( builder, num_curves*3 + 2 ) )
+ check_points( builder, num_curves * 3 + 2 ) )
goto Fail;
- args = stack;
+ args -= nargs;
/* first, add the curves */
while ( num_curves > 0 )
@@ -1600,18 +1683,16 @@
FT_Pos start_y;
- FT_TRACE4(( " hflex1" ));
-
- args = stack;
+ FT_TRACE4(( " hflex1\n" ));
- /* adding five more points; 4 control points, 1 on-curve point */
- /* make sure we have enough space for the start point if it */
+ /* adding five more points: 4 control points, 1 on-curve point */
+ /* -- make sure we have enough space for the start point if it */
/* needs to be added */
if ( cff_builder_start_point( builder, x, y ) ||
check_points( builder, 6 ) )
goto Fail;
- /* Record the starting point's y position for later use */
+ /* record the starting point's y position for later use */
start_y = y;
/* first control point */
@@ -1653,9 +1734,7 @@
FT_Pos start_y;
- FT_TRACE4(( " hflex" ));
-
- args = stack;
+ FT_TRACE4(( " hflex\n" ));
/* adding six more points; 4 control points, 2 on-curve points */
if ( cff_builder_start_point( builder, x, y ) ||
@@ -1700,14 +1779,15 @@
case cff_op_flex1:
{
- FT_Pos start_x, start_y; /* record start x, y values for */
- /* alter use */
- FT_Fixed dx = 0, dy = 0; /* used in horizontal/vertical */
- /* algorithm below */
- FT_Int horizontal, count;
+ FT_Pos start_x, start_y; /* record start x, y values for */
+ /* alter use */
+ FT_Fixed dx = 0, dy = 0; /* used in horizontal/vertical */
+ /* algorithm below */
+ FT_Int horizontal, count;
+ FT_Fixed* temp;
- FT_TRACE4(( " flex1" ));
+ FT_TRACE4(( " flex1\n" ));
/* adding six more points; 4 control points, 2 on-curve points */
if ( cff_builder_start_point( builder, x, y ) ||
@@ -1721,21 +1801,20 @@
/* XXX: figure out whether this is supposed to be a horizontal */
/* or vertical flex; the Type 2 specification is vague... */
- args = stack;
+ temp = args;
/* grab up to the last argument */
for ( count = 5; count > 0; count-- )
{
- dx += args[0];
- dy += args[1];
- args += 2;
+ dx += temp[0];
+ dy += temp[1];
+ temp += 2;
}
- /* rewind */
- args = stack;
-
- if ( dx < 0 ) dx = -dx;
- if ( dy < 0 ) dy = -dy;
+ if ( dx < 0 )
+ dx = -dx;
+ if ( dy < 0 )
+ dy = -dy;
/* strange test, but here it is... */
horizontal = ( dx > dy );
@@ -1744,7 +1823,8 @@
{
x += args[0];
y += args[1];
- cff_builder_add_point( builder, x, y, (FT_Bool)( count == 3 ) );
+ cff_builder_add_point( builder, x, y,
+ (FT_Bool)( count == 3 ) );
args += 2;
}
@@ -1771,13 +1851,12 @@
FT_UInt count;
- FT_TRACE4(( " flex" ));
+ FT_TRACE4(( " flex\n" ));
if ( cff_builder_start_point( builder, x, y ) ||
check_points( builder, 6 ) )
goto Fail;
- args = stack;
for ( count = 6; count > 0; count-- )
{
x += args[0];
@@ -1792,21 +1871,20 @@
break;
case cff_op_endchar:
- FT_TRACE4(( " endchar" ));
+ FT_TRACE4(( " endchar\n" ));
/* We are going to emulate the seac operator. */
- if ( num_args == 4 )
+ if ( num_args >= 4 )
{
/* Save glyph width so that the subglyphs don't overwrite it. */
FT_Pos glyph_width = decoder->glyph_width;
error = cff_operator_seac( decoder,
- args[0],
- args[1],
- (FT_Int)( args[2] >> 16 ),
- (FT_Int)( args[3] >> 16 ) );
- args += 4;
+ args[-4],
+ args[-3],
+ (FT_Int)( args[-2] >> 16 ),
+ (FT_Int)( args[-1] >> 16 ) );
decoder->glyph_width = glyph_width;
}
@@ -1836,11 +1914,11 @@
}
/* return now! */
- FT_TRACE4(( "\n\n" ));
+ FT_TRACE4(( "\n" ));
return error;
case cff_op_abs:
- FT_TRACE4(( " abs" ));
+ FT_TRACE4(( " abs\n" ));
if ( args[0] < 0 )
args[0] = -args[0];
@@ -1848,28 +1926,28 @@
break;
case cff_op_add:
- FT_TRACE4(( " add" ));
+ FT_TRACE4(( " add\n" ));
args[0] += args[1];
args++;
break;
case cff_op_sub:
- FT_TRACE4(( " sub" ));
+ FT_TRACE4(( " sub\n" ));
args[0] -= args[1];
args++;
break;
case cff_op_div:
- FT_TRACE4(( " div" ));
+ FT_TRACE4(( " div\n" ));
args[0] = FT_DivFix( args[0], args[1] );
args++;
break;
case cff_op_neg:
- FT_TRACE4(( " neg" ));
+ FT_TRACE4(( " neg\n" ));
args[0] = -args[0];
args++;
@@ -1880,7 +1958,7 @@
FT_Fixed Rand;
- FT_TRACE4(( " rand" ));
+ FT_TRACE4(( " rand\n" ));
Rand = seed;
if ( Rand >= 0x8000L )
@@ -1895,14 +1973,14 @@
break;
case cff_op_mul:
- FT_TRACE4(( " mul" ));
+ FT_TRACE4(( " mul\n" ));
args[0] = FT_MulFix( args[0], args[1] );
args++;
break;
case cff_op_sqrt:
- FT_TRACE4(( " sqrt" ));
+ FT_TRACE4(( " sqrt\n" ));
if ( args[0] > 0 )
{
@@ -1927,7 +2005,7 @@
case cff_op_drop:
/* nothing */
- FT_TRACE4(( " drop" ));
+ FT_TRACE4(( " drop\n" ));
break;
@@ -1936,7 +2014,7 @@
FT_Fixed tmp;
- FT_TRACE4(( " exch" ));
+ FT_TRACE4(( " exch\n" ));
tmp = args[0];
args[0] = args[1];
@@ -1950,7 +2028,7 @@
FT_Int idx = (FT_Int)( args[0] >> 16 );
- FT_TRACE4(( " index" ));
+ FT_TRACE4(( " index\n" ));
if ( idx < 0 )
idx = 0;
@@ -1967,7 +2045,7 @@
FT_Int idx = (FT_Int)( args[1] >> 16 );
- FT_TRACE4(( " roll" ));
+ FT_TRACE4(( " roll\n" ));
if ( count <= 0 )
count = 1;
@@ -2009,7 +2087,7 @@
break;
case cff_op_dup:
- FT_TRACE4(( " dup" ));
+ FT_TRACE4(( " dup\n" ));
args[1] = args[0];
args++;
@@ -2021,7 +2099,7 @@
FT_Int idx = (FT_Int)( args[1] >> 16 );
- FT_TRACE4(( " put" ));
+ FT_TRACE4(( " put\n" ));
if ( idx >= 0 && idx < decoder->len_buildchar )
decoder->buildchar[idx] = val;
@@ -2034,7 +2112,7 @@
FT_Fixed val = 0;
- FT_TRACE4(( " get" ));
+ FT_TRACE4(( " get\n" ));
if ( idx >= 0 && idx < decoder->len_buildchar )
val = decoder->buildchar[idx];
@@ -2045,18 +2123,18 @@
break;
case cff_op_store:
- FT_TRACE4(( " store "));
+ FT_TRACE4(( " store\n"));
goto Unimplemented;
case cff_op_load:
- FT_TRACE4(( " load" ));
+ FT_TRACE4(( " load\n" ));
goto Unimplemented;
case cff_op_dotsection:
/* this operator is deprecated and ignored by the parser */
- FT_TRACE4(( " dotsection" ));
+ FT_TRACE4(( " dotsection\n" ));
break;
case cff_op_closepath:
@@ -2064,7 +2142,7 @@
/* exist fonts which are incorrectly converted from probably */
/* Type 1 to CFF, and some parsers seem to accept it */
- FT_TRACE4(( " closepath (invalid op)" ));
+ FT_TRACE4(( " closepath (invalid op)\n" ));
args = stack;
break;
@@ -2074,7 +2152,7 @@
/* exist fonts which are incorrectly converted from probably */
/* Type 1 to CFF, and some parsers seem to accept it */
- FT_TRACE4(( " hsbw (invalid op)" ));
+ FT_TRACE4(( " hsbw (invalid op)\n" ));
decoder->glyph_width = decoder->nominal_width +
(args[1] >> 16);
@@ -2083,12 +2161,33 @@
args = stack;
break;
+ case cff_op_callothersubr:
+ /* this is an invalid Type 2 operator; however, there */
+ /* exist fonts which are incorrectly converted from probably */
+ /* Type 1 to CFF, and some parsers seem to accept it */
+
+ FT_TRACE4(( " callothersubr (invalid op)\n" ));
+
+ /* don't modify stack; handle the subr as `unknown' so that */
+ /* following `pop' operands use the arguments on stack */
+ break;
+
+ case cff_op_pop:
+ /* this is an invalid Type 2 operator; however, there */
+ /* exist fonts which are incorrectly converted from probably */
+ /* Type 1 to CFF, and some parsers seem to accept it */
+
+ FT_TRACE4(( " pop (invalid op)\n" ));
+
+ args++;
+ break;
+
case cff_op_and:
{
FT_Fixed cond = args[0] && args[1];
- FT_TRACE4(( " and" ));
+ FT_TRACE4(( " and\n" ));
args[0] = cond ? 0x10000L : 0;
args++;
@@ -2100,7 +2199,7 @@
FT_Fixed cond = args[0] || args[1];
- FT_TRACE4(( " or" ));
+ FT_TRACE4(( " or\n" ));
args[0] = cond ? 0x10000L : 0;
args++;
@@ -2112,7 +2211,7 @@
FT_Fixed cond = !args[0];
- FT_TRACE4(( " eq" ));
+ FT_TRACE4(( " eq\n" ));
args[0] = cond ? 0x10000L : 0;
args++;
@@ -2124,7 +2223,7 @@
FT_Fixed cond = ( args[2] <= args[3] );
- FT_TRACE4(( " ifelse" ));
+ FT_TRACE4(( " ifelse\n" ));
if ( !cond )
args[0] = args[1];
@@ -2138,7 +2237,7 @@
decoder->locals_bias );
- FT_TRACE4(( " callsubr(%d)", idx ));
+ FT_TRACE4(( " callsubr(%d)\n", idx ));
if ( idx >= decoder->num_locals )
{
@@ -2180,7 +2279,7 @@
decoder->globals_bias );
- FT_TRACE4(( " callgsubr(%d)", idx ));
+ FT_TRACE4(( " callgsubr(%d)\n", idx ));
if ( idx >= decoder->num_globals )
{
@@ -2217,7 +2316,7 @@
break;
case cff_op_return:
- FT_TRACE4(( " return" ));
+ FT_TRACE4(( " return\n" ));
if ( decoder->zone <= decoder->zones )
{
@@ -2255,15 +2354,15 @@
return error;
Syntax_Error:
- FT_TRACE4(( "cff_decoder_parse_charstrings: syntax error!" ));
+ FT_TRACE4(( "cff_decoder_parse_charstrings: syntax error!\n" ));
return CFF_Err_Invalid_File_Format;
Stack_Underflow:
- FT_TRACE4(( "cff_decoder_parse_charstrings: stack underflow!" ));
+ FT_TRACE4(( "cff_decoder_parse_charstrings: stack underflow!\n" ));
return CFF_Err_Too_Few_Arguments;
Stack_Overflow:
- FT_TRACE4(( "cff_decoder_parse_charstrings: stack overflow!" ));
+ FT_TRACE4(( "cff_decoder_parse_charstrings: stack overflow!\n" ));
return CFF_Err_Stack_Overflow;
}
@@ -2351,13 +2450,14 @@
{
FT_Error error;
CFF_Decoder decoder;
- TT_Face face = (TT_Face)glyph->root.face;
+ TT_Face face = (TT_Face)glyph->root.face;
FT_Bool hinting, force_scaling;
- CFF_Font cff = (CFF_Font)face->extra.data;
+ CFF_Font cff = (CFF_Font)face->extra.data;
FT_Matrix font_matrix;
FT_Vector font_offset;
+
force_scaling = FALSE;
/* in a CID-keyed font, consider `glyph_index' as a CID and map */
@@ -2366,9 +2466,14 @@
if ( cff->top_font.font_dict.cid_registry != 0xFFFFU &&
cff->charset.cids )
{
- glyph_index = cff_charset_cid_to_gindex( &cff->charset, glyph_index );
- if ( glyph_index == 0 )
- return CFF_Err_Invalid_Argument;
+ /* don't handle CID 0 (.notdef) which is directly mapped to GID 0 */
+ if ( glyph_index != 0 )
+ {
+ glyph_index = cff_charset_cid_to_gindex( &cff->charset,
+ glyph_index );
+ if ( glyph_index == 0 )
+ return CFF_Err_Invalid_Argument;
+ }
}
else if ( glyph_index >= cff->num_glyphs )
return CFF_Err_Invalid_Argument;
@@ -2497,11 +2602,11 @@
cff_decoder_init( &decoder, face, size, glyph, hinting,
FT_LOAD_TARGET_MODE( load_flags ) );
- if ((load_flags & FT_LOAD_ADVANCE_ONLY) != 0)
- cff_decoder_set_width_only( &decoder );
+ if ( load_flags & FT_LOAD_ADVANCE_ONLY )
+ decoder.width_only = TRUE;
decoder.builder.no_recurse =
- (FT_Bool)( ( load_flags & FT_LOAD_NO_RECURSE ) != 0 );
+ (FT_Bool)( load_flags & FT_LOAD_NO_RECURSE );
/* now load the unscaled outline */
error = cff_get_glyph_data( face, glyph_index,
@@ -2608,7 +2713,7 @@
has_vertical_info = FT_BOOL( face->vertical_info &&
face->vertical.number_Of_VMetrics > 0 &&
- face->vertical.long_metrics != 0 );
+ face->vertical.long_metrics );
/* get the vertical metrics from the vtmx table if we have one */
if ( has_vertical_info )
diff --git a/src/cff/cffgload.h b/src/cff/cffgload.h
index bf21654..667134e 100644
--- a/src/cff/cffgload.h
+++ b/src/cff/cffgload.h
@@ -169,9 +169,6 @@ FT_BEGIN_HEADER
FT_Bool hinting,
FT_Render_Mode hint_mode );
- FT_LOCAL( void )
- cff_decoder_set_width_only( CFF_Decoder* decoder );
-
FT_LOCAL( FT_Error )
cff_decoder_prepare( CFF_Decoder* decoder,
CFF_Size size,
diff --git a/src/cff/cffload.c b/src/cff/cffload.c
index 9c030cf..22163fb 100644
--- a/src/cff/cffload.c
+++ b/src/cff/cffload.c
@@ -4,7 +4,7 @@
/* */
/* OpenType and CFF data/program tables loader (body). */
/* */
-/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007 by */
+/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -31,6 +31,7 @@
#if 1
+
static const FT_UShort cff_isoadobe_charset[229] =
{
0, 1, 2, 3, 4, 5, 6, 7,
@@ -175,6 +176,7 @@
363, 364, 365, 366, 367, 368, 369, 370,
371, 372, 373, 374, 375, 376, 377, 378
};
+
#endif /* 1 */
@@ -317,7 +319,7 @@
static FT_Error
cff_index_load_offsets( CFF_Index idx )
{
- FT_Error error = 0;
+ FT_Error error = CFF_Err_Ok;
FT_Stream stream = idx->stream;
FT_Memory memory = stream->memory;
@@ -400,6 +402,7 @@
old_offset = 1;
for ( n = 0; n <= idx->count; n++ )
{
+ /* at this point, `idx->offsets' can't be NULL */
offset = idx->offsets[n];
if ( !offset )
offset = old_offset;
@@ -1353,7 +1356,8 @@
FT_LOCAL_DEF( FT_Error )
cff_font_load( FT_Stream stream,
FT_Int face_index,
- CFF_Font font )
+ CFF_Font font,
+ FT_Bool pure_cff )
{
static const FT_Frame_Field cff_header_fields[] =
{
@@ -1517,7 +1521,7 @@
/* read the Charset and Encoding tables if available */
if ( font->num_glyphs > 0 )
{
- FT_Bool invert = FT_BOOL( dict->cid_registry != 0xFFFFU );
+ FT_Bool invert = FT_BOOL( dict->cid_registry != 0xFFFFU && pure_cff );
error = cff_charset_load( &font->charset, font->num_glyphs, stream,
@@ -1537,9 +1541,6 @@
if ( error )
goto Exit;
}
- else
- /* CID-keyed fonts only need CIDs */
- FT_FREE( font->charset.sids );
}
/* get the font name (/CIDFontName for CID-keyed fonts, */
diff --git a/src/cff/cffload.h b/src/cff/cffload.h
index 068cbb5..02498bd 100644
--- a/src/cff/cffload.h
+++ b/src/cff/cffload.h
@@ -4,7 +4,7 @@
/* */
/* OpenType & CFF data/program tables loader (specification). */
/* */
-/* Copyright 1996-2001, 2002, 2003, 2007 by */
+/* Copyright 1996-2001, 2002, 2003, 2007, 2008 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -60,7 +60,8 @@ FT_BEGIN_HEADER
FT_LOCAL( FT_Error )
cff_font_load( FT_Stream stream,
FT_Int face_index,
- CFF_Font font );
+ CFF_Font font,
+ FT_Bool pure_cff );
FT_LOCAL( void )
cff_font_done( CFF_Font font );
diff --git a/src/cff/cffobjs.c b/src/cff/cffobjs.c
index 12997a9..3525ea3 100644
--- a/src/cff/cffobjs.c
+++ b/src/cff/cffobjs.c
@@ -101,7 +101,7 @@
/* CFF and Type 1 private dictionaries have slightly different */
- /* structures; we need to synthetize a Type 1 dictionary on the fly */
+ /* structures; we need to synthesize a Type 1 dictionary on the fly */
static void
cff_make_private_dict( CFF_SubFont subfont,
@@ -437,7 +437,7 @@
error = sfnt->init_face( stream, face, face_index, num_params, params );
if ( !error )
{
- if ( face->format_tag != 0x4F54544FL ) /* `OTTO'; OpenType/CFF font */
+ if ( face->format_tag != TTAG_OTTO ) /* `OTTO'; OpenType/CFF font */
{
FT_TRACE2(( "[not a valid OpenType/CFF font]\n" ));
goto Bad_Format;
@@ -465,8 +465,7 @@
pure_cff = 0;
/* load font directory */
- error = sfnt->load_face( stream, face,
- face_index, num_params, params );
+ error = sfnt->load_face( stream, face, 0, num_params, params );
if ( error )
goto Exit;
}
@@ -508,13 +507,15 @@
goto Exit;
face->extra.data = cff;
- error = cff_font_load( stream, face_index, cff );
+ error = cff_font_load( stream, face_index, cff, pure_cff );
if ( error )
goto Exit;
cff->pshinter = pshinter;
cff->psnames = (void*)psnames;
+ cffface->face_index = face_index;
+
/* Complement the root flags with some interesting information. */
/* Note that this is only necessary for pure CFF and CEF fonts; */
/* SFNT based fonts use the `name' table instead. */
@@ -534,6 +535,111 @@
goto Bad_Format;
}
+ if ( !dict->units_per_em )
+ dict->units_per_em = pure_cff ? 1000 : face->root.units_per_EM;
+
+ /* Normalize the font matrix so that `matrix->xx' is 1; the */
+ /* scaling is done with `units_per_em' then (at this point, */
+ /* it already contains the scaling factor, but without */
+ /* normalization of the matrix). */
+ /* */
+ /* Note that the offsets must be expressed in integer font */
+ /* units. */
+
+ {
+ FT_Matrix* matrix = &dict->font_matrix;
+ FT_Vector* offset = &dict->font_offset;
+ FT_ULong* upm = &dict->units_per_em;
+ FT_Fixed temp = FT_ABS( matrix->yy );
+
+
+ if ( temp != 0x10000L )
+ {
+ *upm = FT_DivFix( *upm, temp );
+
+ matrix->xx = FT_DivFix( matrix->xx, temp );
+ matrix->yx = FT_DivFix( matrix->yx, temp );
+ matrix->xy = FT_DivFix( matrix->xy, temp );
+ matrix->yy = FT_DivFix( matrix->yy, temp );
+ offset->x = FT_DivFix( offset->x, temp );
+ offset->y = FT_DivFix( offset->y, temp );
+ }
+
+ offset->x >>= 16;
+ offset->y >>= 16;
+ }
+
+ for ( i = cff->num_subfonts; i > 0; i-- )
+ {
+ CFF_FontRecDict sub = &cff->subfonts[i - 1]->font_dict;
+ CFF_FontRecDict top = &cff->top_font.font_dict;
+
+ FT_Matrix* matrix;
+ FT_Vector* offset;
+ FT_ULong* upm;
+ FT_Fixed temp;
+
+
+ if ( sub->units_per_em )
+ {
+ FT_Int scaling;
+
+
+ if ( top->units_per_em > 1 && sub->units_per_em > 1 )
+ scaling = FT_MIN( top->units_per_em, sub->units_per_em );
+ else
+ scaling = 1;
+
+ FT_Matrix_Multiply_Scaled( &top->font_matrix,
+ &sub->font_matrix,
+ scaling );
+ FT_Vector_Transform_Scaled( &sub->font_offset,
+ &top->font_matrix,
+ scaling );
+
+ sub->units_per_em = FT_MulDiv( sub->units_per_em,
+ top->units_per_em,
+ scaling );
+ }
+ else
+ {
+ sub->font_matrix = top->font_matrix;
+ sub->font_offset = top->font_offset;
+
+ sub->units_per_em = top->units_per_em;
+ }
+
+ matrix = &sub->font_matrix;
+ offset = &sub->font_offset;
+ upm = &sub->units_per_em;
+ temp = FT_ABS( matrix->yy );
+
+ if ( temp != 0x10000L )
+ {
+ *upm = FT_DivFix( *upm, temp );
+
+ /* if *upm is larger than 100*1000 we divide by 1000 -- */
+ /* this can happen if e.g. there is no top-font FontMatrix */
+ /* and the subfont FontMatrix already contains the complete */
+ /* scaling for the subfont (see section 5.11 of the PLRM) */
+
+ /* 100 is a heuristic value */
+
+ if ( *upm > 100L * 1000L )
+ *upm = ( *upm + 500 ) / 1000;
+
+ matrix->xx = FT_DivFix( matrix->xx, temp );
+ matrix->yx = FT_DivFix( matrix->yx, temp );
+ matrix->xy = FT_DivFix( matrix->xy, temp );
+ matrix->yy = FT_DivFix( matrix->yy, temp );
+ offset->x = FT_DivFix( offset->x, temp );
+ offset->y = FT_DivFix( offset->y, temp );
+ }
+
+ offset->x >>= 16;
+ offset->y >>= 16;
+ }
+
if ( pure_cff )
{
char* style_name = NULL;
@@ -554,10 +660,7 @@
cffface->bbox.xMax = ( dict->font_bbox.xMax + 0xFFFFU ) >> 16;
cffface->bbox.yMax = ( dict->font_bbox.yMax + 0xFFFFU ) >> 16;
- if ( !dict->units_per_em )
- dict->units_per_em = 1000;
-
- cffface->units_per_EM = dict->units_per_em;
+ cffface->units_per_EM = (FT_UShort)( dict->units_per_em );
cffface->ascender = (FT_Short)( cffface->bbox.yMax );
cffface->descender = (FT_Short)( cffface->bbox.yMin );
@@ -711,113 +814,7 @@
cffface->style_flags = flags;
}
- else
- {
- if ( !dict->units_per_em )
- dict->units_per_em = face->root.units_per_EM;
- }
-
- /* Normalize the font matrix so that `matrix->xx' is 1; the */
- /* scaling is done with `units_per_em' then (at this point, */
- /* it already contains the scaling factor, but without */
- /* normalization of the matrix). */
- /* */
- /* Note that the offsets must be expressed in integer font */
- /* units. */
- {
- FT_Matrix* matrix = &dict->font_matrix;
- FT_Vector* offset = &dict->font_offset;
- FT_ULong* upm = &dict->units_per_em;
- FT_Fixed temp = FT_ABS( matrix->yy );
-
-
- if ( temp != 0x10000L )
- {
- *upm = FT_DivFix( *upm, temp );
-
- matrix->xx = FT_DivFix( matrix->xx, temp );
- matrix->yx = FT_DivFix( matrix->yx, temp );
- matrix->xy = FT_DivFix( matrix->xy, temp );
- matrix->yy = FT_DivFix( matrix->yy, temp );
- offset->x = FT_DivFix( offset->x, temp );
- offset->y = FT_DivFix( offset->y, temp );
- }
-
- offset->x >>= 16;
- offset->y >>= 16;
- }
-
- for ( i = cff->num_subfonts; i > 0; i-- )
- {
- CFF_FontRecDict sub = &cff->subfonts[i - 1]->font_dict;
- CFF_FontRecDict top = &cff->top_font.font_dict;
-
- FT_Matrix* matrix;
- FT_Vector* offset;
- FT_ULong* upm;
- FT_Fixed temp;
-
-
- if ( sub->units_per_em )
- {
- FT_Int scaling;
-
-
- if ( top->units_per_em > 1 && sub->units_per_em > 1 )
- scaling = FT_MIN( top->units_per_em, sub->units_per_em );
- else
- scaling = 1;
-
- FT_Matrix_Multiply_Scaled( &top->font_matrix,
- &sub->font_matrix,
- scaling );
- FT_Vector_Transform_Scaled( &sub->font_offset,
- &top->font_matrix,
- scaling );
-
- sub->units_per_em = FT_MulDiv( sub->units_per_em,
- top->units_per_em,
- scaling );
- }
- else
- {
- sub->font_matrix = top->font_matrix;
- sub->font_offset = top->font_offset;
-
- sub->units_per_em = top->units_per_em;
- }
-
- matrix = &sub->font_matrix;
- offset = &sub->font_offset;
- upm = &sub->units_per_em;
- temp = FT_ABS( matrix->yy );
-
- if ( temp != 0x10000L )
- {
- *upm = FT_DivFix( *upm, temp );
-
- /* if *upm is larger than 100*1000 we divide by 1000 -- */
- /* this can happen if e.g. there is no top-font FontMatrix */
- /* and the subfont FontMatrix already contains the complete */
- /* scaling for the subfont (see section 5.11 of the PLRM) */
-
- /* 100 is a heuristic value */
-
- if ( *upm > 100L * 1000L )
- *upm = ( *upm + 500 ) / 1000;
-
- matrix->xx = FT_DivFix( matrix->xx, temp );
- matrix->yx = FT_DivFix( matrix->yx, temp );
- matrix->xy = FT_DivFix( matrix->xy, temp );
- matrix->yy = FT_DivFix( matrix->yy, temp );
- offset->x = FT_DivFix( offset->x, temp );
- offset->y = FT_DivFix( offset->y, temp );
- }
-
- offset->x >>= 16;
- offset->y >>= 16;
- }
#ifndef FT_CONFIG_OPTION_NO_GLYPH_NAMES
/* CID-keyed CFF fonts don't have glyph names -- the SFNT loader */
@@ -826,7 +823,7 @@
cffface->face_flags |= FT_FACE_FLAG_GLYPH_NAMES;
#endif
- if ( dict->cid_registry != 0xFFFFU )
+ if ( dict->cid_registry != 0xFFFFU && pure_cff )
cffface->face_flags |= FT_FACE_FLAG_CID_KEYED;
@@ -835,7 +832,7 @@
/* Compute char maps. */
/* */
- /* Try to synthetize a Unicode charmap if there is none available */
+ /* Try to synthesize a Unicode charmap if there is none available */
/* already. If an OpenType font contains a Unicode "cmap", we */
/* will use it, whatever be in the CFF part of the file. */
{
@@ -922,10 +919,16 @@
FT_LOCAL_DEF( void )
cff_face_done( FT_Face cffface ) /* CFF_Face */
{
- CFF_Face face = (CFF_Face)cffface;
- FT_Memory memory = cffface->memory;
- SFNT_Service sfnt = (SFNT_Service)face->sfnt;
+ CFF_Face face = (CFF_Face)cffface;
+ FT_Memory memory;
+ SFNT_Service sfnt;
+
+
+ if ( !face )
+ return;
+ memory = cffface->memory;
+ sfnt = (SFNT_Service)face->sfnt;
if ( sfnt )
sfnt->done_face( face );
diff --git a/src/cff/cffparse.c b/src/cff/cffparse.c
index d6d77dd..290595f 100644
--- a/src/cff/cffparse.c
+++ b/src/cff/cffparse.c
@@ -4,7 +4,7 @@
/* */
/* CFF token stream parser (body) */
/* */
-/* Copyright 1996-2001, 2002, 2003, 2004, 2007, 2008 by */
+/* Copyright 1996-2001, 2002, 2003, 2004, 2007, 2008, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -244,7 +244,7 @@
if ( !nib && !number )
exponent_add--;
/* Only add digit if we don't overflow. */
- else if ( number < 0xCCCCCCCL )
+ else if ( number < 0xCCCCCCCL && fraction_length < 9 )
{
fraction_length++;
number = number * 10 + nib;
@@ -355,6 +355,12 @@
if ( FT_ABS( integer_length ) > 5 )
goto Exit;
+ /* Remove non-significant digits. */
+ if ( integer_length < 0 ) {
+ number /= power_tens[-integer_length];
+ fraction_length += integer_length;
+ }
+
/* Convert into 16.16 format. */
if ( fraction_length > 0 )
{
@@ -406,10 +412,9 @@
cff_parse_fixed_scaled( FT_Byte** d,
FT_Int scaling )
{
- return **d ==
- 30 ? cff_parse_real( d[0], d[1], scaling, NULL )
- : (FT_Fixed)FT_MulFix( cff_parse_integer( d[0], d[1] ) << 16,
- power_tens[scaling] );
+ return **d == 30 ? cff_parse_real( d[0], d[1], scaling, NULL )
+ : ( cff_parse_integer( d[0], d[1] ) *
+ power_tens[scaling] ) << 16;
}
diff --git a/src/psaux/afmparse.c b/src/psaux/afmparse.c
index 0528fe6..63a786e 100644
--- a/src/psaux/afmparse.c
+++ b/src/psaux/afmparse.c
@@ -4,7 +4,7 @@
/* */
/* AFM parser (body). */
/* */
-/* Copyright 2006, 2007 by */
+/* Copyright 2006, 2007, 2008 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -672,7 +672,12 @@
FT_ULong index2 = KERN_INDEX( kp2->index1, kp2->index2 );
- return (int)( index1 - index2 );
+ if ( index1 > index2 )
+ return 1;
+ else if ( index1 < index2 )
+ return -1;
+ else
+ return 0;
}
diff --git a/src/psaux/psobjs.c b/src/psaux/psobjs.c
index b7b84ac..52e30a4 100644
--- a/src/psaux/psobjs.c
+++ b/src/psaux/psobjs.c
@@ -4,7 +4,7 @@
/* */
/* Auxiliary functions for PostScript fonts (body). */
/* */
-/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by */
+/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -175,11 +175,17 @@
return PSaux_Err_Invalid_Argument;
}
+ if ( length < 0 )
+ {
+ FT_ERROR(( "ps_table_add: invalid length\n" ));
+ return PSaux_Err_Invalid_Argument;
+ }
+
/* grow the base block if needed */
if ( table->cursor + length > table->capacity )
{
FT_Error error;
- FT_Offset new_size = table->capacity;
+ FT_Offset new_size = table->capacity;
FT_Long in_offset;
@@ -376,7 +382,7 @@
/* skip octal escape or ignore backslash */
for ( i = 0; i < 3 && cur < limit; ++i )
{
- if ( ! IS_OCTAL_DIGIT( *cur ) )
+ if ( !IS_OCTAL_DIGIT( *cur ) )
break;
++cur;
@@ -1259,8 +1265,9 @@
old_cursor = parser->cursor;
old_limit = parser->limit;
- /* we store the elements count if necessary */
- if ( field->type != T1_FIELD_TYPE_BBOX )
+ /* we store the elements count if necessary; */
+ /* we further assume that `count_offset' can't be zero */
+ if ( field->type != T1_FIELD_TYPE_BBOX && field->count_offset != 0 )
*(FT_Byte*)( (FT_Byte*)objects[0] + field->count_offset ) =
(FT_Byte)num_elements;
@@ -1634,27 +1641,24 @@
t1_builder_close_contour( T1_Builder builder )
{
FT_Outline* outline = builder->current;
+ FT_Int first;
if ( !outline )
return;
- /* XXXX: We must not include the last point in the path if it */
- /* is located on the first point. */
+ first = outline->n_contours <= 1
+ ? 0 : outline->contours[outline->n_contours - 2] + 1;
+
+ /* We must not include the last point in the path if it */
+ /* is located on the first point. */
if ( outline->n_points > 1 )
{
- FT_Int first = 0;
FT_Vector* p1 = outline->points + first;
FT_Vector* p2 = outline->points + outline->n_points - 1;
FT_Byte* control = (FT_Byte*)outline->tags + outline->n_points - 1;
- if ( outline->n_contours > 1 )
- {
- first = outline->contours[outline->n_contours - 2] + 1;
- p1 = outline->points + first;
- }
-
/* `delete' last point only if it coincides with the first */
/* point and it is not a control point (which can happen). */
if ( p1->x == p2->x && p1->y == p2->y )
@@ -1663,8 +1667,18 @@
}
if ( outline->n_contours > 0 )
- outline->contours[outline->n_contours - 1] =
- (short)( outline->n_points - 1 );
+ {
+ /* Don't add contours only consisting of one point, i.e., */
+ /* check whether begin point and last point are the same. */
+ if ( first == outline->n_points - 1 )
+ {
+ outline->n_contours--;
+ outline->n_points--;
+ }
+ else
+ outline->contours[outline->n_contours - 1] =
+ (short)( outline->n_points - 1 );
+ }
}
diff --git a/src/psaux/t1decode.c b/src/psaux/t1decode.c
index 550ba64..bda2324 100644
--- a/src/psaux/t1decode.c
+++ b/src/psaux/t1decode.c
@@ -4,7 +4,7 @@
/* */
/* PostScript Type 1 decoding routines (body). */
/* */
-/* Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by */
+/* Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -354,10 +354,9 @@
( decoder->buildchar == NULL ) );
if ( decoder->len_buildchar > 0 )
- memset( &decoder->buildchar[0],
- 0,
- sizeof( decoder->buildchar[0] ) *
- decoder->len_buildchar );
+ ft_memset( &decoder->buildchar[0],
+ 0,
+ sizeof( decoder->buildchar[0] ) * decoder->len_buildchar );
FT_TRACE4(( "\nStart charstring\n" ));
@@ -777,10 +776,10 @@
idx + blend->num_designs > decoder->face->len_buildchar )
goto Unexpected_OtherSubr;
- memcpy( &decoder->buildchar[idx],
- blend->weight_vector,
- blend->num_designs *
- sizeof( blend->weight_vector[ 0 ] ) );
+ ft_memcpy( &decoder->buildchar[idx],
+ blend->weight_vector,
+ blend->num_designs *
+ sizeof( blend->weight_vector[0] ) );
}
break;
diff --git a/src/pshinter/pshalgo.c b/src/pshinter/pshalgo.c
index 5d7e2f4..f9ab3da 100644
--- a/src/pshinter/pshalgo.c
+++ b/src/pshinter/pshalgo.c
@@ -4,7 +4,7 @@
/* */
/* PostScript hinting algorithm (body). */
/* */
-/* Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by */
+/* Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used */
@@ -898,7 +898,7 @@
#ifdef DEBUG_ZONES
-#include <stdio.h>
+#include FT_CONFIG_STANDARD_LIBRARY_H
static void
psh_print_zone( PSH_Zone zone )
diff --git a/src/psnames/psmodule.c b/src/psnames/psmodule.c
index dbcfe44..41942a9 100644
--- a/src/psnames/psmodule.c
+++ b/src/psnames/psmodule.c
@@ -174,18 +174,34 @@
/* sort base glyphs before glyph variants */
if ( unicode1 == unicode2 )
- return map1->unicode - map2->unicode;
+ {
+ if ( map1->unicode > map2->unicode )
+ return 1;
+ else if ( map1->unicode < map2->unicode )
+ return -1;
+ else
+ return 0;
+ }
else
- return unicode1 - unicode2;
+ {
+ if ( unicode1 > unicode2 )
+ return 1;
+ else if ( unicode1 < unicode2 )
+ return -1;
+ else
+ return 0;
+ }
}
- /* support for old WGL4 fonts */
+ /* support for extra glyphs not handled (well) in AGL; */
+ /* we add extra mappings for them if necessary */
-#define WGL_EXTRA_LIST_SIZE 8
+#define EXTRA_GLYPH_LIST_SIZE 10
- static const FT_UInt32 ft_wgl_extra_unicodes[WGL_EXTRA_LIST_SIZE] =
+ static const FT_UInt32 ft_extra_glyph_unicodes[EXTRA_GLYPH_LIST_SIZE] =
{
+ /* WGL 4 */
0x0394,
0x03A9,
0x2215,
@@ -193,10 +209,13 @@
0x02C9,
0x03BC,
0x2219,
- 0x00A0
+ 0x00A0,
+ /* Romanian */
+ 0x021A,
+ 0x021B
};
- static const char ft_wgl_extra_glyph_names[] =
+ static const char ft_extra_glyph_names[] =
{
'D','e','l','t','a',0,
'O','m','e','g','a',0,
@@ -205,11 +224,13 @@
'm','a','c','r','o','n',0,
'm','u',0,
'p','e','r','i','o','d','c','e','n','t','e','r','e','d',0,
- 's','p','a','c','e',0
+ 's','p','a','c','e',0,
+ 'T','c','o','m','m','a','a','c','c','e','n','t',0,
+ 't','c','o','m','m','a','a','c','c','e','n','t',0
};
static const FT_Int
- ft_wgl_extra_glyph_name_offsets[WGL_EXTRA_LIST_SIZE] =
+ ft_extra_glyph_name_offsets[EXTRA_GLYPH_LIST_SIZE] =
{
0,
6,
@@ -218,29 +239,31 @@
28,
35,
38,
- 53
+ 53,
+ 59,
+ 72
};
static void
- ps_check_wgl_name( const char* gname,
- FT_UInt glyph,
- FT_UInt* wgl_glyphs,
- FT_UInt *states )
+ ps_check_extra_glyph_name( const char* gname,
+ FT_UInt glyph,
+ FT_UInt* extra_glyphs,
+ FT_UInt *states )
{
FT_UInt n;
- for ( n = 0; n < WGL_EXTRA_LIST_SIZE; n++ )
+ for ( n = 0; n < EXTRA_GLYPH_LIST_SIZE; n++ )
{
- if ( ft_strcmp( ft_wgl_extra_glyph_names +
- ft_wgl_extra_glyph_name_offsets[n], gname ) == 0 )
+ if ( ft_strcmp( ft_extra_glyph_names +
+ ft_extra_glyph_name_offsets[n], gname ) == 0 )
{
if ( states[n] == 0 )
{
- /* mark this WGL extra glyph as a candidate for the cmap */
+ /* mark this extra glyph as a candidate for the cmap */
states[n] = 1;
- wgl_glyphs[n] = glyph;
+ extra_glyphs[n] = glyph;
}
return;
@@ -250,17 +273,17 @@
static void
- ps_check_wgl_unicode( FT_UInt32 uni_char,
- FT_UInt *states )
+ ps_check_extra_glyph_unicode( FT_UInt32 uni_char,
+ FT_UInt *states )
{
FT_UInt n;
- for ( n = 0; n < WGL_EXTRA_LIST_SIZE; n++ )
+ for ( n = 0; n < EXTRA_GLYPH_LIST_SIZE; n++ )
{
- if ( uni_char == ft_wgl_extra_unicodes[n] )
+ if ( uni_char == ft_extra_glyph_unicodes[n] )
{
- /* disable this WGL extra glyph from being added to the cmap */
+ /* disable this extra glyph from being added to the cmap */
states[n] = 2;
return;
@@ -280,15 +303,15 @@
{
FT_Error error;
- FT_UInt wgl_list_states[] = { 0, 0, 0, 0, 0, 0, 0, 0 };
- FT_UInt wgl_glyphs[WGL_EXTRA_LIST_SIZE];
+ FT_UInt extra_glyph_list_states[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
+ FT_UInt extra_glyphs[EXTRA_GLYPH_LIST_SIZE];
/* we first allocate the table */
table->num_maps = 0;
table->maps = 0;
- if ( !FT_NEW_ARRAY( table->maps, num_glyphs + WGL_EXTRA_LIST_SIZE ) )
+ if ( !FT_NEW_ARRAY( table->maps, num_glyphs + EXTRA_GLYPH_LIST_SIZE ) )
{
FT_UInt n;
FT_UInt count;
@@ -305,12 +328,14 @@
if ( gname )
{
- ps_check_wgl_name( gname, n, wgl_glyphs, wgl_list_states );
+ ps_check_extra_glyph_name( gname, n,
+ extra_glyphs, extra_glyph_list_states );
uni_char = ps_unicode_value( gname );
if ( BASE_GLYPH( uni_char ) != 0 )
{
- ps_check_wgl_unicode( uni_char, wgl_list_states );
+ ps_check_extra_glyph_unicode( uni_char,
+ extra_glyph_list_states );
map->unicode = uni_char;
map->glyph_index = n;
map++;
@@ -321,15 +346,15 @@
}
}
- for ( n = 0; n < WGL_EXTRA_LIST_SIZE; n++ )
+ for ( n = 0; n < EXTRA_GLYPH_LIST_SIZE; n++ )
{
- if ( wgl_list_states[n] == 1 )
+ if ( extra_glyph_list_states[n] == 1 )
{
- /* This glyph name has an additional WGL4 representation. */
- /* Add it to the cmap. */
+ /* This glyph name has an additional representation. */
+ /* Add it to the cmap. */
- map->unicode = ft_wgl_extra_unicodes[n];
- map->glyph_index = wgl_glyphs[n];
+ map->unicode = ft_extra_glyph_unicodes[n];
+ map->glyph_index = extra_glyphs[n];
map++;
}
}
diff --git a/src/psnames/pstables.h b/src/psnames/pstables.h
index cc40ef7..1521e9c 100644
--- a/src/psnames/pstables.h
+++ b/src/psnames/pstables.h
@@ -4,7 +4,7 @@
/* */
/* PostScript glyph names. */
/* */
-/* Copyright 2005 by */
+/* Copyright 2005, 2008 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -561,7 +561,10 @@
* The lookup function to get the Unicode value for a given string
* is defined below the table.
*/
- static const unsigned char ft_adobe_glyph_list[54791] =
+
+#ifdef FT_CONFIG_OPTION_ADOBE_GLYPH_LIST
+
+ static const unsigned char ft_adobe_glyph_list[54791L] =
{
0, 52, 0,106, 2,167, 3, 63, 4,220, 6,125, 9,143, 10, 23,
11,137, 12,199, 14,246, 15, 87, 16,233, 17,219, 18,104, 19, 88,
@@ -4086,5 +4089,7 @@
return 0;
}
+#endif /* FT_CONFIG_OPTION_ADOBE_GLYPH_LIST */
+
/* END */
diff --git a/src/raster/ftmisc.h b/src/raster/ftmisc.h
index c5dbd50..d9d73e3 100644
--- a/src/raster/ftmisc.h
+++ b/src/raster/ftmisc.h
@@ -5,7 +5,7 @@
/* Miscellaneous macros for stand-alone rasterizer (specification */
/* only). */
/* */
-/* Copyright 2005 by */
+/* Copyright 2005, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used */
@@ -27,7 +27,8 @@
#ifndef __FTMISC_H__
#define __FTMISC_H__
-#include <string.h> /* memset */
+ /* memset */
+#include FT_CONFIG_STANDARD_LIBRARY_H
#define FT_BEGIN_HEADER
#define FT_END_HEADER
diff --git a/src/raster/ftraster.c b/src/raster/ftraster.c
index 86d77d4..eb9c4a4 100644
--- a/src/raster/ftraster.c
+++ b/src/raster/ftraster.c
@@ -4,7 +4,7 @@
/* */
/* The FreeType glyph rasterizer (body). */
/* */
-/* Copyright 1996-2001, 2002, 2003, 2005, 2007, 2008 by */
+/* Copyright 1996-2001, 2002, 2003, 2005, 2007, 2008, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -181,13 +181,13 @@
/* Disable the tracing mechanism for simplicity -- developers can */
/* activate it easily by redefining these two macros. */
#ifndef FT_ERROR
-#define FT_ERROR( x ) do ; while ( 0 ) /* nothing */
+#define FT_ERROR( x ) do { } while ( 0 ) /* nothing */
#endif
#ifndef FT_TRACE
-#define FT_TRACE( x ) do ; while ( 0 ) /* nothing */
-#define FT_TRACE1( x ) do ; while ( 0 ) /* nothing */
-#define FT_TRACE6( x ) do ; while ( 0 ) /* nothing */
+#define FT_TRACE( x ) do { } while ( 0 ) /* nothing */
+#define FT_TRACE1( x ) do { } while ( 0 ) /* nothing */
+#define FT_TRACE6( x ) do { } while ( 0 ) /* nothing */
#endif
#define Raster_Err_None 0
@@ -370,7 +370,7 @@
#define RAS_VARS /* void */
#define RAS_VAR /* void */
-#define FT_UNUSED_RASTER do ; while ( 0 )
+#define FT_UNUSED_RASTER do { } while ( 0 )
#else /* FT_STATIC_RASTER */
@@ -388,7 +388,7 @@
#endif /* FT_STATIC_RASTER */
- typedef struct TWorker_ TWorker, *PWorker;
+ typedef struct TWorker_ TWorker, *PWorker;
/* prototypes used for sweep function dispatch */
@@ -518,7 +518,7 @@
};
- typedef struct TRaster_
+ typedef struct TRaster_
{
char* buffer;
long buffer_size;
@@ -531,7 +531,7 @@
#ifdef FT_STATIC_RASTER
- static TWorker cur_ras;
+ static TWorker cur_ras;
#define ras cur_ras
#else
@@ -543,24 +543,25 @@
#ifdef FT_RASTER_OPTION_ANTI_ALIASING
-static const char count_table[256] =
-{
- 0 , 1 , 1 , 2 , 1 , 2 , 2 , 3 , 1 , 2 , 2 , 3 , 2 , 3 , 3 , 4,
- 1 , 2 , 2 , 3 , 2 , 3 , 3 , 4 , 2 , 3 , 3 , 4 , 3 , 4 , 4 , 5,
- 1 , 2 , 2 , 3 , 2 , 3 , 3 , 4 , 2 , 3 , 3 , 4 , 3 , 4 , 4 , 5,
- 2 , 3 , 3 , 4 , 3 , 4 , 4 , 5 , 3 , 4 , 4 , 5 , 4 , 5 , 5 , 6,
- 1 , 2 , 2 , 3 , 2 , 3 , 3 , 4 , 2 , 3 , 3 , 4 , 3 , 4 , 4 , 5,
- 2 , 3 , 3 , 4 , 3 , 4 , 4 , 5 , 3 , 4 , 4 , 5 , 4 , 5 , 5 , 6,
- 2 , 3 , 3 , 4 , 3 , 4 , 4 , 5 , 3 , 4 , 4 , 5 , 4 , 5 , 5 , 6,
- 3 , 4 , 4 , 5 , 4 , 5 , 5 , 6 , 4 , 5 , 5 , 6 , 5 , 6 , 6 , 7,
- 1 , 2 , 2 , 3 , 2 , 3 , 3 , 4 , 2 , 3 , 3 , 4 , 3 , 4 , 4 , 5,
- 2 , 3 , 3 , 4 , 3 , 4 , 4 , 5 , 3 , 4 , 4 , 5 , 4 , 5 , 5 , 6,
- 2 , 3 , 3 , 4 , 3 , 4 , 4 , 5 , 3 , 4 , 4 , 5 , 4 , 5 , 5 , 6,
- 3 , 4 , 4 , 5 , 4 , 5 , 5 , 6 , 4 , 5 , 5 , 6 , 5 , 6 , 6 , 7,
- 2 , 3 , 3 , 4 , 3 , 4 , 4 , 5 , 3 , 4 , 4 , 5 , 4 , 5 , 5 , 6,
- 3 , 4 , 4 , 5 , 4 , 5 , 5 , 6 , 4 , 5 , 5 , 6 , 5 , 6 , 6 , 7,
- 3 , 4 , 4 , 5 , 4 , 5 , 5 , 6 , 4 , 5 , 5 , 6 , 5 , 6 , 6 , 7,
- 4 , 5 , 5 , 6 , 5 , 6 , 6 , 7 , 5 , 6 , 6 , 7 , 6 , 7 , 7 , 8 };
+ static const char count_table[256] =
+ {
+ 0 , 1 , 1 , 2 , 1 , 2 , 2 , 3 , 1 , 2 , 2 , 3 , 2 , 3 , 3 , 4,
+ 1 , 2 , 2 , 3 , 2 , 3 , 3 , 4 , 2 , 3 , 3 , 4 , 3 , 4 , 4 , 5,
+ 1 , 2 , 2 , 3 , 2 , 3 , 3 , 4 , 2 , 3 , 3 , 4 , 3 , 4 , 4 , 5,
+ 2 , 3 , 3 , 4 , 3 , 4 , 4 , 5 , 3 , 4 , 4 , 5 , 4 , 5 , 5 , 6,
+ 1 , 2 , 2 , 3 , 2 , 3 , 3 , 4 , 2 , 3 , 3 , 4 , 3 , 4 , 4 , 5,
+ 2 , 3 , 3 , 4 , 3 , 4 , 4 , 5 , 3 , 4 , 4 , 5 , 4 , 5 , 5 , 6,
+ 2 , 3 , 3 , 4 , 3 , 4 , 4 , 5 , 3 , 4 , 4 , 5 , 4 , 5 , 5 , 6,
+ 3 , 4 , 4 , 5 , 4 , 5 , 5 , 6 , 4 , 5 , 5 , 6 , 5 , 6 , 6 , 7,
+ 1 , 2 , 2 , 3 , 2 , 3 , 3 , 4 , 2 , 3 , 3 , 4 , 3 , 4 , 4 , 5,
+ 2 , 3 , 3 , 4 , 3 , 4 , 4 , 5 , 3 , 4 , 4 , 5 , 4 , 5 , 5 , 6,
+ 2 , 3 , 3 , 4 , 3 , 4 , 4 , 5 , 3 , 4 , 4 , 5 , 4 , 5 , 5 , 6,
+ 3 , 4 , 4 , 5 , 4 , 5 , 5 , 6 , 4 , 5 , 5 , 6 , 5 , 6 , 6 , 7,
+ 2 , 3 , 3 , 4 , 3 , 4 , 4 , 5 , 3 , 4 , 4 , 5 , 4 , 5 , 5 , 6,
+ 3 , 4 , 4 , 5 , 4 , 5 , 5 , 6 , 4 , 5 , 5 , 6 , 5 , 6 , 6 , 7,
+ 3 , 4 , 4 , 5 , 4 , 5 , 5 , 6 , 4 , 5 , 5 , 6 , 5 , 6 , 6 , 7,
+ 4 , 5 , 5 , 6 , 5 , 6 , 6 , 7 , 5 , 6 , 6 , 7 , 6 , 7 , 7 , 8
+a };
#endif /* FT_RASTER_OPTION_ANTI_ALIASING */
@@ -581,7 +582,7 @@ static const char count_table[256] =
/* Set_High_Precision */
/* */
/* <Description> */
- /* Sets precision variables according to param flag. */
+ /* Set precision variables according to param flag. */
/* */
/* <Input> */
/* High :: Set to True for high precision (typically for ppem < 18), */
@@ -618,7 +619,7 @@ static const char count_table[256] =
/* New_Profile */
/* */
/* <Description> */
- /* Creates a new profile in the render pool. */
+ /* Create a new profile in the render pool. */
/* */
/* <Input> */
/* aState :: The state/orientation of the new profile. */
@@ -684,7 +685,7 @@ static const char count_table[256] =
/* End_Profile */
/* */
/* <Description> */
- /* Finalizes the current profile. */
+ /* Finalize the current profile. */
/* */
/* <Return> */
/* SUCCESS on success. FAILURE in case of overflow or incoherency. */
@@ -741,7 +742,7 @@ static const char count_table[256] =
/* Insert_Y_Turn */
/* */
/* <Description> */
- /* Inserts a salient into the sorted list placed on top of the render */
+ /* Insert a salient into the sorted list placed on top of the render */
/* pool. */
/* */
/* <Input> */
@@ -796,7 +797,7 @@ static const char count_table[256] =
/* Finalize_Profile_Table */
/* */
/* <Description> */
- /* Adjusts all links in the profiles list. */
+ /* Adjust all links in the profiles list. */
/* */
/* <Return> */
/* SUCCESS on success. FAILURE in case of overflow. */
@@ -810,10 +811,10 @@ static const char count_table[256] =
n = ras.num_Profs;
+ p = ras.fProfile;
- if ( n > 1 )
+ if ( n > 1 && p )
{
- p = ras.fProfile;
while ( n > 0 )
{
if ( n > 1 )
@@ -857,7 +858,7 @@ static const char count_table[256] =
/* Split_Conic */
/* */
/* <Description> */
- /* Subdivides one conic Bezier into two joint sub-arcs in the Bezier */
+ /* Subdivide one conic Bezier into two joint sub-arcs in the Bezier */
/* stack. */
/* */
/* <Input> */
@@ -896,7 +897,7 @@ static const char count_table[256] =
/* Split_Cubic */
/* */
/* <Description> */
- /* Subdivides a third-order Bezier arc into two joint sub-arcs in the */
+ /* Subdivide a third-order Bezier arc into two joint sub-arcs in the */
/* Bezier stack. */
/* */
/* <Note> */
@@ -938,7 +939,7 @@ static const char count_table[256] =
/* Line_Up */
/* */
/* <Description> */
- /* Computes the x-coordinates of an ascending line segment and stores */
+ /* Compute the x-coordinates of an ascending line segment and store */
/* them in the render pool. */
/* */
/* <Input> */
@@ -1077,8 +1078,8 @@ static const char count_table[256] =
/* Line_Down */
/* */
/* <Description> */
- /* Computes the x-coordinates of an descending line segment and */
- /* stores them in the render pool. */
+ /* Compute the x-coordinates of an descending line segment and store */
+ /* them in the render pool. */
/* */
/* <Input> */
/* x1 :: The x-coordinate of the segment's start point. */
@@ -1128,7 +1129,7 @@ static const char count_table[256] =
/* Bezier_Up */
/* */
/* <Description> */
- /* Computes the x-coordinates of an ascending Bezier arc and stores */
+ /* Compute the x-coordinates of an ascending Bezier arc and store */
/* them in the render pool. */
/* */
/* <Input> */
@@ -1261,7 +1262,7 @@ static const char count_table[256] =
/* Bezier_Down */
/* */
/* <Description> */
- /* Computes the x-coordinates of an descending Bezier arc and stores */
+ /* Compute the x-coordinates of an descending Bezier arc and store */
/* them in the render pool. */
/* */
/* <Input> */
@@ -1310,7 +1311,7 @@ static const char count_table[256] =
/* Line_To */
/* */
/* <Description> */
- /* Injects a new line segment and adjusts Profiles list. */
+ /* Inject a new line segment and adjust the Profiles list. */
/* */
/* <Input> */
/* x :: The x-coordinate of the segment's end point (its start point */
@@ -1400,7 +1401,7 @@ static const char count_table[256] =
/* Conic_To */
/* */
/* <Description> */
- /* Injects a new conic arc and adjusts the profile list. */
+ /* Inject a new conic arc and adjust the profile list. */
/* */
/* <Input> */
/* cx :: The x-coordinate of the arc's new control point. */
@@ -1510,7 +1511,7 @@ static const char count_table[256] =
/* Cubic_To */
/* */
/* <Description> */
- /* Injects a new cubic arc and adjusts the profile list. */
+ /* Inject a new cubic arc and adjust the profile list. */
/* */
/* <Input> */
/* cx1 :: The x-coordinate of the arc's first new control point. */
@@ -1648,7 +1649,7 @@ static const char count_table[256] =
/* Decompose_Curve */
/* */
/* <Description> */
- /* Scans the outline arrays in order to emit individual segments and */
+ /* Scan the outline arrays in order to emit individual segments and */
/* Beziers by calling Line_To() and Bezier_To(). It handles all */
/* weird cases, like when the first point is off the curve, or when */
/* there are simply no `on' points in the contour! */
@@ -1869,7 +1870,7 @@ static const char count_table[256] =
/* Convert_Glyph */
/* */
/* <Description> */
- /* Converts a glyph into a series of segments and arcs and makes a */
+ /* Convert a glyph into a series of segments and arcs and make a */
/* profiles list with them. */
/* */
/* <Input> */
@@ -2150,8 +2151,10 @@ static const char count_table[256] =
f1 = (Byte) ( 0xFF >> ( e1 & 7 ) );
f2 = (Byte) ~( 0x7F >> ( e2 & 7 ) );
- if ( ras.gray_min_x > c1 ) ras.gray_min_x = (short)c1;
- if ( ras.gray_max_x < c2 ) ras.gray_max_x = (short)c2;
+ if ( ras.gray_min_x > c1 )
+ ras.gray_min_x = (short)c1;
+ if ( ras.gray_max_x < c2 )
+ ras.gray_max_x = (short)c2;
target = ras.bTarget + ras.traceOfs + c1;
c2 -= c1;
@@ -2184,14 +2187,36 @@ static const char count_table[256] =
PProfile left,
PProfile right )
{
- Long e1, e2;
+ Long e1, e2, pxl;
Short c1, f1;
/* Drop-out control */
- e1 = CEILING( x1 );
- e2 = FLOOR ( x2 );
+ /* e2 x2 x1 e1 */
+ /* */
+ /* ^ | */
+ /* | | */
+ /* +-------------+---------------------+------------+ */
+ /* | | */
+ /* | v */
+ /* */
+ /* pixel contour contour pixel */
+ /* center center */
+
+ /* drop-out mode scan conversion rules (as defined in OpenType) */
+ /* --------------------------------------------------------------- */
+ /* 0 1, 2, 3 */
+ /* 1 1, 2, 4 */
+ /* 2 1, 2 */
+ /* 3 same as mode 2 */
+ /* 4 1, 2, 5 */
+ /* 5 1, 2, 6 */
+ /* 6, 7 same as mode 2 */
+
+ e1 = CEILING( x1 );
+ e2 = FLOOR ( x2 );
+ pxl = e1;
if ( e1 > e2 )
{
@@ -2199,19 +2224,20 @@ static const char count_table[256] =
{
switch ( ras.dropOutControl )
{
- case 1:
- e1 = e2;
+ case 0: /* simple drop-outs including stubs */
+ pxl = e2;
break;
- case 4:
- e1 = CEILING( (x1 + x2 + 1) / 2 );
+ case 4: /* smart drop-outs including stubs */
+ pxl = FLOOR( ( x1 + x2 + 1 ) / 2 + ras.precision_half );
break;
- case 2:
- case 5:
- /* Drop-out Control Rule #4 */
+ case 1: /* simple drop-outs excluding stubs */
+ case 5: /* smart drop-outs excluding stubs */
+
+ /* Drop-out Control Rules #4 and #6 */
- /* The spec is not very clear regarding rule #4. It */
+ /* The spec is not very clear regarding those rules. It */
/* presents a method that is way too costly to implement */
/* while the general idea seems to get rid of `stubs'. */
/* */
@@ -2233,7 +2259,6 @@ static const char count_table[256] =
/* FIXXXME: uncommenting this line solves the disappearing */
/* bit problem in the `7' of verdana 10pts, but */
/* makes a new one in the `C' of arial 14pts */
-
#if 0
if ( x2 - x1 < ras.precision_half )
#endif
@@ -2247,41 +2272,43 @@ static const char count_table[256] =
return;
}
- /* check that the rightmost pixel isn't set */
-
- e1 = TRUNC( e1 );
+ if ( ras.dropOutControl == 1 )
+ pxl = e2;
+ else
+ pxl = FLOOR( ( x1 + x2 + 1 ) / 2 + ras.precision_half );
+ break;
- c1 = (Short)( e1 >> 3 );
- f1 = (Short)( e1 & 7 );
+ default: /* modes 2, 3, 6, 7 */
+ return; /* no drop-out control */
+ }
- if ( e1 >= 0 && e1 < ras.bWidth &&
- ras.bTarget[ras.traceOfs + c1] & ( 0x80 >> f1 ) )
- return;
+ /* check that the other pixel isn't set */
+ e1 = pxl == e1 ? e2 : e1;
- if ( ras.dropOutControl == 2 )
- e1 = e2;
- else
- e1 = CEILING( ( x1 + x2 + 1 ) / 2 );
+ e1 = TRUNC( e1 );
- break;
+ c1 = (Short)( e1 >> 3 );
+ f1 = (Short)( e1 & 7 );
- default:
- return; /* unsupported mode */
- }
+ if ( e1 >= 0 && e1 < ras.bWidth &&
+ ras.bTarget[ras.traceOfs + c1] & ( 0x80 >> f1 ) )
+ return;
}
else
return;
}
- e1 = TRUNC( e1 );
+ e1 = TRUNC( pxl );
if ( e1 >= 0 && e1 < ras.bWidth )
{
c1 = (Short)( e1 >> 3 );
f1 = (Short)( e1 & 7 );
- if ( ras.gray_min_x > c1 ) ras.gray_min_x = c1;
- if ( ras.gray_max_x < c1 ) ras.gray_max_x = c1;
+ if ( ras.gray_min_x > c1 )
+ ras.gray_min_x = c1;
+ if ( ras.gray_max_x < c1 )
+ ras.gray_max_x = c1;
ras.bTarget[ras.traceOfs + c1] |= (char)( 0x80 >> f1 );
}
@@ -2365,15 +2392,26 @@ static const char count_table[256] =
PProfile left,
PProfile right )
{
- Long e1, e2;
+ Long e1, e2, pxl;
PByte bits;
Byte f1;
/* During the horizontal sweep, we only take care of drop-outs */
- e1 = CEILING( x1 );
- e2 = FLOOR ( x2 );
+ /* e1 + <-- pixel center */
+ /* | */
+ /* x1 ---+--> <-- contour */
+ /* | */
+ /* | */
+ /* x2 <--+--- <-- contour */
+ /* | */
+ /* | */
+ /* e2 + <-- pixel center */
+
+ e1 = CEILING( x1 );
+ e2 = FLOOR ( x2 );
+ pxl = e1;
if ( e1 > e2 )
{
@@ -2381,23 +2419,17 @@ static const char count_table[256] =
{
switch ( ras.dropOutControl )
{
- case 1:
- e1 = e2;
+ case 0: /* simple drop-outs including stubs */
+ pxl = e2;
break;
- case 4:
- e1 = CEILING( ( x1 + x2 + 1 ) / 2 );
+ case 4: /* smart drop-outs including stubs */
+ pxl = FLOOR( ( x1 + x2 + 1 ) / 2 + ras.precision_half );
break;
- case 2:
- case 5:
-
- /* Drop-out Control Rule #4 */
-
- /* The spec is not very clear regarding rule #4. It */
- /* presents a method that is way too costly to implement */
- /* while the general idea seems to get rid of `stubs'. */
- /* */
+ case 1: /* simple drop-outs excluding stubs */
+ case 5: /* smart drop-outs excluding stubs */
+ /* see Vertical_Sweep_Drop for details */
/* rightmost stub test */
if ( left->next == right && left->height <= 0 )
@@ -2407,32 +2439,32 @@ static const char count_table[256] =
if ( right->next == left && left->start == y )
return;
- /* check that the rightmost pixel isn't set */
-
- e1 = TRUNC( e1 );
+ if ( ras.dropOutControl == 1 )
+ pxl = e2;
+ else
+ pxl = FLOOR( ( x1 + x2 + 1 ) / 2 + ras.precision_half );
+ break;
- bits = ras.bTarget + ( y >> 3 );
- f1 = (Byte)( 0x80 >> ( y & 7 ) );
+ default: /* modes 2, 3, 6, 7 */
+ return; /* no drop-out control */
+ }
- bits -= e1 * ras.target.pitch;
- if ( ras.target.pitch > 0 )
- bits += ( ras.target.rows - 1 ) * ras.target.pitch;
+ /* check that the other pixel isn't set */
+ e1 = pxl == e1 ? e2 : e1;
- if ( e1 >= 0 &&
- e1 < ras.target.rows &&
- *bits & f1 )
- return;
+ e1 = TRUNC( e1 );
- if ( ras.dropOutControl == 2 )
- e1 = e2;
- else
- e1 = CEILING( ( x1 + x2 + 1 ) / 2 );
+ bits = ras.bTarget + ( y >> 3 );
+ f1 = (Byte)( 0x80 >> ( y & 7 ) );
- break;
+ bits -= e1 * ras.target.pitch;
+ if ( ras.target.pitch > 0 )
+ bits += ( ras.target.rows - 1 ) * ras.target.pitch;
- default:
- return; /* unsupported mode */
- }
+ if ( e1 >= 0 &&
+ e1 < ras.target.rows &&
+ *bits & f1 )
+ return;
}
else
return;
@@ -2441,7 +2473,7 @@ static const char count_table[256] =
bits = ras.bTarget + ( y >> 3 );
f1 = (Byte)( 0x80 >> ( y & 7 ) );
- e1 = TRUNC( e1 );
+ e1 = TRUNC( pxl );
if ( e1 >= 0 && e1 < ras.target.rows )
{
@@ -2526,10 +2558,10 @@ static const char count_table[256] =
if ( ras.gray_max_x >= 0 )
{
- Long last_pixel = ras.target.width - 1;
- Int last_cell = last_pixel >> 2;
- Int last_bit = last_pixel & 3;
- Bool over = 0;
+ Long last_pixel = ras.target.width - 1;
+ Int last_cell = last_pixel >> 2;
+ Int last_bit = last_pixel & 3;
+ Bool over = 0;
if ( ras.gray_max_x >= last_cell && last_bit != 3 )
@@ -2541,8 +2573,8 @@ static const char count_table[256] =
if ( ras.gray_min_x < 0 )
ras.gray_min_x = 0;
- bit = ras.bTarget + ras.gray_min_x;
- bit2 = bit + ras.gray_width;
+ bit = ras.bTarget + ras.gray_min_x;
+ bit2 = bit + ras.gray_width;
c1 = ras.gray_max_x - ras.gray_min_x;
@@ -2627,6 +2659,7 @@ static const char count_table[256] =
/* During the horizontal sweep, we only take care of drop-outs */
+
e1 = CEILING( x1 );
e2 = FLOOR ( x2 );
@@ -2636,23 +2669,17 @@ static const char count_table[256] =
{
switch ( ras.dropOutControl )
{
- case 1:
+ case 0: /* simple drop-outs including stubs */
e1 = e2;
break;
- case 4:
- e1 = CEILING( ( x1 + x2 + 1 ) / 2 );
+ case 4: /* smart drop-outs including stubs */
+ e1 = FLOOR( ( x1 + x2 + 1 ) / 2 + ras.precision_half );
break;
- case 2:
- case 5:
-
- /* Drop-out Control Rule #4 */
-
- /* The spec is not very clear regarding rule #4. It */
- /* presents a method that is way too costly to implement */
- /* while the general idea seems to get rid of `stubs'. */
- /* */
+ case 1: /* simple drop-outs excluding stubs */
+ case 5: /* smart drop-outs excluding stubs */
+ /* see Vertical_Sweep_Drop for details */
/* rightmost stub test */
if ( left->next == right && left->height <= 0 )
@@ -2662,15 +2689,15 @@ static const char count_table[256] =
if ( right->next == left && left->start == y )
return;
- if ( ras.dropOutControl == 2 )
+ if ( ras.dropOutControl == 1 )
e1 = e2;
else
- e1 = CEILING( ( x1 + x2 + 1 ) / 2 );
+ e1 = FLOOR( ( x1 + x2 + 1 ) / 2 + ras.precision_half );
break;
- default:
- return; /* unsupported mode */
+ default: /* modes 2, 3, 6, 7 */
+ return; /* no drop-out control */
}
}
else
@@ -2722,7 +2749,7 @@ static const char count_table[256] =
TProfileList draw_left, draw_right;
- /* Init empty linked lists */
+ /* initialize empty linked lists */
Init_Linked( &waiting );
@@ -2742,8 +2769,10 @@ static const char count_table[256] =
bottom = (Short)P->start;
top = (Short)( P->start + P->height - 1 );
- if ( min_Y > bottom ) min_Y = bottom;
- if ( max_Y < top ) max_Y = top;
+ if ( min_Y > bottom )
+ min_Y = bottom;
+ if ( max_Y < top )
+ max_Y = top;
P->X = 0;
InsNew( &waiting, P );
@@ -2751,18 +2780,18 @@ static const char count_table[256] =
P = Q;
}
- /* Check the Y-turns */
+ /* check the Y-turns */
if ( ras.numTurns == 0 )
{
ras.error = Raster_Err_Invalid;
return FAILURE;
}
- /* Now inits the sweep */
+ /* now initialize the sweep */
ras.Proc_Sweep_Init( RAS_VARS &min_Y, &max_Y );
- /* Then compute the distance of each profile from min_Y */
+ /* then compute the distance of each profile from min_Y */
P = waiting;
@@ -2772,7 +2801,7 @@ static const char count_table[256] =
P = P->link;
}
- /* Let's go */
+ /* let's go */
y = min_Y;
y_height = 0;
@@ -2783,7 +2812,7 @@ static const char count_table[256] =
while ( ras.numTurns > 0 )
{
- /* look in the waiting list for new activations */
+ /* check waiting list for new activations */
P = waiting;
@@ -2810,7 +2839,7 @@ static const char count_table[256] =
P = Q;
}
- /* Sort the drawing lists */
+ /* sort the drawing lists */
Sort( &draw_left );
Sort( &draw_right );
@@ -2820,7 +2849,7 @@ static const char count_table[256] =
while ( y < y_change )
{
- /* Let's trace */
+ /* let's trace */
dropouts = 0;
@@ -2839,22 +2868,25 @@ static const char count_table[256] =
x2 = xs;
}
- if ( x2 - x1 <= ras.precision )
- {
- e1 = FLOOR( x1 );
- e2 = CEILING( x2 );
+ e1 = FLOOR( x1 );
+ e2 = CEILING( x2 );
- if ( ras.dropOutControl != 0 &&
- ( e1 > e2 || e2 == e1 + ras.precision ) )
+ if ( x2 - x1 <= ras.precision &&
+ e1 != x1 && e2 != x2 )
+ {
+ if ( e1 > e2 || e2 == e1 + ras.precision )
{
- /* a drop out was detected */
+ if ( ras.dropOutControl != 2 )
+ {
+ /* a drop-out was detected */
- P_Left ->X = x1;
- P_Right->X = x2;
+ P_Left ->X = x1;
+ P_Right->X = x2;
- /* mark profile for drop-out processing */
- P_Left->countL = 1;
- dropouts++;
+ /* mark profile for drop-out processing */
+ P_Left->countL = 1;
+ dropouts++;
+ }
goto Skip_To_Next;
}
@@ -2868,9 +2900,9 @@ static const char count_table[256] =
P_Right = P_Right->link;
}
- /* now perform the dropouts _after_ the span drawing -- */
- /* drop-outs processing has been moved out of the loop */
- /* for performance tuning */
+ /* handle drop-outs _after_ the span drawing -- */
+ /* drop-out processing has been moved out of the loop */
+ /* for performance tuning */
if ( dropouts > 0 )
goto Scan_DropOuts;
@@ -2887,7 +2919,7 @@ static const char count_table[256] =
}
}
- /* Now finalize the profiles that needs it */
+ /* now finalize the profiles that need it */
P = draw_left;
while ( P )
@@ -2908,7 +2940,7 @@ static const char count_table[256] =
}
}
- /* for gray-scaling, flushes the bitmap scanline cache */
+ /* for gray-scaling, flush the bitmap scanline cache */
while ( y <= max_Y )
{
ras.Proc_Sweep_Step( RAS_VAR );
@@ -2951,7 +2983,7 @@ static const char count_table[256] =
/* Render_Single_Pass */
/* */
/* <Description> */
- /* Performs one sweep with sub-banding. */
+ /* Perform one sweep with sub-banding. */
/* */
/* <Input> */
/* flipped :: If set, flip the direction of the outline. */
@@ -3026,7 +3058,7 @@ static const char count_table[256] =
/* Render_Glyph */
/* */
/* <Description> */
- /* Renders a glyph in a bitmap. Sub-banding if needed. */
+ /* Render a glyph in a bitmap. Sub-banding if needed. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
@@ -3039,13 +3071,23 @@ static const char count_table[256] =
Set_High_Precision( RAS_VARS ras.outline.flags &
FT_OUTLINE_HIGH_PRECISION );
- ras.scale_shift = ras.precision_shift;
- /* Drop-out mode 2 is hard-coded since this is the only mode used */
- /* on Windows platforms. Using other modes, as specified by the */
- /* font, results in misplaced pixels. */
- ras.dropOutControl = 2;
- ras.second_pass = (FT_Byte)( !( ras.outline.flags &
- FT_OUTLINE_SINGLE_PASS ) );
+ ras.scale_shift = ras.precision_shift;
+
+ if ( ras.outline.flags & FT_OUTLINE_IGNORE_DROPOUTS )
+ ras.dropOutControl = 2;
+ else
+ {
+ if ( ras.outline.flags & FT_OUTLINE_SMART_DROPOUTS )
+ ras.dropOutControl = 4;
+ else
+ ras.dropOutControl = 0;
+
+ if ( !( ras.outline.flags & FT_OUTLINE_INCLUDE_STUBS ) )
+ ras.dropOutControl += 1;
+ }
+
+ ras.second_pass = (FT_Byte)( !( ras.outline.flags &
+ FT_OUTLINE_SINGLE_PASS ) );
/* Vertical Sweep */
ras.Proc_Sweep_Init = Vertical_Sweep_Init;
@@ -3064,7 +3106,7 @@ static const char count_table[256] =
return error;
/* Horizontal Sweep */
- if ( ras.second_pass && ras.dropOutControl != 0 )
+ if ( ras.second_pass && ras.dropOutControl != 2 )
{
ras.Proc_Sweep_Init = Horizontal_Sweep_Init;
ras.Proc_Sweep_Span = Horizontal_Sweep_Span;
@@ -3085,14 +3127,13 @@ static const char count_table[256] =
#ifdef FT_RASTER_OPTION_ANTI_ALIASING
-
/*************************************************************************/
/* */
/* <Function> */
/* Render_Gray_Glyph */
/* */
/* <Description> */
- /* Renders a glyph with grayscaling. Sub-banding if needed. */
+ /* Render a glyph with grayscaling. Sub-banding if needed. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
@@ -3106,12 +3147,22 @@ static const char count_table[256] =
Set_High_Precision( RAS_VARS ras.outline.flags &
FT_OUTLINE_HIGH_PRECISION );
- ras.scale_shift = ras.precision_shift + 1;
- /* Drop-out mode 2 is hard-coded since this is the only mode used */
- /* on Windows platforms. Using other modes, as specified by the */
- /* font, results in misplaced pixels. */
- ras.dropOutControl = 2;
- ras.second_pass = !( ras.outline.flags & FT_OUTLINE_SINGLE_PASS );
+ ras.scale_shift = ras.precision_shift + 1;
+
+ if ( ras.outline.flags & FT_OUTLINE_IGNORE_DROPOUTS )
+ ras.dropOutControl = 2;
+ else
+ {
+ if ( ras.outline.flags & FT_OUTLINE_SMART_DROPOUTS )
+ ras.dropOutControl = 4;
+ else
+ ras.dropOutControl = 0;
+
+ if ( !( ras.outline.flags & FT_OUTLINE_INCLUDE_STUBS ) )
+ ras.dropOutControl += 1;
+ }
+
+ ras.second_pass = !( ras.outline.flags & FT_OUTLINE_SINGLE_PASS );
/* Vertical Sweep */
@@ -3139,7 +3190,7 @@ static const char count_table[256] =
return error;
/* Horizontal Sweep */
- if ( ras.second_pass && ras.dropOutControl != 0 )
+ if ( ras.second_pass && ras.dropOutControl != 2 )
{
ras.Proc_Sweep_Init = Horizontal_Sweep_Init;
ras.Proc_Sweep_Span = Horizontal_Gray_Sweep_Span;
@@ -3198,7 +3249,7 @@ static const char count_table[256] =
static int
- ft_black_new( void* memory,
+ ft_black_new( void* memory,
FT_Raster *araster )
{
static TRaster the_raster;
@@ -3256,9 +3307,9 @@ static const char count_table[256] =
static void
- ft_black_reset( PRaster raster,
- char* pool_base,
- long pool_size )
+ ft_black_reset( PRaster raster,
+ char* pool_base,
+ long pool_size )
{
if ( raster )
{
@@ -3283,9 +3334,9 @@ static const char count_table[256] =
static void
- ft_black_set_mode( PRaster raster,
- unsigned long mode,
- const char* palette )
+ ft_black_set_mode( PRaster raster,
+ unsigned long mode,
+ const char* palette )
{
#ifdef FT_RASTER_OPTION_ANTI_ALIASING
@@ -3351,15 +3402,15 @@ static const char count_table[256] =
if ( !target_map->buffer )
return Raster_Err_Invalid;
- ras.outline = *outline;
- ras.target = *target_map;
+ ras.outline = *outline;
+ ras.target = *target_map;
- worker->buff = (PLong) raster->buffer;
- worker->sizeBuff = worker->buff +
- raster->buffer_size / sizeof ( Long );
+ worker->buff = (PLong) raster->buffer;
+ worker->sizeBuff = worker->buff +
+ raster->buffer_size / sizeof ( Long );
#ifdef FT_RASTER_OPTION_ANTI_ALIASING
- worker->grays = raster->grays;
- worker->gray_width = raster->gray_width;
+ worker->grays = raster->grays;
+ worker->gray_width = raster->gray_width;
#endif
return ( ( params->flags & FT_RASTER_FLAG_AA )
diff --git a/src/sfnt/sfdriver.c b/src/sfnt/sfdriver.c
index 5ba22a6..142ef76 100644
--- a/src/sfnt/sfdriver.c
+++ b/src/sfnt/sfdriver.c
@@ -4,7 +4,7 @@
/* */
/* High-level SFNT driver interface (body). */
/* */
-/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007 by */
+/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -151,10 +151,35 @@
}
+ static FT_UInt
+ sfnt_get_name_index( TT_Face face,
+ FT_String* glyph_name )
+ {
+ FT_Face root = &face->root;
+ FT_Long i;
+
+
+ for ( i = 0; i < root->num_glyphs; i++ )
+ {
+ FT_String* gname;
+ FT_Error error = tt_face_get_ps_name( face, i, &gname );
+
+
+ if ( error )
+ continue;
+
+ if ( !ft_strcmp( glyph_name, gname ) )
+ return (FT_UInt)i;
+ }
+
+ return 0;
+ }
+
+
static const FT_Service_GlyphDictRec sfnt_service_glyph_dict =
{
(FT_GlyphDict_GetNameFunc) sfnt_get_glyph_name,
- (FT_GlyphDict_NameIndexFunc)NULL
+ (FT_GlyphDict_NameIndexFunc)sfnt_get_name_index
};
#endif /* TT_CONFIG_OPTION_POSTSCRIPT_NAMES */
diff --git a/src/sfnt/sfobjs.c b/src/sfnt/sfobjs.c
index c25b87d..c826b92 100644
--- a/src/sfnt/sfobjs.c
+++ b/src/sfnt/sfobjs.c
@@ -123,14 +123,20 @@
/* */
/* nameid :: The name id of the name record to return. */
/* */
+ /* <InOut> */
+ /* name :: The address of a string pointer. NULL if no name is */
+ /* present. */
+ /* */
/* <Return> */
- /* Character string. NULL if no name is present. */
+ /* FreeType error code. 0 means success. */
/* */
- static FT_String*
- tt_face_get_name( TT_Face face,
- FT_UShort nameid )
+ static FT_Error
+ tt_face_get_name( TT_Face face,
+ FT_UShort nameid,
+ FT_String** name )
{
FT_Memory memory = face->root.memory;
+ FT_Error error = SFNT_Err_Ok;
FT_String* result = NULL;
FT_UShort n;
TT_NameEntryRec* rec;
@@ -145,6 +151,8 @@
TT_NameEntry_ConvertFunc convert;
+ FT_ASSERT( name );
+
rec = face->name_table.names;
for ( n = 0; n < face->num_names; n++, rec++ )
{
@@ -256,11 +264,8 @@
{
if ( rec->string == NULL )
{
- FT_Error error = SFNT_Err_Ok;
FT_Stream stream = face->name_table.stream;
- FT_UNUSED( error );
-
if ( FT_QNEW_ARRAY ( rec->string, rec->stringLength ) ||
FT_STREAM_SEEK( rec->stringOffset ) ||
@@ -277,7 +282,8 @@
}
Exit:
- return result;
+ *name = result;
+ return error;
}
@@ -363,11 +369,12 @@
if ( FT_READ_ULONG( tag ) )
return error;
- if ( tag != 0x00010000UL &&
- tag != TTAG_ttcf &&
- tag != FT_MAKE_TAG( 'O', 'T', 'T', 'O' ) &&
- tag != TTAG_true &&
- tag != 0x00020000UL )
+ if ( tag != 0x00010000UL &&
+ tag != TTAG_ttcf &&
+ tag != TTAG_OTTO &&
+ tag != TTAG_true &&
+ tag != TTAG_typ1 &&
+ tag != 0x00020000UL )
return SFNT_Err_Unknown_File_Format;
face->ttc_header.tag = TTAG_ttcf;
@@ -401,7 +408,7 @@
face->ttc_header.version = 1 << 16;
face->ttc_header.count = 1;
- if ( FT_NEW( face->ttc_header.offsets) )
+ if ( FT_NEW( face->ttc_header.offsets ) )
return error;
face->ttc_header.offsets[0] = offset;
@@ -451,7 +458,7 @@
face_index = 0;
if ( face_index >= face->ttc_header.count )
- return SFNT_Err_Bad_Argument;
+ return SFNT_Err_Invalid_Argument;
if ( FT_STREAM_SEEK( face->ttc_header.offsets[face_index] ) )
return error;
@@ -461,7 +468,8 @@
if ( error )
return error;
- face->root.num_faces = face->ttc_header.count;
+ face->root.num_faces = face->ttc_header.count;
+ face->root.face_index = face_index;
return error;
}
@@ -498,6 +506,13 @@
FT_TRACE3(( "\n" )); \
} while ( 0 )
+#define GET_NAME( id, field ) \
+ do { \
+ error = tt_face_get_name( face, TT_NAME_ID_##id, field ); \
+ if ( error ) \
+ goto Exit; \
+ } while ( 0 )
+
FT_LOCAL_DEF( FT_Error )
sfnt_load_face( FT_Stream stream,
@@ -506,7 +521,10 @@
FT_Int num_params,
FT_Parameter* params )
{
- FT_Error error, psnames_error;
+ FT_Error error;
+#ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
+ FT_Error psnames_error;
+#endif
FT_Bool has_outline;
FT_Bool is_apple_sbit;
@@ -581,7 +599,10 @@
/* don't check for errors */
LOAD_( name );
LOAD_( post );
+
+#ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
psnames_error = error;
+#endif
/* do not load the metrics headers and tables if this is an Apple */
/* sbit font file */
@@ -660,19 +681,20 @@
face->os2.version = 0xFFFFU;
}
-
}
/* the optional tables */
- /* embedded bitmap support. */
+ /* embedded bitmap support */
if ( sfnt->load_eblc )
{
LOAD_( eblc );
if ( error )
{
- /* return an error if this font file has no outlines */
- if ( error == SFNT_Err_Table_Missing && has_outline )
+ /* a font which contains neither bitmaps nor outlines is */
+ /* still valid (although rather useless in most cases); */
+ /* however, you can find such stripped fonts in PDFs */
+ if ( error == SFNT_Err_Table_Missing )
error = SFNT_Err_Ok;
else
goto Exit;
@@ -692,59 +714,38 @@
LOAD_( gasp );
LOAD_( kern );
- error = SFNT_Err_Ok;
-
face->root.num_glyphs = face->max_profile.numGlyphs;
-#if 0
/* Bit 8 of the `fsSelection' field in the `OS/2' table denotes */
/* a WWS-only font face. `WWS' stands for `weight', width', and */
/* `slope', a term used by Microsoft's Windows Presentation */
- /* Foundation (WPF). This flag will be introduced in version */
- /* 1.5 of the OpenType specification (but is already in use). */
+ /* Foundation (WPF). This flag has been introduced in version */
+ /* 1.5 of the OpenType specification (May 2008). */
if ( face->os2.version != 0xFFFFU && face->os2.fsSelection & 256 )
-#endif
{
- face->root.family_name =
- tt_face_get_name( face, TT_NAME_ID_PREFERRED_FAMILY );
+ GET_NAME( PREFERRED_FAMILY, &face->root.family_name );
if ( !face->root.family_name )
- face->root.family_name =
- tt_face_get_name( face, TT_NAME_ID_FONT_FAMILY );
+ GET_NAME( FONT_FAMILY, &face->root.family_name );
- face->root.style_name =
- tt_face_get_name( face, TT_NAME_ID_PREFERRED_SUBFAMILY );
+ GET_NAME( PREFERRED_SUBFAMILY, &face->root.style_name );
if ( !face->root.style_name )
- face->root.style_name =
- tt_face_get_name( face, TT_NAME_ID_FONT_SUBFAMILY );
+ GET_NAME( FONT_SUBFAMILY, &face->root.style_name );
}
-#if 0
else
{
- /* Support for `name' table ID 21 (WWS family) and 22 (WWS */
- /* subfamily) is still under consideration by Microsoft and */
- /* not implemented in the current version of WPF. */
-
- face->root.family_name =
- tt_face_get_name( face, TT_NAME_ID_WWS_FAMILY );
+ GET_NAME( WWS_FAMILY, &face->root.family_name );
if ( !face->root.family_name )
- face->root.family_name =
- tt_face_get_name( face, TT_NAME_ID_PREFERRED_FAMILY );
+ GET_NAME( PREFERRED_FAMILY, &face->root.family_name );
if ( !face->root.family_name )
- face->root.family_name =
- tt_face_get_name( face, TT_NAME_ID_FONT_FAMILY );
+ GET_NAME( FONT_FAMILY, &face->root.family_name );
- face->root.style_name =
- tt_face_get_name( face, TT_NAME_ID_WWS_SUBFAMILY );
+ GET_NAME( WWS_SUBFAMILY, &face->root.style_name );
if ( !face->root.style_name )
- face->root.style_name =
- tt_face_get_name( face, TT_NAME_ID_PREFERRED_SUBFAMILY );
+ GET_NAME( PREFERRED_SUBFAMILY, &face->root.style_name );
if ( !face->root.style_name )
- face->root.style_name =
- tt_face_get_name( face, TT_NAME_ID_FONT_SUBFAMILY );
+ GET_NAME( FONT_SUBFAMILY, &face->root.style_name );
}
-#endif
-
/* now set up root fields */
{
@@ -801,10 +802,9 @@
flags = 0;
if ( has_outline == TRUE && face->os2.version != 0xFFFFU )
{
- /* We have an OS/2 table; use the `fsSelection' field. Bit 9 */
- /* indicates an oblique font face. This flag will be */
- /* introduced in version 1.5 of the OpenType specification (but */
- /* is already in use). */
+ /* We have an OS/2 table; use the `fsSelection' field. Bit 9 */
+ /* indicates an oblique font face. This flag has been */
+ /* introduced in version 1.5 of the OpenType specification. */
if ( face->os2.fsSelection & 512 ) /* bit 9 */
flags |= FT_STYLE_FLAG_ITALIC;
@@ -817,6 +817,7 @@
else
{
/* this is an old Mac font, use the header field */
+
if ( face->header.Mac_Style & 1 )
flags |= FT_STYLE_FLAG_BOLD;
@@ -861,12 +862,78 @@
}
}
+#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
+
+ /*
+ * Now allocate the root array of FT_Bitmap_Size records and
+ * populate them. Unfortunately, it isn't possible to indicate bit
+ * depths in the FT_Bitmap_Size record. This is a design error.
+ */
+ {
+ FT_UInt i, count;
+
+
+#ifndef FT_CONFIG_OPTION_OLD_INTERNALS
+ count = face->sbit_num_strikes;
+#else
+ count = (FT_UInt)face->num_sbit_strikes;
+#endif
+
+ if ( count > 0 )
+ {
+ FT_Memory memory = face->root.stream->memory;
+ FT_UShort em_size = face->header.Units_Per_EM;
+ FT_Short avgwidth = face->os2.xAvgCharWidth;
+ FT_Size_Metrics metrics;
+
+
+ if ( em_size == 0 || face->os2.version == 0xFFFFU )
+ {
+ avgwidth = 0;
+ em_size = 1;
+ }
+
+ if ( FT_NEW_ARRAY( root->available_sizes, count ) )
+ goto Exit;
+
+ for ( i = 0; i < count; i++ )
+ {
+ FT_Bitmap_Size* bsize = root->available_sizes + i;
+
+
+ error = sfnt->load_strike_metrics( face, i, &metrics );
+ if ( error )
+ goto Exit;
+
+ bsize->height = (FT_Short)( metrics.height >> 6 );
+ bsize->width = (FT_Short)(
+ ( avgwidth * metrics.x_ppem + em_size / 2 ) / em_size );
+
+ bsize->x_ppem = metrics.x_ppem << 6;
+ bsize->y_ppem = metrics.y_ppem << 6;
+
+ /* assume 72dpi */
+ bsize->size = metrics.y_ppem << 6;
+ }
+
+ root->face_flags |= FT_FACE_FLAG_FIXED_SIZES;
+ root->num_fixed_sizes = (FT_Int)count;
+ }
+ }
+
+#endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */
+
+ /* a font with no bitmaps and no outlines is scalable; */
+ /* it has only empty glyphs then */
+ if ( !FT_HAS_FIXED_SIZES( root ) && !FT_IS_SCALABLE( root ) )
+ root->face_flags |= FT_FACE_FLAG_SCALABLE;
+
/*********************************************************************/
/* */
/* Set up metrics. */
/* */
- if ( has_outline == TRUE )
+ if ( FT_IS_SCALABLE( root ) )
{
/* XXX What about if outline header is missing */
/* (e.g. sfnt wrapped bitmap)? */
@@ -919,10 +986,9 @@
/* this computation is based on various versions of Times New Roman */
if ( face->horizontal.Line_Gap == 0 )
root->height = (FT_Short)( ( root->height * 115 + 50 ) / 100 );
-#endif
+#endif /* 0 */
#if 0
-
/* some fonts have the OS/2 "sTypoAscender", "sTypoDescender" & */
/* "sTypoLineGap" fields set to 0, like ARIALNB.TTF */
if ( face->os2.version != 0xFFFFU && root->ascender )
@@ -937,80 +1003,21 @@
if ( height > root->height )
root->height = height;
}
-
#endif /* 0 */
- root->max_advance_width = face->horizontal.advance_Width_Max;
+ root->max_advance_width = face->horizontal.advance_Width_Max;
+ root->max_advance_height = (FT_Short)( face->vertical_info
+ ? face->vertical.advance_Height_Max
+ : root->height );
- root->max_advance_height = (FT_Short)( face->vertical_info
- ? face->vertical.advance_Height_Max
- : root->height );
-
- root->underline_position = face->postscript.underlinePosition;
+ /* See http://www.microsoft.com/OpenType/OTSpec/post.htm -- */
+ /* Adjust underline position from top edge to centre of */
+ /* stroke to convert TrueType meaning to FreeType meaning. */
+ root->underline_position = face->postscript.underlinePosition -
+ face->postscript.underlineThickness / 2;
root->underline_thickness = face->postscript.underlineThickness;
}
-#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
-
- /*
- * Now allocate the root array of FT_Bitmap_Size records and
- * populate them. Unfortunately, it isn't possible to indicate bit
- * depths in the FT_Bitmap_Size record. This is a design error.
- */
- {
- FT_UInt i, count;
-
-
-#if !defined FT_CONFIG_OPTION_OLD_INTERNALS
- count = face->sbit_num_strikes;
-#else
- count = (FT_UInt)face->num_sbit_strikes;
-#endif
-
- if ( count > 0 )
- {
- FT_Memory memory = face->root.stream->memory;
- FT_UShort em_size = face->header.Units_Per_EM;
- FT_Short avgwidth = face->os2.xAvgCharWidth;
- FT_Size_Metrics metrics;
-
-
- if ( em_size == 0 || face->os2.version == 0xFFFFU )
- {
- avgwidth = 0;
- em_size = 1;
- }
-
- if ( FT_NEW_ARRAY( root->available_sizes, count ) )
- goto Exit;
-
- for ( i = 0; i < count; i++ )
- {
- FT_Bitmap_Size* bsize = root->available_sizes + i;
-
-
- error = sfnt->load_strike_metrics( face, i, &metrics );
- if ( error )
- goto Exit;
-
- bsize->height = (FT_Short)( metrics.height >> 6 );
- bsize->width = (FT_Short)(
- ( avgwidth * metrics.x_ppem + em_size / 2 ) / em_size );
-
- bsize->x_ppem = metrics.x_ppem << 6;
- bsize->y_ppem = metrics.y_ppem << 6;
-
- /* assume 72dpi */
- bsize->size = metrics.y_ppem << 6;
- }
-
- root->face_flags |= FT_FACE_FLAG_FIXED_SIZES;
- root->num_fixed_sizes = (FT_Int)count;
- }
- }
-
-#endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */
-
}
Exit:
@@ -1022,14 +1029,21 @@
#undef LOAD_
#undef LOADM_
+#undef GET_NAME
FT_LOCAL_DEF( void )
sfnt_done_face( TT_Face face )
{
- FT_Memory memory = face->root.memory;
- SFNT_Service sfnt = (SFNT_Service)face->sfnt;
+ FT_Memory memory;
+ SFNT_Service sfnt;
+
+
+ if ( !face )
+ return;
+ memory = face->root.memory;
+ sfnt = (SFNT_Service)face->sfnt;
if ( sfnt )
{
@@ -1068,7 +1082,7 @@
}
/* freeing the horizontal metrics */
-#if !defined FT_CONFIG_OPTION_OLD_INTERNALS
+#ifndef FT_CONFIG_OPTION_OLD_INTERNALS
{
FT_Stream stream = FT_FACE_STREAM( face );
diff --git a/src/sfnt/ttcmap.c b/src/sfnt/ttcmap.c
index b70b64c..6830391 100644
--- a/src/sfnt/ttcmap.c
+++ b/src/sfnt/ttcmap.c
@@ -4,7 +4,7 @@
/* */
/* TrueType character mapping table (cmap) support (body). */
/* */
-/* Copyright 2002, 2003, 2004, 2005, 2006, 2007 by */
+/* Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -134,7 +134,7 @@
FT_UInt gindex = 0;
- table += 6; /* go to glyph ids */
+ table += 6; /* go to glyph IDs */
while ( ++charcode < 256 )
{
gindex = table[charcode];
@@ -231,7 +231,7 @@
/* language 4 USHORT Mac language code */
/* keys 6 USHORT[256] sub-header keys */
/* subs 518 SUBHEAD[NSUBS] sub-headers array */
- /* glyph_ids 518+NSUB*8 USHORT[] glyph id array */
+ /* glyph_ids 518+NSUB*8 USHORT[] glyph ID array */
/* */
/* The `keys' table is used to map charcode high-bytes to sub-headers. */
/* The value of `NSUBS' is the number of sub-headers defined in the */
@@ -260,14 +260,14 @@
/* */
/* * The value of `offset' is read. This is a _byte_ distance from the */
/* location of the `offset' field itself into a slice of the */
- /* `glyph_ids' table. Let's call it `slice' (it's a USHORT[] too). */
+ /* `glyph_ids' table. Let's call it `slice' (it is a USHORT[] too). */
/* */
/* * The value `slice[char.lo - first]' is read. If it is 0, there is */
/* no glyph for the charcode. Otherwise, the value of `delta' is */
/* added to it (modulo 65536) to form a new glyph index. */
/* */
/* It is up to the validation routine to check that all offsets fall */
- /* within the glyph ids table (and not within the `subs' table itself or */
+ /* within the glyph IDs table (and not within the `subs' table itself or */
/* outside of the CMap). */
/* */
@@ -282,7 +282,7 @@
FT_UInt n, max_subs;
FT_Byte* keys; /* keys table */
FT_Byte* subs; /* sub-headers */
- FT_Byte* glyph_ids; /* glyph id array */
+ FT_Byte* glyph_ids; /* glyph ID array */
if ( table + length > valid->limit || length < 6 + 512 )
@@ -328,6 +328,10 @@
delta = TT_NEXT_SHORT( p );
offset = TT_NEXT_USHORT( p );
+ /* many Dynalab fonts have empty sub-headers */
+ if ( code_count == 0 )
+ continue;
+
/* check range within 0..255 */
if ( valid->level >= FT_VALIDATE_PARANOID )
{
@@ -342,7 +346,7 @@
if ( ids < glyph_ids || ids + code_count*2 > table + length )
FT_INVALID_OFFSET;
- /* check glyph ids */
+ /* check glyph IDs */
if ( valid->level >= FT_VALIDATE_TIGHT )
{
FT_Byte* limit = p + code_count * 2;
@@ -393,7 +397,7 @@
sub = subs; /* jump to first sub-header */
/* check that the sub-header for this byte is 0, which */
- /* indicates that it's really a valid one-byte value */
+ /* indicates that it is really a valid one-byte value */
/* Otherwise, return 0 */
/* */
p += char_lo * 2;
@@ -601,14 +605,14 @@
/* each segment; can be */
/* zero */
/* */
- /* glyphIds 16+NUM_SEGS*8 USHORT[] array of glyph id */
+ /* glyphIds 16+NUM_SEGS*8 USHORT[] array of glyph ID */
/* ranges */
/* */
/* Character codes are modelled by a series of ordered (increasing) */
/* intervals called segments. Each segment has start and end codes, */
/* provided by the `startCount' and `endCount' arrays. Segments must */
- /* not be overlapping and the last segment should always contain the */
- /* `0xFFFF' endCount. */
+ /* not overlap, and the last segment should always contain the value */
+ /* 0xFFFF for `endCount'. */
/* */
/* The fields `searchRange', `entrySelector' and `rangeShift' are better */
/* ignored (they are traces of over-engineering in the TrueType */
@@ -621,14 +625,14 @@
/* charcode within the segment is obtained by adding the value of */
/* `idDelta' directly to the charcode, modulo 65536. */
/* */
- /* Otherwise, a glyph index is taken from the glyph ids sub-array for */
+ /* Otherwise, a glyph index is taken from the glyph IDs sub-array for */
/* the segment, and the value of `idDelta' is added to it. */
/* */
/* */
- /* Finally, note that certain fonts contain invalid charmaps that */
- /* contain end=0xFFFF, start=0xFFFF, delta=0x0001, offset=0xFFFF at the */
- /* of their charmaps (e.g. opens___.ttf which comes with OpenOffice.org) */
- /* we need special code to deal with them correctly... */
+ /* Finally, note that a lot of fonts contain an invalid last segment, */
+ /* where `start' and `end' are correctly set to 0xFFFF but both `delta' */
+ /* and `offset' are incorrect (e.g., `opens___.ttf' which comes with */
+ /* OpenOffice.org). We need special code to deal with them correctly. */
/* */
#ifdef TT_CONFIG_CMAP_FORMAT_4
@@ -693,6 +697,23 @@
p += num_ranges * 2;
offset = FT_PEEK_USHORT( p );
+ /* some fonts have an incorrect last segment; */
+ /* we have to catch it */
+ if ( range_index >= num_ranges - 1 &&
+ cmap->cur_start == 0xFFFFU &&
+ cmap->cur_end == 0xFFFFU )
+ {
+ TT_Face face = (TT_Face)cmap->cmap.cmap.charmap.face;
+ FT_Byte* limit = face->cmap_table + face->cmap_size;
+
+
+ if ( offset && p + offset + 2 > limit )
+ {
+ cmap->cur_delta = 1;
+ offset = 0;
+ }
+ }
+
if ( offset != 0xFFFFU )
{
cmap->cur_values = offset ? p + offset : NULL;
@@ -831,7 +852,7 @@
/* */
if ( valid->level >= FT_VALIDATE_PARANOID )
{
- /* check the values of 'searchRange', 'entrySelector', 'rangeShift' */
+ /* check the values of `searchRange', `entrySelector', `rangeShift' */
FT_UInt search_range = TT_NEXT_USHORT( p );
FT_UInt entry_selector = TT_NEXT_USHORT( p );
FT_UInt range_shift = TT_NEXT_USHORT( p );
@@ -858,7 +879,7 @@
offsets = deltas + num_segs * 2;
glyph_ids = offsets + num_segs * 2;
- /* check last segment, its end count must be FFFF */
+ /* check last segment; its end count value must be 0xFFFF */
if ( valid->level >= FT_VALIDATE_PARANOID )
{
p = ends + ( num_segs - 1 ) * 2;
@@ -867,9 +888,9 @@
}
{
- FT_UInt start, end, offset, n;
- FT_UInt last_start = 0, last_end = 0;
- FT_Int delta;
+ FT_UInt start, end, offset, n;
+ FT_UInt last_start = 0, last_end = 0;
+ FT_Int delta;
FT_Byte* p_start = starts;
FT_Byte* p_end = ends;
FT_Byte* p_delta = deltas;
@@ -887,10 +908,10 @@
if ( start > end )
FT_INVALID_DATA;
- /* this test should be performed at default validation level; */
- /* unfortunately, some popular Asian fonts present overlapping */
- /* ranges in their charmaps */
- /* */
+ /* this test should be performed at default validation level; */
+ /* unfortunately, some popular Asian fonts have overlapping */
+ /* ranges in their charmaps */
+ /* */
if ( start <= last_end && n > 0 )
{
if ( valid->level >= FT_VALIDATE_TIGHT )
@@ -898,7 +919,7 @@
else
{
/* allow overlapping segments, provided their start points */
- /* and end points, respectively, are in ascending order. */
+ /* and end points, respectively, are in ascending order */
/* */
if ( last_start > start || last_end > end )
error |= TT_CMAP_FLAG_UNSORTED;
@@ -909,16 +930,27 @@
if ( offset && offset != 0xFFFFU )
{
- p += offset; /* start of glyph id array */
+ p += offset; /* start of glyph ID array */
- /* check that we point within the glyph ids table only */
+ /* check that we point within the glyph IDs table only */
if ( valid->level >= FT_VALIDATE_TIGHT )
{
if ( p < glyph_ids ||
p + ( end - start + 1 ) * 2 > table + length )
FT_INVALID_DATA;
}
- else
+ /* Some fonts handle the last segment incorrectly. In */
+ /* theory, 0xFFFF might point to an ordinary glyph -- */
+ /* a cmap 4 is versatile and could be used for any */
+ /* encoding, not only Unicode. However, reality shows */
+ /* that far too many fonts are sloppy and incorrectly */
+ /* set all fields but `start' and `end' for the last */
+ /* segment if it contains only a single character. */
+ /* */
+ /* We thus omit the test here, delaying it to the */
+ /* routines which actually access the cmap. */
+ else if ( n != num_segs - 1 ||
+ !( start == 0xFFFFU && end == 0xFFFFU ) )
{
if ( p < glyph_ids ||
p + ( end - start + 1 ) * 2 > valid->limit )
@@ -946,12 +978,12 @@
}
else if ( offset == 0xFFFFU )
{
- /* Some fonts (erroneously?) use a range offset of 0xFFFF */
+ /* some fonts (erroneously?) use a range offset of 0xFFFF */
/* to mean missing glyph in cmap table */
/* */
- if ( valid->level >= FT_VALIDATE_PARANOID ||
- n != num_segs - 1 ||
- !( start == 0xFFFFU && end == 0xFFFFU && delta == 0x1U ) )
+ if ( valid->level >= FT_VALIDATE_PARANOID ||
+ n != num_segs - 1 ||
+ !( start == 0xFFFFU && end == 0xFFFFU ) )
FT_INVALID_DATA;
}
@@ -965,9 +997,9 @@
static FT_UInt
- tt_cmap4_char_map_linear( TT_CMap cmap,
- FT_UInt* pcharcode,
- FT_Bool next )
+ tt_cmap4_char_map_linear( TT_CMap cmap,
+ FT_UInt32* pcharcode,
+ FT_Bool next )
{
FT_UInt num_segs2, start, end, offset;
FT_Int delta;
@@ -1009,6 +1041,22 @@
p += num_segs2;
offset = TT_PEEK_USHORT( p );
+ /* some fonts have an incorrect last segment; */
+ /* we have to catch it */
+ if ( i >= num_segs - 1 &&
+ start == 0xFFFFU && end == 0xFFFFU )
+ {
+ TT_Face face = (TT_Face)cmap->cmap.charmap.face;
+ FT_Byte* limit = face->cmap_table + face->cmap_size;
+
+
+ if ( offset && p + offset + 2 > limit )
+ {
+ delta = 1;
+ offset = 0;
+ }
+ }
+
if ( offset == 0xFFFFU )
continue;
@@ -1038,9 +1086,9 @@
static FT_UInt
- tt_cmap4_char_map_binary( TT_CMap cmap,
- FT_UInt* pcharcode,
- FT_Bool next )
+ tt_cmap4_char_map_binary( TT_CMap cmap,
+ FT_UInt32* pcharcode,
+ FT_Bool next )
{
FT_UInt num_segs2, start, end, offset;
FT_Int delta;
@@ -1088,6 +1136,22 @@
p += num_segs2;
offset = TT_PEEK_USHORT( p );
+ /* some fonts have an incorrect last segment; */
+ /* we have to catch it */
+ if ( mid >= num_segs - 1 &&
+ start == 0xFFFFU && end == 0xFFFFU )
+ {
+ TT_Face face = (TT_Face)cmap->cmap.charmap.face;
+ FT_Byte* limit = face->cmap_table + face->cmap_size;
+
+
+ if ( offset && p + offset + 2 > limit )
+ {
+ delta = 1;
+ offset = 0;
+ }
+ }
+
/* search the first segment containing `charcode' */
if ( cmap->flags & TT_CMAP_FLAG_OVERLAPPING )
{
@@ -1359,7 +1423,7 @@
/* */
/* first 6 USHORT first segment code */
/* count 8 USHORT segment size in chars */
- /* glyphIds 10 USHORT[count] glyph ids */
+ /* glyphIds 10 USHORT[count] glyph IDs */
/* */
/* A very simplified segment mapping. */
/* */
@@ -1506,7 +1570,7 @@
/***** *****/
/***** FORMAT 8 *****/
/***** *****/
- /***** It's hard to completely understand what the OpenType spec *****/
+ /***** It is hard to completely understand what the OpenType spec *****/
/***** says about this format, but here is my conclusion. *****/
/***** *****/
/***** The purpose of this format is to easily map UTF-16 text to *****/
@@ -1521,7 +1585,7 @@
/***** `char_hi' and `char_lo' must be in the Surrogates Area. *****/
/***** Area. *****/
/***** *****/
- /***** The 'is32' table embedded in the charmap indicates whether a *****/
+ /***** The `is32' table embedded in the charmap indicates whether a *****/
/***** given 16-bit value is in the surrogates area or not. *****/
/***** *****/
/***** So, for any given `char_code', we can assert the following: *****/
@@ -1548,11 +1612,11 @@
/* is32 12 BYTE[8192] 32-bitness bitmap */
/* count 8204 ULONG number of groups */
/* */
- /* This header is followed by 'count' groups of the following format: */
+ /* This header is followed by `count' groups of the following format: */
/* */
/* start 0 ULONG first charcode */
/* end 4 ULONG last charcode */
- /* startId 8 ULONG start glyph id for the group */
+ /* startId 8 ULONG start glyph ID for the group */
/* */
#ifdef TT_CONFIG_CMAP_FORMAT_8
@@ -1934,7 +1998,7 @@
/* */
/* start 0 ULONG first charcode */
/* end 4 ULONG last charcode */
- /* startId 8 ULONG start glyph id for the group */
+ /* startId 8 ULONG start glyph ID for the group */
/* */
#ifdef TT_CONFIG_CMAP_FORMAT_12
@@ -2727,7 +2791,7 @@
FT_UInt tot = 0;
- p += 3; /* point to the first 'cnt' field */
+ p += 3; /* point to the first `cnt' field */
for ( ; numRanges > 0; numRanges-- )
{
tot += 1 + p[0];
@@ -2774,7 +2838,7 @@
}
- static FT_UInt*
+ static FT_UInt32*
tt_cmap14_get_nondef_chars( TT_CMap cmap,
FT_Byte *p,
FT_Memory memory )
@@ -2962,7 +3026,7 @@
(TT_CMap_Info_GetFunc)tt_cmap14_get_info
};
-#endif /* TT_CONFIG_CMAP_FORMAT_0 */
+#endif /* TT_CONFIG_CMAP_FORMAT_14 */
static const TT_CMap_Class tt_cmap_classes[] =
diff --git a/src/sfnt/ttkern.c b/src/sfnt/ttkern.c
index 28e52c3..67d5115 100644
--- a/src/sfnt/ttkern.c
+++ b/src/sfnt/ttkern.c
@@ -5,7 +5,7 @@
/* Load the basic TrueType kerning table. This doesn't handle */
/* kerning data within the GPOS table at the moment. */
/* */
-/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007 by */
+/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -103,6 +103,9 @@
p_next += length;
+ if ( p_next > p_limit ) /* handle broken table */
+ p_next = p_limit;
+
/* only use horizontal kerning tables */
if ( ( coverage & ~8 ) != 0x0001 ||
p + 8 > p_limit )
@@ -111,8 +114,8 @@
num_pairs = FT_NEXT_USHORT( p );
p += 6;
- if ( p + 6 * num_pairs > p_limit )
- goto NextTable;
+ if ( ( p_next - p ) / 6 < (int)num_pairs ) /* handle broken count */
+ num_pairs = (FT_UInt)( ( p_next - p ) / 6 );
avail |= mask;
@@ -181,18 +184,22 @@
FT_Int result = 0;
FT_UInt count, mask = 1;
FT_Byte* p = face->kern_table;
+ FT_Byte* p_limit = p + face->kern_table_size;
p += 4;
mask = 0x0001;
- for ( count = face->num_kern_tables; count > 0; count--, mask <<= 1 )
+ for ( count = face->num_kern_tables;
+ count > 0 && p + 6 <= p_limit;
+ count--, mask <<= 1 )
{
FT_Byte* base = p;
FT_Byte* next = base;
FT_UInt version = FT_NEXT_USHORT( p );
FT_UInt length = FT_NEXT_USHORT( p );
FT_UInt coverage = FT_NEXT_USHORT( p );
+ FT_UInt num_pairs;
FT_Int value = 0;
FT_UNUSED( version );
@@ -200,21 +207,27 @@
next = base + length;
+ if ( next > p_limit ) /* handle broken table */
+ next = p_limit;
+
if ( ( face->kern_avail_bits & mask ) == 0 )
goto NextTable;
if ( p + 8 > next )
goto NextTable;
+ num_pairs = FT_NEXT_USHORT( p );
+ p += 6;
+
+ if ( ( next - p ) / 6 < (int)num_pairs ) /* handle broken count */
+ num_pairs = (FT_UInt)( ( next - p ) / 6 );
+
switch ( coverage >> 8 )
{
case 0:
{
- FT_UInt num_pairs = FT_NEXT_USHORT( p );
- FT_ULong key0 = TT_KERN_INDEX( left_glyph, right_glyph );
-
+ FT_ULong key0 = TT_KERN_INDEX( left_glyph, right_glyph );
- p += 6;
if ( face->kern_order_bits & mask ) /* binary search */
{
diff --git a/src/sfnt/ttload.c b/src/sfnt/ttload.c
index 6b7c342..c45a1ed 100644
--- a/src/sfnt/ttload.c
+++ b/src/sfnt/ttload.c
@@ -58,6 +58,9 @@
{
TT_Table entry;
TT_Table limit;
+#ifdef FT_DEBUG_LEVEL_TRACE
+ FT_Bool zero_length = FALSE;
+#endif
FT_TRACE4(( "tt_face_lookup_table: %08p, `%c%c%c%c' -- ",
@@ -72,17 +75,28 @@
for ( ; entry < limit; entry++ )
{
- /* For compatibility with Windows, we consider 0-length */
- /* tables the same as missing tables. */
- if ( entry->Tag == tag && entry->Length != 0 )
- {
- FT_TRACE4(( "found table.\n" ));
- return entry;
+ /* For compatibility with Windows, we consider */
+ /* zero-length tables the same as missing tables. */
+ if ( entry->Tag == tag ) {
+ if ( entry->Length != 0 )
+ {
+ FT_TRACE4(( "found table.\n" ));
+ return entry;
+ }
+#ifdef FT_DEBUG_LEVEL_TRACE
+ zero_length = TRUE;
+#endif
}
}
- FT_TRACE4(( "could not find table!\n" ));
- return 0;
+#ifdef FT_DEBUG_LEVEL_TRACE
+ if ( zero_length )
+ FT_TRACE4(( "ignoring empty table!\n" ));
+ else
+ FT_TRACE4(( "could not find table!\n" ));
+#endif
+
+ return NULL;
}
@@ -124,7 +138,7 @@
*length = table->Length;
if ( FT_STREAM_SEEK( table->Offset ) )
- goto Exit;
+ goto Exit;
}
else
error = SFNT_Err_Table_Missing;
@@ -134,27 +148,30 @@
}
- /* Here, we */
- /* */
- /* - check that `num_tables' is valid */
- /* - look for a `head' table, check its size, and parse it to check */
- /* whether its `magic' field is correctly set */
- /* */
- /* When checking directory entries, ignore the tables `glyx' and `locx' */
- /* which are hacked-out versions of `glyf' and `loca' in some PostScript */
- /* Type 42 fonts, and which are generally invalid. */
- /* */
+ /* Here, we */
+ /* */
+ /* - check that `num_tables' is valid (and adjust it if necessary) */
+ /* */
+ /* - look for a `head' table, check its size, and parse it to check */
+ /* whether its `magic' field is correctly set */
+ /* */
+ /* - errors (except errors returned by stream handling) */
+ /* */
+ /* SFNT_Err_Unknown_File_Format: */
+ /* no table is defined in directory, it is not sfnt-wrapped */
+ /* data */
+ /* SFNT_Err_Table_Missing: */
+ /* table directory is valid, but essential tables */
+ /* (head/bhed/SING) are missing */
+ /* */
static FT_Error
check_table_dir( SFNT_Header sfnt,
FT_Stream stream )
{
- FT_Error error;
- FT_UInt nn;
- FT_UInt has_head = 0, has_sing = 0, has_meta = 0;
- FT_ULong offset = sfnt->offset + 12;
-
- const FT_ULong glyx_tag = FT_MAKE_TAG( 'g', 'l', 'y', 'x' );
- const FT_ULong locx_tag = FT_MAKE_TAG( 'l', 'o', 'c', 'x' );
+ FT_Error error;
+ FT_UInt nn, valid_entries = 0;
+ FT_UInt has_head = 0, has_sing = 0, has_meta = 0;
+ FT_ULong offset = sfnt->offset + 12;
static const FT_Frame_Field table_dir_entry_fields[] =
{
@@ -170,12 +187,8 @@
};
- if ( sfnt->num_tables == 0 ||
- offset + sfnt->num_tables * 16 > stream->size )
- return SFNT_Err_Unknown_File_Format;
-
if ( FT_STREAM_SEEK( offset ) )
- return error;
+ goto Exit;
for ( nn = 0; nn < sfnt->num_tables; nn++ )
{
@@ -183,12 +196,23 @@
if ( FT_STREAM_READ_FIELDS( table_dir_entry_fields, &table ) )
- return error;
+ {
+ nn--;
+ FT_TRACE2(( "check_table_dir:"
+ " can read only %d table%s in font (instead of %d)\n",
+ nn, nn == 1 ? "" : "s", sfnt->num_tables ));
+ sfnt->num_tables = nn;
+ break;
+ }
- if ( table.Offset + table.Length > stream->size &&
- table.Tag != glyx_tag &&
- table.Tag != locx_tag )
- return SFNT_Err_Unknown_File_Format;
+ /* we ignore invalid tables */
+ if ( table.Offset + table.Length > stream->size )
+ {
+ FT_TRACE2(( "check_table_dir: table entry %d invalid\n", nn ));
+ continue;
+ }
+ else
+ valid_entries++;
if ( table.Tag == TTAG_head || table.Tag == TTAG_bhed )
{
@@ -210,17 +234,26 @@
*
*/
if ( table.Length < 0x36 )
- return SFNT_Err_Unknown_File_Format;
+ {
+ FT_TRACE2(( "check_table_dir: `head' table too small\n" ));
+ error = SFNT_Err_Table_Missing;
+ goto Exit;
+ }
if ( FT_STREAM_SEEK( table.Offset + 12 ) ||
FT_READ_ULONG( magic ) )
- return error;
+ goto Exit;
if ( magic != 0x5F0F3CF5UL )
- return SFNT_Err_Unknown_File_Format;
+ {
+ FT_TRACE2(( "check_table_dir:"
+ " no magic number found in `head' table\n"));
+ error = SFNT_Err_Table_Missing;
+ goto Exit;
+ }
if ( FT_STREAM_SEEK( offset + ( nn + 1 ) * 16 ) )
- return error;
+ goto Exit;
}
else if ( table.Tag == TTAG_SING )
has_sing = 1;
@@ -228,11 +261,34 @@
has_meta = 1;
}
+ sfnt->num_tables = valid_entries;
+
+ if ( sfnt->num_tables == 0 )
+ {
+ FT_TRACE2(( "check_table_dir: no tables found\n" ));
+ error = SFNT_Err_Unknown_File_Format;
+ goto Exit;
+ }
+
/* if `sing' and `meta' tables are present, there is no `head' table */
if ( has_head || ( has_sing && has_meta ) )
- return SFNT_Err_Ok;
+ {
+ error = SFNT_Err_Ok;
+ goto Exit;
+ }
else
- return SFNT_Err_Unknown_File_Format;
+ {
+ FT_TRACE2(( "check_table_dir:" ));
+#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
+ FT_TRACE2(( " neither `head', `bhed', nor `sing' table found\n" ));
+#else
+ FT_TRACE2(( " neither `head' nor `sing' table found\n" ));
+#endif
+ error = SFNT_Err_Table_Missing;
+ }
+
+ Exit:
+ return error;
}
@@ -266,7 +322,7 @@
FT_Error error;
FT_Memory memory = stream->memory;
TT_TableRec* entry;
- TT_TableRec* limit;
+ FT_Int nn;
static const FT_Frame_Field offset_table_fields[] =
{
@@ -290,7 +346,7 @@
if ( FT_READ_ULONG( sfnt.format_tag ) ||
FT_STREAM_READ_FIELDS( offset_table_fields, &sfnt ) )
- return error;
+ goto Exit;
/* many fonts don't have these fields set correctly */
#if 0
@@ -301,51 +357,58 @@
/* load the table directory */
- FT_TRACE2(( "-- Tables count: %12u\n", sfnt.num_tables ));
- FT_TRACE2(( "-- Format version: %08lx\n", sfnt.format_tag ));
+ FT_TRACE2(( "-- Number of tables: %10u\n", sfnt.num_tables ));
+ FT_TRACE2(( "-- Format version: 0x%08lx\n", sfnt.format_tag ));
/* check first */
error = check_table_dir( &sfnt, stream );
if ( error )
{
- FT_TRACE2(( "tt_face_load_font_dir: invalid table directory!\n" ));
+ FT_TRACE2(( "tt_face_load_font_dir: invalid table directory for TrueType!\n" ));
- return error;
+ goto Exit;
}
face->num_tables = sfnt.num_tables;
face->format_tag = sfnt.format_tag;
if ( FT_QNEW_ARRAY( face->dir_tables, face->num_tables ) )
- return error;
+ goto Exit;
if ( FT_STREAM_SEEK( sfnt.offset + 12 ) ||
FT_FRAME_ENTER( face->num_tables * 16L ) )
- return error;
+ goto Exit;
entry = face->dir_tables;
- limit = entry + face->num_tables;
- for ( ; entry < limit; entry++ )
+ for ( nn = 0; nn < sfnt.num_tables; nn++ )
{
entry->Tag = FT_GET_TAG4();
entry->CheckSum = FT_GET_ULONG();
entry->Offset = FT_GET_LONG();
entry->Length = FT_GET_LONG();
- FT_TRACE2(( " %c%c%c%c - %08lx - %08lx\n",
- (FT_Char)( entry->Tag >> 24 ),
- (FT_Char)( entry->Tag >> 16 ),
- (FT_Char)( entry->Tag >> 8 ),
- (FT_Char)( entry->Tag ),
- entry->Offset,
- entry->Length ));
+ /* ignore invalid tables */
+ if ( entry->Offset + entry->Length > stream->size )
+ continue;
+ else
+ {
+ FT_TRACE2(( " %c%c%c%c - %08lx - %08lx\n",
+ (FT_Char)( entry->Tag >> 24 ),
+ (FT_Char)( entry->Tag >> 16 ),
+ (FT_Char)( entry->Tag >> 8 ),
+ (FT_Char)( entry->Tag ),
+ entry->Offset,
+ entry->Length ));
+ entry++;
+ }
}
FT_FRAME_EXIT();
FT_TRACE2(( "table directory loaded\n\n" ));
+ Exit:
return error;
}
diff --git a/src/sfnt/ttmtx.c b/src/sfnt/ttmtx.c
index 55f681a..2a7d22c 100644
--- a/src/sfnt/ttmtx.c
+++ b/src/sfnt/ttmtx.c
@@ -4,7 +4,7 @@
/* */
/* Load the metrics tables common to TTF and OTF fonts (body). */
/* */
-/* Copyright 2006, 2007 by */
+/* Copyright 2006, 2007, 2008 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -60,7 +60,7 @@
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
-#if !defined FT_CONFIG_OPTION_OLD_INTERNALS
+#ifndef FT_CONFIG_OPTION_OLD_INTERNALS
FT_LOCAL_DEF( FT_Error )
tt_face_load_hmtx( TT_Face face,
@@ -97,7 +97,7 @@
return error;
}
-#else /* !OPTIMIZE_MEMORY || OLD_INTERNALS */
+#else /* !FT_CONFIG_OPTION_OLD_INTERNALS */
FT_LOCAL_DEF( FT_Error )
tt_face_load_hmtx( TT_Face face,
@@ -229,7 +229,7 @@
return error;
}
-#endif /* !OPTIMIZE_MEMORY || OLD_INTERNALS */
+#endif /* !FT_CONFIG_OPTION_OLD_INTERNALS */
/*************************************************************************/
@@ -341,7 +341,7 @@
/* */
/* advance :: The advance width resp. advance height. */
/* */
-#if !defined FT_CONFIG_OPTION_OLD_INTERNALS
+#ifndef FT_CONFIG_OPTION_OLD_INTERNALS
FT_LOCAL_DEF( FT_Error )
tt_face_get_metrics( TT_Face face,
@@ -420,7 +420,7 @@
return SFNT_Err_Ok;
}
-#else /* OLD_INTERNALS */
+#else /* !FT_CONFIG_OPTION_OLD_INTERNALS */
FT_LOCAL_DEF( FT_Error )
tt_face_get_metrics( TT_Face face,
@@ -460,7 +460,7 @@
return SFNT_Err_Ok;
}
-#endif /* !OPTIMIZE_MEMORY || OLD_INTERNALS */
+#endif /* !FT_CONFIG_OPTION_OLD_INTERNALS */
/* END */
diff --git a/src/sfnt/ttpost.c b/src/sfnt/ttpost.c
index 1e61636..ce628e2 100644
--- a/src/sfnt/ttpost.c
+++ b/src/sfnt/ttpost.c
@@ -5,7 +5,7 @@
/* Postcript name table processing for TrueType and OpenType fonts */
/* (body). */
/* */
-/* Copyright 1996-2001, 2002, 2003, 2006, 2007 by */
+/* Copyright 1996-2001, 2002, 2003, 2006, 2007, 2008 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -62,11 +62,11 @@
/* table of Mac names. Thus, it is possible to build a version of */
/* FreeType without the Type 1 driver & PSNames module. */
-#define MAC_NAME( x ) tt_post_default_names[x]
+#define MAC_NAME( x ) ( (FT_String*)tt_post_default_names[x] )
/* the 258 default Mac PS glyph names */
- static const FT_String* tt_post_default_names[258] =
+ static const FT_String* const tt_post_default_names[258] =
{
/* 0 */
".notdef", ".null", "CR", "space", "exclam",
@@ -416,13 +416,14 @@
/* tt_face_get_ps_name */
/* */
/* <Description> */
- /* Gets the PostScript glyph name of a glyph. */
+ /* Get the PostScript glyph name of a glyph. */
/* */
/* <Input> */
/* face :: A handle to the parent face. */
/* */
/* idx :: The glyph index. */
/* */
+ /* <InOut> */
/* PSname :: The address of a string pointer. Will be NULL in case */
/* of error, otherwise it is a pointer to the glyph name. */
/* */
@@ -436,9 +437,9 @@
FT_UInt idx,
FT_String** PSname )
{
- FT_Error error;
- TT_Post_Names names;
- FT_Fixed format;
+ FT_Error error;
+ TT_Post_Names names;
+ FT_Fixed format;
#ifdef FT_CONFIG_OPTION_POSTSCRIPT_NAMES
FT_Service_PsCMaps psnames;
diff --git a/src/sfnt/ttsbit.c b/src/sfnt/ttsbit.c
index 8261ba5..eadaade 100644
--- a/src/sfnt/ttsbit.c
+++ b/src/sfnt/ttsbit.c
@@ -4,7 +4,7 @@
/* */
/* TrueType and OpenType embedded bitmap support (body). */
/* */
-/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007 by */
+/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -24,11 +24,11 @@
* Alas, the memory-optimized sbit loader can't be used when implementing
* the `old internals' hack
*/
-#if !defined FT_CONFIG_OPTION_OLD_INTERNALS
+#ifndef FT_CONFIG_OPTION_OLD_INTERNALS
#include "ttsbit0.c"
-#else /* !FT_CONFIG_OPTION_OLD_INTERNALS */
+#else /* FT_CONFIG_OPTION_OLD_INTERNALS */
#include <ft2build.h>
#include FT_INTERNAL_DEBUG_H
@@ -83,7 +83,8 @@
FT_Int line_bits,
FT_Bool byte_padded,
FT_Int x_offset,
- FT_Int y_offset )
+ FT_Int y_offset,
+ FT_Int source_height )
{
FT_Byte* line_buff;
FT_Int line_incr;
@@ -116,7 +117,7 @@
acc = 0; /* clear accumulator */
loaded = 0; /* no bits were loaded */
- for ( height = target->rows; height > 0; height-- )
+ for ( height = source_height; height > 0; height-- )
{
FT_Byte* cur = line_buff; /* current write cursor */
FT_Int count = line_bits; /* # of bits to extract per line */
@@ -772,7 +773,7 @@
Found:
/* return successfully! */
*arange = range;
- return 0;
+ return SFNT_Err_Ok;
}
}
@@ -1230,7 +1231,7 @@
/* the sbit blitter doesn't make a difference between pixmap */
/* depths. */
blit_sbit( map, (FT_Byte*)stream->cursor, line_bits, pad_bytes,
- x_offset * pix_bits, y_offset );
+ x_offset * pix_bits, y_offset, metrics->height );
FT_FRAME_EXIT();
}
@@ -1324,7 +1325,11 @@
range->image_format, metrics, stream );
case 8: /* compound format */
- FT_Stream_Skip( stream, 1L );
+ if ( FT_STREAM_SKIP( 1L ) )
+ {
+ error = SFNT_Err_Invalid_Stream_Skip;
+ goto Exit;
+ }
/* fallthrough */
case 9:
@@ -1496,7 +1501,7 @@
return error;
}
-#endif /* !FT_CONFIG_OPTION_OLD_INTERNALS */
+#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */
/* END */
diff --git a/src/sfnt/ttsbit.h b/src/sfnt/ttsbit.h
index c6067c0..7ea2af1 100644
--- a/src/sfnt/ttsbit.h
+++ b/src/sfnt/ttsbit.h
@@ -4,7 +4,7 @@
/* */
/* TrueType and OpenType embedded bitmap support (specification). */
/* */
-/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007 by */
+/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -45,7 +45,7 @@ FT_BEGIN_HEADER
FT_ULong strike_index,
FT_Size_Metrics* metrics );
-#if defined FT_CONFIG_OPTION_OLD_INTERNALS
+#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
FT_LOCAL( FT_Error )
tt_find_sbit_image( TT_Face face,
FT_UInt glyph_index,
diff --git a/src/sfnt/ttsbit0.c b/src/sfnt/ttsbit0.c
index 37c7a9b..3ebcbbd 100644
--- a/src/sfnt/ttsbit0.c
+++ b/src/sfnt/ttsbit0.c
@@ -5,7 +5,7 @@
/* TrueType and OpenType embedded bitmap support (body). */
/* This is a heap-optimized version. */
/* */
-/* Copyright 2005, 2006, 2007, 2008 by */
+/* Copyright 2005, 2006, 2007, 2008, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -39,65 +39,16 @@
#define FT_COMPONENT trace_ttsbit
- static const FT_Frame_Field tt_sbit_line_metrics_fields[] =
- {
-#undef FT_STRUCTURE
-#define FT_STRUCTURE TT_SBit_LineMetricsRec
-
- /* no FT_FRAME_START */
- FT_FRAME_CHAR( ascender ),
- FT_FRAME_CHAR( descender ),
- FT_FRAME_BYTE( max_width ),
-
- FT_FRAME_CHAR( caret_slope_numerator ),
- FT_FRAME_CHAR( caret_slope_denominator ),
- FT_FRAME_CHAR( caret_offset ),
-
- FT_FRAME_CHAR( min_origin_SB ),
- FT_FRAME_CHAR( min_advance_SB ),
- FT_FRAME_CHAR( max_before_BL ),
- FT_FRAME_CHAR( min_after_BL ),
- FT_FRAME_CHAR( pads[0] ),
- FT_FRAME_CHAR( pads[1] ),
- FT_FRAME_END
- };
-
- static const FT_Frame_Field tt_strike_start_fields[] =
- {
-#undef FT_STRUCTURE
-#define FT_STRUCTURE TT_SBit_StrikeRec
-
- /* no FT_FRAME_START */
- FT_FRAME_ULONG( ranges_offset ),
- FT_FRAME_SKIP_LONG,
- FT_FRAME_ULONG( num_ranges ),
- FT_FRAME_ULONG( color_ref ),
- FT_FRAME_END
- };
-
- static const FT_Frame_Field tt_strike_end_fields[] =
- {
- /* no FT_FRAME_START */
- FT_FRAME_USHORT( start_glyph ),
- FT_FRAME_USHORT( end_glyph ),
- FT_FRAME_BYTE ( x_ppem ),
- FT_FRAME_BYTE ( y_ppem ),
- FT_FRAME_BYTE ( bit_depth ),
- FT_FRAME_CHAR ( flags ),
- FT_FRAME_END
- };
-
-
FT_LOCAL_DEF( FT_Error )
tt_face_load_eblc( TT_Face face,
FT_Stream stream )
{
- FT_Error error = SFNT_Err_Ok;
- FT_Fixed version;
- FT_ULong num_strikes, table_size;
- FT_Byte* p;
- FT_Byte* p_limit;
- FT_UInt count;
+ FT_Error error = SFNT_Err_Ok;
+ FT_Fixed version;
+ FT_ULong num_strikes, table_size;
+ FT_Byte* p;
+ FT_Byte* p_limit;
+ FT_UInt count;
face->sbit_num_strikes = 0;
@@ -111,7 +62,7 @@
if ( table_size < 8 )
{
- FT_ERROR(( "%s: table too short!\n", "tt_face_load_sbit_strikes" ));
+ FT_ERROR(( "tt_face_load_sbit_strikes: table too short!\n" ));
error = SFNT_Err_Invalid_File_Format;
goto Exit;
}
@@ -129,8 +80,7 @@
if ( version != 0x00020000UL || num_strikes >= 0x10000UL )
{
- FT_ERROR(( "%s: invalid table version!\n",
- "tt_face_load_sbit_strikes" ));
+ FT_ERROR(( "tt_face_load_sbit_strikes: invalid table version!\n" ));
error = SFNT_Err_Invalid_File_Format;
goto Fail;
}
@@ -182,7 +132,7 @@
FT_ULong strike_index,
FT_Size_Metrics* metrics )
{
- FT_Byte* strike;
+ FT_Byte* strike;
if ( strike_index >= (FT_ULong)face->sbit_num_strikes )
@@ -374,14 +324,11 @@
if ( p + 5 > limit )
goto Fail;
- if ( !decoder->metrics_loaded )
- {
- metrics->height = p[0];
- metrics->width = p[1];
- metrics->horiBearingX = (FT_Char)p[2];
- metrics->horiBearingY = (FT_Char)p[3];
- metrics->horiAdvance = p[4];
- }
+ metrics->height = p[0];
+ metrics->width = p[1];
+ metrics->horiBearingX = (FT_Char)p[2];
+ metrics->horiBearingY = (FT_Char)p[3];
+ metrics->horiAdvance = p[4];
p += 5;
if ( big )
@@ -389,19 +336,16 @@
if ( p + 3 > limit )
goto Fail;
- if ( !decoder->metrics_loaded )
- {
- metrics->vertBearingX = (FT_Char)p[0];
- metrics->vertBearingY = (FT_Char)p[1];
- metrics->vertAdvance = p[2];
- }
+ metrics->vertBearingX = (FT_Char)p[0];
+ metrics->vertBearingY = (FT_Char)p[1];
+ metrics->vertAdvance = p[2];
p += 3;
}
decoder->metrics_loaded = 1;
*pp = p;
- return 0;
+ return SFNT_Err_Ok;
Fail:
return SFNT_Err_Invalid_Argument;
@@ -507,7 +451,7 @@
if ( w > 0 )
wval = (FT_UInt)( wval | ( *p++ & ( 0xFF00U >> w ) ) );
- /* all bits read and there are ( x_pos + w ) bits to be written */
+ /* all bits read and there are `x_pos + w' bits to be written */
write[0] = (FT_Byte)( write[0] | ( wval >> x_pos ) );
@@ -587,7 +531,12 @@
{
w = ( width < 8 - x_pos ) ? width : 8 - x_pos;
- if ( nbits < w )
+ if ( h == height )
+ {
+ rval |= *p++;
+ nbits += x_pos;
+ }
+ else if ( nbits < w )
{
rval |= *p++;
nbits += 8 - w;
@@ -598,7 +547,8 @@
nbits -= w;
}
- *write++ |= ( ( rval >> nbits ) & 0xFF ) & ~( 0xFF << w );
+ *write++ |= ( ( rval >> nbits ) & 0xFF ) &
+ ( ~( 0xFF << w ) << ( 8 - w - x_pos ) );
rval <<= 8;
w = width - w;
@@ -645,6 +595,13 @@
FT_Error error = SFNT_Err_Ok;
FT_UInt num_components, nn;
+ FT_Char horiBearingX = decoder->metrics->horiBearingX;
+ FT_Char horiBearingY = decoder->metrics->horiBearingY;
+ FT_Byte horiAdvance = decoder->metrics->horiAdvance;
+ FT_Char vertBearingX = decoder->metrics->vertBearingX;
+ FT_Char vertBearingY = decoder->metrics->vertBearingY;
+ FT_Byte vertAdvance = decoder->metrics->vertAdvance;
+
if ( p + 2 > limit )
goto Fail;
@@ -653,6 +610,13 @@
if ( p + 4 * num_components > limit )
goto Fail;
+ if ( !decoder->bitmap_allocated )
+ {
+ error = tt_sbit_decoder_alloc_bitmap( decoder );
+ if ( error )
+ goto Exit;
+ }
+
for ( nn = 0; nn < num_components; nn++ )
{
FT_UInt gindex = FT_NEXT_USHORT( p );
@@ -667,6 +631,15 @@
break;
}
+ decoder->metrics->horiBearingX = horiBearingX;
+ decoder->metrics->horiBearingY = horiBearingY;
+ decoder->metrics->horiAdvance = horiAdvance;
+ decoder->metrics->vertBearingX = vertBearingX;
+ decoder->metrics->vertBearingY = vertBearingY;
+ decoder->metrics->vertAdvance = vertAdvance;
+ decoder->metrics->width = (FT_UInt)decoder->bitmap->width;
+ decoder->metrics->height = (FT_UInt)decoder->bitmap->rows;
+
Exit:
return error;
diff --git a/src/smooth/ftgrays.c b/src/smooth/ftgrays.c
index add1dd2..10fa2ae 100644
--- a/src/smooth/ftgrays.c
+++ b/src/smooth/ftgrays.c
@@ -4,7 +4,7 @@
/* */
/* A new `perfect' anti-aliasing renderer (body). */
/* */
-/* Copyright 2000-2001, 2002, 2003, 2005, 2006, 2007 by */
+/* Copyright 2000-2001, 2002, 2003, 2005, 2006, 2007, 2008 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -91,11 +91,19 @@
#define FT_COMPONENT trace_smooth
+#ifdef _STANDALONE_
-#ifdef _STANDALONE_
+ /* define this to dump debugging information */
+/* #define FT_DEBUG_LEVEL_TRACE */
+
+
+#ifdef FT_DEBUG_LEVEL_TRACE
+#include <stdio.h>
+#include <stdarg.h>
+#endif
-#include <string.h> /* for ft_memcpy() */
+#include <string.h>
#include <setjmp.h>
#include <limits.h>
#define FT_UINT_MAX UINT_MAX
@@ -118,24 +126,53 @@
#include "ftimage.h"
#include "ftgrays.h"
+
/* This macro is used to indicate that a function parameter is unused. */
/* Its purpose is simply to reduce compiler warnings. Note also that */
/* simply defining it as `(void)x' doesn't avoid warnings with certain */
/* ANSI compilers (e.g. LCC). */
#define FT_UNUSED( x ) (x) = (x)
- /* Disable the tracing mechanism for simplicity -- developers can */
- /* activate it easily by redefining these two macros. */
+
+ /* we only use level 5 & 7 tracing messages; cf. ftdebug.h */
+
+#ifdef FT_DEBUG_LEVEL_TRACE
+
+ void
+ FT_Message( const char* fmt,
+ ... )
+ {
+ va_list ap;
+
+
+ va_start( ap, fmt );
+ vfprintf( stderr, fmt, ap );
+ va_end( ap );
+ }
+
+ /* we don't handle tracing levels in stand-alone mode; */
+#ifndef FT_TRACE5
+#define FT_TRACE5( varformat ) FT_Message varformat
+#endif
+#ifndef FT_TRACE7
+#define FT_TRACE7( varformat ) FT_Message varformat
+#endif
#ifndef FT_ERROR
-#define FT_ERROR( x ) do ; while ( 0 ) /* nothing */
+#define FT_ERROR( varformat ) FT_Message varformat
#endif
-#ifndef FT_TRACE
-#define FT_TRACE( x ) do ; while ( 0 ) /* nothing */
-#endif
+#else /* !FT_DEBUG_LEVEL_TRACE */
+
+#define FT_TRACE5( x ) do { } while ( 0 ) /* nothing */
+#define FT_TRACE7( x ) do { } while ( 0 ) /* nothing */
+#define FT_ERROR( x ) do { } while ( 0 ) /* nothing */
+
+#endif /* !FT_DEBUG_LEVEL_TRACE */
+
#else /* !_STANDALONE_ */
+
#include <ft2build.h>
#include "ftgrays.h"
#include FT_INTERNAL_OBJECTS_H
@@ -147,7 +184,7 @@
#define ErrRaster_Invalid_Mode Smooth_Err_Cannot_Render_Glyph
#define ErrRaster_Invalid_Outline Smooth_Err_Invalid_Outline
#define ErrRaster_Memory_Overflow Smooth_Err_Out_Of_Memory
-#define ErrRaster_Invalid_Argument Smooth_Err_Bad_Argument
+#define ErrRaster_Invalid_Argument Smooth_Err_Invalid_Argument
#endif /* !_STANDALONE_ */
@@ -160,10 +197,6 @@
#define FT_MEM_ZERO( dest, count ) FT_MEM_SET( dest, 0, count )
#endif
- /* define this to dump debugging information */
-#define xxxDEBUG_GRAYS
-
-
/* as usual, for the speed hungry :-) */
#ifndef FT_STATIC_RASTER
@@ -398,8 +431,8 @@
int x = ras.ex;
- if ( x > ras.max_ex )
- x = ras.max_ex;
+ if ( x > ras.count_ex )
+ x = ras.count_ex;
pcell = &ras.ycells[ras.ey];
for (;;)
@@ -1207,7 +1240,7 @@
x += (TCoord)ras.min_ex;
/* FT_Span.x is a 16-bit short, so limit our coordinates appropriately */
- if ( x >= 32768 )
+ if ( x >= 32767 )
x = 32767;
if ( coverage )
@@ -1229,24 +1262,23 @@
if ( ras.render_span && count > 0 )
ras.render_span( ras.span_y, count, ras.gray_spans,
ras.render_span_data );
- /* ras.render_span( span->y, ras.gray_spans, count ); */
-#ifdef DEBUG_GRAYS
+#ifdef FT_DEBUG_LEVEL_TRACE
- if ( ras.span_y >= 0 )
+ if ( count > 0 )
{
int n;
- fprintf( stderr, "y=%3d ", ras.span_y );
+ FT_TRACE7(( "y = %3d ", ras.span_y ));
span = ras.gray_spans;
for ( n = 0; n < count; n++, span++ )
- fprintf( stderr, "[%d..%d]:%02x ",
- span->x, span->x + span->len - 1, span->coverage );
- fprintf( stderr, "\n" );
+ FT_TRACE7(( "[%d..%d]:%02x ",
+ span->x, span->x + span->len - 1, span->coverage ));
+ FT_TRACE7(( "\n" ));
}
-#endif /* DEBUG_GRAYS */
+#endif /* FT_DEBUG_LEVEL_TRACE */
ras.num_gray_spans = 0;
ras.span_y = y;
@@ -1267,9 +1299,11 @@
}
-#ifdef DEBUG_GRAYS
+#ifdef FT_DEBUG_LEVEL_TRACE
- /* to be called while in the debugger */
+ /* to be called while in the debugger -- */
+ /* this function causes a compiler warning since it is unused otherwise */
+ static void
gray_dump_cells( RAS_ARG )
{
int yindex;
@@ -1288,7 +1322,7 @@
}
}
-#endif /* DEBUG_GRAYS */
+#endif /* FT_DEBUG_LEVEL_TRACE */
static void
@@ -1304,6 +1338,8 @@
ras.num_gray_spans = 0;
+ FT_TRACE7(( "gray_sweep: start\n" ));
+
for ( yindex = 0; yindex < ras.ycount; yindex++ )
{
PCell cell = ras.ycells[yindex];
@@ -1337,6 +1373,8 @@
if ( ras.render_span && ras.num_gray_spans > 0 )
ras.render_span( ras.span_y, ras.num_gray_spans,
ras.gray_spans, ras.render_span_data );
+
+ FT_TRACE7(( "gray_sweep: end\n" ));
}
@@ -1344,7 +1382,7 @@
/*************************************************************************/
/* */
- /* The following function should only compile in stand_alone mode, */
+ /* The following function should only compile in stand-alone mode, */
/* i.e., when building this component without the rest of FreeType. */
/* */
/*************************************************************************/
@@ -1355,18 +1393,19 @@
/* FT_Outline_Decompose */
/* */
/* <Description> */
- /* Walks over an outline's structure to decompose it into individual */
- /* segments and Bezier arcs. This function is also able to emit */
+ /* Walk over an outline's structure to decompose it into individual */
+ /* segments and Bézier arcs. This function is also able to emit */
/* `move to' and `close to' operations to indicate the start and end */
/* of new contours in the outline. */
/* */
/* <Input> */
/* outline :: A pointer to the source target. */
/* */
- /* func_interface :: A table of `emitters', i.e,. function pointers */
+ /* func_interface :: A table of `emitters', i.e., function pointers */
/* called during decomposition to indicate path */
/* operations. */
/* */
+ /* <InOut> */
/* user :: A typeless pointer which is passed to each */
/* emitter during the decomposition. It can be */
/* used to store the state during the */
@@ -1375,17 +1414,13 @@
/* <Return> */
/* Error code. 0 means success. */
/* */
- static
- int FT_Outline_Decompose( const FT_Outline* outline,
- const FT_Outline_Funcs* func_interface,
- void* user )
+ static int
+ FT_Outline_Decompose( const FT_Outline* outline,
+ const FT_Outline_Funcs* func_interface,
+ void* user )
{
#undef SCALED
-#if 0
#define SCALED( x ) ( ( (x) << shift ) - delta )
-#else
-#define SCALED( x ) (x)
-#endif
FT_Vector v_last;
FT_Vector v_control;
@@ -1395,17 +1430,21 @@
FT_Vector* limit;
char* tags;
+ int error;
+
int n; /* index of contour in outline */
int first; /* index of first point in contour */
- int error;
char tag; /* current point's state */
-#if 0
- int shift = func_interface->shift;
- TPos delta = func_interface->delta;
-#endif
+ int shift;
+ TPos delta;
+ if ( !outline || !func_interface )
+ return ErrRaster_Invalid_Argument;
+
+ shift = func_interface->shift;
+ delta = func_interface->delta;
first = 0;
for ( n = 0; n < outline->n_contours; n++ )
@@ -1413,22 +1452,25 @@
int last; /* index of last point in contour */
+ FT_TRACE5(( "FT_Outline_Decompose: Outline %d\n", n ));
+
last = outline->contours[n];
+ if ( last < 0 )
+ goto Invalid_Outline;
limit = outline->points + last;
- v_start = outline->points[first];
- v_last = outline->points[last];
-
+ v_start = outline->points[first];
v_start.x = SCALED( v_start.x );
v_start.y = SCALED( v_start.y );
- v_last.x = SCALED( v_last.x );
- v_last.y = SCALED( v_last.y );
+ v_last = outline->points[last];
+ v_last.x = SCALED( v_last.x );
+ v_last.y = SCALED( v_last.y );
v_control = v_start;
point = outline->points + first;
- tags = outline->tags + first;
+ tags = outline->tags + first;
tag = FT_CURVE_TAG( tags[0] );
/* A contour cannot start with a cubic control point! */
@@ -1459,6 +1501,8 @@
tags--;
}
+ FT_TRACE5(( " move to (%.2f, %.2f)\n",
+ v_start.x / 64.0, v_start.y / 64.0 ));
error = func_interface->move_to( &v_start, user );
if ( error )
goto Exit;
@@ -1479,6 +1523,8 @@
vec.x = SCALED( point->x );
vec.y = SCALED( point->y );
+ FT_TRACE5(( " line to (%.2f, %.2f)\n",
+ vec.x / 64.0, vec.y / 64.0 ));
error = func_interface->line_to( &vec, user );
if ( error )
goto Exit;
@@ -1486,53 +1532,60 @@
}
case FT_CURVE_TAG_CONIC: /* consume conic arcs */
- {
- v_control.x = SCALED( point->x );
- v_control.y = SCALED( point->y );
-
- Do_Conic:
- if ( point < limit )
- {
- FT_Vector vec;
- FT_Vector v_middle;
+ v_control.x = SCALED( point->x );
+ v_control.y = SCALED( point->y );
+ Do_Conic:
+ if ( point < limit )
+ {
+ FT_Vector vec;
+ FT_Vector v_middle;
- point++;
- tags++;
- tag = FT_CURVE_TAG( tags[0] );
-
- vec.x = SCALED( point->x );
- vec.y = SCALED( point->y );
-
- if ( tag == FT_CURVE_TAG_ON )
- {
- error = func_interface->conic_to( &v_control, &vec,
- user );
- if ( error )
- goto Exit;
- continue;
- }
- if ( tag != FT_CURVE_TAG_CONIC )
- goto Invalid_Outline;
+ point++;
+ tags++;
+ tag = FT_CURVE_TAG( tags[0] );
- v_middle.x = ( v_control.x + vec.x ) / 2;
- v_middle.y = ( v_control.y + vec.y ) / 2;
+ vec.x = SCALED( point->x );
+ vec.y = SCALED( point->y );
- error = func_interface->conic_to( &v_control, &v_middle,
- user );
+ if ( tag == FT_CURVE_TAG_ON )
+ {
+ FT_TRACE5(( " conic to (%.2f, %.2f)"
+ " with control (%.2f, %.2f)\n",
+ vec.x / 64.0, vec.y / 64.0,
+ v_control.x / 64.0, v_control.y / 64.0 ));
+ error = func_interface->conic_to( &v_control, &vec, user );
if ( error )
goto Exit;
-
- v_control = vec;
- goto Do_Conic;
+ continue;
}
- error = func_interface->conic_to( &v_control, &v_start,
- user );
- goto Close;
+ if ( tag != FT_CURVE_TAG_CONIC )
+ goto Invalid_Outline;
+
+ v_middle.x = ( v_control.x + vec.x ) / 2;
+ v_middle.y = ( v_control.y + vec.y ) / 2;
+
+ FT_TRACE5(( " conic to (%.2f, %.2f)"
+ " with control (%.2f, %.2f)\n",
+ v_middle.x / 64.0, v_middle.y / 64.0,
+ v_control.x / 64.0, v_control.y / 64.0 ));
+ error = func_interface->conic_to( &v_control, &v_middle, user );
+ if ( error )
+ goto Exit;
+
+ v_control = vec;
+ goto Do_Conic;
}
+ FT_TRACE5(( " conic to (%.2f, %.2f)"
+ " with control (%.2f, %.2f)\n",
+ v_start.x / 64.0, v_start.y / 64.0,
+ v_control.x / 64.0, v_control.y / 64.0 ));
+ error = func_interface->conic_to( &v_control, &v_start, user );
+ goto Close;
+
default: /* FT_CURVE_TAG_CUBIC */
{
FT_Vector vec1, vec2;
@@ -1559,12 +1612,22 @@
vec.x = SCALED( point->x );
vec.y = SCALED( point->y );
+ FT_TRACE5(( " cubic to (%.2f, %.2f)"
+ " with controls (%.2f, %.2f) and (%.2f, %.2f)\n",
+ vec.x / 64.0, vec.y / 64.0,
+ vec1.x / 64.0, vec1.y / 64.0,
+ vec2.x / 64.0, vec2.y / 64.0 ));
error = func_interface->cubic_to( &vec1, &vec2, &vec, user );
if ( error )
goto Exit;
continue;
}
+ FT_TRACE5(( " cubic to (%.2f, %.2f)"
+ " with controls (%.2f, %.2f) and (%.2f, %.2f)\n",
+ v_start.x / 64.0, v_start.y / 64.0,
+ vec1.x / 64.0, vec1.y / 64.0,
+ vec2.x / 64.0, vec2.y / 64.0 ));
error = func_interface->cubic_to( &vec1, &vec2, &v_start, user );
goto Close;
}
@@ -1572,6 +1635,8 @@
}
/* close the contour with a line segment */
+ FT_TRACE5(( " line to (%.2f, %.2f)\n",
+ v_start.x / 64.0, v_start.y / 64.0 ));
error = func_interface->line_to( &v_start, user );
Close:
@@ -1581,9 +1646,11 @@
first = last + 1;
}
+ FT_TRACE5(( "FT_Outline_Decompose: Done\n", n ));
return 0;
Exit:
+ FT_TRACE5(( "FT_Outline_Decompose: Error %d\n", error ));
return error;
Invalid_Outline:
@@ -1616,15 +1683,14 @@
volatile int error = 0;
+
if ( ft_setjmp( ras.jump_buffer ) == 0 )
{
error = FT_Outline_Decompose( &ras.outline, &func_interface, &ras );
gray_record_cell( RAS_VAR );
}
else
- {
error = ErrRaster_Memory_Overflow;
- }
return error;
}
@@ -1666,7 +1732,7 @@
ras.cubic_level = 16;
{
- int level = 0;
+ int level = 0;
if ( ras.count_ex > 24 || ras.count_ey > 24 )
@@ -1678,10 +1744,12 @@
ras.cubic_level <<= level;
}
- /* setup vertical bands */
+ /* set up vertical bands */
num_bands = (int)( ( ras.max_ey - ras.min_ey ) / ras.band_size );
- if ( num_bands == 0 ) num_bands = 1;
- if ( num_bands >= 39 ) num_bands = 39;
+ if ( num_bands == 0 )
+ num_bands = 1;
+ if ( num_bands >= 39 )
+ num_bands = 39;
ras.band_shoot = 0;
@@ -1760,8 +1828,8 @@
/* be some problems. */
if ( middle == bottom )
{
-#ifdef DEBUG_GRAYS
- fprintf( stderr, "Rotten glyph!\n" );
+#ifdef FT_DEBUG_LEVEL_TRACE
+ FT_TRACE7(( "gray_convert_glyph: Rotten glyph!\n" ));
#endif
return 1;
}
@@ -1813,7 +1881,7 @@
worker = raster->worker;
/* if direct mode is not set, we must have a target bitmap */
- if ( ( params->flags & FT_RASTER_FLAG_DIRECT ) == 0 )
+ if ( !( params->flags & FT_RASTER_FLAG_DIRECT ) )
{
if ( !target_map )
return ErrRaster_Invalid_Argument;
@@ -1831,7 +1899,7 @@
return ErrRaster_Invalid_Mode;
/* compute clipping box */
- if ( ( params->flags & FT_RASTER_FLAG_DIRECT ) == 0 )
+ if ( !( params->flags & FT_RASTER_FLAG_DIRECT ) )
{
/* compute clip box from target pixmap */
ras.clip_box.xMin = 0;
@@ -1840,9 +1908,7 @@
ras.clip_box.yMax = target_map->rows;
}
else if ( params->flags & FT_RASTER_FLAG_CLIP )
- {
ras.clip_box = params->clip_box;
- }
else
{
ras.clip_box.xMin = -32768L;
@@ -1859,24 +1925,24 @@
ras.band_size = raster->band_size;
ras.num_gray_spans = 0;
- if ( target_map )
- ras.target = *target_map;
-
- ras.render_span = (FT_Raster_Span_Func)gray_render_span;
- ras.render_span_data = &ras;
-
if ( params->flags & FT_RASTER_FLAG_DIRECT )
{
ras.render_span = (FT_Raster_Span_Func)params->gray_spans;
ras.render_span_data = params->user;
}
+ else
+ {
+ ras.target = *target_map;
+ ras.render_span = (FT_Raster_Span_Func)gray_render_span;
+ ras.render_span_data = &ras;
+ }
return gray_convert_glyph( worker );
}
- /**** RASTER OBJECT CREATION: In standalone mode, we simply use *****/
- /**** a static object. *****/
+ /**** RASTER OBJECT CREATION: In stand-alone mode, we simply use *****/
+ /**** a static object. *****/
#ifdef _STANDALONE_
@@ -1984,3 +2050,8 @@
/* END */
+
+
+/* Local Variables: */
+/* coding: utf-8 */
+/* End: */
diff --git a/src/smooth/ftsmooth.c b/src/smooth/ftsmooth.c
index 85d04eb..a6db504 100644
--- a/src/smooth/ftsmooth.c
+++ b/src/smooth/ftsmooth.c
@@ -4,7 +4,7 @@
/* */
/* Anti-aliasing renderer interface (body). */
/* */
-/* Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006 by */
+/* Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -294,13 +294,13 @@
for ( hh = height_org; hh > 0; hh-- )
{
- memcpy( write, read, pitch );
+ ft_memcpy( write, read, pitch );
write += pitch;
- memcpy( write, read, pitch );
+ ft_memcpy( write, read, pitch );
write += pitch;
- memcpy( write, read, pitch );
+ ft_memcpy( write, read, pitch );
write += pitch;
read += pitch;
}
diff --git a/src/truetype/ttdriver.c b/src/truetype/ttdriver.c
index 2647cf5..42feb05 100644
--- a/src/truetype/ttdriver.c
+++ b/src/truetype/ttdriver.c
@@ -4,7 +4,7 @@
/* */
/* TrueType font driver implementation (body). */
/* */
-/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007 by */
+/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -129,38 +129,43 @@
tt_get_advances( FT_Face ttface,
FT_UInt start,
FT_UInt count,
- FT_UInt flags,
+ FT_Int32 flags,
FT_Fixed *advances )
{
FT_UInt nn;
TT_Face face = (TT_Face) ttface;
- FT_Bool check = FT_BOOL(!(flags & FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH));
+ FT_Bool check = FT_BOOL(
+ !( flags & FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH ) );
+
/* XXX: TODO: check for sbits */
- if (flags & FT_LOAD_VERTICAL_LAYOUT)
+ if ( flags & FT_LOAD_VERTICAL_LAYOUT )
{
- for (nn = 0; nn < count; nn++)
+ for ( nn = 0; nn < count; nn++ )
{
FT_Short tsb;
FT_UShort ah;
+
TT_Get_VMetrics( face, start + nn, check, &tsb, &ah );
advances[nn] = ah;
}
}
else
{
- for (nn = 0; nn < count; nn++)
+ for ( nn = 0; nn < count; nn++ )
{
FT_Short lsb;
FT_UShort aw;
+
TT_Get_HMetrics( face, start + nn, check, &lsb, &aw );
advances[nn] = aw;
}
}
- return 0;
+
+ return TT_Err_Ok;
}
/*************************************************************************/
@@ -267,7 +272,7 @@
/* glyph_index :: The index of the glyph in the font file. */
/* */
/* load_flags :: A flag indicating what to load for this glyph. The */
- /* FTLOAD_??? constants can be used to control the */
+ /* FT_LOAD_XXX constants can be used to control the */
/* glyph loading process (e.g., whether the outline */
/* should be scaled, whether to load bitmaps or not, */
/* whether to hint the outline, etc). */
@@ -296,11 +301,24 @@
if ( !face || glyph_index >= (FT_UInt)face->num_glyphs )
return TT_Err_Invalid_Argument;
+ if ( load_flags & FT_LOAD_NO_HINTING )
+ {
+ /* both FT_LOAD_NO_HINTING and FT_LOAD_NO_AUTOHINT */
+ /* are necessary to disable hinting for tricky fonts */
+
+ if ( FT_IS_TRICKY( face ) )
+ load_flags &= ~FT_LOAD_NO_HINTING;
+
+ if ( load_flags & FT_LOAD_NO_AUTOHINT )
+ load_flags |= FT_LOAD_NO_HINTING;
+ }
+
if ( load_flags & ( FT_LOAD_NO_RECURSE | FT_LOAD_NO_SCALE ) )
{
- load_flags |= FT_LOAD_NO_HINTING |
- FT_LOAD_NO_BITMAP |
- FT_LOAD_NO_SCALE;
+ load_flags |= FT_LOAD_NO_BITMAP | FT_LOAD_NO_SCALE;
+
+ if ( !FT_IS_TRICKY( face ) )
+ load_flags |= FT_LOAD_NO_HINTING;
}
/* now load the glyph outline if necessary */
diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c
index ddcea97..06e9ccd 100644
--- a/src/truetype/ttgload.c
+++ b/src/truetype/ttgload.c
@@ -382,8 +382,8 @@
for ( ; vec < vec_limit; vec++, flag++ )
{
- FT_Pos y = 0;
- FT_Byte f = *flag;
+ FT_Pos y = 0;
+ FT_Byte f = *flag;
if ( f & 2 )
@@ -405,7 +405,8 @@
x += y;
vec->x = x;
- *flag = f & ~( 2 | 16 );
+ /* the cast is for stupid compilers */
+ *flag = (FT_Byte)( f & ~( 2 | 16 ) );
}
/* reading the Y coordinates */
@@ -417,8 +418,8 @@
for ( ; vec < vec_limit; vec++, flag++ )
{
- FT_Pos y = 0;
- FT_Byte f = *flag;
+ FT_Pos y = 0;
+ FT_Byte f = *flag;
if ( f & 4 )
@@ -440,7 +441,8 @@
x += y;
vec->y = x;
- *flag = f & FT_CURVE_TAG_ON;
+ /* the cast is for stupid compilers */
+ *flag = (FT_Byte)( f & FT_CURVE_TAG_ON );
}
outline->n_points = (FT_UShort)n_points;
@@ -557,10 +559,10 @@
FT_Stream stream = loader->stream;
- /* we must undo the FT_FRAME_ENTER in order to point to the */
- /* composite instructions, if we find some. */
- /* we will process them later... */
- /* */
+ /* we must undo the FT_FRAME_ENTER in order to point */
+ /* to the composite instructions, if we find some. */
+ /* We will process them later. */
+ /* */
loader->ins_pos = (FT_ULong)( FT_STREAM_POS() +
p - limit );
}
@@ -643,6 +645,7 @@
/* save original point position in org */
if ( n_ins > 0 )
FT_ARRAY_COPY( zone->org, zone->cur, zone->n_points );
+
/* Reset graphics state. */
loader->exec->GS = ((TT_Size)loader->size)->GS;
@@ -1242,6 +1245,13 @@
if ( loader->byte_len > 0 )
{
+ if ( !loader->glyf_offset )
+ {
+ FT_TRACE2(( "no `glyf' table but non-zero `loca' entry!\n" ));
+ error = TT_Err_Invalid_Table;
+ goto Exit;
+ }
+
error = face->access_glyph_frame( loader, glyph_index,
loader->glyf_offset + offset,
loader->byte_len );
@@ -1435,7 +1445,6 @@
FT_Vector pp[4];
-
/* Each time we call load_truetype_glyph in this loop, the */
/* value of `gloader.base.subglyphs' can change due to table */
/* reallocations. We thus need to recompute the subglyph */
@@ -1668,8 +1677,8 @@
}
/* adjust advance width to the value contained in the hdmx table */
- if ( !face->postscript.isFixedPitch &&
- IS_HINTED( loader->load_flags ) )
+ if ( !face->postscript.isFixedPitch &&
+ IS_HINTED( loader->load_flags ) )
{
FT_Byte* widthp;
@@ -1838,12 +1847,15 @@
FT_Error error = face->goto_table( face, TTAG_glyf, stream, 0 );
- if ( error )
+ if ( error == TT_Err_Table_Missing )
+ loader->glyf_offset = 0;
+ else if ( error )
{
FT_ERROR(( "TT_Load_Glyph: could not access glyph table\n" ));
return error;
}
- loader->glyf_offset = FT_STREAM_POS();
+ else
+ loader->glyf_offset = FT_STREAM_POS();
}
/* get face's glyph loader */
@@ -1855,7 +1867,7 @@
loader->gloader = gloader;
}
- loader->load_flags = load_flags;
+ loader->load_flags = load_flags;
loader->face = (FT_Face)face;
loader->size = (FT_Size)size;
@@ -1958,6 +1970,40 @@
FT_Outline_Translate( &glyph->outline, -loader.pp1.x, 0 );
}
+#ifdef TT_USE_BYTECODE_INTERPRETER
+
+ if ( IS_HINTED( load_flags ) )
+ {
+ if ( loader.exec->GS.scan_control )
+ {
+ /* convert scan conversion mode to FT_OUTLINE_XXX flags */
+ switch ( loader.exec->GS.scan_type )
+ {
+ case 0: /* simple drop-outs including stubs */
+ glyph->outline.flags |= FT_OUTLINE_INCLUDE_STUBS;
+ break;
+ case 1: /* simple drop-outs excluding stubs */
+ /* nothing; it's the default rendering mode */
+ break;
+ case 4: /* smart drop-outs including stubs */
+ glyph->outline.flags |= FT_OUTLINE_SMART_DROPOUTS |
+ FT_OUTLINE_INCLUDE_STUBS;
+ break;
+ case 5: /* smart drop-outs excluding stubs */
+ glyph->outline.flags |= FT_OUTLINE_SMART_DROPOUTS;
+ break;
+
+ default: /* no drop-out control */
+ glyph->outline.flags |= FT_OUTLINE_IGNORE_DROPOUTS;
+ break;
+ }
+ }
+ else
+ glyph->outline.flags |= FT_OUTLINE_IGNORE_DROPOUTS;
+ }
+
+#endif /* TT_USE_BYTECODE_INTERPRETER */
+
compute_glyph_metrics( &loader, glyph_index );
}
diff --git a/src/truetype/ttgload.h b/src/truetype/ttgload.h
index 313bb14..958d67d 100644
--- a/src/truetype/ttgload.h
+++ b/src/truetype/ttgload.h
@@ -4,7 +4,7 @@
/* */
/* TrueType Glyph Loader (specification). */
/* */
-/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006 by */
+/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2008 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -34,14 +34,14 @@ FT_BEGIN_HEADER
FT_LOCAL( void )
TT_Init_Glyph_Loading( TT_Face face );
- FT_LOCAL(void)
+ FT_LOCAL( void )
TT_Get_HMetrics( TT_Face face,
FT_UInt idx,
FT_Bool check,
FT_Short* lsb,
FT_UShort* aw );
- FT_LOCAL(void)
+ FT_LOCAL( void )
TT_Get_VMetrics( TT_Face face,
FT_UInt idx,
FT_Bool check,
diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c
index 0b3adbc..515e734 100644
--- a/src/truetype/ttgxvar.c
+++ b/src/truetype/ttgxvar.c
@@ -905,13 +905,15 @@
}
else
{
- for ( i = 0;
- i < num_coords && blend->normalizedcoords[i] == coords[i];
- ++i );
- if ( i == num_coords )
- manageCvt = mcvt_retain;
- else
+ manageCvt = mcvt_retain;
+ for ( i = 0; i < num_coords; ++i )
+ {
+ if ( blend->normalizedcoords[i] != coords[i] )
+ {
manageCvt = mcvt_load;
+ break;
+ }
+ }
/* If we don't change the blend coords then we don't need to do */
/* anything to the cvt table. It will be correct. Otherwise we */
diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c
index f9c3656..2279a62 100644
--- a/src/truetype/ttinterp.c
+++ b/src/truetype/ttinterp.c
@@ -4,7 +4,7 @@
/* */
/* TrueType bytecode interpreter (body). */
/* */
-/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by */
+/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -693,7 +693,7 @@
/* exec :: A handle to the target execution context. */
/* */
/* <Return> */
- /* TrueTyoe error code. 0 means success. */
+ /* TrueType error code. 0 means success. */
/* */
/* <Note> */
/* Only the glyph loader and debugger should call this function. */
@@ -748,6 +748,13 @@
}
+ /* The default value for `scan_control' is documented as FALSE in the */
+ /* TrueType specification. This is confusing since it implies a */
+ /* Boolean value. However, this is not the case, thus both the */
+ /* default values of our `scan_type' and `scan_control' fields (which */
+ /* the documentation's `scan_control' variable is split into) are */
+ /* zero. */
+
const TT_GraphicsState tt_default_graphics_state =
{
0, 0, 0,
@@ -761,7 +768,7 @@
1, 64, 1,
TRUE, 68, 0, 0, 9, 3,
- 0, FALSE, 2, 1, 1, 1
+ 0, FALSE, 0, 1, 1, 1
};
@@ -5092,12 +5099,8 @@
return;
}
- A *= 64;
-
-#if 0
- if ( ( args[0] & 0x100 ) != 0 && CUR.metrics.pointSize <= A )
+ if ( ( args[0] & 0x100 ) != 0 && CUR.tt_metrics.ppem <= A )
CUR.GS.scan_control = TRUE;
-#endif
if ( ( args[0] & 0x200 ) != 0 && CUR.tt_metrics.rotated )
CUR.GS.scan_control = TRUE;
@@ -5105,10 +5108,8 @@
if ( ( args[0] & 0x400 ) != 0 && CUR.tt_metrics.stretched )
CUR.GS.scan_control = TRUE;
-#if 0
- if ( ( args[0] & 0x800 ) != 0 && CUR.metrics.pointSize > A )
+ if ( ( args[0] & 0x800 ) != 0 && CUR.tt_metrics.ppem > A )
CUR.GS.scan_control = FALSE;
-#endif
if ( ( args[0] & 0x1000 ) != 0 && CUR.tt_metrics.rotated )
CUR.GS.scan_control = FALSE;
@@ -5127,16 +5128,8 @@
static void
Ins_SCANTYPE( INS_ARG )
{
- /* for compatibility with future enhancements, */
- /* we must ignore new modes */
-
- if ( args[0] >= 0 && args[0] <= 5 )
- {
- if ( args[0] == 3 )
- args[0] = 2;
-
+ if ( args[0] >= 0 )
CUR.GS.scan_type = (FT_Int)args[0];
- }
}
@@ -6395,7 +6388,7 @@
{
scale_valid = 1;
scale = TT_MULDIV( org2 + delta2 - ( org1 + delta1 ),
- 0x10000, orus2 - orus1 );
+ 0x10000L, orus2 - orus1 );
}
x = ( org1 + delta1 ) +
diff --git a/src/truetype/ttobjs.c b/src/truetype/ttobjs.c
index 801559f..2649a67 100644
--- a/src/truetype/ttobjs.c
+++ b/src/truetype/ttobjs.c
@@ -4,7 +4,7 @@
/* */
/* Objects manager (body). */
/* */
-/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007 by */
+/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -144,6 +144,39 @@
#endif /* TT_USE_BYTECODE_INTERPRETER */
+ /* Compare the face with a list of well-known `tricky' fonts. */
+ /* This list shall be expanded as we find more of them. */
+
+ static FT_Bool
+ tt_check_trickyness( FT_String* name )
+ {
+ static const char* const trick_names[] =
+ {
+ "DFKaiSho-SB", /* dfkaisb.ttf */
+ "DFKaiShu",
+ "DFKai-SB", /* kaiu.ttf */
+ "HuaTianSongTi?", /* htst3.ttf */
+ "MingLiU", /* mingliu.ttf & mingliu.ttc */
+ "PMingLiU", /* mingliu.ttc */
+ "MingLi43", /* mingli.ttf */
+ NULL
+ };
+ int nn;
+
+
+ if ( !name )
+ return FALSE;
+
+ /* Note that we only check the face name at the moment; it might */
+ /* be worth to do more checks for a few special cases. */
+ for ( nn = 0; trick_names[nn] != NULL; nn++ )
+ if ( ft_strstr( name, trick_names[nn] ) )
+ return TRUE;
+
+ return FALSE;
+ }
+
+
/*************************************************************************/
/* */
/* <Function> */
@@ -180,7 +213,7 @@
TT_Face face = (TT_Face)ttface;
- library = face->root.driver->root.library;
+ library = ttface->driver->root.library;
sfnt = (SFNT_Service)FT_Get_Module_Interface( library, "sfnt" );
if ( !sfnt )
goto Bad_Format;
@@ -206,7 +239,7 @@
}
#ifdef TT_USE_BYTECODE_INTERPRETER
- face->root.face_flags |= FT_FACE_FLAG_HINTER;
+ ttface->face_flags |= FT_FACE_FLAG_HINTER;
#endif
/* If we are performing a simple font format check, exit immediately. */
@@ -218,16 +251,19 @@
if ( error )
goto Exit;
+ if ( tt_check_trickyness( ttface->family_name ) )
+ ttface->face_flags |= FT_FACE_FLAG_TRICKY;
+
error = tt_face_load_hdmx( face, stream );
if ( error )
goto Exit;
- if ( face->root.face_flags & FT_FACE_FLAG_SCALABLE )
+ if ( FT_IS_SCALABLE( ttface ) )
{
#ifdef FT_CONFIG_OPTION_INCREMENTAL
- if ( !face->root.internal->incremental_interface )
+ if ( !ttface->internal->incremental_interface )
error = tt_face_load_loca( face, stream );
if ( !error )
error = tt_face_load_cvt( face, stream );
@@ -267,38 +303,8 @@
if ( params[i].tag == FT_PARAM_TAG_UNPATENTED_HINTING )
unpatented_hinting = TRUE;
- /* Compare the face with a list of well-known `tricky' fonts. */
- /* This list shall be expanded as we find more of them. */
if ( !unpatented_hinting )
- {
- static const char* const trick_names[] =
- {
- "DFKaiSho-SB", /* dfkaisb.ttf */
- "DFKai-SB", /* kaiu.ttf */
- "HuaTianSongTi?", /* htst3.ttf */
- "MingLiU", /* mingliu.ttf & mingliu.ttc */
- "PMingLiU", /* mingliu.ttc */
- "MingLi43", /* mingli.ttf */
- NULL
- };
- int nn;
-
-
- /* Note that we only check the face name at the moment; it might */
- /* be worth to do more checks for a few special cases. */
- for ( nn = 0; trick_names[nn] != NULL; nn++ )
- {
- if ( ttface->family_name &&
- ft_strstr( ttface->family_name, trick_names[nn] ) )
- {
- unpatented_hinting = 1;
- break;
- }
- }
- }
-
- ttface->internal->ignore_unpatented_hinter =
- FT_BOOL( !unpatented_hinting );
+ ttface->internal->ignore_unpatented_hinter = TRUE;
}
#endif /* TT_CONFIG_OPTION_UNPATENTED_HINTING &&
@@ -330,12 +336,18 @@
FT_LOCAL_DEF( void )
tt_face_done( FT_Face ttface ) /* TT_Face */
{
- TT_Face face = (TT_Face)ttface;
- FT_Memory memory = face->root.memory;
- FT_Stream stream = face->root.stream;
+ TT_Face face = (TT_Face)ttface;
+ FT_Memory memory;
+ FT_Stream stream;
+ SFNT_Service sfnt;
+
- SFNT_Service sfnt = (SFNT_Service)face->sfnt;
+ if ( !face )
+ return;
+ memory = ttface->memory;
+ stream = ttface->stream;
+ sfnt = (SFNT_Service)face->sfnt;
/* for `extended TrueType formats' (i.e. compressed versions) */
if ( face->extra.finalizer )
@@ -674,7 +686,7 @@
if ( !size->cvt_ready )
{
FT_UInt i;
- TT_Face face = (TT_Face) size->root.face;
+ TT_Face face = (TT_Face)size->root.face;
/* Scale the cvt values to the new ppem. */
diff --git a/src/truetype/ttobjs.h b/src/truetype/ttobjs.h
index 6971013..d4b8228 100644
--- a/src/truetype/ttobjs.h
+++ b/src/truetype/ttobjs.h
@@ -4,7 +4,7 @@
/* */
/* Objects manager (specification). */
/* */
-/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007 by */
+/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -99,6 +99,10 @@ FT_BEGIN_HEADER
FT_Short delta_shift;
FT_Byte instruct_control;
+ /* According to Greg Hitchcock from Microsoft, the `scan_control' */
+ /* variable as documented in the TrueType specification is a 32-bit */
+ /* integer; the high-word part holds the SCANTYPE value, the low-word */
+ /* part the SCANCTRL value. We separate it into two fields. */
FT_Bool scan_control;
FT_Int scan_type;
diff --git a/src/truetype/ttpload.c b/src/truetype/ttpload.c
index 9d3381b..dc538fb 100644
--- a/src/truetype/ttpload.c
+++ b/src/truetype/ttpload.c
@@ -4,7 +4,7 @@
/* */
/* TrueType-specific tables loader (body). */
/* */
-/* Copyright 1996-2001, 2002, 2004, 2005, 2006, 2007 by */
+/* Copyright 1996-2001, 2002, 2004, 2005, 2006, 2007, 2008 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -65,11 +65,17 @@
{
FT_Error error;
FT_ULong table_len;
+ FT_Int shift;
/* we need the size of the `glyf' table for malformed `loca' tables */
error = face->goto_table( face, TTAG_glyf, stream, &face->glyf_len );
- if ( error )
+
+ /* it is possible that a font doesn't have a glyf table at all */
+ /* or its size is zero */
+ if ( error == TT_Err_Table_Missing )
+ face->glyf_len = 0;
+ else if ( error )
goto Exit;
FT_TRACE2(( "Locations " ));
@@ -82,23 +88,65 @@
if ( face->header.Index_To_Loc_Format != 0 )
{
+ shift = 2;
+
if ( table_len >= 0x40000L )
{
FT_TRACE2(( "table too large!\n" ));
error = TT_Err_Invalid_Table;
goto Exit;
}
- face->num_locations = (FT_UInt)( table_len >> 2 );
+ face->num_locations = (FT_UInt)( table_len >> shift );
}
else
{
+ shift = 1;
+
if ( table_len >= 0x20000L )
{
FT_TRACE2(( "table too large!\n" ));
error = TT_Err_Invalid_Table;
goto Exit;
}
- face->num_locations = (FT_UInt)( table_len >> 1 );
+ face->num_locations = (FT_UInt)( table_len >> shift );
+ }
+
+ if ( face->num_locations != (FT_UInt)face->root.num_glyphs )
+ {
+ FT_TRACE2(( "glyph count mismatch! loca: %d, maxp: %d\n",
+ face->num_locations, face->root.num_glyphs ));
+
+ /* we only handle the case where `maxp' gives a larger value */
+ if ( face->num_locations < (FT_UInt)face->root.num_glyphs )
+ {
+ FT_Long new_loca_len = (FT_Long)face->root.num_glyphs << shift;
+
+ TT_Table entry = face->dir_tables;
+ TT_Table limit = entry + face->num_tables;
+
+ FT_Long pos = FT_Stream_Pos( stream );
+ FT_Long dist = 0x7FFFFFFFL;
+
+
+ /* compute the distance to next table in font file */
+ for ( ; entry < limit; entry++ )
+ {
+ FT_Long diff = entry->Offset - pos;
+
+
+ if ( diff > 0 && diff < dist )
+ dist = diff;
+ }
+
+ if ( new_loca_len <= dist )
+ {
+ face->num_locations = (FT_Long)face->root.num_glyphs;
+ table_len = new_loca_len;
+
+ FT_TRACE2(( "adjusting num_locations to %d\n",
+ face->num_locations ));
+ }
+ }
}
/*
@@ -162,6 +210,9 @@
/* Anyway, there do exist (malformed) fonts which don't obey */
/* this rule, so we are only able to provide an upper bound for */
/* the size. */
+ /* */
+ /* We get (intentionally) a wrong, non-zero result in case the */
+ /* `glyf' table is missing. */
if ( pos2 >= pos1 )
*asize = (FT_UInt)( pos2 - pos1 );
else