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). */
/* */
/* 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. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -35,7 +35,6 @@
/* */
/*************************************************************************/
#ifndef __FTCONFIG_H__
#define __FTCONFIG_H__
@@ -306,9 +305,38 @@ FT_BEGIN_HEADER
/* Provide assembler fragments for performance-critical functions. */
/* 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__
#if defined( __arm__ ) && !defined( __thumb__ )
#if defined( __arm__ ) && !defined( __thumb__ ) && \
!( defined( __CC_ARM ) || defined( __ARMCC__ ) )
#define FT_MULFIX_ASSEMBLER FT_MulFix_arm
/* documentation is in freetype.h */
@@ -333,7 +361,7 @@ FT_BEGIN_HEADER
return a;
}
#endif /* __arm__ && !__thumb__ */
#endif /* __arm__ && !__thumb__ && !( __CC_ARM || __ARMCC__ ) */
#if defined( i386 )
#define FT_MULFIX_ASSEMBLER FT_MulFix_i386
@@ -4,7 +4,8 @@
/* */
/* 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. */
/* */
/* 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 */
/* _implementation_. For example, using FT_RENDER_MODE_LCD when calling */
/* FT_Render_Glyph still generates a bitmap that is 3 times larger than */
/* the original size; the difference will be that each triplet of */
/* subpixels has R=G=B. */
/* FT_Render_Glyph still generates a bitmap that is 3 times wider than */
/* the original size in case this macro isn't defined; however, each */
/* triplet of subpixels has R=G=B. */
/* */
/* This is done to allow FreeType clients to run unmodified, forcing */
/* 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 */
/* contain no glyph data, but supply it via a callback function. */
/* This allows FreeType to be used with the PostScript language, using */
/* the GhostScript interpreter. */
/* This is required by clients supporting document formats which */
/* 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 */
/* */
/* 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 */
/* code will be used. */
/* */
+16 -5
View File
@@ -4,7 +4,8 @@
/* */
/* 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. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -231,6 +232,10 @@ FT_BEGIN_HEADER
/* vertAdvance :: */
/* 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_
{
FT_Pos width;
@@ -1477,8 +1482,13 @@ FT_BEGIN_HEADER
/* important to perform correct WYSIWYG layout. */
/* Only relevant for outline glyphs. */
/* */
/* advance :: This is the transformed advance width for the */
/* glyph (in 26.6 fractional pixel format). */
/* advance :: This shorthand is, depending on */
/* @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 */
/* contained in the glyph slot. Typically */
@@ -1743,7 +1753,8 @@ FT_BEGIN_HEADER
/* data :: A pointer to the parameter data. */
/* */
/* <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_
{
@@ -3763,7 +3774,7 @@ FT_BEGIN_HEADER
*/
#define FREETYPE_MAJOR 2
#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) */
/* 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 ); */
/* if ( error ) // `glyph' unchanged */
/* ... */
+27 -11
View File
@@ -5,7 +5,8 @@
/* FreeType glyph image formats and default raster interface */
/* (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. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -51,10 +52,9 @@ FT_BEGIN_HEADER
/* FT_Pos */
/* */
/* <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 */
/* pixel coordinates. */
/* The type FT_Pos is 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 pixel coordinates. */
/* */
typedef signed long FT_Pos;
@@ -99,6 +99,20 @@ FT_BEGIN_HEADER
/* */
/* 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_
{
FT_Pos xMin, yMin;
@@ -254,6 +268,9 @@ FT_BEGIN_HEADER
/* flow. In all cases, the pitch is an offset to add */
/* 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 */
/* value should be aligned on 32-bit boundaries in */
/* most cases. */
@@ -563,8 +580,8 @@ FT_BEGIN_HEADER
/* FT_Outline_ConicToFunc */
/* */
/* <Description> */
/* A function pointer type use to describe the signature of a `conic */
/* to' function during outline walking/decomposition. */
/* A function pointer type used to describe the signature of a `conic */
/* to' function during outline walking or decomposition. */
/* */
/* A `conic to' is emitted to indicate a second-order Bézier arc in */
/* the outline. */
@@ -596,7 +613,7 @@ FT_BEGIN_HEADER
/* */
/* <Description> */
/* 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. */
/* */
@@ -629,8 +646,7 @@ FT_BEGIN_HEADER
/* */
/* <Description> */
/* A structure to hold various function pointers used during outline */
/* decomposition in order to emit segments, conic, and cubic Béziers, */
/* as well as `move to' and `close to' operations. */
/* decomposition in order to emit segments, conic, and cubic Béziers. */
/* */
/* <Fields> */
/* move_to :: The `move to' emitter. */
@@ -657,7 +673,7 @@ FT_BEGIN_HEADER
/* 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. */
/* */
typedef struct FT_Outline_Funcs_
+6 -2
View File
@@ -4,7 +4,7 @@
/* */
/* 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. */
/* */
/* 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.
*
* 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:
* These correspond to horizontal or vertical metrics depending on the
@@ -114,6 +117,7 @@ FT_BEGIN_HEADER
FT_Long bearing_x;
FT_Long bearing_y;
FT_Long advance;
FT_Long advance_v; /* since 2.3.12 */
} FT_Incremental_MetricsRec;
+3 -4
View File
@@ -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, 2009 by */
/* Copyright 1996-2001, 2002, 2003, 2005, 2006, 2007, 2008, 2009, 2010 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -85,9 +85,8 @@ FT_BEGIN_HEADER
/* */
/* <Description> */
/* 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. */
/* segments and Bézier arcs. This function also emits `move to' */
/* operations to indicate the start of new contours in the outline. */
/* */
/* <Input> */
/* outline :: A pointer to the source target. */
+30 -1
View File
@@ -7,7 +7,7 @@
/* */
/* 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. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -160,6 +160,35 @@ FT_BEGIN_HEADER
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,
FT_Face face )
{
FT_UInt i;
FT_Bool started = 0, same_width = 1;
FT_UInt i;
FT_Bool started = 0, same_width = 1;
FT_Fixed advance, old_advance = 0;
/* check whether all ASCII digits have the same advance width; */
/* digit `0' is 0x30 in all supported charmaps */
for ( i = 0x30; i <= 0x39; i++ )
{
FT_UInt glyph_index;
FT_Fixed advance, old_advance = 0;
FT_UInt glyph_index;
glyph_index = FT_Get_Char_Index( face, i );
+4 -4
View File
@@ -407,16 +407,16 @@
af_latin2_metrics_check_digits( AF_LatinMetrics metrics,
FT_Face face )
{
FT_UInt i;
FT_Bool started = 0, same_width = 1;
FT_UInt i;
FT_Bool started = 0, same_width = 1;
FT_Fixed advance, old_advance = 0;
/* check whether all ASCII digits have the same advance width; */
/* digit `0' is 0x30 in all supported charmaps */
for ( i = 0x30; i <= 0x39; i++ )
{
FT_UInt glyph_index;
FT_Fixed advance, old_advance;
FT_UInt glyph_index;
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). */
/* */
/* Copyright 2008 by */
/* Copyright 2008, 2010 by */
/* David Turner, Robert Wilhelm, Werner Lemberg, and suzuki toshiya. */
/* */
/* 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 */
/* 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,
FT_Stream stream,
FT_Long face_index,
@@ -40,7 +40,7 @@ FT_BEGIN_HEADER
/* Create a new FT_Face given a buffer and a driver name. */
/* From ftmac.c. */
FT_LOCAL_DEF( FT_Error )
FT_LOCAL( FT_Error )
open_face_from_buffer( FT_Library library,
FT_Byte* base,
FT_ULong size,
+3 -3
View File
@@ -4,7 +4,7 @@
/* */
/* 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. */
/* */
/* This file is part of the FreeType project, and may only be used */
@@ -140,7 +140,7 @@
/* */
/* <Description> */
/* 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 */
/* update it. */
/* */
@@ -507,7 +507,7 @@
/* */
/* <Description> */
/* 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 */
/* update it. */
/* */
+1 -1
View File
@@ -989,7 +989,7 @@
#else /* !FT_DEBUG_MEMORY */
/* 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 */
+5 -1
View File
@@ -372,7 +372,7 @@
if ( slot->format == FT_GLYPH_FORMAT_BITMAP )
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 )
clazz = FT_OUTLINE_GLYPH_CLASS_GET;
@@ -515,6 +515,10 @@
const FT_Glyph_Class* clazz;
#ifdef FT_CONFIG_OPTION_PIC
FT_Library library = FT_GLYPH( glyph )->library;
#endif
/* check argument */
if ( !the_glyph )
+2 -2
View File
@@ -115,7 +115,7 @@
FT_Module_Class** classes;
FT_Memory memory;
FT_UInt i;
BasePIC* pic_container = library->pic_container.base;
BasePIC* pic_container = (BasePIC*)library->pic_container.base;
if ( !pic_container->default_module_classes )
return;
@@ -145,7 +145,7 @@
FT_Module_Class** classes;
FT_Module_Class* clazz;
FT_UInt i;
BasePIC* pic_container = library->pic_container.base;
BasePIC* pic_container = (BasePIC*)library->pic_container.base;
memory = library->memory;
pic_container->default_module_classes = 0;
+25 -3
View File
@@ -4,7 +4,8 @@
/* */
/* 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. */
/* */
/* 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_TRUETYPE_ENGINE_H
#ifdef FT_CONFIG_OPTION_MAC_FONTS
#include "ftbase.h"
#endif
#define GRID_FIT_METRICS
@@ -708,8 +711,8 @@
}
/* compute the linear advance in 16.16 pixels */
if ( ( load_flags & FT_LOAD_LINEAR_DESIGN ) == 0 &&
( FT_IS_SCALABLE( face ) ) )
if ( ( load_flags & FT_LOAD_LINEAR_DESIGN ) == 0 &&
( FT_IS_SCALABLE( face ) ) )
{
FT_Size_Metrics* metrics = &face->size->metrics;
@@ -739,11 +742,30 @@
renderer, slot,
&internal->transform_matrix,
&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 */
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? */
if ( !error &&
slot->format != FT_GLYPH_FORMAT_BITMAP &&
+4 -4
View File
@@ -4,7 +4,7 @@
/* */
/* 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. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -304,9 +304,9 @@
*anoutline = null_outline;
if ( FT_NEW_ARRAY( anoutline->points, numPoints * 2L ) ||
FT_NEW_ARRAY( anoutline->tags, numPoints ) ||
FT_NEW_ARRAY( anoutline->contours, numContours ) )
if ( FT_NEW_ARRAY( anoutline->points, numPoints ) ||
FT_NEW_ARRAY( anoutline->tags, numPoints ) ||
FT_NEW_ARRAY( anoutline->contours, numContours ) )
goto Fail;
anoutline->n_points = (FT_UShort)numPoints;
+5 -4
View File
@@ -5,7 +5,7 @@
/* FreeType API for checking patented TrueType bytecode instructions */
/* (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, */
/* modified, and distributed under the terms of the FreeType project */
@@ -114,7 +114,7 @@
FT_ULong tag )
{
FT_Stream stream = face->stream;
FT_Error error = FT_Err_Ok;
FT_Error error = FT_Err_Ok;
FT_Service_SFNT_Table service;
FT_Bool result = FALSE;
@@ -124,13 +124,14 @@
if ( service )
{
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++ )
error = service->table_info( face, i,
&tag_i, &offset_i, &length_i );
if ( error ||
if ( error ||
FT_STREAM_SEEK( offset_i ) )
goto Exit;
+6 -8
View File
@@ -4,7 +4,7 @@
/* */
/* 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. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -979,7 +979,8 @@
thcos = FT_Cos( theta );
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;
if ( miter ) /* this is a miter (broken angle) */
@@ -1360,7 +1361,7 @@
phi1 = (angle_mid + angle_in ) / 2;
phi2 = (angle_mid + angle_out ) / 2;
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++ )
{
@@ -1735,13 +1736,10 @@
}
else
{
/* if both first and last points are conic, */
/* start at their middle and record its position */
/* for closure */
/* if both first and last points are conic, */
/* start at their middle */
v_start.x = ( v_start.x + v_last.x ) / 2;
v_start.y = ( v_start.y + v_last.y ) / 2;
v_last = v_start;
}
point--;
tags--;
+2 -2
View File
@@ -4,7 +4,7 @@
/* */
/* 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. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -100,8 +100,8 @@
if ( slot->format == FT_GLYPH_FORMAT_OUTLINE )
{
error = FT_Outline_Embolden( &slot->outline, xstr );
/* ignore error */
(void)FT_Outline_Embolden( &slot->outline, xstr );
/* this is more than enough for most glyphs; if you need accurate */
/* values, you have to call FT_Outline_Get_CBox */
+2 -2
View File
@@ -71,8 +71,8 @@
FT_UNUSED( cache );
return FT_BOOL( gnode->family == gquery->family &&
gnode->gindex == gquery->gindex );
return FT_BOOL( gnode->family == gquery->family &&
gnode->gindex == gquery->gindex );
}
+3 -2
View File
@@ -621,14 +621,15 @@
{
FT_Module sfnt;
FT_Module_Interface result;
FT_Library library = driver->library;
FT_UNUSED(library);
result = ft_service_list_lookup( FT_CFF_SERVICES_GET, module_interface );
if ( result != NULL )
return result;
if ( !driver )
return NULL;
/* we pass our request to the `sfnt' module */
sfnt = FT_Get_Module( driver->library, "sfnt" );
+130 -35
View File
@@ -4,7 +4,8 @@
/* */
/* 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. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -113,6 +114,9 @@
cff_op_closepath,
cff_op_callothersubr,
cff_op_pop,
cff_op_seac,
cff_op_sbw,
cff_op_setcurrentpoint,
/* do not remove */
cff_op_max
@@ -201,7 +205,10 @@
2, /* hsbw */
0,
0,
0
0,
5, /* seac */
4, /* sbw */
2 /* setcurrentpoint */
};
@@ -319,17 +326,23 @@
/* subroutines. */
/* */
/* <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> */
/* The bias value. */
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;
if ( num_subrs < 1240 )
if ( in_charstring_type == 1 )
result = 0;
else if ( num_subrs < 1240 )
result = 107;
else if ( num_subrs < 33900U )
result = 1131;
@@ -380,9 +393,12 @@
cff_builder_init( &decoder->builder, face, size, slot, hinting );
/* initialize Type2 decoder */
decoder->cff = cff;
decoder->num_globals = cff->num_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;
}
@@ -434,7 +450,9 @@
decoder->num_locals = sub->num_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->nominal_width = sub->private_dict.nominal_width;
@@ -677,7 +695,7 @@
data.length = length;
face->root.internal->incremental_interface->funcs->free_glyph_data(
face->root.internal->incremental_interface->object,&data );
face->root.internal->incremental_interface->object, &data );
}
else
#endif /* FT_CONFIG_OPTION_INCREMENTAL */
@@ -693,6 +711,7 @@
static FT_Error
cff_operator_seac( CFF_Decoder* decoder,
FT_Pos asb,
FT_Pos adx,
FT_Pos ady,
FT_Int bchar,
@@ -705,6 +724,7 @@
FT_Vector left_bearing, advance;
FT_Byte* charstring;
FT_ULong charstring_len;
FT_Pos glyph_width;
if ( decoder->seac )
@@ -713,6 +733,9 @@
return CFF_Err_Syntax_Error;
}
adx += decoder->builder.left_bearing.x;
ady += decoder->builder.left_bearing.y;
#ifdef FT_CONFIG_OPTION_INCREMENTAL
/* Incremental fonts don't necessarily have valid charsets. */
/* They use the character code, not the glyph index, in this case. */
@@ -795,16 +818,17 @@
cff_free_glyph_data( face, &charstring, charstring_len );
}
/* Save the left bearing and width of the base character */
/* as they will be erased by the next load. */
/* Save the left bearing, advance and glyph width of the base */
/* character as they will be erased by the next load. */
left_bearing = builder->left_bearing;
advance = builder->advance;
glyph_width = decoder->glyph_width;
builder->left_bearing.x = 0;
builder->left_bearing.y = 0;
builder->pos_x = adx;
builder->pos_x = adx - asb;
builder->pos_y = ady;
/* Now load `achar' on top of the base outline. */
@@ -824,10 +848,11 @@
cff_free_glyph_data( face, &charstring, charstring_len );
}
/* Restore the left side bearing and advance width */
/* of the base character. */
/* Restore the left side bearing, advance and glyph width */
/* of the base character. */
builder->left_bearing = left_bearing;
builder->advance = advance;
decoder->glyph_width = glyph_width;
builder->pos_x = 0;
builder->pos_y = 0;
@@ -869,6 +894,8 @@
FT_Pos x, y;
FT_Fixed seed;
FT_Fixed* stack;
FT_Int charstring_type =
decoder->cff->top_font.font_dict.charstring_type;
T2_Hints_Funcs hinter;
@@ -958,7 +985,8 @@
( (FT_Int32)ip[2] << 8 ) |
ip[3];
ip += 4;
shift = 0;
if ( charstring_type == 2 )
shift = 0;
}
if ( decoder->top - stack >= CFF_MAX_OPERANDS )
goto Stack_Overflow;
@@ -1032,6 +1060,12 @@
case 0:
op = cff_op_dotsection;
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:
op = cff_op_and;
break;
@@ -1041,6 +1075,12 @@
case 5:
op = cff_op_not;
break;
case 6:
op = cff_op_seac;
break;
case 7:
op = cff_op_sbw;
break;
case 8:
op = cff_op_store;
break;
@@ -1104,6 +1144,9 @@
case 30:
op = cff_op_roll;
break;
case 33:
op = cff_op_setcurrentpoint;
break;
case 34:
op = cff_op_hflex;
break;
@@ -1171,7 +1214,7 @@
op = cff_op_hvcurveto;
break;
default:
;
break;
}
if ( op == cff_op_unknown )
@@ -1886,6 +1929,21 @@
}
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:
FT_TRACE4(( " endchar\n" ));
@@ -1895,10 +1953,8 @@
/* Save glyph width so that the subglyphs don't overwrite it. */
FT_Pos glyph_width = decoder->glyph_width;
error = cff_operator_seac( decoder,
args[-4],
args[-3],
0L, args[-4], args[-3],
(FT_Int)( args[-2] >> 16 ),
(FT_Int)( args[-1] >> 16 ) );
@@ -2106,7 +2162,7 @@
FT_TRACE4(( " dup\n" ));
args[1] = args[0];
args++;
args += 2;
break;
case cff_op_put:
@@ -2117,7 +2173,7 @@
FT_TRACE4(( " put\n" ));
if ( idx >= 0 && idx < decoder->len_buildchar )
if ( idx >= 0 && idx < CFF_MAX_TRANS_ELEMENTS )
decoder->buildchar[idx] = val;
}
break;
@@ -2130,7 +2186,7 @@
FT_TRACE4(( " get\n" ));
if ( idx >= 0 && idx < decoder->len_buildchar )
if ( idx >= 0 && idx < CFF_MAX_TRANS_ELEMENTS )
val = decoder->buildchar[idx];
args[0] = val;
@@ -2170,10 +2226,42 @@
FT_TRACE4(( " hsbw (invalid op)\n" ));
decoder->glyph_width = decoder->nominal_width +
(args[1] >> 16);
x = args[0];
y = 0;
decoder->glyph_width = decoder->nominal_width + ( args[1] >> 16 );
decoder->builder.left_bearing.x = args[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;
break;
@@ -2184,8 +2272,10 @@
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 */
/* subsequent `pop' operands should add the arguments, */
/* this is the implementation described for `unknown' other */
/* subroutines in the Type1 spec. */
args -= 2 + ( args[-2] >> 16 );
break;
case cff_op_pop:
@@ -2674,23 +2764,25 @@
#ifdef FT_CONFIG_OPTION_INCREMENTAL
/* Incremental fonts can optionally override the metrics. */
if ( !error &&
face->root.internal->incremental_interface &&
if ( !error &&
face->root.internal->incremental_interface &&
face->root.internal->incremental_interface->funcs->get_glyph_metrics )
{
FT_Incremental_MetricsRec metrics;
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_v = decoder.builder.advance.y;
error = face->root.internal->incremental_interface->funcs->get_glyph_metrics(
face->root.internal->incremental_interface->object,
glyph_index, FALSE, &metrics );
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.y = 0;
decoder.builder.advance.y = metrics.advance_v;
}
#endif /* FT_CONFIG_OPTION_INCREMENTAL */
@@ -2827,9 +2919,12 @@
if ( has_vertical_info )
metrics->vertBearingX = metrics->horiBearingX -
metrics->horiAdvance / 2;
else
ft_synthesize_vertical_metrics( metrics,
metrics->vertAdvance );
else
{
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
#define CFF_MAX_OPERANDS 48
#define CFF_MAX_SUBRS_CALLS 32
#define CFF_MAX_OPERANDS 48
#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 width_only;
FT_Int num_hints;
FT_Fixed* buildchar;
FT_Int len_buildchar;
FT_Fixed buildchar[CFF_MAX_TRANS_ELEMENTS];
FT_UInt num_locals;
FT_UInt num_globals;
+5 -4
View File
@@ -657,10 +657,11 @@
cffface->num_glyphs = cff->charstrings_index.count;
/* set global bbox, as well as EM size */
cffface->bbox.xMin = dict->font_bbox.xMin >> 16;
cffface->bbox.yMin = dict->font_bbox.yMin >> 16;
cffface->bbox.xMax = ( dict->font_bbox.xMax + 0xFFFFU ) >> 16;
cffface->bbox.yMax = ( dict->font_bbox.yMax + 0xFFFFU ) >> 16;
cffface->bbox.xMin = dict->font_bbox.xMin >> 16;
cffface->bbox.yMin = dict->font_bbox.yMin >> 16;
/* no `U' suffix here to 0xFFFF! */
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 );
+3 -1
View File
@@ -745,8 +745,10 @@
p++;
for (;;)
{
/* An unterminated floating point number at the */
/* end of a dictionary is invalid but harmless. */
if ( p >= limit )
goto Syntax_Error;
goto Exit;
v = p[0] >> 4;
if ( v == 15 )
break;
+12 -7
View File
@@ -4,7 +4,7 @@
/* */
/* 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. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -58,6 +58,8 @@
#endif
FT_TRACE4(( "cid_load_glyph: glyph index %d\n", glyph_index ));
#ifdef FT_CONFIG_OPTION_INCREMENTAL
/* 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_y = FIXED_TO_INT( decoder->builder.left_bearing.y );
metrics.bearing_y = 0;
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,
glyph_index, FALSE, &metrics );
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.y = 0;
decoder->builder.advance.y = INT_TO_FIXED( metrics.advance_v );
}
#endif /* FT_CONFIG_OPTION_INCREMENTAL */
@@ -425,9 +427,12 @@
metrics->horiBearingX = cbox.xMin;
metrics->horiBearingY = cbox.yMax;
/* make up vertical ones */
ft_synthesize_vertical_metrics( metrics,
metrics->vertAdvance );
if ( load_flags & FT_LOAD_VERTICAL_LAYOUT )
{
/* make up vertical ones */
ft_synthesize_vertical_metrics( metrics,
metrics->vertAdvance );
}
}
Exit:
+5 -4
View File
@@ -413,10 +413,11 @@
cidface->num_fixed_sizes = 0;
cidface->available_sizes = 0;
cidface->bbox.xMin = cid->font_bbox.xMin >> 16;
cidface->bbox.yMin = cid->font_bbox.yMin >> 16;
cidface->bbox.xMax = ( cid->font_bbox.xMax + 0xFFFFU ) >> 16;
cidface->bbox.yMax = ( cid->font_bbox.yMax + 0xFFFFU ) >> 16;
cidface->bbox.xMin = cid->font_bbox.xMin >> 16;
cidface->bbox.yMin = cid->font_bbox.yMin >> 16;
/* no `U' suffix here to 0xFFFF! */
cidface->bbox.xMax = ( cid->font_bbox.xMax + 0xFFFF ) >> 16;
cidface->bbox.yMax = ( cid->font_bbox.yMax + 0xFFFF ) >> 16;
if ( !cidface->units_per_EM )
cidface->units_per_EM = 1000;
+1 -1
View File
@@ -22,7 +22,7 @@
#define T1CODE T1_FIELD_LOCATION_CID_INFO
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_STRING( "Registry", registry, 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 */
/* distributions. */
/* */
/* Copyright 2004, 2005, 2006, 2009 by */
/* Copyright 2004, 2005, 2006, 2009, 2010 by */
/* Albert Chin-A-Young. */
/* */
/* Based on code in src/gzip/ftgzip.c, Copyright 2004 by */
@@ -122,13 +122,9 @@
zip->pos = 0;
/* check and skip .Z header */
{
stream = source;
error = ft_lzw_check_header( source );
if ( error )
goto Exit;
}
error = ft_lzw_check_header( source );
if ( error )
goto Exit;
/* initialize internal lzw variable */
ft_lzwstate_init( lzw, source );
+3 -3
View File
@@ -4,7 +4,7 @@
/* */
/* FreeType PFR bitmap loader (body). */
/* */
/* Copyright 2002, 2003, 2006 by */
/* Copyright 2002, 2003, 2006, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -600,8 +600,8 @@
/* get the bitmap metrics */
{
FT_Long xpos, ypos, advance;
FT_UInt xsize, ysize, format;
FT_Long xpos = 0, ypos = 0, advance = 0;
FT_UInt xsize = 0, ysize = 0, format = 0;
FT_Byte* p;
+18 -3
View File
@@ -4,7 +4,8 @@
/* */
/* 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. */
/* */
/* 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 */
/* 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 )
#endif /* FT_CONFIG_OPTION_INCREMENTAL */
{
FT_ERROR(( "t1operator_seac:"
" glyph names table not available in this font\n" ));
@@ -1453,12 +1459,20 @@
case op_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 */
/* 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 )
{
FT_ERROR(( "t1_decoder_parse_charstrings:"
@@ -1466,6 +1480,7 @@
goto Syntax_Error;
}
else
#endif
decoder->flex_state = 0;
break;
+1 -2
View File
@@ -561,8 +561,7 @@
psnames_get_service( FT_Module module,
const char* service_id )
{
FT_Library library = module->library;
FT_UNUSED(library);
FT_UNUSED( module );
return ft_service_list_lookup( FT_PSCMAPS_SERVICES_GET, service_id );
}
-2
View File
@@ -417,8 +417,6 @@
sfnt_get_interface( FT_Module module,
const char* module_interface )
{
FT_Library library = module->library;
FT_UNUSED(library);
FT_UNUSED( module );
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_TAGS_H
#include FT_SERVICE_POSTSCRIPT_CMAPS_H
#include FT_SFNT_NAMES_H
#include "sferrors.h"
#ifdef TT_CONFIG_OPTION_BDF
@@ -527,13 +528,27 @@
#endif
FT_Bool has_outline;
FT_Bool is_apple_sbit;
FT_Bool ignore_preferred_family = FALSE;
FT_Bool ignore_preferred_subfamily = FALSE;
SFNT_Service sfnt = (SFNT_Service)face->sfnt;
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 */
@@ -722,26 +737,30 @@
/* Foundation (WPF). This flag has been introduced in version */
/* 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 )
{
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 )
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 )
GET_NAME( FONT_SUBFAMILY, &face->root.style_name );
}
else
{
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 );
if ( !face->root.family_name )
GET_NAME( FONT_FAMILY, &face->root.family_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 );
if ( !face->root.style_name )
GET_NAME( FONT_SUBFAMILY, &face->root.style_name );
+3 -6
View File
@@ -2574,10 +2574,7 @@
}
FT_CALLBACK_TABLE_DEF
const TT_CMap_ClassRec tt_cmap13_class_rec =
{
{
FT_DEFINE_TT_CMAP(tt_cmap13_class_rec,
sizeof ( TT_CMap13Rec ),
(FT_CMap_InitFunc) tt_cmap13_init,
@@ -2586,11 +2583,11 @@
(FT_CMap_CharNextFunc) tt_cmap13_char_next,
NULL, NULL, NULL, NULL, NULL
},
,
13,
(TT_CMap_ValidateFunc) tt_cmap13_validate,
(TT_CMap_Info_GetFunc) tt_cmap13_get_info
};
)
#endif /* TT_CONFIG_CMAP_FORMAT_13 */
+4 -4
View File
@@ -168,10 +168,10 @@
check_table_dir( SFNT_Header sfnt,
FT_Stream stream )
{
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;
FT_Error error;
FT_UShort 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[] =
{
+14 -4
View File
@@ -4,7 +4,8 @@
/* */
/* 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. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -298,7 +299,15 @@
if ( !size )
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;
if ( load_flags & FT_LOAD_NO_HINTING )
@@ -393,16 +402,17 @@
tt_get_interface( FT_Module driver, /* TT_Driver */
const char* tt_interface )
{
FT_Library library = driver->library;
FT_Module_Interface result;
FT_Module sfntd;
SFNT_Service sfnt;
FT_UNUSED(library);
result = ft_service_list_lookup( FT_TT_SERVICES_GET, tt_interface );
if ( result != NULL )
return result;
if ( !driver )
return NULL;
/* only return the default interface from the SFNT module */
sfntd = FT_Get_Module( driver->library, "sfnt" );
if ( sfntd )
+134 -82
View File
@@ -4,7 +4,8 @@
/* */
/* 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. */
/* */
/* 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 */
/* advance width maximum. */
/* */
FT_LOCAL_DEF(void)
FT_LOCAL_DEF( void )
TT_Get_HMetrics( TT_Face face,
FT_UInt idx,
FT_Bool check,
@@ -80,6 +81,9 @@
if ( check && face->postscript.isFixedPitch )
*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 */
/* it in for a consistent interface. */
/* */
FT_LOCAL_DEF(void)
FT_LOCAL_DEF( void )
TT_Get_VMetrics( TT_Face face,
FT_UInt idx,
FT_Bool check,
@@ -131,6 +135,91 @@
#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
load_truetype_glyph( TT_Loader loader,
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_ULong offset;
TT_Face face = (TT_Face)loader->face;
@@ -1151,75 +1241,7 @@
y_scale = 0x10000L;
}
/* get metrics, horizontal and vertical */
{
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;
}
}
tt_get_metrics( loader, glyph_index );
/* 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 */
@@ -1257,7 +1279,13 @@
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 )
#endif /* FT_CONFIG_OPTION_INCREMENTAL */
{
FT_TRACE2(( "no `glyf' table but non-zero `loca' entry\n" ));
error = TT_Err_Invalid_Table;
@@ -1272,9 +1300,9 @@
opened_frame = 1;
/* read first glyph header */
/* read glyph header first */
error = face->read_glyph_header( loader );
if ( error )
if ( error || header_only )
goto Exit;
}
@@ -1285,6 +1313,9 @@
loader->bbox.yMin = 0;
loader->bbox.yMax = 0;
if ( header_only )
goto Exit;
TT_LOADER_SET_PP( loader );
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
@@ -1474,7 +1505,7 @@
num_base_points = gloader->base.outline.n_points;
error = load_truetype_glyph( loader, subglyph->index,
recurse_count + 1 );
recurse_count + 1, FALSE );
if ( error )
goto Exit;
@@ -1697,7 +1728,7 @@
/* scale the metrics */
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 );
}
@@ -1757,6 +1788,7 @@
glyph->metrics.vertAdvance = (FT_Pos)metrics.vertAdvance << 6;
glyph->format = FT_GLYPH_FORMAT_BITMAP;
if ( load_flags & FT_LOAD_VERTICAL_LAYOUT )
{
glyph->bitmap_left = metrics.vertBearingX;
@@ -1779,7 +1811,8 @@
tt_loader_init( TT_Loader loader,
TT_Size size,
TT_GlyphSlot glyph,
FT_Int32 load_flags )
FT_Int32 load_flags,
FT_Bool glyf_table_only )
{
TT_Face face;
FT_Stream stream;
@@ -1793,7 +1826,7 @@
#ifdef TT_USE_BYTECODE_INTERPRETER
/* load execution context */
if ( IS_HINTED( load_flags ) )
if ( IS_HINTED( load_flags ) && !glyf_table_only )
{
TT_ExecContext exec;
FT_Bool grayscale;
@@ -1874,6 +1907,7 @@
}
/* get face's glyph loader */
if ( !glyf_table_only )
{
FT_GlyphLoader gloader = glyph->internal->loader;
@@ -1945,7 +1979,25 @@
{
error = load_sbit_image( size, glyph, glyph_index, load_flags );
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;
}
}
#endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */
@@ -1957,7 +2009,7 @@
if ( load_flags & FT_LOAD_SBITS_ONLY )
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 )
return error;
@@ -1966,7 +2018,7 @@
glyph->outline.flags = 0;
/* main loading loop */
error = load_truetype_glyph( &loader, glyph_index, 0 );
error = load_truetype_glyph( &loader, glyph_index, 0, FALSE );
if ( !error )
{
if ( glyph->format == FT_GLYPH_FORMAT_COMPOSITE )
+4 -7
View File
@@ -94,11 +94,8 @@
#define ALL_POINTS (FT_UShort*)( -1 )
enum
{
GX_PT_POINTS_ARE_WORDS = 0x80,
GX_PT_POINT_RUN_COUNT_MASK = 0x7F
};
#define GX_PT_POINTS_ARE_WORDS 0x80
#define GX_PT_POINT_RUN_COUNT_MASK 0x7F
/*************************************************************************/
@@ -214,9 +211,9 @@
FT_Offset delta_cnt )
{
FT_Short *deltas;
FT_Int runcnt;
FT_UInt runcnt;
FT_Offset i;
FT_Offset j;
FT_UInt j;
FT_Memory memory = stream->memory;
FT_Error error = TT_Err_Ok;
+10 -8
View File
@@ -4,7 +4,7 @@
/* */
/* 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. */
/* */
/* 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 */
if ( ( len - 0xFFFFU ) > 0 )
if ( len > 0xFFFFU )
return 0;
for ( n = 0; n < type1->num_glyphs; n++ )
@@ -285,13 +285,15 @@
{
t1_font->font_bbox = fi->FontBBox;
t1_face->bbox.xMin = fi->FontBBox.xMin >> 16;
t1_face->bbox.yMin = fi->FontBBox.yMin >> 16;
t1_face->bbox.xMax = ( fi->FontBBox.xMax + 0xFFFFU ) >> 16;
t1_face->bbox.yMax = ( fi->FontBBox.yMax + 0xFFFFU ) >> 16;
t1_face->bbox.xMin = fi->FontBBox.xMin >> 16;
t1_face->bbox.yMin = fi->FontBBox.yMin >> 16;
/* no `U' suffix here to 0xFFFF! */
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 );
t1_face->descender = (FT_Short)( ( fi->Descender + 0x8000U ) >> 16 );
/* no `U' suffix here to 0x8000! */
t1_face->ascender = (FT_Short)( ( fi->Ascender + 0x8000 ) >> 16 );
t1_face->descender = (FT_Short)( ( fi->Descender + 0x8000 ) >> 16 );
if ( fi->NumKernPair )
{
+29 -11
View File
@@ -4,7 +4,7 @@
/* */
/* 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. */
/* */
/* 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_y = FIXED_TO_INT( decoder->builder.left_bearing.y );
metrics.bearing_y = 0;
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,
glyph_index, FALSE, &metrics );
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.y = 0;
decoder->builder.advance.y = INT_TO_FIXED( metrics.advance_v );
}
#endif /* FT_CONFIG_OPTION_INCREMENTAL */
@@ -287,7 +287,12 @@
#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 )
#endif /* FT_CONFIG_OPTION_INCREMENTAL */
{
error = T1_Err_Invalid_Argument;
goto Exit;
@@ -396,10 +401,20 @@
FIXED_TO_INT( decoder.builder.advance.x );
glyph->root.internal->glyph_transformed = 0;
/* make up vertical ones */
metrics->vertAdvance = ( face->type1.font_bbox.yMax -
face->type1.font_bbox.yMin ) >> 16;
glyph->root.linearVertAdvance = metrics->vertAdvance;
if ( load_flags & FT_LOAD_VERTICAL_LAYOUT )
{
/* make up vertical ones */
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;
@@ -459,9 +474,12 @@
metrics->horiBearingX = cbox.xMin;
metrics->horiBearingY = cbox.yMax;
/* make up vertical ones */
ft_synthesize_vertical_metrics( metrics,
metrics->vertAdvance );
if ( load_flags & FT_LOAD_VERTICAL_LAYOUT )
{
/* make up vertical ones */
ft_synthesize_vertical_metrics( metrics,
metrics->vertAdvance );
}
}
/* 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->available_sizes = 0;
root->bbox.xMin = type1->font_bbox.xMin >> 16;
root->bbox.yMin = type1->font_bbox.yMin >> 16;
root->bbox.xMax = ( type1->font_bbox.xMax + 0xFFFFU ) >> 16;
root->bbox.yMax = ( type1->font_bbox.yMax + 0xFFFFU ) >> 16;
root->bbox.xMin = type1->font_bbox.xMin >> 16;
root->bbox.yMin = type1->font_bbox.yMin >> 16;
/* no `U' suffix here to 0xFFFF! */
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. */
if ( !root->units_per_EM )
+12 -9
View File
@@ -397,15 +397,18 @@
T1_Skip_PS_Token( parser );
cur = parser->root.cursor;
if ( *cur == '\r' )
{
cur++;
if ( *cur == '\n' )
cur++;
}
else if ( *cur == '\n' )
cur++;
else
/* according to the Type1 spec, the first cipher byte must not be */
/* an ASCII whitespace character code (blank, tab, carriage return */
/* or line feed). We have seen Type 1 fonts with two line feed */
/* characters... So skip now all whitespace character codes. */
while ( cur < limit &&
( *cur == ' ' ||
*cur == '\t' ||
*cur == '\r' ||
*cur == '\n' ) )
++cur;
if ( cur >= limit )
{
FT_ERROR(( "T1_Get_Private_Dict:"
" `eexec' not properly terminated\n" ));