merged freetype 2.3.12

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35566 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jérôme Duval
2010-02-21 20:08:50 +00:00
parent 9d071e27f1
commit dd4974484f
44 changed files with 620 additions and 294 deletions
@@ -4,7 +4,7 @@
/* */ /* */
/* ANSI-specific configuration file (specification only). */ /* ANSI-specific configuration file (specification only). */
/* */ /* */
/* Copyright 1996-2001, 2002, 2003, 2004, 2006, 2007, 2008 by */ /* Copyright 1996-2001, 2002, 2003, 2004, 2006, 2007, 2008, 2010 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@@ -35,7 +35,6 @@
/* */ /* */
/*************************************************************************/ /*************************************************************************/
#ifndef __FTCONFIG_H__ #ifndef __FTCONFIG_H__
#define __FTCONFIG_H__ #define __FTCONFIG_H__
@@ -306,9 +305,38 @@ FT_BEGIN_HEADER
/* Provide assembler fragments for performance-critical functions. */ /* Provide assembler fragments for performance-critical functions. */
/* These must be defined `static __inline__' with GCC. */ /* These must be defined `static __inline__' with GCC. */
#if defined( __CC_ARM ) || defined( __ARMCC__ ) /* RVCT */
#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
{
smull t2, t, b, a /* (lo=t2,hi=t) = a*b */
mov a, t, asr #31 /* a = (hi >> 31) */
add a, a, #0x8000 /* a += 0x8000 */
adds t2, t2, a /* t2 += a */
adc t, t, #0 /* t += carry */
mov a, t2, lsr #16 /* a = t2 >> 16 */
orr a, a, t, lsl #16 /* a |= t << 16 */
}
return a;
}
#endif /* __CC_ARM || __ARMCC__ */
#ifdef __GNUC__ #ifdef __GNUC__
#if defined( __arm__ ) && !defined( __thumb__ ) #if defined( __arm__ ) && !defined( __thumb__ ) && \
!( defined( __CC_ARM ) || defined( __ARMCC__ ) )
#define FT_MULFIX_ASSEMBLER FT_MulFix_arm #define FT_MULFIX_ASSEMBLER FT_MulFix_arm
/* documentation is in freetype.h */ /* documentation is in freetype.h */
@@ -333,7 +361,7 @@ FT_BEGIN_HEADER
return a; return a;
} }
#endif /* __arm__ && !__thumb__ */ #endif /* __arm__ && !__thumb__ && !( __CC_ARM || __ARMCC__ ) */
#if defined( i386 ) #if defined( i386 )
#define FT_MULFIX_ASSEMBLER FT_MulFix_i386 #define FT_MULFIX_ASSEMBLER FT_MulFix_i386
@@ -4,7 +4,8 @@
/* */ /* */
/* User-selectable configuration macros (specification only). */ /* User-selectable configuration macros (specification only). */
/* */ /* */
/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */ /* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, */
/* 2010 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@@ -85,9 +86,9 @@ FT_BEGIN_HEADER
/* */ /* */
/* This macro has no impact on the FreeType API, only on its */ /* This macro has no impact on the FreeType API, only on its */
/* _implementation_. For example, using FT_RENDER_MODE_LCD when calling */ /* _implementation_. For example, using FT_RENDER_MODE_LCD when calling */
/* FT_Render_Glyph still generates a bitmap that is 3 times larger than */ /* FT_Render_Glyph still generates a bitmap that is 3 times wider than */
/* the original size; the difference will be that each triplet of */ /* the original size in case this macro isn't defined; however, each */
/* subpixels has R=G=B. */ /* triplet of subpixels has R=G=B. */
/* */ /* */
/* This is done to allow FreeType clients to run unmodified, forcing */ /* This is done to allow FreeType clients to run unmodified, forcing */
/* them to display normal gray-level anti-aliased glyphs. */ /* them to display normal gray-level anti-aliased glyphs. */
@@ -313,10 +314,11 @@ FT_BEGIN_HEADER
/* */ /* */
/* Allow the use of FT_Incremental_Interface to load typefaces that */ /* Allow the use of FT_Incremental_Interface to load typefaces that */
/* contain no glyph data, but supply it via a callback function. */ /* contain no glyph data, but supply it via a callback function. */
/* This allows FreeType to be used with the PostScript language, using */ /* This is required by clients supporting document formats which */
/* the GhostScript interpreter. */ /* supply font data incrementally as the document is parsed, such */
/* as the Ghostscript interpreter for the PostScript language. */
/* */ /* */
/* #define FT_CONFIG_OPTION_INCREMENTAL */ #define FT_CONFIG_OPTION_INCREMENTAL
/*************************************************************************/ /*************************************************************************/
@@ -402,7 +404,7 @@ FT_BEGIN_HEADER
/* Position Independent Code */ /* Position Independent Code */
/* */ /* */
/* If this macro is set (which is _not_ the default), FreeType2 will */ /* If this macro is set (which is _not_ the default), FreeType2 will */
/* avoid creating constants that require address fixups. Instead the */ /* avoid creating constants that require address fixups. Instead the */
/* constants will be moved into a struct and additional intialization */ /* constants will be moved into a struct and additional intialization */
/* code will be used. */ /* code will be used. */
/* */ /* */
+16 -5
View File
@@ -4,7 +4,8 @@
/* */ /* */
/* FreeType high-level API and common types (specification only). */ /* FreeType high-level API and common types (specification only). */
/* */ /* */
/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */ /* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, */
/* 2010 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@@ -231,6 +232,10 @@ FT_BEGIN_HEADER
/* vertAdvance :: */ /* vertAdvance :: */
/* Advance height for vertical layout. */ /* Advance height for vertical layout. */
/* */ /* */
/* <Note> */
/* If not disabled with @FT_LOAD_NO_HINTING, the values represent */
/* dimensions of the hinted glyph (in case hinting is applicable). */
/* */
typedef struct FT_Glyph_Metrics_ typedef struct FT_Glyph_Metrics_
{ {
FT_Pos width; FT_Pos width;
@@ -1477,8 +1482,13 @@ FT_BEGIN_HEADER
/* important to perform correct WYSIWYG layout. */ /* important to perform correct WYSIWYG layout. */
/* Only relevant for outline glyphs. */ /* Only relevant for outline glyphs. */
/* */ /* */
/* advance :: This is the transformed advance width for the */ /* advance :: This shorthand is, depending on */
/* glyph (in 26.6 fractional pixel format). */ /* @FT_LOAD_IGNORE_TRANSFORM, the transformed */
/* advance width for the glyph (in 26.6 */
/* fractional pixel format). As specified with */
/* @FT_LOAD_VERTICAL_LAYOUT, it uses either the */
/* `horiAdvance' or the `vertAdvance' value of */
/* `metrics' field. */
/* */ /* */
/* format :: This field indicates the format of the image */ /* format :: This field indicates the format of the image */
/* contained in the glyph slot. Typically */ /* contained in the glyph slot. Typically */
@@ -1743,7 +1753,8 @@ FT_BEGIN_HEADER
/* data :: A pointer to the parameter data. */ /* data :: A pointer to the parameter data. */
/* */ /* */
/* <Note> */ /* <Note> */
/* The ID and function of parameters are driver-specific. */ /* The ID and function of parameters are driver-specific. See the */
/* various FT_PARAM_TAG_XXX flags for more information. */
/* */ /* */
typedef struct FT_Parameter_ typedef struct FT_Parameter_
{ {
@@ -3763,7 +3774,7 @@ FT_BEGIN_HEADER
*/ */
#define FREETYPE_MAJOR 2 #define FREETYPE_MAJOR 2
#define FREETYPE_MINOR 3 #define FREETYPE_MINOR 3
#define FREETYPE_PATCH 11 #define FREETYPE_PATCH 12
/*************************************************************************/ /*************************************************************************/
+1 -1
View File
@@ -468,7 +468,7 @@ FT_BEGIN_HEADER
/* // convert to a bitmap (default render mode + destroying old) */ /* // convert to a bitmap (default render mode + destroying old) */
/* if ( glyph->format != FT_GLYPH_FORMAT_BITMAP ) */ /* if ( glyph->format != FT_GLYPH_FORMAT_BITMAP ) */
/* { */ /* { */
/* error = FT_Glyph_To_Bitmap( &glyph, FT_RENDER_MODE_DEFAULT, */ /* error = FT_Glyph_To_Bitmap( &glyph, FT_RENDER_MODE_NORMAL, */
/* 0, 1 ); */ /* 0, 1 ); */
/* if ( error ) // `glyph' unchanged */ /* if ( error ) // `glyph' unchanged */
/* ... */ /* ... */
+27 -11
View File
@@ -5,7 +5,8 @@
/* FreeType glyph image formats and default raster interface */ /* FreeType glyph image formats and default raster interface */
/* (specification). */ /* (specification). */
/* */ /* */
/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */ /* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, */
/* 2010 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@@ -51,10 +52,9 @@ FT_BEGIN_HEADER
/* FT_Pos */ /* FT_Pos */
/* */ /* */
/* <Description> */ /* <Description> */
/* The type FT_Pos is a 32-bit integer used to store vectorial */ /* The type FT_Pos is used to store vectorial coordinates. Depending */
/* coordinates. Depending on the context, these can represent */ /* on the context, these can represent distances in integer font */
/* distances in integer font units, or 16.16, or 26.6 fixed float */ /* units, or 16.16, or 26.6 fixed float pixel coordinates. */
/* pixel coordinates. */
/* */ /* */
typedef signed long FT_Pos; typedef signed long FT_Pos;
@@ -99,6 +99,20 @@ FT_BEGIN_HEADER
/* */ /* */
/* yMax :: The vertical maximum (top-most). */ /* yMax :: The vertical maximum (top-most). */
/* */ /* */
/* <Note> */
/* The bounding box is specified with the coordinates of the lower */
/* left and the upper right corner. In PostScript, those values are */
/* often called (llx,lly) and (urx,ury), respectively. */
/* */
/* If `yMin' is negative, this value gives the glyph's descender. */
/* Otherwise, the glyph doesn't descend below the baseline. */
/* Similarly, if `ymax' is positive, this value gives the glyph's */
/* ascender. */
/* */
/* `xMin' gives the horizontal distance from the glyph's origin to */
/* the left edge of the glyph's bounding box. If `xMin' is negative, */
/* the glyph extends to the left of the origin. */
/* */
typedef struct FT_BBox_ typedef struct FT_BBox_
{ {
FT_Pos xMin, yMin; FT_Pos xMin, yMin;
@@ -254,6 +268,9 @@ FT_BEGIN_HEADER
/* flow. In all cases, the pitch is an offset to add */ /* flow. In all cases, the pitch is an offset to add */
/* to a bitmap pointer in order to go down one row. */ /* to a bitmap pointer in order to go down one row. */
/* */ /* */
/* For the B/W rasterizer, `pitch' is always an even */
/* number. */
/* */
/* buffer :: A typeless pointer to the bitmap buffer. This */ /* buffer :: A typeless pointer to the bitmap buffer. This */
/* value should be aligned on 32-bit boundaries in */ /* value should be aligned on 32-bit boundaries in */
/* most cases. */ /* most cases. */
@@ -563,8 +580,8 @@ FT_BEGIN_HEADER
/* FT_Outline_ConicToFunc */ /* FT_Outline_ConicToFunc */
/* */ /* */
/* <Description> */ /* <Description> */
/* A function pointer type use to describe the signature of a `conic */ /* A function pointer type used to describe the signature of a `conic */
/* to' function during outline walking/decomposition. */ /* to' function during outline walking or decomposition. */
/* */ /* */
/* A `conic to' is emitted to indicate a second-order Bézier arc in */ /* A `conic to' is emitted to indicate a second-order Bézier arc in */
/* the outline. */ /* the outline. */
@@ -596,7 +613,7 @@ FT_BEGIN_HEADER
/* */ /* */
/* <Description> */ /* <Description> */
/* A function pointer type used to describe the signature of a `cubic */ /* A function pointer type used to describe the signature of a `cubic */
/* to' function during outline walking/decomposition. */ /* to' function during outline walking or decomposition. */
/* */ /* */
/* A `cubic to' is emitted to indicate a third-order Bézier arc. */ /* A `cubic to' is emitted to indicate a third-order Bézier arc. */
/* */ /* */
@@ -629,8 +646,7 @@ FT_BEGIN_HEADER
/* */ /* */
/* <Description> */ /* <Description> */
/* A structure to hold various function pointers used during outline */ /* A structure to hold various function pointers used during outline */
/* decomposition in order to emit segments, conic, and cubic Béziers, */ /* decomposition in order to emit segments, conic, and cubic Béziers. */
/* as well as `move to' and `close to' operations. */
/* */ /* */
/* <Fields> */ /* <Fields> */
/* move_to :: The `move to' emitter. */ /* move_to :: The `move to' emitter. */
@@ -657,7 +673,7 @@ FT_BEGIN_HEADER
/* y' = (x << shift) - delta */ /* y' = (x << shift) - delta */
/* } */ /* } */
/* */ /* */
/* Set the value of `shift' and `delta' to~0 to get the original */ /* Set the values of `shift' and `delta' to~0 to get the original */
/* point coordinates. */ /* point coordinates. */
/* */ /* */
typedef struct FT_Outline_Funcs_ typedef struct FT_Outline_Funcs_
+6 -2
View File
@@ -4,7 +4,7 @@
/* */ /* */
/* FreeType incremental loading (specification). */ /* FreeType incremental loading (specification). */
/* */ /* */
/* Copyright 2002, 2003, 2006, 2007, 2008 by */ /* Copyright 2002, 2003, 2006, 2007, 2008, 2010 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@@ -101,7 +101,10 @@ FT_BEGIN_HEADER
* Top bearing, in font units. * Top bearing, in font units.
* *
* advance :: * advance ::
* Glyph advance, in font units. * Horizontal component of glyph advance, in font units.
*
* advance_v ::
* Vertical component of glyph advance, in font units.
* *
* @note: * @note:
* These correspond to horizontal or vertical metrics depending on the * These correspond to horizontal or vertical metrics depending on the
@@ -114,6 +117,7 @@ FT_BEGIN_HEADER
FT_Long bearing_x; FT_Long bearing_x;
FT_Long bearing_y; FT_Long bearing_y;
FT_Long advance; FT_Long advance;
FT_Long advance_v; /* since 2.3.12 */
} FT_Incremental_MetricsRec; } FT_Incremental_MetricsRec;
+3 -4
View File
@@ -5,7 +5,7 @@
/* Support for the FT_Outline type used to store glyph shapes of */ /* Support for the FT_Outline type used to store glyph shapes of */
/* most scalable font formats (specification). */ /* most scalable font formats (specification). */
/* */ /* */
/* Copyright 1996-2001, 2002, 2003, 2005, 2006, 2007, 2008, 2009 by */ /* Copyright 1996-2001, 2002, 2003, 2005, 2006, 2007, 2008, 2009, 2010 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@@ -85,9 +85,8 @@ FT_BEGIN_HEADER
/* */ /* */
/* <Description> */ /* <Description> */
/* Walk 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 */ /* segments and Bézier arcs. This function also emits `move to' */
/* `move to' and `close to' operations to indicate the start and end */ /* operations to indicate the start of new contours in the outline. */
/* of new contours in the outline. */
/* */ /* */
/* <Input> */ /* <Input> */
/* outline :: A pointer to the source target. */ /* outline :: A pointer to the source target. */
+30 -1
View File
@@ -7,7 +7,7 @@
/* */ /* */
/* This is _not_ used to retrieve glyph names! */ /* This is _not_ used to retrieve glyph names! */
/* */ /* */
/* Copyright 1996-2001, 2002, 2003, 2006, 2009 by */ /* Copyright 1996-2001, 2002, 2003, 2006, 2009, 2010 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@@ -160,6 +160,35 @@ FT_BEGIN_HEADER
FT_SfntName *aname ); FT_SfntName *aname );
/***************************************************************************
*
* @constant:
* FT_PARAM_TAG_IGNORE_PREFERRED_FAMILY
*
* @description:
* A constant used as the tag of @FT_Parameter structures to make
* FT_Open_Face() ignore preferred family subfamily names in `name'
* table since OpenType version 1.4. For backwards compatibility with
* legacy systems which has 4-face-per-family restriction.
*
*/
#define FT_PARAM_TAG_IGNORE_PREFERRED_FAMILY FT_MAKE_TAG( 'i', 'g', 'p', 'f' )
/***************************************************************************
*
* @constant:
* FT_PARAM_TAG_IGNORE_PREFERRED_SUBFAMILY
*
* @description:
* A constant used as the tag of @FT_Parameter structures to make
* FT_Open_Face() ignore preferred subfamily names in `name' table since
* OpenType version 1.4. For backwards compatibility with legacy
* systems which has 4-face-per-family restriction.
*
*/
#define FT_PARAM_TAG_IGNORE_PREFERRED_SUBFAMILY FT_MAKE_TAG( 'i', 'g', 'p', 's' )
/* */ /* */
+4 -4
View File
@@ -402,16 +402,16 @@
af_latin_metrics_check_digits( AF_LatinMetrics metrics, af_latin_metrics_check_digits( AF_LatinMetrics metrics,
FT_Face face ) FT_Face face )
{ {
FT_UInt i; FT_UInt i;
FT_Bool started = 0, same_width = 1; FT_Bool started = 0, same_width = 1;
FT_Fixed advance, old_advance = 0;
/* check whether all ASCII digits have the same advance width; */ /* check whether all ASCII digits have the same advance width; */
/* digit `0' is 0x30 in all supported charmaps */ /* digit `0' is 0x30 in all supported charmaps */
for ( i = 0x30; i <= 0x39; i++ ) for ( i = 0x30; i <= 0x39; i++ )
{ {
FT_UInt glyph_index; FT_UInt glyph_index;
FT_Fixed advance, old_advance = 0;
glyph_index = FT_Get_Char_Index( face, i ); glyph_index = FT_Get_Char_Index( face, i );
+4 -4
View File
@@ -407,16 +407,16 @@
af_latin2_metrics_check_digits( AF_LatinMetrics metrics, af_latin2_metrics_check_digits( AF_LatinMetrics metrics,
FT_Face face ) FT_Face face )
{ {
FT_UInt i; FT_UInt i;
FT_Bool started = 0, same_width = 1; FT_Bool started = 0, same_width = 1;
FT_Fixed advance, old_advance = 0;
/* check whether all ASCII digits have the same advance width; */ /* check whether all ASCII digits have the same advance width; */
/* digit `0' is 0x30 in all supported charmaps */ /* digit `0' is 0x30 in all supported charmaps */
for ( i = 0x30; i <= 0x39; i++ ) for ( i = 0x30; i <= 0x39; i++ )
{ {
FT_UInt glyph_index; FT_UInt glyph_index;
FT_Fixed advance, old_advance;
glyph_index = FT_Get_Char_Index( face, i ); glyph_index = FT_Get_Char_Index( face, i );
+3 -3
View File
@@ -4,7 +4,7 @@
/* */ /* */
/* The FreeType private functions used in base module (specification). */ /* The FreeType private functions used in base module (specification). */
/* */ /* */
/* Copyright 2008 by */ /* Copyright 2008, 2010 by */
/* David Turner, Robert Wilhelm, Werner Lemberg, and suzuki toshiya. */ /* David Turner, Robert Wilhelm, Werner Lemberg, and suzuki toshiya. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@@ -29,7 +29,7 @@ FT_BEGIN_HEADER
/* Assume the stream is sfnt-wrapped PS Type1 or sfnt-wrapped CID-keyed */ /* 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. */ /* font, and try to load a face specified by the face_index. */
FT_LOCAL_DEF( FT_Error ) FT_LOCAL( FT_Error )
open_face_PS_from_sfnt_stream( FT_Library library, open_face_PS_from_sfnt_stream( FT_Library library,
FT_Stream stream, FT_Stream stream,
FT_Long face_index, FT_Long face_index,
@@ -40,7 +40,7 @@ FT_BEGIN_HEADER
/* Create a new FT_Face given a buffer and a driver name. */ /* Create a new FT_Face given a buffer and a driver name. */
/* From ftmac.c. */ /* From ftmac.c. */
FT_LOCAL_DEF( FT_Error ) FT_LOCAL( FT_Error )
open_face_from_buffer( FT_Library library, open_face_from_buffer( FT_Library library,
FT_Byte* base, FT_Byte* base,
FT_ULong size, FT_ULong size,
+3 -3
View File
@@ -4,7 +4,7 @@
/* */ /* */
/* FreeType bbox computation (body). */ /* FreeType bbox computation (body). */
/* */ /* */
/* Copyright 1996-2001, 2002, 2004, 2006 by */ /* Copyright 1996-2001, 2002, 2004, 2006, 2010 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used */ /* This file is part of the FreeType project, and may only be used */
@@ -140,7 +140,7 @@
/* */ /* */
/* <Description> */ /* <Description> */
/* This function is used as a `conic_to' emitter during */ /* This function is used as a `conic_to' emitter during */
/* FT_Raster_Decompose(). It checks a conic Bezier curve with the */ /* FT_Outline_Decompose(). It checks a conic Bezier curve with the */
/* current bounding box, and computes its extrema if necessary to */ /* current bounding box, and computes its extrema if necessary to */
/* update it. */ /* update it. */
/* */ /* */
@@ -507,7 +507,7 @@
/* */ /* */
/* <Description> */ /* <Description> */
/* This function is used as a `cubic_to' emitter during */ /* This function is used as a `cubic_to' emitter during */
/* FT_Raster_Decompose(). It checks a cubic Bezier curve with the */ /* FT_Outline_Decompose(). It checks a cubic Bezier curve with the */
/* current bounding box, and computes its extrema if necessary to */ /* current bounding box, and computes its extrema if necessary to */
/* update it. */ /* update it. */
/* */ /* */
+1 -1
View File
@@ -989,7 +989,7 @@
#else /* !FT_DEBUG_MEMORY */ #else /* !FT_DEBUG_MEMORY */
/* ANSI C doesn't like empty source files */ /* ANSI C doesn't like empty source files */
static const FT_Byte _debug_mem_dummy = 0; typedef int _debug_mem_dummy;
#endif /* !FT_DEBUG_MEMORY */ #endif /* !FT_DEBUG_MEMORY */
+5 -1
View File
@@ -372,7 +372,7 @@
if ( slot->format == FT_GLYPH_FORMAT_BITMAP ) if ( slot->format == FT_GLYPH_FORMAT_BITMAP )
clazz = FT_BITMAP_GLYPH_CLASS_GET; clazz = FT_BITMAP_GLYPH_CLASS_GET;
/* it it is an outline too */ /* if it is an outline */
else if ( slot->format == FT_GLYPH_FORMAT_OUTLINE ) else if ( slot->format == FT_GLYPH_FORMAT_OUTLINE )
clazz = FT_OUTLINE_GLYPH_CLASS_GET; clazz = FT_OUTLINE_GLYPH_CLASS_GET;
@@ -515,6 +515,10 @@
const FT_Glyph_Class* clazz; const FT_Glyph_Class* clazz;
#ifdef FT_CONFIG_OPTION_PIC
FT_Library library = FT_GLYPH( glyph )->library;
#endif
/* check argument */ /* check argument */
if ( !the_glyph ) if ( !the_glyph )
+2 -2
View File
@@ -115,7 +115,7 @@
FT_Module_Class** classes; FT_Module_Class** classes;
FT_Memory memory; FT_Memory memory;
FT_UInt i; FT_UInt i;
BasePIC* pic_container = library->pic_container.base; BasePIC* pic_container = (BasePIC*)library->pic_container.base;
if ( !pic_container->default_module_classes ) if ( !pic_container->default_module_classes )
return; return;
@@ -145,7 +145,7 @@
FT_Module_Class** classes; FT_Module_Class** classes;
FT_Module_Class* clazz; FT_Module_Class* clazz;
FT_UInt i; FT_UInt i;
BasePIC* pic_container = library->pic_container.base; BasePIC* pic_container = (BasePIC*)library->pic_container.base;
memory = library->memory; memory = library->memory;
pic_container->default_module_classes = 0; pic_container->default_module_classes = 0;
+25 -3
View File
@@ -4,7 +4,8 @@
/* */ /* */
/* The FreeType private base classes (body). */ /* The FreeType private base classes (body). */
/* */ /* */
/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */ /* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, */
/* 2010 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@@ -37,7 +38,9 @@
#include FT_SERVICE_KERNING_H #include FT_SERVICE_KERNING_H
#include FT_SERVICE_TRUETYPE_ENGINE_H #include FT_SERVICE_TRUETYPE_ENGINE_H
#ifdef FT_CONFIG_OPTION_MAC_FONTS
#include "ftbase.h" #include "ftbase.h"
#endif
#define GRID_FIT_METRICS #define GRID_FIT_METRICS
@@ -708,8 +711,8 @@
} }
/* compute the linear advance in 16.16 pixels */ /* compute the linear advance in 16.16 pixels */
if ( ( load_flags & FT_LOAD_LINEAR_DESIGN ) == 0 && if ( ( load_flags & FT_LOAD_LINEAR_DESIGN ) == 0 &&
( FT_IS_SCALABLE( face ) ) ) ( FT_IS_SCALABLE( face ) ) )
{ {
FT_Size_Metrics* metrics = &face->size->metrics; FT_Size_Metrics* metrics = &face->size->metrics;
@@ -739,11 +742,30 @@
renderer, slot, renderer, slot,
&internal->transform_matrix, &internal->transform_matrix,
&internal->transform_delta ); &internal->transform_delta );
else if ( slot->format == FT_GLYPH_FORMAT_OUTLINE )
{
/* apply `standard' transformation if no renderer is available */
if ( &internal->transform_matrix )
FT_Outline_Transform( &slot->outline,
&internal->transform_matrix );
if ( &internal->transform_delta )
FT_Outline_Translate( &slot->outline,
internal->transform_delta.x,
internal->transform_delta.y );
}
/* transform advance */ /* transform advance */
FT_Vector_Transform( &slot->advance, &internal->transform_matrix ); FT_Vector_Transform( &slot->advance, &internal->transform_matrix );
} }
} }
FT_TRACE5(( " x advance: %d\n" , slot->advance.x ));
FT_TRACE5(( " y advance: %d\n" , slot->advance.y ));
FT_TRACE5(( " linear x advance: %d\n" , slot->linearHoriAdvance ));
FT_TRACE5(( " linear y advance: %d\n" , slot->linearVertAdvance ));
/* do we need to render the image now? */ /* do we need to render the image now? */
if ( !error && if ( !error &&
slot->format != FT_GLYPH_FORMAT_BITMAP && slot->format != FT_GLYPH_FORMAT_BITMAP &&
+4 -4
View File
@@ -4,7 +4,7 @@
/* */ /* */
/* FreeType outline management (body). */ /* FreeType outline management (body). */
/* */ /* */
/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by */ /* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@@ -304,9 +304,9 @@
*anoutline = null_outline; *anoutline = null_outline;
if ( FT_NEW_ARRAY( anoutline->points, numPoints * 2L ) || if ( FT_NEW_ARRAY( anoutline->points, numPoints ) ||
FT_NEW_ARRAY( anoutline->tags, numPoints ) || FT_NEW_ARRAY( anoutline->tags, numPoints ) ||
FT_NEW_ARRAY( anoutline->contours, numContours ) ) FT_NEW_ARRAY( anoutline->contours, numContours ) )
goto Fail; goto Fail;
anoutline->n_points = (FT_UShort)numPoints; anoutline->n_points = (FT_UShort)numPoints;
+5 -4
View File
@@ -5,7 +5,7 @@
/* FreeType API for checking patented TrueType bytecode instructions */ /* FreeType API for checking patented TrueType bytecode instructions */
/* (body). */ /* (body). */
/* */ /* */
/* Copyright 2007, 2008 by David Turner. */ /* Copyright 2007, 2008, 2010 by David Turner. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */ /* modified, and distributed under the terms of the FreeType project */
@@ -114,7 +114,7 @@
FT_ULong tag ) FT_ULong tag )
{ {
FT_Stream stream = face->stream; FT_Stream stream = face->stream;
FT_Error error = FT_Err_Ok; FT_Error error = FT_Err_Ok;
FT_Service_SFNT_Table service; FT_Service_SFNT_Table service;
FT_Bool result = FALSE; FT_Bool result = FALSE;
@@ -124,13 +124,14 @@
if ( service ) if ( service )
{ {
FT_UInt i = 0; FT_UInt i = 0;
FT_ULong tag_i = 0, offset_i, length_i; FT_ULong tag_i = 0, offset_i = 0, length_i = 0;
for ( i = 0; !error && tag_i != tag ; i++ ) for ( i = 0; !error && tag_i != tag ; i++ )
error = service->table_info( face, i, error = service->table_info( face, i,
&tag_i, &offset_i, &length_i ); &tag_i, &offset_i, &length_i );
if ( error || if ( error ||
FT_STREAM_SEEK( offset_i ) ) FT_STREAM_SEEK( offset_i ) )
goto Exit; goto Exit;
+6 -8
View File
@@ -4,7 +4,7 @@
/* */ /* */
/* FreeType path stroker (body). */ /* FreeType path stroker (body). */
/* */ /* */
/* Copyright 2002, 2003, 2004, 2005, 2006, 2008, 2009 by */ /* Copyright 2002, 2003, 2004, 2005, 2006, 2008, 2009, 2010 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@@ -979,7 +979,8 @@
thcos = FT_Cos( theta ); thcos = FT_Cos( theta );
sigma = FT_MulFix( stroker->miter_limit, thcos ); sigma = FT_MulFix( stroker->miter_limit, thcos );
if ( sigma >= 0x10000L ) /* FT_Sin(x) = 0 for x <= 57 */
if ( sigma >= 0x10000L || ft_pos_abs( theta ) <= 57 )
miter = FALSE; miter = FALSE;
if ( miter ) /* this is a miter (broken angle) */ if ( miter ) /* this is a miter (broken angle) */
@@ -1360,7 +1361,7 @@
phi1 = (angle_mid + angle_in ) / 2; phi1 = (angle_mid + angle_in ) / 2;
phi2 = (angle_mid + angle_out ) / 2; phi2 = (angle_mid + angle_out ) / 2;
length1 = FT_DivFix( stroker->radius, FT_Cos( theta1 ) ); length1 = FT_DivFix( stroker->radius, FT_Cos( theta1 ) );
length2 = FT_DivFix( stroker->radius, FT_Cos(theta2) ); length2 = FT_DivFix( stroker->radius, FT_Cos( theta2 ) );
for ( side = 0; side <= 1; side++ ) for ( side = 0; side <= 1; side++ )
{ {
@@ -1735,13 +1736,10 @@
} }
else else
{ {
/* if both first and last points are conic, */ /* if both first and last points are conic, */
/* start at their middle and record its position */ /* start at their middle */
/* for closure */
v_start.x = ( v_start.x + v_last.x ) / 2; v_start.x = ( v_start.x + v_last.x ) / 2;
v_start.y = ( v_start.y + v_last.y ) / 2; v_start.y = ( v_start.y + v_last.y ) / 2;
v_last = v_start;
} }
point--; point--;
tags--; tags--;
+2 -2
View File
@@ -4,7 +4,7 @@
/* */ /* */
/* FreeType synthesizing code for emboldening and slanting (body). */ /* FreeType synthesizing code for emboldening and slanting (body). */
/* */ /* */
/* Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006 by */ /* Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006, 2010 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@@ -100,8 +100,8 @@
if ( slot->format == FT_GLYPH_FORMAT_OUTLINE ) if ( slot->format == FT_GLYPH_FORMAT_OUTLINE )
{ {
error = FT_Outline_Embolden( &slot->outline, xstr );
/* ignore error */ /* ignore error */
(void)FT_Outline_Embolden( &slot->outline, xstr );
/* this is more than enough for most glyphs; if you need accurate */ /* this is more than enough for most glyphs; if you need accurate */
/* values, you have to call FT_Outline_Get_CBox */ /* values, you have to call FT_Outline_Get_CBox */
+2 -2
View File
@@ -71,8 +71,8 @@
FT_UNUSED( cache ); FT_UNUSED( cache );
return FT_BOOL( gnode->family == gquery->family && return FT_BOOL( gnode->family == gquery->family &&
gnode->gindex == gquery->gindex ); gnode->gindex == gquery->gindex );
} }
+3 -2
View File
@@ -621,14 +621,15 @@
{ {
FT_Module sfnt; FT_Module sfnt;
FT_Module_Interface result; FT_Module_Interface result;
FT_Library library = driver->library;
FT_UNUSED(library);
result = ft_service_list_lookup( FT_CFF_SERVICES_GET, module_interface ); result = ft_service_list_lookup( FT_CFF_SERVICES_GET, module_interface );
if ( result != NULL ) if ( result != NULL )
return result; return result;
if ( !driver )
return NULL;
/* we pass our request to the `sfnt' module */ /* we pass our request to the `sfnt' module */
sfnt = FT_Get_Module( driver->library, "sfnt" ); sfnt = FT_Get_Module( driver->library, "sfnt" );
+130 -35
View File
@@ -4,7 +4,8 @@
/* */ /* */
/* OpenType Glyph Loader (body). */ /* OpenType Glyph Loader (body). */
/* */ /* */
/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */ /* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, */
/* 2010 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@@ -113,6 +114,9 @@
cff_op_closepath, cff_op_closepath,
cff_op_callothersubr, cff_op_callothersubr,
cff_op_pop, cff_op_pop,
cff_op_seac,
cff_op_sbw,
cff_op_setcurrentpoint,
/* do not remove */ /* do not remove */
cff_op_max cff_op_max
@@ -201,7 +205,10 @@
2, /* hsbw */ 2, /* hsbw */
0, 0,
0, 0,
0 0,
5, /* seac */
4, /* sbw */
2 /* setcurrentpoint */
}; };
@@ -319,17 +326,23 @@
/* subroutines. */ /* subroutines. */
/* */ /* */
/* <Input> */ /* <Input> */
/* num_subrs :: The number of glyph subroutines. */ /* in_charstring_type :: The `CharstringType' value of the top DICT */
/* dictionary. */
/* */
/* num_subrs :: The number of glyph subroutines. */
/* */ /* */
/* <Return> */ /* <Return> */
/* The bias value. */ /* The bias value. */
static FT_Int static FT_Int
cff_compute_bias( FT_UInt num_subrs ) cff_compute_bias( FT_Int in_charstring_type,
FT_UInt num_subrs )
{ {
FT_Int result; FT_Int result;
if ( num_subrs < 1240 ) if ( in_charstring_type == 1 )
result = 0;
else if ( num_subrs < 1240 )
result = 107; result = 107;
else if ( num_subrs < 33900U ) else if ( num_subrs < 33900U )
result = 1131; result = 1131;
@@ -380,9 +393,12 @@
cff_builder_init( &decoder->builder, face, size, slot, hinting ); cff_builder_init( &decoder->builder, face, size, slot, hinting );
/* initialize Type2 decoder */ /* initialize Type2 decoder */
decoder->cff = cff;
decoder->num_globals = cff->num_global_subrs; decoder->num_globals = cff->num_global_subrs;
decoder->globals = cff->global_subrs; decoder->globals = cff->global_subrs;
decoder->globals_bias = cff_compute_bias( decoder->num_globals ); decoder->globals_bias = cff_compute_bias(
cff->top_font.font_dict.charstring_type,
decoder->num_globals );
decoder->hint_mode = hint_mode; decoder->hint_mode = hint_mode;
} }
@@ -434,7 +450,9 @@
decoder->num_locals = sub->num_local_subrs; decoder->num_locals = sub->num_local_subrs;
decoder->locals = sub->local_subrs; decoder->locals = sub->local_subrs;
decoder->locals_bias = cff_compute_bias( decoder->num_locals ); decoder->locals_bias = cff_compute_bias(
decoder->cff->top_font.font_dict.charstring_type,
decoder->num_locals );
decoder->glyph_width = sub->private_dict.default_width; decoder->glyph_width = sub->private_dict.default_width;
decoder->nominal_width = sub->private_dict.nominal_width; decoder->nominal_width = sub->private_dict.nominal_width;
@@ -677,7 +695,7 @@
data.length = length; data.length = length;
face->root.internal->incremental_interface->funcs->free_glyph_data( face->root.internal->incremental_interface->funcs->free_glyph_data(
face->root.internal->incremental_interface->object,&data ); face->root.internal->incremental_interface->object, &data );
} }
else else
#endif /* FT_CONFIG_OPTION_INCREMENTAL */ #endif /* FT_CONFIG_OPTION_INCREMENTAL */
@@ -693,6 +711,7 @@
static FT_Error static FT_Error
cff_operator_seac( CFF_Decoder* decoder, cff_operator_seac( CFF_Decoder* decoder,
FT_Pos asb,
FT_Pos adx, FT_Pos adx,
FT_Pos ady, FT_Pos ady,
FT_Int bchar, FT_Int bchar,
@@ -705,6 +724,7 @@
FT_Vector left_bearing, advance; FT_Vector left_bearing, advance;
FT_Byte* charstring; FT_Byte* charstring;
FT_ULong charstring_len; FT_ULong charstring_len;
FT_Pos glyph_width;
if ( decoder->seac ) if ( decoder->seac )
@@ -713,6 +733,9 @@
return CFF_Err_Syntax_Error; return CFF_Err_Syntax_Error;
} }
adx += decoder->builder.left_bearing.x;
ady += decoder->builder.left_bearing.y;
#ifdef FT_CONFIG_OPTION_INCREMENTAL #ifdef FT_CONFIG_OPTION_INCREMENTAL
/* Incremental fonts don't necessarily have valid charsets. */ /* Incremental fonts don't necessarily have valid charsets. */
/* They use the character code, not the glyph index, in this case. */ /* They use the character code, not the glyph index, in this case. */
@@ -795,16 +818,17 @@
cff_free_glyph_data( face, &charstring, charstring_len ); cff_free_glyph_data( face, &charstring, charstring_len );
} }
/* Save the left bearing and width of the base character */ /* Save the left bearing, advance and glyph width of the base */
/* as they will be erased by the next load. */ /* character as they will be erased by the next load. */
left_bearing = builder->left_bearing; left_bearing = builder->left_bearing;
advance = builder->advance; advance = builder->advance;
glyph_width = decoder->glyph_width;
builder->left_bearing.x = 0; builder->left_bearing.x = 0;
builder->left_bearing.y = 0; builder->left_bearing.y = 0;
builder->pos_x = adx; builder->pos_x = adx - asb;
builder->pos_y = ady; builder->pos_y = ady;
/* Now load `achar' on top of the base outline. */ /* Now load `achar' on top of the base outline. */
@@ -824,10 +848,11 @@
cff_free_glyph_data( face, &charstring, charstring_len ); cff_free_glyph_data( face, &charstring, charstring_len );
} }
/* Restore the left side bearing and advance width */ /* Restore the left side bearing, advance and glyph width */
/* of the base character. */ /* of the base character. */
builder->left_bearing = left_bearing; builder->left_bearing = left_bearing;
builder->advance = advance; builder->advance = advance;
decoder->glyph_width = glyph_width;
builder->pos_x = 0; builder->pos_x = 0;
builder->pos_y = 0; builder->pos_y = 0;
@@ -869,6 +894,8 @@
FT_Pos x, y; FT_Pos x, y;
FT_Fixed seed; FT_Fixed seed;
FT_Fixed* stack; FT_Fixed* stack;
FT_Int charstring_type =
decoder->cff->top_font.font_dict.charstring_type;
T2_Hints_Funcs hinter; T2_Hints_Funcs hinter;
@@ -958,7 +985,8 @@
( (FT_Int32)ip[2] << 8 ) | ( (FT_Int32)ip[2] << 8 ) |
ip[3]; ip[3];
ip += 4; ip += 4;
shift = 0; if ( charstring_type == 2 )
shift = 0;
} }
if ( decoder->top - stack >= CFF_MAX_OPERANDS ) if ( decoder->top - stack >= CFF_MAX_OPERANDS )
goto Stack_Overflow; goto Stack_Overflow;
@@ -1032,6 +1060,12 @@
case 0: case 0:
op = cff_op_dotsection; op = cff_op_dotsection;
break; break;
case 1: /* this is actually the Type1 vstem3 operator */
op = cff_op_vstem;
break;
case 2: /* this is actually the Type1 hstem3 operator */
op = cff_op_hstem;
break;
case 3: case 3:
op = cff_op_and; op = cff_op_and;
break; break;
@@ -1041,6 +1075,12 @@
case 5: case 5:
op = cff_op_not; op = cff_op_not;
break; break;
case 6:
op = cff_op_seac;
break;
case 7:
op = cff_op_sbw;
break;
case 8: case 8:
op = cff_op_store; op = cff_op_store;
break; break;
@@ -1104,6 +1144,9 @@
case 30: case 30:
op = cff_op_roll; op = cff_op_roll;
break; break;
case 33:
op = cff_op_setcurrentpoint;
break;
case 34: case 34:
op = cff_op_hflex; op = cff_op_hflex;
break; break;
@@ -1171,7 +1214,7 @@
op = cff_op_hvcurveto; op = cff_op_hvcurveto;
break; break;
default: default:
; break;
} }
if ( op == cff_op_unknown ) if ( op == cff_op_unknown )
@@ -1886,6 +1929,21 @@
} }
break; break;
case cff_op_seac:
FT_TRACE4(( " seac\n" ));
error = cff_operator_seac( decoder,
args[0], args[1], args[2],
(FT_Int)( args[3] >> 16 ),
(FT_Int)( args[4] >> 16 ) );
/* add current outline to the glyph slot */
FT_GlyphLoader_Add( builder->loader );
/* return now! */
FT_TRACE4(( "\n" ));
return error;
case cff_op_endchar: case cff_op_endchar:
FT_TRACE4(( " endchar\n" )); FT_TRACE4(( " endchar\n" ));
@@ -1895,10 +1953,8 @@
/* Save glyph width so that the subglyphs don't overwrite it. */ /* Save glyph width so that the subglyphs don't overwrite it. */
FT_Pos glyph_width = decoder->glyph_width; FT_Pos glyph_width = decoder->glyph_width;
error = cff_operator_seac( decoder, error = cff_operator_seac( decoder,
args[-4], 0L, args[-4], args[-3],
args[-3],
(FT_Int)( args[-2] >> 16 ), (FT_Int)( args[-2] >> 16 ),
(FT_Int)( args[-1] >> 16 ) ); (FT_Int)( args[-1] >> 16 ) );
@@ -2106,7 +2162,7 @@
FT_TRACE4(( " dup\n" )); FT_TRACE4(( " dup\n" ));
args[1] = args[0]; args[1] = args[0];
args++; args += 2;
break; break;
case cff_op_put: case cff_op_put:
@@ -2117,7 +2173,7 @@
FT_TRACE4(( " put\n" )); FT_TRACE4(( " put\n" ));
if ( idx >= 0 && idx < decoder->len_buildchar ) if ( idx >= 0 && idx < CFF_MAX_TRANS_ELEMENTS )
decoder->buildchar[idx] = val; decoder->buildchar[idx] = val;
} }
break; break;
@@ -2130,7 +2186,7 @@
FT_TRACE4(( " get\n" )); FT_TRACE4(( " get\n" ));
if ( idx >= 0 && idx < decoder->len_buildchar ) if ( idx >= 0 && idx < CFF_MAX_TRANS_ELEMENTS )
val = decoder->buildchar[idx]; val = decoder->buildchar[idx];
args[0] = val; args[0] = val;
@@ -2170,10 +2226,42 @@
FT_TRACE4(( " hsbw (invalid op)\n" )); FT_TRACE4(( " hsbw (invalid op)\n" ));
decoder->glyph_width = decoder->nominal_width + decoder->glyph_width = decoder->nominal_width + ( args[1] >> 16 );
(args[1] >> 16);
x = args[0]; decoder->builder.left_bearing.x = args[0];
y = 0; decoder->builder.left_bearing.y = 0;
x = decoder->builder.pos_x + args[0];
y = decoder->builder.pos_y;
args = stack;
break;
case cff_op_sbw:
/* 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(( " sbw (invalid op)\n" ));
decoder->glyph_width = decoder->nominal_width + ( args[2] >> 16 );
decoder->builder.left_bearing.x = args[0];
decoder->builder.left_bearing.y = args[1];
x = decoder->builder.pos_x + args[0];
y = decoder->builder.pos_y + args[1];
args = stack;
break;
case cff_op_setcurrentpoint:
/* 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(( " setcurrentpoint (invalid op)\n" ));
x = decoder->builder.pos_x + args[0];
y = decoder->builder.pos_y + args[1];
args = stack; args = stack;
break; break;
@@ -2184,8 +2272,10 @@
FT_TRACE4(( " callothersubr (invalid op)\n" )); FT_TRACE4(( " callothersubr (invalid op)\n" ));
/* don't modify stack; handle the subr as `unknown' so that */ /* subsequent `pop' operands should add the arguments, */
/* following `pop' operands use the arguments on stack */ /* this is the implementation described for `unknown' other */
/* subroutines in the Type1 spec. */
args -= 2 + ( args[-2] >> 16 );
break; break;
case cff_op_pop: case cff_op_pop:
@@ -2674,23 +2764,25 @@
#ifdef FT_CONFIG_OPTION_INCREMENTAL #ifdef FT_CONFIG_OPTION_INCREMENTAL
/* Incremental fonts can optionally override the metrics. */ /* Incremental fonts can optionally override the metrics. */
if ( !error && if ( !error &&
face->root.internal->incremental_interface && face->root.internal->incremental_interface &&
face->root.internal->incremental_interface->funcs->get_glyph_metrics ) face->root.internal->incremental_interface->funcs->get_glyph_metrics )
{ {
FT_Incremental_MetricsRec metrics; FT_Incremental_MetricsRec metrics;
metrics.bearing_x = decoder.builder.left_bearing.x; metrics.bearing_x = decoder.builder.left_bearing.x;
metrics.bearing_y = decoder.builder.left_bearing.y; metrics.bearing_y = 0;
metrics.advance = decoder.builder.advance.x; metrics.advance = decoder.builder.advance.x;
metrics.advance_v = decoder.builder.advance.y;
error = face->root.internal->incremental_interface->funcs->get_glyph_metrics( error = face->root.internal->incremental_interface->funcs->get_glyph_metrics(
face->root.internal->incremental_interface->object, face->root.internal->incremental_interface->object,
glyph_index, FALSE, &metrics ); glyph_index, FALSE, &metrics );
decoder.builder.left_bearing.x = metrics.bearing_x; decoder.builder.left_bearing.x = metrics.bearing_x;
decoder.builder.left_bearing.y = metrics.bearing_y;
decoder.builder.advance.x = metrics.advance; decoder.builder.advance.x = metrics.advance;
decoder.builder.advance.y = 0; decoder.builder.advance.y = metrics.advance_v;
} }
#endif /* FT_CONFIG_OPTION_INCREMENTAL */ #endif /* FT_CONFIG_OPTION_INCREMENTAL */
@@ -2827,9 +2919,12 @@
if ( has_vertical_info ) if ( has_vertical_info )
metrics->vertBearingX = metrics->horiBearingX - metrics->vertBearingX = metrics->horiBearingX -
metrics->horiAdvance / 2; metrics->horiAdvance / 2;
else else
ft_synthesize_vertical_metrics( metrics, {
metrics->vertAdvance ); if ( load_flags & FT_LOAD_VERTICAL_LAYOUT )
ft_synthesize_vertical_metrics( metrics,
metrics->vertAdvance );
}
} }
} }
+4 -4
View File
@@ -28,8 +28,9 @@
FT_BEGIN_HEADER FT_BEGIN_HEADER
#define CFF_MAX_OPERANDS 48 #define CFF_MAX_OPERANDS 48
#define CFF_MAX_SUBRS_CALLS 32 #define CFF_MAX_SUBRS_CALLS 32
#define CFF_MAX_TRANS_ELEMENTS 32
/*************************************************************************/ /*************************************************************************/
@@ -137,8 +138,7 @@ FT_BEGIN_HEADER
FT_Bool read_width; FT_Bool read_width;
FT_Bool width_only; FT_Bool width_only;
FT_Int num_hints; FT_Int num_hints;
FT_Fixed* buildchar; FT_Fixed buildchar[CFF_MAX_TRANS_ELEMENTS];
FT_Int len_buildchar;
FT_UInt num_locals; FT_UInt num_locals;
FT_UInt num_globals; FT_UInt num_globals;
+5 -4
View File
@@ -657,10 +657,11 @@
cffface->num_glyphs = cff->charstrings_index.count; cffface->num_glyphs = cff->charstrings_index.count;
/* set global bbox, as well as EM size */ /* set global bbox, as well as EM size */
cffface->bbox.xMin = dict->font_bbox.xMin >> 16; cffface->bbox.xMin = dict->font_bbox.xMin >> 16;
cffface->bbox.yMin = dict->font_bbox.yMin >> 16; cffface->bbox.yMin = dict->font_bbox.yMin >> 16;
cffface->bbox.xMax = ( dict->font_bbox.xMax + 0xFFFFU ) >> 16; /* no `U' suffix here to 0xFFFF! */
cffface->bbox.yMax = ( dict->font_bbox.yMax + 0xFFFFU ) >> 16; cffface->bbox.xMax = ( dict->font_bbox.xMax + 0xFFFF ) >> 16;
cffface->bbox.yMax = ( dict->font_bbox.yMax + 0xFFFF ) >> 16;
cffface->units_per_EM = (FT_UShort)( dict->units_per_em ); cffface->units_per_EM = (FT_UShort)( dict->units_per_em );
+3 -1
View File
@@ -745,8 +745,10 @@
p++; p++;
for (;;) for (;;)
{ {
/* An unterminated floating point number at the */
/* end of a dictionary is invalid but harmless. */
if ( p >= limit ) if ( p >= limit )
goto Syntax_Error; goto Exit;
v = p[0] >> 4; v = p[0] >> 4;
if ( v == 15 ) if ( v == 15 )
break; break;
+12 -7
View File
@@ -4,7 +4,7 @@
/* */ /* */
/* CID-keyed Type1 Glyph Loader (body). */ /* CID-keyed Type1 Glyph Loader (body). */
/* */ /* */
/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009 by */ /* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@@ -58,6 +58,8 @@
#endif #endif
FT_TRACE4(( "cid_load_glyph: glyph index %d\n", glyph_index ));
#ifdef FT_CONFIG_OPTION_INCREMENTAL #ifdef FT_CONFIG_OPTION_INCREMENTAL
/* For incremental fonts get the character data using */ /* For incremental fonts get the character data using */
@@ -171,16 +173,16 @@
metrics.bearing_x = FIXED_TO_INT( decoder->builder.left_bearing.x ); metrics.bearing_x = FIXED_TO_INT( decoder->builder.left_bearing.x );
metrics.bearing_y = FIXED_TO_INT( decoder->builder.left_bearing.y ); metrics.bearing_y = 0;
metrics.advance = FIXED_TO_INT( decoder->builder.advance.x ); metrics.advance = FIXED_TO_INT( decoder->builder.advance.x );
metrics.advance_v = FIXED_TO_INT( decoder->builder.advance.y );
error = inc->funcs->get_glyph_metrics( inc->object, error = inc->funcs->get_glyph_metrics( inc->object,
glyph_index, FALSE, &metrics ); glyph_index, FALSE, &metrics );
decoder->builder.left_bearing.x = INT_TO_FIXED( metrics.bearing_x ); decoder->builder.left_bearing.x = INT_TO_FIXED( metrics.bearing_x );
decoder->builder.left_bearing.y = INT_TO_FIXED( metrics.bearing_y );
decoder->builder.advance.x = INT_TO_FIXED( metrics.advance ); decoder->builder.advance.x = INT_TO_FIXED( metrics.advance );
decoder->builder.advance.y = 0; decoder->builder.advance.y = INT_TO_FIXED( metrics.advance_v );
} }
#endif /* FT_CONFIG_OPTION_INCREMENTAL */ #endif /* FT_CONFIG_OPTION_INCREMENTAL */
@@ -425,9 +427,12 @@
metrics->horiBearingX = cbox.xMin; metrics->horiBearingX = cbox.xMin;
metrics->horiBearingY = cbox.yMax; metrics->horiBearingY = cbox.yMax;
/* make up vertical ones */ if ( load_flags & FT_LOAD_VERTICAL_LAYOUT )
ft_synthesize_vertical_metrics( metrics, {
metrics->vertAdvance ); /* make up vertical ones */
ft_synthesize_vertical_metrics( metrics,
metrics->vertAdvance );
}
} }
Exit: Exit:
+5 -4
View File
@@ -413,10 +413,11 @@
cidface->num_fixed_sizes = 0; cidface->num_fixed_sizes = 0;
cidface->available_sizes = 0; cidface->available_sizes = 0;
cidface->bbox.xMin = cid->font_bbox.xMin >> 16; cidface->bbox.xMin = cid->font_bbox.xMin >> 16;
cidface->bbox.yMin = cid->font_bbox.yMin >> 16; cidface->bbox.yMin = cid->font_bbox.yMin >> 16;
cidface->bbox.xMax = ( cid->font_bbox.xMax + 0xFFFFU ) >> 16; /* no `U' suffix here to 0xFFFF! */
cidface->bbox.yMax = ( cid->font_bbox.yMax + 0xFFFFU ) >> 16; cidface->bbox.xMax = ( cid->font_bbox.xMax + 0xFFFF ) >> 16;
cidface->bbox.yMax = ( cid->font_bbox.yMax + 0xFFFF ) >> 16;
if ( !cidface->units_per_EM ) if ( !cidface->units_per_EM )
cidface->units_per_EM = 1000; cidface->units_per_EM = 1000;
+1 -1
View File
@@ -22,7 +22,7 @@
#define T1CODE T1_FIELD_LOCATION_CID_INFO #define T1CODE T1_FIELD_LOCATION_CID_INFO
T1_FIELD_KEY ( "CIDFontName", cid_font_name, 0 ) T1_FIELD_KEY ( "CIDFontName", cid_font_name, 0 )
T1_FIELD_NUM ( "CIDFontVersion", cid_version, 0 ) T1_FIELD_FIXED ( "CIDFontVersion", cid_version, 0 )
T1_FIELD_NUM ( "CIDFontType", cid_font_type, 0 ) T1_FIELD_NUM ( "CIDFontType", cid_font_type, 0 )
T1_FIELD_STRING( "Registry", registry, 0 ) T1_FIELD_STRING( "Registry", registry, 0 )
T1_FIELD_STRING( "Ordering", ordering, 0 ) T1_FIELD_STRING( "Ordering", ordering, 0 )
+4 -8
View File
@@ -8,7 +8,7 @@
/* be used to parse compressed PCF fonts, as found with many X11 server */ /* be used to parse compressed PCF fonts, as found with many X11 server */
/* distributions. */ /* distributions. */
/* */ /* */
/* Copyright 2004, 2005, 2006, 2009 by */ /* Copyright 2004, 2005, 2006, 2009, 2010 by */
/* Albert Chin-A-Young. */ /* Albert Chin-A-Young. */
/* */ /* */
/* Based on code in src/gzip/ftgzip.c, Copyright 2004 by */ /* Based on code in src/gzip/ftgzip.c, Copyright 2004 by */
@@ -122,13 +122,9 @@
zip->pos = 0; zip->pos = 0;
/* check and skip .Z header */ /* check and skip .Z header */
{ error = ft_lzw_check_header( source );
stream = source; if ( error )
goto Exit;
error = ft_lzw_check_header( source );
if ( error )
goto Exit;
}
/* initialize internal lzw variable */ /* initialize internal lzw variable */
ft_lzwstate_init( lzw, source ); ft_lzwstate_init( lzw, source );
+3 -3
View File
@@ -4,7 +4,7 @@
/* */ /* */
/* FreeType PFR bitmap loader (body). */ /* FreeType PFR bitmap loader (body). */
/* */ /* */
/* Copyright 2002, 2003, 2006 by */ /* Copyright 2002, 2003, 2006, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@@ -600,8 +600,8 @@
/* get the bitmap metrics */ /* get the bitmap metrics */
{ {
FT_Long xpos, ypos, advance; FT_Long xpos = 0, ypos = 0, advance = 0;
FT_UInt xsize, ysize, format; FT_UInt xsize = 0, ysize = 0, format = 0;
FT_Byte* p; FT_Byte* p;
+18 -3
View File
@@ -4,7 +4,8 @@
/* */ /* */
/* PostScript Type 1 decoding routines (body). */ /* PostScript Type 1 decoding routines (body). */
/* */ /* */
/* Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */ /* Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 */
/* 2010 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@@ -211,7 +212,12 @@
/* `glyph_names' is set to 0 for CID fonts which do not */ /* `glyph_names' is set to 0 for CID fonts which do not */
/* include an encoding. How can we deal with these? */ /* include an encoding. How can we deal with these? */
#ifdef FT_CONFIG_OPTION_INCREMENTAL
if ( decoder->glyph_names == 0 &&
!face->root.internal->incremental_interface )
#else
if ( decoder->glyph_names == 0 ) if ( decoder->glyph_names == 0 )
#endif /* FT_CONFIG_OPTION_INCREMENTAL */
{ {
FT_ERROR(( "t1operator_seac:" FT_ERROR(( "t1operator_seac:"
" glyph names table not available in this font\n" )); " glyph names table not available in this font\n" ));
@@ -1453,12 +1459,20 @@
case op_setcurrentpoint: case op_setcurrentpoint:
FT_TRACE4(( " setcurrentpoint" )); FT_TRACE4(( " setcurrentpoint" ));
/* From the T1 specs, section 6.4: */ /* From the T1 specification, section 6.4: */
/* */ /* */
/* The setcurrentpoint command is used only in */ /* The setcurrentpoint command is used only in */
/* conjunction with results from OtherSubrs procedures. */ /* conjunction with results from OtherSubrs procedures. */
/* known_othersubr_result_cnt != 0 is already handled above */ /* known_othersubr_result_cnt != 0 is already handled */
/* above. */
/* Note, however, that both Ghostscript and Adobe */
/* Distiller handle this situation by silently ignoring */
/* the inappropriate `setcurrentpoint' instruction. So */
/* we do the same. */
#if 0
if ( decoder->flex_state != 1 ) if ( decoder->flex_state != 1 )
{ {
FT_ERROR(( "t1_decoder_parse_charstrings:" FT_ERROR(( "t1_decoder_parse_charstrings:"
@@ -1466,6 +1480,7 @@
goto Syntax_Error; goto Syntax_Error;
} }
else else
#endif
decoder->flex_state = 0; decoder->flex_state = 0;
break; break;
+1 -2
View File
@@ -561,8 +561,7 @@
psnames_get_service( FT_Module module, psnames_get_service( FT_Module module,
const char* service_id ) const char* service_id )
{ {
FT_Library library = module->library; FT_UNUSED( module );
FT_UNUSED(library);
return ft_service_list_lookup( FT_PSCMAPS_SERVICES_GET, service_id ); return ft_service_list_lookup( FT_PSCMAPS_SERVICES_GET, service_id );
} }
-2
View File
@@ -417,8 +417,6 @@
sfnt_get_interface( FT_Module module, sfnt_get_interface( FT_Module module,
const char* module_interface ) const char* module_interface )
{ {
FT_Library library = module->library;
FT_UNUSED(library);
FT_UNUSED( module ); FT_UNUSED( module );
return ft_service_list_lookup( FT_SFNT_SERVICES_GET, module_interface ); return ft_service_list_lookup( FT_SFNT_SERVICES_GET, module_interface );
+25 -6
View File
@@ -26,6 +26,7 @@
#include FT_TRUETYPE_IDS_H #include FT_TRUETYPE_IDS_H
#include FT_TRUETYPE_TAGS_H #include FT_TRUETYPE_TAGS_H
#include FT_SERVICE_POSTSCRIPT_CMAPS_H #include FT_SERVICE_POSTSCRIPT_CMAPS_H
#include FT_SFNT_NAMES_H
#include "sferrors.h" #include "sferrors.h"
#ifdef TT_CONFIG_OPTION_BDF #ifdef TT_CONFIG_OPTION_BDF
@@ -527,13 +528,27 @@
#endif #endif
FT_Bool has_outline; FT_Bool has_outline;
FT_Bool is_apple_sbit; FT_Bool is_apple_sbit;
FT_Bool ignore_preferred_family = FALSE;
FT_Bool ignore_preferred_subfamily = FALSE;
SFNT_Service sfnt = (SFNT_Service)face->sfnt; SFNT_Service sfnt = (SFNT_Service)face->sfnt;
FT_UNUSED( face_index ); FT_UNUSED( face_index );
FT_UNUSED( num_params );
FT_UNUSED( params );
/* Check parameters */
{
FT_Int i;
for ( i = 0; i < num_params; i++ )
{
if ( params[i].tag == FT_PARAM_TAG_IGNORE_PREFERRED_FAMILY )
ignore_preferred_family = TRUE;
else if ( params[i].tag == FT_PARAM_TAG_IGNORE_PREFERRED_SUBFAMILY )
ignore_preferred_subfamily = TRUE;
}
}
/* Load tables */ /* Load tables */
@@ -722,26 +737,30 @@
/* Foundation (WPF). This flag has been introduced in version */ /* Foundation (WPF). This flag has been introduced in version */
/* 1.5 of the OpenType specification (May 2008). */ /* 1.5 of the OpenType specification (May 2008). */
face->root.family_name = NULL;
face->root.style_name = NULL;
if ( face->os2.version != 0xFFFFU && face->os2.fsSelection & 256 ) if ( face->os2.version != 0xFFFFU && face->os2.fsSelection & 256 )
{ {
GET_NAME( PREFERRED_FAMILY, &face->root.family_name ); if ( !ignore_preferred_family )
GET_NAME( PREFERRED_FAMILY, &face->root.family_name );
if ( !face->root.family_name ) if ( !face->root.family_name )
GET_NAME( FONT_FAMILY, &face->root.family_name ); GET_NAME( FONT_FAMILY, &face->root.family_name );
GET_NAME( PREFERRED_SUBFAMILY, &face->root.style_name ); if ( !ignore_preferred_subfamily )
GET_NAME( PREFERRED_SUBFAMILY, &face->root.style_name );
if ( !face->root.style_name ) if ( !face->root.style_name )
GET_NAME( FONT_SUBFAMILY, &face->root.style_name ); GET_NAME( FONT_SUBFAMILY, &face->root.style_name );
} }
else else
{ {
GET_NAME( WWS_FAMILY, &face->root.family_name ); GET_NAME( WWS_FAMILY, &face->root.family_name );
if ( !face->root.family_name ) if ( !face->root.family_name && !ignore_preferred_family )
GET_NAME( PREFERRED_FAMILY, &face->root.family_name ); GET_NAME( PREFERRED_FAMILY, &face->root.family_name );
if ( !face->root.family_name ) if ( !face->root.family_name )
GET_NAME( FONT_FAMILY, &face->root.family_name ); GET_NAME( FONT_FAMILY, &face->root.family_name );
GET_NAME( WWS_SUBFAMILY, &face->root.style_name ); GET_NAME( WWS_SUBFAMILY, &face->root.style_name );
if ( !face->root.style_name ) if ( !face->root.style_name && !ignore_preferred_subfamily )
GET_NAME( PREFERRED_SUBFAMILY, &face->root.style_name ); GET_NAME( PREFERRED_SUBFAMILY, &face->root.style_name );
if ( !face->root.style_name ) if ( !face->root.style_name )
GET_NAME( FONT_SUBFAMILY, &face->root.style_name ); GET_NAME( FONT_SUBFAMILY, &face->root.style_name );
+3 -6
View File
@@ -2574,10 +2574,7 @@
} }
FT_CALLBACK_TABLE_DEF FT_DEFINE_TT_CMAP(tt_cmap13_class_rec,
const TT_CMap_ClassRec tt_cmap13_class_rec =
{
{
sizeof ( TT_CMap13Rec ), sizeof ( TT_CMap13Rec ),
(FT_CMap_InitFunc) tt_cmap13_init, (FT_CMap_InitFunc) tt_cmap13_init,
@@ -2586,11 +2583,11 @@
(FT_CMap_CharNextFunc) tt_cmap13_char_next, (FT_CMap_CharNextFunc) tt_cmap13_char_next,
NULL, NULL, NULL, NULL, NULL NULL, NULL, NULL, NULL, NULL
}, ,
13, 13,
(TT_CMap_ValidateFunc) tt_cmap13_validate, (TT_CMap_ValidateFunc) tt_cmap13_validate,
(TT_CMap_Info_GetFunc) tt_cmap13_get_info (TT_CMap_Info_GetFunc) tt_cmap13_get_info
}; )
#endif /* TT_CONFIG_CMAP_FORMAT_13 */ #endif /* TT_CONFIG_CMAP_FORMAT_13 */
+4 -4
View File
@@ -168,10 +168,10 @@
check_table_dir( SFNT_Header sfnt, check_table_dir( SFNT_Header sfnt,
FT_Stream stream ) FT_Stream stream )
{ {
FT_Error error; FT_Error error;
FT_UInt nn, valid_entries = 0; FT_UShort nn, valid_entries = 0;
FT_UInt has_head = 0, has_sing = 0, has_meta = 0; FT_UInt has_head = 0, has_sing = 0, has_meta = 0;
FT_ULong offset = sfnt->offset + 12; FT_ULong offset = sfnt->offset + 12;
static const FT_Frame_Field table_dir_entry_fields[] = static const FT_Frame_Field table_dir_entry_fields[] =
{ {
+14 -4
View File
@@ -4,7 +4,8 @@
/* */ /* */
/* TrueType font driver implementation (body). */ /* TrueType font driver implementation (body). */
/* */ /* */
/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */ /* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 */
/* 2010 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@@ -298,7 +299,15 @@
if ( !size ) if ( !size )
return TT_Err_Invalid_Size_Handle; return TT_Err_Invalid_Size_Handle;
if ( !face || glyph_index >= (FT_UInt)face->num_glyphs ) if ( !face )
return TT_Err_Invalid_Argument;
#ifdef FT_CONFIG_OPTION_INCREMENTAL
if ( glyph_index >= (FT_UInt)face->num_glyphs &&
!face->internal->incremental_interface )
#else
if ( glyph_index >= (FT_UInt)face->num_glyphs )
#endif
return TT_Err_Invalid_Argument; return TT_Err_Invalid_Argument;
if ( load_flags & FT_LOAD_NO_HINTING ) if ( load_flags & FT_LOAD_NO_HINTING )
@@ -393,16 +402,17 @@
tt_get_interface( FT_Module driver, /* TT_Driver */ tt_get_interface( FT_Module driver, /* TT_Driver */
const char* tt_interface ) const char* tt_interface )
{ {
FT_Library library = driver->library;
FT_Module_Interface result; FT_Module_Interface result;
FT_Module sfntd; FT_Module sfntd;
SFNT_Service sfnt; SFNT_Service sfnt;
FT_UNUSED(library);
result = ft_service_list_lookup( FT_TT_SERVICES_GET, tt_interface ); result = ft_service_list_lookup( FT_TT_SERVICES_GET, tt_interface );
if ( result != NULL ) if ( result != NULL )
return result; return result;
if ( !driver )
return NULL;
/* only return the default interface from the SFNT module */ /* only return the default interface from the SFNT module */
sfntd = FT_Get_Module( driver->library, "sfnt" ); sfntd = FT_Get_Module( driver->library, "sfnt" );
if ( sfntd ) if ( sfntd )
+134 -82
View File
@@ -4,7 +4,8 @@
/* */ /* */
/* TrueType Glyph Loader (body). */ /* TrueType Glyph Loader (body). */
/* */ /* */
/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */ /* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, */
/* 2010 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@@ -69,7 +70,7 @@
/* `check' is true, take care of monospaced fonts by returning the */ /* `check' is true, take care of monospaced fonts by returning the */
/* advance width maximum. */ /* advance width maximum. */
/* */ /* */
FT_LOCAL_DEF(void) FT_LOCAL_DEF( void )
TT_Get_HMetrics( TT_Face face, TT_Get_HMetrics( TT_Face face,
FT_UInt idx, FT_UInt idx,
FT_Bool check, FT_Bool check,
@@ -80,6 +81,9 @@
if ( check && face->postscript.isFixedPitch ) if ( check && face->postscript.isFixedPitch )
*aw = face->horizontal.advance_Width_Max; *aw = face->horizontal.advance_Width_Max;
FT_TRACE5(( " advance width (font units): %d\n", *aw ));
FT_TRACE5(( " left side bearing (font units): %d\n", *lsb ));
} }
@@ -96,7 +100,7 @@
/* The monospace `check' is probably not meaningful here, but we leave */ /* The monospace `check' is probably not meaningful here, but we leave */
/* it in for a consistent interface. */ /* it in for a consistent interface. */
/* */ /* */
FT_LOCAL_DEF(void) FT_LOCAL_DEF( void )
TT_Get_VMetrics( TT_Face face, TT_Get_VMetrics( TT_Face face,
FT_UInt idx, FT_UInt idx,
FT_Bool check, FT_Bool check,
@@ -131,6 +135,91 @@
#endif #endif
FT_TRACE5(( " advance height (font units): %d\n", *ah ));
FT_TRACE5(( " top side bearing (font units): %d\n", *tsb ));
}
static void
tt_get_metrics( TT_Loader loader,
FT_UInt glyph_index )
{
TT_Face face = (TT_Face)loader->face;
FT_Short left_bearing = 0, top_bearing = 0;
FT_UShort advance_width = 0, advance_height = 0;
TT_Get_HMetrics( face, glyph_index,
(FT_Bool)!( loader->load_flags &
FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH ),
&left_bearing,
&advance_width );
TT_Get_VMetrics( face, glyph_index,
(FT_Bool)!( loader->load_flags &
FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH ),
&top_bearing,
&advance_height );
#ifdef FT_CONFIG_OPTION_INCREMENTAL
/* If this is an incrementally loaded font check whether there are */
/* overriding metrics for this glyph. */
if ( face->root.internal->incremental_interface &&
face->root.internal->incremental_interface->funcs->get_glyph_metrics )
{
FT_Incremental_MetricsRec metrics;
FT_Error error;
metrics.bearing_x = left_bearing;
metrics.bearing_y = 0;
metrics.advance = advance_width;
metrics.advance_v = 0;
error = face->root.internal->incremental_interface->funcs->get_glyph_metrics(
face->root.internal->incremental_interface->object,
glyph_index, FALSE, &metrics );
if ( error )
goto Exit;
left_bearing = (FT_Short)metrics.bearing_x;
advance_width = (FT_UShort)metrics.advance;
#if 0
/* GWW: Do I do the same for vertical metrics? */
metrics.bearing_x = 0;
metrics.bearing_y = top_bearing;
metrics.advance = advance_height;
error = face->root.internal->incremental_interface->funcs->get_glyph_metrics(
face->root.internal->incremental_interface->object,
glyph_index, TRUE, &metrics );
if ( error )
goto Exit;
top_bearing = (FT_Short)metrics.bearing_y;
advance_height = (FT_UShort)metrics.advance;
#endif /* 0 */
}
Exit:
#endif /* FT_CONFIG_OPTION_INCREMENTAL */
loader->left_bearing = left_bearing;
loader->advance = advance_width;
loader->top_bearing = top_bearing;
loader->vadvance = advance_height;
if ( !loader->linear_def )
{
loader->linear_def = 1;
loader->linear = advance_width;
}
} }
@@ -1102,9 +1191,10 @@
static FT_Error static FT_Error
load_truetype_glyph( TT_Loader loader, load_truetype_glyph( TT_Loader loader,
FT_UInt glyph_index, FT_UInt glyph_index,
FT_UInt recurse_count ) FT_UInt recurse_count,
FT_Bool header_only )
{ {
FT_Error error; FT_Error error = TT_Err_Ok;
FT_Fixed x_scale, y_scale; FT_Fixed x_scale, y_scale;
FT_ULong offset; FT_ULong offset;
TT_Face face = (TT_Face)loader->face; TT_Face face = (TT_Face)loader->face;
@@ -1151,75 +1241,7 @@
y_scale = 0x10000L; y_scale = 0x10000L;
} }
/* get metrics, horizontal and vertical */ tt_get_metrics( loader, glyph_index );
{
FT_Short left_bearing = 0, top_bearing = 0;
FT_UShort advance_width = 0, advance_height = 0;
TT_Get_HMetrics( face, glyph_index,
(FT_Bool)!( loader->load_flags &
FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH ),
&left_bearing,
&advance_width );
TT_Get_VMetrics( face, glyph_index,
(FT_Bool)!( loader->load_flags &
FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH ),
&top_bearing,
&advance_height );
#ifdef FT_CONFIG_OPTION_INCREMENTAL
/* If this is an incrementally loaded font see if there are */
/* overriding metrics for this glyph. */
if ( face->root.internal->incremental_interface &&
face->root.internal->incremental_interface->funcs->get_glyph_metrics )
{
FT_Incremental_MetricsRec metrics;
metrics.bearing_x = left_bearing;
metrics.bearing_y = 0;
metrics.advance = advance_width;
error = face->root.internal->incremental_interface->funcs->get_glyph_metrics(
face->root.internal->incremental_interface->object,
glyph_index, FALSE, &metrics );
if ( error )
goto Exit;
left_bearing = (FT_Short)metrics.bearing_x;
advance_width = (FT_UShort)metrics.advance;
#if 0
/* GWW: Do I do the same for vertical metrics? */
metrics.bearing_x = 0;
metrics.bearing_y = top_bearing;
metrics.advance = advance_height;
error = face->root.internal->incremental_interface->funcs->get_glyph_metrics(
face->root.internal->incremental_interface->object,
glyph_index, TRUE, &metrics );
if ( error )
goto Exit;
top_bearing = (FT_Short)metrics.bearing_y;
advance_height = (FT_UShort)metrics.advance;
#endif /* 0 */
}
#endif /* FT_CONFIG_OPTION_INCREMENTAL */
loader->left_bearing = left_bearing;
loader->advance = advance_width;
loader->top_bearing = top_bearing;
loader->vadvance = advance_height;
if ( !loader->linear_def )
{
loader->linear_def = 1;
loader->linear = advance_width;
}
}
/* Set `offset' to the start of the glyph relative to the start of */ /* Set `offset' to the start of the glyph relative to the start of */
/* the `glyf' table, and `byte_len' to the length of the glyph in */ /* the `glyf' table, and `byte_len' to the length of the glyph in */
@@ -1257,7 +1279,13 @@
if ( loader->byte_len > 0 ) if ( loader->byte_len > 0 )
{ {
#ifdef FT_CONFIG_OPTION_INCREMENTAL
/* for the incremental interface, `glyf_offset' is always zero */
if ( !loader->glyf_offset &&
!face->root.internal->incremental_interface )
#else
if ( !loader->glyf_offset ) if ( !loader->glyf_offset )
#endif /* FT_CONFIG_OPTION_INCREMENTAL */
{ {
FT_TRACE2(( "no `glyf' table but non-zero `loca' entry\n" )); FT_TRACE2(( "no `glyf' table but non-zero `loca' entry\n" ));
error = TT_Err_Invalid_Table; error = TT_Err_Invalid_Table;
@@ -1272,9 +1300,9 @@
opened_frame = 1; opened_frame = 1;
/* read first glyph header */ /* read glyph header first */
error = face->read_glyph_header( loader ); error = face->read_glyph_header( loader );
if ( error ) if ( error || header_only )
goto Exit; goto Exit;
} }
@@ -1285,6 +1313,9 @@
loader->bbox.yMin = 0; loader->bbox.yMin = 0;
loader->bbox.yMax = 0; loader->bbox.yMax = 0;
if ( header_only )
goto Exit;
TT_LOADER_SET_PP( loader ); TT_LOADER_SET_PP( loader );
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
@@ -1474,7 +1505,7 @@
num_base_points = gloader->base.outline.n_points; num_base_points = gloader->base.outline.n_points;
error = load_truetype_glyph( loader, subglyph->index, error = load_truetype_glyph( loader, subglyph->index,
recurse_count + 1 ); recurse_count + 1, FALSE );
if ( error ) if ( error )
goto Exit; goto Exit;
@@ -1697,7 +1728,7 @@
/* scale the metrics */ /* scale the metrics */
if ( !( loader->load_flags & FT_LOAD_NO_SCALE ) ) if ( !( loader->load_flags & FT_LOAD_NO_SCALE ) )
{ {
top = FT_MulFix( top, y_scale ); top = FT_MulFix( top, y_scale );
advance = FT_MulFix( advance, y_scale ); advance = FT_MulFix( advance, y_scale );
} }
@@ -1757,6 +1788,7 @@
glyph->metrics.vertAdvance = (FT_Pos)metrics.vertAdvance << 6; glyph->metrics.vertAdvance = (FT_Pos)metrics.vertAdvance << 6;
glyph->format = FT_GLYPH_FORMAT_BITMAP; glyph->format = FT_GLYPH_FORMAT_BITMAP;
if ( load_flags & FT_LOAD_VERTICAL_LAYOUT ) if ( load_flags & FT_LOAD_VERTICAL_LAYOUT )
{ {
glyph->bitmap_left = metrics.vertBearingX; glyph->bitmap_left = metrics.vertBearingX;
@@ -1779,7 +1811,8 @@
tt_loader_init( TT_Loader loader, tt_loader_init( TT_Loader loader,
TT_Size size, TT_Size size,
TT_GlyphSlot glyph, TT_GlyphSlot glyph,
FT_Int32 load_flags ) FT_Int32 load_flags,
FT_Bool glyf_table_only )
{ {
TT_Face face; TT_Face face;
FT_Stream stream; FT_Stream stream;
@@ -1793,7 +1826,7 @@
#ifdef TT_USE_BYTECODE_INTERPRETER #ifdef TT_USE_BYTECODE_INTERPRETER
/* load execution context */ /* load execution context */
if ( IS_HINTED( load_flags ) ) if ( IS_HINTED( load_flags ) && !glyf_table_only )
{ {
TT_ExecContext exec; TT_ExecContext exec;
FT_Bool grayscale; FT_Bool grayscale;
@@ -1874,6 +1907,7 @@
} }
/* get face's glyph loader */ /* get face's glyph loader */
if ( !glyf_table_only )
{ {
FT_GlyphLoader gloader = glyph->internal->loader; FT_GlyphLoader gloader = glyph->internal->loader;
@@ -1945,7 +1979,25 @@
{ {
error = load_sbit_image( size, glyph, glyph_index, load_flags ); error = load_sbit_image( size, glyph, glyph_index, load_flags );
if ( !error ) if ( !error )
{
FT_Face root = &face->root;
if ( FT_IS_SCALABLE( root ) )
{
/* for the bbox we need the header only */
(void)tt_loader_init( &loader, size, glyph, load_flags, TRUE );
(void)load_truetype_glyph( &loader, glyph_index, 0, TRUE );
glyph->linearHoriAdvance = loader.linear;
glyph->linearVertAdvance = loader.top_bearing + loader.bbox.yMax -
loader.vadvance;
if ( face->postscript.isFixedPitch &&
( load_flags & FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH ) == 0 )
glyph->linearHoriAdvance = face->horizontal.advance_Width_Max;
}
return TT_Err_Ok; return TT_Err_Ok;
}
} }
#endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */ #endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */
@@ -1957,7 +2009,7 @@
if ( load_flags & FT_LOAD_SBITS_ONLY ) if ( load_flags & FT_LOAD_SBITS_ONLY )
return TT_Err_Invalid_Argument; return TT_Err_Invalid_Argument;
error = tt_loader_init( &loader, size, glyph, load_flags ); error = tt_loader_init( &loader, size, glyph, load_flags, FALSE );
if ( error ) if ( error )
return error; return error;
@@ -1966,7 +2018,7 @@
glyph->outline.flags = 0; glyph->outline.flags = 0;
/* main loading loop */ /* main loading loop */
error = load_truetype_glyph( &loader, glyph_index, 0 ); error = load_truetype_glyph( &loader, glyph_index, 0, FALSE );
if ( !error ) if ( !error )
{ {
if ( glyph->format == FT_GLYPH_FORMAT_COMPOSITE ) if ( glyph->format == FT_GLYPH_FORMAT_COMPOSITE )
+4 -7
View File
@@ -94,11 +94,8 @@
#define ALL_POINTS (FT_UShort*)( -1 ) #define ALL_POINTS (FT_UShort*)( -1 )
enum #define GX_PT_POINTS_ARE_WORDS 0x80
{ #define GX_PT_POINT_RUN_COUNT_MASK 0x7F
GX_PT_POINTS_ARE_WORDS = 0x80,
GX_PT_POINT_RUN_COUNT_MASK = 0x7F
};
/*************************************************************************/ /*************************************************************************/
@@ -214,9 +211,9 @@
FT_Offset delta_cnt ) FT_Offset delta_cnt )
{ {
FT_Short *deltas; FT_Short *deltas;
FT_Int runcnt; FT_UInt runcnt;
FT_Offset i; FT_Offset i;
FT_Offset j; FT_UInt j;
FT_Memory memory = stream->memory; FT_Memory memory = stream->memory;
FT_Error error = TT_Err_Ok; FT_Error error = TT_Err_Ok;
+10 -8
View File
@@ -4,7 +4,7 @@
/* */ /* */
/* AFM support for Type 1 fonts (body). */ /* AFM support for Type 1 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. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@@ -58,7 +58,7 @@
/* PS string/name length must be < 16-bit */ /* PS string/name length must be < 16-bit */
if ( ( len - 0xFFFFU ) > 0 ) if ( len > 0xFFFFU )
return 0; return 0;
for ( n = 0; n < type1->num_glyphs; n++ ) for ( n = 0; n < type1->num_glyphs; n++ )
@@ -285,13 +285,15 @@
{ {
t1_font->font_bbox = fi->FontBBox; t1_font->font_bbox = fi->FontBBox;
t1_face->bbox.xMin = fi->FontBBox.xMin >> 16; t1_face->bbox.xMin = fi->FontBBox.xMin >> 16;
t1_face->bbox.yMin = fi->FontBBox.yMin >> 16; t1_face->bbox.yMin = fi->FontBBox.yMin >> 16;
t1_face->bbox.xMax = ( fi->FontBBox.xMax + 0xFFFFU ) >> 16; /* no `U' suffix here to 0xFFFF! */
t1_face->bbox.yMax = ( fi->FontBBox.yMax + 0xFFFFU ) >> 16; t1_face->bbox.xMax = ( fi->FontBBox.xMax + 0xFFFF ) >> 16;
t1_face->bbox.yMax = ( fi->FontBBox.yMax + 0xFFFF ) >> 16;
t1_face->ascender = (FT_Short)( ( fi->Ascender + 0x8000U ) >> 16 ); /* no `U' suffix here to 0x8000! */
t1_face->descender = (FT_Short)( ( fi->Descender + 0x8000U ) >> 16 ); t1_face->ascender = (FT_Short)( ( fi->Ascender + 0x8000 ) >> 16 );
t1_face->descender = (FT_Short)( ( fi->Descender + 0x8000 ) >> 16 );
if ( fi->NumKernPair ) if ( fi->NumKernPair )
{ {
+29 -11
View File
@@ -4,7 +4,7 @@
/* */ /* */
/* Type 1 Glyph Loader (body). */ /* Type 1 Glyph Loader (body). */
/* */ /* */
/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2008, 2009 by */ /* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2008, 2009, 2010 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@@ -103,16 +103,16 @@
metrics.bearing_x = FIXED_TO_INT( decoder->builder.left_bearing.x ); metrics.bearing_x = FIXED_TO_INT( decoder->builder.left_bearing.x );
metrics.bearing_y = FIXED_TO_INT( decoder->builder.left_bearing.y ); metrics.bearing_y = 0;
metrics.advance = FIXED_TO_INT( decoder->builder.advance.x ); metrics.advance = FIXED_TO_INT( decoder->builder.advance.x );
metrics.advance_v = FIXED_TO_INT( decoder->builder.advance.y );
error = inc->funcs->get_glyph_metrics( inc->object, error = inc->funcs->get_glyph_metrics( inc->object,
glyph_index, FALSE, &metrics ); glyph_index, FALSE, &metrics );
decoder->builder.left_bearing.x = INT_TO_FIXED( metrics.bearing_x ); decoder->builder.left_bearing.x = INT_TO_FIXED( metrics.bearing_x );
decoder->builder.left_bearing.y = INT_TO_FIXED( metrics.bearing_y );
decoder->builder.advance.x = INT_TO_FIXED( metrics.advance ); decoder->builder.advance.x = INT_TO_FIXED( metrics.advance );
decoder->builder.advance.y = 0; decoder->builder.advance.y = INT_TO_FIXED( metrics.advance_v );
} }
#endif /* FT_CONFIG_OPTION_INCREMENTAL */ #endif /* FT_CONFIG_OPTION_INCREMENTAL */
@@ -287,7 +287,12 @@
#endif #endif
#ifdef FT_CONFIG_OPTION_INCREMENTAL
if ( glyph_index >= (FT_UInt)face->root.num_glyphs &&
!face->root.internal->incremental_interface )
#else
if ( glyph_index >= (FT_UInt)face->root.num_glyphs ) if ( glyph_index >= (FT_UInt)face->root.num_glyphs )
#endif /* FT_CONFIG_OPTION_INCREMENTAL */
{ {
error = T1_Err_Invalid_Argument; error = T1_Err_Invalid_Argument;
goto Exit; goto Exit;
@@ -396,10 +401,20 @@
FIXED_TO_INT( decoder.builder.advance.x ); FIXED_TO_INT( decoder.builder.advance.x );
glyph->root.internal->glyph_transformed = 0; glyph->root.internal->glyph_transformed = 0;
/* make up vertical ones */ if ( load_flags & FT_LOAD_VERTICAL_LAYOUT )
metrics->vertAdvance = ( face->type1.font_bbox.yMax - {
face->type1.font_bbox.yMin ) >> 16; /* make up vertical ones */
glyph->root.linearVertAdvance = metrics->vertAdvance; metrics->vertAdvance = ( face->type1.font_bbox.yMax -
face->type1.font_bbox.yMin ) >> 16;
glyph->root.linearVertAdvance = metrics->vertAdvance;
}
else
{
metrics->vertAdvance =
FIXED_TO_INT( decoder.builder.advance.y );
glyph->root.linearVertAdvance =
FIXED_TO_INT( decoder.builder.advance.y );
}
glyph->root.format = FT_GLYPH_FORMAT_OUTLINE; glyph->root.format = FT_GLYPH_FORMAT_OUTLINE;
@@ -459,9 +474,12 @@
metrics->horiBearingX = cbox.xMin; metrics->horiBearingX = cbox.xMin;
metrics->horiBearingY = cbox.yMax; metrics->horiBearingY = cbox.yMax;
/* make up vertical ones */ if ( load_flags & FT_LOAD_VERTICAL_LAYOUT )
ft_synthesize_vertical_metrics( metrics, {
metrics->vertAdvance ); /* make up vertical ones */
ft_synthesize_vertical_metrics( metrics,
metrics->vertAdvance );
}
} }
/* Set control data to the glyph charstrings. Note that this is */ /* Set control data to the glyph charstrings. Note that this is */
+5 -4
View File
@@ -441,10 +441,11 @@
root->num_fixed_sizes = 0; root->num_fixed_sizes = 0;
root->available_sizes = 0; root->available_sizes = 0;
root->bbox.xMin = type1->font_bbox.xMin >> 16; root->bbox.xMin = type1->font_bbox.xMin >> 16;
root->bbox.yMin = type1->font_bbox.yMin >> 16; root->bbox.yMin = type1->font_bbox.yMin >> 16;
root->bbox.xMax = ( type1->font_bbox.xMax + 0xFFFFU ) >> 16; /* no `U' suffix here to 0xFFFF! */
root->bbox.yMax = ( type1->font_bbox.yMax + 0xFFFFU ) >> 16; root->bbox.xMax = ( type1->font_bbox.xMax + 0xFFFF ) >> 16;
root->bbox.yMax = ( type1->font_bbox.yMax + 0xFFFF ) >> 16;
/* Set units_per_EM if we didn't set it in parse_font_matrix. */ /* Set units_per_EM if we didn't set it in parse_font_matrix. */
if ( !root->units_per_EM ) if ( !root->units_per_EM )
+12 -9
View File
@@ -397,15 +397,18 @@
T1_Skip_PS_Token( parser ); T1_Skip_PS_Token( parser );
cur = parser->root.cursor; cur = parser->root.cursor;
if ( *cur == '\r' )
{ /* according to the Type1 spec, the first cipher byte must not be */
cur++; /* an ASCII whitespace character code (blank, tab, carriage return */
if ( *cur == '\n' ) /* or line feed). We have seen Type 1 fonts with two line feed */
cur++; /* characters... So skip now all whitespace character codes. */
} while ( cur < limit &&
else if ( *cur == '\n' ) ( *cur == ' ' ||
cur++; *cur == '\t' ||
else *cur == '\r' ||
*cur == '\n' ) )
++cur;
if ( cur >= limit )
{ {
FT_ERROR(( "T1_Get_Private_Dict:" FT_ERROR(( "T1_Get_Private_Dict:"
" `eexec' not properly terminated\n" )); " `eexec' not properly terminated\n" ));