From 4a62922bf8b8d9309db2ae8431469ee2b8cd7adf Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sun, 12 Mar 2017 10:19:53 +0100 Subject: [PATCH 001/470] src/truetype/ttgxvar.[ch]: s/avar_checked/avar_loaded/. --- ChangeLog | 4 ++++ src/truetype/ttgxvar.c | 8 ++++---- src/truetype/ttgxvar.h | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index b1158369b..43ef3fbd9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2017-03-12 Werner Lemberg + + src/truetype/ttgxvar.[ch]: s/avar_checked/avar_loaded/. + 2017-03-08 Werner Lemberg [sfnt] Another fix for buggy variation fonts. diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c index fa614ca1a..641d07c00 100644 --- a/src/truetype/ttgxvar.c +++ b/src/truetype/ttgxvar.c @@ -320,7 +320,7 @@ FT_TRACE2(( "AVAR " )); - blend->avar_checked = TRUE; + blend->avar_loaded = TRUE; error = face->goto_table( face, TTAG_avar, stream, &table_len ); if ( error ) { @@ -2124,7 +2124,7 @@ fvar_head.axisCount * num_instances ) ) goto Exit; - if ( fvar_head.instanceCount && !face->blend->avar_checked ) + if ( fvar_head.instanceCount && !face->blend->avar_loaded ) ft_var_load_avar( face ); ns = mmvar->namedstyle; @@ -2564,7 +2564,7 @@ if ( FT_NEW_ARRAY( normalized, num_axes ) ) goto Exit; - if ( !face->blend->avar_checked ) + if ( !face->blend->avar_loaded ) ft_var_load_avar( face ); ft_var_to_normalized( face, num_coords, coords, normalized ); @@ -2613,7 +2613,7 @@ return error; } - if ( !face->blend->avar_checked ) + if ( !face->blend->avar_loaded ) ft_var_load_avar( face ); ft_var_to_design( face, diff --git a/src/truetype/ttgxvar.h b/src/truetype/ttgxvar.h index c59d52809..0d1fb3964 100644 --- a/src/truetype/ttgxvar.h +++ b/src/truetype/ttgxvar.h @@ -235,7 +235,7 @@ FT_BEGIN_HEADER FT_Fixed* normalized_stylecoords; /* normalized_stylecoords[num_namedstyles][num_axis] */ - FT_Bool avar_checked; + FT_Bool avar_loaded; GX_AVarSegment avar_segment; FT_Bool hvar_loaded; From 8dd9e9675d117e5e5d1c8cae84847b3c84daeb53 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sun, 12 Mar 2017 10:47:20 +0100 Subject: [PATCH 002/470] Document `GX_BlendRec'. --- src/truetype/ttgxvar.h | 87 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 77 insertions(+), 10 deletions(-) diff --git a/src/truetype/ttgxvar.h b/src/truetype/ttgxvar.h index 0d1fb3964..804678cb9 100644 --- a/src/truetype/ttgxvar.h +++ b/src/truetype/ttgxvar.h @@ -214,15 +214,82 @@ FT_BEGIN_HEADER /* */ /* */ /* Data for interpolating a font from a distortable font specified */ - /* by the GX *var tables ([fgca]var). */ + /* by the GX *var tables ([fgcahvm]var). */ /* */ /* */ - /* num_axis :: The number of axes along which interpolation */ - /* may happen */ + /* num_axis :: */ + /* The number of axes along which interpolation may happen. */ /* */ - /* normalizedcoords :: A normalized value (between [-1,1]) indicating */ - /* the contribution along each axis to the final */ - /* interpolated font. */ + /* normalizedcoords :: */ + /* An array of normalized values (between [-1,1]) indicating the */ + /* contribution along each axis to the final interpolated font. */ + /* `coords' holds the same values. */ + /* */ + /* mmvar :: */ + /* Data from the `fvar' table. */ + /* */ + /* mmvar_len :: */ + /* The length of the `mmvar' structure. */ + /* */ + /* normalized_stylecoords :: */ + /* A two-dimensional array that holds the named instance data from */ + /* `mmvar' as normalized values. */ + /* */ + /* avar_loaded :: */ + /* A Boolean; if set, FreeType tried to load (and parse) the `avar' */ + /* table. */ + /* */ + /* avar_segment :: */ + /* Data from the `avar' table. */ + /* */ + /* hvar_loaded :: */ + /* A Boolean; if set, FreeType tried to load (and parse) the `hvar' */ + /* table. */ + /* */ + /* hvar_checked :: */ + /* A Boolean; if set, FreeType successfully loaded and parsed the */ + /* `hvar' table. */ + /* */ + /* hvar_error :: */ + /* If loading and parsing of the `hvar' table failed, this field */ + /* holds the corresponding error code. */ + /* */ + /* hvar_table :: */ + /* Data from the `hvar' table. */ + /* */ + /* vvar_loaded :: */ + /* A Boolean; if set, FreeType tried to load (and parse) the `vvar' */ + /* table. */ + /* */ + /* vvar_checked :: */ + /* A Boolean; if set, FreeType successfully loaded and parsed the */ + /* `vvar' table. */ + /* */ + /* vvar_error :: */ + /* If loading and parsing of the `vvar' table failed, this field */ + /* holds the corresponding error code. */ + /* */ + /* vvar_table :: */ + /* Data from the `vvar' table. */ + /* */ + /* mvar_table :: */ + /* Data from the `mvar' table. */ + /* */ + /* tuplecount :: */ + /* The number of shared tuples in the `gvar' table. */ + /* */ + /* tuplecoords :: */ + /* A two-dimensional array that holds the shared tuple coordinates */ + /* in the `gvar' table. */ + /* */ + /* gv_glyphcnt :: */ + /* The number of glyphs handled in the `gvar' table. */ + /* */ + /* glyphoffsets :: */ + /* Offsets into the glyph variation data array. */ + /* */ + /* gvar_size :: */ + /* The size of the `gvar' table. */ /* */ typedef struct GX_BlendRec_ { @@ -236,7 +303,7 @@ FT_BEGIN_HEADER /* normalized_stylecoords[num_namedstyles][num_axis] */ FT_Bool avar_loaded; - GX_AVarSegment avar_segment; + GX_AVarSegment avar_segment; /* avar_segment[num_axis] */ FT_Bool hvar_loaded; FT_Bool hvar_checked; @@ -250,11 +317,11 @@ FT_BEGIN_HEADER GX_MVarTable mvar_table; - FT_UInt tuplecount; /* shared tuples in `gvar' */ - FT_Fixed* tuplecoords; /* tuplecoords[tuplecount][num_axis] */ + FT_UInt tuplecount; + FT_Fixed* tuplecoords; /* tuplecoords[tuplecount][num_axis] */ FT_UInt gv_glyphcnt; - FT_ULong* glyphoffsets; + FT_ULong* glyphoffsets; /* glyphoffsets[gv_glyphcnt + 1] */ FT_ULong gvar_size; From 5eb0fd5e97c2af7aaeeb129571b2b820c5079604 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sun, 12 Mar 2017 20:46:56 +0100 Subject: [PATCH 003/470] [truetype] Store and use design coordinates also. * include/freetype/internal/services/svmm.h (FT_Get_Var_Blend_Func): Add `normalizedcoords' argument. * src/truetype/ttgxvar.h (GX_BlendRec): Add `coords' field to store the design coordinates of the current instance. Updated. * src/truetype/ttgxvar.c (TT_Set_MM_Blend): Move functionality to... (tt_set_mm_blend): ... New function. Convert data in `normalizedcoords' array to `coords' array on demand. (TT_Set_Var_Design): Store argument data in `coords' array. (TT_Get_Var_Design): Get data from `coords' array. (tt_get_var_blend): Updated. (tt_done_blend): Updated. * src/cff/cffload.c, src/cff/cffload.h (cff_get_var_blend): Updated. * src/cff/cf2ft.c (cf2_getNormalizedVector): Updated. * src/cff/cffobjs.c (cff_face_init): Updated. --- ChangeLog | 26 ++++ include/freetype/internal/services/svmm.h | 1 + src/cff/cf2ft.c | 2 +- src/cff/cffload.c | 7 +- src/cff/cffload.h | 1 + src/cff/cffobjs.c | 2 +- src/truetype/ttgxvar.c | 166 ++++++++++++++++------ src/truetype/ttgxvar.h | 7 + 8 files changed, 164 insertions(+), 48 deletions(-) diff --git a/ChangeLog b/ChangeLog index 43ef3fbd9..6fb4fc932 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,29 @@ +2017-03-12 Werner Lemberg + + [truetype] Store and use design coordinates also. + + * include/freetype/internal/services/svmm.h (FT_Get_Var_Blend_Func): + Add `normalizedcoords' argument. + + * src/truetype/ttgxvar.h (GX_BlendRec): Add `coords' field to store + the design coordinates of the current instance. + Updated. + + * src/truetype/ttgxvar.c (TT_Set_MM_Blend): Move functionality to... + (tt_set_mm_blend): ... New function. + Convert data in `normalizedcoords' array to `coords' array on + demand. + (TT_Set_Var_Design): Store argument data in `coords' array. + (TT_Get_Var_Design): Get data from `coords' array. + (tt_get_var_blend): Updated. + (tt_done_blend): Updated. + + * src/cff/cffload.c, src/cff/cffload.h (cff_get_var_blend): Updated. + + * src/cff/cf2ft.c (cf2_getNormalizedVector): Updated. + + * src/cff/cffobjs.c (cff_face_init): Updated. + 2017-03-12 Werner Lemberg src/truetype/ttgxvar.[ch]: s/avar_checked/avar_loaded/. diff --git a/include/freetype/internal/services/svmm.h b/include/freetype/internal/services/svmm.h index 97af1ac98..1d51cd909 100644 --- a/include/freetype/internal/services/svmm.h +++ b/include/freetype/internal/services/svmm.h @@ -72,6 +72,7 @@ FT_BEGIN_HEADER (*FT_Get_Var_Blend_Func)( FT_Face face, FT_UInt *num_coords, FT_Fixed* *coords, + FT_Fixed* *normalizedcoords, FT_MM_Var* *mm_var ); typedef void diff --git a/src/cff/cf2ft.c b/src/cff/cf2ft.c index 5cca92a11..eb8472f11 100644 --- a/src/cff/cf2ft.c +++ b/src/cff/cf2ft.c @@ -457,7 +457,7 @@ FT_ASSERT( decoder && decoder->builder.face ); FT_ASSERT( vec && len ); - return cff_get_var_blend( decoder->builder.face, len, vec, NULL ); + return cff_get_var_blend( decoder->builder.face, len, NULL, vec, NULL ); } #endif diff --git a/src/cff/cffload.c b/src/cff/cffload.c index 47626a714..d356ab361 100644 --- a/src/cff/cffload.c +++ b/src/cff/cffload.c @@ -1572,12 +1572,17 @@ cff_get_var_blend( CFF_Face face, FT_UInt *num_coords, FT_Fixed* *coords, + FT_Fixed* *normalizedcoords, FT_MM_Var* *mm_var ) { FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm; - return mm->get_var_blend( FT_FACE( face ), num_coords, coords, mm_var ); + return mm->get_var_blend( FT_FACE( face ), + num_coords, + coords, + normalizedcoords, + mm_var ); } diff --git a/src/cff/cffload.h b/src/cff/cffload.h index 1709a661e..c745e8127 100644 --- a/src/cff/cffload.h +++ b/src/cff/cffload.h @@ -112,6 +112,7 @@ FT_BEGIN_HEADER cff_get_var_blend( CFF_Face face, FT_UInt *num_coords, FT_Fixed* *coords, + FT_Fixed* *normalizedcoords, FT_MM_Var* *mm_var ); FT_LOCAL( void ) diff --git a/src/cff/cffobjs.c b/src/cff/cffobjs.c index bcda2a913..832276143 100644 --- a/src/cff/cffobjs.c +++ b/src/cff/cffobjs.c @@ -703,7 +703,7 @@ if ( error ) goto Exit; - mm->get_var_blend( cffface, NULL, NULL, &mm_var ); + mm->get_var_blend( cffface, NULL, NULL, NULL, &mm_var ); if ( mm_var->namedstyle ) { diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c index 641d07c00..5abcd02ee 100644 --- a/src/truetype/ttgxvar.c +++ b/src/truetype/ttgxvar.c @@ -2259,35 +2259,11 @@ } - /*************************************************************************/ - /* */ - /* */ - /* TT_Set_MM_Blend */ - /* */ - /* */ - /* Set the blend (normalized) coordinates for this instance of the */ - /* font. Check that the `gvar' table is reasonable and does some */ - /* initial preparation. */ - /* */ - /* */ - /* face :: The font. */ - /* Initialize the blend structure with `gvar' data. */ - /* */ - /* */ - /* num_coords :: The number of available coordinates. If it is */ - /* larger than the number of axes, ignore the excess */ - /* values. If it is smaller than the number of axes, */ - /* use the default value (0) for the remaining axes. */ - /* */ - /* coords :: An array of `num_coords', each between [-1,1]. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ - FT_LOCAL_DEF( FT_Error ) - TT_Set_MM_Blend( TT_Face face, + static FT_Error + tt_set_mm_blend( TT_Face face, FT_UInt num_coords, - FT_Fixed* coords ) + FT_Fixed* coords, + FT_Bool set_design_coords ) { FT_Error error = FT_Err_Ok; GX_Blend blend; @@ -2318,7 +2294,8 @@ if ( num_coords > mmvar->num_axis ) { - FT_TRACE2(( "TT_Set_MM_Blend: only using first %d of %d coordinates\n", + FT_TRACE2(( "TT_Set_MM_Blend:" + " only using first %d of %d coordinates\n", mmvar->num_axis, num_coords )); num_coords = mmvar->num_axis; } @@ -2347,6 +2324,12 @@ if ( FT_SET_ERROR( ft_var_load_gvar( face ) ) ) goto Exit; + if ( !blend->coords ) + { + if ( FT_NEW_ARRAY( blend->coords, mmvar->num_axis ) ) + goto Exit; + } + if ( !blend->normalizedcoords ) { if ( FT_NEW_ARRAY( blend->normalizedcoords, mmvar->num_axis ) ) @@ -2391,6 +2374,12 @@ coords, num_coords * sizeof ( FT_Fixed ) ); + if ( set_design_coords ) + ft_var_to_design( face, + num_coords, + blend->normalizedcoords, + blend->coords ); + face->doblend = TRUE; if ( face->cvt ) @@ -2449,6 +2438,40 @@ } + /*************************************************************************/ + /* */ + /* */ + /* TT_Set_MM_Blend */ + /* */ + /* */ + /* Set the blend (normalized) coordinates for this instance of the */ + /* font. Check that the `gvar' table is reasonable and does some */ + /* initial preparation. */ + /* */ + /* */ + /* face :: The font. */ + /* Initialize the blend structure with `gvar' data. */ + /* */ + /* */ + /* num_coords :: The number of available coordinates. If it is */ + /* larger than the number of axes, ignore the excess */ + /* values. If it is smaller than the number of axes, */ + /* use the default value (0) for the remaining axes. */ + /* */ + /* coords :: An array of `num_coords', each between [-1,1]. */ + /* */ + /* */ + /* FreeType error code. 0 means success. */ + /* */ + FT_LOCAL_DEF( FT_Error ) + TT_Set_MM_Blend( TT_Face face, + FT_UInt num_coords, + FT_Fixed* coords ) + { + return tt_set_mm_blend( face, num_coords, coords, 1 ); + } + + /*************************************************************************/ /* */ /* */ @@ -2493,7 +2516,8 @@ nc = num_coords; if ( num_coords > blend->num_axis ) { - FT_TRACE2(( "TT_Get_MM_Blend: only using first %d of %d coordinates\n", + FT_TRACE2(( "TT_Get_MM_Blend:" + " only using first %d of %d coordinates\n", blend->num_axis, num_coords )); nc = blend->num_axis; } @@ -2546,11 +2570,16 @@ FT_UInt num_coords, FT_Fixed* coords ) { - FT_Error error = FT_Err_Ok; - FT_Memory memory = face->root.memory; + FT_Error error = FT_Err_Ok; + GX_Blend blend; + FT_MM_Var* mmvar; + FT_UInt i; + FT_Memory memory = face->root.memory; + + FT_Var_Axis* a; + FT_Fixed* c; FT_Fixed* normalized = NULL; - FT_UInt num_axes; if ( !face->blend ) @@ -2559,9 +2588,33 @@ goto Exit; } - num_axes = face->blend->mmvar->num_axis; + blend = face->blend; + mmvar = blend->mmvar; + + if ( num_coords > mmvar->num_axis ) + { + FT_TRACE2(( "TT_Set_Var_Design:" + " only using first %d of %d coordinates\n", + mmvar->num_axis, num_coords )); + num_coords = mmvar->num_axis; + } + + if ( !blend->coords ) + { + if ( FT_NEW_ARRAY( blend->coords, mmvar->num_axis ) ) + goto Exit; + } + + FT_MEM_COPY( blend->coords, + coords, + num_coords * sizeof ( FT_Fixed ) ); + + a = mmvar->axis + num_coords; + c = coords + num_coords; + for ( i = num_coords; i < mmvar->num_axis; i++, a++, c++ ) + *c = a->def; - if ( FT_NEW_ARRAY( normalized, num_axes ) ) + if ( FT_NEW_ARRAY( normalized, mmvar->num_axis ) ) goto Exit; if ( !face->blend->avar_loaded ) @@ -2569,7 +2622,7 @@ ft_var_to_normalized( face, num_coords, coords, normalized ); - error = TT_Set_MM_Blend( face, num_axes, normalized ); + error = tt_set_mm_blend( face, mmvar->num_axis, normalized, 0 ); Exit: FT_FREE( normalized ); @@ -2605,6 +2658,8 @@ FT_Fixed* coords ) { FT_Error error = FT_Err_Ok; + GX_Blend blend; + FT_UInt i, nc; if ( !face->blend ) @@ -2613,13 +2668,30 @@ return error; } - if ( !face->blend->avar_loaded ) - ft_var_load_avar( face ); + blend = face->blend; - ft_var_to_design( face, - num_coords, - face->blend->normalizedcoords, - coords ); + nc = num_coords; + if ( num_coords > blend->num_axis ) + { + FT_TRACE2(( "TT_Get_Var_Design:" + " only using first %d of %d coordinates\n", + blend->num_axis, num_coords )); + nc = blend->num_axis; + } + + if ( face->doblend ) + { + for ( i = 0; i < nc; i++ ) + coords[i] = blend->coords[i]; + } + else + { + for ( i = 0; i < nc; i++ ) + coords[i] = 0; + } + + for ( ; i < num_coords; i++ ) + coords[i] = 0; return FT_Err_Ok; } @@ -3506,16 +3578,19 @@ tt_get_var_blend( TT_Face face, FT_UInt *num_coords, FT_Fixed* *coords, + FT_Fixed* *normalizedcoords, FT_MM_Var* *mm_var ) { if ( face->blend ) { if ( num_coords ) - *num_coords = face->blend->num_axis; + *num_coords = face->blend->num_axis; if ( coords ) - *coords = face->blend->normalizedcoords; + *coords = face->blend->coords; + if ( normalizedcoords ) + *normalizedcoords = face->blend->normalizedcoords; if ( mm_var ) - *mm_var = face->blend->mmvar; + *mm_var = face->blend->mmvar; } else { @@ -3583,6 +3658,7 @@ /* blend->num_axis might not be set up yet */ num_axes = blend->mmvar->num_axis; + FT_FREE( blend->coords ); FT_FREE( blend->normalizedcoords ); FT_FREE( blend->normalized_stylecoords ); FT_FREE( blend->mmvar ); diff --git a/src/truetype/ttgxvar.h b/src/truetype/ttgxvar.h index 804678cb9..7e81719a3 100644 --- a/src/truetype/ttgxvar.h +++ b/src/truetype/ttgxvar.h @@ -220,6 +220,11 @@ FT_BEGIN_HEADER /* num_axis :: */ /* The number of axes along which interpolation may happen. */ /* */ + /* coords :: */ + /* An array of design coordinates (in user space) indicating the */ + /* contribution along each axis to the final interpolated font. */ + /* `normalizedcoords' holds the same values. */ + /* */ /* normalizedcoords :: */ /* An array of normalized values (between [-1,1]) indicating the */ /* contribution along each axis to the final interpolated font. */ @@ -294,6 +299,7 @@ FT_BEGIN_HEADER typedef struct GX_BlendRec_ { FT_UInt num_axis; + FT_Fixed* coords; FT_Fixed* normalizedcoords; FT_MM_Var* mmvar; @@ -423,6 +429,7 @@ FT_BEGIN_HEADER tt_get_var_blend( TT_Face face, FT_UInt *num_coords, FT_Fixed* *coords, + FT_Fixed* *normalizedcoords, FT_MM_Var* *mm_var ); FT_LOCAL( void ) From 447a0b62634802d8acdb56008cff5ff4e50be244 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Mon, 13 Mar 2017 07:42:34 +0100 Subject: [PATCH 004/470] [truetype] Ignore invalid MVAR tags. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=838 * src/truetype/ttgxvar.c (ft_var_load_mvar): Ignore value and emit warning for invalid tags. (tt_apply_mvar): Ignore invalid tags. --- ChangeLog | 12 ++++++++++++ src/truetype/ttgxvar.c | 36 ++++++++++++++++++++++++------------ 2 files changed, 36 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6fb4fc932..091724f39 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2017-03-13 Werner Lemberg + + [truetype] Ignore invalid MVAR tags. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=838 + + * src/truetype/ttgxvar.c (ft_var_load_mvar): Ignore value and emit + warning for invalid tags. + (tt_apply_mvar): Ignore invalid tags. + 2017-03-12 Werner Lemberg [truetype] Store and use design coordinates also. diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c index 5abcd02ee..32779058e 100644 --- a/src/truetype/ttgxvar.c +++ b/src/truetype/ttgxvar.c @@ -1263,7 +1263,16 @@ FT_Short* p = ft_var_get_value_pointer( face, value->tag ); - value->unmodified = *p; + if ( p ) + value->unmodified = *p; +#ifdef FT_DEBUG_LEVEL_TRACE + else + FT_TRACE1(( "ft_var_load_mvar: Ignoring unknown tag `%c%c%c%c'\n", + (FT_Char)( value->tag >> 24 ), + (FT_Char)( value->tag >> 16 ), + (FT_Char)( value->tag >> 8 ), + (FT_Char)( value->tag ) )); +#endif } face->variation_support |= TT_FACE_FLAG_VAR_MVAR; @@ -1320,17 +1329,20 @@ value->outerIndex, value->innerIndex ); - FT_TRACE5(( "value %c%c%c%c (%d units) adjusted by %d units (MVAR)\n", - (FT_Char)( value->tag >> 24 ), - (FT_Char)( value->tag >> 16 ), - (FT_Char)( value->tag >> 8 ), - (FT_Char)( value->tag ), - value->unmodified, - delta )); - - /* since we handle both signed and unsigned values as FT_Short, */ - /* ensure proper overflow arithmetic */ - *p = (FT_Short)( value->unmodified + (FT_Short)delta ); + if ( p ) + { + FT_TRACE5(( "value %c%c%c%c (%d units) adjusted by %d units (MVAR)\n", + (FT_Char)( value->tag >> 24 ), + (FT_Char)( value->tag >> 16 ), + (FT_Char)( value->tag >> 8 ), + (FT_Char)( value->tag ), + value->unmodified, + delta )); + + /* since we handle both signed and unsigned values as FT_Short, */ + /* ensure proper overflow arithmetic */ + *p = (FT_Short)( value->unmodified + (FT_Short)delta ); + } } /* adjust all derived values */ From 4a32dce92a0ff00d824b3ec512b8f6dff28dcaa2 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Tue, 14 Mar 2017 19:32:12 +0100 Subject: [PATCH 005/470] [sfnt] Implement PS names for font instances [1/3]. Add 128bit MurmurHash 3 function. Everything is guarded with TT_CONFIG_OPTION_GX_VAR_SUPPORT. * src/sfnt/sfdriver.c (ROTL32): New macro. (fmix32, murmur_hash_3_128): New functions. --- ChangeLog | 11 +++ src/sfnt/sfdriver.c | 189 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 200 insertions(+) diff --git a/ChangeLog b/ChangeLog index 091724f39..181ade9ae 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2017-03-14 Werner Lemberg + + [sfnt] Implement PS names for font instances [1/3]. + + Add 128bit MurmurHash 3 function. + + Everything is guarded with TT_CONFIG_OPTION_GX_VAR_SUPPORT. + + * src/sfnt/sfdriver.c (ROTL32): New macro. + (fmix32, murmur_hash_3_128): New functions. + 2017-03-13 Werner Lemberg [truetype] Ignore invalid MVAR tags. diff --git a/src/sfnt/sfdriver.c b/src/sfnt/sfdriver.c index f13266975..455c49061 100644 --- a/src/sfnt/sfdriver.c +++ b/src/sfnt/sfdriver.c @@ -250,6 +250,195 @@ } +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT + + /* the implementation of MurmurHash3 is taken and adapted from */ + /* https://github.com/aappleby/smhasher/blob/master/src/MurmurHash3.cpp */ + +#define ROTL32( x, r ) ( x << r ) | ( x >> ( 32 - r ) ) + + + FT_UInt32 + fmix32( FT_UInt32 h ) + { + h ^= h >> 16; + h *= 0x85ebca6b; + h ^= h >> 13; + h *= 0xc2b2ae35; + h ^= h >> 16; + + return h; + } + + + void + murmur_hash_3_128( const void* key, + const int len, + FT_UInt32 seed, + void* out ) + { + const FT_Byte* data = (const FT_Byte*)key; + const int nblocks = len / 16; + + FT_UInt32 h1 = seed; + FT_UInt32 h2 = seed; + FT_UInt32 h3 = seed; + FT_UInt32 h4 = seed; + + const FT_UInt32 c1 = 0x239b961b; + const FT_UInt32 c2 = 0xab0e9789; + const FT_UInt32 c3 = 0x38b34ae5; + const FT_UInt32 c4 = 0xa1e38b93; + + const FT_UInt32* blocks = (const FT_UInt32*)( data + nblocks * 16 ); + + int i; + + + for( i = -nblocks; i; i++ ) + { + FT_UInt32 k1 = blocks[i * 4 + 0]; + FT_UInt32 k2 = blocks[i * 4 + 1]; + FT_UInt32 k3 = blocks[i * 4 + 2]; + FT_UInt32 k4 = blocks[i * 4 + 3]; + + + k1 *= c1; + k1 = ROTL32( k1, 15 ); + k1 *= c2; + h1 ^= k1; + + h1 = ROTL32( h1, 19 ); + h1 += h2; + h1 = h1 * 5 + 0x561ccd1b; + + k2 *= c2; + k2 = ROTL32( k2, 16 ); + k2 *= c3; + h2 ^= k2; + + h2 = ROTL32( h2, 17 ); + h2 += h3; + h2 = h2 * 5 + 0x0bcaa747; + + k3 *= c3; + k3 = ROTL32( k3, 17 ); + k3 *= c4; + h3 ^= k3; + + h3 = ROTL32( h3, 15 ); + h3 += h4; + h3 = h3 * 5 + 0x96cd1c35; + + k4 *= c4; + k4 = ROTL32( k4, 18 ); + k4 *= c1; + h4 ^= k4; + + h4 = ROTL32( h4, 13 ); + h4 += h1; + h4 = h4 * 5 + 0x32ac3b17; + } + + { + const FT_Byte* tail = (const FT_Byte*)( data + nblocks * 16 ); + + FT_UInt32 k1 = 0; + FT_UInt32 k2 = 0; + FT_UInt32 k3 = 0; + FT_UInt32 k4 = 0; + + + switch ( len & 15 ) + { + case 15: + k4 ^= tail[14] << 16; + case 14: + k4 ^= tail[13] << 8; + case 13: + k4 ^= tail[12] << 0; + k4 *= c4; + k4 = ROTL32( k4, 18 ); + k4 *= c1; + h4 ^= k4; + + case 12: + k3 ^= tail[11] << 24; + case 11: + k3 ^= tail[10] << 16; + case 10: + k3 ^= tail[9] << 8; + case 9: + k3 ^= tail[8] << 0; + k3 *= c3; + k3 = ROTL32( k3, 17 ); + k3 *= c4; + h3 ^= k3; + + case 8: + k2 ^= tail[7] << 24; + case 7: + k2 ^= tail[6] << 16; + case 6: + k2 ^= tail[5] << 8; + case 5: + k2 ^= tail[4] << 0; + k2 *= c2; + k2 = ROTL32( k2, 16 ); + k2 *= c3; + h2 ^= k2; + + case 4: + k1 ^= tail[3] << 24; + case 3: + k1 ^= tail[2] << 16; + case 2: + k1 ^= tail[1] << 8; + case 1: + k1 ^= tail[0] << 0; + k1 *= c1; + k1 = ROTL32( k1, 15 ); + k1 *= c2; + h1 ^= k1; + } + } + + h1 ^= len; + h2 ^= len; + h3 ^= len; + h4 ^= len; + + h1 += h2; + h1 += h3; + h1 += h4; + + h2 += h1; + h3 += h1; + h4 += h1; + + h1 = fmix32( h1 ); + h2 = fmix32( h2 ); + h3 = fmix32( h3 ); + h4 = fmix32( h4 ); + + h1 += h2; + h1 += h3; + h1 += h4; + + h2 += h1; + h3 += h1; + h4 += h1; + + ((FT_UInt32*)out)[0] = h1; + ((FT_UInt32*)out)[1] = h2; + ((FT_UInt32*)out)[2] = h3; + ((FT_UInt32*)out)[3] = h4; + } + + +#endif /* TT_CONFIG_OPTION_GX_VAR_SUPPORT */ + + typedef int (*char_type_func)( int c ); From 4fd9cc73e672de3223a44e9034f788de6641efd0 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Tue, 14 Mar 2017 19:40:50 +0100 Subject: [PATCH 006/470] [sfnt] Implement PS names for font instances [2/3]. * src/sfnt/sfdriver.c (fix2float) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: New function to find the shortest representation of a 16.16 fractional number. --- ChangeLog | 8 +++ src/sfnt/sfdriver.c | 120 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 128 insertions(+) diff --git a/ChangeLog b/ChangeLog index 181ade9ae..cdbec0db1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2017-03-14 Werner Lemberg + + [sfnt] Implement PS names for font instances [2/3]. + + * src/sfnt/sfdriver.c (fix2float) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: + New function to find the shortest representation of a 16.16 + fractional number. + 2017-03-14 Werner Lemberg [sfnt] Implement PS names for font instances [1/3]. diff --git a/src/sfnt/sfdriver.c b/src/sfnt/sfdriver.c index 455c49061..f0ae98168 100644 --- a/src/sfnt/sfdriver.c +++ b/src/sfnt/sfdriver.c @@ -601,6 +601,126 @@ } +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT + + /* + * Find the shortest decimal representation of a 16.16 fixed point + * number. The function fills `buf' with the result, returning a pointer + * to the position after the representation's last byte. + */ + + static char* + fixed2float( FT_Int fixed, + char* buf ) + { + char* p; + char* q; + char tmp[5]; + + FT_Int int_part; + FT_Int frac_part; + + FT_Int i; + + + p = buf; + + if ( fixed == 0 ) + { + *p++ = '0'; + return p; + } + + if ( fixed < 0 ) + { + *p++ = '-'; + fixed = -fixed; + } + + int_part = ( fixed >> 16 ) & 0xFFFF; + frac_part = fixed & 0xFFFF; + + /* get digits of integer part (in reverse order) */ + q = tmp; + while ( int_part > 0 ) + { + *q++ = '0' + int_part % 10; + int_part /= 10; + } + + /* copy digits in correct order to buffer */ + while ( q > tmp ) + *p++ = *--q; + + if ( !frac_part ) + return p; + + /* save position of point */ + q = p; + *p++ = '.'; + + /* apply rounding */ + frac_part = frac_part * 10 + 5; + + /* get digits of fractional part */ + for ( i = 0; i < 5; i++ ) + { + *p++ = '0' + frac_part / 0x10000L; + + frac_part %= 0x10000L; + if ( !frac_part ) + break; + + frac_part *= 10; + } + + /* + If the remainder stored in `frac_part' (after the last FOR loop) is + smaller than 34480*10, the resulting decimal value minus 0.00001 is + an equivalent representation of `fixed'. + + The above FOR loop always finds the larger of the two values; I + verified this by iterating over all possible fixed point numbers. + + If the remainder is 17232*10, both values are equally good, and we + take the next even number (following IEEE 754's `round to nearest, + ties to even' rounding rule). + + If the remainder is smaller than 17232*10, the lower of the two + numbers is nearer to the exact result (values 17232 and 34480 were + also found by testing all possible fixed point values). + + We use this to find a shorter decimal representation. If not ending + with digit zero, we take the representation with less error. + */ + p--; + if ( p - q == 5 ) /* five digits? */ + { + /* take the representation that has zero as the last digit */ + if ( frac_part < 34480 * 10 && + *p == '1' ) + *p = '0'; + + /* otherwise use the one with less error */ + else if ( frac_part == 17232 * 10 && + *p & 1 ) + *p -= 1; + + else if ( frac_part < 17232 * 10 && + *p != '0' ) + *p -= 1; + } + + /* remove trailing zeros */ + while ( *p == '0' ) + *p-- = '\0'; + + return p + 1; + } + +#endif /* TT_CONFIG_OPTION_GX_VAR_SUPPORT */ + + static const char* sfnt_get_ps_name( TT_Face face ) { From 34010f7c473330907b39bd7d55e985f407d7f87c Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Tue, 14 Mar 2017 21:50:22 +0100 Subject: [PATCH 007/470] [sfnt] Implement PS names for font instances [3/3]. Everything is guarded with TT_CONFIG_OPTION_GX_VAR_SUPPORT. * include/freetype/internal/tttypes.h (TT_FaceRec): New fields `var_postscript_prefix' and `var_postscript_prefix_len'. * src/sfnt/sfdriver.c: Include FT_TRUETYPE_IDS_H. (sfnt_is_alphanumeric): New wrapperfunction for `ft_isalnum'. (get_win_string, get_apple_string): Remove `const' from return value. (MAX_VALUE_DESCRIPTOR_LEN, MAX_PS_NAME_LEN): New macros. (hexdigits): New array. (sfnt_get_var_ps_name): New function, implementing Adobe TechNote 5902 to construct a PS name for a variation font instance. (sfnt_get_ps_name): Call `sfnt_get_var_ps_name' for font instances. * src/sfnt/sfobjs.c (sfnt_done_face): Updated. * src/truetype/ttgxvar.c (tt_set_mm_blend): Reset `face->postscript_name' to trigger recalculation for new instance parameters. --- ChangeLog | 29 ++- include/freetype/freetype.h | 9 +- include/freetype/internal/tttypes.h | 13 ++ src/sfnt/sfdriver.c | 345 ++++++++++++++++++++++++++-- src/sfnt/sfobjs.c | 1 + src/truetype/ttgxvar.c | 4 + 6 files changed, 374 insertions(+), 27 deletions(-) diff --git a/ChangeLog b/ChangeLog index cdbec0db1..b68e263d1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,28 @@ +2017-03-14 Werner Lemberg + + [sfnt] Implement PS names for font instances [3/3]. + + Everything is guarded with TT_CONFIG_OPTION_GX_VAR_SUPPORT. + + * include/freetype/internal/tttypes.h (TT_FaceRec): New fields + `var_postscript_prefix' and `var_postscript_prefix_len'. + + * src/sfnt/sfdriver.c: Include FT_TRUETYPE_IDS_H. + (sfnt_is_alphanumeric): New wrapperfunction for `ft_isalnum'. + (get_win_string, get_apple_string): Remove `const' from return + value. + (MAX_VALUE_DESCRIPTOR_LEN, MAX_PS_NAME_LEN): New macros. + (hexdigits): New array. + (sfnt_get_var_ps_name): New function, implementing Adobe TechNote + 5902 to construct a PS name for a variation font instance. + (sfnt_get_ps_name): Call `sfnt_get_var_ps_name' for font instances. + + * src/sfnt/sfobjs.c (sfnt_done_face): Updated. + + * src/truetype/ttgxvar.c (tt_set_mm_blend): Reset + `face->postscript_name' to trigger recalculation for new instance + parameters. + 2017-03-14 Werner Lemberg [sfnt] Implement PS names for font instances [2/3]. @@ -80,8 +105,8 @@ https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=738 * src/sfnt/sfobjs.c (sfnt_init_face): While setting number of - instances to zero for `CFF' fonts table, ensure that there is no `glyf' - present also (which gets priority). + instances to zero for `CFF' fonts table, ensure that there is no + `glyf' table present also (which gets priority). 2017-03-06 Werner Lemberg diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h index bf119e3e8..7b65e2174 100644 --- a/include/freetype/freetype.h +++ b/include/freetype/freetype.h @@ -891,7 +891,7 @@ FT_BEGIN_HEADER /* variation fonts only, holding the named */ /* instance index for the current face index */ /* (starting with value~1; value~0 indicates */ - /* font access without variation data). For */ + /* font access without a named instance). For */ /* non-variation fonts, bits 16-30 are */ /* ignored. If we have the third named */ /* instance of face~4, say, `face_index' is */ @@ -3403,6 +3403,13 @@ FT_BEGIN_HEADER /* The returned pointer is owned by the face and is destroyed with */ /* it. */ /* */ + /* For variation fonts, this string changes if you select a different */ + /* instance, and you have to call `FT_Get_PostScript_Name' again to */ + /* retrieve it. FreeType follows Adobe TechNote #5902, `Generating */ + /* PostScript Names for Fonts Using OpenType Font Variations'. */ + /* */ + /* http://wwwimages.adobe.com/content/dam/Adobe/en/devnet/font/pdfs/5902.AdobePSNameGeneration.html */ + /* */ FT_EXPORT( const char* ) FT_Get_Postscript_Name( FT_Face face ); diff --git a/include/freetype/internal/tttypes.h b/include/freetype/internal/tttypes.h index abe4dcd64..a1f6774ab 100644 --- a/include/freetype/internal/tttypes.h +++ b/include/freetype/internal/tttypes.h @@ -1309,6 +1309,15 @@ FT_BEGIN_HEADER /* For example, TT_FACE_FLAG_VAR_FVAR is only */ /* set if we have at least one design axis. */ /* */ + /* var_postscript_prefix :: */ + /* The PostScript name prefix needed for */ + /* constructing a variation font instance's */ + /* PS name . */ + /* */ + /* var_postscript_prefix_len :: */ + /* The length of the `var_postscript_prefix' */ + /* string. */ + /* */ /* horz_metrics_size :: The size of the `hmtx' table. */ /* */ /* vert_metrics_size :: The size of the `vmtx' table. */ @@ -1502,6 +1511,10 @@ FT_BEGIN_HEADER FT_Bool is_default_instance; /* since 2.7.1 */ FT_UInt32 variation_support; /* since 2.7.1 */ + + const char* var_postscript_prefix; /* since 2.7.2 */ + FT_Int var_postscript_prefix_len; /* since 2.7.2 */ + #endif /* since version 2.2 */ diff --git a/src/sfnt/sfdriver.c b/src/sfnt/sfdriver.c index f0ae98168..0f95c76b2 100644 --- a/src/sfnt/sfdriver.c +++ b/src/sfnt/sfdriver.c @@ -20,6 +20,7 @@ #include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_SFNT_H #include FT_INTERNAL_OBJECTS_H +#include FT_TRUETYPE_IDS_H #include "sfdriver.h" #include "ttload.h" @@ -252,6 +253,18 @@ #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT + /* Only ASCII letters and digits are taken for a variation font */ + /* instance's PostScript name. */ + /* */ + /* `ft_isalnum' is a macro, but we need a function here, thus */ + /* this definition. */ + static int + sfnt_is_alphanumeric( int c ) + { + return ft_isalnum( c ); + } + + /* the implementation of MurmurHash3 is taken and adapted from */ /* https://github.com/aappleby/smhasher/blob/master/src/MurmurHash3.cpp */ @@ -451,7 +464,7 @@ (n)->encodingID == 0 && \ (n)->languageID == 0 ) - static const char* + static char* get_win_string( FT_Memory memory, FT_Stream stream, TT_Name entry, @@ -460,10 +473,10 @@ { FT_Error error = FT_Err_Ok; - const char* result; - FT_String* r; - FT_Char* p; - FT_UInt len; + char* result; + FT_String* r; + FT_Char* p; + FT_UInt len; FT_UNUSED( error ); @@ -512,7 +525,7 @@ } - static const char* + static char* get_apple_string( FT_Memory memory, FT_Stream stream, TT_Name entry, @@ -521,10 +534,10 @@ { FT_Error error = FT_Err_Ok; - const char* result; - FT_String* r; - FT_Char* p; - FT_UInt len; + char* result; + FT_String* r; + FT_Char* p; + FT_UInt len; FT_UNUSED( error ); @@ -603,6 +616,27 @@ #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT + /* + The maximum length of an axis value descriptor. + + We need 65536 different values for the decimal fraction; this fits + nicely into five decimal places. Consequently, it consists of + + . the minus sign if the number is negative, + . up to five characters for the digits before the decimal point, + . the decimal point if there is a fractional part, and + . up to five characters for the digits after the decimal point. + + We also need one byte for the leading `_' character and up to four + bytes for the axis tag. + */ +#define MAX_VALUE_DESCRIPTOR_LEN ( 1 + 5 + 1 + 5 + 1 + 4 ) + + + /* the maximum length of PostScript font names */ +#define MAX_PS_NAME_LEN 127 + + /* * Find the shortest decimal representation of a 16.16 fixed point * number. The function fills `buf' with the result, returning a pointer @@ -718,40 +752,303 @@ return p + 1; } -#endif /* TT_CONFIG_OPTION_GX_VAR_SUPPORT */ + + static const char hexdigits[16] = + { + '0', '1', '2', '3', '4', '5', '6', '7', + '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' + }; static const char* - sfnt_get_ps_name( TT_Face face ) + sfnt_get_var_ps_name( TT_Face face ) { - FT_Int found, win, apple; - const char* result = NULL; + FT_Error error; + FT_Memory memory = face->root.memory; + FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm; - if ( face->postscript_name ) - return face->postscript_name; + FT_UInt num_coords; + FT_Fixed* coords; + FT_MM_Var* mm_var; - /* scan the name table to see whether we have a Postscript name here, */ - /* either in Macintosh or Windows platform encodings */ - found = sfnt_get_name_id( face, 6, &win, &apple ); + FT_Int found, win, apple; + FT_UInt i, j; + + char* result = NULL; + char* p; - if ( found ) + + if ( !face->var_postscript_prefix ) { + FT_UInt len; + + + /* check whether we have a Variations PostScript Name Prefix */ + found = sfnt_get_name_id( face, + TT_NAME_ID_VARIATIONS_PREFIX, + &win, + &apple ); + if ( !found ) + { + /* otherwise use the typographic family name */ + found = sfnt_get_name_id( face, + TT_NAME_ID_TYPOGRAPHIC_FAMILY, + &win, + &apple ); + } + + if ( !found ) + { + /* as a last resort we try the family name; note that this is */ + /* not in the Adobe TechNote, but GX fonts (which predate the */ + /* TechNote) benefit from this behaviour */ + found = sfnt_get_name_id( face, + TT_NAME_ID_FONT_FAMILY, + &win, + &apple ); + } + + if ( !found ) + { + FT_TRACE0(( "sfnt_get_var_ps_name:" + " Can't construct PS name prefix for font instances\n" )); + return NULL; + } + /* prefer Windows entries over Apple */ if ( win != -1 ) result = get_win_string( face->root.memory, face->name_table.stream, face->name_table.names + win, - sfnt_is_postscript, - 1 ); + sfnt_is_alphanumeric, + 0 ); else result = get_apple_string( face->root.memory, face->name_table.stream, face->name_table.names + apple, - sfnt_is_postscript, - 1 ); + sfnt_is_alphanumeric, + 0 ); + + len = ft_strlen( result ); + + /* sanitize if necessary; we reserve space for 36 bytes (a 128bit */ + /* checksum as a hex number, preceded by `-' and followed by three */ + /* ASCII dots, to be used if the constructed PS name would be too */ + /* long); this is also sufficient for a single instance */ + if ( len > MAX_PS_NAME_LEN - ( 1 + 32 + 3 ) ) + { + len = MAX_PS_NAME_LEN - ( 1 + 32 + 3 ); + result[len] = '\0'; + + FT_TRACE0(( "sfnt_get_var_ps_name:" + " Shortening variation PS name prefix\n" + " " + " to %d characters\n", len )); + } + + face->var_postscript_prefix = result; + face->var_postscript_prefix_len = len; } + mm->get_var_blend( FT_FACE( face ), + &num_coords, + &coords, + NULL, + &mm_var ); + + if ( FT_IS_NAMED_INSTANCE( FT_FACE( face ) ) ) + { + SFNT_Service sfnt = (SFNT_Service)face->sfnt; + + FT_Long instance = ( ( face->root.face_index & 0x7FFF0000L ) >> 16 ) - 1; + FT_UInt psid = mm_var->namedstyle[instance].psid; + + char* ps_name = NULL; + + + /* try first to load the name string with index `postScriptNameID' */ + if ( psid == 6 || + ( psid > 255 && psid < 32768 ) ) + (void)sfnt->get_name( face, (FT_UShort)psid, &ps_name ); + + if ( ps_name ) + { + result = ps_name; + goto check_length; + } + else + { + /* otherwise construct a name using `subfamilyNameID' */ + FT_UInt strid = mm_var->namedstyle[instance].strid; + + char* subfamily_name; + char* s; + + + (void)sfnt->get_name( face, (FT_UShort)strid, &subfamily_name ); + + if ( !subfamily_name ) + { + FT_TRACE1(( "sfnt_get_var_ps_name:" + " can't construct named instance PS name;\n" + " " + " trying to construct normal instance PS name\n" )); + goto construct_instance_name; + } + + /* after the prefix we have character `-' followed by the */ + /* subfamily name (using only characters a-z, A-Z, and 0-9) */ + if ( FT_ALLOC( result, face->var_postscript_prefix_len + + 1 + ft_strlen( subfamily_name ) + 1 ) ) + return NULL; + + ft_strcpy( result, face->var_postscript_prefix ); + + p = result + face->var_postscript_prefix_len; + *p++ = '-'; + + s = subfamily_name; + while ( *s ) + { + if ( ft_isalnum( *s ) ) + *p++ = *s; + s++; + } + *p++ = '\0'; + + FT_FREE( subfamily_name ); + } + } + else + { + FT_Var_Axis* axis; + + + construct_instance_name: + axis = mm_var->axis; + + if ( FT_ALLOC( result, + face->var_postscript_prefix_len + + num_coords * MAX_VALUE_DESCRIPTOR_LEN + 1 ) ) + return NULL; + + p = result; + + ft_strcpy( p, face->var_postscript_prefix ); + p += face->var_postscript_prefix_len; + + for ( i = 0; i < num_coords; i++, coords++, axis++ ) + { + FT_ULong t; + + + /* omit axis value descriptor if it is identical */ + /* to the default axis value */ + if ( *coords == axis->def ) + continue; + + *p++ = '_'; + p = fixed2float( *coords, p ); + + t = axis->tag >> 24 & 0xFF; + if ( t != ' ' && ft_isalnum( t ) ) + *p++ = t; + t = axis->tag >> 16 & 0xFF; + if ( t != ' ' && ft_isalnum( t ) ) + *p++ = t; + t = axis->tag >> 8 & 0xFF; + if ( t != ' ' && ft_isalnum( t ) ) + *p++ = t; + t = axis->tag & 0xFF; + if ( t != ' ' && ft_isalnum( t ) ) + *p++ = t; + } + } + + check_length: + if ( p - result > MAX_PS_NAME_LEN ) + { + /* the PS name is too long; replace the part after the prefix with */ + /* a checksum; we use MurmurHash 3 with a hash length of 128 bit */ + + FT_UInt32 seed = 123456789; + + FT_UInt32 hash[4]; + FT_UInt32* h; + + + murmur_hash_3_128( result, p - result, seed, hash ); + + p = result + face->var_postscript_prefix_len; + *p++ = '-'; + + /* we convert the hash value to hex digits from back to front */ + p += 32 + 3; + h = hash + 3; + + *p-- = '\0'; + *p-- = '.'; + *p-- = '.'; + *p-- = '.'; + + for ( i = 0; i < 4; i++, h-- ) + { + FT_UInt32 v = *h; + + + for ( j = 0; j < 8; j++ ) + { + *p-- = hexdigits[v & 0xF]; + v >>= 4; + } + } + } + + return result; + } + +#endif /* TT_CONFIG_OPTION_GX_VAR_SUPPORT */ + + + static const char* + sfnt_get_ps_name( TT_Face face ) + { + FT_Int found, win, apple; + const char* result = NULL; + + + if ( face->postscript_name ) + return face->postscript_name; + +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT + if ( face->blend ) + { + face->postscript_name = sfnt_get_var_ps_name( face ); + return face->postscript_name; + } +#endif + + /* scan the name table to see whether we have a Postscript name here, */ + /* either in Macintosh or Windows platform encodings */ + found = sfnt_get_name_id( face, TT_NAME_ID_PS_NAME, &win, &apple ); + if ( !found ) + return NULL; + + /* prefer Windows entries over Apple */ + if ( win != -1 ) + result = get_win_string( face->root.memory, + face->name_table.stream, + face->name_table.names + win, + sfnt_is_postscript, + 1 ); + else + result = get_apple_string( face->root.memory, + face->name_table.stream, + face->name_table.names + apple, + sfnt_is_postscript, + 1 ); + face->postscript_name = result; return result; diff --git a/src/sfnt/sfobjs.c b/src/sfnt/sfobjs.c index 54912c500..36400749a 100644 --- a/src/sfnt/sfobjs.c +++ b/src/sfnt/sfobjs.c @@ -1755,6 +1755,7 @@ face->root.num_fixed_sizes = 0; FT_FREE( face->postscript_name ); + FT_FREE( face->var_postscript_prefix ); face->sfnt = NULL; } diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c index 32779058e..7f0b3f34d 100644 --- a/src/truetype/ttgxvar.c +++ b/src/truetype/ttgxvar.c @@ -2445,6 +2445,10 @@ face->is_default_instance = is_default_instance; + /* enforce recomputation of the PostScript name; */ + FT_FREE( face->postscript_name ); + face->postscript_name = NULL; + Exit: return error; } From 9357ef80ff7a1112dec4e274ad68107d60bdcf52 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Wed, 15 Mar 2017 07:56:22 +0100 Subject: [PATCH 008/470] Typo: s/stroke/strike/. --- ChangeLog | 6 +++--- src/base/ftobjs.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index b68e263d1..a2d720d4a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2308,7 +2308,7 @@ 2016-09-29 Werner Lemberg - [truetype] Disallow bitmap strokes for non-default instances. + [truetype] Disallow bitmap strikes for non-default instances. Also speed up access of default instances if GX variations are active. @@ -2695,12 +2695,12 @@ 2016-09-03 Werner Lemberg - [base] Avoid negative bitmap stroke dimensions (#48985). + [base] Avoid negative bitmap strike dimensions (#48985). * src/base/ftobjs.c (FT_Open_Face): Check whether negation was actually successful. For example, this can fail for value -32768 if the type is `signed short'. If there are problems, - disable the stroke. + disable the strike. 2016-09-03 Werner Lemberg diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c index f86369e18..b1a093b34 100644 --- a/src/base/ftobjs.c +++ b/src/base/ftobjs.c @@ -2404,7 +2404,7 @@ if ( bsize->height < 0 || bsize->x_ppem < 0 || bsize->y_ppem < 0 ) { FT_TRACE0(( "FT_Open_Face:" - " Invalid bitmap dimensions for stroke %d," + " Invalid bitmap dimensions for strike %d," " now disabled\n", i )); bsize->width = 0; bsize->height = 0; From f87269c35c4e97010757e4183bff82752784491c Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Wed, 15 Mar 2017 08:03:16 +0100 Subject: [PATCH 009/470] * src/tools/ftfuzzer/ftfuzzer.cc: Improve readability; formatting. --- ChangeLog | 4 ++++ src/tools/ftfuzzer/ftfuzzer.cc | 25 ++++++++++++++++--------- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index a2d720d4a..1e46a4022 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2017-03-15 Werner Lemberg + + * src/tools/ftfuzzer/ftfuzzer.cc: Improve readability; formatting. + 2017-03-14 Werner Lemberg [sfnt] Implement PS names for font instances [3/3]. diff --git a/src/tools/ftfuzzer/ftfuzzer.cc b/src/tools/ftfuzzer/ftfuzzer.cc index 475b23266..591c8b6a3 100644 --- a/src/tools/ftfuzzer/ftfuzzer.cc +++ b/src/tools/ftfuzzer/ftfuzzer.cc @@ -315,18 +315,23 @@ } // loop over an arbitrary size for outlines (index 0) - // and up to ten arbitrarily selected bitmap stroke sizes (index 1-10) - int max_idx = face->num_fixed_sizes < 10 - ? face->num_fixed_sizes - : 10; + // and up to ten arbitrarily selected bitmap strike sizes + // from the range [0;num_fixed_sizes - 1] + int max_size_cnt = face->num_fixed_sizes < 10 + ? face->num_fixed_sizes + : 10; - Random pool( max_idx, face->num_fixed_sizes ); + Random sizes_pool( max_size_cnt, face->num_fixed_sizes ); - for ( int idx = 0; idx <= max_idx; idx++ ) + for ( int size_cnt = 0; + size_cnt <= max_size_cnt; + size_cnt++ ) { FT_Int32 flags = load_flags; - if ( !idx ) + int size_index = 0; + + if ( !size_cnt ) { // set up 20pt at 72dpi as an arbitrary size if ( FT_Set_Char_Size( face, 20 * 64, 20 * 64, 72, 72 ) ) @@ -335,11 +340,13 @@ } else { - // bitmap strokes are not active for glyph variations + // bitmap strikes are not active for font variations if ( instance_index ) continue; - if ( FT_Select_Size( face, pool.get() - 1 ) ) + size_index = sizes_pool.get() - 1; + + if ( FT_Select_Size( face, size_index ) ) continue; flags |= FT_LOAD_COLOR; } From 3f92048ab1cf44f280d4511fa42de1bea8449744 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Wed, 15 Mar 2017 09:18:22 +0100 Subject: [PATCH 010/470] [ftfuzzer] Limit number of tested faces and instances. This is inspired by the discussion in and analysis of https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=859 * src/tools/ftfuzzer/ftfuzzer.cc (LLVMFuzzerTestOneInput): Use only up to 20 face indices. Use only up to 20 instance indices. --- ChangeLog | 12 +++++++ src/tools/ftfuzzer/ftfuzzer.cc | 63 ++++++++++++++++++++++++++-------- 2 files changed, 60 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1e46a4022..d5addbde3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2017-03-15 Werner Lemberg + + [ftfuzzer] Limit number of tested faces and instances. + + This is inspired by the discussion in and analysis of + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=859 + + * src/tools/ftfuzzer/ftfuzzer.cc (LLVMFuzzerTestOneInput): Use only + up to 20 face indices. + Use only up to 20 instance indices. + 2017-03-15 Werner Lemberg * src/tools/ftfuzzer/ftfuzzer.cc: Improve readability; formatting. diff --git a/src/tools/ftfuzzer/ftfuzzer.cc b/src/tools/ftfuzzer/ftfuzzer.cc index 591c8b6a3..44bdaddba 100644 --- a/src/tools/ftfuzzer/ftfuzzer.cc +++ b/src/tools/ftfuzzer/ftfuzzer.cc @@ -270,11 +270,20 @@ long num_faces = face->num_faces; FT_Done_Face( face ); - // loop over all faces - for ( long face_index = 0; - face_index < num_faces; - face_index++ ) + // loop over up to 20 arbitrarily selected faces + // from index range [0;num-faces-1] + long max_face_cnt = num_faces < 20 + ? num_faces + : 20; + + Random faces_pool( max_face_cnt, num_faces ); + + for ( long face_cnt = 0; + face_cnt < max_face_cnt; + face_cnt++ ) { + long face_index = faces_pool.get() - 1; + // get number of instances if ( FT_New_Memory_Face( library, files[0].data(), @@ -285,17 +294,41 @@ long num_instances = face->style_flags >> 16; FT_Done_Face( face ); - // load face with and without instances - for ( long instance_index = 0; - instance_index < num_instances + 1; - instance_index++ ) + // loop over the face without instance (index 0) + // and up to 20 arbitrarily selected instances + // from index range [1;num_instances] + long max_instance_cnt = num_instances < 20 + ? num_instances + : 20; + + Random instances_pool( max_instance_cnt, num_instances ); + + for ( long instance_cnt = 0; + instance_cnt <= max_instance_cnt; + instance_cnt++ ) { - if ( FT_New_Memory_Face( library, - files[0].data(), - (FT_Long)files[0].size(), - ( instance_index << 16 ) + face_index, - &face ) ) - continue; + long instance_index = 0; + + if ( !instance_cnt ) + { + if ( FT_New_Memory_Face( library, + files[0].data(), + (FT_Long)files[0].size(), + face_index, + &face ) ) + continue; + } + else + { + instance_index = instances_pool.get(); + + if ( FT_New_Memory_Face( library, + files[0].data(), + (FT_Long)files[0].size(), + ( instance_index << 16 ) + face_index, + &face ) ) + continue; + } // if we have more than a single input file coming from an archive, // attach them (starting with the second file) using the order given @@ -314,7 +347,7 @@ FT_Attach_Stream( face, &open_args ); } - // loop over an arbitrary size for outlines (index 0) + // loop over an arbitrary size for outlines // and up to ten arbitrarily selected bitmap strike sizes // from the range [0;num_fixed_sizes - 1] int max_size_cnt = face->num_fixed_sizes < 10 From 981c23b75eb78ea2e30bf70643d61ab603453bc9 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Wed, 15 Mar 2017 11:35:26 +0100 Subject: [PATCH 011/470] Remove clang compiler warnings (#50548). * include/freetype/internal/tttypes.h (TT_FaceRec): Make `var_postscript_prefix_len' unsigned. * src/autofit/afwarp.c (af_warper_compute_line_best): Remove redundant assignment. * src/cff/cffload.c (cff_subfont_load): Add casts. * src/cff/cffparse.c (cff_parse_blend): Remove redundant assignment. * src/sfnt/sfdriver.c (fmix32, murmur_hash_3_128): Add `static' keyword. Add casts. (fixed2float): Add cast. (sfnt_get_var_ps_name): Make `p' always initialized. Add casts. * src/truetype/ttgxvar.c (TT_Get_MM_Var): Add casts. --- ChangeLog | 23 ++++++++++++ include/freetype/internal/tttypes.h | 2 +- src/autofit/afwarp.c | 1 - src/cff/cffload.c | 5 ++- src/cff/cffparse.c | 2 - src/sfnt/sfdriver.c | 58 +++++++++++++++-------------- src/truetype/ttgxvar.c | 4 +- 7 files changed, 59 insertions(+), 36 deletions(-) diff --git a/ChangeLog b/ChangeLog index d5addbde3..5bbf50a1a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,26 @@ +2017-03-15 Werner Lemberg + + Remove clang compiler warnings (#50548). + + * include/freetype/internal/tttypes.h (TT_FaceRec): Make + `var_postscript_prefix_len' unsigned. + + * src/autofit/afwarp.c (af_warper_compute_line_best): Remove + redundant assignment. + + * src/cff/cffload.c (cff_subfont_load): Add casts. + + * src/cff/cffparse.c (cff_parse_blend): Remove redundant assignment. + + * src/sfnt/sfdriver.c (fmix32, murmur_hash_3_128): Add `static' + keyword. + Add casts. + (fixed2float): Add cast. + (sfnt_get_var_ps_name): Make `p' always initialized. + Add casts. + + * src/truetype/ttgxvar.c (TT_Get_MM_Var): Add casts. + 2017-03-15 Werner Lemberg [ftfuzzer] Limit number of tested faces and instances. diff --git a/include/freetype/internal/tttypes.h b/include/freetype/internal/tttypes.h index a1f6774ab..9a2f7c806 100644 --- a/include/freetype/internal/tttypes.h +++ b/include/freetype/internal/tttypes.h @@ -1513,7 +1513,7 @@ FT_BEGIN_HEADER FT_UInt32 variation_support; /* since 2.7.1 */ const char* var_postscript_prefix; /* since 2.7.2 */ - FT_Int var_postscript_prefix_len; /* since 2.7.2 */ + FT_UInt var_postscript_prefix_len; /* since 2.7.2 */ #endif diff --git a/src/autofit/afwarp.c b/src/autofit/afwarp.c index 44dd49b6f..f99aa6d98 100644 --- a/src/autofit/afwarp.c +++ b/src/autofit/afwarp.c @@ -98,7 +98,6 @@ if ( xx1min + w < warper->x2min ) xx1min = warper->x2min - w; - xx1max = warper->x1max; if ( xx1max + w > warper->x2max ) xx1max = warper->x2max - w; diff --git a/src/cff/cffload.c b/src/cff/cffload.c index d356ab361..d3a2af9ad 100644 --- a/src/cff/cffload.c +++ b/src/cff/cffload.c @@ -2084,7 +2084,8 @@ { do { - driver->random_seed = (FT_Int32)cff_random( driver->random_seed ); + driver->random_seed = + (FT_Int32)cff_random( (FT_UInt32)driver->random_seed ); } while ( driver->random_seed < 0 ); } @@ -2097,7 +2098,7 @@ do { face->root.internal->random_seed = - (FT_Int32)cff_random( face->root.internal->random_seed ); + (FT_Int32)cff_random( (FT_UInt32)face->root.internal->random_seed ); } while ( face->root.internal->random_seed < 0 ); } diff --git a/src/cff/cffparse.c b/src/cff/cffparse.c index 59fa2908a..e1511bdbd 100644 --- a/src/cff/cffparse.c +++ b/src/cff/cffparse.c @@ -894,8 +894,6 @@ FT_Error error; - error = FT_ERR( Stack_Underflow ); - if ( !priv || !priv->subfont ) { error = FT_THROW( Invalid_File_Format ); diff --git a/src/sfnt/sfdriver.c b/src/sfnt/sfdriver.c index 0f95c76b2..24181b4cd 100644 --- a/src/sfnt/sfdriver.c +++ b/src/sfnt/sfdriver.c @@ -271,7 +271,7 @@ #define ROTL32( x, r ) ( x << r ) | ( x >> ( 32 - r ) ) - FT_UInt32 + static FT_UInt32 fmix32( FT_UInt32 h ) { h ^= h >> 16; @@ -284,14 +284,14 @@ } - void - murmur_hash_3_128( const void* key, - const int len, - FT_UInt32 seed, - void* out ) + static void + murmur_hash_3_128( const void* key, + const unsigned int len, + FT_UInt32 seed, + void* out ) { const FT_Byte* data = (const FT_Byte*)key; - const int nblocks = len / 16; + const int nblocks = (int)len / 16; FT_UInt32 h1 = seed; FT_UInt32 h2 = seed; @@ -365,50 +365,50 @@ switch ( len & 15 ) { case 15: - k4 ^= tail[14] << 16; + k4 ^= (FT_UInt32)tail[14] << 16; case 14: - k4 ^= tail[13] << 8; + k4 ^= (FT_UInt32)tail[13] << 8; case 13: - k4 ^= tail[12] << 0; + k4 ^= (FT_UInt32)tail[12]; k4 *= c4; k4 = ROTL32( k4, 18 ); k4 *= c1; h4 ^= k4; case 12: - k3 ^= tail[11] << 24; + k3 ^= (FT_UInt32)tail[11] << 24; case 11: - k3 ^= tail[10] << 16; + k3 ^= (FT_UInt32)tail[10] << 16; case 10: - k3 ^= tail[9] << 8; + k3 ^= (FT_UInt32)tail[9] << 8; case 9: - k3 ^= tail[8] << 0; + k3 ^= (FT_UInt32)tail[8]; k3 *= c3; k3 = ROTL32( k3, 17 ); k3 *= c4; h3 ^= k3; case 8: - k2 ^= tail[7] << 24; + k2 ^= (FT_UInt32)tail[7] << 24; case 7: - k2 ^= tail[6] << 16; + k2 ^= (FT_UInt32)tail[6] << 16; case 6: - k2 ^= tail[5] << 8; + k2 ^= (FT_UInt32)tail[5] << 8; case 5: - k2 ^= tail[4] << 0; + k2 ^= (FT_UInt32)tail[4]; k2 *= c2; k2 = ROTL32( k2, 16 ); k2 *= c3; h2 ^= k2; case 4: - k1 ^= tail[3] << 24; + k1 ^= (FT_UInt32)tail[3] << 24; case 3: - k1 ^= tail[2] << 16; + k1 ^= (FT_UInt32)tail[2] << 16; case 2: - k1 ^= tail[1] << 8; + k1 ^= (FT_UInt32)tail[1] << 8; case 1: - k1 ^= tail[0] << 0; + k1 ^= (FT_UInt32)tail[0]; k1 *= c1; k1 = ROTL32( k1, 15 ); k1 *= c2; @@ -699,7 +699,7 @@ /* get digits of fractional part */ for ( i = 0; i < 5; i++ ) { - *p++ = '0' + frac_part / 0x10000L; + *p++ = '0' + (char)( frac_part / 0x10000L ); frac_part %= 0x10000L; if ( !frac_part ) @@ -875,6 +875,8 @@ if ( ps_name ) { result = ps_name; + p = result + ft_strlen( result ) + 1; + goto check_length; } else @@ -940,7 +942,7 @@ for ( i = 0; i < num_coords; i++, coords++, axis++ ) { - FT_ULong t; + char t; /* omit axis value descriptor if it is identical */ @@ -951,16 +953,16 @@ *p++ = '_'; p = fixed2float( *coords, p ); - t = axis->tag >> 24 & 0xFF; + t = (char)( axis->tag >> 24 ); if ( t != ' ' && ft_isalnum( t ) ) *p++ = t; - t = axis->tag >> 16 & 0xFF; + t = (char)( axis->tag >> 16 ); if ( t != ' ' && ft_isalnum( t ) ) *p++ = t; - t = axis->tag >> 8 & 0xFF; + t = (char)( axis->tag >> 8 ); if ( t != ' ' && ft_isalnum( t ) ) *p++ = t; - t = axis->tag & 0xFF; + t = (char)axis->tag; if ( t != ' ' && ft_isalnum( t ) ) *p++ = t; } diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c index 7f0b3f34d..4ceee00e6 100644 --- a/src/truetype/ttgxvar.c +++ b/src/truetype/ttgxvar.c @@ -2205,8 +2205,8 @@ ns = &mmvar->namedstyle[fvar_head.instanceCount]; - ns->strid = strid; - ns->psid = psid; + ns->strid = (FT_UInt)strid; + ns->psid = (FT_UInt)psid; a = mmvar->axis; c = ns->coords; From d9ff6f20ad3e5101dbed0164cbed10e0d0c26792 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Thu, 16 Mar 2017 20:20:51 +0100 Subject: [PATCH 012/470] * src/truetype/ttgxvar.c (tt_done_blend): Free `vvar_table'. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=883 --- ChangeLog | 8 ++++++++ src/truetype/ttgxvar.c | 10 ++++++++++ 2 files changed, 18 insertions(+) diff --git a/ChangeLog b/ChangeLog index 5bbf50a1a..7dac7a2c1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2017-03-16 Werner Lemberg + + * src/truetype/ttgxvar.c (tt_done_blend): Free `vvar_table'. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=883 + 2017-03-15 Werner Lemberg Remove clang compiler warnings (#50548). diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c index 4ceee00e6..59615e22e 100644 --- a/src/truetype/ttgxvar.c +++ b/src/truetype/ttgxvar.c @@ -3696,6 +3696,16 @@ FT_FREE( blend->hvar_table ); } + if ( blend->vvar_table ) + { + ft_var_done_item_variation_store( face, + &blend->vvar_table->itemStore ); + + FT_FREE( blend->vvar_table->widthMap.innerIndex ); + FT_FREE( blend->vvar_table->widthMap.outerIndex ); + FT_FREE( blend->vvar_table ); + } + if ( blend->mvar_table ) { ft_var_done_item_variation_store( face, From 0bf95b585e5a44e6999ebd54ad2b1913e5e885a8 Mon Sep 17 00:00:00 2001 From: Dave Arnold Date: Fri, 17 Mar 2017 07:22:55 +0100 Subject: [PATCH 013/470] [cff] Fix CFF2 stack allocation. * src/cff/cffparse.c (cff_parser_init) add 1 for operator. --- ChangeLog | 6 ++++++ src/cff/cffload.c | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 7dac7a2c1..86a581845 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2017-03-17 Dave Arnold + + [cff] Fix CFF2 stack allocation. + + * src/cff/cffparse.c (cff_parser_init) add 1 for operator. + 2017-03-16 Werner Lemberg * src/truetype/ttgxvar.c (tt_done_blend): Free `vvar_table'. diff --git a/src/cff/cffload.c b/src/cff/cffload.c index d3a2af9ad..ed93fb571 100644 --- a/src/cff/cffload.c +++ b/src/cff/cffload.c @@ -1890,7 +1890,8 @@ subfont->lenNDV = lenNDV; subfont->NDV = NDV; - stackSize = font->cff2 ? font->top_font.font_dict.maxstack + /* add 1 for the operator */ + stackSize = font->cff2 ? font->top_font.font_dict.maxstack + 1 : CFF_MAX_STACK_DEPTH + 1; if ( cff_parser_init( &parser, From fdbef538f41198a59af8bebfc2841e3ce25b10d1 Mon Sep 17 00:00:00 2001 From: Dave Arnold Date: Fri, 17 Mar 2017 07:28:11 +0100 Subject: [PATCH 014/470] [cff] Fix potential bugs in default NDV for CFF2. * src/cff/cffload.c (cff_blend_build_vector): Explicitly build blend vector when `lenNDV' is zero; don't rely on zero-init. Save `lenNDV' as part of cache key even when `lenNDV' is zero. --- ChangeLog | 8 ++++++++ src/cff/cffload.c | 15 ++++++++++----- src/cff/cfftypes.h | 4 ++-- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 86a581845..8035e6210 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2017-03-17 Dave Arnold + + [cff] Fix potential bugs in default NDV for CFF2. + + * src/cff/cffload.c (cff_blend_build_vector): Explicitly build blend + vector when `lenNDV' is zero; don't rely on zero-init. + Save `lenNDV' as part of cache key even when `lenNDV' is zero. + 2017-03-17 Dave Arnold [cff] Fix CFF2 stack allocation. diff --git a/src/cff/cffload.c b/src/cff/cffload.c index ed93fb571..91e74f32c 100644 --- a/src/cff/cffload.c +++ b/src/cff/cffload.c @@ -1463,10 +1463,15 @@ /* Note: `lenNDV' could be zero. */ /* In that case, build default blend vector (1,0,0...). */ - /* In the normal case, initialize each component to 1 */ - /* before inner loop. */ - if ( lenNDV != 0 ) - blend->BV[master] = FT_FIXED_ONE; /* default */ + if ( !lenNDV ) + { + blend->BV[master] = 0; + continue; + } + + /* In the normal case, initialize each component to 1 */ + /* before inner loop. */ + blend->BV[master] = FT_FIXED_ONE; /* default */ /* inner loop steps through axes in this region */ for ( j = 0; j < lenNDV; j++ ) @@ -1529,12 +1534,12 @@ lenNDV * sizeof ( *NDV ) ) ) goto Exit; - blend->lenNDV = lenNDV; FT_MEM_COPY( blend->lastNDV, NDV, lenNDV * sizeof ( *NDV ) ); } + blend->lenNDV = lenNDV; blend->builtBV = TRUE; Exit: diff --git a/src/cff/cfftypes.h b/src/cff/cfftypes.h index 8d43e2834..74f569f08 100644 --- a/src/cff/cfftypes.h +++ b/src/cff/cfftypes.h @@ -112,8 +112,8 @@ FT_BEGIN_HEADER FT_UInt shortDeltaCount; /* not used; always zero */ #endif - FT_UInt regionIdxCount; /* number of regions in this var data */ - FT_UInt* regionIndices; /* array of `regionCount' indices; */ + FT_UInt regionIdxCount; /* number of region indexes */ + FT_UInt* regionIndices; /* array of `regionIdxCount' indices; */ /* these index `varRegionList' */ } CFF_VarData; From bffb7fe90b1a3403ee253c30974beaa8ee436567 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Fri, 17 Mar 2017 07:52:30 +0100 Subject: [PATCH 015/470] `make multi' fixes; compiler warnings. * src/base/ftsnames.c: Include FT_INTERNAL_DEBUG_H. * src/cff/cffobjs.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include FT_MULTIPLE_MASTERS_H and FT_SERVICE_MULTIPLE_MASTERS_H. * src/sfnt/sfdriver.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include FT_MULTIPLE_MASTERS_H and FT_SERVICE_MULTIPLE_MASTERS_H. (get_win_string, get_apple_string): Initialize `result'. --- ChangeLog | 13 +++++++++++++ src/base/ftsnames.c | 2 ++ src/cff/cffobjs.c | 5 +++++ src/sfnt/sfdriver.c | 9 +++++++-- 4 files changed, 27 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8035e6210..0db7b3db6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2017-03-17 Werner Lemberg + + `make multi' fixes; compiler warnings. + + * src/base/ftsnames.c: Include FT_INTERNAL_DEBUG_H. + + * src/cff/cffobjs.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include + FT_MULTIPLE_MASTERS_H and FT_SERVICE_MULTIPLE_MASTERS_H. + + * src/sfnt/sfdriver.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include + FT_MULTIPLE_MASTERS_H and FT_SERVICE_MULTIPLE_MASTERS_H. + (get_win_string, get_apple_string): Initialize `result'. + 2017-03-17 Dave Arnold [cff] Fix potential bugs in default NDV for CFF2. diff --git a/src/base/ftsnames.c b/src/base/ftsnames.c index 868b42943..360945008 100644 --- a/src/base/ftsnames.c +++ b/src/base/ftsnames.c @@ -20,6 +20,8 @@ #include +#include FT_INTERNAL_DEBUG_H + #include FT_SFNT_NAMES_H #include FT_INTERNAL_TRUETYPE_TYPES_H #include FT_INTERNAL_STREAM_H diff --git a/src/cff/cffobjs.c b/src/cff/cffobjs.c index 832276143..ddcfdc97d 100644 --- a/src/cff/cffobjs.c +++ b/src/cff/cffobjs.c @@ -27,6 +27,11 @@ #include FT_INTERNAL_SFNT_H #include FT_CFF_DRIVER_H +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT +#include FT_MULTIPLE_MASTERS_H +#include FT_SERVICE_MULTIPLE_MASTERS_H +#endif + #include "cffobjs.h" #include "cffload.h" #include "cffcmap.h" diff --git a/src/sfnt/sfdriver.c b/src/sfnt/sfdriver.c index 24181b4cd..991433ee4 100644 --- a/src/sfnt/sfdriver.c +++ b/src/sfnt/sfdriver.c @@ -51,6 +51,11 @@ #include FT_SERVICE_SFNT_H #include FT_SERVICE_TT_CMAP_H +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT +#include FT_MULTIPLE_MASTERS_H +#include FT_SERVICE_MULTIPLE_MASTERS_H +#endif + /*************************************************************************/ /* */ @@ -473,7 +478,7 @@ { FT_Error error = FT_Err_Ok; - char* result; + char* result = NULL; FT_String* r; FT_Char* p; FT_UInt len; @@ -534,7 +539,7 @@ { FT_Error error = FT_Err_Ok; - char* result; + char* result = NULL; FT_String* r; FT_Char* p; FT_UInt len; From e5595784f4075a631f3d6606cecc6dad3100d642 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Fri, 17 Mar 2017 21:34:08 +0100 Subject: [PATCH 016/470] Fix preprocessor warning. * devel/ftoption.h, include/freetype/config/ftoption.h: Test whether TT_CONFIG_OPTION_SUBPIXEL_HINTING is defined before checking its value. --- ChangeLog | 8 ++++++++ devel/ftoption.h | 2 ++ include/freetype/config/ftoption.h | 2 ++ 3 files changed, 12 insertions(+) diff --git a/ChangeLog b/ChangeLog index 0db7b3db6..55733a0bc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2017-03-17 Werner Lemberg + + Fix preprocessor warning. + + * devel/ftoption.h, include/freetype/config/ftoption.h: Test whether + TT_CONFIG_OPTION_SUBPIXEL_HINTING is defined before checking its + value. + 2017-03-17 Werner Lemberg `make multi' fixes; compiler warnings. diff --git a/devel/ftoption.h b/devel/ftoption.h index b8b0a8d98..db661e7fc 100644 --- a/devel/ftoption.h +++ b/devel/ftoption.h @@ -913,6 +913,7 @@ FT_BEGIN_HEADER #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER #define TT_USE_BYTECODE_INTERPRETER +#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING #if TT_CONFIG_OPTION_SUBPIXEL_HINTING & 1 #define TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY #endif @@ -920,6 +921,7 @@ FT_BEGIN_HEADER #if TT_CONFIG_OPTION_SUBPIXEL_HINTING & 2 #define TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL #endif +#endif #endif diff --git a/include/freetype/config/ftoption.h b/include/freetype/config/ftoption.h index 7e81fa467..ff393a87d 100644 --- a/include/freetype/config/ftoption.h +++ b/include/freetype/config/ftoption.h @@ -922,6 +922,7 @@ FT_BEGIN_HEADER #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER #define TT_USE_BYTECODE_INTERPRETER +#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING #if TT_CONFIG_OPTION_SUBPIXEL_HINTING & 1 #define TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY #endif @@ -929,6 +930,7 @@ FT_BEGIN_HEADER #if TT_CONFIG_OPTION_SUBPIXEL_HINTING & 2 #define TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL #endif +#endif #endif From d5bfa053f5854cc42966634e1b26a8024b7a51d4 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Fri, 17 Mar 2017 21:47:54 +0100 Subject: [PATCH 017/470] Fixes for conditional compilation. * src/autofit/afcjk.c, src/autofit/afindic.c: Include `afcjk.h' earlier. * src/sfnt/sfobjs.c (sfnt_init_face): Put `memory' variable into TT_CONFIG_OPTION_GX_VAR_SUPPORT block. (sfnt_done_face): Protect some code with TT_CONFIG_OPTION_GX_VAR_SUPPORT. * src/sfnt/ttsbit.c (tt_face_load_sbix_image): Remove compiler warning. * src/truetype/ttgload.c (TT_Load_Simple_Glyph): Put `tmp' variable into TT_USE_BYTECODE_INTERPRETER block. (tt_loader_init): Put `error' variable into TT_USE_BYTECODE_INTERPRETER block. --- ChangeLog | 21 +++++++++++++++++++++ src/autofit/afcjk.c | 2 +- src/autofit/afindic.c | 2 +- src/sfnt/sfobjs.c | 5 ++++- src/sfnt/ttsbit.c | 3 +++ src/truetype/ttgload.c | 10 ++++++---- 6 files changed, 36 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 55733a0bc..1f0163b7c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,24 @@ +2017-03-17 Werner Lemberg + + Fixes for conditional compilation. + + * src/autofit/afcjk.c, src/autofit/afindic.c: Include `afcjk.h' + earlier. + + * src/sfnt/sfobjs.c (sfnt_init_face): Put `memory' variable into + TT_CONFIG_OPTION_GX_VAR_SUPPORT block. + (sfnt_done_face): Protect some code with + TT_CONFIG_OPTION_GX_VAR_SUPPORT. + + * src/sfnt/ttsbit.c (tt_face_load_sbix_image): Remove compiler + warning. + + * src/truetype/ttgload.c (TT_Load_Simple_Glyph): Put `tmp' variable + into TT_USE_BYTECODE_INTERPRETER block. + + (tt_loader_init): Put `error' variable into + TT_USE_BYTECODE_INTERPRETER block. + 2017-03-17 Werner Lemberg Fix preprocessor warning. diff --git a/src/autofit/afcjk.c b/src/autofit/afcjk.c index f172a9fd9..ec05ee4d9 100644 --- a/src/autofit/afcjk.c +++ b/src/autofit/afcjk.c @@ -29,13 +29,13 @@ #include "afglobal.h" #include "afpic.h" #include "aflatin.h" +#include "afcjk.h" #ifdef AF_CONFIG_OPTION_CJK #undef AF_CONFIG_OPTION_CJK_BLUE_HANI_VERT -#include "afcjk.h" #include "aferrors.h" diff --git a/src/autofit/afindic.c b/src/autofit/afindic.c index 03c611b9f..23be46ed5 100644 --- a/src/autofit/afindic.c +++ b/src/autofit/afindic.c @@ -18,13 +18,13 @@ #include "aftypes.h" #include "aflatin.h" +#include "afcjk.h" #ifdef AF_CONFIG_OPTION_INDIC #include "afindic.h" #include "aferrors.h" -#include "afcjk.h" #ifdef AF_CONFIG_OPTION_USE_WARPER diff --git a/src/sfnt/sfobjs.c b/src/sfnt/sfobjs.c index 36400749a..0418d83ca 100644 --- a/src/sfnt/sfobjs.c +++ b/src/sfnt/sfobjs.c @@ -856,7 +856,6 @@ FT_Parameter* params ) { FT_Error error; - FT_Memory memory = face->root.memory; FT_Library library = face->root.driver->root.library; SFNT_Service sfnt; FT_Int face_index; @@ -943,6 +942,8 @@ #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT { + FT_Memory memory = face->root.memory; + FT_ULong fvar_len; FT_ULong version; @@ -1754,8 +1755,10 @@ FT_FREE( face->sbit_strike_map ); face->root.num_fixed_sizes = 0; +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT FT_FREE( face->postscript_name ); FT_FREE( face->var_postscript_prefix ); +#endif face->sfnt = NULL; } diff --git a/src/sfnt/ttsbit.c b/src/sfnt/ttsbit.c index 98295932d..5a0215d01 100644 --- a/src/sfnt/ttsbit.c +++ b/src/sfnt/ttsbit.c @@ -1460,6 +1460,9 @@ FT_Byte* p; FT_UNUSED( map ); +#ifndef FT_CONFIG_OPTION_USE_PNG + FT_UNUSED( metrics_only ); +#endif strike_index = face->sbit_strike_map[strike_index]; diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c index 0fdaa85f2..eecf7afdd 100644 --- a/src/truetype/ttgload.c +++ b/src/truetype/ttgload.c @@ -332,7 +332,6 @@ FT_Outline* outline; FT_UShort n_ins; FT_Int n_points; - FT_ULong tmp; FT_Byte *flag, *flag_limit; FT_Byte c, count; @@ -402,6 +401,9 @@ if ( IS_HINTED( load->load_flags ) ) { + FT_ULong tmp; + + /* check instructions size */ if ( ( limit - p ) < n_ins ) { @@ -2270,17 +2272,17 @@ FT_Int32 load_flags, FT_Bool glyf_table_only ) { - FT_Error error; - TT_Face face; FT_Stream stream; + #ifdef TT_USE_BYTECODE_INTERPRETER + FT_Error error; FT_Bool pedantic = FT_BOOL( load_flags & FT_LOAD_PEDANTIC ); -#endif #if defined TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY || \ defined TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL TT_Driver driver = (TT_Driver)FT_FACE_DRIVER( (TT_Face)glyph->face ); #endif +#endif face = (TT_Face)glyph->face; From 9931175dcc57313be60d3633f7597ec4db446a35 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sat, 18 Mar 2017 07:06:49 +0100 Subject: [PATCH 018/470] Improve `make multi'. * src/autofit/aflatin2.c: Guard file with FT_OPTION_AUTOFIT2. * src/base/ftmac.c: Guard more parts of the file with FT_MACINTOSH. * src/psaux/afmparse.c: Guard file with T1_CONFIG_OPTION_NO_AFM. * src/sfnt/pngshim.c: Guard file with TT_CONFIG_OPTION_EMBEDDED_BITMAPS also. * src/sfnt/ttbdf.c: Avoid empty source file. * src/sfnt/ttpost.c: Guard file with TT_CONFIG_OPTION_POSTSCRIPT_NAMES. * src/sfnt/ttsbit.c: Guard file with TT_CONFIG_OPTION_EMBEDDED_BITMAPS. * src/truetype/ttgxvar.c, src/truetype/ttinterp.c: Avoid empty source file. * src/truetype/ttsubpix.c: Guard file with TT_USE_BYTECODE_INTERPRETER also. * src/type1/t1afm.c: Guard file with T1_CONFIG_OPTION_NO_AFM. * src/autofit/autofit.c, src/base/ftbase.c, src/cache/ftcache.c, src/cff/cff.c, src/cid/type1cid.c, src/gxvalid/gxvalid.c, src/pcf/pcf.c, src/pfr/pfr.c, src/psaux/psaux.c, src/pshinter/pshinter.c, src/psnames/psnames.c, src/raster/raster.c, src/sfnt/sfnt.c, src/smooth/smooth.c, src/truetype/truetype.c, src/type1/type1.c, src/type42/type42.c: Remove conditionals; sort entries. --- ChangeLog | 35 +++++++++++++++++++++++++++++++++++ src/autofit/aflatin2.c | 10 ++++++++++ src/autofit/autofit.c | 23 ++++++++--------------- src/base/ftbase.c | 7 ++----- src/base/ftmac.c | 12 +++++++++--- src/bdf/bdf.c | 3 ++- src/cache/ftcache.c | 9 +++++---- src/cff/cff.c | 8 ++++---- src/cid/type1cid.c | 6 +++--- src/gxvalid/gxvalid.c | 14 +++++++------- src/otvalid/otvalid.c | 3 ++- src/pcf/pcf.c | 8 ++++---- src/pfr/pfr.c | 9 +++++---- src/psaux/afmparse.c | 9 +++++++++ src/psaux/psaux.c | 12 ++++-------- src/pshinter/pshinter.c | 8 ++++---- src/psnames/psnames.c | 4 ++-- src/raster/raster.c | 4 ++-- src/sfnt/pngshim.c | 10 ++++++++-- src/sfnt/sfnt.c | 24 ++++++++---------------- src/sfnt/ttbdf.c | 7 ++++++- src/sfnt/ttpost.c | 11 +++++++++++ src/sfnt/ttsbit.c | 13 ++++++++++++- src/smooth/smooth.c | 4 ++-- src/truetype/truetype.c | 16 +++++----------- src/truetype/ttgxvar.c | 7 ++++++- src/truetype/ttinterp.c | 6 +++++- src/truetype/ttsubpix.c | 9 ++++++--- src/type1/t1afm.c | 9 +++++++++ src/type1/type1.c | 13 +++++-------- src/type42/type42.c | 6 ++++-- 31 files changed, 204 insertions(+), 115 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1f0163b7c..44c8d6342 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,38 @@ +2017-03-17 Werner Lemberg + + Improve `make multi'. + + * src/autofit/aflatin2.c: Guard file with FT_OPTION_AUTOFIT2. + + * src/base/ftmac.c: Guard more parts of the file with FT_MACINTOSH. + + * src/psaux/afmparse.c: Guard file with T1_CONFIG_OPTION_NO_AFM. + + * src/sfnt/pngshim.c: Guard file with + TT_CONFIG_OPTION_EMBEDDED_BITMAPS also. + + * src/sfnt/ttbdf.c: Avoid empty source file. + * src/sfnt/ttpost.c: Guard file with + TT_CONFIG_OPTION_POSTSCRIPT_NAMES. + * src/sfnt/ttsbit.c: Guard file with + TT_CONFIG_OPTION_EMBEDDED_BITMAPS. + + * src/truetype/ttgxvar.c, src/truetype/ttinterp.c: Avoid empty + source file. + + * src/truetype/ttsubpix.c: Guard file with + TT_USE_BYTECODE_INTERPRETER also. + + * src/type1/t1afm.c: Guard file with T1_CONFIG_OPTION_NO_AFM. + + * src/autofit/autofit.c, src/base/ftbase.c, src/cache/ftcache.c, + src/cff/cff.c, src/cid/type1cid.c, src/gxvalid/gxvalid.c, + src/pcf/pcf.c, src/pfr/pfr.c, src/psaux/psaux.c, + src/pshinter/pshinter.c, src/psnames/psnames.c, src/raster/raster.c, + src/sfnt/sfnt.c, src/smooth/smooth.c, src/truetype/truetype.c, + src/type1/type1.c, src/type42/type42.c: Remove conditionals; sort + entries. + 2017-03-17 Werner Lemberg Fixes for conditional compilation. diff --git a/src/autofit/aflatin2.c b/src/autofit/aflatin2.c index 70487569e..cc2312648 100644 --- a/src/autofit/aflatin2.c +++ b/src/autofit/aflatin2.c @@ -23,6 +23,9 @@ #include FT_ADVANCES_H + +#ifdef FT_OPTION_AUTOFIT2 + #include "afglobal.h" #include "aflatin.h" #include "aflatin2.h" @@ -2419,5 +2422,12 @@ (AF_WritingSystem_ApplyHintsFunc) af_latin2_hints_apply /* style_hints_apply */ ) +#else /* !FT_OPTION_AUTOFIT2 */ + + /* ANSI C doesn't like empty source files */ + typedef int _af_latin2_dummy; + +#endif /* !FT_OPTION_AUTOFIT2 */ + /* END */ diff --git a/src/autofit/autofit.c b/src/autofit/autofit.c index 60060c9c7..bbedad7b5 100644 --- a/src/autofit/autofit.c +++ b/src/autofit/autofit.c @@ -18,29 +18,22 @@ #define FT_MAKE_OPTION_SINGLE_OBJECT #include -#include "afpic.c" + #include "afangles.c" #include "afblue.c" +#include "afcjk.c" +#include "afdummy.c" #include "afglobal.c" #include "afhints.c" - -#include "afranges.c" - -#include "afdummy.c" +#include "afindic.c" #include "aflatin.c" -#ifdef FT_OPTION_AUTOFIT2 #include "aflatin2.c" -#endif -#include "afcjk.c" -#include "afindic.c" - -#include "afshaper.c" - #include "afloader.c" #include "afmodule.c" - -#ifdef AF_CONFIG_OPTION_USE_WARPER +#include "afpic.c" +#include "afranges.c" +#include "afshaper.c" #include "afwarp.c" -#endif + /* END */ diff --git a/src/base/ftbase.c b/src/base/ftbase.c index 993ac7228..55f735994 100644 --- a/src/base/ftbase.c +++ b/src/base/ftbase.c @@ -17,26 +17,23 @@ #include - #define FT_MAKE_OPTION_SINGLE_OBJECT -#include "ftpic.c" #include "basepic.c" #include "ftadvanc.c" #include "ftcalc.c" #include "ftdbgmem.c" #include "ftgloadr.c" #include "fthash.c" +#include "ftmac.c" #include "ftobjs.c" #include "ftoutln.c" +#include "ftpic.c" #include "ftrfork.c" #include "ftsnames.c" #include "ftstream.c" #include "fttrigon.c" #include "ftutil.c" -#ifdef FT_MACINTOSH -#include "ftmac.c" -#endif /* END */ diff --git a/src/base/ftmac.c b/src/base/ftmac.c index fb70606b7..4b92066da 100644 --- a/src/base/ftmac.c +++ b/src/base/ftmac.c @@ -71,6 +71,9 @@ #include FT_INTERNAL_STREAM_H #include "ftbase.h" + +#ifdef FT_MACINTOSH + /* This is for Mac OS X. Without redefinition, OS_INLINE */ /* expands to `static inline' which doesn't survive the */ /* -ansi compilation flag of GCC. */ @@ -118,8 +121,6 @@ #endif -#ifdef FT_MACINTOSH - /* This function is deprecated because FSSpec is deprecated in Mac OS X */ FT_EXPORT_DEF( FT_Error ) FT_GetFile_From_Mac_Name( const char* fontName, @@ -1076,7 +1077,12 @@ #endif } -#endif /* FT_MACINTOSH */ +#else /* !FT_MACINTOSH */ + + /* ANSI C doesn't like empty source files */ + typedef int _ft_mac_dummy; + +#endif /* !FT_MACINTOSH */ /* END */ diff --git a/src/bdf/bdf.c b/src/bdf/bdf.c index f95fb7622..e54df6649 100644 --- a/src/bdf/bdf.c +++ b/src/bdf/bdf.c @@ -24,9 +24,10 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#define FT_MAKE_OPTION_SINGLE_OBJECT +#define FT_MAKE_OPTION_SINGLE_OBJECT #include + #include "bdflib.c" #include "bdfdrivr.c" diff --git a/src/cache/ftcache.c b/src/cache/ftcache.c index 052ff2547..822618831 100644 --- a/src/cache/ftcache.c +++ b/src/cache/ftcache.c @@ -17,15 +17,16 @@ #define FT_MAKE_OPTION_SINGLE_OBJECT - #include -#include "ftcmru.c" -#include "ftcmanag.c" + +#include "ftcbasic.c" #include "ftccache.c" #include "ftccmap.c" #include "ftcglyph.c" #include "ftcimage.c" +#include "ftcmanag.c" +#include "ftcmru.c" #include "ftcsbits.c" -#include "ftcbasic.c" + /* END */ diff --git a/src/cff/cff.c b/src/cff/cff.c index 545fb202c..397f6dfaf 100644 --- a/src/cff/cff.c +++ b/src/cff/cff.c @@ -17,16 +17,15 @@ #define FT_MAKE_OPTION_SINGLE_OBJECT - #include -#include "cffpic.c" +#include "cffcmap.c" #include "cffdrivr.c" +#include "cffgload.c" #include "cffparse.c" +#include "cffpic.c" #include "cffload.c" #include "cffobjs.c" -#include "cffgload.c" -#include "cffcmap.c" #include "cf2arrst.c" #include "cf2blues.c" @@ -38,4 +37,5 @@ #include "cf2read.c" #include "cf2stack.c" + /* END */ diff --git a/src/cid/type1cid.c b/src/cid/type1cid.c index aeb9c3eab..93e6f810d 100644 --- a/src/cid/type1cid.c +++ b/src/cid/type1cid.c @@ -17,13 +17,13 @@ #define FT_MAKE_OPTION_SINGLE_OBJECT - #include -#include "cidparse.c" + +#include "cidgload.c" #include "cidload.c" #include "cidobjs.c" +#include "cidparse.c" #include "cidriver.c" -#include "cidgload.c" /* END */ diff --git a/src/gxvalid/gxvalid.c b/src/gxvalid/gxvalid.c index f0648ea39..da485141d 100644 --- a/src/gxvalid/gxvalid.c +++ b/src/gxvalid/gxvalid.c @@ -16,15 +16,17 @@ /* */ /***************************************************************************/ -#define FT_MAKE_OPTION_SINGLE_OBJECT +#define FT_MAKE_OPTION_SINGLE_OBJECT #include -#include "gxvfeat.c" -#include "gxvcommn.c" #include "gxvbsln.c" -#include "gxvtrak.c" +#include "gxvcommn.c" +#include "gxvfeat.c" #include "gxvjust.c" +#include "gxvkern.c" +#include "gxvlcar.c" +#include "gxvmod.c" #include "gxvmort.c" #include "gxvmort0.c" #include "gxvmort1.c" @@ -37,11 +39,9 @@ #include "gxvmorx2.c" #include "gxvmorx4.c" #include "gxvmorx5.c" -#include "gxvkern.c" #include "gxvopbd.c" #include "gxvprop.c" -#include "gxvlcar.c" -#include "gxvmod.c" +#include "gxvtrak.c" /* END */ diff --git a/src/otvalid/otvalid.c b/src/otvalid/otvalid.c index 3901c54c4..312751a1f 100644 --- a/src/otvalid/otvalid.c +++ b/src/otvalid/otvalid.c @@ -15,8 +15,8 @@ /* */ /***************************************************************************/ -#define FT_MAKE_OPTION_SINGLE_OBJECT +#define FT_MAKE_OPTION_SINGLE_OBJECT #include #include "otvbase.c" @@ -28,4 +28,5 @@ #include "otvmath.c" #include "otvmod.c" + /* END */ diff --git a/src/pcf/pcf.c b/src/pcf/pcf.c index 11d5b7b2a..8ffd6e280 100644 --- a/src/pcf/pcf.c +++ b/src/pcf/pcf.c @@ -26,11 +26,11 @@ THE SOFTWARE. #define FT_MAKE_OPTION_SINGLE_OBJECT - - #include -#include "pcfutil.c" -#include "pcfread.c" + #include "pcfdrivr.c" +#include "pcfread.c" +#include "pcfutil.c" + /* END */ diff --git a/src/pfr/pfr.c b/src/pfr/pfr.c index 2d0e72ce5..4f31f5d9b 100644 --- a/src/pfr/pfr.c +++ b/src/pfr/pfr.c @@ -15,15 +15,16 @@ /* */ /***************************************************************************/ -#define FT_MAKE_OPTION_SINGLE_OBJECT +#define FT_MAKE_OPTION_SINGLE_OBJECT #include -#include "pfrload.c" -#include "pfrgload.c" #include "pfrcmap.c" -#include "pfrobjs.c" #include "pfrdrivr.c" +#include "pfrgload.c" +#include "pfrload.c" +#include "pfrobjs.c" #include "pfrsbit.c" + /* END */ diff --git a/src/psaux/afmparse.c b/src/psaux/afmparse.c index dbe7ddd70..ff2cc8cf0 100644 --- a/src/psaux/afmparse.c +++ b/src/psaux/afmparse.c @@ -20,6 +20,8 @@ #include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_POSTSCRIPT_AUX_H +#ifndef T1_CONFIG_OPTION_NO_AFM + #include "afmparse.h" #include "psconv.h" @@ -973,5 +975,12 @@ return error; } +#else /* T1_CONFIG_OPTION_NO_AFM */ + + /* ANSI C doesn't like empty source files */ + typedef int _afm_parse_dummy; + +#endif /* T1_CONFIG_OPTION_NO_AFM */ + /* END */ diff --git a/src/psaux/psaux.c b/src/psaux/psaux.c index f8f19d0f3..c373aa7d5 100644 --- a/src/psaux/psaux.c +++ b/src/psaux/psaux.c @@ -17,18 +17,14 @@ #define FT_MAKE_OPTION_SINGLE_OBJECT - #include -#include "psobjs.c" -#include "psauxmod.c" -#include "t1decode.c" -#include "t1cmap.c" -#ifndef T1_CONFIG_OPTION_NO_AFM #include "afmparse.c" -#endif - +#include "psauxmod.c" #include "psconv.c" +#include "psobjs.c" +#include "t1cmap.c" +#include "t1decode.c" /* END */ diff --git a/src/pshinter/pshinter.c b/src/pshinter/pshinter.c index e6727aea1..13e07e148 100644 --- a/src/pshinter/pshinter.c +++ b/src/pshinter/pshinter.c @@ -17,13 +17,13 @@ #define FT_MAKE_OPTION_SINGLE_OBJECT - #include -#include "pshpic.c" -#include "pshrec.c" -#include "pshglob.c" + #include "pshalgo.c" +#include "pshglob.c" #include "pshmod.c" +#include "pshpic.c" +#include "pshrec.c" /* END */ diff --git a/src/psnames/psnames.c b/src/psnames/psnames.c index 5b7bc8b68..22466d623 100644 --- a/src/psnames/psnames.c +++ b/src/psnames/psnames.c @@ -17,10 +17,10 @@ #define FT_MAKE_OPTION_SINGLE_OBJECT - #include -#include "pspic.c" + #include "psmodule.c" +#include "pspic.c" /* END */ diff --git a/src/raster/raster.c b/src/raster/raster.c index ee54ae19f..46a6690b1 100644 --- a/src/raster/raster.c +++ b/src/raster/raster.c @@ -17,11 +17,11 @@ #define FT_MAKE_OPTION_SINGLE_OBJECT - #include -#include "rastpic.c" + #include "ftraster.c" #include "ftrend1.c" +#include "rastpic.c" /* END */ diff --git a/src/sfnt/pngshim.c b/src/sfnt/pngshim.c index 96fc08e3b..b9b296ea5 100644 --- a/src/sfnt/pngshim.c +++ b/src/sfnt/pngshim.c @@ -24,7 +24,8 @@ #include FT_CONFIG_STANDARD_LIBRARY_H -#ifdef FT_CONFIG_OPTION_USE_PNG +#if defined( TT_CONFIG_OPTION_EMBEDDED_BITMAPS ) && \ + defined( FT_CONFIG_OPTION_USE_PNG ) /* We always include , so make libpng shut up! */ #define PNG_SKIP_SETJMP_CHECK 1 @@ -377,7 +378,12 @@ return error; } -#endif /* FT_CONFIG_OPTION_USE_PNG */ +#else /* !(TT_CONFIG_OPTION_EMBEDDED_BITMAPS && FT_CONFIG_OPTION_USE_PNG) */ + + /* ANSI C doesn't like empty source files */ + typedef int _pngshim_dummy; + +#endif /* !(TT_CONFIG_OPTION_EMBEDDED_BITMAPS && FT_CONFIG_OPTION_USE_PNG) */ /* END */ diff --git a/src/sfnt/sfnt.c b/src/sfnt/sfnt.c index cffda6e6d..6cf8c9ef3 100644 --- a/src/sfnt/sfnt.c +++ b/src/sfnt/sfnt.c @@ -17,27 +17,19 @@ #define FT_MAKE_OPTION_SINGLE_OBJECT - #include + +#include "pngshim.c" +#include "sfdriver.c" #include "sfntpic.c" -#include "ttload.c" -#include "ttmtx.c" +#include "sfobjs.c" +#include "ttbdf.c" #include "ttcmap.c" #include "ttkern.c" -#include "sfobjs.c" -#include "sfdriver.c" - -#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS -#include "pngshim.c" -#include "ttsbit.c" -#endif - -#ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES +#include "ttload.c" +#include "ttmtx.c" #include "ttpost.c" -#endif +#include "ttsbit.c" -#ifdef TT_CONFIG_OPTION_BDF -#include "ttbdf.c" -#endif /* END */ diff --git a/src/sfnt/ttbdf.c b/src/sfnt/ttbdf.c index e7e72209d..2196e3791 100644 --- a/src/sfnt/ttbdf.c +++ b/src/sfnt/ttbdf.c @@ -246,7 +246,12 @@ return error; } -#endif /* TT_CONFIG_OPTION_BDF */ +#else /* !TT_CONFIG_OPTION_BDF */ + + /* ANSI C doesn't like empty source files */ + typedef int _tt_bdf_dummy; + +#endif /* !TT_CONFIG_OPTION_BDF */ /* END */ diff --git a/src/sfnt/ttpost.c b/src/sfnt/ttpost.c index 6548e8513..540d5f254 100644 --- a/src/sfnt/ttpost.c +++ b/src/sfnt/ttpost.c @@ -29,6 +29,10 @@ #include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_STREAM_H #include FT_TRUETYPE_TAGS_H + + +#ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES + #include "ttpost.h" #include "sferrors.h" @@ -561,5 +565,12 @@ return FT_Err_Ok; } +#else /* !TT_CONFIG_OPTION_POSTSCRIPT_NAMES */ + + /* ANSI C doesn't like empty source files */ + typedef int _tt_post_dummy; + +#endif /* !TT_CONFIG_OPTION_POSTSCRIPT_NAMES */ + /* END */ diff --git a/src/sfnt/ttsbit.c b/src/sfnt/ttsbit.c index 5a0215d01..0c76a5577 100644 --- a/src/sfnt/ttsbit.c +++ b/src/sfnt/ttsbit.c @@ -24,6 +24,10 @@ #include FT_INTERNAL_STREAM_H #include FT_TRUETYPE_TAGS_H #include FT_BITMAP_H + + +#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS + #include "ttsbit.h" #include "sferrors.h" @@ -1650,5 +1654,12 @@ return error; } +#else /* !TT_CONFIG_OPTION_EMBEDDED_BITMAPS */ + + /* ANSI C doesn't like empty source files */ + typedef int _tt_sbit_dummy; + +#endif /* !TT_CONFIG_OPTION_EMBEDDED_BITMAPS */ + -/* EOF */ +/* END */ diff --git a/src/smooth/smooth.c b/src/smooth/smooth.c index 200f5dcb9..e0460d9d4 100644 --- a/src/smooth/smooth.c +++ b/src/smooth/smooth.c @@ -17,11 +17,11 @@ #define FT_MAKE_OPTION_SINGLE_OBJECT - #include -#include "ftspic.c" + #include "ftgrays.c" #include "ftsmooth.c" +#include "ftspic.c" /* END */ diff --git a/src/truetype/truetype.c b/src/truetype/truetype.c index 4866103a7..301b82ad1 100644 --- a/src/truetype/truetype.c +++ b/src/truetype/truetype.c @@ -17,22 +17,16 @@ #define FT_MAKE_OPTION_SINGLE_OBJECT - #include -#include "ttpic.c" + #include "ttdriver.c" /* driver interface */ -#include "ttpload.c" /* tables loader */ #include "ttgload.c" /* glyph loader */ -#include "ttobjs.c" /* object manager */ - -#ifdef TT_USE_BYTECODE_INTERPRETER +#include "ttgxvar.c" /* gx distortable font */ #include "ttinterp.c" +#include "ttobjs.c" /* object manager */ +#include "ttpic.c" +#include "ttpload.c" /* tables loader */ #include "ttsubpix.c" -#endif - -#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT -#include "ttgxvar.c" /* gx distortable font */ -#endif /* END */ diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c index 59615e22e..55b7b0d5b 100644 --- a/src/truetype/ttgxvar.c +++ b/src/truetype/ttgxvar.c @@ -3721,7 +3721,12 @@ } } -#endif /* TT_CONFIG_OPTION_GX_VAR_SUPPORT */ +#else /* !TT_CONFIG_OPTION_GX_VAR_SUPPORT */ + + /* ANSI C doesn't like empty source files */ + typedef int _tt_gxvar_dummy; + +#endif /* !TT_CONFIG_OPTION_GX_VAR_SUPPORT */ /* END */ diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c index 7179ffd77..44df298d5 100644 --- a/src/truetype/ttinterp.c +++ b/src/truetype/ttinterp.c @@ -8415,8 +8415,12 @@ return exc->error; } +#else /* !TT_USE_BYTECODE_INTERPRETER */ -#endif /* TT_USE_BYTECODE_INTERPRETER */ + /* ANSI C doesn't like empty source files */ + typedef int _tt_interp_dummy; + +#endif /* !TT_USE_BYTECODE_INTERPRETER */ /* END */ diff --git a/src/truetype/ttsubpix.c b/src/truetype/ttsubpix.c index 5d803cde1..f8502d2f7 100644 --- a/src/truetype/ttsubpix.c +++ b/src/truetype/ttsubpix.c @@ -27,7 +27,8 @@ #include "ttsubpix.h" -#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY +#if defined( TT_USE_BYTECODE_INTERPRETER ) && \ + defined( TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY ) /*************************************************************************/ /* */ @@ -1000,12 +1001,14 @@ } } -#else /* !TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */ +#else /* !(TT_USE_BYTECODE_INTERPRETER && */ + /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY) */ /* ANSI C doesn't like empty source files */ typedef int _tt_subpix_dummy; -#endif /* !TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */ +#endif /* !(TT_USE_BYTECODE_INTERPRETER && */ + /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY) */ /* END */ diff --git a/src/type1/t1afm.c b/src/type1/t1afm.c index 792ea2ff9..11a2646fc 100644 --- a/src/type1/t1afm.c +++ b/src/type1/t1afm.c @@ -24,6 +24,8 @@ #include "t1errors.h" +#ifndef T1_CONFIG_OPTION_NO_AFM + /*************************************************************************/ /* */ /* The macro FT_COMPONENT is used in trace mode. It is an implicit */ @@ -402,5 +404,12 @@ return FT_Err_Ok; } +#else /* T1_CONFIG_OPTION_NO_AFM */ + + /* ANSI C doesn't like empty source files */ + typedef int _t1_afm_dummy; + +#endif /* T1_CONFIG_OPTION_NO_AFM */ + /* END */ diff --git a/src/type1/type1.c b/src/type1/type1.c index bfe0e439f..81795376e 100644 --- a/src/type1/type1.c +++ b/src/type1/type1.c @@ -17,17 +17,14 @@ #define FT_MAKE_OPTION_SINGLE_OBJECT - #include -#include "t1parse.c" -#include "t1load.c" -#include "t1objs.c" -#include "t1driver.c" -#include "t1gload.c" -#ifndef T1_CONFIG_OPTION_NO_AFM #include "t1afm.c" -#endif +#include "t1driver.c" +#include "t1gload.c" +#include "t1load.c" +#include "t1objs.c" +#include "t1parse.c" /* END */ diff --git a/src/type42/type42.c b/src/type42/type42.c index 4e7c9d1a4..ae8ac2678 100644 --- a/src/type42/type42.c +++ b/src/type42/type42.c @@ -15,11 +15,13 @@ /* */ /***************************************************************************/ -#define FT_MAKE_OPTION_SINGLE_OBJECT +#define FT_MAKE_OPTION_SINGLE_OBJECT #include + +#include "t42drivr.c" #include "t42objs.c" #include "t42parse.c" -#include "t42drivr.c" + /* END */ From ab840e6a4c26bf1b2e6833911c9f761ac45e24e5 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sat, 18 Mar 2017 08:50:42 +0100 Subject: [PATCH 019/470] [ftfuzzer] Minor improvement. * src/tools/ftfuzzer/ftfuzzer.cc: Don't set intermediate axis if bitmap strikes are active. --- ChangeLog | 9 ++++++++- src/tools/ftfuzzer/ftfuzzer.cc | 3 ++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 44c8d6342..4cf4d5a5b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,11 @@ -2017-03-17 Werner Lemberg +2017-03-18 Werner Lemberg + + [ftfuzzer] Minor improvement. + + * src/tools/ftfuzzer/ftfuzzer.cc: Don't set intermediate axis if + bitmap strikes are active. + +2017-03-18 Werner Lemberg Improve `make multi'. diff --git a/src/tools/ftfuzzer/ftfuzzer.cc b/src/tools/ftfuzzer/ftfuzzer.cc index 44bdaddba..55a08e416 100644 --- a/src/tools/ftfuzzer/ftfuzzer.cc +++ b/src/tools/ftfuzzer/ftfuzzer.cc @@ -385,7 +385,8 @@ } // test MM interface only for a face without a selected instance - if ( instance_index == 0 ) + // and without a selected bitmap strike + if ( !instance_index && !size_cnt ) setIntermediateAxis( face ); // loop over all glyphs From 13fa85a246d5fddc037ef3f11e61f9cf0ff3b2be Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sat, 18 Mar 2017 09:42:58 +0100 Subject: [PATCH 020/470] [truetype] Another limitation for bytecode loop count maximum. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=900 * src/truetype/ttinterp.c (TT_RunIns): Limit `loopcall_counter_max' by number of glyphs also. --- ChangeLog | 11 +++++++++++ src/truetype/ttinterp.c | 26 +++++++++++++++++--------- 2 files changed, 28 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4cf4d5a5b..a0ec37bbc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2017-03-18 Werner Lemberg + + [truetype] Another limitation for bytecode loop count maximum. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=900 + + * src/truetype/ttinterp.c (TT_RunIns): Limit `loopcall_counter_max' + by number of glyphs also. + 2017-03-18 Werner Lemberg [ftfuzzer] Minor improvement. diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c index 44df298d5..f4f89b0e7 100644 --- a/src/truetype/ttinterp.c +++ b/src/truetype/ttinterp.c @@ -7605,15 +7605,16 @@ exc->twilight.n_points = (FT_UShort)num_twilight_points; } - /* Set up loop detectors. We restrict the number of LOOPCALL loops */ - /* and the number of JMPR, JROT, and JROF calls with a negative */ - /* argument to values that depend on the size of the CVT table and */ - /* the number of points in the current glyph (if applicable). */ - /* */ - /* The idea is that in real-world bytecode you either iterate over */ - /* all CVT entries (in the `prep' table), or over all points (or */ - /* contours, in the `glyf' table) of a glyph, and such iterations */ - /* don't happen very often. */ + /* Set up loop detectors. We restrict the number of LOOPCALL loops */ + /* and the number of JMPR, JROT, and JROF calls with a negative */ + /* argument to values that depend on various parameters like the */ + /* size of the CVT table or the number of points in the current */ + /* glyph (if applicable). */ + /* */ + /* The idea is that in real-world bytecode you either iterate over */ + /* all CVT entries (in the `prep' table), or over all points (or */ + /* contours, in the `glyf' table) of a glyph, and such iterations */ + /* don't happen very often. */ exc->loopcall_counter = 0; exc->neg_jump_counter = 0; @@ -7626,6 +7627,13 @@ else exc->loopcall_counter_max = FT_MAX( 100, 5 * exc->cvtSize ); + + /* as a protection against an unreasonable number of CVT entries */ + /* we assume at most 100 control values per glyph for the counter */ + if ( exc->loopcall_counter_max > + 100 * (FT_ULong)exc->face->root.num_glyphs ) + exc->loopcall_counter_max = 100 * (FT_ULong)exc->face->root.num_glyphs; + FT_TRACE5(( "TT_RunIns: Limiting total number of loops in LOOPCALL" " to %d\n", exc->loopcall_counter_max )); From 3e79254ae73ba4e5f951967b42d38b0aa1460af8 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sat, 18 Mar 2017 10:06:15 +0100 Subject: [PATCH 021/470] * src/truetype/ttinterp.c (TT_RunIns): Adjust loop counter (#50573). The problematic font that exceeds the old limit is Lato-Regular, version 2.007, containing bytecode generated by a buggy version of ttfautohint. --- ChangeLog | 8 ++++++++ src/truetype/ttinterp.c | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index a0ec37bbc..ea14f23c7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2017-03-18 Werner Lemberg + + * src/truetype/ttinterp.c (TT_RunIns): Adjust loop counter (#50573). + + The problematic font that exceeds the old limit is Lato-Regular, + version 2.007, containing bytecode generated by a buggy version of + ttfautohint. + 2017-03-18 Werner Lemberg [truetype] Another limitation for bytecode loop count maximum. diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c index f4f89b0e7..000c30b23 100644 --- a/src/truetype/ttinterp.c +++ b/src/truetype/ttinterp.c @@ -7626,7 +7626,7 @@ exc->cvtSize / 10 ); else exc->loopcall_counter_max = FT_MAX( 100, - 5 * exc->cvtSize ); + 10 * exc->cvtSize ); /* as a protection against an unreasonable number of CVT entries */ /* we assume at most 100 control values per glyph for the counter */ From 7aeee3c50f2656b65f7dc207aa2020bb1398da98 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sat, 18 Mar 2017 17:30:42 +0100 Subject: [PATCH 022/470] Introduce FT_UINT_TO_POINTER macro (#50560). We have to make a separate case for Windows 64's LLP64 data model. * builds/unix/ftconfig.in, builds/vms/ftconfig.h, include/freetype/config/ftconfig.h (FT_UINT_TO_POINTER): New macro. * src/truetype/ttgload.c (load_truetype_glyph): Use it. --- ChangeLog | 11 +++++++++++ builds/unix/ftconfig.in | 9 +++++++++ builds/vms/ftconfig.h | 9 +++++++++ include/freetype/config/ftconfig.h | 9 +++++++++ src/truetype/ttgload.c | 6 +++--- 5 files changed, 41 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index ea14f23c7..6a6351868 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2017-03-18 Werner Lemberg + + Introduce FT_UINT_TO_POINTER macro (#50560). + + We have to make a separate case for Windows 64's LLP64 data model. + + * builds/unix/ftconfig.in, builds/vms/ftconfig.h, + include/freetype/config/ftconfig.h (FT_UINT_TO_POINTER): New macro. + + * src/truetype/ttgload.c (load_truetype_glyph): Use it. + 2017-03-18 Werner Lemberg * src/truetype/ttinterp.c (TT_RunIns): Adjust loop counter (#50573). diff --git a/builds/unix/ftconfig.in b/builds/unix/ftconfig.in index 0bc93f19a..b0ef313a8 100644 --- a/builds/unix/ftconfig.in +++ b/builds/unix/ftconfig.in @@ -365,6 +365,15 @@ FT_BEGIN_HEADER #endif +#ifdef _WIN64 + /* only 64bit Windows uses the LLP64 data model, i.e., */ + /* 32bit integers, 64bit pointers */ +#define FT_UINT_TO_POINTER( x ) (void*)(FT_UInt64)(x) +#else +#define FT_UINT_TO_POINTER( x ) (void*)(unsigned long)(x) +#endif + + /*************************************************************************/ /* */ /* miscellaneous */ diff --git a/builds/vms/ftconfig.h b/builds/vms/ftconfig.h index c959ff19f..8fbb0f4b7 100644 --- a/builds/vms/ftconfig.h +++ b/builds/vms/ftconfig.h @@ -306,6 +306,15 @@ FT_BEGIN_HEADER #endif +#ifdef _WIN64 + /* only 64bit Windows uses the LLP64 data model, i.e., */ + /* 32bit integers, 64bit pointers */ +#define FT_UINT_TO_POINTER( x ) (void*)(FT_UInt64)(x) +#else +#define FT_UINT_TO_POINTER( x ) (void*)(unsigned long)(x) +#endif + + /*************************************************************************/ /* */ /* miscellaneous */ diff --git a/include/freetype/config/ftconfig.h b/include/freetype/config/ftconfig.h index 9d7f8839b..0a1e4db8e 100644 --- a/include/freetype/config/ftconfig.h +++ b/include/freetype/config/ftconfig.h @@ -333,6 +333,15 @@ FT_BEGIN_HEADER #endif +#ifdef _WIN64 + /* only 64bit Windows uses the LLP64 data model, i.e., */ + /* 32bit integers, 64bit pointers */ +#define FT_UINT_TO_POINTER( x ) (void*)(FT_UInt64)(x) +#else +#define FT_UINT_TO_POINTER( x ) (void*)(unsigned long)(x) +#endif + + /*************************************************************************/ /* */ /* miscellaneous */ diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c index eecf7afdd..cd4634faa 100644 --- a/src/truetype/ttgload.c +++ b/src/truetype/ttgload.c @@ -1711,7 +1711,7 @@ /* check whether we already have a composite glyph with this index */ if ( FT_List_Find( &loader->composites, - (void*)(unsigned long)glyph_index ) ) + FT_UINT_TO_POINTER( glyph_index ) ) ) { FT_TRACE1(( "TT_Load_Composite_Glyph:" " infinite recursion detected\n" )); @@ -1720,13 +1720,13 @@ } else if ( node ) - node->data = (void*)(unsigned long)glyph_index; + node->data = FT_UINT_TO_POINTER( glyph_index ); else { if ( FT_NEW( node ) ) goto Exit; - node->data = (void*)(unsigned long)glyph_index; + node->data = FT_UINT_TO_POINTER( glyph_index ); FT_List_Add( &loader->composites, node ); } From dd64a6227ceda32a90c06f77cf44e23dad95cb78 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Mon, 20 Mar 2017 05:34:02 +0100 Subject: [PATCH 023/470] * src/cff/cffgload.c (cff_builder_init): Add safety guard (#50578). --- ChangeLog | 4 ++++ src/cff/cffgload.c | 7 +++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6a6351868..04a1932a7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2017-03-20 Werner Lemberg + + * src/cff/cffgload.c (cff_builder_init): Add safety guard (#50578). + 2017-03-18 Werner Lemberg Introduce FT_UINT_TO_POINTER macro (#50560). diff --git a/src/cff/cffgload.c b/src/cff/cffgload.c index 4803b4bbc..9ead7d399 100644 --- a/src/cff/cffgload.c +++ b/src/cff/cffgload.c @@ -281,8 +281,11 @@ CFF_Internal internal = (CFF_Internal)size->root.internal; - builder->hints_globals = (void *)internal->topfont; - builder->hints_funcs = glyph->root.internal->glyph_hints; + if ( internal ) + { + builder->hints_globals = (void *)internal->topfont; + builder->hints_funcs = glyph->root.internal->glyph_hints; + } } } From 6342da9a8d518544ad590b887a21c122c10f8773 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Mon, 20 Mar 2017 05:36:41 +0100 Subject: [PATCH 024/470] [sfnt] Don't add instances to non-variation fonts. * src/sfnt/sfobjs.c (sfnt_init_face): Fix it. --- ChangeLog | 6 ++++++ src/sfnt/sfobjs.c | 5 +++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 04a1932a7..74ce79529 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2017-03-20 Werner Lemberg + + [sfnt] Don't add instances to non-variation fonts. + + * src/sfnt/sfobjs.c (sfnt_init_face): Fix it. + 2017-03-20 Werner Lemberg * src/cff/cffgload.c (cff_builder_init): Add safety guard (#50578). diff --git a/src/sfnt/sfobjs.c b/src/sfnt/sfobjs.c index 0418d83ca..d3de9fcb3 100644 --- a/src/sfnt/sfobjs.c +++ b/src/sfnt/sfobjs.c @@ -1012,8 +1012,9 @@ * later on. Here, we have to adjust `num_instances' accordingly. */ - if ( !( FT_ALLOC( default_values, num_axes * 2 ) || - FT_ALLOC( instance_values, num_axes * 2 ) ) ) + if ( ( face->variation_support & TT_FACE_FLAG_VAR_FVAR ) && + !( FT_ALLOC( default_values, num_axes * 2 ) || + FT_ALLOC( instance_values, num_axes * 2 ) ) ) { /* the current stream position is 16 bytes after the table start */ FT_ULong array_start = FT_STREAM_POS() - 16 + offset; From 683e3ad93632d040e4cc10b71323b3ddfee351a3 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Tue, 21 Mar 2017 19:49:11 +0100 Subject: [PATCH 025/470] [truetype] Some variable renamings. Too much local variables holding different structures were called `metrics'. * src/truetype/ttdriver.c (tt_size_select): s/metrics/size_metrics/. * src/truetype/ttgload.c (tt_get_metrics_incr_overrids, compute_glyph_metrics): s/metrics/incr_metrics/. (load_sbit_image): s/metrics/sbit_metrics/. * src/truetype/ttobjs.c (tt_size_run_fpgm): s/metrics/size_metrics/. (tt_size_init_bytecode): s/metrics/tt_metrics/. (tt_size_reset): s/metrics/size_metrics/. --- ChangeLog | 17 +++++++++ src/truetype/ttdriver.c | 8 ++-- src/truetype/ttgload.c | 70 +++++++++++++++++----------------- src/truetype/ttobjs.c | 83 +++++++++++++++++++++-------------------- 4 files changed, 100 insertions(+), 78 deletions(-) diff --git a/ChangeLog b/ChangeLog index 74ce79529..9e0743184 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +2017-03-20 Werner Lemberg + + [truetype] Some variable renamings. + + Too much local variables holding different structures were called + `metrics'. + + * src/truetype/ttdriver.c (tt_size_select): s/metrics/size_metrics/. + + * src/truetype/ttgload.c (tt_get_metrics_incr_overrids, + compute_glyph_metrics): s/metrics/incr_metrics/. + (load_sbit_image): s/metrics/sbit_metrics/. + + * src/truetype/ttobjs.c (tt_size_run_fpgm): s/metrics/size_metrics/. + (tt_size_init_bytecode): s/metrics/tt_metrics/. + (tt_size_reset): s/metrics/size_metrics/. + 2017-03-20 Werner Lemberg [sfnt] Don't add instances to non-variation fonts. diff --git a/src/truetype/ttdriver.c b/src/truetype/ttdriver.c index 6f9b74691..4ec78e2f8 100644 --- a/src/truetype/ttdriver.c +++ b/src/truetype/ttdriver.c @@ -308,11 +308,13 @@ } else { - SFNT_Service sfnt = (SFNT_Service)ttface->sfnt; - FT_Size_Metrics* metrics = &size->metrics; + SFNT_Service sfnt = (SFNT_Service)ttface->sfnt; + FT_Size_Metrics* size_metrics = &size->metrics; - error = sfnt->load_strike_metrics( ttface, strike_index, metrics ); + error = sfnt->load_strike_metrics( ttface, + strike_index, + size_metrics ); if ( error ) ttsize->strike_index = 0xFFFFFFFFUL; } diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c index cd4634faa..9cdcf1012 100644 --- a/src/truetype/ttgload.c +++ b/src/truetype/ttgload.c @@ -194,39 +194,39 @@ if ( face->root.internal->incremental_interface && face->root.internal->incremental_interface->funcs->get_glyph_metrics ) { - FT_Incremental_MetricsRec metrics; + FT_Incremental_MetricsRec incr_metrics; FT_Error error; - metrics.bearing_x = loader->left_bearing; - metrics.bearing_y = 0; - metrics.advance = loader->advance; - metrics.advance_v = 0; + incr_metrics.bearing_x = loader->left_bearing; + incr_metrics.bearing_y = 0; + incr_metrics.advance = loader->advance; + incr_metrics.advance_v = 0; error = face->root.internal->incremental_interface->funcs->get_glyph_metrics( face->root.internal->incremental_interface->object, - glyph_index, FALSE, &metrics ); + glyph_index, FALSE, &incr_metrics ); if ( error ) goto Exit; - left_bearing = (FT_Short)metrics.bearing_x; - advance_width = (FT_UShort)metrics.advance; + left_bearing = (FT_Short)incr_metrics.bearing_x; + advance_width = (FT_UShort)incr_metrics.advance; #if 0 /* GWW: Do I do the same for vertical metrics? */ - metrics.bearing_x = 0; - metrics.bearing_y = loader->top_bearing; - metrics.advance = loader->vadvance; + incr_metrics.bearing_x = 0; + incr_metrics.bearing_y = loader->top_bearing; + incr_metrics.advance = loader->vadvance; error = face->root.internal->incremental_interface->funcs->get_glyph_metrics( face->root.internal->incremental_interface->object, - glyph_index, TRUE, &metrics ); + glyph_index, TRUE, &incr_metrics ); if ( error ) goto Exit; - top_bearing = (FT_Short)metrics.bearing_y; - advance_height = (FT_UShort)metrics.advance; + top_bearing = (FT_Short)incr_metrics.bearing_y; + advance_height = (FT_UShort)incr_metrics.advance; #endif /* 0 */ @@ -2151,7 +2151,7 @@ #ifdef FT_CONFIG_OPTION_INCREMENTAL { FT_Incremental_InterfaceRec* incr; - FT_Incremental_MetricsRec metrics; + FT_Incremental_MetricsRec incr_metrics; FT_Error error; @@ -2161,19 +2161,19 @@ /* overriding metrics for this glyph. */ if ( incr && incr->funcs->get_glyph_metrics ) { - metrics.bearing_x = 0; - metrics.bearing_y = top; - metrics.advance = advance; + incr_metrics.bearing_x = 0; + incr_metrics.bearing_y = top; + incr_metrics.advance = advance; error = incr->funcs->get_glyph_metrics( incr->object, glyph_index, TRUE, - &metrics ); + &incr_metrics ); if ( error ) return error; - top = metrics.bearing_y; - advance = metrics.advance; + top = incr_metrics.bearing_y; + advance = incr_metrics.advance; } } @@ -2215,7 +2215,7 @@ SFNT_Service sfnt; FT_Stream stream; FT_Error error; - TT_SBit_MetricsRec metrics; + TT_SBit_MetricsRec sbit_metrics; face = (TT_Face)glyph->face; @@ -2228,34 +2228,34 @@ (FT_UInt)load_flags, stream, &glyph->bitmap, - &metrics ); + &sbit_metrics ); if ( !error ) { glyph->outline.n_points = 0; glyph->outline.n_contours = 0; - glyph->metrics.width = (FT_Pos)metrics.width * 64; - glyph->metrics.height = (FT_Pos)metrics.height * 64; + glyph->metrics.width = (FT_Pos)sbit_metrics.width * 64; + glyph->metrics.height = (FT_Pos)sbit_metrics.height * 64; - glyph->metrics.horiBearingX = (FT_Pos)metrics.horiBearingX * 64; - glyph->metrics.horiBearingY = (FT_Pos)metrics.horiBearingY * 64; - glyph->metrics.horiAdvance = (FT_Pos)metrics.horiAdvance * 64; + glyph->metrics.horiBearingX = (FT_Pos)sbit_metrics.horiBearingX * 64; + glyph->metrics.horiBearingY = (FT_Pos)sbit_metrics.horiBearingY * 64; + glyph->metrics.horiAdvance = (FT_Pos)sbit_metrics.horiAdvance * 64; - glyph->metrics.vertBearingX = (FT_Pos)metrics.vertBearingX * 64; - glyph->metrics.vertBearingY = (FT_Pos)metrics.vertBearingY * 64; - glyph->metrics.vertAdvance = (FT_Pos)metrics.vertAdvance * 64; + glyph->metrics.vertBearingX = (FT_Pos)sbit_metrics.vertBearingX * 64; + glyph->metrics.vertBearingY = (FT_Pos)sbit_metrics.vertBearingY * 64; + glyph->metrics.vertAdvance = (FT_Pos)sbit_metrics.vertAdvance * 64; glyph->format = FT_GLYPH_FORMAT_BITMAP; if ( load_flags & FT_LOAD_VERTICAL_LAYOUT ) { - glyph->bitmap_left = metrics.vertBearingX; - glyph->bitmap_top = metrics.vertBearingY; + glyph->bitmap_left = sbit_metrics.vertBearingX; + glyph->bitmap_top = sbit_metrics.vertBearingY; } else { - glyph->bitmap_left = metrics.horiBearingX; - glyph->bitmap_top = metrics.horiBearingY; + glyph->bitmap_left = sbit_metrics.horiBearingX; + glyph->bitmap_top = sbit_metrics.horiBearingY; } } diff --git a/src/truetype/ttobjs.c b/src/truetype/ttobjs.c index fd0c4ddd3..27e0931a3 100644 --- a/src/truetype/ttobjs.c +++ b/src/truetype/ttobjs.c @@ -792,14 +792,14 @@ exec->pedantic_hinting = pedantic; { - FT_Size_Metrics* metrics = &exec->metrics; - TT_Size_Metrics* tt_metrics = &exec->tt_metrics; + FT_Size_Metrics* size_metrics = &exec->metrics; + TT_Size_Metrics* tt_metrics = &exec->tt_metrics; - metrics->x_ppem = 0; - metrics->y_ppem = 0; - metrics->x_scale = 0; - metrics->y_scale = 0; + size_metrics->x_ppem = 0; + size_metrics->y_ppem = 0; + size_metrics->x_scale = 0; + size_metrics->y_scale = 0; tt_metrics->ppem = 0; tt_metrics->scale = 0; @@ -1014,17 +1014,17 @@ /* Set default metrics */ { - TT_Size_Metrics* metrics = &size->ttmetrics; + TT_Size_Metrics* tt_metrics = &size->ttmetrics; - metrics->rotated = FALSE; - metrics->stretched = FALSE; + tt_metrics->rotated = FALSE; + tt_metrics->stretched = FALSE; /* set default engine compensation */ - metrics->compensations[0] = 0; /* gray */ - metrics->compensations[1] = 0; /* black */ - metrics->compensations[2] = 0; /* white */ - metrics->compensations[3] = 0; /* reserved */ + tt_metrics->compensations[0] = 0; /* gray */ + tt_metrics->compensations[1] = 0; /* black */ + tt_metrics->compensations[2] = 0; /* white */ + tt_metrics->compensations[3] = 0; /* reserved */ } /* allocate function defs, instruction defs, cvt, and storage area */ @@ -1209,7 +1209,7 @@ FT_Bool only_height ) { TT_Face face; - FT_Size_Metrics* metrics; + FT_Size_Metrics* size_metrics; face = (TT_Face)size->root.face; @@ -1220,12 +1220,12 @@ size->ttmetrics.valid = FALSE; - metrics = &size->metrics; + size_metrics = &size->metrics; /* copy the result from base layer */ - *metrics = size->root.metrics; + *size_metrics = size->root.metrics; - if ( metrics->x_ppem < 1 || metrics->y_ppem < 1 ) + if ( size_metrics->x_ppem < 1 || size_metrics->y_ppem < 1 ) return FT_THROW( Invalid_PPem ); /* This bit flag, if set, indicates that the ppems must be */ @@ -1234,12 +1234,15 @@ /* */ if ( face->header.Flags & 8 ) { - metrics->ascender = - FT_PIX_ROUND( FT_MulFix( face->root.ascender, metrics->y_scale ) ); - metrics->descender = - FT_PIX_ROUND( FT_MulFix( face->root.descender, metrics->y_scale ) ); - metrics->height = - FT_PIX_ROUND( FT_MulFix( face->root.height, metrics->y_scale ) ); + size_metrics->ascender = FT_PIX_ROUND( + FT_MulFix( face->root.ascender, + size_metrics->y_scale ) ); + size_metrics->descender = FT_PIX_ROUND( + FT_MulFix( face->root.descender, + size_metrics->y_scale ) ); + size_metrics->height = FT_PIX_ROUND( + FT_MulFix( face->root.height, + size_metrics->y_scale ) ); } size->ttmetrics.valid = TRUE; @@ -1249,31 +1252,31 @@ if ( face->header.Flags & 8 ) { - metrics->x_scale = FT_DivFix( metrics->x_ppem << 6, - face->root.units_per_EM ); - metrics->y_scale = FT_DivFix( metrics->y_ppem << 6, - face->root.units_per_EM ); - - metrics->max_advance = - FT_PIX_ROUND( FT_MulFix( face->root.max_advance_width, - metrics->x_scale ) ); + size_metrics->x_scale = FT_DivFix( size_metrics->x_ppem << 6, + face->root.units_per_EM ); + size_metrics->y_scale = FT_DivFix( size_metrics->y_ppem << 6, + face->root.units_per_EM ); + + size_metrics->max_advance = FT_PIX_ROUND( + FT_MulFix( face->root.max_advance_width, + size_metrics->x_scale ) ); } /* compute new transformation */ - if ( metrics->x_ppem >= metrics->y_ppem ) + if ( size_metrics->x_ppem >= size_metrics->y_ppem ) { - size->ttmetrics.scale = metrics->x_scale; - size->ttmetrics.ppem = metrics->x_ppem; + size->ttmetrics.scale = size_metrics->x_scale; + size->ttmetrics.ppem = size_metrics->x_ppem; size->ttmetrics.x_ratio = 0x10000L; - size->ttmetrics.y_ratio = FT_DivFix( metrics->y_ppem, - metrics->x_ppem ); + size->ttmetrics.y_ratio = FT_DivFix( size_metrics->y_ppem, + size_metrics->x_ppem ); } else { - size->ttmetrics.scale = metrics->y_scale; - size->ttmetrics.ppem = metrics->y_ppem; - size->ttmetrics.x_ratio = FT_DivFix( metrics->x_ppem, - metrics->y_ppem ); + size->ttmetrics.scale = size_metrics->y_scale; + size->ttmetrics.ppem = size_metrics->y_ppem; + size->ttmetrics.x_ratio = FT_DivFix( size_metrics->x_ppem, + size_metrics->y_ppem ); size->ttmetrics.y_ratio = 0x10000L; } From 67ff7664e4cce992764e70cde25381d07377afee Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Thu, 23 Mar 2017 12:41:30 +0100 Subject: [PATCH 026/470] Make MM fonts work (again). * src/base/ftmm.c (FT_Set_Var_Design_Coordinates, FT_Set_MM_Blend_Coordinates, FT_Set_Var_Blend_Coordinates): Ignore return value of `ft_face_get_mvar_service'; instead, check whether a service is actually returned. --- ChangeLog | 9 +++++++++ src/base/ftmm.c | 21 +++++++++------------ 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9e0743184..f34409209 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2017-03-23 Werner Lemberg + + Make MM fonts work (again). + + * src/base/ftmm.c (FT_Set_Var_Design_Coordinates, + FT_Set_MM_Blend_Coordinates, FT_Set_Var_Blend_Coordinates): Ignore + return value of `ft_face_get_mvar_service'; instead, check whether a + service is actually returned. + 2017-03-20 Werner Lemberg [truetype] Some variable renamings. diff --git a/src/base/ftmm.c b/src/base/ftmm.c index 6aaa5f8b0..2cb56a39b 100644 --- a/src/base/ftmm.c +++ b/src/base/ftmm.c @@ -205,12 +205,11 @@ error = service_mm->set_var_design( face, num_coords, coords ); } - if ( !error ) - error = ft_face_get_mvar_service( face, &service_mvar ); - if ( !error ) { - if ( service_mvar->metrics_adjust ) + (void)ft_face_get_mvar_service( face, &service_mvar ); + + if ( service_mvar && service_mvar->metrics_adjust ) service_mvar->metrics_adjust( face ); } @@ -278,12 +277,11 @@ error = service_mm->set_mm_blend( face, num_coords, coords ); } - if ( !error ) - error = ft_face_get_mvar_service( face, &service_mvar ); - if ( !error ) { - if ( service_mvar->metrics_adjust ) + (void)ft_face_get_mvar_service( face, &service_mvar ); + + if ( service_mvar && service_mvar->metrics_adjust ) service_mvar->metrics_adjust( face ); } @@ -326,12 +324,11 @@ error = service_mm->set_mm_blend( face, num_coords, coords ); } - if ( !error ) - error = ft_face_get_mvar_service( face, &service_mvar ); - if ( !error ) { - if ( service_mvar->metrics_adjust ) + (void)ft_face_get_mvar_service( face, &service_mvar ); + + if ( service_mvar && service_mvar->metrics_adjust ) service_mvar->metrics_adjust( face ); } From 913f436d12dfe682c349eff8bf4cdd9065ff117d Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Thu, 23 Mar 2017 18:37:06 +0100 Subject: [PATCH 027/470] [sfnt] Fix check for default named instance. * src/sfnt/sfobjs.c (sfnt_init_face): A `fixed' number needs four bytes, not two... --- ChangeLog | 7 +++++++ src/sfnt/sfobjs.c | 12 ++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index f34409209..a98267a63 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2017-03-23 Werner Lemberg + + [sfnt] Fix check for default named instance. + + * src/sfnt/sfobjs.c (sfnt_init_face): A `fixed' number needs four + bytes, not two... + 2017-03-23 Werner Lemberg Make MM fonts work (again). diff --git a/src/sfnt/sfobjs.c b/src/sfnt/sfobjs.c index d3de9fcb3..ac2e620e5 100644 --- a/src/sfnt/sfobjs.c +++ b/src/sfnt/sfobjs.c @@ -1013,8 +1013,8 @@ */ if ( ( face->variation_support & TT_FACE_FLAG_VAR_FVAR ) && - !( FT_ALLOC( default_values, num_axes * 2 ) || - FT_ALLOC( instance_values, num_axes * 2 ) ) ) + !( FT_ALLOC( default_values, num_axes * 4 ) || + FT_ALLOC( instance_values, num_axes * 4 ) ) ) { /* the current stream position is 16 bytes after the table start */ FT_ULong array_start = FT_STREAM_POS() - 16 + offset; @@ -1029,10 +1029,10 @@ for ( i = 0; i < num_axes; i++ ) { - (void)FT_STREAM_READ_AT( default_value_offset, p, 2 ); + (void)FT_STREAM_READ_AT( default_value_offset, p, 4 ); default_value_offset += axis_size; - p += 2; + p += 4; } instance_offset = array_start + axis_size * num_axes + 4; @@ -1041,9 +1041,9 @@ { (void)FT_STREAM_READ_AT( instance_offset, instance_values, - num_axes * 2 ); + num_axes * 4 ); - if ( !ft_memcmp( default_values, instance_values, num_axes * 2 ) ) + if ( !ft_memcmp( default_values, instance_values, num_axes * 4 ) ) break; instance_offset += instance_size; From f958c48ee431bef8d4d466b40c9cb2d4dbcb7791 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Fri, 24 Mar 2017 09:15:10 +0100 Subject: [PATCH 028/470] [psaux] Better protect `flex' handling. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=935 * src/psaux/t1decode.c (t1_decoder_parse_charstrings) : Since there is not a single flex operator but a series of subroutine calls, malformed fonts can call arbitrary other operators after the start of a flex, possibly adding points. For this reason we have to check the available number of points before inserting a point. --- ChangeLog | 15 +++++++++++++++ src/psaux/t1decode.c | 9 +++++++++ 2 files changed, 24 insertions(+) diff --git a/ChangeLog b/ChangeLog index a98267a63..01e9a7be1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2017-03-23 Werner Lemberg + + [psaux] Better protect `flex' handling. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=935 + + * src/psaux/t1decode.c (t1_decoder_parse_charstrings) + : Since there is not a single flex operator but a + series of subroutine calls, malformed fonts can call arbitrary other + operators after the start of a flex, possibly adding points. For + this reason we have to check the available number of points before + inserting a point. + 2017-03-23 Werner Lemberg [sfnt] Fix check for default named instance. diff --git a/src/psaux/t1decode.c b/src/psaux/t1decode.c index af7b465ed..7dd45135d 100644 --- a/src/psaux/t1decode.c +++ b/src/psaux/t1decode.c @@ -780,10 +780,19 @@ /* point without adding any point to the outline */ idx = decoder->num_flex_vectors++; if ( idx > 0 && idx < 7 ) + { + /* in malformed fonts it is possible to have other */ + /* opcodes in the middle of a flex (which don't */ + /* increase `num_flex_vectors'); we thus have to */ + /* check whether we can add a point */ + if ( FT_SET_ERROR( t1_builder_check_points( builder, 1 ) ) ) + goto Syntax_Error; + t1_builder_add_point( builder, x, y, (FT_Byte)( idx == 3 || idx == 6 ) ); + } } break; From 3774fc08b502c3e685afca098b6e8a195aded6a0 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sun, 26 Mar 2017 08:32:09 +0200 Subject: [PATCH 029/470] * src/psaux/psobjs.c (t1_builder_close_contour): Add safety guard. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=941 --- ChangeLog | 8 ++++++++ src/psaux/psobjs.c | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/ChangeLog b/ChangeLog index 01e9a7be1..3d782e9de 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2017-03-26 Werner Lemberg + + * src/psaux/psobjs.c (t1_builder_close_contour): Add safety guard. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=941 + 2017-03-23 Werner Lemberg [psaux] Better protect `flex' handling. diff --git a/src/psaux/psobjs.c b/src/psaux/psobjs.c index d18e821a9..0baf83686 100644 --- a/src/psaux/psobjs.c +++ b/src/psaux/psobjs.c @@ -1718,6 +1718,14 @@ first = outline->n_contours <= 1 ? 0 : outline->contours[outline->n_contours - 2] + 1; + /* in malformed fonts it can happen that a contour was started */ + /* but no points were added */ + if ( outline->n_contours && first == outline->n_points ) + { + outline->n_contours--; + return; + } + /* We must not include the last point in the path if it */ /* is located on the first point. */ if ( outline->n_points > 1 ) From c22a9aa245ed03516801a22894a235c88bbc5bc7 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Mon, 27 Mar 2017 07:57:24 +0200 Subject: [PATCH 030/470] [pcf] Fix compiler warnings. Reported by Alexander Hedges . * src/pcf/pcfdrivr.c (pcf_property_set, pcf_property_get): Tag `property_name' with `FT_UNUSED' where necessary. --- ChangeLog | 9 +++++++++ src/pcf/pcfdrivr.c | 6 ++++++ 2 files changed, 15 insertions(+) diff --git a/ChangeLog b/ChangeLog index 3d782e9de..1bc0dde4e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2017-03-27 Werner Lemberg + + [pcf] Fix compiler warnings. + + Reported by Alexander Hedges . + + * src/pcf/pcfdrivr.c (pcf_property_set, pcf_property_get): Tag + `property_name' with `FT_UNUSED' where necessary. + 2017-03-26 Werner Lemberg * src/psaux/psobjs.c (t1_builder_close_contour): Add safety guard. diff --git a/src/pcf/pcfdrivr.c b/src/pcf/pcfdrivr.c index bc6542372..9f4d36d11 100644 --- a/src/pcf/pcfdrivr.c +++ b/src/pcf/pcfdrivr.c @@ -722,6 +722,9 @@ THE SOFTWARE. FT_UNUSED( module ); FT_UNUSED( value ); FT_UNUSED( value_is_string ); +#ifndef FT_DEBUG_LEVEL_TRACE + FT_UNUSED( property_name ); +#endif #endif /* !PCF_CONFIG_OPTION_LONG_FAMILY_NAMES */ @@ -757,6 +760,9 @@ THE SOFTWARE. FT_UNUSED( module ); FT_UNUSED( value ); +#ifndef FT_DEBUG_LEVEL_TRACE + FT_UNUSED( property_name ); +#endif #endif /* !PCF_CONFIG_OPTION_LONG_FAMILY_NAMES */ From 565f5a7d19d23aa7b3d6f917e5ef6b297b89f384 Mon Sep 17 00:00:00 2001 From: Wojciech Mamrak Date: Mon, 27 Mar 2017 09:19:14 +0200 Subject: [PATCH 031/470] [sfnt] Minor improvement for handling kern tables. * src/sfnt/ttkern.c (tt_face_load_kern): Don't check for cross-stream kerning tables since we reject format 2 tables later on anyways. Modify code for limit test... (tt_face_get_kerning): ... to avoid a limit test here. --- ChangeLog | 10 ++++++++++ src/sfnt/ttkern.c | 7 +++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1bc0dde4e..1e5eee668 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2017-03-27 Wojciech Mamrak + + [sfnt] Minor improvement for handling kern tables. + + * src/sfnt/ttkern.c (tt_face_load_kern): Don't check for + cross-stream kerning tables since we reject format 2 tables later + on anyways. + Modify code for limit test... + (tt_face_get_kerning): ... to avoid a limit test here. + 2017-03-27 Werner Lemberg [pcf] Fix compiler warnings. diff --git a/src/sfnt/ttkern.c b/src/sfnt/ttkern.c index 78dc5eb87..c97e5789a 100644 --- a/src/sfnt/ttkern.c +++ b/src/sfnt/ttkern.c @@ -108,8 +108,8 @@ p_next = p_limit; /* only use horizontal kerning tables */ - if ( ( coverage & ~8U ) != 0x0001 || - p + 8 > p_limit ) + if ( ( coverage & 3U ) != 0x0001 || + p + 8 > p_next ) goto NextTable; num_pairs = FT_NEXT_USHORT( p ); @@ -214,8 +214,7 @@ if ( ( face->kern_avail_bits & mask ) == 0 ) goto NextTable; - if ( p + 8 > next ) - goto NextTable; + FT_ASSERT( p + 8 <= next ); /* tested in tt_face_load_kern */ num_pairs = FT_NEXT_USHORT( p ); p += 6; From 208e712de049f01d23e18dfe4fda5ee019fe5191 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Mon, 27 Mar 2017 20:56:23 +0200 Subject: [PATCH 032/470] [cid, truetype] Don't use `index' as a variable name. At least on FreeBSD there is a global declaration of `index' in file `/usr/include/strings.h'. * src/cff/cf2intrp.c, src/truetype/ttgload.c: s/index/idx/ where appropriate. --- ChangeLog | 10 ++++++++++ src/truetype/ttgload.c | 6 +++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1e5eee668..a2afd1598 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2017-03-27 Werner Lemberg + + [cid, truetype] Don't use `index' as a variable name. + + At least on FreeBSD there is a global declaration of `index' in file + `/usr/include/strings.h'. + + * src/cff/cf2intrp.c, src/truetype/ttgload.c: s/index/idx/ where + appropriate. + 2017-03-27 Wojciech Mamrak [sfnt] Minor improvement for handling kern tables. diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c index 9cdcf1012..35b62d0eb 100644 --- a/src/truetype/ttgload.c +++ b/src/truetype/ttgload.c @@ -1394,7 +1394,7 @@ /* a utility function to retrieve i-th node from given FT_List */ static FT_ListNode ft_list_get_node_at( FT_List list, - FT_UInt index ) + FT_UInt idx ) { FT_ListNode cur; @@ -1404,10 +1404,10 @@ for ( cur = list->head; cur; cur = cur->next ) { - if ( !index ) + if ( !idx ) return cur; - index--; + idx--; } return NULL; From 4c1b5dc152d2bd8e63431c9e708e3b851835d8d6 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Mon, 27 Mar 2017 21:00:17 +0200 Subject: [PATCH 033/470] s/index/idx/ where appropriate. --- src/cff/cf2intrp.c | 180 ++++++++++++++++++++++----------------------- 1 file changed, 90 insertions(+), 90 deletions(-) diff --git a/src/cff/cf2intrp.c b/src/cff/cf2intrp.c index 62c696d08..40bd9059a 100644 --- a/src/cff/cf2intrp.c +++ b/src/cff/cf2intrp.c @@ -333,14 +333,14 @@ FT_Bool doConditionalLastRead ) { CF2_Fixed vals[14]; - CF2_UInt index; + CF2_UInt idx; FT_Bool isHFlex; CF2_Int top, i, j; vals[0] = *curX; vals[1] = *curY; - index = 0; + idx = 0; isHFlex = FT_BOOL( readFromStack[9] == FALSE ); top = isHFlex ? 9 : 10; @@ -348,7 +348,7 @@ { vals[i + 2] = vals[i]; if ( readFromStack[i] ) - vals[i + 2] += cf2_stack_getReal( opStack, index++ ); + vals[i + 2] += cf2_stack_getReal( opStack, idx++ ); } if ( isHFlex ) @@ -358,7 +358,7 @@ { FT_Bool lastIsX = (FT_Bool)( cf2_fixedAbs( vals[10] - *curX ) > cf2_fixedAbs( vals[11] - *curY ) ); - CF2_Fixed lastVal = cf2_stack_getReal( opStack, index ); + CF2_Fixed lastVal = cf2_stack_getReal( opStack, idx ); if ( lastIsX ) @@ -375,12 +375,12 @@ else { if ( readFromStack[10] ) - vals[12] = vals[10] + cf2_stack_getReal( opStack, index++ ); + vals[12] = vals[10] + cf2_stack_getReal( opStack, idx++ ); else vals[12] = *curX; if ( readFromStack[11] ) - vals[13] = vals[11] + cf2_stack_getReal( opStack, index ); + vals[13] = vals[11] + cf2_stack_getReal( opStack, idx ); else vals[13] = *curY; } @@ -775,16 +775,16 @@ case cf2_cmdRLINETO: { - CF2_UInt index; + CF2_UInt idx; CF2_UInt count = cf2_stack_count( opStack ); FT_TRACE4(( " rlineto\n" )); - for ( index = 0; index < count; index += 2 ) + for ( idx = 0; idx < count; idx += 2 ) { - curX += cf2_stack_getReal( opStack, index + 0 ); - curY += cf2_stack_getReal( opStack, index + 1 ); + curX += cf2_stack_getReal( opStack, idx + 0 ); + curY += cf2_stack_getReal( opStack, idx + 1 ); cf2_glyphpath_lineTo( &glyphPath, curX, curY ); } @@ -796,7 +796,7 @@ case cf2_cmdHLINETO: case cf2_cmdVLINETO: { - CF2_UInt index; + CF2_UInt idx; CF2_UInt count = cf2_stack_count( opStack ); FT_Bool isX = FT_BOOL( op1 == cf2_cmdHLINETO ); @@ -804,9 +804,9 @@ FT_TRACE4(( isX ? " hlineto\n" : " vlineto\n" )); - for ( index = 0; index < count; index++ ) + for ( idx = 0; idx < count; idx++ ) { - CF2_Fixed v = cf2_stack_getReal( opStack, index ); + CF2_Fixed v = cf2_stack_getReal( opStack, idx ); if ( isX ) @@ -827,33 +827,33 @@ case cf2_cmdRRCURVETO: { CF2_UInt count = cf2_stack_count( opStack ); - CF2_UInt index = 0; + CF2_UInt idx = 0; FT_TRACE4(( op1 == cf2_cmdRCURVELINE ? " rcurveline\n" : " rrcurveto\n" )); - while ( index + 6 <= count ) + while ( idx + 6 <= count ) { - CF2_Fixed x1 = cf2_stack_getReal( opStack, index + 0 ) + curX; - CF2_Fixed y1 = cf2_stack_getReal( opStack, index + 1 ) + curY; - CF2_Fixed x2 = cf2_stack_getReal( opStack, index + 2 ) + x1; - CF2_Fixed y2 = cf2_stack_getReal( opStack, index + 3 ) + y1; - CF2_Fixed x3 = cf2_stack_getReal( opStack, index + 4 ) + x2; - CF2_Fixed y3 = cf2_stack_getReal( opStack, index + 5 ) + y2; + CF2_Fixed x1 = cf2_stack_getReal( opStack, idx + 0 ) + curX; + CF2_Fixed y1 = cf2_stack_getReal( opStack, idx + 1 ) + curY; + CF2_Fixed x2 = cf2_stack_getReal( opStack, idx + 2 ) + x1; + CF2_Fixed y2 = cf2_stack_getReal( opStack, idx + 3 ) + y1; + CF2_Fixed x3 = cf2_stack_getReal( opStack, idx + 4 ) + x2; + CF2_Fixed y3 = cf2_stack_getReal( opStack, idx + 5 ) + y2; cf2_glyphpath_curveTo( &glyphPath, x1, y1, x2, y2, x3, y3 ); - curX = x3; - curY = y3; - index += 6; + curX = x3; + curY = y3; + idx += 6; } if ( op1 == cf2_cmdRCURVELINE ) { - curX += cf2_stack_getReal( opStack, index + 0 ); - curY += cf2_stack_getReal( opStack, index + 1 ); + curX += cf2_stack_getReal( opStack, idx + 0 ); + curY += cf2_stack_getReal( opStack, idx + 1 ); cf2_glyphpath_lineTo( &glyphPath, curX, curY ); } @@ -1600,35 +1600,35 @@ case cf2_cmdRLINECURVE: { CF2_UInt count = cf2_stack_count( opStack ); - CF2_UInt index = 0; + CF2_UInt idx = 0; FT_TRACE4(( " rlinecurve\n" )); - while ( index + 6 < count ) + while ( idx + 6 < count ) { - curX += cf2_stack_getReal( opStack, index + 0 ); - curY += cf2_stack_getReal( opStack, index + 1 ); + curX += cf2_stack_getReal( opStack, idx + 0 ); + curY += cf2_stack_getReal( opStack, idx + 1 ); cf2_glyphpath_lineTo( &glyphPath, curX, curY ); - index += 2; + idx += 2; } - while ( index < count ) + while ( idx < count ) { - CF2_Fixed x1 = cf2_stack_getReal( opStack, index + 0 ) + curX; - CF2_Fixed y1 = cf2_stack_getReal( opStack, index + 1 ) + curY; - CF2_Fixed x2 = cf2_stack_getReal( opStack, index + 2 ) + x1; - CF2_Fixed y2 = cf2_stack_getReal( opStack, index + 3 ) + y1; - CF2_Fixed x3 = cf2_stack_getReal( opStack, index + 4 ) + x2; - CF2_Fixed y3 = cf2_stack_getReal( opStack, index + 5 ) + y2; + CF2_Fixed x1 = cf2_stack_getReal( opStack, idx + 0 ) + curX; + CF2_Fixed y1 = cf2_stack_getReal( opStack, idx + 1 ) + curY; + CF2_Fixed x2 = cf2_stack_getReal( opStack, idx + 2 ) + x1; + CF2_Fixed y2 = cf2_stack_getReal( opStack, idx + 3 ) + y1; + CF2_Fixed x3 = cf2_stack_getReal( opStack, idx + 4 ) + x2; + CF2_Fixed y3 = cf2_stack_getReal( opStack, idx + 5 ) + y2; cf2_glyphpath_curveTo( &glyphPath, x1, y1, x2, y2, x3, y3 ); - curX = x3; - curY = y3; - index += 6; + curX = x3; + curY = y3; + idx += 6; } cf2_stack_clear( opStack ); @@ -1638,42 +1638,42 @@ case cf2_cmdVVCURVETO: { CF2_UInt count, count1 = cf2_stack_count( opStack ); - CF2_UInt index = 0; + CF2_UInt idx = 0; /* if `cf2_stack_count' isn't of the form 4n or 4n+1, */ /* we enforce it by clearing the second bit */ /* (and sorting the stack indexing to suit) */ - count = count1 & ~2U; - index += count1 - count; + count = count1 & ~2U; + idx += count1 - count; FT_TRACE4(( " vvcurveto\n" )); - while ( index < count ) + while ( idx < count ) { CF2_Fixed x1, y1, x2, y2, x3, y3; - if ( ( count - index ) & 1 ) + if ( ( count - idx ) & 1 ) { - x1 = cf2_stack_getReal( opStack, index ) + curX; + x1 = cf2_stack_getReal( opStack, idx ) + curX; - index++; + idx++; } else x1 = curX; - y1 = cf2_stack_getReal( opStack, index + 0 ) + curY; - x2 = cf2_stack_getReal( opStack, index + 1 ) + x1; - y2 = cf2_stack_getReal( opStack, index + 2 ) + y1; + y1 = cf2_stack_getReal( opStack, idx + 0 ) + curY; + x2 = cf2_stack_getReal( opStack, idx + 1 ) + x1; + y2 = cf2_stack_getReal( opStack, idx + 2 ) + y1; x3 = x2; - y3 = cf2_stack_getReal( opStack, index + 3 ) + y2; + y3 = cf2_stack_getReal( opStack, idx + 3 ) + y2; cf2_glyphpath_curveTo( &glyphPath, x1, y1, x2, y2, x3, y3 ); - curX = x3; - curY = y3; - index += 4; + curX = x3; + curY = y3; + idx += 4; } cf2_stack_clear( opStack ); @@ -1683,42 +1683,42 @@ case cf2_cmdHHCURVETO: { CF2_UInt count, count1 = cf2_stack_count( opStack ); - CF2_UInt index = 0; + CF2_UInt idx = 0; /* if `cf2_stack_count' isn't of the form 4n or 4n+1, */ /* we enforce it by clearing the second bit */ /* (and sorting the stack indexing to suit) */ - count = count1 & ~2U; - index += count1 - count; + count = count1 & ~2U; + idx += count1 - count; FT_TRACE4(( " hhcurveto\n" )); - while ( index < count ) + while ( idx < count ) { CF2_Fixed x1, y1, x2, y2, x3, y3; - if ( ( count - index ) & 1 ) + if ( ( count - idx ) & 1 ) { - y1 = cf2_stack_getReal( opStack, index ) + curY; + y1 = cf2_stack_getReal( opStack, idx ) + curY; - index++; + idx++; } else y1 = curY; - x1 = cf2_stack_getReal( opStack, index + 0 ) + curX; - x2 = cf2_stack_getReal( opStack, index + 1 ) + x1; - y2 = cf2_stack_getReal( opStack, index + 2 ) + y1; - x3 = cf2_stack_getReal( opStack, index + 3 ) + x2; + x1 = cf2_stack_getReal( opStack, idx + 0 ) + curX; + x2 = cf2_stack_getReal( opStack, idx + 1 ) + x1; + y2 = cf2_stack_getReal( opStack, idx + 2 ) + y1; + x3 = cf2_stack_getReal( opStack, idx + 3 ) + x2; y3 = y2; cf2_glyphpath_curveTo( &glyphPath, x1, y1, x2, y2, x3, y3 ); - curX = x3; - curY = y3; - index += 4; + curX = x3; + curY = y3; + idx += 4; } cf2_stack_clear( opStack ); @@ -1729,7 +1729,7 @@ case cf2_cmdHVCURVETO: { CF2_UInt count, count1 = cf2_stack_count( opStack ); - CF2_UInt index = 0; + CF2_UInt idx = 0; FT_Bool alternate = FT_BOOL( op1 == cf2_cmdHVCURVETO ); @@ -1738,29 +1738,29 @@ /* 8n+4, or 8n+5, we enforce it by clearing the */ /* second bit */ /* (and sorting the stack indexing to suit) */ - count = count1 & ~2U; - index += count1 - count; + count = count1 & ~2U; + idx += count1 - count; FT_TRACE4(( alternate ? " hvcurveto\n" : " vhcurveto\n" )); - while ( index < count ) + while ( idx < count ) { CF2_Fixed x1, x2, x3, y1, y2, y3; if ( alternate ) { - x1 = cf2_stack_getReal( opStack, index + 0 ) + curX; + x1 = cf2_stack_getReal( opStack, idx + 0 ) + curX; y1 = curY; - x2 = cf2_stack_getReal( opStack, index + 1 ) + x1; - y2 = cf2_stack_getReal( opStack, index + 2 ) + y1; - y3 = cf2_stack_getReal( opStack, index + 3 ) + y2; + x2 = cf2_stack_getReal( opStack, idx + 1 ) + x1; + y2 = cf2_stack_getReal( opStack, idx + 2 ) + y1; + y3 = cf2_stack_getReal( opStack, idx + 3 ) + y2; - if ( count - index == 5 ) + if ( count - idx == 5 ) { - x3 = cf2_stack_getReal( opStack, index + 4 ) + x2; + x3 = cf2_stack_getReal( opStack, idx + 4 ) + x2; - index++; + idx++; } else x3 = x2; @@ -1770,16 +1770,16 @@ else { x1 = curX; - y1 = cf2_stack_getReal( opStack, index + 0 ) + curY; - x2 = cf2_stack_getReal( opStack, index + 1 ) + x1; - y2 = cf2_stack_getReal( opStack, index + 2 ) + y1; - x3 = cf2_stack_getReal( opStack, index + 3 ) + x2; + y1 = cf2_stack_getReal( opStack, idx + 0 ) + curY; + x2 = cf2_stack_getReal( opStack, idx + 1 ) + x1; + y2 = cf2_stack_getReal( opStack, idx + 2 ) + y1; + x3 = cf2_stack_getReal( opStack, idx + 3 ) + x2; - if ( count - index == 5 ) + if ( count - idx == 5 ) { - y3 = cf2_stack_getReal( opStack, index + 4 ) + y2; + y3 = cf2_stack_getReal( opStack, idx + 4 ) + y2; - index++; + idx++; } else y3 = y2; @@ -1789,9 +1789,9 @@ cf2_glyphpath_curveTo( &glyphPath, x1, y1, x2, y2, x3, y3 ); - curX = x3; - curY = y3; - index += 4; + curX = x3; + curY = y3; + idx += 4; } cf2_stack_clear( opStack ); From 1ede3674cbb61888cccaf30a83536654b1c9d4e8 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Thu, 30 Mar 2017 00:26:31 +0200 Subject: [PATCH 034/470] [truetype] Fix thinko related to PS name of default named instance. * src/truetype/ttgxvar.c (TT_Get_MM_Var): `strid' and `psid' are name ID values, not indices into the array of name entries. --- ChangeLog | 7 +++++++ src/truetype/ttgxvar.c | 33 +++++++++++++++++---------------- 2 files changed, 24 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index a2afd1598..9dc20c050 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2017-03-29 Werner Lemberg + + [truetype] Fix thinko related to PS name of default named instance. + + * src/truetype/ttgxvar.c (TT_Get_MM_Var): `strid' and `psid' are + name ID values, not indices into the array of name entries. + 2017-03-27 Werner Lemberg [cid, truetype] Don't use `index' as a variable name. diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c index 55b7b0d5b..a87913d8c 100644 --- a/src/truetype/ttgxvar.c +++ b/src/truetype/ttgxvar.c @@ -2171,42 +2171,43 @@ { SFNT_Service sfnt = (SFNT_Service)face->sfnt; - FT_Int found, win, apple; + FT_Int found, dummy1, dummy2; + FT_UInt strid = 0xFFFFFFFFUL; /* the default instance is missing in array the */ /* of named instances; try to synthesize an entry */ found = sfnt->get_name_id( face, TT_NAME_ID_TYPOGRAPHIC_SUBFAMILY, - &win, - &apple ); - if ( !found ) + &dummy1, + &dummy2 ); + if ( found ) + strid = TT_NAME_ID_TYPOGRAPHIC_SUBFAMILY; + else + { found = sfnt->get_name_id( face, TT_NAME_ID_FONT_SUBFAMILY, - &win, - &apple ); + &dummy1, + &dummy2 ); + if ( found ) + strid = TT_NAME_ID_FONT_SUBFAMILY; + } if ( found ) { - FT_Int strid = win >= 0 ? win : apple; - - found = sfnt->get_name_id( face, TT_NAME_ID_PS_NAME, - &win, - &apple ); + &dummy1, + &dummy2 ); if ( found ) { - FT_Int psid = win >= 0 ? win : apple; - - FT_TRACE5(( "TT_Get_MM_Var:" " Adding default instance to named instances\n" )); ns = &mmvar->namedstyle[fvar_head.instanceCount]; - ns->strid = (FT_UInt)strid; - ns->psid = (FT_UInt)psid; + ns->strid = strid; + ns->psid = TT_NAME_ID_PS_NAME; a = mmvar->axis; c = ns->coords; From bcc74f4dafee25ea89f1d3144646cba7e30f9908 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Thu, 30 Mar 2017 13:14:43 +0200 Subject: [PATCH 035/470] [truetype] Allow linear scaling for unhinted rendering (#50470). * src/truetype/ttdriver.c (tt_size_request): Revert change from 2011-07-16; the intended metrics fix seems now to be implemented in a different way, making the patch unnecessary. Note that this change was usually patched out by all major GNU/Linux distributions due to heavy side effects. * src/truetype/ttgload.c (compute_glyph_metrics, TT_Load_Glyph): Refer to the metrics of the `TT_Size' object. --- ChangeLog | 13 +++++++++++++ src/truetype/ttdriver.c | 3 +-- src/truetype/ttgload.c | 10 +++++----- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9dc20c050..65c492e6d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2017-03-30 Werner Lemberg + + [truetype] Allow linear scaling for unhinted rendering (#50470). + + * src/truetype/ttdriver.c (tt_size_request): Revert change from + 2011-07-16; the intended metrics fix seems now to be implemented in + a different way, making the patch unnecessary. Note that this + change was usually patched out by all major GNU/Linux distributions + due to heavy side effects. + + * src/truetype/ttgload.c (compute_glyph_metrics, TT_Load_Glyph): + Refer to the metrics of the `TT_Size' object. + 2017-03-29 Werner Lemberg [truetype] Fix thinko related to PS name of default named instance. diff --git a/src/truetype/ttdriver.c b/src/truetype/ttdriver.c index 4ec78e2f8..9bf0f84fc 100644 --- a/src/truetype/ttdriver.c +++ b/src/truetype/ttdriver.c @@ -356,8 +356,7 @@ if ( FT_IS_SCALABLE( size->face ) ) { - error = tt_size_reset( ttsize, 0 ); - ttsize->root.metrics = ttsize->metrics; + error = tt_size_reset( ttsize, 0 ); #ifdef TT_USE_BYTECODE_INTERPRETER /* for the `MPS' bytecode instruction we need the point size */ diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c index 35b62d0eb..b225190a6 100644 --- a/src/truetype/ttgload.c +++ b/src/truetype/ttgload.c @@ -2037,7 +2037,7 @@ y_scale = 0x10000L; if ( ( loader->load_flags & FT_LOAD_NO_SCALE ) == 0 ) - y_scale = size->root.metrics.y_scale; + y_scale = size->metrics.y_scale; if ( glyph->format != FT_GLYPH_FORMAT_COMPOSITE ) FT_Outline_Get_CBox( &glyph->outline, &bbox ); @@ -2069,7 +2069,7 @@ widthp = tt_face_get_device_metrics( face, - size->root.metrics.x_ppem, + size->metrics.x_ppem, glyph_index ); #ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY @@ -2636,11 +2636,11 @@ if ( !glyph->metrics.horiAdvance && glyph->linearHoriAdvance ) glyph->metrics.horiAdvance = FT_MulFix( glyph->linearHoriAdvance, - size->root.metrics.x_scale ); + size->metrics.x_scale ); if ( !glyph->metrics.vertAdvance && glyph->linearVertAdvance ) glyph->metrics.vertAdvance = FT_MulFix( glyph->linearVertAdvance, - size->root.metrics.y_scale ); + size->metrics.y_scale ); } return FT_Err_Ok; @@ -2736,7 +2736,7 @@ /* TrueType glyphs at all sizes using the bytecode interpreter. */ /* */ if ( !( load_flags & FT_LOAD_NO_SCALE ) && - size->root.metrics.y_ppem < 24 ) + size->metrics.y_ppem < 24 ) glyph->outline.flags |= FT_OUTLINE_HIGH_PRECISION; Exit: From da38be831d2c8ea5443c73d01ecfbc750bba7045 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Thu, 30 Mar 2017 13:24:03 +0200 Subject: [PATCH 036/470] [truetype] Fix HVAR and VVAR handling (#50678). * src/truetype/ttgxvar.c (tt_hvadvance_adjust): Handle glyph indices larger than `mapCount' as described in the specification. --- ChangeLog | 8 ++++++++ src/truetype/ttgxvar.c | 15 +++++++-------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 65c492e6d..c7413718e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2017-03-30 Werner Lemberg + + [truetype] Fix HVAR and VVAR handling (#50678). + + * src/truetype/ttgxvar.c (tt_hvadvance_adjust): Handle + glyph indices larger than `mapCount' as described in the + specification. + 2017-03-30 Werner Lemberg [truetype] Allow linear scaling for unhinted rendering (#50470). diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c index a87913d8c..6d4529ba5 100644 --- a/src/truetype/ttgxvar.c +++ b/src/truetype/ttgxvar.c @@ -1007,16 +1007,15 @@ if ( table->widthMap.innerIndex ) { - if ( gindex >= table->widthMap.mapCount ) - { - FT_TRACE2(( "gindex %d out of range\n", gindex )); - error = FT_THROW( Invalid_Argument ); - goto Exit; - } + FT_UInt idx = gindex; + + + if ( idx >= table->widthMap.mapCount ) + idx = table->widthMap.mapCount - 1; /* trust that HVAR parser has checked indices */ - outerIndex = table->widthMap.outerIndex[gindex]; - innerIndex = table->widthMap.innerIndex[gindex]; + outerIndex = table->widthMap.outerIndex[idx]; + innerIndex = table->widthMap.innerIndex[idx]; } else { From c8c6763988ebc4ce1c93c099ae2401b677035c60 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Thu, 30 Mar 2017 21:07:17 +0200 Subject: [PATCH 037/470] * src/cff/cffparse.h (CFF2_DEFAULT_STACK): Set to 513 also. Requested by Dave Arnold. --- ChangeLog | 6 ++++++ src/cff/cffparse.h | 10 +++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index c7413718e..df655affb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2017-03-30 Werner Lemberg + + * src/cff/cffparse.h (CFF2_DEFAULT_STACK): Set to 513 also. + + Requested by Dave Arnold. + 2017-03-30 Werner Lemberg [truetype] Fix HVAR and VVAR handling (#50678). diff --git a/src/cff/cffparse.h b/src/cff/cffparse.h index 9976d42b1..83d1bba45 100644 --- a/src/cff/cffparse.h +++ b/src/cff/cffparse.h @@ -31,8 +31,16 @@ FT_BEGIN_HEADER /* CFF uses constant parser stack size; */ /* CFF2 can increase from default 193 */ #define CFF_MAX_STACK_DEPTH 96 + + /* + * There are plans to remove the `maxstack' operator in a forthcoming + * revision of the CFF2 specification, increasing the (then static) stack + * size to 513. By making the default stack size equal to the maximum + * stack size, the operator is essentially disabled, which has the + * desired effect in FreeType. + */ #define CFF2_MAX_STACK 513 -#define CFF2_DEFAULT_STACK 193 +#define CFF2_DEFAULT_STACK 513 #define CFF_CODE_TOPDICT 0x1000 #define CFF_CODE_PRIVATE 0x2000 From 5a3490e054bda8a318ebde482c7fb30213cab3d9 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Fri, 31 Mar 2017 09:35:58 +0200 Subject: [PATCH 038/470] * src/cff/cffload.c (cff_font_load): Improve fix from 2017-01-04. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Allow CFFs containing a single font to have an empty font name. Problem reported by 張俊芝 <418092625@qq.com> in http://lists.nongnu.org/archive/html/freetype-devel/2017-03/msg00074.html --- ChangeLog | 10 ++++++++++ src/cff/cffload.c | 6 ++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index df655affb..f0e7a9b23 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2017-03-31 Werner Lemberg + + * src/cff/cffload.c (cff_font_load): Improve fix from 2017-01-04. + + Allow CFFs containing a single font to have an empty font name. + + Problem reported by 張俊芝 <418092625@qq.com> in + + http://lists.nongnu.org/archive/html/freetype-devel/2017-03/msg00074.html + 2017-03-30 Werner Lemberg * src/cff/cffparse.h (CFF2_DEFAULT_STACK): Set to 513 also. diff --git a/src/cff/cffload.c b/src/cff/cffload.c index 91e74f32c..3beaeb1c8 100644 --- a/src/cff/cffload.c +++ b/src/cff/cffload.c @@ -2280,8 +2280,10 @@ goto Exit; } - /* font names must not be empty */ - if ( font->name_index.data_size < font->name_index.count ) + /* if we have an empty font name, */ + /* it must be the only font in the CFF */ + if ( font->name_index.count > 1 && + font->name_index.data_size < font->name_index.count ) { /* for pure CFFs, we still haven't checked enough bytes */ /* to be sure that it is a CFF at all */ From 54b58097ee7dd8bf8db5dc0c925ad220e5770f8c Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Fri, 31 Mar 2017 22:41:53 -0400 Subject: [PATCH 039/470] [autofit] Disable stem adjustment for `FT_LOAD_TARGET_LCD'. * include/freetype/freetype.h (FT_LOAD_TARGET_LCD): Document it. * src/autofit/afcjk.c (af_cjk_hints_init): Updated. * src/autofit/aflatin.c (af_latin_hints_init): Ditto. * src/autofit/aflatin2.c (af_latin2_hints_init): Ditto. --- ChangeLog | 9 +++++++++ include/freetype/freetype.h | 2 +- src/autofit/afcjk.c | 4 ++-- src/autofit/aflatin.c | 4 ++-- src/autofit/aflatin2.c | 4 ++-- 5 files changed, 16 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index f0e7a9b23..e23f5a0c3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2017-03-31 Alexei Podtelezhnikov + + [autofit] Disable stem adjustment for `FT_LOAD_TARGET_LCD'. + + * include/freetype/freetype.h (FT_LOAD_TARGET_LCD): Document it. + * src/autofit/afcjk.c (af_cjk_hints_init): Updated. + * src/autofit/aflatin.c (af_latin_hints_init): Ditto. + * src/autofit/aflatin2.c (af_latin2_hints_init): Ditto. + 2017-03-31 Werner Lemberg * src/cff/cffload.c (cff_font_load): Improve fix from 2017-01-04. diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h index 7b65e2174..21e2d3131 100644 --- a/include/freetype/freetype.h +++ b/include/freetype/freetype.h @@ -2940,7 +2940,7 @@ FT_BEGIN_HEADER * in non-monochrome modes. * * FT_LOAD_TARGET_LCD :: - * A variant of @FT_LOAD_TARGET_NORMAL optimized for horizontally + * A variant of @FT_LOAD_TARGET_LIGHT optimized for horizontally * decimated LCD displays. * * FT_LOAD_TARGET_LCD_V :: diff --git a/src/autofit/afcjk.c b/src/autofit/afcjk.c index ec05ee4d9..61e29cded 100644 --- a/src/autofit/afcjk.c +++ b/src/autofit/afcjk.c @@ -1398,9 +1398,9 @@ other_flags |= AF_LATIN_HINTS_VERT_SNAP; /* - * We adjust stems to full pixels only if we don't use the `light' mode. + * We adjust stems to full pixels unless in `light' or `lcd' mode. */ - if ( mode != FT_RENDER_MODE_LIGHT ) + if ( mode != FT_RENDER_MODE_LIGHT && mode != FT_RENDER_MODE_LCD ) other_flags |= AF_LATIN_HINTS_STEM_ADJUST; if ( mode == FT_RENDER_MODE_MONO ) diff --git a/src/autofit/aflatin.c b/src/autofit/aflatin.c index b983460d8..1b07b5b6c 100644 --- a/src/autofit/aflatin.c +++ b/src/autofit/aflatin.c @@ -2575,9 +2575,9 @@ other_flags |= AF_LATIN_HINTS_VERT_SNAP; /* - * We adjust stems to full pixels only if we don't use the `light' mode. + * We adjust stems to full pixels unless in `light' or `lcd' mode. */ - if ( mode != FT_RENDER_MODE_LIGHT ) + if ( mode != FT_RENDER_MODE_LIGHT && mode != FT_RENDER_MODE_LCD ) other_flags |= AF_LATIN_HINTS_STEM_ADJUST; if ( mode == FT_RENDER_MODE_MONO ) diff --git a/src/autofit/aflatin2.c b/src/autofit/aflatin2.c index cc2312648..c215f29a7 100644 --- a/src/autofit/aflatin2.c +++ b/src/autofit/aflatin2.c @@ -1558,9 +1558,9 @@ other_flags |= AF_LATIN_HINTS_VERT_SNAP; /* - * We adjust stems to full pixels only if we don't use the `light' mode. + * We adjust stems to full pixels unless in `light' or `lcd' mode. */ - if ( mode != FT_RENDER_MODE_LIGHT ) + if ( mode != FT_RENDER_MODE_LIGHT && mode != FT_RENDER_MODE_LCD ) other_flags |= AF_LATIN_HINTS_STEM_ADJUST; if ( mode == FT_RENDER_MODE_MONO ) From bb6c037bae83131c37c6255db7bdd8880047a6d5 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sat, 1 Apr 2017 09:49:11 +0200 Subject: [PATCH 040/470] * src/truetype/ttgload.c: Include FT_CONFIG_CONFIG_H. Otherwise FT_UINT_TO_POINTER might not be defined. Problem reported by Alexei. --- ChangeLog | 8 ++++++++ src/truetype/ttgload.c | 1 + 2 files changed, 9 insertions(+) diff --git a/ChangeLog b/ChangeLog index e23f5a0c3..c07da84de 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2017-04-01 Werner Lemberg + + * src/truetype/ttgload.c: Include FT_CONFIG_CONFIG_H. + + Otherwise FT_UINT_TO_POINTER might not be defined. + + Problem reported by Alexei. + 2017-03-31 Alexei Podtelezhnikov [autofit] Disable stem adjustment for `FT_LOAD_TARGET_LCD'. diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c index b225190a6..8962be560 100644 --- a/src/truetype/ttgload.c +++ b/src/truetype/ttgload.c @@ -18,6 +18,7 @@ #include #include FT_INTERNAL_DEBUG_H +#include FT_CONFIG_CONFIG_H #include FT_INTERNAL_CALC_H #include FT_INTERNAL_STREAM_H #include FT_INTERNAL_SFNT_H From e7b013044e18d7942af9d529a83d7fbb2d1da756 Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Sun, 2 Apr 2017 22:01:47 -0400 Subject: [PATCH 041/470] [autofit] Disable metrics adjustment for `FT_LOAD_TARGET_LCD'. * src/autofit/aflatin.c (af_latin_hints_init): Updated. * src/autofit/aflatin2.c (af_latin2_hints_init): Ditto. --- ChangeLog | 7 +++++++ src/autofit/aflatin.c | 6 +++--- src/autofit/aflatin2.c | 6 +++--- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index c07da84de..f39195811 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2017-04-02 Alexei Podtelezhnikov + + [autofit] Disable metrics adjustment for `FT_LOAD_TARGET_LCD'. + + * src/autofit/aflatin.c (af_latin_hints_init): Updated. + * src/autofit/aflatin2.c (af_latin2_hints_init): Ditto. + 2017-04-01 Werner Lemberg * src/truetype/ttgload.c: Include FT_CONFIG_CONFIG_H. diff --git a/src/autofit/aflatin.c b/src/autofit/aflatin.c index 1b07b5b6c..11fa523c8 100644 --- a/src/autofit/aflatin.c +++ b/src/autofit/aflatin.c @@ -2584,14 +2584,14 @@ other_flags |= AF_LATIN_HINTS_MONO; /* - * In `light' hinting mode we disable horizontal hinting completely. + * In `light' or `lcd' mode we disable horizontal hinting completely. * We also do it if the face is italic. * * However, if warping is enabled (which only works in `light' hinting * mode), advance widths get adjusted, too. */ - if ( mode == FT_RENDER_MODE_LIGHT || - ( face->style_flags & FT_STYLE_FLAG_ITALIC ) != 0 ) + if ( mode == FT_RENDER_MODE_LIGHT || mode == FT_RENDER_MODE_LCD || + ( face->style_flags & FT_STYLE_FLAG_ITALIC ) != 0 ) scaler_flags |= AF_SCALER_FLAG_NO_HORIZONTAL; #ifdef AF_CONFIG_OPTION_USE_WARPER diff --git a/src/autofit/aflatin2.c b/src/autofit/aflatin2.c index c215f29a7..0607278b1 100644 --- a/src/autofit/aflatin2.c +++ b/src/autofit/aflatin2.c @@ -1567,11 +1567,11 @@ other_flags |= AF_LATIN_HINTS_MONO; /* - * In `light' hinting mode we disable horizontal hinting completely. + * In `light' or `lcd' mode we disable horizontal hinting completely. * We also do it if the face is italic. */ - if ( mode == FT_RENDER_MODE_LIGHT || - ( face->style_flags & FT_STYLE_FLAG_ITALIC ) != 0 ) + if ( mode == FT_RENDER_MODE_LIGHT || mode == FT_RENDER_MODE_LCD || + ( face->style_flags & FT_STYLE_FLAG_ITALIC ) != 0 ) scaler_flags |= AF_SCALER_FLAG_NO_HORIZONTAL; #ifdef AF_CONFIG_OPTION_USE_WARPER From 093c18205858cb073d71a91ae96d35438e30cd0a Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Mon, 3 Apr 2017 11:37:33 +0200 Subject: [PATCH 042/470] [truetype] Avoid reexecution of `fpgm' and `prep' in case of error. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=981 * include/freetype/fterrdef.h (FT_Err_DEF_In_Glyf_Bytecode): New error code. * src/truetype/ttinterp.c (Ins_FDEF, Ins_IDEF): Prohibit execution of these two opcodes in `glyf' bytecode. (TT_RunIns): Don't enforce reexecution of `fpgm' and `prep' bytecode in case of error since function tables can no longer be modified (due to the changes in `Ins_FDEF' and `Ins_IDEF'). This change can enormously speed up handling of broken fonts. --- ChangeLog | 18 ++++++++++++++++++ include/freetype/fterrdef.h | 2 ++ src/truetype/ttinterp.c | 25 +++++++++++++++---------- 3 files changed, 35 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index f39195811..b6cc3b644 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,21 @@ +2017-04-03 Werner Lemberg + + [truetype] Avoid reexecution of `fpgm' and `prep' in case of error. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=981 + + * include/freetype/fterrdef.h (FT_Err_DEF_In_Glyf_Bytecode): New + error code. + + * src/truetype/ttinterp.c (Ins_FDEF, Ins_IDEF): Prohibit execution + of these two opcodes in `glyf' bytecode. + (TT_RunIns): Don't enforce reexecution of `fpgm' and `prep' bytecode + in case of error since function tables can no longer be modified + (due to the changes in `Ins_FDEF' and `Ins_IDEF'). This change can + enormously speed up handling of broken fonts. + 2017-04-02 Alexei Podtelezhnikov [autofit] Disable metrics adjustment for `FT_LOAD_TARGET_LCD'. diff --git a/include/freetype/fterrdef.h b/include/freetype/fterrdef.h index 232dccdc6..cabbac827 100644 --- a/include/freetype/fterrdef.h +++ b/include/freetype/fterrdef.h @@ -231,6 +231,8 @@ "invalid PostScript (post) table format" ) FT_ERRORDEF_( Invalid_Post_Table, 0x9B, "invalid PostScript (post) table" ) + FT_ERRORDEF_( DEF_In_Glyf_Bytecode, 0x9C, + "found FDEF or IDEF opcode in glyf bytecode" ) /* CFF, CID, and Type 1 errors */ diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c index 000c30b23..fed377d97 100644 --- a/src/truetype/ttinterp.c +++ b/src/truetype/ttinterp.c @@ -3564,6 +3564,13 @@ #endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */ + /* FDEF is only allowed in `prep' or `fpgm' */ + if ( exc->curRange == tt_coderange_glyph ) + { + exc->error = FT_THROW( DEF_In_Glyf_Bytecode ); + return; + } + /* some font programs are broken enough to redefine functions! */ /* We will then parse the current table. */ @@ -3990,6 +3997,13 @@ TT_DefRecord* limit; + /* we enable IDEF only in `prep' or `fpgm' */ + if ( exc->curRange == tt_coderange_glyph ) + { + exc->error = FT_THROW( DEF_In_Glyf_Bytecode ); + return; + } + /* First of all, look for the same function in our table */ def = exc->IDefs; @@ -8408,17 +8422,8 @@ exc->error = FT_THROW( Code_Overflow ); LErrorLabel_: - /* If any errors have occurred, function tables may be broken. */ - /* Force a re-execution of `prep' and `fpgm' tables if no */ - /* bytecode debugger is run. */ - if ( exc->error && - !exc->instruction_trap && - exc->curRange == tt_coderange_glyph ) - { + if ( exc->error && !exc->instruction_trap ) FT_TRACE1(( " The interpreter returned error 0x%x\n", exc->error )); - exc->size->bytecode_ready = -1; - exc->size->cvt_ready = -1; - } return exc->error; } From 8210ee4b69569a04add80301c51ed226616ac93d Mon Sep 17 00:00:00 2001 From: Sascha Brawer Date: Thu, 6 Apr 2017 05:39:51 +0200 Subject: [PATCH 043/470] [autofit] Add support for Ol Chiki script. * src/autofit/afblue.dat: Add blue zone data for Ol Chiki. * src/autofit/afblue.c, src/autofit/afblue.h: Regenerated. * src/autofit/afscript.h: Add Ol Chiki standard character. * src/autofit/afranges.c, src/autofit/afstyles.h: Add Ol Chiki data. --- ChangeLog | 11 +++++++++++ src/autofit/afblue.c | 5 +++++ src/autofit/afblue.dat | 8 ++++++++ src/autofit/afblue.h | 42 ++++++++++++++++++++++-------------------- src/autofit/afranges.c | 12 ++++++++++++ src/autofit/afscript.h | 6 ++++++ src/autofit/afstyles.h | 7 +++++++ 7 files changed, 71 insertions(+), 20 deletions(-) diff --git a/ChangeLog b/ChangeLog index b6cc3b644..9a5d54973 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2017-04-06 Sascha Brawer + + [autofit] Add support for Ol Chiki script. + + * src/autofit/afblue.dat: Add blue zone data for Ol Chiki. + * src/autofit/afblue.c, src/autofit/afblue.h: Regenerated. + + * src/autofit/afscript.h: Add Ol Chiki standard character. + + * src/autofit/afranges.c, src/autofit/afstyles.h: Add Ol Chiki data. + 2017-04-03 Werner Lemberg [truetype] Avoid reexecution of `fpgm' and `prep' in case of error. diff --git a/src/autofit/afblue.c b/src/autofit/afblue.c index 524f68874..1cfb35530 100644 --- a/src/autofit/afblue.c +++ b/src/autofit/afblue.c @@ -206,6 +206,8 @@ '\0', '\xE1', '\x80', '\x89', ' ', '\xE1', '\x80', '\x8A', ' ', '\xE1', '\x80', '\xA5', ' ', '\xE1', '\x80', '\xA9', ' ', '\xE1', '\x80', '\xA8', ' ', '\xE1', '\x81', '\x82', ' ', '\xE1', '\x81', '\x85', ' ', '\xE1', '\x81', '\x89', /* ဉ ည ဥ ဩ ဨ ၂ ၅ ၉ */ '\0', + '\xE1', '\xB1', '\x9B', ' ', '\xE1', '\xB1', '\x9C', ' ', '\xE1', '\xB1', '\x9D', ' ', '\xE1', '\xB1', '\xA1', ' ', '\xE1', '\xB1', '\xA2', ' ', '\xE1', '\xB1', '\xA5', /* ᱛ ᱜ ᱝ ᱡ ᱢ ᱥ */ + '\0', '\xE0', '\xB6', '\x89', ' ', '\xE0', '\xB6', '\x9A', ' ', '\xE0', '\xB6', '\x9D', ' ', '\xE0', '\xB6', '\xB3', ' ', '\xE0', '\xB6', '\xB4', ' ', '\xE0', '\xB6', '\xBA', ' ', '\xE0', '\xB6', '\xBD', ' ', '\xE0', '\xB7', '\x86', /* ඉ ක ඝ ඳ ප ය ල ෆ */ '\0', '\xE0', '\xB6', '\x91', ' ', '\xE0', '\xB6', '\x94', ' ', '\xE0', '\xB6', '\x9D', ' ', '\xE0', '\xB6', '\xA2', ' ', '\xE0', '\xB6', '\xA7', ' ', '\xE0', '\xB6', '\xAE', ' ', '\xE0', '\xB6', '\xB0', ' ', '\xE0', '\xB6', '\xBB', /* එ ඔ ඝ ජ ට ථ ධ ර */ @@ -425,6 +427,9 @@ { AF_BLUE_STRING_MYANMAR_DESCENDER, 0 }, { AF_BLUE_STRING_MAX, 0 }, { AF_BLUE_STRING_MAX, 0 }, + { AF_BLUE_STRING_OL_CHIKI, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_OL_CHIKI, 0 }, + { AF_BLUE_STRING_MAX, 0 }, { AF_BLUE_STRING_SINHALA_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, { AF_BLUE_STRING_SINHALA_BOTTOM, 0 }, { AF_BLUE_STRING_SINHALA_DESCENDER, 0 }, diff --git a/src/autofit/afblue.dat b/src/autofit/afblue.dat index 8b75aecf3..c1f63fbe6 100644 --- a/src/autofit/afblue.dat +++ b/src/autofit/afblue.dat @@ -288,6 +288,9 @@ AF_BLUE_STRING_ENUM AF_BLUE_STRINGS_ARRAY AF_BLUE_STRING_MAX_LEN: AF_BLUE_STRING_MYANMAR_DESCENDER "ဉ ည ဥ ဩ ဨ ၂ ၅ ၉" + AF_BLUE_STRING_OL_CHIKI + "ᱛ ᱜ ᱝ ᱡ ᱢ ᱥ" + AF_BLUE_STRING_SINHALA_TOP "ඉ ක ඝ ඳ ප ය ල ෆ" AF_BLUE_STRING_SINHALA_BOTTOM @@ -674,6 +677,11 @@ AF_BLUE_STRINGSET_ENUM AF_BLUE_STRINGSETS_ARRAY AF_BLUE_STRINGSET_MAX_LEN: AF_BLUE_STRINGSET_NONE { AF_BLUE_STRING_MAX, 0 } + AF_BLUE_STRINGSET_OLCK + { AF_BLUE_STRING_OL_CHIKI, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_OL_CHIKI, 0 } + { AF_BLUE_STRING_MAX, 0 } + AF_BLUE_STRINGSET_SINH { AF_BLUE_STRING_SINHALA_TOP, AF_BLUE_PROPERTY_LATIN_TOP } { AF_BLUE_STRING_SINHALA_BOTTOM, 0 } diff --git a/src/autofit/afblue.h b/src/autofit/afblue.h index f4720edd5..56bc216df 100644 --- a/src/autofit/afblue.h +++ b/src/autofit/afblue.h @@ -167,21 +167,22 @@ FT_BEGIN_HEADER AF_BLUE_STRING_MYANMAR_BOTTOM = 2286, AF_BLUE_STRING_MYANMAR_ASCENDER = 2318, AF_BLUE_STRING_MYANMAR_DESCENDER = 2346, - AF_BLUE_STRING_SINHALA_TOP = 2378, - AF_BLUE_STRING_SINHALA_BOTTOM = 2410, - AF_BLUE_STRING_SINHALA_DESCENDER = 2442, - AF_BLUE_STRING_TAMIL_TOP = 2486, - AF_BLUE_STRING_TAMIL_BOTTOM = 2518, - AF_BLUE_STRING_TELUGU_TOP = 2550, - AF_BLUE_STRING_TELUGU_BOTTOM = 2578, - AF_BLUE_STRING_THAI_TOP = 2606, - AF_BLUE_STRING_THAI_BOTTOM = 2630, - AF_BLUE_STRING_THAI_ASCENDER = 2658, - AF_BLUE_STRING_THAI_LARGE_ASCENDER = 2670, - AF_BLUE_STRING_THAI_DESCENDER = 2682, - AF_BLUE_STRING_THAI_LARGE_DESCENDER = 2698, - AF_BLUE_STRING_THAI_DIGIT_TOP = 2706, - af_blue_1_1 = 2717, + AF_BLUE_STRING_OL_CHIKI = 2378, + AF_BLUE_STRING_SINHALA_TOP = 2402, + AF_BLUE_STRING_SINHALA_BOTTOM = 2434, + AF_BLUE_STRING_SINHALA_DESCENDER = 2466, + AF_BLUE_STRING_TAMIL_TOP = 2510, + AF_BLUE_STRING_TAMIL_BOTTOM = 2542, + AF_BLUE_STRING_TELUGU_TOP = 2574, + AF_BLUE_STRING_TELUGU_BOTTOM = 2602, + AF_BLUE_STRING_THAI_TOP = 2630, + AF_BLUE_STRING_THAI_BOTTOM = 2654, + AF_BLUE_STRING_THAI_ASCENDER = 2682, + AF_BLUE_STRING_THAI_LARGE_ASCENDER = 2694, + AF_BLUE_STRING_THAI_DESCENDER = 2706, + AF_BLUE_STRING_THAI_LARGE_DESCENDER = 2722, + AF_BLUE_STRING_THAI_DIGIT_TOP = 2730, + af_blue_1_1 = 2741, #ifdef AF_CONFIG_OPTION_CJK AF_BLUE_STRING_CJK_TOP = af_blue_1_1 + 1, AF_BLUE_STRING_CJK_BOTTOM = af_blue_1_1 + 203, @@ -263,11 +264,12 @@ FT_BEGIN_HEADER AF_BLUE_STRINGSET_MLYM = 112, AF_BLUE_STRINGSET_MYMR = 115, AF_BLUE_STRINGSET_NONE = 120, - AF_BLUE_STRINGSET_SINH = 121, - AF_BLUE_STRINGSET_TAML = 125, - AF_BLUE_STRINGSET_TELU = 128, - AF_BLUE_STRINGSET_THAI = 131, - af_blue_2_1 = 139, + AF_BLUE_STRINGSET_OLCK = 121, + AF_BLUE_STRINGSET_SINH = 124, + AF_BLUE_STRINGSET_TAML = 128, + AF_BLUE_STRINGSET_TELU = 131, + AF_BLUE_STRINGSET_THAI = 134, + af_blue_2_1 = 142, #ifdef AF_CONFIG_OPTION_CJK AF_BLUE_STRINGSET_HANI = af_blue_2_1 + 0, af_blue_2_1_1 = af_blue_2_1 + 2, diff --git a/src/autofit/afranges.c b/src/autofit/afranges.c index fdd28006f..24bc31fe2 100644 --- a/src/autofit/afranges.c +++ b/src/autofit/afranges.c @@ -515,6 +515,18 @@ }; + const AF_Script_UniRangeRec af_olck_uniranges[] = + { + AF_UNIRANGE_REC( 0x1C50, 0x1C7F ), /* Ol Chiki */ + AF_UNIRANGE_REC( 0, 0 ) + }; + + const AF_Script_UniRangeRec af_olck_nonbase_uniranges[] = + { + AF_UNIRANGE_REC( 0, 0 ) + }; + + const AF_Script_UniRangeRec af_sinh_uniranges[] = { AF_UNIRANGE_REC( 0x0D80, 0x0DFF ), /* Sinhala */ diff --git a/src/autofit/afscript.h b/src/autofit/afscript.h index c656c7839..c38b96fba 100644 --- a/src/autofit/afscript.h +++ b/src/autofit/afscript.h @@ -171,6 +171,12 @@ HINTING_BOTTOM_TO_TOP, "" ) + SCRIPT( olck, OLCK, + "Ol Chiki", + HB_SCRIPT_OL_CHIKI, + HINTING_BOTTOM_TO_TOP, + "\xE1\xB1\x9B" ) /* ᱛ */ + SCRIPT( sinh, SINH, "Sinhala", HB_SCRIPT_SINHALA, diff --git a/src/autofit/afstyles.h b/src/autofit/afstyles.h index 3afa8395e..eb9b8b1f8 100644 --- a/src/autofit/afstyles.h +++ b/src/autofit/afstyles.h @@ -238,6 +238,13 @@ AF_BLUE_STRINGSET_NONE, AF_COVERAGE_DEFAULT ) + STYLE( olck_dflt, OLCK_DFLT, + "Ol Chiki default style", + AF_WRITING_SYSTEM_LATIN, + AF_SCRIPT_OLCK, + AF_BLUE_STRINGSET_OLCK, + AF_COVERAGE_DEFAULT ) + STYLE( sinh_dflt, SINH_DFLT, "Sinhala default style", AF_WRITING_SYSTEM_LATIN, From ba9cee479a1af5aaebce3d940fcbb8c5a3f9a833 Mon Sep 17 00:00:00 2001 From: Sascha Brawer Date: Thu, 6 Apr 2017 05:50:44 +0200 Subject: [PATCH 044/470] [autofit] Add support for Adlam script. * src/autofit/afblue.dat: Add blue zone data for Adlam. * src/autofit/afblue.c, src/autofit/afblue.h: Regenerated. * src/autofit/afscript.h: Add Adlam standard characters. * src/autofit/afranges.c, src/autofit/afstyles.h: Add Adlam data. --- ChangeLog | 11 ++ src/autofit/afblue.c | 14 +++ src/autofit/afblue.dat | 17 +++ src/autofit/afblue.h | 275 +++++++++++++++++++++-------------------- src/autofit/afranges.c | 17 ++- src/autofit/afscript.h | 6 + src/autofit/afstyles.h | 7 ++ 7 files changed, 210 insertions(+), 137 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9a5d54973..2bff58990 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2017-04-06 Sascha Brawer + + [autofit] Add support for Adlam script. + + * src/autofit/afblue.dat: Add blue zone data for Adlam. + * src/autofit/afblue.c, src/autofit/afblue.h: Regenerated. + + * src/autofit/afscript.h: Add Adlam standard characters. + + * src/autofit/afranges.c, src/autofit/afstyles.h: Add Adlam data. + 2017-04-06 Sascha Brawer [autofit] Add support for Ol Chiki script. diff --git a/src/autofit/afblue.c b/src/autofit/afblue.c index 1cfb35530..6e434e95d 100644 --- a/src/autofit/afblue.c +++ b/src/autofit/afblue.c @@ -26,6 +26,14 @@ af_blue_strings[] = { /* */ + '\xF0', '\x9E', '\xA4', '\x8C', ' ', '\xF0', '\x9E', '\xA4', '\x85', ' ', '\xF0', '\x9E', '\xA4', '\x88', ' ', '\xF0', '\x9E', '\xA4', '\x8F', ' ', '\xF0', '\x9E', '\xA4', '\x94', ' ', '\xF0', '\x9E', '\xA4', '\x9A', /* 𞤌 𞤅 𞤈 𞤏 𞤔 𞤚 */ + '\0', + '\xF0', '\x9E', '\xA4', '\x82', ' ', '\xF0', '\x9E', '\xA4', '\x96', /* 𞤂 𞤖 */ + '\0', + '\xF0', '\x9E', '\xA4', '\xAC', ' ', '\xF0', '\x9E', '\xA4', '\xAE', ' ', '\xF0', '\x9E', '\xA4', '\xBB', ' ', '\xF0', '\x9E', '\xA4', '\xBC', ' ', '\xF0', '\x9E', '\xA4', '\xBE', /* 𞤬 𞤮 𞤻 𞤼 𞤾 */ + '\0', + '\xF0', '\x9E', '\xA4', '\xA4', ' ', '\xF0', '\x9E', '\xA4', '\xA8', ' ', '\xF0', '\x9E', '\xA4', '\xA9', ' ', '\xF0', '\x9E', '\xA4', '\xAD', ' ', '\xF0', '\x9E', '\xA4', '\xB4', ' ', '\xF0', '\x9E', '\xA4', '\xB8', ' ', '\xF0', '\x9E', '\xA4', '\xBA', ' ', '\xF0', '\x9E', '\xA5', '\x80', /* 𞤤 𞤨 𞤩 𞤭 𞤴 𞤸 𞤺 𞥀 */ + '\0', '\xD8', '\xA7', ' ', '\xD8', '\xA5', ' ', '\xD9', '\x84', ' ', '\xD9', '\x83', ' ', '\xD8', '\xB7', ' ', '\xD8', '\xB8', /* ا إ ل ك ط ظ */ '\0', '\xD8', '\xAA', ' ', '\xD8', '\xAB', ' ', '\xD8', '\xB7', ' ', '\xD8', '\xB8', ' ', '\xD9', '\x83', /* ت ث ط ظ ك */ @@ -285,6 +293,12 @@ af_blue_stringsets[] = { /* */ + { AF_BLUE_STRING_ADLAM_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_ADLAM_CAPITAL_BOTTOM, 0 }, + { AF_BLUE_STRING_ADLAM_SMALL_TOP, AF_BLUE_PROPERTY_LATIN_TOP | + AF_BLUE_PROPERTY_LATIN_X_HEIGHT }, + { AF_BLUE_STRING_ADLAM_SMALL_BOTTOM, 0 }, + { AF_BLUE_STRING_MAX, 0 }, { AF_BLUE_STRING_ARABIC_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, { AF_BLUE_STRING_ARABIC_BOTTOM, 0 }, { AF_BLUE_STRING_ARABIC_JOIN, AF_BLUE_PROPERTY_LATIN_NEUTRAL }, diff --git a/src/autofit/afblue.dat b/src/autofit/afblue.dat index c1f63fbe6..7b5c08425 100644 --- a/src/autofit/afblue.dat +++ b/src/autofit/afblue.dat @@ -74,6 +74,15 @@ AF_BLUE_STRING_ENUM AF_BLUE_STRINGS_ARRAY AF_BLUE_STRING_MAX_LEN: + AF_BLUE_STRING_ADLAM_CAPITAL_TOP + "𞤌 𞤅 𞤈 𞤏 𞤔 𞤚" + AF_BLUE_STRING_ADLAM_CAPITAL_BOTTOM + "𞤂 𞤖" + AF_BLUE_STRING_ADLAM_SMALL_TOP + "𞤬 𞤮 𞤻 𞤼 𞤾" + AF_BLUE_STRING_ADLAM_SMALL_BOTTOM + "𞤤 𞤨 𞤩 𞤭 𞤴 𞤸 𞤺 𞥀" + AF_BLUE_STRING_ARABIC_TOP "ا إ ل ك ط ظ" AF_BLUE_STRING_ARABIC_BOTTOM @@ -488,6 +497,14 @@ AF_BLUE_STRING_ENUM AF_BLUE_STRINGS_ARRAY AF_BLUE_STRING_MAX_LEN: AF_BLUE_STRINGSET_ENUM AF_BLUE_STRINGSETS_ARRAY AF_BLUE_STRINGSET_MAX_LEN: + AF_BLUE_STRINGSET_ADLM + { AF_BLUE_STRING_ADLAM_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_ADLAM_CAPITAL_BOTTOM, 0 } + { AF_BLUE_STRING_ADLAM_SMALL_TOP, AF_BLUE_PROPERTY_LATIN_TOP | + AF_BLUE_PROPERTY_LATIN_X_HEIGHT } + { AF_BLUE_STRING_ADLAM_SMALL_BOTTOM, 0 } + { AF_BLUE_STRING_MAX, 0 } + AF_BLUE_STRINGSET_ARAB { AF_BLUE_STRING_ARABIC_TOP, AF_BLUE_PROPERTY_LATIN_TOP } { AF_BLUE_STRING_ARABIC_BOTTOM, 0 } diff --git a/src/autofit/afblue.h b/src/autofit/afblue.h index 56bc216df..e290c47f4 100644 --- a/src/autofit/afblue.h +++ b/src/autofit/afblue.h @@ -77,112 +77,116 @@ FT_BEGIN_HEADER typedef enum AF_Blue_String_ { - AF_BLUE_STRING_ARABIC_TOP = 0, - AF_BLUE_STRING_ARABIC_BOTTOM = 18, - AF_BLUE_STRING_ARABIC_JOIN = 33, - AF_BLUE_STRING_ARMENIAN_CAPITAL_TOP = 36, - AF_BLUE_STRING_ARMENIAN_CAPITAL_BOTTOM = 60, - AF_BLUE_STRING_ARMENIAN_SMALL_ASCENDER = 84, - AF_BLUE_STRING_ARMENIAN_SMALL_TOP = 105, - AF_BLUE_STRING_ARMENIAN_SMALL_BOTTOM = 129, - AF_BLUE_STRING_ARMENIAN_SMALL_DESCENDER = 153, - AF_BLUE_STRING_BENGALI_BASE = 177, - AF_BLUE_STRING_BENGALI_TOP = 209, - AF_BLUE_STRING_BENGALI_HEAD = 237, - AF_BLUE_STRING_CHEROKEE_CAPITAL = 269, - AF_BLUE_STRING_CHEROKEE_SMALL_ASCENDER = 301, - AF_BLUE_STRING_CHEROKEE_SMALL = 333, - AF_BLUE_STRING_CHEROKEE_SMALL_DESCENDER = 365, - AF_BLUE_STRING_CYRILLIC_CAPITAL_TOP = 381, - AF_BLUE_STRING_CYRILLIC_CAPITAL_BOTTOM = 405, - AF_BLUE_STRING_CYRILLIC_SMALL = 429, - AF_BLUE_STRING_CYRILLIC_SMALL_DESCENDER = 453, - AF_BLUE_STRING_DEVANAGARI_BASE = 462, - AF_BLUE_STRING_DEVANAGARI_TOP = 494, - AF_BLUE_STRING_DEVANAGARI_HEAD = 526, - AF_BLUE_STRING_DEVANAGARI_BOTTOM = 558, - AF_BLUE_STRING_ETHIOPIC_TOP = 566, - AF_BLUE_STRING_ETHIOPIC_BOTTOM = 598, - AF_BLUE_STRING_GEORGIAN_MKHEDRULI_TOP = 630, - AF_BLUE_STRING_GEORGIAN_MKHEDRULI_BOTTOM = 662, - AF_BLUE_STRING_GEORGIAN_MKHEDRULI_ASCENDER = 694, - AF_BLUE_STRING_GEORGIAN_MKHEDRULI_DESCENDER = 726, - AF_BLUE_STRING_GEORGIAN_ASOMTAVRULI_TOP = 758, - AF_BLUE_STRING_GEORGIAN_ASOMTAVRULI_BOTTOM = 790, - AF_BLUE_STRING_GEORGIAN_NUSKHURI_TOP = 822, - AF_BLUE_STRING_GEORGIAN_NUSKHURI_BOTTOM = 854, - AF_BLUE_STRING_GEORGIAN_NUSKHURI_ASCENDER = 886, - AF_BLUE_STRING_GEORGIAN_NUSKHURI_DESCENDER = 918, - AF_BLUE_STRING_GREEK_CAPITAL_TOP = 950, - AF_BLUE_STRING_GREEK_CAPITAL_BOTTOM = 971, - AF_BLUE_STRING_GREEK_SMALL_BETA_TOP = 989, - AF_BLUE_STRING_GREEK_SMALL = 1007, - AF_BLUE_STRING_GREEK_SMALL_DESCENDER = 1031, - AF_BLUE_STRING_GUJARATI_TOP = 1055, - AF_BLUE_STRING_GUJARATI_BOTTOM = 1087, - AF_BLUE_STRING_GUJARATI_ASCENDER = 1119, - AF_BLUE_STRING_GUJARATI_DESCENDER = 1169, - AF_BLUE_STRING_GUJARATI_DIGIT_TOP = 1202, - AF_BLUE_STRING_GURMUKHI_BASE = 1222, - AF_BLUE_STRING_GURMUKHI_HEAD = 1254, - AF_BLUE_STRING_GURMUKHI_TOP = 1286, - AF_BLUE_STRING_GURMUKHI_BOTTOM = 1318, - AF_BLUE_STRING_GURMUKHI_DIGIT_TOP = 1350, - AF_BLUE_STRING_HEBREW_TOP = 1370, - AF_BLUE_STRING_HEBREW_BOTTOM = 1394, - AF_BLUE_STRING_HEBREW_DESCENDER = 1412, - AF_BLUE_STRING_KANNADA_TOP = 1427, - AF_BLUE_STRING_KANNADA_BOTTOM = 1471, - AF_BLUE_STRING_KHMER_TOP = 1503, - AF_BLUE_STRING_KHMER_SUBSCRIPT_TOP = 1527, - AF_BLUE_STRING_KHMER_BOTTOM = 1567, - AF_BLUE_STRING_KHMER_DESCENDER = 1599, - AF_BLUE_STRING_KHMER_LARGE_DESCENDER = 1633, - AF_BLUE_STRING_KHMER_SYMBOLS_WAXING_TOP = 1720, - AF_BLUE_STRING_KHMER_SYMBOLS_WANING_BOTTOM = 1728, - AF_BLUE_STRING_LAO_TOP = 1736, - AF_BLUE_STRING_LAO_BOTTOM = 1768, - AF_BLUE_STRING_LAO_ASCENDER = 1800, - AF_BLUE_STRING_LAO_LARGE_ASCENDER = 1816, - AF_BLUE_STRING_LAO_DESCENDER = 1828, - AF_BLUE_STRING_LATIN_CAPITAL_TOP = 1852, - AF_BLUE_STRING_LATIN_CAPITAL_BOTTOM = 1868, - AF_BLUE_STRING_LATIN_SMALL_F_TOP = 1884, - AF_BLUE_STRING_LATIN_SMALL_TOP = 1898, - AF_BLUE_STRING_LATIN_SMALL_BOTTOM = 1914, - AF_BLUE_STRING_LATIN_SMALL_DESCENDER = 1930, - AF_BLUE_STRING_LATIN_SUBS_CAPITAL_TOP = 1940, - AF_BLUE_STRING_LATIN_SUBS_CAPITAL_BOTTOM = 1960, - AF_BLUE_STRING_LATIN_SUBS_SMALL_F_TOP = 1980, - AF_BLUE_STRING_LATIN_SUBS_SMALL = 2000, - AF_BLUE_STRING_LATIN_SUBS_SMALL_DESCENDER = 2036, - AF_BLUE_STRING_LATIN_SUPS_CAPITAL_TOP = 2056, - AF_BLUE_STRING_LATIN_SUPS_CAPITAL_BOTTOM = 2087, - AF_BLUE_STRING_LATIN_SUPS_SMALL_F_TOP = 2116, - AF_BLUE_STRING_LATIN_SUPS_SMALL = 2142, - AF_BLUE_STRING_LATIN_SUPS_SMALL_DESCENDER = 2167, - AF_BLUE_STRING_MALAYALAM_TOP = 2178, - AF_BLUE_STRING_MALAYALAM_BOTTOM = 2222, - AF_BLUE_STRING_MYANMAR_TOP = 2254, - AF_BLUE_STRING_MYANMAR_BOTTOM = 2286, - AF_BLUE_STRING_MYANMAR_ASCENDER = 2318, - AF_BLUE_STRING_MYANMAR_DESCENDER = 2346, - AF_BLUE_STRING_OL_CHIKI = 2378, - AF_BLUE_STRING_SINHALA_TOP = 2402, - AF_BLUE_STRING_SINHALA_BOTTOM = 2434, - AF_BLUE_STRING_SINHALA_DESCENDER = 2466, - AF_BLUE_STRING_TAMIL_TOP = 2510, - AF_BLUE_STRING_TAMIL_BOTTOM = 2542, - AF_BLUE_STRING_TELUGU_TOP = 2574, - AF_BLUE_STRING_TELUGU_BOTTOM = 2602, - AF_BLUE_STRING_THAI_TOP = 2630, - AF_BLUE_STRING_THAI_BOTTOM = 2654, - AF_BLUE_STRING_THAI_ASCENDER = 2682, - AF_BLUE_STRING_THAI_LARGE_ASCENDER = 2694, - AF_BLUE_STRING_THAI_DESCENDER = 2706, - AF_BLUE_STRING_THAI_LARGE_DESCENDER = 2722, - AF_BLUE_STRING_THAI_DIGIT_TOP = 2730, - af_blue_1_1 = 2741, + AF_BLUE_STRING_ADLAM_CAPITAL_TOP = 0, + AF_BLUE_STRING_ADLAM_CAPITAL_BOTTOM = 30, + AF_BLUE_STRING_ADLAM_SMALL_TOP = 40, + AF_BLUE_STRING_ADLAM_SMALL_BOTTOM = 65, + AF_BLUE_STRING_ARABIC_TOP = 105, + AF_BLUE_STRING_ARABIC_BOTTOM = 123, + AF_BLUE_STRING_ARABIC_JOIN = 138, + AF_BLUE_STRING_ARMENIAN_CAPITAL_TOP = 141, + AF_BLUE_STRING_ARMENIAN_CAPITAL_BOTTOM = 165, + AF_BLUE_STRING_ARMENIAN_SMALL_ASCENDER = 189, + AF_BLUE_STRING_ARMENIAN_SMALL_TOP = 210, + AF_BLUE_STRING_ARMENIAN_SMALL_BOTTOM = 234, + AF_BLUE_STRING_ARMENIAN_SMALL_DESCENDER = 258, + AF_BLUE_STRING_BENGALI_BASE = 282, + AF_BLUE_STRING_BENGALI_TOP = 314, + AF_BLUE_STRING_BENGALI_HEAD = 342, + AF_BLUE_STRING_CHEROKEE_CAPITAL = 374, + AF_BLUE_STRING_CHEROKEE_SMALL_ASCENDER = 406, + AF_BLUE_STRING_CHEROKEE_SMALL = 438, + AF_BLUE_STRING_CHEROKEE_SMALL_DESCENDER = 470, + AF_BLUE_STRING_CYRILLIC_CAPITAL_TOP = 486, + AF_BLUE_STRING_CYRILLIC_CAPITAL_BOTTOM = 510, + AF_BLUE_STRING_CYRILLIC_SMALL = 534, + AF_BLUE_STRING_CYRILLIC_SMALL_DESCENDER = 558, + AF_BLUE_STRING_DEVANAGARI_BASE = 567, + AF_BLUE_STRING_DEVANAGARI_TOP = 599, + AF_BLUE_STRING_DEVANAGARI_HEAD = 631, + AF_BLUE_STRING_DEVANAGARI_BOTTOM = 663, + AF_BLUE_STRING_ETHIOPIC_TOP = 671, + AF_BLUE_STRING_ETHIOPIC_BOTTOM = 703, + AF_BLUE_STRING_GEORGIAN_MKHEDRULI_TOP = 735, + AF_BLUE_STRING_GEORGIAN_MKHEDRULI_BOTTOM = 767, + AF_BLUE_STRING_GEORGIAN_MKHEDRULI_ASCENDER = 799, + AF_BLUE_STRING_GEORGIAN_MKHEDRULI_DESCENDER = 831, + AF_BLUE_STRING_GEORGIAN_ASOMTAVRULI_TOP = 863, + AF_BLUE_STRING_GEORGIAN_ASOMTAVRULI_BOTTOM = 895, + AF_BLUE_STRING_GEORGIAN_NUSKHURI_TOP = 927, + AF_BLUE_STRING_GEORGIAN_NUSKHURI_BOTTOM = 959, + AF_BLUE_STRING_GEORGIAN_NUSKHURI_ASCENDER = 991, + AF_BLUE_STRING_GEORGIAN_NUSKHURI_DESCENDER = 1023, + AF_BLUE_STRING_GREEK_CAPITAL_TOP = 1055, + AF_BLUE_STRING_GREEK_CAPITAL_BOTTOM = 1076, + AF_BLUE_STRING_GREEK_SMALL_BETA_TOP = 1094, + AF_BLUE_STRING_GREEK_SMALL = 1112, + AF_BLUE_STRING_GREEK_SMALL_DESCENDER = 1136, + AF_BLUE_STRING_GUJARATI_TOP = 1160, + AF_BLUE_STRING_GUJARATI_BOTTOM = 1192, + AF_BLUE_STRING_GUJARATI_ASCENDER = 1224, + AF_BLUE_STRING_GUJARATI_DESCENDER = 1274, + AF_BLUE_STRING_GUJARATI_DIGIT_TOP = 1307, + AF_BLUE_STRING_GURMUKHI_BASE = 1327, + AF_BLUE_STRING_GURMUKHI_HEAD = 1359, + AF_BLUE_STRING_GURMUKHI_TOP = 1391, + AF_BLUE_STRING_GURMUKHI_BOTTOM = 1423, + AF_BLUE_STRING_GURMUKHI_DIGIT_TOP = 1455, + AF_BLUE_STRING_HEBREW_TOP = 1475, + AF_BLUE_STRING_HEBREW_BOTTOM = 1499, + AF_BLUE_STRING_HEBREW_DESCENDER = 1517, + AF_BLUE_STRING_KANNADA_TOP = 1532, + AF_BLUE_STRING_KANNADA_BOTTOM = 1576, + AF_BLUE_STRING_KHMER_TOP = 1608, + AF_BLUE_STRING_KHMER_SUBSCRIPT_TOP = 1632, + AF_BLUE_STRING_KHMER_BOTTOM = 1672, + AF_BLUE_STRING_KHMER_DESCENDER = 1704, + AF_BLUE_STRING_KHMER_LARGE_DESCENDER = 1738, + AF_BLUE_STRING_KHMER_SYMBOLS_WAXING_TOP = 1825, + AF_BLUE_STRING_KHMER_SYMBOLS_WANING_BOTTOM = 1833, + AF_BLUE_STRING_LAO_TOP = 1841, + AF_BLUE_STRING_LAO_BOTTOM = 1873, + AF_BLUE_STRING_LAO_ASCENDER = 1905, + AF_BLUE_STRING_LAO_LARGE_ASCENDER = 1921, + AF_BLUE_STRING_LAO_DESCENDER = 1933, + AF_BLUE_STRING_LATIN_CAPITAL_TOP = 1957, + AF_BLUE_STRING_LATIN_CAPITAL_BOTTOM = 1973, + AF_BLUE_STRING_LATIN_SMALL_F_TOP = 1989, + AF_BLUE_STRING_LATIN_SMALL_TOP = 2003, + AF_BLUE_STRING_LATIN_SMALL_BOTTOM = 2019, + AF_BLUE_STRING_LATIN_SMALL_DESCENDER = 2035, + AF_BLUE_STRING_LATIN_SUBS_CAPITAL_TOP = 2045, + AF_BLUE_STRING_LATIN_SUBS_CAPITAL_BOTTOM = 2065, + AF_BLUE_STRING_LATIN_SUBS_SMALL_F_TOP = 2085, + AF_BLUE_STRING_LATIN_SUBS_SMALL = 2105, + AF_BLUE_STRING_LATIN_SUBS_SMALL_DESCENDER = 2141, + AF_BLUE_STRING_LATIN_SUPS_CAPITAL_TOP = 2161, + AF_BLUE_STRING_LATIN_SUPS_CAPITAL_BOTTOM = 2192, + AF_BLUE_STRING_LATIN_SUPS_SMALL_F_TOP = 2221, + AF_BLUE_STRING_LATIN_SUPS_SMALL = 2247, + AF_BLUE_STRING_LATIN_SUPS_SMALL_DESCENDER = 2272, + AF_BLUE_STRING_MALAYALAM_TOP = 2283, + AF_BLUE_STRING_MALAYALAM_BOTTOM = 2327, + AF_BLUE_STRING_MYANMAR_TOP = 2359, + AF_BLUE_STRING_MYANMAR_BOTTOM = 2391, + AF_BLUE_STRING_MYANMAR_ASCENDER = 2423, + AF_BLUE_STRING_MYANMAR_DESCENDER = 2451, + AF_BLUE_STRING_OL_CHIKI = 2483, + AF_BLUE_STRING_SINHALA_TOP = 2507, + AF_BLUE_STRING_SINHALA_BOTTOM = 2539, + AF_BLUE_STRING_SINHALA_DESCENDER = 2571, + AF_BLUE_STRING_TAMIL_TOP = 2615, + AF_BLUE_STRING_TAMIL_BOTTOM = 2647, + AF_BLUE_STRING_TELUGU_TOP = 2679, + AF_BLUE_STRING_TELUGU_BOTTOM = 2707, + AF_BLUE_STRING_THAI_TOP = 2735, + AF_BLUE_STRING_THAI_BOTTOM = 2759, + AF_BLUE_STRING_THAI_ASCENDER = 2787, + AF_BLUE_STRING_THAI_LARGE_ASCENDER = 2799, + AF_BLUE_STRING_THAI_DESCENDER = 2811, + AF_BLUE_STRING_THAI_LARGE_DESCENDER = 2827, + AF_BLUE_STRING_THAI_DIGIT_TOP = 2835, + af_blue_1_1 = 2846, #ifdef AF_CONFIG_OPTION_CJK AF_BLUE_STRING_CJK_TOP = af_blue_1_1 + 1, AF_BLUE_STRING_CJK_BOTTOM = af_blue_1_1 + 203, @@ -241,35 +245,36 @@ FT_BEGIN_HEADER typedef enum AF_Blue_Stringset_ { - AF_BLUE_STRINGSET_ARAB = 0, - AF_BLUE_STRINGSET_ARMN = 4, - AF_BLUE_STRINGSET_BENG = 11, - AF_BLUE_STRINGSET_CHER = 16, - AF_BLUE_STRINGSET_CYRL = 23, - AF_BLUE_STRINGSET_DEVA = 29, - AF_BLUE_STRINGSET_ETHI = 35, - AF_BLUE_STRINGSET_GEOR = 38, - AF_BLUE_STRINGSET_GEOK = 43, - AF_BLUE_STRINGSET_GREK = 50, - AF_BLUE_STRINGSET_GUJR = 57, - AF_BLUE_STRINGSET_GURU = 63, - AF_BLUE_STRINGSET_HEBR = 69, - AF_BLUE_STRINGSET_KNDA = 73, - AF_BLUE_STRINGSET_KHMR = 76, - AF_BLUE_STRINGSET_KHMS = 82, - AF_BLUE_STRINGSET_LAO = 85, - AF_BLUE_STRINGSET_LATN = 91, - AF_BLUE_STRINGSET_LATB = 98, - AF_BLUE_STRINGSET_LATP = 105, - AF_BLUE_STRINGSET_MLYM = 112, - AF_BLUE_STRINGSET_MYMR = 115, - AF_BLUE_STRINGSET_NONE = 120, - AF_BLUE_STRINGSET_OLCK = 121, - AF_BLUE_STRINGSET_SINH = 124, - AF_BLUE_STRINGSET_TAML = 128, - AF_BLUE_STRINGSET_TELU = 131, - AF_BLUE_STRINGSET_THAI = 134, - af_blue_2_1 = 142, + AF_BLUE_STRINGSET_ADLM = 0, + AF_BLUE_STRINGSET_ARAB = 5, + AF_BLUE_STRINGSET_ARMN = 9, + AF_BLUE_STRINGSET_BENG = 16, + AF_BLUE_STRINGSET_CHER = 21, + AF_BLUE_STRINGSET_CYRL = 28, + AF_BLUE_STRINGSET_DEVA = 34, + AF_BLUE_STRINGSET_ETHI = 40, + AF_BLUE_STRINGSET_GEOR = 43, + AF_BLUE_STRINGSET_GEOK = 48, + AF_BLUE_STRINGSET_GREK = 55, + AF_BLUE_STRINGSET_GUJR = 62, + AF_BLUE_STRINGSET_GURU = 68, + AF_BLUE_STRINGSET_HEBR = 74, + AF_BLUE_STRINGSET_KNDA = 78, + AF_BLUE_STRINGSET_KHMR = 81, + AF_BLUE_STRINGSET_KHMS = 87, + AF_BLUE_STRINGSET_LAO = 90, + AF_BLUE_STRINGSET_LATN = 96, + AF_BLUE_STRINGSET_LATB = 103, + AF_BLUE_STRINGSET_LATP = 110, + AF_BLUE_STRINGSET_MLYM = 117, + AF_BLUE_STRINGSET_MYMR = 120, + AF_BLUE_STRINGSET_NONE = 125, + AF_BLUE_STRINGSET_OLCK = 126, + AF_BLUE_STRINGSET_SINH = 129, + AF_BLUE_STRINGSET_TAML = 133, + AF_BLUE_STRINGSET_TELU = 136, + AF_BLUE_STRINGSET_THAI = 139, + af_blue_2_1 = 147, #ifdef AF_CONFIG_OPTION_CJK AF_BLUE_STRINGSET_HANI = af_blue_2_1 + 0, af_blue_2_1_1 = af_blue_2_1 + 2, diff --git a/src/autofit/afranges.c b/src/autofit/afranges.c index 24bc31fe2..dceab9a8d 100644 --- a/src/autofit/afranges.c +++ b/src/autofit/afranges.c @@ -56,6 +56,19 @@ /* of the corresponding `ta_xxxx_uniranges' ranges */ + const AF_Script_UniRangeRec af_adlm_uniranges[] = + { + AF_UNIRANGE_REC( 0x1E900, 0x1E95F ), /* Adlam */ + AF_UNIRANGE_REC( 0, 0 ) + }; + + const AF_Script_UniRangeRec af_adlm_nonbase_uniranges[] = + { + AF_UNIRANGE_REC( 0x1D944, 0x1E94A ), + AF_UNIRANGE_REC( 0, 0 ) + }; + + const AF_Script_UniRangeRec af_arab_uniranges[] = { AF_UNIRANGE_REC( 0x0600, 0x06FF ), /* Arabic */ @@ -515,13 +528,13 @@ }; - const AF_Script_UniRangeRec af_olck_uniranges[] = + const AF_Script_UniRangeRec af_olck_uniranges[] = { AF_UNIRANGE_REC( 0x1C50, 0x1C7F ), /* Ol Chiki */ AF_UNIRANGE_REC( 0, 0 ) }; - const AF_Script_UniRangeRec af_olck_nonbase_uniranges[] = + const AF_Script_UniRangeRec af_olck_nonbase_uniranges[] = { AF_UNIRANGE_REC( 0, 0 ) }; diff --git a/src/autofit/afscript.h b/src/autofit/afscript.h index c38b96fba..154a7e882 100644 --- a/src/autofit/afscript.h +++ b/src/autofit/afscript.h @@ -30,6 +30,12 @@ /* use `HB_SCRIPT_INVALID' as the HarfBuzz script name tag for */ /* them. */ + SCRIPT( adlm, ADLM, + "Adlam", + HB_SCRIPT_ADLAM, + HINTING_BOTTOM_TO_TOP, + "\xF0\x9E\xA4\x8C \xF0\x9E\xA4\xAE" ) /* 𞤌 𞤮 */ + SCRIPT( arab, ARAB, "Arabic", HB_SCRIPT_ARABIC, diff --git a/src/autofit/afstyles.h b/src/autofit/afstyles.h index eb9b8b1f8..cf283d976 100644 --- a/src/autofit/afstyles.h +++ b/src/autofit/afstyles.h @@ -83,6 +83,13 @@ DEFAULT ) + STYLE( adlm_dflt, ADLM_DFLT, + "Adlam default style", + AF_WRITING_SYSTEM_LATIN, + AF_SCRIPT_ADLM, + AF_BLUE_STRINGSET_ADLM, + AF_COVERAGE_DEFAULT ) + STYLE( arab_dflt, ARAB_DFLT, "Arabic default style", AF_WRITING_SYSTEM_LATIN, From 134246b72b605b638c1bcd030d85b76a2ed2bac8 Mon Sep 17 00:00:00 2001 From: Sascha Brawer Date: Thu, 6 Apr 2017 07:06:32 +0200 Subject: [PATCH 045/470] [autofit] Add support for N'Ko script. * src/autofit/afblue.dat: Add blue zone data for N'Ko. * src/autofit/afblue.c, src/autofit/afblue.h: Regenerated. * src/autofit/afscript.h: Add N'Ko standard characters. * src/autofit/afranges.c, src/autofit/afstyles.h: Add N'Ko data. --- ChangeLog | 12 ++++++++++ src/autofit/afblue.c | 14 ++++++++++++ src/autofit/afblue.dat | 17 ++++++++++++++ src/autofit/afblue.h | 51 +++++++++++++++++++++++------------------- src/autofit/afranges.c | 51 ++++++++++++++++++++++++++---------------- src/autofit/afscript.h | 6 +++++ src/autofit/afstyles.h | 7 ++++++ 7 files changed, 116 insertions(+), 42 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2bff58990..dc9fd9d8a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2017-04-06 Sascha Brawer + Werner Lemberg [autofit] Add support for Adlam script. diff --git a/src/autofit/afblue.c b/src/autofit/afblue.c index 6e434e95d..d49767a3f 100644 --- a/src/autofit/afblue.c +++ b/src/autofit/afblue.c @@ -214,6 +214,14 @@ '\0', '\xE1', '\x80', '\x89', ' ', '\xE1', '\x80', '\x8A', ' ', '\xE1', '\x80', '\xA5', ' ', '\xE1', '\x80', '\xA9', ' ', '\xE1', '\x80', '\xA8', ' ', '\xE1', '\x81', '\x82', ' ', '\xE1', '\x81', '\x85', ' ', '\xE1', '\x81', '\x89', /* ဉ ည ဥ ဩ ဨ ၂ ၅ ၉ */ '\0', + '\xDF', '\x90', ' ', '\xDF', '\x89', ' ', '\xDF', '\x92', ' ', '\xDF', '\x9F', ' ', '\xDF', '\x96', ' ', '\xDF', '\x9C', ' ', '\xDF', '\xA0', ' ', '\xDF', '\xA5', /* ߐ ߉ ߒ ߟ ߖ ߜ ߠ ߥ */ + '\0', + '\xDF', '\x80', ' ', '\xDF', '\x98', ' ', '\xDF', '\xA1', ' ', '\xDF', '\xA0', ' ', '\xDF', '\xA5', /* ߀ ߘ ߡ ߠ ߥ */ + '\0', + '\xDF', '\x8F', ' ', '\xDF', '\x9B', ' ', '\xDF', '\x8B', /* ߏ ߛ ߋ */ + '\0', + '\xDF', '\x8E', ' ', '\xDF', '\x8F', ' ', '\xDF', '\x9B', ' ', '\xDF', '\x8B', /* ߎ ߏ ߛ ߋ */ + '\0', '\xE1', '\xB1', '\x9B', ' ', '\xE1', '\xB1', '\x9C', ' ', '\xE1', '\xB1', '\x9D', ' ', '\xE1', '\xB1', '\xA1', ' ', '\xE1', '\xB1', '\xA2', ' ', '\xE1', '\xB1', '\xA5', /* ᱛ ᱜ ᱝ ᱡ ᱢ ᱥ */ '\0', '\xE0', '\xB6', '\x89', ' ', '\xE0', '\xB6', '\x9A', ' ', '\xE0', '\xB6', '\x9D', ' ', '\xE0', '\xB6', '\xB3', ' ', '\xE0', '\xB6', '\xB4', ' ', '\xE0', '\xB6', '\xBA', ' ', '\xE0', '\xB6', '\xBD', ' ', '\xE0', '\xB7', '\x86', /* ඉ ක ඝ ඳ ප ය ල ෆ */ @@ -440,6 +448,12 @@ { AF_BLUE_STRING_MYANMAR_ASCENDER, AF_BLUE_PROPERTY_LATIN_TOP }, { AF_BLUE_STRING_MYANMAR_DESCENDER, 0 }, { AF_BLUE_STRING_MAX, 0 }, + { AF_BLUE_STRING_NKO_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_NKO_BOTTOM, 0 }, + { AF_BLUE_STRING_NKO_SMALL_TOP, AF_BLUE_PROPERTY_LATIN_TOP | + AF_BLUE_PROPERTY_LATIN_X_HEIGHT }, + { AF_BLUE_STRING_NKO_SMALL_BOTTOM, 0 }, + { AF_BLUE_STRING_MAX, 0 }, { AF_BLUE_STRING_MAX, 0 }, { AF_BLUE_STRING_OL_CHIKI, AF_BLUE_PROPERTY_LATIN_TOP }, { AF_BLUE_STRING_OL_CHIKI, 0 }, diff --git a/src/autofit/afblue.dat b/src/autofit/afblue.dat index 7b5c08425..6d8680948 100644 --- a/src/autofit/afblue.dat +++ b/src/autofit/afblue.dat @@ -297,6 +297,15 @@ AF_BLUE_STRING_ENUM AF_BLUE_STRINGS_ARRAY AF_BLUE_STRING_MAX_LEN: AF_BLUE_STRING_MYANMAR_DESCENDER "ဉ ည ဥ ဩ ဨ ၂ ၅ ၉" + AF_BLUE_STRING_NKO_TOP + "ߐ ߉ ߒ ߟ ߖ ߜ ߠ ߥ" + AF_BLUE_STRING_NKO_BOTTOM + "߀ ߘ ߡ ߠ ߥ" + AF_BLUE_STRING_NKO_SMALL_TOP + "ߏ ߛ ߋ" + AF_BLUE_STRING_NKO_SMALL_BOTTOM + "ߎ ߏ ߛ ߋ" + AF_BLUE_STRING_OL_CHIKI "ᱛ ᱜ ᱝ ᱡ ᱢ ᱥ" @@ -691,6 +700,14 @@ AF_BLUE_STRINGSET_ENUM AF_BLUE_STRINGSETS_ARRAY AF_BLUE_STRINGSET_MAX_LEN: { AF_BLUE_STRING_MYANMAR_DESCENDER, 0 } { AF_BLUE_STRING_MAX, 0 } + AF_BLUE_STRINGSET_NKOO + { AF_BLUE_STRING_NKO_TOP, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_NKO_BOTTOM, 0 } + { AF_BLUE_STRING_NKO_SMALL_TOP, AF_BLUE_PROPERTY_LATIN_TOP | + AF_BLUE_PROPERTY_LATIN_X_HEIGHT } + { AF_BLUE_STRING_NKO_SMALL_BOTTOM, 0 } + { AF_BLUE_STRING_MAX, 0 } + AF_BLUE_STRINGSET_NONE { AF_BLUE_STRING_MAX, 0 } diff --git a/src/autofit/afblue.h b/src/autofit/afblue.h index e290c47f4..9fd349824 100644 --- a/src/autofit/afblue.h +++ b/src/autofit/afblue.h @@ -171,22 +171,26 @@ FT_BEGIN_HEADER AF_BLUE_STRING_MYANMAR_BOTTOM = 2391, AF_BLUE_STRING_MYANMAR_ASCENDER = 2423, AF_BLUE_STRING_MYANMAR_DESCENDER = 2451, - AF_BLUE_STRING_OL_CHIKI = 2483, - AF_BLUE_STRING_SINHALA_TOP = 2507, - AF_BLUE_STRING_SINHALA_BOTTOM = 2539, - AF_BLUE_STRING_SINHALA_DESCENDER = 2571, - AF_BLUE_STRING_TAMIL_TOP = 2615, - AF_BLUE_STRING_TAMIL_BOTTOM = 2647, - AF_BLUE_STRING_TELUGU_TOP = 2679, - AF_BLUE_STRING_TELUGU_BOTTOM = 2707, - AF_BLUE_STRING_THAI_TOP = 2735, - AF_BLUE_STRING_THAI_BOTTOM = 2759, - AF_BLUE_STRING_THAI_ASCENDER = 2787, - AF_BLUE_STRING_THAI_LARGE_ASCENDER = 2799, - AF_BLUE_STRING_THAI_DESCENDER = 2811, - AF_BLUE_STRING_THAI_LARGE_DESCENDER = 2827, - AF_BLUE_STRING_THAI_DIGIT_TOP = 2835, - af_blue_1_1 = 2846, + AF_BLUE_STRING_NKO_TOP = 2483, + AF_BLUE_STRING_NKO_BOTTOM = 2507, + AF_BLUE_STRING_NKO_SMALL_TOP = 2522, + AF_BLUE_STRING_NKO_SMALL_BOTTOM = 2531, + AF_BLUE_STRING_OL_CHIKI = 2543, + AF_BLUE_STRING_SINHALA_TOP = 2567, + AF_BLUE_STRING_SINHALA_BOTTOM = 2599, + AF_BLUE_STRING_SINHALA_DESCENDER = 2631, + AF_BLUE_STRING_TAMIL_TOP = 2675, + AF_BLUE_STRING_TAMIL_BOTTOM = 2707, + AF_BLUE_STRING_TELUGU_TOP = 2739, + AF_BLUE_STRING_TELUGU_BOTTOM = 2767, + AF_BLUE_STRING_THAI_TOP = 2795, + AF_BLUE_STRING_THAI_BOTTOM = 2819, + AF_BLUE_STRING_THAI_ASCENDER = 2847, + AF_BLUE_STRING_THAI_LARGE_ASCENDER = 2859, + AF_BLUE_STRING_THAI_DESCENDER = 2871, + AF_BLUE_STRING_THAI_LARGE_DESCENDER = 2887, + AF_BLUE_STRING_THAI_DIGIT_TOP = 2895, + af_blue_1_1 = 2906, #ifdef AF_CONFIG_OPTION_CJK AF_BLUE_STRING_CJK_TOP = af_blue_1_1 + 1, AF_BLUE_STRING_CJK_BOTTOM = af_blue_1_1 + 203, @@ -268,13 +272,14 @@ FT_BEGIN_HEADER AF_BLUE_STRINGSET_LATP = 110, AF_BLUE_STRINGSET_MLYM = 117, AF_BLUE_STRINGSET_MYMR = 120, - AF_BLUE_STRINGSET_NONE = 125, - AF_BLUE_STRINGSET_OLCK = 126, - AF_BLUE_STRINGSET_SINH = 129, - AF_BLUE_STRINGSET_TAML = 133, - AF_BLUE_STRINGSET_TELU = 136, - AF_BLUE_STRINGSET_THAI = 139, - af_blue_2_1 = 147, + AF_BLUE_STRINGSET_NKOO = 125, + AF_BLUE_STRINGSET_NONE = 130, + AF_BLUE_STRINGSET_OLCK = 131, + AF_BLUE_STRINGSET_SINH = 134, + AF_BLUE_STRINGSET_TAML = 138, + AF_BLUE_STRINGSET_TELU = 141, + AF_BLUE_STRINGSET_THAI = 144, + af_blue_2_1 = 152, #ifdef AF_CONFIG_OPTION_CJK AF_BLUE_STRINGSET_HANI = af_blue_2_1 + 0, af_blue_2_1_1 = af_blue_2_1 + 2, diff --git a/src/autofit/afranges.c b/src/autofit/afranges.c index dceab9a8d..57236cf8d 100644 --- a/src/autofit/afranges.c +++ b/src/autofit/afranges.c @@ -493,27 +493,40 @@ const AF_Script_UniRangeRec af_mymr_uniranges[] = { - AF_UNIRANGE_REC( 0x1000, 0x109F ), /* Myanmar */ - AF_UNIRANGE_REC( 0xA9E0, 0xA9FF ), /* Myanmar Extended-B */ - AF_UNIRANGE_REC( 0xAA60, 0xAA7F ), /* Myanmar Extended-A */ - AF_UNIRANGE_REC( 0, 0 ) + AF_UNIRANGE_REC( 0x1000, 0x109F ), /* Myanmar */ + AF_UNIRANGE_REC( 0xA9E0, 0xA9FF ), /* Myanmar Extended-B */ + AF_UNIRANGE_REC( 0xAA60, 0xAA7F ), /* Myanmar Extended-A */ + AF_UNIRANGE_REC( 0, 0 ) }; const AF_Script_UniRangeRec af_mymr_nonbase_uniranges[] = { - AF_UNIRANGE_REC( 0x102D, 0x1030 ), - AF_UNIRANGE_REC( 0x1032, 0x1037 ), - AF_UNIRANGE_REC( 0x103A, 0x103A ), - AF_UNIRANGE_REC( 0x103D, 0x103E ), - AF_UNIRANGE_REC( 0x1058, 0x1059 ), - AF_UNIRANGE_REC( 0x105E, 0x1060 ), - AF_UNIRANGE_REC( 0x1071, 0x1074 ), - AF_UNIRANGE_REC( 0x1082, 0x1082 ), - AF_UNIRANGE_REC( 0x1085, 0x1086 ), - AF_UNIRANGE_REC( 0x108D, 0x108D ), - AF_UNIRANGE_REC( 0xA9E5, 0xA9E5 ), - AF_UNIRANGE_REC( 0xAA7C, 0xAA7C ), - AF_UNIRANGE_REC( 0, 0 ) + AF_UNIRANGE_REC( 0x102D, 0x1030 ), + AF_UNIRANGE_REC( 0x1032, 0x1037 ), + AF_UNIRANGE_REC( 0x103A, 0x103A ), + AF_UNIRANGE_REC( 0x103D, 0x103E ), + AF_UNIRANGE_REC( 0x1058, 0x1059 ), + AF_UNIRANGE_REC( 0x105E, 0x1060 ), + AF_UNIRANGE_REC( 0x1071, 0x1074 ), + AF_UNIRANGE_REC( 0x1082, 0x1082 ), + AF_UNIRANGE_REC( 0x1085, 0x1086 ), + AF_UNIRANGE_REC( 0x108D, 0x108D ), + AF_UNIRANGE_REC( 0xA9E5, 0xA9E5 ), + AF_UNIRANGE_REC( 0xAA7C, 0xAA7C ), + AF_UNIRANGE_REC( 0, 0 ) + }; + + + const AF_Script_UniRangeRec af_nkoo_uniranges[] = + { + AF_UNIRANGE_REC( 0x07C0, 0x07FF ), /* N'Ko */ + AF_UNIRANGE_REC( 0, 0 ) + }; + + const AF_Script_UniRangeRec af_nkoo_nonbase_uniranges[] = + { + AF_UNIRANGE_REC( 0x07EB, 0x07F5 ), + AF_UNIRANGE_REC( 0, 0 ) }; @@ -530,8 +543,8 @@ const AF_Script_UniRangeRec af_olck_uniranges[] = { - AF_UNIRANGE_REC( 0x1C50, 0x1C7F ), /* Ol Chiki */ - AF_UNIRANGE_REC( 0, 0 ) + AF_UNIRANGE_REC( 0x1C50, 0x1C7F ), /* Ol Chiki */ + AF_UNIRANGE_REC( 0, 0 ) }; const AF_Script_UniRangeRec af_olck_nonbase_uniranges[] = diff --git a/src/autofit/afscript.h b/src/autofit/afscript.h index 154a7e882..e90ce826c 100644 --- a/src/autofit/afscript.h +++ b/src/autofit/afscript.h @@ -171,6 +171,12 @@ HINTING_BOTTOM_TO_TOP, "\xE1\x80\x9D \xE1\x80\x84 \xE1\x80\x82" ) /* ဝ င ဂ */ + SCRIPT( nkoo, NKOO, + "N'Ko", + HB_SCRIPT_NKO, + HINTING_BOTTOM_TO_TOP, + "\xDF\x8B \xDF\x80" ) /* ߋ ߀ */ + SCRIPT( none, NONE, "no script", HB_SCRIPT_INVALID, diff --git a/src/autofit/afstyles.h b/src/autofit/afstyles.h index cf283d976..beb0152b6 100644 --- a/src/autofit/afstyles.h +++ b/src/autofit/afstyles.h @@ -238,6 +238,13 @@ AF_BLUE_STRINGSET_MYMR, AF_COVERAGE_DEFAULT ) + STYLE( nkoo_dflt, NKOO_DFLT, + "N'Ko default style", + AF_WRITING_SYSTEM_LATIN, + AF_SCRIPT_NKOO, + AF_BLUE_STRINGSET_NKOO, + AF_COVERAGE_DEFAULT ) + STYLE( none_dflt, NONE_DFLT, "no style", AF_WRITING_SYSTEM_DUMMY, From 837f1125668805f47d810aec5a2c02e88453b557 Mon Sep 17 00:00:00 2001 From: Sascha Brawer Date: Thu, 6 Apr 2017 08:44:08 +0200 Subject: [PATCH 046/470] [autofit] Add support for Tifinagh script. * src/autofit/afblue.dat: Add blue zone data for Tifinagh. * src/autofit/afblue.c, src/autofit/afblue.h: Regenerated. * src/autofit/afscript.h: Add Tifinagh standard characters. * src/autofit/afranges.c, src/autofit/afstyles.h: Add Tifinagh data. --- ChangeLog | 12 ++++++++++++ src/autofit/afblue.c | 5 +++++ src/autofit/afblue.dat | 8 ++++++++ src/autofit/afblue.h | 6 ++++-- src/autofit/afranges.c | 12 ++++++++++++ src/autofit/afscript.h | 6 ++++++ src/autofit/afstyles.h | 7 +++++++ 7 files changed, 54 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index dc9fd9d8a..c8788e499 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2017-04-06 Sascha Brawer + Werner Lemberg Werner Lemberg Date: Thu, 6 Apr 2017 11:35:07 +0200 Subject: [PATCH 047/470] [autofit] Add support for Tai Viet script. * src/autofit/afblue.dat: Add blue zone data for Tai Viet. * src/autofit/afblue.c, src/autofit/afblue.h: Regenerated. * src/autofit/afscript.h: Add Tai Viet standard characters. * src/autofit/afranges.c, src/autofit/afstyles.h: Add Tai Viet data. --- ChangeLog | 12 ++++++++++++ src/autofit/afblue.c | 7 +++++++ src/autofit/afblue.dat | 10 ++++++++++ src/autofit/afblue.h | 37 ++++++++++++++++++++----------------- src/autofit/afranges.c | 17 +++++++++++++++++ src/autofit/afscript.h | 6 ++++++ src/autofit/afstyles.h | 7 +++++++ 7 files changed, 79 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index c8788e499..fc6710fae 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2017-04-06 Sascha Brawer + Werner Lemberg Werner Lemberg Date: Thu, 6 Apr 2017 12:47:27 +0200 Subject: [PATCH 048/470] [autofit] Add support for Glagolitic script. * src/autofit/afblue.dat: Add blue zone data for Glagolitic. * src/autofit/afblue.c, src/autofit/afblue.h: Regenerated. * src/autofit/afscript.h: Add Glagolitic standard characters. * src/autofit/afranges.c, src/autofit/afstyles.h: Add Glagolitic data. --- ChangeLog | 12 +++ src/autofit/afblue.c | 14 +++ src/autofit/afblue.dat | 17 ++++ src/autofit/afblue.h | 205 +++++++++++++++++++++-------------------- src/autofit/afranges.c | 13 +++ src/autofit/afscript.h | 6 ++ src/autofit/afstyles.h | 7 ++ 7 files changed, 174 insertions(+), 100 deletions(-) diff --git a/ChangeLog b/ChangeLog index fc6710fae..09774a2ad 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2017-04-06 Sascha Brawer + Werner Lemberg Werner Lemberg Date: Thu, 6 Apr 2017 16:49:39 +0200 Subject: [PATCH 049/470] [autofit] Add support for Osage script. * src/autofit/afblue.dat: Add blue zone data for Osage. * src/autofit/afblue.c, src/autofit/afblue.h: Regenerated. * src/autofit/afscript.h: Add Osage standard characters. * src/autofit/afranges.c, src/autofit/afstyles.h: Add Osage data. --- ChangeLog | 12 +++++++++ src/autofit/afblue.c | 23 +++++++++++++++++ src/autofit/afblue.dat | 26 +++++++++++++++++++ src/autofit/afblue.h | 58 ++++++++++++++++++++++++------------------ src/autofit/afranges.c | 12 +++++++++ src/autofit/afscript.h | 6 +++++ src/autofit/afstyles.h | 7 +++++ 7 files changed, 119 insertions(+), 25 deletions(-) diff --git a/ChangeLog b/ChangeLog index 09774a2ad..90a045511 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2017-04-06 Sascha Brawer + Werner Lemberg Werner Lemberg Date: Thu, 6 Apr 2017 17:05:47 +0200 Subject: [PATCH 050/470] [autofit] Add support for Lisu script. * src/autofit/afblue.dat: Add blue zone data for Lisu. * src/autofit/afblue.c, src/autofit/afblue.h: Regenerated. * src/autofit/afscript.h: Add Lisu standard characters. * src/autofit/afranges.c, src/autofit/afstyles.h: Add Lisu data. --- ChangeLog | 12 +++++ src/autofit/afblue.c | 7 +++ src/autofit/afblue.dat | 10 ++++ src/autofit/afblue.h | 101 +++++++++++++++++++++-------------------- src/autofit/afranges.c | 12 +++++ src/autofit/afscript.h | 6 +++ src/autofit/afstyles.h | 7 +++ 7 files changed, 106 insertions(+), 49 deletions(-) diff --git a/ChangeLog b/ChangeLog index 90a045511..fcf686dfc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2017-04-06 Sascha Brawer + Werner Lemberg Werner Lemberg Date: Fri, 7 Apr 2017 17:13:38 +0200 Subject: [PATCH 051/470] [ftfuzzer] Fix clang warnings. * src/tools/ftfuzzer/ftfuzzer.cc (LLVMFuzzerTestOneInput): Add casts. --- ChangeLog | 7 +++++++ src/tools/ftfuzzer/ftfuzzer.cc | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index fcf686dfc..bba3a21f0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2017-04-07 Werner Lemberg + + [ftfuzzer] Fix clang warnings. + + * src/tools/ftfuzzer/ftfuzzer.cc (LLVMFuzzerTestOneInput): Add + casts. + 2017-04-06 Sascha Brawer Werner Lemberg Date: Fri, 7 Apr 2017 17:22:59 +0200 Subject: [PATCH 052/470] [autofit] Fix invalid character range description (#50745). Also reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=1034 * src/autofit/afranges.c (af_glag_nonbase_uniranges): Fix typo in recent commit. --- ChangeLog | 11 +++++++++++ src/autofit/afranges.c | 3 ++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index bba3a21f0..2ac6b31c9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2017-04-07 Werner Lemberg + + [autofit] Fix invalid character range description (#50745). + + Also reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=1034 + + * src/autofit/afranges.c (af_glag_nonbase_uniranges): Fix typo in + recent commit. + 2017-04-07 Werner Lemberg [ftfuzzer] Fix clang warnings. diff --git a/src/autofit/afranges.c b/src/autofit/afranges.c index e470b0a44..9c94421c5 100644 --- a/src/autofit/afranges.c +++ b/src/autofit/afranges.c @@ -255,7 +255,8 @@ const AF_Script_UniRangeRec af_glag_nonbase_uniranges[] = { - AF_UNIRANGE_REC( 0x1E000, 0x1E02F ) + AF_UNIRANGE_REC( 0x1E000, 0x1E02F ), + AF_UNIRANGE_REC( 0, 0 ) }; From d79fc79422fbbb74c59f766dc687e2cb30d9d6a9 Mon Sep 17 00:00:00 2001 From: Sascha Brawer Date: Sat, 8 Apr 2017 07:06:24 +0200 Subject: [PATCH 053/470] [autofit] Add support for Deseret script. * src/autofit/afblue.dat: Add blue zone data for Deseret. * src/autofit/afblue.c, src/autofit/afblue.h: Regenerated. * src/autofit/afscript.h: Add Deseret standard characters. * src/autofit/afranges.c, src/autofit/afstyles.h: Add Deseret data. --- ChangeLog | 12 ++ src/autofit/afblue.c | 14 +++ src/autofit/afblue.dat | 17 +++ src/autofit/afblue.h | 275 +++++++++++++++++++++-------------------- src/autofit/afranges.c | 12 ++ src/autofit/afscript.h | 6 + src/autofit/afstyles.h | 7 ++ 7 files changed, 208 insertions(+), 135 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2ac6b31c9..7d0fb6df5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2017-04-08 Sascha Brawer + Werner Lemberg [autofit] Fix invalid character range description (#50745). diff --git a/src/autofit/afblue.c b/src/autofit/afblue.c index 500a61c00..91ea74161 100644 --- a/src/autofit/afblue.c +++ b/src/autofit/afblue.c @@ -74,6 +74,14 @@ '\0', '\xD1', '\x80', ' ', '\xD1', '\x83', ' ', '\xD1', '\x84', /* р у ф */ '\0', + '\xF0', '\x90', '\x90', '\x82', ' ', '\xF0', '\x90', '\x90', '\x84', ' ', '\xF0', '\x90', '\x90', '\x8B', ' ', '\xF0', '\x90', '\x90', '\x97', ' ', '\xF0', '\x90', '\x90', '\x91', /* 𐐂 𐐄 𐐋 𐐗 𐐑 */ + '\0', + '\xF0', '\x90', '\x90', '\x80', ' ', '\xF0', '\x90', '\x90', '\x82', ' ', '\xF0', '\x90', '\x90', '\x84', ' ', '\xF0', '\x90', '\x90', '\x97', ' ', '\xF0', '\x90', '\x90', '\x9B', /* 𐐀 𐐂 𐐄 𐐗 𐐛 */ + '\0', + '\xF0', '\x90', '\x90', '\xAA', ' ', '\xF0', '\x90', '\x90', '\xAC', ' ', '\xF0', '\x90', '\x90', '\xB3', ' ', '\xF0', '\x90', '\x90', '\xBF', ' ', '\xF0', '\x90', '\x90', '\xB9', /* 𐐪 𐐬 𐐳 𐐿 𐐹 */ + '\0', + '\xF0', '\x90', '\x90', '\xA8', ' ', '\xF0', '\x90', '\x90', '\xAA', ' ', '\xF0', '\x90', '\x90', '\xAC', ' ', '\xF0', '\x90', '\x90', '\xBF', ' ', '\xF0', '\x90', '\x91', '\x83', /* 𐐨 𐐪 𐐬 𐐿 𐑃 */ + '\0', '\xE0', '\xA4', '\x95', ' ', '\xE0', '\xA4', '\xAE', ' ', '\xE0', '\xA4', '\x85', ' ', '\xE0', '\xA4', '\x86', ' ', '\xE0', '\xA4', '\xA5', ' ', '\xE0', '\xA4', '\xA7', ' ', '\xE0', '\xA4', '\xAD', ' ', '\xE0', '\xA4', '\xB6', /* क म अ आ थ ध भ श */ '\0', '\xE0', '\xA4', '\x88', ' ', '\xE0', '\xA4', '\x90', ' ', '\xE0', '\xA4', '\x93', ' ', '\xE0', '\xA4', '\x94', ' ', '\xE0', '\xA4', '\xBF', ' ', '\xE0', '\xA5', '\x80', ' ', '\xE0', '\xA5', '\x8B', ' ', '\xE0', '\xA5', '\x8C', /* ई ऐ ओ औ ि ी ो ौ */ @@ -381,6 +389,12 @@ { AF_BLUE_STRING_DEVANAGARI_BASE, 0 }, { AF_BLUE_STRING_DEVANAGARI_BOTTOM, 0 }, { AF_BLUE_STRING_MAX, 0 }, + { AF_BLUE_STRING_DESERET_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_DESERET_CAPITAL_BOTTOM, 0 }, + { AF_BLUE_STRING_DESERET_SMALL_TOP, AF_BLUE_PROPERTY_LATIN_TOP | + AF_BLUE_PROPERTY_LATIN_X_HEIGHT }, + { AF_BLUE_STRING_DESERET_SMALL_BOTTOM, 0 }, + { AF_BLUE_STRING_MAX, 0 }, { AF_BLUE_STRING_ETHIOPIC_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, { AF_BLUE_STRING_ETHIOPIC_BOTTOM, 0 }, { AF_BLUE_STRING_MAX, 0 }, diff --git a/src/autofit/afblue.dat b/src/autofit/afblue.dat index df4d3efa0..58eaa2664 100644 --- a/src/autofit/afblue.dat +++ b/src/autofit/afblue.dat @@ -133,6 +133,15 @@ AF_BLUE_STRING_ENUM AF_BLUE_STRINGS_ARRAY AF_BLUE_STRING_MAX_LEN: AF_BLUE_STRING_CYRILLIC_SMALL_DESCENDER "р у ф" + AF_BLUE_STRING_DESERET_CAPITAL_TOP + "𐐂 𐐄 𐐋 𐐗 𐐑" + AF_BLUE_STRING_DESERET_CAPITAL_BOTTOM + "𐐀 𐐂 𐐄 𐐗 𐐛" + AF_BLUE_STRING_DESERET_SMALL_TOP + "𐐪 𐐬 𐐳 𐐿 𐐹" + AF_BLUE_STRING_DESERET_SMALL_BOTTOM + "𐐨 𐐪 𐐬 𐐿 𐑃" + AF_BLUE_STRING_DEVANAGARI_BASE "क म अ आ थ ध भ श" AF_BLUE_STRING_DEVANAGARI_TOP @@ -605,6 +614,14 @@ AF_BLUE_STRINGSET_ENUM AF_BLUE_STRINGSETS_ARRAY AF_BLUE_STRINGSET_MAX_LEN: { AF_BLUE_STRING_DEVANAGARI_BOTTOM, 0 } { AF_BLUE_STRING_MAX, 0 } + AF_BLUE_STRINGSET_DSRT + { AF_BLUE_STRING_DESERET_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_DESERET_CAPITAL_BOTTOM, 0 } + { AF_BLUE_STRING_DESERET_SMALL_TOP, AF_BLUE_PROPERTY_LATIN_TOP | + AF_BLUE_PROPERTY_LATIN_X_HEIGHT } + { AF_BLUE_STRING_DESERET_SMALL_BOTTOM, 0 } + { AF_BLUE_STRING_MAX, 0 } + AF_BLUE_STRINGSET_ETHI { AF_BLUE_STRING_ETHIOPIC_TOP, AF_BLUE_PROPERTY_LATIN_TOP } { AF_BLUE_STRING_ETHIOPIC_BOTTOM, 0 } diff --git a/src/autofit/afblue.h b/src/autofit/afblue.h index 2be2481c6..3847137cc 100644 --- a/src/autofit/afblue.h +++ b/src/autofit/afblue.h @@ -101,112 +101,116 @@ FT_BEGIN_HEADER AF_BLUE_STRING_CYRILLIC_CAPITAL_BOTTOM = 510, AF_BLUE_STRING_CYRILLIC_SMALL = 534, AF_BLUE_STRING_CYRILLIC_SMALL_DESCENDER = 558, - AF_BLUE_STRING_DEVANAGARI_BASE = 567, - AF_BLUE_STRING_DEVANAGARI_TOP = 599, - AF_BLUE_STRING_DEVANAGARI_HEAD = 631, - AF_BLUE_STRING_DEVANAGARI_BOTTOM = 663, - AF_BLUE_STRING_ETHIOPIC_TOP = 671, - AF_BLUE_STRING_ETHIOPIC_BOTTOM = 703, - AF_BLUE_STRING_GEORGIAN_MKHEDRULI_TOP = 735, - AF_BLUE_STRING_GEORGIAN_MKHEDRULI_BOTTOM = 767, - AF_BLUE_STRING_GEORGIAN_MKHEDRULI_ASCENDER = 799, - AF_BLUE_STRING_GEORGIAN_MKHEDRULI_DESCENDER = 831, - AF_BLUE_STRING_GEORGIAN_ASOMTAVRULI_TOP = 863, - AF_BLUE_STRING_GEORGIAN_ASOMTAVRULI_BOTTOM = 895, - AF_BLUE_STRING_GEORGIAN_NUSKHURI_TOP = 927, - AF_BLUE_STRING_GEORGIAN_NUSKHURI_BOTTOM = 959, - AF_BLUE_STRING_GEORGIAN_NUSKHURI_ASCENDER = 991, - AF_BLUE_STRING_GEORGIAN_NUSKHURI_DESCENDER = 1023, - AF_BLUE_STRING_GLAGOLITIC_CAPITAL_TOP = 1055, - AF_BLUE_STRING_GLAGOLITIC_CAPITAL_BOTTOM = 1087, - AF_BLUE_STRING_GLAGOLITIC_SMALL_TOP = 1119, - AF_BLUE_STRING_GLAGOLITIC_SMALL_BOTTOM = 1151, - AF_BLUE_STRING_GREEK_CAPITAL_TOP = 1183, - AF_BLUE_STRING_GREEK_CAPITAL_BOTTOM = 1204, - AF_BLUE_STRING_GREEK_SMALL_BETA_TOP = 1222, - AF_BLUE_STRING_GREEK_SMALL = 1240, - AF_BLUE_STRING_GREEK_SMALL_DESCENDER = 1264, - AF_BLUE_STRING_GUJARATI_TOP = 1288, - AF_BLUE_STRING_GUJARATI_BOTTOM = 1320, - AF_BLUE_STRING_GUJARATI_ASCENDER = 1352, - AF_BLUE_STRING_GUJARATI_DESCENDER = 1402, - AF_BLUE_STRING_GUJARATI_DIGIT_TOP = 1435, - AF_BLUE_STRING_GURMUKHI_BASE = 1455, - AF_BLUE_STRING_GURMUKHI_HEAD = 1487, - AF_BLUE_STRING_GURMUKHI_TOP = 1519, - AF_BLUE_STRING_GURMUKHI_BOTTOM = 1551, - AF_BLUE_STRING_GURMUKHI_DIGIT_TOP = 1583, - AF_BLUE_STRING_HEBREW_TOP = 1603, - AF_BLUE_STRING_HEBREW_BOTTOM = 1627, - AF_BLUE_STRING_HEBREW_DESCENDER = 1645, - AF_BLUE_STRING_KANNADA_TOP = 1660, - AF_BLUE_STRING_KANNADA_BOTTOM = 1704, - AF_BLUE_STRING_KHMER_TOP = 1736, - AF_BLUE_STRING_KHMER_SUBSCRIPT_TOP = 1760, - AF_BLUE_STRING_KHMER_BOTTOM = 1800, - AF_BLUE_STRING_KHMER_DESCENDER = 1832, - AF_BLUE_STRING_KHMER_LARGE_DESCENDER = 1866, - AF_BLUE_STRING_KHMER_SYMBOLS_WAXING_TOP = 1953, - AF_BLUE_STRING_KHMER_SYMBOLS_WANING_BOTTOM = 1961, - AF_BLUE_STRING_LAO_TOP = 1969, - AF_BLUE_STRING_LAO_BOTTOM = 2001, - AF_BLUE_STRING_LAO_ASCENDER = 2033, - AF_BLUE_STRING_LAO_LARGE_ASCENDER = 2049, - AF_BLUE_STRING_LAO_DESCENDER = 2061, - AF_BLUE_STRING_LATIN_CAPITAL_TOP = 2085, - AF_BLUE_STRING_LATIN_CAPITAL_BOTTOM = 2101, - AF_BLUE_STRING_LATIN_SMALL_F_TOP = 2117, - AF_BLUE_STRING_LATIN_SMALL_TOP = 2131, - AF_BLUE_STRING_LATIN_SMALL_BOTTOM = 2147, - AF_BLUE_STRING_LATIN_SMALL_DESCENDER = 2163, - AF_BLUE_STRING_LATIN_SUBS_CAPITAL_TOP = 2173, - AF_BLUE_STRING_LATIN_SUBS_CAPITAL_BOTTOM = 2193, - AF_BLUE_STRING_LATIN_SUBS_SMALL_F_TOP = 2213, - AF_BLUE_STRING_LATIN_SUBS_SMALL = 2233, - AF_BLUE_STRING_LATIN_SUBS_SMALL_DESCENDER = 2269, - AF_BLUE_STRING_LATIN_SUPS_CAPITAL_TOP = 2289, - AF_BLUE_STRING_LATIN_SUPS_CAPITAL_BOTTOM = 2320, - AF_BLUE_STRING_LATIN_SUPS_SMALL_F_TOP = 2349, - AF_BLUE_STRING_LATIN_SUPS_SMALL = 2375, - AF_BLUE_STRING_LATIN_SUPS_SMALL_DESCENDER = 2400, - AF_BLUE_STRING_LISU_TOP = 2411, - AF_BLUE_STRING_LISU_BOTTOM = 2443, - AF_BLUE_STRING_MALAYALAM_TOP = 2475, - AF_BLUE_STRING_MALAYALAM_BOTTOM = 2519, - AF_BLUE_STRING_MYANMAR_TOP = 2551, - AF_BLUE_STRING_MYANMAR_BOTTOM = 2583, - AF_BLUE_STRING_MYANMAR_ASCENDER = 2615, - AF_BLUE_STRING_MYANMAR_DESCENDER = 2643, - AF_BLUE_STRING_NKO_TOP = 2675, - AF_BLUE_STRING_NKO_BOTTOM = 2699, - AF_BLUE_STRING_NKO_SMALL_TOP = 2714, - AF_BLUE_STRING_NKO_SMALL_BOTTOM = 2723, - AF_BLUE_STRING_OL_CHIKI = 2735, - AF_BLUE_STRING_OSAGE_CAPITAL_TOP = 2759, - AF_BLUE_STRING_OSAGE_CAPITAL_BOTTOM = 2799, - AF_BLUE_STRING_OSAGE_CAPITAL_DESCENDER = 2829, - AF_BLUE_STRING_OSAGE_SMALL_TOP = 2844, - AF_BLUE_STRING_OSAGE_SMALL_BOTTOM = 2884, - AF_BLUE_STRING_OSAGE_SMALL_ASCENDER = 2924, - AF_BLUE_STRING_OSAGE_SMALL_DESCENDER = 2949, - AF_BLUE_STRING_SINHALA_TOP = 2964, - AF_BLUE_STRING_SINHALA_BOTTOM = 2996, - AF_BLUE_STRING_SINHALA_DESCENDER = 3028, - AF_BLUE_STRING_TAI_VIET_TOP = 3072, - AF_BLUE_STRING_TAI_VIET_BOTTOM = 3092, - AF_BLUE_STRING_TAMIL_TOP = 3104, - AF_BLUE_STRING_TAMIL_BOTTOM = 3136, - AF_BLUE_STRING_TELUGU_TOP = 3168, - AF_BLUE_STRING_TELUGU_BOTTOM = 3196, - AF_BLUE_STRING_THAI_TOP = 3224, - AF_BLUE_STRING_THAI_BOTTOM = 3248, - AF_BLUE_STRING_THAI_ASCENDER = 3276, - AF_BLUE_STRING_THAI_LARGE_ASCENDER = 3288, - AF_BLUE_STRING_THAI_DESCENDER = 3300, - AF_BLUE_STRING_THAI_LARGE_DESCENDER = 3316, - AF_BLUE_STRING_THAI_DIGIT_TOP = 3324, - AF_BLUE_STRING_TIFINAGH = 3336, - af_blue_1_1 = 3367, + AF_BLUE_STRING_DESERET_CAPITAL_TOP = 567, + AF_BLUE_STRING_DESERET_CAPITAL_BOTTOM = 592, + AF_BLUE_STRING_DESERET_SMALL_TOP = 617, + AF_BLUE_STRING_DESERET_SMALL_BOTTOM = 642, + AF_BLUE_STRING_DEVANAGARI_BASE = 667, + AF_BLUE_STRING_DEVANAGARI_TOP = 699, + AF_BLUE_STRING_DEVANAGARI_HEAD = 731, + AF_BLUE_STRING_DEVANAGARI_BOTTOM = 763, + AF_BLUE_STRING_ETHIOPIC_TOP = 771, + AF_BLUE_STRING_ETHIOPIC_BOTTOM = 803, + AF_BLUE_STRING_GEORGIAN_MKHEDRULI_TOP = 835, + AF_BLUE_STRING_GEORGIAN_MKHEDRULI_BOTTOM = 867, + AF_BLUE_STRING_GEORGIAN_MKHEDRULI_ASCENDER = 899, + AF_BLUE_STRING_GEORGIAN_MKHEDRULI_DESCENDER = 931, + AF_BLUE_STRING_GEORGIAN_ASOMTAVRULI_TOP = 963, + AF_BLUE_STRING_GEORGIAN_ASOMTAVRULI_BOTTOM = 995, + AF_BLUE_STRING_GEORGIAN_NUSKHURI_TOP = 1027, + AF_BLUE_STRING_GEORGIAN_NUSKHURI_BOTTOM = 1059, + AF_BLUE_STRING_GEORGIAN_NUSKHURI_ASCENDER = 1091, + AF_BLUE_STRING_GEORGIAN_NUSKHURI_DESCENDER = 1123, + AF_BLUE_STRING_GLAGOLITIC_CAPITAL_TOP = 1155, + AF_BLUE_STRING_GLAGOLITIC_CAPITAL_BOTTOM = 1187, + AF_BLUE_STRING_GLAGOLITIC_SMALL_TOP = 1219, + AF_BLUE_STRING_GLAGOLITIC_SMALL_BOTTOM = 1251, + AF_BLUE_STRING_GREEK_CAPITAL_TOP = 1283, + AF_BLUE_STRING_GREEK_CAPITAL_BOTTOM = 1304, + AF_BLUE_STRING_GREEK_SMALL_BETA_TOP = 1322, + AF_BLUE_STRING_GREEK_SMALL = 1340, + AF_BLUE_STRING_GREEK_SMALL_DESCENDER = 1364, + AF_BLUE_STRING_GUJARATI_TOP = 1388, + AF_BLUE_STRING_GUJARATI_BOTTOM = 1420, + AF_BLUE_STRING_GUJARATI_ASCENDER = 1452, + AF_BLUE_STRING_GUJARATI_DESCENDER = 1502, + AF_BLUE_STRING_GUJARATI_DIGIT_TOP = 1535, + AF_BLUE_STRING_GURMUKHI_BASE = 1555, + AF_BLUE_STRING_GURMUKHI_HEAD = 1587, + AF_BLUE_STRING_GURMUKHI_TOP = 1619, + AF_BLUE_STRING_GURMUKHI_BOTTOM = 1651, + AF_BLUE_STRING_GURMUKHI_DIGIT_TOP = 1683, + AF_BLUE_STRING_HEBREW_TOP = 1703, + AF_BLUE_STRING_HEBREW_BOTTOM = 1727, + AF_BLUE_STRING_HEBREW_DESCENDER = 1745, + AF_BLUE_STRING_KANNADA_TOP = 1760, + AF_BLUE_STRING_KANNADA_BOTTOM = 1804, + AF_BLUE_STRING_KHMER_TOP = 1836, + AF_BLUE_STRING_KHMER_SUBSCRIPT_TOP = 1860, + AF_BLUE_STRING_KHMER_BOTTOM = 1900, + AF_BLUE_STRING_KHMER_DESCENDER = 1932, + AF_BLUE_STRING_KHMER_LARGE_DESCENDER = 1966, + AF_BLUE_STRING_KHMER_SYMBOLS_WAXING_TOP = 2053, + AF_BLUE_STRING_KHMER_SYMBOLS_WANING_BOTTOM = 2061, + AF_BLUE_STRING_LAO_TOP = 2069, + AF_BLUE_STRING_LAO_BOTTOM = 2101, + AF_BLUE_STRING_LAO_ASCENDER = 2133, + AF_BLUE_STRING_LAO_LARGE_ASCENDER = 2149, + AF_BLUE_STRING_LAO_DESCENDER = 2161, + AF_BLUE_STRING_LATIN_CAPITAL_TOP = 2185, + AF_BLUE_STRING_LATIN_CAPITAL_BOTTOM = 2201, + AF_BLUE_STRING_LATIN_SMALL_F_TOP = 2217, + AF_BLUE_STRING_LATIN_SMALL_TOP = 2231, + AF_BLUE_STRING_LATIN_SMALL_BOTTOM = 2247, + AF_BLUE_STRING_LATIN_SMALL_DESCENDER = 2263, + AF_BLUE_STRING_LATIN_SUBS_CAPITAL_TOP = 2273, + AF_BLUE_STRING_LATIN_SUBS_CAPITAL_BOTTOM = 2293, + AF_BLUE_STRING_LATIN_SUBS_SMALL_F_TOP = 2313, + AF_BLUE_STRING_LATIN_SUBS_SMALL = 2333, + AF_BLUE_STRING_LATIN_SUBS_SMALL_DESCENDER = 2369, + AF_BLUE_STRING_LATIN_SUPS_CAPITAL_TOP = 2389, + AF_BLUE_STRING_LATIN_SUPS_CAPITAL_BOTTOM = 2420, + AF_BLUE_STRING_LATIN_SUPS_SMALL_F_TOP = 2449, + AF_BLUE_STRING_LATIN_SUPS_SMALL = 2475, + AF_BLUE_STRING_LATIN_SUPS_SMALL_DESCENDER = 2500, + AF_BLUE_STRING_LISU_TOP = 2511, + AF_BLUE_STRING_LISU_BOTTOM = 2543, + AF_BLUE_STRING_MALAYALAM_TOP = 2575, + AF_BLUE_STRING_MALAYALAM_BOTTOM = 2619, + AF_BLUE_STRING_MYANMAR_TOP = 2651, + AF_BLUE_STRING_MYANMAR_BOTTOM = 2683, + AF_BLUE_STRING_MYANMAR_ASCENDER = 2715, + AF_BLUE_STRING_MYANMAR_DESCENDER = 2743, + AF_BLUE_STRING_NKO_TOP = 2775, + AF_BLUE_STRING_NKO_BOTTOM = 2799, + AF_BLUE_STRING_NKO_SMALL_TOP = 2814, + AF_BLUE_STRING_NKO_SMALL_BOTTOM = 2823, + AF_BLUE_STRING_OL_CHIKI = 2835, + AF_BLUE_STRING_OSAGE_CAPITAL_TOP = 2859, + AF_BLUE_STRING_OSAGE_CAPITAL_BOTTOM = 2899, + AF_BLUE_STRING_OSAGE_CAPITAL_DESCENDER = 2929, + AF_BLUE_STRING_OSAGE_SMALL_TOP = 2944, + AF_BLUE_STRING_OSAGE_SMALL_BOTTOM = 2984, + AF_BLUE_STRING_OSAGE_SMALL_ASCENDER = 3024, + AF_BLUE_STRING_OSAGE_SMALL_DESCENDER = 3049, + AF_BLUE_STRING_SINHALA_TOP = 3064, + AF_BLUE_STRING_SINHALA_BOTTOM = 3096, + AF_BLUE_STRING_SINHALA_DESCENDER = 3128, + AF_BLUE_STRING_TAI_VIET_TOP = 3172, + AF_BLUE_STRING_TAI_VIET_BOTTOM = 3192, + AF_BLUE_STRING_TAMIL_TOP = 3204, + AF_BLUE_STRING_TAMIL_BOTTOM = 3236, + AF_BLUE_STRING_TELUGU_TOP = 3268, + AF_BLUE_STRING_TELUGU_BOTTOM = 3296, + AF_BLUE_STRING_THAI_TOP = 3324, + AF_BLUE_STRING_THAI_BOTTOM = 3348, + AF_BLUE_STRING_THAI_ASCENDER = 3376, + AF_BLUE_STRING_THAI_LARGE_ASCENDER = 3388, + AF_BLUE_STRING_THAI_DESCENDER = 3400, + AF_BLUE_STRING_THAI_LARGE_DESCENDER = 3416, + AF_BLUE_STRING_THAI_DIGIT_TOP = 3424, + AF_BLUE_STRING_TIFINAGH = 3436, + af_blue_1_1 = 3467, #ifdef AF_CONFIG_OPTION_CJK AF_BLUE_STRING_CJK_TOP = af_blue_1_1 + 1, AF_BLUE_STRING_CJK_BOTTOM = af_blue_1_1 + 203, @@ -272,35 +276,36 @@ FT_BEGIN_HEADER AF_BLUE_STRINGSET_CHER = 21, AF_BLUE_STRINGSET_CYRL = 28, AF_BLUE_STRINGSET_DEVA = 34, - AF_BLUE_STRINGSET_ETHI = 40, - AF_BLUE_STRINGSET_GEOR = 43, - AF_BLUE_STRINGSET_GEOK = 48, - AF_BLUE_STRINGSET_GLAG = 55, - AF_BLUE_STRINGSET_GREK = 60, - AF_BLUE_STRINGSET_GUJR = 67, - AF_BLUE_STRINGSET_GURU = 73, - AF_BLUE_STRINGSET_HEBR = 79, - AF_BLUE_STRINGSET_KNDA = 83, - AF_BLUE_STRINGSET_KHMR = 86, - AF_BLUE_STRINGSET_KHMS = 92, - AF_BLUE_STRINGSET_LAO = 95, - AF_BLUE_STRINGSET_LATN = 101, - AF_BLUE_STRINGSET_LATB = 108, - AF_BLUE_STRINGSET_LATP = 115, - AF_BLUE_STRINGSET_LISU = 122, - AF_BLUE_STRINGSET_MLYM = 125, - AF_BLUE_STRINGSET_MYMR = 128, - AF_BLUE_STRINGSET_NKOO = 133, - AF_BLUE_STRINGSET_NONE = 138, - AF_BLUE_STRINGSET_OLCK = 139, - AF_BLUE_STRINGSET_OSGE = 142, - AF_BLUE_STRINGSET_SINH = 150, - AF_BLUE_STRINGSET_TAML = 154, - AF_BLUE_STRINGSET_TAVT = 157, - AF_BLUE_STRINGSET_TELU = 160, - AF_BLUE_STRINGSET_THAI = 163, - AF_BLUE_STRINGSET_TFNG = 171, - af_blue_2_1 = 174, + AF_BLUE_STRINGSET_DSRT = 40, + AF_BLUE_STRINGSET_ETHI = 45, + AF_BLUE_STRINGSET_GEOR = 48, + AF_BLUE_STRINGSET_GEOK = 53, + AF_BLUE_STRINGSET_GLAG = 60, + AF_BLUE_STRINGSET_GREK = 65, + AF_BLUE_STRINGSET_GUJR = 72, + AF_BLUE_STRINGSET_GURU = 78, + AF_BLUE_STRINGSET_HEBR = 84, + AF_BLUE_STRINGSET_KNDA = 88, + AF_BLUE_STRINGSET_KHMR = 91, + AF_BLUE_STRINGSET_KHMS = 97, + AF_BLUE_STRINGSET_LAO = 100, + AF_BLUE_STRINGSET_LATN = 106, + AF_BLUE_STRINGSET_LATB = 113, + AF_BLUE_STRINGSET_LATP = 120, + AF_BLUE_STRINGSET_LISU = 127, + AF_BLUE_STRINGSET_MLYM = 130, + AF_BLUE_STRINGSET_MYMR = 133, + AF_BLUE_STRINGSET_NKOO = 138, + AF_BLUE_STRINGSET_NONE = 143, + AF_BLUE_STRINGSET_OLCK = 144, + AF_BLUE_STRINGSET_OSGE = 147, + AF_BLUE_STRINGSET_SINH = 155, + AF_BLUE_STRINGSET_TAML = 159, + AF_BLUE_STRINGSET_TAVT = 162, + AF_BLUE_STRINGSET_TELU = 165, + AF_BLUE_STRINGSET_THAI = 168, + AF_BLUE_STRINGSET_TFNG = 176, + af_blue_2_1 = 179, #ifdef AF_CONFIG_OPTION_CJK AF_BLUE_STRINGSET_HANI = af_blue_2_1 + 0, af_blue_2_1_1 = af_blue_2_1 + 2, diff --git a/src/autofit/afranges.c b/src/autofit/afranges.c index 9c94421c5..1431bc6b1 100644 --- a/src/autofit/afranges.c +++ b/src/autofit/afranges.c @@ -200,6 +200,18 @@ }; + const AF_Script_UniRangeRec af_dsrt_uniranges[] = + { + AF_UNIRANGE_REC( 0x10400, 0x1044F ), /* Deseret */ + AF_UNIRANGE_REC( 0, 0 ) + }; + + const AF_Script_UniRangeRec af_dsrt_nonbase_uniranges[] = + { + AF_UNIRANGE_REC( 0, 0 ) + }; + + const AF_Script_UniRangeRec af_ethi_uniranges[] = { AF_UNIRANGE_REC( 0x1200, 0x137F ), /* Ethiopic */ diff --git a/src/autofit/afscript.h b/src/autofit/afscript.h index e67dd574a..7de40502a 100644 --- a/src/autofit/afscript.h +++ b/src/autofit/afscript.h @@ -73,6 +73,12 @@ HINTING_TOP_TO_BOTTOM, "\xE0\xA4\xA0 \xE0\xA4\xB5 \xE0\xA4\x9F" ) /* ठ व ट */ + SCRIPT( dsrt, DSRT, + "Deseret", + HB_SCRIPT_DESERET, + HINTING_BOTTOM_TO_TOP, + "\xF0\x90\x90\x84 \xF0\x90\x90\xAC") /* 𐐄 𐐬 */ + SCRIPT( ethi, ETHI, "Ethiopic", HB_SCRIPT_ETHIOPIC, diff --git a/src/autofit/afstyles.h b/src/autofit/afstyles.h index 606f18fa2..dc7928374 100644 --- a/src/autofit/afstyles.h +++ b/src/autofit/afstyles.h @@ -127,6 +127,13 @@ AF_BLUE_STRINGSET_DEVA, AF_COVERAGE_DEFAULT ) + STYLE( dsrt_dflt, DSRT_DFLT, + "Deseret default style", + AF_WRITING_SYSTEM_LATIN, + AF_SCRIPT_DSRT, + AF_BLUE_STRINGSET_DSRT, + AF_COVERAGE_DEFAULT ) + STYLE( ethi_dflt, ETHI_DFLT, "Ethiopic default style", AF_WRITING_SYSTEM_LATIN, From 5bf4b1aaf78f02c9216653fbad6c5954234871b2 Mon Sep 17 00:00:00 2001 From: Sascha Brawer Date: Sat, 8 Apr 2017 11:38:52 +0200 Subject: [PATCH 054/470] [autofit] Add support for Cypriot script. * src/autofit/afblue.dat: Add blue zone data for Cypriot. * src/autofit/afblue.c, src/autofit/afblue.h: Regenerated. * src/autofit/afscript.h: Add Cypriot standard characters. * src/autofit/afranges.c, src/autofit/afstyles.h: Add Cypriot data. --- ChangeLog | 12 ++ src/autofit/afblue.c | 11 ++ src/autofit/afblue.dat | 14 ++ src/autofit/afblue.h | 296 +++++++++++++++++++++-------------------- src/autofit/afranges.c | 12 ++ src/autofit/afscript.h | 6 + src/autofit/afstyles.h | 7 + 7 files changed, 212 insertions(+), 146 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7d0fb6df5..3c51943fe 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2017-04-08 Sascha Brawer + Werner Lemberg Werner Lemberg Date: Sat, 8 Apr 2017 16:11:44 +0200 Subject: [PATCH 055/470] [autofit] Add support for Gothic script. * src/autofit/afblue.dat: Add blue zone data for Gothic. * src/autofit/afblue.c, src/autofit/afblue.h: Regenerated. * src/autofit/afscript.h: Add Gothic standard characters. * src/autofit/afranges.c, src/autofit/afstyles.h: Add Gothic data. --- ChangeLog | 12 +++ src/autofit/afblue.c | 7 ++ src/autofit/afblue.dat | 10 ++ src/autofit/afblue.h | 225 +++++++++++++++++++++-------------------- src/autofit/afranges.c | 12 +++ src/autofit/afscript.h | 6 ++ src/autofit/afstyles.h | 7 ++ 7 files changed, 168 insertions(+), 111 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3c51943fe..ba3707b6c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2017-04-08 Sascha Brawer + Werner Lemberg Werner Lemberg Date: Sat, 8 Apr 2017 17:58:57 +0200 Subject: [PATCH 056/470] [autofit] Add support for Old Turkic script. * src/autofit/afblue.dat: Add blue zone data for Old Turkic. * src/autofit/afblue.c, src/autofit/afblue.h: Regenerated. * src/autofit/afscript.h: Add Old Turkic standard characters. * src/autofit/afranges.c, src/autofit/afstyles.h: Add Old Turkic data. --- ChangeLog | 12 ++++++++ docs/CHANGES | 16 ++++++++-- src/autofit/afblue.c | 7 +++++ src/autofit/afblue.dat | 10 ++++++ src/autofit/afblue.h | 69 ++++++++++++++++++++++-------------------- src/autofit/afranges.c | 12 ++++++++ src/autofit/afscript.h | 6 ++++ src/autofit/afstyles.h | 7 +++++ 8 files changed, 104 insertions(+), 35 deletions(-) diff --git a/ChangeLog b/ChangeLog index ba3707b6c..c9dfba5f8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2017-04-08 Sascha Brawer + Werner Lemberg Werner Lemberg Date: Sat, 15 Apr 2017 23:48:59 -0400 Subject: [PATCH 057/470] Typos. --- ChangeLog.21 | 10 +++++----- ChangeLog.22 | 4 ++-- ChangeLog.23 | 2 +- include/freetype/ftlcdfil.h | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/ChangeLog.21 b/ChangeLog.21 index 904e4626e..93d56ad99 100644 --- a/ChangeLog.21 +++ b/ChangeLog.21 @@ -3361,7 +3361,7 @@ * src/base/ftstroke.c: Include FT_INTERNAL_OBJECTS_H. (FT_Outline_GetOutsideBorder): Inverse result. - (FT_Stroker_Rewind, FT_Glyph_Stroke, FT_GlyphStrokeBorder): New + (FT_Stroker_Rewind, FT_Glyph_Stroke, FT_Glyph_StrokeBorder): New functions. (FT_Stroker_EndSubPath): Close path if needed. (FT_Stroker_Set, FT_Stroker_ParseOutline): Use FT_Stroker_Rewind. @@ -3493,8 +3493,8 @@ 2003-12-23 David Turner * include/freetype/internal/ftobjs.h (FT_PAD_FLOOR, FT_PAD_ROUND, - FT_PAD_CEIL, FT_PIX_FLOOR, FT_PIX_ROUND, FT_CEIL): New macros. They - are used to avoid compiler warnings with very pedantic compilers. + FT_PAD_CEIL, FT_PIX_FLOOR, FT_PIX_ROUND, FT_PIX_CEIL): New macros. + They are used to avoid compiler warnings with very pedantic compilers. Note that `(x) & -64' causes a warning if (x) is not signed. Use `(x) & ~63' instead! Updated all related code. @@ -4231,7 +4231,7 @@ (t42_parse_encoding): Use `ft_isdigit'. - * src/base/ftmm.c (ft_face_get_mm_service): Return FT_Err_OK if + * src/base/ftmm.c (ft_face_get_mm_service): Return FT_Err_Ok if success. 2003-10-05 Werner Lemberg @@ -5916,7 +5916,7 @@ 2003-04-23 Werner Lemberg * src/pfr/pfrload.c (pfr_extra_item_load_font_id): Use FT_PtrDist - instead of FT_Uint for `len'. + instead of FT_UInt for `len'. 2003-04-22 Werner Lemberg diff --git a/ChangeLog.22 b/ChangeLog.22 index 532930829..08dc3584e 100644 --- a/ChangeLog.22 +++ b/ChangeLog.22 @@ -189,7 +189,7 @@ * src/base/ftdbgmem.c (_ft_debug_file, _ft_debug_lineno) [FT_DEBUG_MEMORY]: New global variables, replacing... - (FT_MemTable_Rec) [FT_DEBUG_MEMORY]: Remove `filename' and + (FT_MemTableRec) [FT_DEBUG_MEMORY]: Remove `filename' and `line_no'. Update all callers. (ft_mem_debug_alloc) [FT_DEBUG_MEMORY]: Avoid possible integer overflow. @@ -494,7 +494,7 @@ FTC_MruList_Init, FTC_MruList_Reset, FTC_MruList_Done, FTC_MruList_New, FTC_MruList_Remove, FTC_MruList_RemoveSelection): Declare as FT_LOCAL_DEF. - (FTC_MruListFind, FTC_MruList_Lookup) [!FTC_INLINE]: Compile + (FTC_MruList_Find, FTC_MruList_Lookup) [!FTC_INLINE]: Compile conditionally. Declare as FT_LOCAL_DEF. diff --git a/ChangeLog.23 b/ChangeLog.23 index 79dc028c1..c14c8fcab 100644 --- a/ChangeLog.23 +++ b/ChangeLog.23 @@ -7023,7 +7023,7 @@ (_ft_lcd_filter_fir): This. Update parameters. (_ft_lcd_filter_legacy) [USE_LEGACY]: New filter function. - (FT_Library_Set_LcdFilter): Update parameters. + (FT_Library_SetLcdFilter): Update parameters. Handle new filter modes. * include/internal/ftobjs.h: Include FT_LCD_FILTER_H. diff --git a/include/freetype/ftlcdfil.h b/include/freetype/ftlcdfil.h index a021c803b..cc9a43c3b 100644 --- a/include/freetype/ftlcdfil.h +++ b/include/freetype/ftlcdfil.h @@ -288,7 +288,7 @@ FT_BEGIN_HEADER * corresponding argument specifies the five LCD filter weights for a * given face (if using @FT_LOAD_TARGET_LCD, for example), overriding * the global default values or the values set up with - * @FT_Library_Set_LcdFilterWeights. + * @FT_Library_SetLcdFilterWeights. * */ #define FT_PARAM_TAG_LCD_FILTER_WEIGHTS \ From 5efba4c4dcc865edbc2b40134b6a1b8ae3caadae Mon Sep 17 00:00:00 2001 From: Hin-Tak Leung Date: Sun, 16 Apr 2017 07:23:24 +0200 Subject: [PATCH 058/470] Fix tracing messages. * src/base/ftobjs.c (FT_Face_GetCharVariantIndex, FT_Face_GetCharVariantIsDefault, FT_Face_GetVariantsOfChar): Print correct function name. --- ChangeLog | 8 ++++++++ src/base/ftobjs.c | 14 +++++++++----- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index c9dfba5f8..d6d949b51 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2017-04-16 Hin-Tak Leung + + Fix tracing messages. + + * src/base/ftobjs.c (FT_Face_GetCharVariantIndex, + FT_Face_GetCharVariantIsDefault, FT_Face_GetVariantsOfChar): Print + correct function name. + 2017-04-08 Sascha Brawer Werner Lemberg 0xFFFFFFFFUL ) { - FT_TRACE1(( "FT_Get_Char_Index: too large charcode" )); + FT_TRACE1(( "FT_Face_GetCharVariantIndex:" + " too large charcode" )); FT_TRACE1(( " 0x%x is truncated\n", charcode )); } if ( variantSelector > 0xFFFFFFFFUL ) { - FT_TRACE1(( "FT_Get_Char_Index: too large variantSelector" )); + FT_TRACE1(( "FT_Face_GetCharVariantIndex:" + " too large variantSelector" )); FT_TRACE1(( " 0x%x is truncated\n", variantSelector )); } @@ -3750,12 +3752,14 @@ if ( charcode > 0xFFFFFFFFUL ) { - FT_TRACE1(( "FT_Get_Char_Index: too large charcode" )); + FT_TRACE1(( "FT_Face_GetCharVariantIsDefault:" + " too large charcode" )); FT_TRACE1(( " 0x%x is truncated\n", charcode )); } if ( variantSelector > 0xFFFFFFFFUL ) { - FT_TRACE1(( "FT_Get_Char_Index: too large variantSelector" )); + FT_TRACE1(( "FT_Face_GetCharVariantIsDefault:" + " too large variantSelector" )); FT_TRACE1(( " 0x%x is truncated\n", variantSelector )); } @@ -3818,7 +3822,7 @@ if ( charcode > 0xFFFFFFFFUL ) { - FT_TRACE1(( "FT_Get_Char_Index: too large charcode" )); + FT_TRACE1(( "FT_Face_GetVariantsOfChar: too large charcode" )); FT_TRACE1(( " 0x%x is truncated\n", charcode )); } From eb0683129bc5d8f7d5e2f5cbdfca12b6f0a5e9c4 Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Sun, 16 Apr 2017 23:41:26 -0400 Subject: [PATCH 059/470] Typos. --- ChangeLog.20 | 2 +- ChangeLog.21 | 6 +++--- ChangeLog.22 | 2 +- ChangeLog.23 | 2 +- docs/CHANGES | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/ChangeLog.20 b/ChangeLog.20 index a6ceb4f78..eabd9d407 100644 --- a/ChangeLog.20 +++ b/ChangeLog.20 @@ -1524,7 +1524,7 @@ * src/base/ftcalc.c (FT_DivFix): Fixed a bug in the 64-bit code that created incorrect scale factors! - (FT_Round_Fix, FT_CeilFix, FT_FloorFix): Minor improvements. + (FT_RoundFix, FT_CeilFix, FT_FloorFix): Minor improvements. 2001-05-12 Werner Lemberg diff --git a/ChangeLog.21 b/ChangeLog.21 index 93d56ad99..f5d4d1ee9 100644 --- a/ChangeLog.21 +++ b/ChangeLog.21 @@ -617,7 +617,7 @@ `ft_get_adobe_glyph_index', a new function defined in `pstables.h'. (ps_get_macintosh_name, ps_get_standard_strings): Updated. - * src/base/ftobjs.c (FT_Set_Char_Sizes): Handle fractional sizes + * src/base/ftobjs.c (FT_Set_Char_Size): Handle fractional sizes more carefully. This fixes Savannah bug #12263. 2005-03-06 David Turner @@ -2101,7 +2101,7 @@ 2004-06-08 David Turner - * include/freetype/freetype.h (FT_GlyphMetrics): Move `lsb_delta' + * include/freetype/freetype.h (FT_Glyph_Metrics): Move `lsb_delta' and `rsb_delta' elements to... (FT_GlyphSlotRec): Here to retain binary compatibility with older FreeType versions. @@ -5024,7 +5024,7 @@ drivers. * src/base/ftobjs.c (FT_Set_Char_Size): Remove redundant code. - (FT_Set_Pixel_Size): Assign value to `metrics' after validation of + (FT_Set_Pixel_Sizes): Assign value to `metrics' after validation of arguments. 2003-06-20 Werner Lemberg diff --git a/ChangeLog.22 b/ChangeLog.22 index 08dc3584e..481c25ee3 100644 --- a/ChangeLog.22 +++ b/ChangeLog.22 @@ -814,7 +814,7 @@ * include/freetype/ftcache.h (FTC_IMAGE_TYPE_COMPARE, FTC_IMAGE_TYPE_HASH), src/cache/ftcbasic.c (FTC_OldFontRec, FTC_OldImageDescRec, FTC_ImageCache_Lookup, FTC_Image_Cache_New, - FTC_OldImage_Desc, FTC_OLD_IMAGE_FORMAT, ftc_old_image_xxx, + FTC_OldImageDesc, FTC_OLD_IMAGE_FORMAT, ftc_old_image_xxx, ftc_image_type_from_old_desc, FTC_Image_Cache_Lookup, FTC_SBitCache_Lookup, FTC_SBit_Cache_New, FTC_SBit_Cache_Lookup) [FT_CONFIG_OPTION_OLD_INTERNALS]: Try to revive old functions of the diff --git a/ChangeLog.23 b/ChangeLog.23 index c14c8fcab..a17a464c9 100644 --- a/ChangeLog.23 +++ b/ChangeLog.23 @@ -5243,7 +5243,7 @@ functions related to cmap type 14 support to the `FT_Object_ActionName' scheme: - FT_Get_Char_Variant_index -> FT_Face_GetCharVariantIndex + FT_Get_Char_Variant_Index -> FT_Face_GetCharVariantIndex FT_Get_Char_Variant_IsDefault -> FT_Face_GetCharVariantIsDefault FT_Get_Variant_Selectors -> FT_Face_GetVariantSelectors FT_Get_Variants_Of_Char -> FT_Face_GetVariantsOfChar diff --git a/docs/CHANGES b/docs/CHANGES index 5a1aa602b..c3c140232 100644 --- a/docs/CHANGES +++ b/docs/CHANGES @@ -2341,7 +2341,7 @@ CHANGES BETWEEN 2.1.8 and 2.1.7 correctly treated as a CID, similar to FreeType's CID driver module. Note that CID CMap support is still missing. - - The FT_FACE_FLAGS_GLYPH_NAMES flag is now set correctly for all + - The FT_FACE_FLAG_GLYPH_NAMES flag is now set correctly for all font formats. - Some subsetted Type 1 fonts weren't parsed correctly. This bug From 71d289da3b6372e1d7c844060c44d3ba1cfefa04 Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Wed, 19 Apr 2017 23:50:29 -0400 Subject: [PATCH 060/470] Typos. --- ChangeLog | 6 +++--- ChangeLog.20 | 2 +- ChangeLog.21 | 16 ++++++++-------- ChangeLog.23 | 14 +++++++------- ChangeLog.24 | 6 +++--- ChangeLog.25 | 2 +- src/sfnt/ttload.c | 2 +- src/smooth/ftsmooth.h | 2 +- 8 files changed, 25 insertions(+), 25 deletions(-) diff --git a/ChangeLog b/ChangeLog index d6d949b51..af21e0378 100644 --- a/ChangeLog +++ b/ChangeLog @@ -329,7 +329,7 @@ * src/truetype/ttdriver.c (tt_size_select): s/metrics/size_metrics/. - * src/truetype/ttgload.c (tt_get_metrics_incr_overrids, + * src/truetype/ttgload.c (tt_get_metrics_incr_overrides, compute_glyph_metrics): s/metrics/incr_metrics/. (load_sbit_image): s/metrics/sbit_metrics/. @@ -860,7 +860,7 @@ (FT_LibraryRec): Updated. * src/base/ftlcdfil.c (_ft_lcd_filter_fir): Renamed to... - (ft_lcd_filter_dir): ... this base function. + (ft_lcd_filter_fir): ... this base function. Updated. (_ft_lcd_filter_legacy): Updated. (FT_Library_SetLcdFilterWeights, FT_Library_SetLcdFilter): Updated. @@ -1139,7 +1139,7 @@ (TT_Name_ConvertFunc): This. (tt_face_get_name): Updated. - * src/sfnt/ttload.c (tt_face_load_name, tt_face_free_names): + * src/sfnt/ttload.c (tt_face_load_name, tt_face_free_name): Updated. 2017-01-24 Werner Lemberg diff --git a/ChangeLog.20 b/ChangeLog.20 index eabd9d407..11376e863 100644 --- a/ChangeLog.20 +++ b/ChangeLog.20 @@ -1338,7 +1338,7 @@ (cff_compute_bias): Use `U' for constant. * src/cid/cidload.c (cid_decrypt): Ditto. * src/psaux/psobjs.c (T1_Decrypt): Ditto. - * src/psaux/t1decode.c (T1_Decoder_Parse_CharStrings): Ditto. + * src/psaux/t1decode.c (T1_Decoder_Parse_Charstrings): Ditto. * src/sfnt/ttload.c (TT_Load_Kern): Remove unused `version' variable. * src/sfnt/ttsbit.c (TT_Load_SBit_Image): Remove unused `top' diff --git a/ChangeLog.21 b/ChangeLog.21 index f5d4d1ee9..df7ce65ab 100644 --- a/ChangeLog.21 +++ b/ChangeLog.21 @@ -2864,7 +2864,7 @@ (psh_blues_snap_stem): Don't use blue_shift but blue_threshold. * src/pshinter/pshalgo.c (PSH_STRONG_THRESHOLD_MAXIMUM): New macro. - (psh_glyph_find_string_points): Use PSH_STRONG_THRESHOLD_MAXIMUM. + (psh_glyph_find_strong_points): Use PSH_STRONG_THRESHOLD_MAXIMUM. (psh_glyph_find_blue_points): New function. Needed for fonts like p052003l.pfb (URW Palladio L Roman) which have flex curves at the base line within blue zones, but the flex curves aren't covered by @@ -5200,7 +5200,7 @@ * src/cid/cidload.c (cid_load_keyword): Handle T1_FIELD_LOCATION_BBOX. (parse_font_bbox): Commented out. - (cid_field_record): Comment out element for parsing FontBBox. + (cid_field_records): Comment out element for parsing FontBBox. * src/type42/t42parse.c (t42_parse_font_bbox): Commented out. (t42_keywords): Handle FontBBox with T1_FIELD_BBOX, not with @@ -6550,7 +6550,7 @@ * src/cache/ftcsbits.c (ftc_sbit_node_load): Fixed a small bug that caused problems with embedded bitmaps. - * src/otlayout/otlayout.h, src/otlyaout/otlconf.h, + * src/otlayout/otlayout.h, src/otlayout/otlconf.h, src/otlayout/otlgsub.c, src/otlayout/otlgsub.h, src/otlayout/otlparse.c, src/otlayout/otlparse.h, src/otlayout/otlutils.h: Updating the OpenType Layout code, adding @@ -7376,7 +7376,7 @@ * src/pcf/pcfdriver.c (PCF_Glyph_Load): Fix computation of horiBearingX. - * src/bdf/bdfdrivr.c (BDF_GlyphLoad): Fix computation of + * src/bdf/bdfdrivr.c (BDF_Glyph_Load): Fix computation of horiBearingY. 2002-08-16 George Williams @@ -7603,7 +7603,7 @@ * src/cid/cidriver.c (Cid_Get_Char_Index, Cid_Get_Next_Char): Removed. - (t1_cid_driver_class): Updated. + (t1cid_driver_class): Updated. * src/truetype/ttdriver.c (tt_driver_class): Updated. * src/type1/t1driver.c (Get_Char_Index, Get_Next_Char): Removed (t1_driver_class): Updated. @@ -7698,7 +7698,7 @@ CFF_Done_SubFont -> cff_subfont_done CFF_Load_Font -> cff_font_load CFF_Done_Font -> cff_font_done - CFF_Size_Get_Global_Funcs -> cff_size_get_global_funcs + CFF_Size_Get_Globals_Funcs -> cff_size_get_globals_funcs CFF_Size_Done -> cff_size_done CFF_Size_Init -> cff_size_init CFF_Size_Reset -> cff_size_reset @@ -9106,7 +9106,7 @@ FT_Realloc_Debug, FT_Free_Debug): Fix compiler warnings. * src/base/ftcalc.c (FT_MulFix): Ditto. * src/cff/cffdrivr.c (cff_get_name_index): Ditto. - * src/cff/cffobjs.c (CFF_Size_Get_Global_Funcs, CFF_Size_Init, + * src/cff/cffobjs.c (CFF_Size_Get_Globals_Funcs, CFF_Size_Init, CFF_GlyphSlot_Init): Ditto. * src/cid/cidobjs.c (CID_GlyphSlot_Init, CID_Size_Get_Globals_Funcs): Ditto. @@ -9384,7 +9384,7 @@ * src/pcf/pcfread.c (pcf_seek_to_table_type): Ditto. * src/sfnt/sfdriver.c (get_sfnt_postscript_name): Ditto. (pcf_get_bitmaps): The same for `sizebitmaps'. - * src/psaux/t1decode.c (T1_Decode_Parse_Charstrings): The same for + * src/psaux/t1decode.c (T1_Decoder_Parse_Charstrings): The same for `orig_y'. (t1operator_seac): Comment out more dead code. * src/pshinter/pshalgo2.c (ps2_hints_apply): Add `DEBUG_HINTER' diff --git a/ChangeLog.23 b/ChangeLog.23 index a17a464c9..0cebab82d 100644 --- a/ChangeLog.23 +++ b/ChangeLog.23 @@ -929,7 +929,7 @@ type1: Fix a data type mismatching with its source. * include/freetype/internal/t1types.h: The type of - T1_Face->buildchar is matched with T1_Decorder->top. + T1_Face->buildchar is matched with T1_Decoder->top. 2009-07-31 suzuki toshiya @@ -975,8 +975,8 @@ psaux: Fix a data type mismatching with its source. * include/freetype/internal/psaux.h: The type of - T1_DecorderRec.buildchar is matched with - T1_DecorderRec.top. + T1_DecoderRec.buildchar is matched with + T1_DecoderRec.top. 2009-07-31 suzuki toshiya @@ -2125,7 +2125,7 @@ code unconditionally. Add support for random numbers and update remaining code accordingly; this should work now. - (t1_operator_seac): Updated. + (t1operator_seac): Updated. * src/psaux/pshrec.c: Include FT_INTERNAL_CALC_H. (ps_hints_t1stem3, t1_hints_stem): Updated. @@ -2594,14 +2594,14 @@ Position Independent Code (PIC) support in smooth renderer. * src/smooth/ftsmooth.h declare ft_smooth_renderer_class, - ft_smooth_lcd_renderer_class and ft_smooth_lcd_v_renderer_class + ft_smooth_lcd_renderer_class and ft_smooth_lcdv_renderer_class using macros from ftrender.h, when FT_CONFIG_OPTION_PIC is defined create and destroy functions will be declared. * src/smooth/ftsmooth.c when FT_CONFIG_OPTION_PIC is defined the following structs: ft_smooth_renderer_class, ft_smooth_lcd_renderer_class - and ft_smooth_lcd_v_renderer_class + and ft_smooth_lcdv_renderer_class will have functions to init or create and destroy them instead of being allocated in the global scope. And macros will be used from ftspic.h in order to access @@ -5530,7 +5530,7 @@ * src/truetype/ttinterp.c (Ins_IUP): Add missing variable initialization. - * src/autofit/aflatin.c (af_latin_metric_init_blues): Get rid of an + * src/autofit/aflatin.c (af_latin_metrics_init_blues): Get rid of an infinite loop in the case of degenerate fonts. 2007-06-26 Rahul Bhalerao diff --git a/ChangeLog.24 b/ChangeLog.24 index 4f32a6be7..577ffeddf 100644 --- a/ChangeLog.24 +++ b/ChangeLog.24 @@ -2941,10 +2941,10 @@ [type42] Remove casts. - * src/type42/t42driver.c (t42_driver_class): Remove all casts and + * src/type42/t42drivr.c (t42_driver_class): Remove all casts and update affected functions. - * src/type42/t42objs.c, src/type42/t42objs.h: Updated for t42driver + * src/type42/t42objs.c, src/type42/t42objs.h: Updated for t42 driver changes. 2011-11-30 Werner Lemberg @@ -4029,7 +4029,7 @@ af_latin_hints_compute_blue_edges. (af_cjk_metrics_init_blues): New function, CJK version of af_latin_metrics_init_blues. - (af_cjk_hints_edges): Add code to align the edge stems to blue zones. + (af_cjk_hint_edges): Add code to align the edge stems to blue zones. * src/autofit/afindic.c (af_indic_metrics_init): Take AF_CJKMetric instead of AF_LatinMetric, and initialize as af_cjk_metrics_init. diff --git a/ChangeLog.25 b/ChangeLog.25 index 109ff67d9..60de5640f 100644 --- a/ChangeLog.25 +++ b/ChangeLog.25 @@ -4767,7 +4767,7 @@ * src/cache/ftcmanag.c (FTC_Manager_Check): Fix cast. * src/cache/ftcmanag.h (FTC_ManagerRec): Ditto. - * src/cff/cf2arrst.c (cf2_arrstack_setNum_Elements): Use cast. + * src/cff/cf2arrst.c (cf2_arrstack_setNumElements): Use cast. * src/cff/cf2ft.c (cf2_freeSeacComponent): Ditto. * src/cff/cffobjs.c (remove_subset_prefix, remove_style): Ditto. diff --git a/src/sfnt/ttload.c b/src/sfnt/ttload.c index 4695253f2..df99baa53 100644 --- a/src/sfnt/ttload.c +++ b/src/sfnt/ttload.c @@ -984,7 +984,7 @@ /*************************************************************************/ /* */ /* */ - /* tt_face_free_names */ + /* tt_face_free_name */ /* */ /* */ /* Frees the name records. */ diff --git a/src/smooth/ftsmooth.h b/src/smooth/ftsmooth.h index 929e26078..b46525b92 100644 --- a/src/smooth/ftsmooth.h +++ b/src/smooth/ftsmooth.h @@ -36,7 +36,7 @@ FT_BEGIN_HEADER FT_DECLARE_RENDERER( ft_smooth_lcd_renderer_class ) - FT_DECLARE_RENDERER( ft_smooth_lcd_v_renderer_class ) + FT_DECLARE_RENDERER( ft_smooth_lcdv_renderer_class ) #endif From c5d9735d854c031bfee09d54b7d176a688ae1faf Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Fri, 21 Apr 2017 22:27:49 -0400 Subject: [PATCH 061/470] Typos. --- ChangeLog.21 | 5 ++--- ChangeLog.23 | 4 ++-- include/freetype/ftttdrv.h | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/ChangeLog.21 b/ChangeLog.21 index df7ce65ab..c36da8fd4 100644 --- a/ChangeLog.21 +++ b/ChangeLog.21 @@ -1819,7 +1819,7 @@ 2004-08-11 Detlef Würkner * src/base/ftrfork.c (FT_Raccess_Guess) - [!FT_CONFIG_OPTION_GUESSING_EMBEDDED_FORK]: Remove compiler + [!FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK]: Remove compiler warnings. 2004-08-06 Adam Piotrowski @@ -4749,8 +4749,7 @@ * include/freetype/ttunpat.h: Fixing documentation comment. * include/freetype/config/ftoption.h, devel/ftoption.h - (TT_CONFIG_OPTION_OPTION_COMPILE_UNPATENTED_HINTING): Replaced - with... + (TT_CONFIG_OPTION_COMPILE_UNPATENTED_HINTING): Replaced with... (TT_CONFIG_OPTION_UNPATENTED_HINTING): This. Updated all users. (TT_CONFIG_OPTION_FORCE_UNPATENTED_HINTING): Removed. diff --git a/ChangeLog.23 b/ChangeLog.23 index 0cebab82d..834f34d38 100644 --- a/ChangeLog.23 +++ b/ChangeLog.23 @@ -4861,7 +4861,7 @@ 2008-04-14 Werner Lemberg * src/pcf/pcfdrivr.c (PCF_Face_Init): Protect call to - `FT_Stream_OpenLZW' with `FT_CONFIG_OPTION_USE_LZ'. From Savannah + `FT_Stream_OpenLZW' with `FT_CONFIG_OPTION_USE_LZW'. From Savannah bug #22909. 2008-04-13 Werner Lemberg @@ -7857,7 +7857,7 @@ 2006-05-18 Werner Lemberg * src/truetype/ttgload.c (TT_Load_Composite_Glyph) - [FT_CONFIG_OPTION_BYTECODE_INTERPRETER]: Make it compilable again. + [TT_CONFIG_OPTION_BYTECODE_INTERPRETER]: Make it compilable again. 2006-05-17 David Turner diff --git a/include/freetype/ftttdrv.h b/include/freetype/ftttdrv.h index 79e3e6e8b..50e1b246a 100644 --- a/include/freetype/ftttdrv.h +++ b/include/freetype/ftttdrv.h @@ -225,7 +225,7 @@ FT_BEGIN_HEADER * filtering. * * If FreeType has not been compiled with the configuration option - * FT_CONFIG_OPTION_SUBPIXEL_HINTING, selecting version~38 or~40 causes + * TT_CONFIG_OPTION_SUBPIXEL_HINTING, selecting version~38 or~40 causes * an `FT_Err_Unimplemented_Feature' error. * * Depending on the graphics framework, Microsoft uses different From eb5e0fb7ee50db2351ce17501a186e35ebc29fb8 Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Fri, 21 Apr 2017 22:53:39 -0400 Subject: [PATCH 062/470] * src/smooth/ftsmooth.h: Remove unused guards and declaration. --- ChangeLog | 4 ++++ src/smooth/ftsmooth.h | 7 ------- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index af21e0378..77b3a4369 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2017-04-21 Alexei Podtelezhnikov + + * src/smooth/ftsmooth.h: Remove unused guards and declaration. + 2017-04-16 Hin-Tak Leung Fix tracing messages. diff --git a/src/smooth/ftsmooth.h b/src/smooth/ftsmooth.h index b46525b92..6dfd65726 100644 --- a/src/smooth/ftsmooth.h +++ b/src/smooth/ftsmooth.h @@ -27,18 +27,11 @@ FT_BEGIN_HEADER -#ifndef FT_CONFIG_OPTION_NO_STD_RASTER - FT_DECLARE_RENDERER( ft_std_renderer_class ) -#endif - -#ifndef FT_CONFIG_OPTION_NO_SMOOTH_RASTER FT_DECLARE_RENDERER( ft_smooth_renderer_class ) FT_DECLARE_RENDERER( ft_smooth_lcd_renderer_class ) FT_DECLARE_RENDERER( ft_smooth_lcdv_renderer_class ) -#endif - FT_END_HEADER From 5412d8869b4b4c2df1c96298dc8d47b08cdb61b3 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sat, 22 Apr 2017 12:48:50 +0200 Subject: [PATCH 063/470] Introduce `FT_Size_InternalRec' structure. We are going to extend this later on. * include/freetype/internal/ftobjs.h (FT_Size_InternalRec): New structure with a single field `module_data'. * src/base/ftobjs.c (FT_New_Size): Allocate `internal' field of `FT_Size' structure. * src/cff/cffgload.c (cff_builder_init, cff_decoder_prepare): Use `size->internal->module_data' instead of `size->internal'. * src/cff/cffobjs.c (cff_size_done): Deallocate `module_data'. (cff_size_init, cff_size_select, cff_size_request): Use `size->internal->module_data' instead of `size->internal'. * src/cif/cidobjs.c (cid_size_done, cid_size_init, cid_size_request): Use `size->internal->module_data' instead of `size->internal'. * src/psaux/psobjs.c (t1_builder_ini): Use `size->internal->module_data' instead of `size->internal'. * src/type1/t1objs.c (T1_Size_Done, T1_Size_Init, T1_Size_Request): Use `size->internal->module_data' instead of `size->internal'. --- ChangeLog | 29 +++++++++++++++++++++++++++++ include/freetype/internal/ftobjs.h | 11 +++++------ src/base/ftobjs.c | 8 ++++++-- src/cff/cffgload.c | 6 ++++-- src/cff/cffobjs.c | 14 ++++++-------- src/cid/cidobjs.c | 10 +++++----- src/psaux/psobjs.c | 2 +- src/type1/t1objs.c | 13 +++++-------- 8 files changed, 61 insertions(+), 32 deletions(-) diff --git a/ChangeLog b/ChangeLog index 77b3a4369..00ba418be 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,32 @@ +2017-04-22 Werner Lemberg + + Introduce `FT_Size_InternalRec' structure. + + We are going to extend this later on. + + * include/freetype/internal/ftobjs.h (FT_Size_InternalRec): New + structure with a single field `module_data'. + + * src/base/ftobjs.c (FT_New_Size): Allocate `internal' field of + `FT_Size' structure. + + * src/cff/cffgload.c (cff_builder_init, cff_decoder_prepare): Use + `size->internal->module_data' instead of `size->internal'. + + * src/cff/cffobjs.c (cff_size_done): Deallocate `module_data'. + (cff_size_init, cff_size_select, cff_size_request): Use + `size->internal->module_data' instead of `size->internal'. + + * src/cif/cidobjs.c (cid_size_done, cid_size_init, + cid_size_request): Use `size->internal->module_data' instead of + `size->internal'. + + * src/psaux/psobjs.c (t1_builder_ini): Use + `size->internal->module_data' instead of `size->internal'. + + * src/type1/t1objs.c (T1_Size_Done, T1_Size_Init, T1_Size_Request): + Use `size->internal->module_data' instead of `size->internal'. + 2017-04-21 Alexei Podtelezhnikov * src/smooth/ftsmooth.h: Remove unused guards and declaration. diff --git a/include/freetype/internal/ftobjs.h b/include/freetype/internal/ftobjs.h index 2f18d07b7..c8526e6fd 100644 --- a/include/freetype/internal/ftobjs.h +++ b/include/freetype/internal/ftobjs.h @@ -433,8 +433,6 @@ FT_BEGIN_HEADER } FT_GlyphSlot_InternalRec; -#if 0 - /*************************************************************************/ /* */ /* */ @@ -442,18 +440,19 @@ FT_BEGIN_HEADER /* */ /* */ /* This structure contains the internal fields of each FT_Size */ - /* object. Currently, it's empty. */ + /* object. */ + /* */ + /* */ + /* module_data :: Data specific to a driver module. */ /* */ /*************************************************************************/ typedef struct FT_Size_InternalRec_ { - /* empty */ + void* module_data; } FT_Size_InternalRec; -#endif - /*************************************************************************/ /*************************************************************************/ diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c index a58c081fb..83d51c09e 100644 --- a/src/base/ftobjs.c +++ b/src/base/ftobjs.c @@ -2605,6 +2605,8 @@ FT_Size size = NULL; FT_ListNode node = NULL; + FT_Size_Internal internal = NULL; + if ( !face ) return FT_THROW( Invalid_Face_Handle ); @@ -2627,8 +2629,10 @@ size->face = face; - /* for now, do not use any internal fields in size objects */ - size->internal = NULL; + if ( FT_NEW( internal ) ) + goto Exit; + + size->internal = internal; if ( clazz->init_size ) error = clazz->init_size( size ); diff --git a/src/cff/cffgload.c b/src/cff/cffgload.c index 9ead7d399..940804850 100644 --- a/src/cff/cffgload.c +++ b/src/cff/cffgload.c @@ -278,7 +278,8 @@ if ( hinting && size ) { - CFF_Internal internal = (CFF_Internal)size->root.internal; + FT_Size ftsize = FT_SIZE( size ); + CFF_Internal internal = (CFF_Internal)ftsize->internal->module_data; if ( internal ) @@ -443,7 +444,8 @@ if ( builder->hints_funcs && size ) { - CFF_Internal internal = (CFF_Internal)size->root.internal; + FT_Size ftsize = FT_SIZE( size ); + CFF_Internal internal = (CFF_Internal)ftsize->internal->module_data; /* for CFFs without subfonts, this value has already been set */ diff --git a/src/cff/cffobjs.c b/src/cff/cffobjs.c index ddcfdc97d..61613933f 100644 --- a/src/cff/cffobjs.c +++ b/src/cff/cffobjs.c @@ -54,9 +54,6 @@ /* */ /* SIZE FUNCTIONS */ /* */ - /* Note that we store the global hints in the size's `internal' root */ - /* field. */ - /* */ /*************************************************************************/ @@ -80,10 +77,11 @@ FT_LOCAL_DEF( void ) cff_size_done( FT_Size cffsize ) /* CFF_Size */ { + FT_Memory memory = cffsize->face->memory; CFF_Size size = (CFF_Size)cffsize; CFF_Face face = (CFF_Face)size->root.face; CFF_Font font = (CFF_Font)face->extra.data; - CFF_Internal internal = (CFF_Internal)cffsize->internal; + CFF_Internal internal = (CFF_Internal)cffsize->internal->module_data; if ( internal ) @@ -103,7 +101,7 @@ funcs->destroy( internal->subfonts[i - 1] ); } - /* `internal' is freed by destroy_size (in ftobjs.c) */ + FT_FREE( internal ); } } @@ -199,7 +197,7 @@ goto Exit; } - cffsize->internal = (FT_Size_Internal)(void*)internal; + cffsize->internal->module_data = internal; } size->strike_index = 0xFFFFFFFFUL; @@ -229,7 +227,7 @@ { CFF_Face face = (CFF_Face)size->face; CFF_Font font = (CFF_Font)face->extra.data; - CFF_Internal internal = (CFF_Internal)size->internal; + CFF_Internal internal = (CFF_Internal)size->internal->module_data; FT_Long top_upm = (FT_Long)font->top_font.font_dict.units_per_em; FT_UInt i; @@ -301,7 +299,7 @@ { CFF_Face cffface = (CFF_Face)size->face; CFF_Font font = (CFF_Font)cffface->extra.data; - CFF_Internal internal = (CFF_Internal)size->internal; + CFF_Internal internal = (CFF_Internal)size->internal->module_data; FT_Long top_upm = (FT_Long)font->top_font.font_dict.units_per_em; FT_UInt i; diff --git a/src/cid/cidobjs.c b/src/cid/cidobjs.c index 7830e1f68..ceda8ff97 100644 --- a/src/cid/cidobjs.c +++ b/src/cid/cidobjs.c @@ -113,16 +113,16 @@ CID_Size size = (CID_Size)cidsize; - if ( cidsize->internal ) + if ( cidsize->internal->module_data ) { PSH_Globals_Funcs funcs; funcs = cid_size_get_globals_funcs( size ); if ( funcs ) - funcs->destroy( (PSH_Globals)cidsize->internal ); + funcs->destroy( (PSH_Globals)cidsize->internal->module_data ); - cidsize->internal = NULL; + cidsize->internal->module_data = NULL; } } @@ -145,7 +145,7 @@ error = funcs->create( cidsize->face->memory, priv, &globals ); if ( !error ) - cidsize->internal = (FT_Size_Internal)(void*)globals; + cidsize->internal->module_data = globals; } return error; @@ -164,7 +164,7 @@ funcs = cid_size_get_globals_funcs( (CID_Size)size ); if ( funcs ) - funcs->set_scale( (PSH_Globals)size->internal, + funcs->set_scale( (PSH_Globals)size->internal->module_data, size->metrics.x_scale, size->metrics.y_scale, 0, 0 ); diff --git a/src/psaux/psobjs.c b/src/psaux/psobjs.c index 0baf83686..f04edea41 100644 --- a/src/psaux/psobjs.c +++ b/src/psaux/psobjs.c @@ -1551,7 +1551,7 @@ builder->current = &loader->current.outline; FT_GlyphLoader_Rewind( loader ); - builder->hints_globals = size->internal; + builder->hints_globals = size->internal->module_data; builder->hints_funcs = NULL; if ( hinting ) diff --git a/src/type1/t1objs.c b/src/type1/t1objs.c index 5637035c8..97c16b0fd 100644 --- a/src/type1/t1objs.c +++ b/src/type1/t1objs.c @@ -49,9 +49,6 @@ /* */ /* SIZE FUNCTIONS */ /* */ - /* note that we store the global hints in the size's "internal" root */ - /* field */ - /* */ /*************************************************************************/ @@ -77,16 +74,16 @@ T1_Size size = (T1_Size)t1size; - if ( size->root.internal ) + if ( t1size->internal->module_data ) { PSH_Globals_Funcs funcs; funcs = T1_Size_Get_Globals_Funcs( size ); if ( funcs ) - funcs->destroy( (PSH_Globals)size->root.internal ); + funcs->destroy( (PSH_Globals)t1size->internal->module_data ); - size->root.internal = NULL; + t1size->internal->module_data = NULL; } } @@ -108,7 +105,7 @@ error = funcs->create( size->root.face->memory, &face->type1.private_dict, &globals ); if ( !error ) - size->root.internal = (FT_Size_Internal)(void*)globals; + t1size->internal->module_data = globals; } return error; @@ -126,7 +123,7 @@ FT_Request_Metrics( size->root.face, req ); if ( funcs ) - funcs->set_scale( (PSH_Globals)size->root.internal, + funcs->set_scale( (PSH_Globals)t1size->internal->module_data, size->root.metrics.x_scale, size->root.metrics.y_scale, 0, 0 ); From 7fa5743ae67ec1e61e03f2bb86b0a662910261b8 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sun, 23 Apr 2017 13:57:37 +0200 Subject: [PATCH 064/470] freetype.h: Avoid non-ASCII character (#50858). --- include/freetype/freetype.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h index 21e2d3131..47e1af26f 100644 --- a/include/freetype/freetype.h +++ b/include/freetype/freetype.h @@ -3150,7 +3150,7 @@ FT_BEGIN_HEADER /* this does not translate to 50% brightness for that pixel on our */ /* sRGB and gamma~2.2 screens. Due to their non-linearity, they */ /* dwell longer in the darks and only a pixel value of about 186 */ - /* results in 50% brightness – 128 ends up too dark on both bright */ + /* results in 50% brightness -- 128 ends up too dark on both bright */ /* and dark backgrounds. The net result is that dark text looks */ /* burnt-out, pixely and blotchy on bright background, bright text */ /* too frail on dark backgrounds, and colored text on colored */ From 7752c68c50e651d76615de84db1e34f7ee1329b3 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Wed, 26 Apr 2017 09:16:45 +0200 Subject: [PATCH 065/470] Document CVE-2017-8105. --- docs/CHANGES | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/CHANGES b/docs/CHANGES index c3c140232..8ad5dfae0 100644 --- a/docs/CHANGES +++ b/docs/CHANGES @@ -29,6 +29,11 @@ CHANGES BETWEEN 2.7.1 and 2.8 now scales the font linearly again (bug introduced in version 2.4.6). + - CVE-2017-8105: Older FreeType versions has an out-of-bounds write + caused by a heap-based buffer overflow related to the Type 1 fonts. + + http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-8105 + III. MISCELLANEOUS From ba86636b14f876fa369c84467409b3b812d47e94 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Wed, 26 Apr 2017 09:35:39 +0200 Subject: [PATCH 066/470] And another CVE for an older FreeType version. --- docs/CHANGES | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/docs/CHANGES b/docs/CHANGES index 8ad5dfae0..d42accbe3 100644 --- a/docs/CHANGES +++ b/docs/CHANGES @@ -29,8 +29,9 @@ CHANGES BETWEEN 2.7.1 and 2.8 now scales the font linearly again (bug introduced in version 2.4.6). - - CVE-2017-8105: Older FreeType versions has an out-of-bounds write - caused by a heap-based buffer overflow related to the Type 1 fonts. + - CVE-2017-8105: Older FreeType versions has an out-of-bounds + write caused by a heap-based buffer overflow related to the Type + 1 fonts. http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-8105 @@ -101,6 +102,12 @@ CHANGES BETWEEN 2.7 and 2.7.1 - Handling of raw CID fonts was partially broken (bug introduced in 2.6.4). + - CVE-2016-10328: Older FreeType versions had an out-of-bounds + write caused by a heap-based buffer overflow related to the CFF + fonts. + + http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2016-10328 + III. MISCELLANEOUS From 69da54cacc0056a40fc7f88278c4c60fd35e7bb9 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Wed, 26 Apr 2017 09:58:28 +0200 Subject: [PATCH 067/470] Document that some FT_Size_Metrics values are always rounded. --- include/freetype/freetype.h | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h index 47e1af26f..4ed86b981 100644 --- a/include/freetype/freetype.h +++ b/include/freetype/freetype.h @@ -1506,27 +1506,34 @@ FT_BEGIN_HEADER /* fractional pixels. Only relevant for scalable */ /* font formats. */ /* */ - /* ascender :: The ascender in 26.6 fractional pixels. See */ - /* @FT_FaceRec for the details. */ + /* ascender :: The ascender in 26.6 fractional pixels, rounded up */ + /* to an integer value. See @FT_FaceRec for the */ + /* details. */ /* */ - /* descender :: The descender in 26.6 fractional pixels. See */ - /* @FT_FaceRec for the details. */ + /* descender :: The descender in 26.6 fractional pixels, rounded */ + /* down to an integer value. See @FT_FaceRec for the */ + /* details. */ /* */ - /* height :: The height in 26.6 fractional pixels. See */ - /* @FT_FaceRec for the details. */ + /* height :: The height in 26.6 fractional pixels, rounded to */ + /* an integer value. See @FT_FaceRec for the */ + /* details. */ /* */ /* max_advance :: The maximum advance width in 26.6 fractional */ - /* pixels. See @FT_FaceRec for the details. */ + /* pixels, rounded to an integer value. See */ + /* @FT_FaceRec for the details. */ /* */ /* */ /* The scaling values, if relevant, are determined first during a */ /* size changing operation. The remaining fields are then set by the */ /* driver. For scalable formats, they are usually set to scaled */ - /* values of the corresponding fields in @FT_FaceRec. */ - /* */ - /* Note that due to glyph hinting, these values might not be exact */ - /* for certain fonts. Thus they must be treated as unreliable */ - /* with an error margin of at least one pixel! */ + /* values of the corresponding fields in @FT_FaceRec. Some values */ + /* like ascender or descender are rounded for historical reasons; */ + /* more precise values (for outline fonts) can be derived by scaling */ + /* the corresponding @FT_FaceRec values manually. */ + /* */ + /* Note that due to glyph hinting and the selected rendering mode */ + /* these values are usually not exact; consequently, they must be */ + /* treated as unreliable with an error margin of at least one pixel! */ /* */ /* Indeed, the only way to get the exact metrics is to render _all_ */ /* glyphs. As this would be a definite performance hit, it is up to */ From 5aa6716a5eb8409f606886b5d4e63476d85a3519 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sat, 22 Apr 2017 13:27:21 +0200 Subject: [PATCH 068/470] Add new `slight' auto-hinting mode. This mode uses fractional advance widths and doesn't scale glyphs horizontally, only applying vertical scaling and hinting. At the same time, the behaviour of the `light' auto-hinter gets restored for backwards compatibility: Both vertical and horizontal scaling is again based on rounded metrics values (this was changed in a commit from 2017-03-30 as a side effect). To be more precise, the behaviour is restored for TrueType fonts only; for other font formats like Type 1, this is a new feature of the `light' hinting mode. * include/freetype/freetype.h (FT_LOAD_TARGET_SLIGHT): New macro. (FT_RENDER_MODE_SLIGHT): New render mode. * include/freetype/internal/ftobjs.h (FT_Size_InternalRec): Add `autohint_mode' and `autohint_metrics' fields. * src/autofit/afcjk.c (af_cjk_hints_init), src/autofit/aflatin.c (af_latin_hints_init), src/autofit/aflatin2 (af_latin2_hints_init): Updated. * src/autofit/afloader.c (af_loader_embolden_glyph_in_slot): Use `autohint_metrics'. (af_loader_load_glyph): s/internal/slot_internal/. Initialize `autohint_metrics' and `autohint_mode' depending on current auto-hint mode. Use `autohint_metrics'. Updated. * src/base/ftadvanc.c (LOAD_ADVANCE_FAST_CHECK): Updated. * src/base/ftobjs.c (FT_Load_Glyph): Updated. (FT_New_Size): Allocate `internal' object. * src/pshinter/pshalgo.c (ps_hints_apply): Updated. * src/smooth/ftsmooth.c (ft_smooth_render): Updated. --- ChangeLog | 42 +++++++++++++ include/freetype/freetype.h | 31 +++++++++- include/freetype/internal/ftobjs.h | 9 ++- src/autofit/afcjk.c | 7 ++- src/autofit/aflatin.c | 10 +++- src/autofit/aflatin2.c | 10 +++- src/autofit/afloader.c | 95 +++++++++++++++++++++++------- src/base/ftadvanc.c | 9 +-- src/base/ftobjs.c | 9 +-- src/pshinter/pshalgo.c | 3 +- src/smooth/ftsmooth.c | 3 +- 11 files changed, 187 insertions(+), 41 deletions(-) diff --git a/ChangeLog b/ChangeLog index 00ba418be..05db1d150 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,45 @@ +2017-04-22 Werner Lemberg + + Add new `slight' auto-hinting mode. + + This mode uses fractional advance widths and doesn't scale glyphs + horizontally, only applying vertical scaling and hinting. + + At the same time, the behaviour of the `light' auto-hinter gets + restored for backwards compatibility: Both vertical and horizontal + scaling is again based on rounded metrics values (this was changed + in a commit from 2017-03-30 as a side effect). To be more precise, + the behaviour is restored for TrueType fonts only; for other font + formats like Type 1, this is a new feature of the `light' hinting + mode. + + * include/freetype/freetype.h (FT_LOAD_TARGET_SLIGHT): New macro. + (FT_RENDER_MODE_SLIGHT): New render mode. + + * include/freetype/internal/ftobjs.h (FT_Size_InternalRec): Add + `autohint_mode' and `autohint_metrics' fields. + + * src/autofit/afcjk.c (af_cjk_hints_init), src/autofit/aflatin.c + (af_latin_hints_init), src/autofit/aflatin2 (af_latin2_hints_init): + Updated. + + * src/autofit/afloader.c (af_loader_embolden_glyph_in_slot): Use + `autohint_metrics'. + (af_loader_load_glyph): s/internal/slot_internal/. + Initialize `autohint_metrics' and `autohint_mode' depending on + current auto-hint mode. + Use `autohint_metrics'. + Updated. + + * src/base/ftadvanc.c (LOAD_ADVANCE_FAST_CHECK): Updated. + + * src/base/ftobjs.c (FT_Load_Glyph): Updated. + (FT_New_Size): Allocate `internal' object. + + * src/pshinter/pshalgo.c (ps_hints_apply): Updated. + + * src/smooth/ftsmooth.c (ft_smooth_render): Updated. + 2017-04-22 Werner Lemberg Introduce `FT_Size_InternalRec' structure. diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h index 4ed86b981..e579056d0 100644 --- a/include/freetype/freetype.h +++ b/include/freetype/freetype.h @@ -221,6 +221,7 @@ FT_BEGIN_HEADER /* */ /* FT_LOAD_TARGET_NORMAL */ /* FT_LOAD_TARGET_LIGHT */ + /* FT_LOAD_TARGET_SLIGHT */ /* FT_LOAD_TARGET_MONO */ /* FT_LOAD_TARGET_LCD */ /* FT_LOAD_TARGET_LCD_V */ @@ -1755,7 +1756,8 @@ FT_BEGIN_HEADER /* `slot->format' is also changed to @FT_GLYPH_FORMAT_BITMAP. */ /* */ /* Here is a small pseudo code fragment that shows how to use */ - /* `lsb_delta' and `rsb_delta': */ + /* `lsb_delta' and `rsb_delta' to improve (integer) positioning of */ + /* glyphs: */ /* */ /* { */ /* FT_Pos origin_x = 0; */ @@ -2941,6 +2943,18 @@ FT_BEGIN_HEADER * driver, if the driver itself and the font support it, or by the * auto-hinter. * + * Use this hinting mode if you mainly need integer advance widths + * and want to avoid sub-pixel rendering. + * + * FT_LOAD_TARGET_SLIGHT :: + * This is similar to @FT_LOAD_TARGET_LIGHT with a main difference: + * Advance widths are not rounded to integer values; instead, the + * linearly scaled values are used. In particular this implies that + * you have to apply sub-pixel rendering. + * + * In general, this mode yields better results than + * @FT_LOAD_TARGET_LIGHT. + * * FT_LOAD_TARGET_MONO :: * Strong hinting algorithm that should only be used for monochrome * output. The result is probably unpleasant if the glyph is rendered @@ -2975,11 +2989,19 @@ FT_BEGIN_HEADER * FT_Render_Glyph( face->glyph, FT_RENDER_MODE_LCD ); * } * + * In general, you should stick with one rendering mode. For example, + * switching between @FT_LOAD_TARGET_LIGHT and @FT_LOAD_TARGET_SLIGHT + * enforces a lot of recomputation, which is slow. Another reason is + * caching: Selecting a different mode usually causes changes in both + * the outlines and the rasterized bitmaps; it is thus necessary to + * empty the cache after a mode switch to avoid false hits. + * */ #define FT_LOAD_TARGET_( x ) ( (FT_Int32)( (x) & 15 ) << 16 ) #define FT_LOAD_TARGET_NORMAL FT_LOAD_TARGET_( FT_RENDER_MODE_NORMAL ) #define FT_LOAD_TARGET_LIGHT FT_LOAD_TARGET_( FT_RENDER_MODE_LIGHT ) +#define FT_LOAD_TARGET_SLIGHT FT_LOAD_TARGET_( FT_RENDER_MODE_SLIGHT ) #define FT_LOAD_TARGET_MONO FT_LOAD_TARGET_( FT_RENDER_MODE_MONO ) #define FT_LOAD_TARGET_LCD FT_LOAD_TARGET_( FT_RENDER_MODE_LCD ) #define FT_LOAD_TARGET_LCD_V FT_LOAD_TARGET_( FT_RENDER_MODE_LCD_V ) @@ -3060,6 +3082,12 @@ FT_BEGIN_HEADER /* indirectly to define hinting algorithm selectors. See */ /* @FT_LOAD_TARGET_XXX for details. */ /* */ + /* FT_RENDER_MODE_SLIGHT :: */ + /* This is equivalent to @FT_RENDER_MODE_NORMAL. It is only */ + /* defined as a separate value because render modes are also used */ + /* indirectly to define hinting algorithm selectors. See */ + /* @FT_LOAD_TARGET_XXX for details. */ + /* */ /* FT_RENDER_MODE_MONO :: */ /* This mode corresponds to 1-bit bitmaps (with 2~levels of */ /* opacity). */ @@ -3092,6 +3120,7 @@ FT_BEGIN_HEADER { FT_RENDER_MODE_NORMAL = 0, FT_RENDER_MODE_LIGHT, + FT_RENDER_MODE_SLIGHT, FT_RENDER_MODE_MONO, FT_RENDER_MODE_LCD, FT_RENDER_MODE_LCD_V, diff --git a/include/freetype/internal/ftobjs.h b/include/freetype/internal/ftobjs.h index c8526e6fd..558409166 100644 --- a/include/freetype/internal/ftobjs.h +++ b/include/freetype/internal/ftobjs.h @@ -443,7 +443,11 @@ FT_BEGIN_HEADER /* object. */ /* */ /* */ - /* module_data :: Data specific to a driver module. */ + /* module_data :: Data specific to a driver module. */ + /* */ + /* autohint_mode :: The used auto-hinting mode. */ + /* */ + /* autohint_metrics :: Metrics used by the auto-hinter. */ /* */ /*************************************************************************/ @@ -451,6 +455,9 @@ FT_BEGIN_HEADER { void* module_data; + FT_Render_Mode autohint_mode; + FT_Size_Metrics autohint_metrics; + } FT_Size_InternalRec; diff --git a/src/autofit/afcjk.c b/src/autofit/afcjk.c index 61e29cded..86b8b4067 100644 --- a/src/autofit/afcjk.c +++ b/src/autofit/afcjk.c @@ -1398,9 +1398,12 @@ other_flags |= AF_LATIN_HINTS_VERT_SNAP; /* - * We adjust stems to full pixels unless in `light' or `lcd' mode. + * We adjust stems to full pixels unless in `light', `slight', + * or `lcd' mode. */ - if ( mode != FT_RENDER_MODE_LIGHT && mode != FT_RENDER_MODE_LCD ) + if ( mode != FT_RENDER_MODE_LIGHT && + mode != FT_RENDER_MODE_SLIGHT && + mode != FT_RENDER_MODE_LCD ) other_flags |= AF_LATIN_HINTS_STEM_ADJUST; if ( mode == FT_RENDER_MODE_MONO ) diff --git a/src/autofit/aflatin.c b/src/autofit/aflatin.c index 11fa523c8..e03fdf01f 100644 --- a/src/autofit/aflatin.c +++ b/src/autofit/aflatin.c @@ -2577,7 +2577,9 @@ /* * We adjust stems to full pixels unless in `light' or `lcd' mode. */ - if ( mode != FT_RENDER_MODE_LIGHT && mode != FT_RENDER_MODE_LCD ) + if ( mode != FT_RENDER_MODE_LIGHT && + mode != FT_RENDER_MODE_SLIGHT && + mode != FT_RENDER_MODE_LCD ) other_flags |= AF_LATIN_HINTS_STEM_ADJUST; if ( mode == FT_RENDER_MODE_MONO ) @@ -2590,8 +2592,10 @@ * However, if warping is enabled (which only works in `light' hinting * mode), advance widths get adjusted, too. */ - if ( mode == FT_RENDER_MODE_LIGHT || mode == FT_RENDER_MODE_LCD || - ( face->style_flags & FT_STYLE_FLAG_ITALIC ) != 0 ) + if ( mode == FT_RENDER_MODE_LIGHT || + mode == FT_RENDER_MODE_SLIGHT || + mode == FT_RENDER_MODE_LCD || + ( face->style_flags & FT_STYLE_FLAG_ITALIC ) != 0 ) scaler_flags |= AF_SCALER_FLAG_NO_HORIZONTAL; #ifdef AF_CONFIG_OPTION_USE_WARPER diff --git a/src/autofit/aflatin2.c b/src/autofit/aflatin2.c index 0607278b1..87ab91d8e 100644 --- a/src/autofit/aflatin2.c +++ b/src/autofit/aflatin2.c @@ -1560,7 +1560,9 @@ /* * We adjust stems to full pixels unless in `light' or `lcd' mode. */ - if ( mode != FT_RENDER_MODE_LIGHT && mode != FT_RENDER_MODE_LCD ) + if ( mode != FT_RENDER_MODE_LIGHT && + mode != FT_RENDER_MODE_SLIGHT && + mode != FT_RENDER_MODE_LCD ) other_flags |= AF_LATIN_HINTS_STEM_ADJUST; if ( mode == FT_RENDER_MODE_MONO ) @@ -1570,8 +1572,10 @@ * In `light' or `lcd' mode we disable horizontal hinting completely. * We also do it if the face is italic. */ - if ( mode == FT_RENDER_MODE_LIGHT || mode == FT_RENDER_MODE_LCD || - ( face->style_flags & FT_STYLE_FLAG_ITALIC ) != 0 ) + if ( mode == FT_RENDER_MODE_LIGHT || + mode == FT_RENDER_MODE_SLIGHT || + mode == FT_RENDER_MODE_LCD || + ( face->style_flags & FT_STYLE_FLAG_ITALIC ) != 0 ) scaler_flags |= AF_SCALER_FLAG_NO_HORIZONTAL; #ifdef AF_CONFIG_OPTION_USE_WARPER diff --git a/src/autofit/afloader.c b/src/autofit/afloader.c index fb8ea3ce1..d90c217fb 100644 --- a/src/autofit/afloader.c +++ b/src/autofit/afloader.c @@ -97,11 +97,13 @@ AF_FaceGlobals globals = loader->globals; AF_WritingSystemClass writing_system_class; + FT_Size_Metrics* size_metrics = &face->size->internal->autohint_metrics; + FT_Pos stdVW = 0; FT_Pos stdHW = 0; - FT_Bool size_changed = face->size->metrics.x_ppem - != globals->stem_darkening_for_ppem; + FT_Bool size_changed = size_metrics->x_ppem != + globals->stem_darkening_for_ppem; FT_Fixed em_size = af_intToFixed( face->units_per_EM ); FT_Fixed em_ratio = FT_DivFix( af_intToFixed( 1000 ), em_size ); @@ -145,11 +147,11 @@ face, stdVW ) ); darken_x = FT_DivFix( FT_MulFix( darken_by_font_units_x, - face->size->metrics.x_scale ), + size_metrics->x_scale ), em_ratio ); globals->standard_vertical_width = stdVW; - globals->stem_darkening_for_ppem = face->size->metrics.x_ppem; + globals->stem_darkening_for_ppem = size_metrics->x_ppem; globals->darken_x = af_fixedToInt( darken_x ); } @@ -164,11 +166,11 @@ face, stdHW ) ); darken_y = FT_DivFix( FT_MulFix( darken_by_font_units_y, - face->size->metrics.y_scale ), + size_metrics->y_scale ), em_ratio ); globals->standard_horizontal_width = stdHW; - globals->stem_darkening_for_ppem = face->size->metrics.x_ppem; + globals->stem_darkening_for_ppem = size_metrics->x_ppem; globals->darken_y = af_fixedToInt( darken_y ); /* @@ -217,10 +219,11 @@ { FT_Error error; - FT_Size size = face->size; - FT_GlyphSlot slot = face->glyph; - FT_Slot_Internal internal = slot->internal; - FT_GlyphLoader gloader = internal->loader; + FT_Size size = face->size; + FT_Size_Internal size_internal = size->internal; + FT_GlyphSlot slot = face->glyph; + FT_Slot_Internal slot_internal = slot->internal; + FT_GlyphLoader gloader = slot_internal->loader; AF_GlyphHints hints = loader->hints; AF_ScalerRec scaler; @@ -239,6 +242,44 @@ FT_ZERO( &scaler ); + if ( !size_internal->autohint_metrics.x_scale || + size_internal->autohint_mode != FT_LOAD_TARGET_MODE( load_flags ) ) + { + /* switching between LIGHT and SLIGHT (and vice versa) usually means */ + /* different scaling values; this later on enforces recomputation of */ + /* everything related to the current size */ + + size_internal->autohint_mode = FT_LOAD_TARGET_MODE( load_flags ); + size_internal->autohint_metrics = size->metrics; + + if ( size_internal->autohint_mode != FT_RENDER_MODE_SLIGHT ) + { + FT_Size_Metrics* size_metrics = &size_internal->autohint_metrics; + + + /* set metrics to integer values and adjust scaling accordingly; */ + /* this is the same setup as with TrueType fonts, cf. function */ + /* `tt_size_reset' in file `ttobjs.c' */ + size_metrics->ascender = FT_PIX_ROUND( + FT_MulFix( face->ascender, + size_metrics->y_scale ) ); + size_metrics->descender = FT_PIX_ROUND( + FT_MulFix( face->descender, + size_metrics->y_scale ) ); + size_metrics->height = FT_PIX_ROUND( + FT_MulFix( face->height, + size_metrics->y_scale ) ); + + size_metrics->x_scale = FT_DivFix( size_metrics->x_ppem << 6, + face->units_per_EM ); + size_metrics->y_scale = FT_DivFix( size_metrics->y_ppem << 6, + face->units_per_EM ); + size_metrics->max_advance = FT_PIX_ROUND( + FT_MulFix( face->max_advance_width, + size_metrics->x_scale ) ); + } + } + /* * TODO: This code currently doesn't support fractional advance widths, * i.e., placing hinted glyphs at anything other than integer @@ -249,9 +290,9 @@ * values of the scaler would need to be adjusted. */ scaler.face = face; - scaler.x_scale = size->metrics.x_scale; + scaler.x_scale = size_internal->autohint_metrics.x_scale; scaler.x_delta = 0; - scaler.y_scale = size->metrics.y_scale; + scaler.y_scale = size_internal->autohint_metrics.y_scale; scaler.y_delta = 0; scaler.render_mode = FT_LOAD_TARGET_MODE( load_flags ); @@ -339,21 +380,22 @@ * */ - /* stem darkening only works well in `light' mode */ - if ( scaler.render_mode == FT_RENDER_MODE_LIGHT && + /* stem darkening only works well in `light' and `slight' modes */ + if ( ( scaler.render_mode == FT_RENDER_MODE_LIGHT || + scaler.render_mode == FT_RENDER_MODE_SLIGHT ) && ( !face->internal->no_stem_darkening || ( face->internal->no_stem_darkening < 0 && - !module->no_stem_darkening ) ) ) + !module->no_stem_darkening ) ) ) af_loader_embolden_glyph_in_slot( loader, face, style_metrics ); - loader->transformed = internal->glyph_transformed; + loader->transformed = slot_internal->glyph_transformed; if ( loader->transformed ) { FT_Matrix inverse; - loader->trans_matrix = internal->glyph_matrix; - loader->trans_delta = internal->glyph_delta; + loader->trans_matrix = slot_internal->glyph_matrix; + loader->trans_delta = slot_internal->glyph_delta; inverse = loader->trans_matrix; if ( !FT_Matrix_Invert( &inverse ) ) @@ -391,7 +433,8 @@ /* we now need to adjust the metrics according to the change in */ /* width/positioning that occurred during the hinting process */ - if ( scaler.render_mode != FT_RENDER_MODE_LIGHT ) + if ( scaler.render_mode != FT_RENDER_MODE_LIGHT && + scaler.render_mode != FT_RENDER_MODE_SLIGHT ) { FT_Pos old_rsb, old_lsb, new_lsb; FT_Pos pp1x_uh, pp2x_uh; @@ -448,7 +491,10 @@ slot->rsb_delta = loader->pp2.x - pp2x; } } - else + /* `light' mode uses integer advance widths */ + /* (but sets `lsb_delta' and `rsb_delta'), */ + /* `slight' mode uses fractional values */ + else if ( scaler.render_mode == FT_RENDER_MODE_LIGHT ) { FT_Pos pp1x = loader->pp1.x; FT_Pos pp2x = loader->pp2.x; @@ -460,6 +506,11 @@ slot->lsb_delta = loader->pp1.x - pp1x; slot->rsb_delta = loader->pp2.x - pp2x; } + else + { + slot->lsb_delta = 0; + slot->rsb_delta = 0; + } break; @@ -510,6 +561,7 @@ /* to keep the original rounded advance width; ditto for */ /* digits if all have the same advance width */ if ( scaler.render_mode != FT_RENDER_MODE_LIGHT && + scaler.render_mode != FT_RENDER_MODE_SLIGHT && ( FT_IS_FIXED_WIDTH( slot->face ) || ( af_face_globals_is_digit( loader->globals, glyph_index ) && style_metrics->digits_have_same_width ) ) ) @@ -533,7 +585,8 @@ slot->metrics.vertAdvance = FT_MulFix( slot->metrics.vertAdvance, style_metrics->scaler.y_scale ); - slot->metrics.horiAdvance = FT_PIX_ROUND( slot->metrics.horiAdvance ); + if ( scaler.render_mode != FT_RENDER_MODE_SLIGHT ) + slot->metrics.horiAdvance = FT_PIX_ROUND( slot->metrics.horiAdvance ); slot->metrics.vertAdvance = FT_PIX_ROUND( slot->metrics.vertAdvance ); slot->format = FT_GLYPH_FORMAT_OUTLINE; diff --git a/src/base/ftadvanc.c b/src/base/ftadvanc.c index 1557607fc..5f2e0b167 100644 --- a/src/base/ftadvanc.c +++ b/src/base/ftadvanc.c @@ -59,14 +59,15 @@ /* */ /* - unscaled load */ /* - unhinted load */ - /* - light-hinted load */ + /* - light-hinted and slight-hinted load */ /* - if a variations font, it must have an `HVAR' or `VVAR' */ /* table (thus the old MM or GX fonts don't qualify; this */ /* gets checked by the driver-specific functions) */ -#define LOAD_ADVANCE_FAST_CHECK( face, flags ) \ - ( flags & ( FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING ) || \ - FT_LOAD_TARGET_MODE( flags ) == FT_RENDER_MODE_LIGHT ) +#define LOAD_ADVANCE_FAST_CHECK( face, flags ) \ + ( flags & ( FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING ) || \ + ( FT_LOAD_TARGET_MODE( flags ) == FT_RENDER_MODE_LIGHT || \ + FT_LOAD_TARGET_MODE( flags ) == FT_RENDER_MODE_SLIGHT ) ) /* documentation is in ftadvanc.h */ diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c index 83d51c09e..7a9169b32 100644 --- a/src/base/ftobjs.c +++ b/src/base/ftobjs.c @@ -668,8 +668,8 @@ * - Then, auto-hint if FT_LOAD_FORCE_AUTOHINT is set or if we don't * have a native font hinter. * - * - Otherwise, auto-hint for LIGHT hinting mode or if there isn't - * any hinting bytecode in the TrueType/OpenType font. + * - Otherwise, auto-hint for LIGHT or SLIGHT hinting mode or if there + * isn't any hinting bytecode in the TrueType/OpenType font. * * - Exception: The font is `tricky' and requires the native hinter to * load properly. @@ -702,8 +702,9 @@ /* check the size of the `fpgm' and `prep' tables, too -- */ /* the assumption is that there don't exist real TTFs where */ /* both `fpgm' and `prep' tables are missing */ - if ( ( mode == FT_RENDER_MODE_LIGHT && - !FT_DRIVER_HINTS_LIGHTLY( driver ) ) || + if ( ( ( mode == FT_RENDER_MODE_LIGHT || + mode == FT_RENDER_MODE_SLIGHT ) && + !FT_DRIVER_HINTS_LIGHTLY( driver ) ) || ( FT_IS_SFNT( face ) && ttface->num_locations && ttface->max_profile.maxSizeOfInstructions == 0 && diff --git a/src/pshinter/pshalgo.c b/src/pshinter/pshalgo.c index 9ad1a3a02..27cb229eb 100644 --- a/src/pshinter/pshalgo.c +++ b/src/pshinter/pshalgo.c @@ -2149,7 +2149,8 @@ glyph->do_vert_snapping = FT_BOOL( hint_mode == FT_RENDER_MODE_MONO || hint_mode == FT_RENDER_MODE_LCD_V ); - glyph->do_stem_adjust = FT_BOOL( hint_mode != FT_RENDER_MODE_LIGHT ); + glyph->do_stem_adjust = FT_BOOL( hint_mode != FT_RENDER_MODE_LIGHT && + hint_mode != FT_RENDER_MODE_SLIGHT ); for ( dimension = 0; dimension < 2; dimension++ ) { diff --git a/src/smooth/ftsmooth.c b/src/smooth/ftsmooth.c index 435854e67..52e61e559 100644 --- a/src/smooth/ftsmooth.c +++ b/src/smooth/ftsmooth.c @@ -433,7 +433,8 @@ FT_Render_Mode mode, const FT_Vector* origin ) { - if ( mode == FT_RENDER_MODE_LIGHT ) + if ( mode == FT_RENDER_MODE_LIGHT || + mode == FT_RENDER_MODE_SLIGHT ) mode = FT_RENDER_MODE_NORMAL; return ft_smooth_render_generic( render, slot, mode, origin, From 5f18d867c0bf075153c8d6abb7e8d248ad469b56 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sat, 22 Apr 2017 23:02:21 +0200 Subject: [PATCH 069/470] [truetype] Do linear scaling for FT_LOAD_NO_HINTING (#50470). * src/truetype/ttobs.h (TT_SizeRec): Add field `hinted_metrics' to hold hinted metrics. Make `metrics' a pointer so that `tt_glyph_load' can easily switch between metrics. * src/truetype/ttdriver.c (tt_size_request): Updated. (tt_glyph_load): Use top-level metrics if FT_LOAD_NO_HINTING is used. * src/truetype/ttgload.c (TT_Hint_Glyph, TT_Process_Simple_Glyph, TT_Process_Composite_Component, load_truetype_glyph, compute_glyph_metrics, TT_Load_Glyph): Updated. * src/truetype/ttinterp.c (TT_Load_Context): Updated. * src/truetype/ttobjs.c (tt_size_reset): Updated. * src/truetype/ttsubpix.c (sph_set_tweaks): Updated. --- ChangeLog | 23 +++++++++++++++++++++++ src/truetype/ttdriver.c | 12 +++++++++--- src/truetype/ttgload.c | 32 ++++++++++++++++---------------- src/truetype/ttinterp.c | 2 +- src/truetype/ttobjs.c | 4 +++- src/truetype/ttobjs.h | 3 ++- src/truetype/ttsubpix.c | 2 +- 7 files changed, 55 insertions(+), 23 deletions(-) diff --git a/ChangeLog b/ChangeLog index 05db1d150..886883868 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,26 @@ +2017-04-22 Werner Lemberg + + [truetype] Do linear scaling for FT_LOAD_NO_HINTING (#50470). + + * src/truetype/ttobs.h (TT_SizeRec): Add field `hinted_metrics' to + hold hinted metrics. + Make `metrics' a pointer so that `tt_glyph_load' can easily switch + between metrics. + + * src/truetype/ttdriver.c (tt_size_request): Updated. + (tt_glyph_load): Use top-level metrics if FT_LOAD_NO_HINTING is + used. + + * src/truetype/ttgload.c (TT_Hint_Glyph, TT_Process_Simple_Glyph, + TT_Process_Composite_Component, load_truetype_glyph, + compute_glyph_metrics, TT_Load_Glyph): Updated. + + * src/truetype/ttinterp.c (TT_Load_Context): Updated. + + * src/truetype/ttobjs.c (tt_size_reset): Updated. + + * src/truetype/ttsubpix.c (sph_set_tweaks): Updated. + 2017-04-22 Werner Lemberg Add new `slight' auto-hinting mode. diff --git a/src/truetype/ttdriver.c b/src/truetype/ttdriver.c index 9bf0f84fc..c9f682e5e 100644 --- a/src/truetype/ttdriver.c +++ b/src/truetype/ttdriver.c @@ -361,9 +361,10 @@ #ifdef TT_USE_BYTECODE_INTERPRETER /* for the `MPS' bytecode instruction we need the point size */ { - FT_UInt resolution = ttsize->metrics.x_ppem > ttsize->metrics.y_ppem - ? req->horiResolution - : req->vertResolution; + FT_UInt resolution = + ttsize->metrics->x_ppem > ttsize->metrics->y_ppem + ? req->horiResolution + : req->vertResolution; /* if we don't have a resolution value, assume 72dpi */ @@ -457,6 +458,11 @@ load_flags |= FT_LOAD_NO_HINTING; } + /* use hinted metrics only if we load a glyph with hinting */ + size->metrics = ( load_flags & FT_LOAD_NO_HINTING ) + ? &ttsize->metrics + : &size->hinted_metrics; + /* now load the glyph outline if necessary */ error = TT_Load_Glyph( size, slot, glyph_index, load_flags ); diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c index 8962be560..c5d548f0b 100644 --- a/src/truetype/ttgload.c +++ b/src/truetype/ttgload.c @@ -778,8 +778,8 @@ } else { - loader->exec->metrics.x_scale = loader->size->metrics.x_scale; - loader->exec->metrics.y_scale = loader->size->metrics.y_scale; + loader->exec->metrics.x_scale = loader->size->metrics->x_scale; + loader->exec->metrics.y_scale = loader->size->metrics->y_scale; } #endif @@ -926,7 +926,7 @@ TT_Driver driver = (TT_Driver)FT_FACE_DRIVER( face ); FT_String* family = face->root.family_name; - FT_UInt ppem = loader->size->metrics.x_ppem; + FT_UInt ppem = loader->size->metrics->x_ppem; FT_String* style = face->root.style_name; FT_UInt x_scale_factor = 1000; #endif @@ -955,9 +955,9 @@ if ( ( loader->load_flags & FT_LOAD_NO_SCALE ) == 0 || x_scale_factor != 1000 ) { - x_scale = FT_MulDiv( loader->size->metrics.x_scale, + x_scale = FT_MulDiv( loader->size->metrics->x_scale, (FT_Long)x_scale_factor, 1000 ); - y_scale = loader->size->metrics.y_scale; + y_scale = loader->size->metrics->y_scale; /* compensate for any scaling by de/emboldening; */ /* the amount was determined via experimentation */ @@ -977,8 +977,8 @@ /* scale the glyph */ if ( ( loader->load_flags & FT_LOAD_NO_SCALE ) == 0 ) { - x_scale = loader->size->metrics.x_scale; - y_scale = loader->size->metrics.y_scale; + x_scale = loader->size->metrics->x_scale; + y_scale = loader->size->metrics->y_scale; do_scale = TRUE; } @@ -1136,8 +1136,8 @@ if ( !( loader->load_flags & FT_LOAD_NO_SCALE ) ) { - FT_Fixed x_scale = loader->size->metrics.x_scale; - FT_Fixed y_scale = loader->size->metrics.y_scale; + FT_Fixed x_scale = loader->size->metrics->x_scale; + FT_Fixed y_scale = loader->size->metrics->y_scale; x = FT_MulFix( x, x_scale ); @@ -1470,8 +1470,8 @@ if ( ( loader->load_flags & FT_LOAD_NO_SCALE ) == 0 ) { - x_scale = loader->size->metrics.x_scale; - y_scale = loader->size->metrics.y_scale; + x_scale = loader->size->metrics->x_scale; + y_scale = loader->size->metrics->y_scale; } else { @@ -2038,7 +2038,7 @@ y_scale = 0x10000L; if ( ( loader->load_flags & FT_LOAD_NO_SCALE ) == 0 ) - y_scale = size->metrics.y_scale; + y_scale = size->metrics->y_scale; if ( glyph->format != FT_GLYPH_FORMAT_COMPOSITE ) FT_Outline_Get_CBox( &glyph->outline, &bbox ); @@ -2070,7 +2070,7 @@ widthp = tt_face_get_device_metrics( face, - size->metrics.x_ppem, + size->metrics->x_ppem, glyph_index ); #ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY @@ -2637,11 +2637,11 @@ if ( !glyph->metrics.horiAdvance && glyph->linearHoriAdvance ) glyph->metrics.horiAdvance = FT_MulFix( glyph->linearHoriAdvance, - size->metrics.x_scale ); + size->metrics->x_scale ); if ( !glyph->metrics.vertAdvance && glyph->linearVertAdvance ) glyph->metrics.vertAdvance = FT_MulFix( glyph->linearVertAdvance, - size->metrics.y_scale ); + size->metrics->y_scale ); } return FT_Err_Ok; @@ -2737,7 +2737,7 @@ /* TrueType glyphs at all sizes using the bytecode interpreter. */ /* */ if ( !( load_flags & FT_LOAD_NO_SCALE ) && - size->metrics.y_ppem < 24 ) + size->metrics->y_ppem < 24 ) glyph->outline.flags |= FT_OUTLINE_HIGH_PRECISION; Exit: diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c index fed377d97..0c51f756d 100644 --- a/src/truetype/ttinterp.c +++ b/src/truetype/ttinterp.c @@ -402,7 +402,7 @@ exec->IDefs = size->instruction_defs; exec->pointSize = size->point_size; exec->tt_metrics = size->ttmetrics; - exec->metrics = size->metrics; + exec->metrics = *size->metrics; exec->maxFunc = size->max_func; exec->maxIns = size->max_ins; diff --git a/src/truetype/ttobjs.c b/src/truetype/ttobjs.c index 27e0931a3..64011e86e 100644 --- a/src/truetype/ttobjs.c +++ b/src/truetype/ttobjs.c @@ -1220,7 +1220,7 @@ size->ttmetrics.valid = FALSE; - size_metrics = &size->metrics; + size_metrics = &size->hinted_metrics; /* copy the result from base layer */ *size_metrics = size->root.metrics; @@ -1280,6 +1280,8 @@ size->ttmetrics.y_ratio = 0x10000L; } + size->metrics = size_metrics; + #ifdef TT_USE_BYTECODE_INTERPRETER size->cvt_ready = -1; #endif /* TT_USE_BYTECODE_INTERPRETER */ diff --git a/src/truetype/ttobjs.h b/src/truetype/ttobjs.h index 65929e592..cdacee75e 100644 --- a/src/truetype/ttobjs.h +++ b/src/truetype/ttobjs.h @@ -278,7 +278,8 @@ FT_BEGIN_HEADER /* we have our own copy of metrics so that we can modify */ /* it without affecting auto-hinting (when used) */ - FT_Size_Metrics metrics; + FT_Size_Metrics* metrics; /* for the current rendering mode */ + FT_Size_Metrics hinted_metrics; /* for the hinted rendering mode */ TT_Size_Metrics ttmetrics; diff --git a/src/truetype/ttsubpix.c b/src/truetype/ttsubpix.c index f8502d2f7..1c8cf0110 100644 --- a/src/truetype/ttsubpix.c +++ b/src/truetype/ttsubpix.c @@ -906,7 +906,7 @@ { TT_Face face = loader->face; FT_String* family = face->root.family_name; - FT_UInt ppem = loader->size->metrics.x_ppem; + FT_UInt ppem = loader->size->metrics->x_ppem; FT_String* style = face->root.style_name; From ab10ffcdd55f289fc0d335cf752acbf68edff172 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Wed, 26 Apr 2017 13:41:40 +0200 Subject: [PATCH 070/470] * include/freetype/freetype.h (FT_Render_Mode): Fix order. This retains backwards compatibility. Noted by Alexei. --- ChangeLog | 8 ++++++++ include/freetype/freetype.h | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 886883868..4e2e717d9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2017-04-26 Werner Lemberg + + * include/freetype/freetype.h (FT_Render_Mode): Fix order. + + This retains backwards compatibility. + + Noted by Alexei. + 2017-04-22 Werner Lemberg [truetype] Do linear scaling for FT_LOAD_NO_HINTING (#50470). diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h index e579056d0..e30910045 100644 --- a/include/freetype/freetype.h +++ b/include/freetype/freetype.h @@ -3120,10 +3120,10 @@ FT_BEGIN_HEADER { FT_RENDER_MODE_NORMAL = 0, FT_RENDER_MODE_LIGHT, - FT_RENDER_MODE_SLIGHT, FT_RENDER_MODE_MONO, FT_RENDER_MODE_LCD, FT_RENDER_MODE_LCD_V, + FT_RENDER_MODE_SLIGHT, FT_RENDER_MODE_MAX From 0a5315d141e698253603170595c655132d9baff2 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Thu, 27 Apr 2017 13:02:24 +0200 Subject: [PATCH 071/470] Introduce AF_CONFIG_OPTION_TT_SIZE_METRICS configuration option. * include/freetype/config/ftoption.h (AF_CONFIG_OPTION_TT_SIZE_METRICS): New option, commented out by default. * src/autofit/afloader.c (af_loader_load_glyph): Use AF_CONFIG_OPTION_TT_SIZE_METRICS to guard the corresponding code. --- ChangeLog | 11 ++++++++++ include/freetype/config/ftoption.h | 20 ++++++++++++++++- include/freetype/freetype.h | 35 ++++++++++++++++++------------ src/autofit/afloader.c | 2 ++ 4 files changed, 53 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4e2e717d9..1aae6ad8f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2017-04-27 Werner Lemberg + + Introduce AF_CONFIG_OPTION_TT_SIZE_METRICS configuration option. + + * include/freetype/config/ftoption.h + (AF_CONFIG_OPTION_TT_SIZE_METRICS): New option, commented out by + default. + + * src/autofit/afloader.c (af_loader_load_glyph): Use + AF_CONFIG_OPTION_TT_SIZE_METRICS to guard the corresponding code. + 2017-04-26 Werner Lemberg * include/freetype/freetype.h (FT_Render_Mode): Fix order. diff --git a/include/freetype/config/ftoption.h b/include/freetype/config/ftoption.h index ff393a87d..69d30a498 100644 --- a/include/freetype/config/ftoption.h +++ b/include/freetype/config/ftoption.h @@ -886,7 +886,9 @@ FT_BEGIN_HEADER /*************************************************************************/ /* */ - /* Compile autofit module with Indic script support. */ + /* Compile autofit module with fallback Indic script support, covering */ + /* some scripts that the `latin' submodule of the autofit module doesn't */ + /* (yet) handle. */ /* */ #define AF_CONFIG_OPTION_INDIC @@ -905,6 +907,22 @@ FT_BEGIN_HEADER /* */ #define AF_CONFIG_OPTION_USE_WARPER + /*************************************************************************/ + /* */ + /* Use TrueType-like size metrics for `light' auto-hinting. This option */ + /* exists mainly for backwards compatibility with GNU/Linux */ + /* distributions like Fedora that did not un-patch the following change */ + /* (which was present in FreeType between versions 2.4.6 and 2.7.1, */ + /* inclusive). */ + /* */ + /* 2011-07-16 Steven Chu */ + /* */ + /* [truetype] Fix metrics on size request for scalable fonts. */ + /* */ + /* This problematic commit is now reverted (more or less). */ + /* */ +/* #define AF_CONFIG_OPTION_TT_SIZE_METRICS */ + /* */ diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h index e30910045..2094382a8 100644 --- a/include/freetype/freetype.h +++ b/include/freetype/freetype.h @@ -2933,27 +2933,34 @@ FT_BEGIN_HEADER * rendering. For monochrome output, use @FT_LOAD_TARGET_MONO * instead. * - * FT_LOAD_TARGET_LIGHT :: - * A lighter hinting algorithm for gray-level modes. Many generated + * FT_LOAD_TARGET_SLIGHT :: + * A slight hinting algorithm for gray-level modes. Many generated * glyphs are fuzzier but better resemble their original shape. This * is achieved by snapping glyphs to the pixel grid only vertically - * (Y-axis), as is done by Microsoft's ClearType and Adobe's - * proprietary font renderer. This preserves inter-glyph spacing in + * (Y-axis), as is done by FreeType's new CFF engine or Microsoft's + * ClearType font renderer. This preserves inter-glyph spacing in * horizontal text. The snapping is done either by the native font * driver, if the driver itself and the font support it, or by the * auto-hinter. * - * Use this hinting mode if you mainly need integer advance widths - * and want to avoid sub-pixel rendering. + * Advance widths are not rounded to integer values; instead, metrics + * are based on linearly scaled values. In particular this implies + * that you have to apply sub-pixel rendering. * - * FT_LOAD_TARGET_SLIGHT :: - * This is similar to @FT_LOAD_TARGET_LIGHT with a main difference: - * Advance widths are not rounded to integer values; instead, the - * linearly scaled values are used. In particular this implies that - * you have to apply sub-pixel rendering. - * - * In general, this mode yields better results than - * @FT_LOAD_TARGET_LIGHT. + * FT_LOAD_TARGET_LIGHT :: + * This is similar to @FT_LOAD_TARGET_SLIGHT with a main difference: + * It uses integer advance widths. + * + * If configuration option AF_CONFIG_OPTION_TT_SIZE_METRICS is active, + * TrueType-like metrics are used to make this mode behave similarly + * as in unpatched FreeType versions between 2.4.6 and 2.7.1 + * (inclusive). + * + * This hinting mode is deprecated. In general, + * @FT_LOAD_TARGET_SLIGHT always yields better results; additionally, + * FT_LOAD_TARGET_LIGHT suffers from backwards compatibility issues + * (see the documentation of AF_CONFIG_OPTION_TT_SIZE_METRICS in + * `ftoption.h' for more details). * * FT_LOAD_TARGET_MONO :: * Strong hinting algorithm that should only be used for monochrome diff --git a/src/autofit/afloader.c b/src/autofit/afloader.c index d90c217fb..b3269d10b 100644 --- a/src/autofit/afloader.c +++ b/src/autofit/afloader.c @@ -252,6 +252,7 @@ size_internal->autohint_mode = FT_LOAD_TARGET_MODE( load_flags ); size_internal->autohint_metrics = size->metrics; +#ifdef AF_CONFIG_OPTION_TT_SIZE_METRICS if ( size_internal->autohint_mode != FT_RENDER_MODE_SLIGHT ) { FT_Size_Metrics* size_metrics = &size_internal->autohint_metrics; @@ -278,6 +279,7 @@ FT_MulFix( face->max_advance_width, size_metrics->x_scale ) ); } +#endif /* AF_CONFIG_OPTION_TT_SIZE_METRICS */ } /* From e9e2e5d4601fe4474bd2cff70a2c8c6a7c7387c3 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Thu, 27 Apr 2017 13:25:58 +0200 Subject: [PATCH 072/470] Document CVE-2017-8287. --- docs/CHANGES | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/CHANGES b/docs/CHANGES index d42accbe3..8df2b13d5 100644 --- a/docs/CHANGES +++ b/docs/CHANGES @@ -29,11 +29,12 @@ CHANGES BETWEEN 2.7.1 and 2.8 now scales the font linearly again (bug introduced in version 2.4.6). - - CVE-2017-8105: Older FreeType versions has an out-of-bounds - write caused by a heap-based buffer overflow related to the Type - 1 fonts. + - CVE-2017-8105, CVE-2017-8287: Older FreeType versions have + out-of-bounds writes caused by heap-based buffer overflows + related to Type 1 fonts. - http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-8105 + https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-8105 + https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-8287 III. MISCELLANEOUS From 785833d96eacab4af67dc6be53571441df6d8a5b Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sat, 29 Apr 2017 06:47:14 +0200 Subject: [PATCH 073/470] * src/truetype/ttdriver.c (tt_size_request): Properly check `error'. Reported by Earnestly in http://lists.nongnu.org/archive/html/freetype/2017-04/msg00031.html --- ChangeLog | 8 ++++++++ include/freetype/freetype.h | 4 ++++ src/truetype/ttdriver.c | 1 + 3 files changed, 13 insertions(+) diff --git a/ChangeLog b/ChangeLog index 1aae6ad8f..f4d31fbe3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2017-04-29 Werner Lemberg + + * src/truetype/ttdriver.c (tt_size_request): Properly check `error'. + + Reported by Earnestly in + + http://lists.nongnu.org/archive/html/freetype/2017-04/msg00031.html + 2017-04-27 Werner Lemberg Introduce AF_CONFIG_OPTION_TT_SIZE_METRICS configuration option. diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h index 2094382a8..681d8e93d 100644 --- a/include/freetype/freetype.h +++ b/include/freetype/freetype.h @@ -2549,6 +2549,10 @@ FT_BEGIN_HEADER /* glyph relative to this size. For more information refer to */ /* `https://www.freetype.org/freetype2/docs/glyphs/glyphs-2.html'. */ /* */ + /* Contrary to @FT_Set_Char_Size, this function doesn't have special */ + /* code to normalize zero-valued widths, heights, or resolutions */ + /* (which lead to errors in most cases). */ + /* */ /* Don't use this function if you are using the FreeType cache API. */ /* */ FT_EXPORT( FT_Error ) diff --git a/src/truetype/ttdriver.c b/src/truetype/ttdriver.c index c9f682e5e..a1653b241 100644 --- a/src/truetype/ttdriver.c +++ b/src/truetype/ttdriver.c @@ -360,6 +360,7 @@ #ifdef TT_USE_BYTECODE_INTERPRETER /* for the `MPS' bytecode instruction we need the point size */ + if ( !error ) { FT_UInt resolution = ttsize->metrics->x_ppem > ttsize->metrics->y_ppem From 7abf0cb758b4b470a0a0671e290669aeefbe0b90 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sun, 30 Apr 2017 17:25:11 +0200 Subject: [PATCH 074/470] [autofit] Fix metrics computation. Problem reported by Markus Trippelsdorf and Nikolaus Waxweiler . * src/base/ftobjs.c (FT_Request_Size): Trigger recomputation of auto-hinter metrics. Without this change, multiple size changing calls for a single face fail. --- ChangeLog | 11 +++++++++++ src/base/ftobjs.c | 4 ++++ 2 files changed, 15 insertions(+) diff --git a/ChangeLog b/ChangeLog index f4d31fbe3..b1ad07b28 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2017-04-30 Werner Lemberg + + [autofit] Fix metrics computation. + + Problem reported by Markus Trippelsdorf and + Nikolaus Waxweiler . + + * src/base/ftobjs.c (FT_Request_Size): Trigger recomputation of + auto-hinter metrics. Without this change, multiple size changing + calls for a single face fail. + 2017-04-29 Werner Lemberg * src/truetype/ttdriver.c (tt_size_request): Properly check `error'. diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c index 7a9169b32..cbc771322 100644 --- a/src/base/ftobjs.c +++ b/src/base/ftobjs.c @@ -3061,6 +3061,10 @@ req->type >= FT_SIZE_REQUEST_TYPE_MAX ) return FT_THROW( Invalid_Argument ); + /* signal the auto-hinter to recompute its size metrics */ + /* (if requested) */ + face->size->internal->autohint_metrics.x_scale = 0; + clazz = face->driver->clazz; if ( clazz->request_size ) From ba40054c2dd9f5d3d8561de7106870ac6a920f6d Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Tue, 2 May 2017 12:32:19 +0200 Subject: [PATCH 075/470] [autofit] Remove `slight' auto-hint mode again. A poll on freetype-devel favoured changes directly applied to `light'. * include/freetype/freetype.h (FT_LOAD_TARGET_SLIGHT, FT_RENDER_MODE_SLIGHT): Removed. * src/autofit/afcjk.c (af_cjk_hints_init), src/autofit/aflatin.c (af_latin_hints_init), src/autofit/aflatin2.c (af_latin2_hints_init): Revert change from 2017-04-22. * src/autofit/afloader.c (af_loader_load_glyph) Remove references to FT_RENDER_MODE_SLIGHT. [AF_CONFIG_OPTION_TT_SIZE_METRICS]: Enable TrueType-like metrics unconditionally. * src/base/ftadvanc.c (LOAD_ADVANCE_FAST_CHECK): Revert change from 2017-04-22. * src/base/ftobjs.c (FT_Load_Glyph): Revert change from 2017-04-22. * src/pshinter/pshalgo.c (ps_hints_apply): Revert change from 2017-04-22. * src/smooth/ftsmooth.c (ft_smooth_render): Revert change from 2017-04-22. * docs/CHANGES: Updated. --- ChangeLog | 32 ++++++++++++ docs/CHANGES | 19 +++++-- include/freetype/config/ftoption.h | 14 ++++-- include/freetype/freetype.h | 79 ++++++++++++++++-------------- src/autofit/afcjk.c | 7 +-- src/autofit/aflatin.c | 10 ++-- src/autofit/aflatin2.c | 10 ++-- src/autofit/afloader.c | 31 ++++-------- src/base/ftadvanc.c | 9 ++-- src/base/ftobjs.c | 9 ++-- src/pshinter/pshalgo.c | 3 +- src/smooth/ftsmooth.c | 3 +- src/truetype/ttgload.c | 2 +- src/truetype/ttobjs.c | 3 ++ 14 files changed, 131 insertions(+), 100 deletions(-) diff --git a/ChangeLog b/ChangeLog index b1ad07b28..8dd013ecc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,35 @@ +2017-05-02 Werner Lemberg + + [autofit] Remove `slight' auto-hint mode again. + + A poll on freetype-devel favoured changes directly applied to + `light'. + + * include/freetype/freetype.h (FT_LOAD_TARGET_SLIGHT, + FT_RENDER_MODE_SLIGHT): Removed. + + * src/autofit/afcjk.c (af_cjk_hints_init), src/autofit/aflatin.c + (af_latin_hints_init), src/autofit/aflatin2.c + (af_latin2_hints_init): Revert change from 2017-04-22. + + * src/autofit/afloader.c (af_loader_load_glyph) Remove references to + FT_RENDER_MODE_SLIGHT. + [AF_CONFIG_OPTION_TT_SIZE_METRICS]: Enable TrueType-like metrics + unconditionally. + + * src/base/ftadvanc.c (LOAD_ADVANCE_FAST_CHECK): Revert change from + 2017-04-22. + + * src/base/ftobjs.c (FT_Load_Glyph): Revert change from 2017-04-22. + + * src/pshinter/pshalgo.c (ps_hints_apply): Revert change from + 2017-04-22. + + * src/smooth/ftsmooth.c (ft_smooth_render): Revert change from + 2017-04-22. + + * docs/CHANGES: Updated. + 2017-04-30 Werner Lemberg [autofit] Fix metrics computation. diff --git a/docs/CHANGES b/docs/CHANGES index 8df2b13d5..d96be35fc 100644 --- a/docs/CHANGES +++ b/docs/CHANGES @@ -3,7 +3,9 @@ CHANGES BETWEEN 2.7.1 and 2.8 I. IMPORTANT CHANGES - - Support for OpenType Variation Fonts is now complete. + - Support for OpenType Variation Fonts is now complete. The last + missing part was handling the `VVAR' and `MVAR' tables, which is + available with this release. - A new function `FT_Face_Properties' allows the control of some module and library properties per font. Currently, the @@ -19,12 +21,21 @@ CHANGES BETWEEN 2.7.1 and 2.8 FREETYPE_PROPERTIES=pcf:no-long-family-names=1 - - Variations font support now takes care of the `VVAR' and `MVAR' - tables also. - II. IMPORTANT BUG FIXES + - `Light' auto-hinting mode no longer uses TrueType metrics for + TrueType fonts. This bug was introduced in version 2.4.6, + causing horizontal scaling also. Almost all GNU/Linux + distributions (with Fedora as a notable exception) disabled the + corresponding patch for good reasons; chances are thus high that + you won't notice a difference. + + If optical backward compatibility for legacy applications is + necessary, you might enable the AF_CONFIG_OPTION_TT_SIZE_METRICS + configuration option. However, it is strongly recommended to + avoid that, adjusting font sizes instead. + - If a TrueType font gets loaded with FT_LOAD_NO_HINTING, FreeType now scales the font linearly again (bug introduced in version 2.4.6). diff --git a/include/freetype/config/ftoption.h b/include/freetype/config/ftoption.h index 69d30a498..1bf6e8f53 100644 --- a/include/freetype/config/ftoption.h +++ b/include/freetype/config/ftoption.h @@ -909,11 +909,15 @@ FT_BEGIN_HEADER /*************************************************************************/ /* */ - /* Use TrueType-like size metrics for `light' auto-hinting. This option */ - /* exists mainly for backwards compatibility with GNU/Linux */ - /* distributions like Fedora that did not un-patch the following change */ - /* (which was present in FreeType between versions 2.4.6 and 2.7.1, */ - /* inclusive). */ + /* Use TrueType-like size metrics for `light' auto-hinting. */ + /* */ + /* It is strongly recommended to avoid this option, which exists only to */ + /* help some legacy applications retain its appearance and behaviour */ + /* with respect to auto-hinted TrueType fonts. */ + /* */ + /* The very reason this option exists at all are GNU/Linux distributions */ + /* like Fedora that did not un-patch the following change (which was */ + /* present in FreeType between versions 2.4.6 and 2.7.1, inclusive). */ /* */ /* 2011-07-16 Steven Chu */ /* */ diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h index 681d8e93d..c3bc7049f 100644 --- a/include/freetype/freetype.h +++ b/include/freetype/freetype.h @@ -221,7 +221,6 @@ FT_BEGIN_HEADER /* */ /* FT_LOAD_TARGET_NORMAL */ /* FT_LOAD_TARGET_LIGHT */ - /* FT_LOAD_TARGET_SLIGHT */ /* FT_LOAD_TARGET_MONO */ /* FT_LOAD_TARGET_LCD */ /* FT_LOAD_TARGET_LCD_V */ @@ -1756,12 +1755,37 @@ FT_BEGIN_HEADER /* `slot->format' is also changed to @FT_GLYPH_FORMAT_BITMAP. */ /* */ /* Here is a small pseudo code fragment that shows how to use */ - /* `lsb_delta' and `rsb_delta' to improve (integer) positioning of */ + /* `lsb_delta' and `rsb_delta' to do fractional positioning of */ /* glyphs: */ /* */ /* { */ - /* FT_Pos origin_x = 0; */ - /* FT_Pos prev_rsb_delta = 0; */ + /* FT_GlyphSlot slot = face->glyph; */ + /* FT_Pos origin_x = 0; */ + /* */ + /* */ + /* for all glyphs do */ + /* */ + /* */ + /* FT_Outline_Translate( slot->outline, origin_x & 63, 0 ); */ + /* */ + /* */ + /* */ + /* */ + /* */ + /* origin_x += slot->advance.x; */ + /* origin_x += slot->rsb_delta - slot->lsb_relta; */ + /* endfor */ + /* } */ + /* */ + /* Here is another small pseudo code fragment that shows how to use */ + /* `lsb_delta' and `rsb_delta' to improve integer positioning of */ + /* glyphs: */ + /* */ + /* { */ + /* FT_GlyphSlot slot = face->glyph; */ + /* FT_Pos origin_x = 0; */ + /* FT_Pos prev_rsb_delta = 0; */ /* */ /* */ /* for all glyphs do */ @@ -1770,16 +1794,16 @@ FT_BEGIN_HEADER /* */ /* */ /* */ - /* if ( prev_rsb_delta - face->glyph->lsb_delta >= 32 ) */ + /* if ( prev_rsb_delta - slot->lsb_delta >= 32 ) */ /* origin_x -= 64; */ - /* else if ( prev_rsb_delta - face->glyph->lsb_delta < -32 ) */ + /* else if ( prev_rsb_delta - slot->lsb_delta < -32 ) */ /* origin_x += 64; */ /* */ - /* prev_rsb_delta = face->glyph->rsb_delta; */ + /* prev_rsb_delta = slot->rsb_delta; */ /* */ /* */ /* */ - /* origin_x += face->glyph->advance.x; */ + /* origin_x += slot->advance.x; */ /* endfor */ /* } */ /* */ @@ -2937,8 +2961,8 @@ FT_BEGIN_HEADER * rendering. For monochrome output, use @FT_LOAD_TARGET_MONO * instead. * - * FT_LOAD_TARGET_SLIGHT :: - * A slight hinting algorithm for gray-level modes. Many generated + * FT_LOAD_TARGET_LIGHT :: + * A lighter hinting algorithm for gray-level modes. Many generated * glyphs are fuzzier but better resemble their original shape. This * is achieved by snapping glyphs to the pixel grid only vertically * (Y-axis), as is done by FreeType's new CFF engine or Microsoft's @@ -2947,25 +2971,16 @@ FT_BEGIN_HEADER * driver, if the driver itself and the font support it, or by the * auto-hinter. * - * Advance widths are not rounded to integer values; instead, metrics - * are based on linearly scaled values. In particular this implies - * that you have to apply sub-pixel rendering. - * - * FT_LOAD_TARGET_LIGHT :: - * This is similar to @FT_LOAD_TARGET_SLIGHT with a main difference: - * It uses integer advance widths. + * Advance widths are rounded to integer values; however, using the + * `lsb_delta' and `rsb_delta' fields of @FT_GlyphSlotRec, it is + * possible to get fractional advance widths for sub-pixel positioning + * (which is recommended to use). * * If configuration option AF_CONFIG_OPTION_TT_SIZE_METRICS is active, * TrueType-like metrics are used to make this mode behave similarly * as in unpatched FreeType versions between 2.4.6 and 2.7.1 * (inclusive). * - * This hinting mode is deprecated. In general, - * @FT_LOAD_TARGET_SLIGHT always yields better results; additionally, - * FT_LOAD_TARGET_LIGHT suffers from backwards compatibility issues - * (see the documentation of AF_CONFIG_OPTION_TT_SIZE_METRICS in - * `ftoption.h' for more details). - * * FT_LOAD_TARGET_MONO :: * Strong hinting algorithm that should only be used for monochrome * output. The result is probably unpleasant if the glyph is rendered @@ -3001,18 +3016,17 @@ FT_BEGIN_HEADER * } * * In general, you should stick with one rendering mode. For example, - * switching between @FT_LOAD_TARGET_LIGHT and @FT_LOAD_TARGET_SLIGHT - * enforces a lot of recomputation, which is slow. Another reason is - * caching: Selecting a different mode usually causes changes in both - * the outlines and the rasterized bitmaps; it is thus necessary to - * empty the cache after a mode switch to avoid false hits. + * switching between @FT_LOAD_TARGET_NORMAL and @FT_LOAD_TARGET_MONO + * enforces a lot of recomputation for TrueType fonts, which is slow. + * Another reason is caching: Selecting a different mode usually causes + * changes in both the outlines and the rasterized bitmaps; it is thus + * necessary to empty the cache after a mode switch to avoid false hits. * */ #define FT_LOAD_TARGET_( x ) ( (FT_Int32)( (x) & 15 ) << 16 ) #define FT_LOAD_TARGET_NORMAL FT_LOAD_TARGET_( FT_RENDER_MODE_NORMAL ) #define FT_LOAD_TARGET_LIGHT FT_LOAD_TARGET_( FT_RENDER_MODE_LIGHT ) -#define FT_LOAD_TARGET_SLIGHT FT_LOAD_TARGET_( FT_RENDER_MODE_SLIGHT ) #define FT_LOAD_TARGET_MONO FT_LOAD_TARGET_( FT_RENDER_MODE_MONO ) #define FT_LOAD_TARGET_LCD FT_LOAD_TARGET_( FT_RENDER_MODE_LCD ) #define FT_LOAD_TARGET_LCD_V FT_LOAD_TARGET_( FT_RENDER_MODE_LCD_V ) @@ -3093,12 +3107,6 @@ FT_BEGIN_HEADER /* indirectly to define hinting algorithm selectors. See */ /* @FT_LOAD_TARGET_XXX for details. */ /* */ - /* FT_RENDER_MODE_SLIGHT :: */ - /* This is equivalent to @FT_RENDER_MODE_NORMAL. It is only */ - /* defined as a separate value because render modes are also used */ - /* indirectly to define hinting algorithm selectors. See */ - /* @FT_LOAD_TARGET_XXX for details. */ - /* */ /* FT_RENDER_MODE_MONO :: */ /* This mode corresponds to 1-bit bitmaps (with 2~levels of */ /* opacity). */ @@ -3134,7 +3142,6 @@ FT_BEGIN_HEADER FT_RENDER_MODE_MONO, FT_RENDER_MODE_LCD, FT_RENDER_MODE_LCD_V, - FT_RENDER_MODE_SLIGHT, FT_RENDER_MODE_MAX diff --git a/src/autofit/afcjk.c b/src/autofit/afcjk.c index 86b8b4067..61e29cded 100644 --- a/src/autofit/afcjk.c +++ b/src/autofit/afcjk.c @@ -1398,12 +1398,9 @@ other_flags |= AF_LATIN_HINTS_VERT_SNAP; /* - * We adjust stems to full pixels unless in `light', `slight', - * or `lcd' mode. + * We adjust stems to full pixels unless in `light' or `lcd' mode. */ - if ( mode != FT_RENDER_MODE_LIGHT && - mode != FT_RENDER_MODE_SLIGHT && - mode != FT_RENDER_MODE_LCD ) + if ( mode != FT_RENDER_MODE_LIGHT && mode != FT_RENDER_MODE_LCD ) other_flags |= AF_LATIN_HINTS_STEM_ADJUST; if ( mode == FT_RENDER_MODE_MONO ) diff --git a/src/autofit/aflatin.c b/src/autofit/aflatin.c index e03fdf01f..11fa523c8 100644 --- a/src/autofit/aflatin.c +++ b/src/autofit/aflatin.c @@ -2577,9 +2577,7 @@ /* * We adjust stems to full pixels unless in `light' or `lcd' mode. */ - if ( mode != FT_RENDER_MODE_LIGHT && - mode != FT_RENDER_MODE_SLIGHT && - mode != FT_RENDER_MODE_LCD ) + if ( mode != FT_RENDER_MODE_LIGHT && mode != FT_RENDER_MODE_LCD ) other_flags |= AF_LATIN_HINTS_STEM_ADJUST; if ( mode == FT_RENDER_MODE_MONO ) @@ -2592,10 +2590,8 @@ * However, if warping is enabled (which only works in `light' hinting * mode), advance widths get adjusted, too. */ - if ( mode == FT_RENDER_MODE_LIGHT || - mode == FT_RENDER_MODE_SLIGHT || - mode == FT_RENDER_MODE_LCD || - ( face->style_flags & FT_STYLE_FLAG_ITALIC ) != 0 ) + if ( mode == FT_RENDER_MODE_LIGHT || mode == FT_RENDER_MODE_LCD || + ( face->style_flags & FT_STYLE_FLAG_ITALIC ) != 0 ) scaler_flags |= AF_SCALER_FLAG_NO_HORIZONTAL; #ifdef AF_CONFIG_OPTION_USE_WARPER diff --git a/src/autofit/aflatin2.c b/src/autofit/aflatin2.c index 87ab91d8e..0607278b1 100644 --- a/src/autofit/aflatin2.c +++ b/src/autofit/aflatin2.c @@ -1560,9 +1560,7 @@ /* * We adjust stems to full pixels unless in `light' or `lcd' mode. */ - if ( mode != FT_RENDER_MODE_LIGHT && - mode != FT_RENDER_MODE_SLIGHT && - mode != FT_RENDER_MODE_LCD ) + if ( mode != FT_RENDER_MODE_LIGHT && mode != FT_RENDER_MODE_LCD ) other_flags |= AF_LATIN_HINTS_STEM_ADJUST; if ( mode == FT_RENDER_MODE_MONO ) @@ -1572,10 +1570,8 @@ * In `light' or `lcd' mode we disable horizontal hinting completely. * We also do it if the face is italic. */ - if ( mode == FT_RENDER_MODE_LIGHT || - mode == FT_RENDER_MODE_SLIGHT || - mode == FT_RENDER_MODE_LCD || - ( face->style_flags & FT_STYLE_FLAG_ITALIC ) != 0 ) + if ( mode == FT_RENDER_MODE_LIGHT || mode == FT_RENDER_MODE_LCD || + ( face->style_flags & FT_STYLE_FLAG_ITALIC ) != 0 ) scaler_flags |= AF_SCALER_FLAG_NO_HORIZONTAL; #ifdef AF_CONFIG_OPTION_USE_WARPER diff --git a/src/autofit/afloader.c b/src/autofit/afloader.c index b3269d10b..ddf47ebcf 100644 --- a/src/autofit/afloader.c +++ b/src/autofit/afloader.c @@ -245,15 +245,14 @@ if ( !size_internal->autohint_metrics.x_scale || size_internal->autohint_mode != FT_LOAD_TARGET_MODE( load_flags ) ) { - /* switching between LIGHT and SLIGHT (and vice versa) usually means */ - /* different scaling values; this later on enforces recomputation of */ - /* everything related to the current size */ + /* switching between hinting modes usually means different scaling */ + /* values; this later on enforces recomputation of everything */ + /* related to the current size */ size_internal->autohint_mode = FT_LOAD_TARGET_MODE( load_flags ); size_internal->autohint_metrics = size->metrics; #ifdef AF_CONFIG_OPTION_TT_SIZE_METRICS - if ( size_internal->autohint_mode != FT_RENDER_MODE_SLIGHT ) { FT_Size_Metrics* size_metrics = &size_internal->autohint_metrics; @@ -382,12 +381,11 @@ * */ - /* stem darkening only works well in `light' and `slight' modes */ - if ( ( scaler.render_mode == FT_RENDER_MODE_LIGHT || - scaler.render_mode == FT_RENDER_MODE_SLIGHT ) && + /* stem darkening only works well in `light' mode */ + if ( scaler.render_mode == FT_RENDER_MODE_LIGHT && ( !face->internal->no_stem_darkening || ( face->internal->no_stem_darkening < 0 && - !module->no_stem_darkening ) ) ) + !module->no_stem_darkening ) ) ) af_loader_embolden_glyph_in_slot( loader, face, style_metrics ); loader->transformed = slot_internal->glyph_transformed; @@ -435,8 +433,7 @@ /* we now need to adjust the metrics according to the change in */ /* width/positioning that occurred during the hinting process */ - if ( scaler.render_mode != FT_RENDER_MODE_LIGHT && - scaler.render_mode != FT_RENDER_MODE_SLIGHT ) + if ( scaler.render_mode != FT_RENDER_MODE_LIGHT ) { FT_Pos old_rsb, old_lsb, new_lsb; FT_Pos pp1x_uh, pp2x_uh; @@ -494,9 +491,8 @@ } } /* `light' mode uses integer advance widths */ - /* (but sets `lsb_delta' and `rsb_delta'), */ - /* `slight' mode uses fractional values */ - else if ( scaler.render_mode == FT_RENDER_MODE_LIGHT ) + /* but sets `lsb_delta' and `rsb_delta' */ + else { FT_Pos pp1x = loader->pp1.x; FT_Pos pp2x = loader->pp2.x; @@ -508,11 +504,6 @@ slot->lsb_delta = loader->pp1.x - pp1x; slot->rsb_delta = loader->pp2.x - pp2x; } - else - { - slot->lsb_delta = 0; - slot->rsb_delta = 0; - } break; @@ -563,7 +554,6 @@ /* to keep the original rounded advance width; ditto for */ /* digits if all have the same advance width */ if ( scaler.render_mode != FT_RENDER_MODE_LIGHT && - scaler.render_mode != FT_RENDER_MODE_SLIGHT && ( FT_IS_FIXED_WIDTH( slot->face ) || ( af_face_globals_is_digit( loader->globals, glyph_index ) && style_metrics->digits_have_same_width ) ) ) @@ -587,8 +577,7 @@ slot->metrics.vertAdvance = FT_MulFix( slot->metrics.vertAdvance, style_metrics->scaler.y_scale ); - if ( scaler.render_mode != FT_RENDER_MODE_SLIGHT ) - slot->metrics.horiAdvance = FT_PIX_ROUND( slot->metrics.horiAdvance ); + slot->metrics.horiAdvance = FT_PIX_ROUND( slot->metrics.horiAdvance ); slot->metrics.vertAdvance = FT_PIX_ROUND( slot->metrics.vertAdvance ); slot->format = FT_GLYPH_FORMAT_OUTLINE; diff --git a/src/base/ftadvanc.c b/src/base/ftadvanc.c index 5f2e0b167..1557607fc 100644 --- a/src/base/ftadvanc.c +++ b/src/base/ftadvanc.c @@ -59,15 +59,14 @@ /* */ /* - unscaled load */ /* - unhinted load */ - /* - light-hinted and slight-hinted load */ + /* - light-hinted load */ /* - if a variations font, it must have an `HVAR' or `VVAR' */ /* table (thus the old MM or GX fonts don't qualify; this */ /* gets checked by the driver-specific functions) */ -#define LOAD_ADVANCE_FAST_CHECK( face, flags ) \ - ( flags & ( FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING ) || \ - ( FT_LOAD_TARGET_MODE( flags ) == FT_RENDER_MODE_LIGHT || \ - FT_LOAD_TARGET_MODE( flags ) == FT_RENDER_MODE_SLIGHT ) ) +#define LOAD_ADVANCE_FAST_CHECK( face, flags ) \ + ( flags & ( FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING ) || \ + FT_LOAD_TARGET_MODE( flags ) == FT_RENDER_MODE_LIGHT ) /* documentation is in ftadvanc.h */ diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c index cbc771322..539116e85 100644 --- a/src/base/ftobjs.c +++ b/src/base/ftobjs.c @@ -668,8 +668,8 @@ * - Then, auto-hint if FT_LOAD_FORCE_AUTOHINT is set or if we don't * have a native font hinter. * - * - Otherwise, auto-hint for LIGHT or SLIGHT hinting mode or if there - * isn't any hinting bytecode in the TrueType/OpenType font. + * - Otherwise, auto-hint for LIGHT hinting mode or if there isn't + * any hinting bytecode in the TrueType/OpenType font. * * - Exception: The font is `tricky' and requires the native hinter to * load properly. @@ -702,9 +702,8 @@ /* check the size of the `fpgm' and `prep' tables, too -- */ /* the assumption is that there don't exist real TTFs where */ /* both `fpgm' and `prep' tables are missing */ - if ( ( ( mode == FT_RENDER_MODE_LIGHT || - mode == FT_RENDER_MODE_SLIGHT ) && - !FT_DRIVER_HINTS_LIGHTLY( driver ) ) || + if ( ( mode == FT_RENDER_MODE_LIGHT && + !FT_DRIVER_HINTS_LIGHTLY( driver ) ) || ( FT_IS_SFNT( face ) && ttface->num_locations && ttface->max_profile.maxSizeOfInstructions == 0 && diff --git a/src/pshinter/pshalgo.c b/src/pshinter/pshalgo.c index 27cb229eb..9ad1a3a02 100644 --- a/src/pshinter/pshalgo.c +++ b/src/pshinter/pshalgo.c @@ -2149,8 +2149,7 @@ glyph->do_vert_snapping = FT_BOOL( hint_mode == FT_RENDER_MODE_MONO || hint_mode == FT_RENDER_MODE_LCD_V ); - glyph->do_stem_adjust = FT_BOOL( hint_mode != FT_RENDER_MODE_LIGHT && - hint_mode != FT_RENDER_MODE_SLIGHT ); + glyph->do_stem_adjust = FT_BOOL( hint_mode != FT_RENDER_MODE_LIGHT ); for ( dimension = 0; dimension < 2; dimension++ ) { diff --git a/src/smooth/ftsmooth.c b/src/smooth/ftsmooth.c index 52e61e559..435854e67 100644 --- a/src/smooth/ftsmooth.c +++ b/src/smooth/ftsmooth.c @@ -433,8 +433,7 @@ FT_Render_Mode mode, const FT_Vector* origin ) { - if ( mode == FT_RENDER_MODE_LIGHT || - mode == FT_RENDER_MODE_SLIGHT ) + if ( mode == FT_RENDER_MODE_LIGHT ) mode = FT_RENDER_MODE_NORMAL; return ft_smooth_render_generic( render, slot, mode, origin, diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c index c5d548f0b..9c1e109c3 100644 --- a/src/truetype/ttgload.c +++ b/src/truetype/ttgload.c @@ -2737,7 +2737,7 @@ /* TrueType glyphs at all sizes using the bytecode interpreter. */ /* */ if ( !( load_flags & FT_LOAD_NO_SCALE ) && - size->metrics->y_ppem < 24 ) + size->metrics->y_ppem < 24 ) glyph->outline.flags |= FT_OUTLINE_HIGH_PRECISION; Exit: diff --git a/src/truetype/ttobjs.c b/src/truetype/ttobjs.c index 64011e86e..d20e3da07 100644 --- a/src/truetype/ttobjs.c +++ b/src/truetype/ttobjs.c @@ -1234,6 +1234,7 @@ /* */ if ( face->header.Flags & 8 ) { + /* the TT spec always asks for ROUND, not FLOOR or CEIL */ size_metrics->ascender = FT_PIX_ROUND( FT_MulFix( face->root.ascender, size_metrics->y_scale ) ); @@ -1252,6 +1253,8 @@ if ( face->header.Flags & 8 ) { + /* base scaling values on integer ppem values, */ + /* as mandated by the TrueType specification */ size_metrics->x_scale = FT_DivFix( size_metrics->x_ppem << 6, face->root.units_per_EM ); size_metrics->y_scale = FT_DivFix( size_metrics->y_ppem << 6, From 60bf264ee25dc08403dddb3e4cd2bf950cda9e90 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 2 May 2017 14:38:54 +0200 Subject: [PATCH 076/470] [truetype] Make `IUP' gvar deltas do the same as Apple (#50832). When points are not touched by gvar interpolation deltas, FreeType gave a slightly different result than Apple's CoreText. The OpenType working group will update the specification to document the following behaviour: If the two points with deltas to the `left' and `right' of the untouched point have the same coordinate, then the inferred delta for the untouched point should be zero. * src/truetype/ttgxvar.c (tt_delta_interpolate): Implement new behaviour. --- ChangeLog | 15 +++++++++++++++ src/truetype/ttgxvar.c | 23 +++++------------------ 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8dd013ecc..05fd0aa4e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2017-05-02 Behdad Esfahbod + + [truetype] Make `IUP' gvar deltas do the same as Apple (#50832). + + When points are not touched by gvar interpolation deltas, FreeType + gave a slightly different result than Apple's CoreText. + + The OpenType working group will update the specification to document + the following behaviour: If the two points with deltas to the `left' + and `right' of the untouched point have the same coordinate, then + the inferred delta for the untouched point should be zero. + + * src/truetype/ttgxvar.c (tt_delta_interpolate): Implement new + behaviour. + 2017-05-02 Werner Lemberg [autofit] Remove `slight' auto-hint mode again. diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c index 6d4529ba5..0cedb6bdf 100644 --- a/src/truetype/ttgxvar.c +++ b/src/truetype/ttgxvar.c @@ -3081,25 +3081,12 @@ d1 = out1 - in1; d2 = out2 - in2; - if ( out1 == out2 || in1 == in2 ) + /* If the reference points have the same coordinate but different */ + /* delta, inferred delta is zero. Otherwise interpolate. */ + if ( in1 != in2 || out1 == out2 ) { - for ( p = p1; p <= p2; p++ ) - { - out = in_points[p].x; - - if ( out <= in1 ) - out += d1; - else if ( out >= in2 ) - out += d2; - else - out = out1; - - out_points[p].x = out; - } - } - else - { - FT_Fixed scale = FT_DivFix( out2 - out1, in2 - in1 ); + FT_Fixed scale = in1 != in2 ? FT_DivFix( out2 - out1, in2 - in1 ) + : 0; for ( p = p1; p <= p2; p++ ) From 14ae17a25f787c966fa9e532499c93461181b81b Mon Sep 17 00:00:00 2001 From: Sascha Brawer Date: Wed, 3 May 2017 18:35:13 +0200 Subject: [PATCH 077/470] [autofit] Add support for Avestan script. * src/autofit/afblue.dat: Add blue zone data for Avestan. * src/autofit/afblue.c, src/autofit/afblue.h: Regenerated. * src/autofit/afscript.h: Add Avestan standard character. * src/autofit/afranges.c, src/autofit/afstyles.h: Add Avestan data. --- ChangeLog | 12 ++ src/autofit/afblue.c | 7 + src/autofit/afblue.dat | 10 ++ src/autofit/afblue.h | 333 +++++++++++++++++++++-------------------- src/autofit/afranges.c | 13 ++ src/autofit/afscript.h | 6 + src/autofit/afstyles.h | 7 + 7 files changed, 223 insertions(+), 165 deletions(-) diff --git a/ChangeLog b/ChangeLog index 05fd0aa4e..f1afb3ca0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2017-05-03 Sascha Brawer + Werner Lemberg [truetype] Make `IUP' gvar deltas do the same as Apple (#50832). diff --git a/src/autofit/afblue.c b/src/autofit/afblue.c index bbbe77913..0fd6e881d 100644 --- a/src/autofit/afblue.c +++ b/src/autofit/afblue.c @@ -52,6 +52,10 @@ '\0', '\xD5', '\xA2', ' ', '\xD5', '\xA8', ' ', '\xD5', '\xAB', ' ', '\xD5', '\xAC', ' ', '\xD5', '\xB2', ' ', '\xD5', '\xBA', ' ', '\xD6', '\x83', ' ', '\xD6', '\x81', /* բ ը ի լ ղ պ փ ց */ '\0', + '\xF0', '\x90', '\xAC', '\x80', ' ', '\xF0', '\x90', '\xAC', '\x81', ' ', '\xF0', '\x90', '\xAC', '\x90', ' ', '\xF0', '\x90', '\xAC', '\x9B', /* 𐬀 𐬁 𐬐 𐬛 */ + '\0', + '\xF0', '\x90', '\xAC', '\x80', ' ', '\xF0', '\x90', '\xAC', '\x81', /* 𐬀 𐬁 */ + '\0', '\xE0', '\xA6', '\x85', ' ', '\xE0', '\xA6', '\xA1', ' ', '\xE0', '\xA6', '\xA4', ' ', '\xE0', '\xA6', '\xA8', ' ', '\xE0', '\xA6', '\xAC', ' ', '\xE0', '\xA6', '\xAD', ' ', '\xE0', '\xA6', '\xB2', ' ', '\xE0', '\xA6', '\x95', /* অ ড ত ন ব ভ ল ক */ '\0', '\xE0', '\xA6', '\x87', ' ', '\xE0', '\xA6', '\x9F', ' ', '\xE0', '\xA6', '\xA0', ' ', '\xE0', '\xA6', '\xBF', ' ', '\xE0', '\xA7', '\x80', ' ', '\xE0', '\xA7', '\x88', ' ', '\xE0', '\xA7', '\x97', /* ই ট ঠ ি ী ৈ ৗ */ @@ -373,6 +377,9 @@ { AF_BLUE_STRING_ARMENIAN_SMALL_BOTTOM, 0 }, { AF_BLUE_STRING_ARMENIAN_SMALL_DESCENDER, 0 }, { AF_BLUE_STRING_MAX, 0 }, + { AF_BLUE_STRING_AVESTAN_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_AVESTAN_BOTTOM, 0 }, + { AF_BLUE_STRING_MAX, 0 }, { AF_BLUE_STRING_BENGALI_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, { AF_BLUE_STRING_BENGALI_HEAD, AF_BLUE_PROPERTY_LATIN_TOP }, { AF_BLUE_STRING_BENGALI_BASE, AF_BLUE_PROPERTY_LATIN_TOP | diff --git a/src/autofit/afblue.dat b/src/autofit/afblue.dat index 6fa8fdd81..be0ae420f 100644 --- a/src/autofit/afblue.dat +++ b/src/autofit/afblue.dat @@ -108,6 +108,11 @@ AF_BLUE_STRING_ENUM AF_BLUE_STRINGS_ARRAY AF_BLUE_STRING_MAX_LEN: AF_BLUE_STRING_ARMENIAN_SMALL_DESCENDER "բ ը ի լ ղ պ փ ց" + AF_BLUE_STRING_AVESTAN_TOP + "𐬀 𐬁 𐬐 𐬛" + AF_BLUE_STRING_AVESTAN_BOTTOM + "𐬀 𐬁" + AF_BLUE_STRING_BENGALI_BASE "অ ড ত ন ব ভ ল ক" AF_BLUE_STRING_BENGALI_TOP @@ -593,6 +598,11 @@ AF_BLUE_STRINGSET_ENUM AF_BLUE_STRINGSETS_ARRAY AF_BLUE_STRINGSET_MAX_LEN: { AF_BLUE_STRING_ARMENIAN_SMALL_DESCENDER, 0 } { AF_BLUE_STRING_MAX, 0 } + AF_BLUE_STRINGSET_AVST + { AF_BLUE_STRING_AVESTAN_TOP, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_AVESTAN_BOTTOM, 0 } + { AF_BLUE_STRING_MAX, 0 } + AF_BLUE_STRINGSET_BENG { AF_BLUE_STRING_BENGALI_TOP, AF_BLUE_PROPERTY_LATIN_TOP } { AF_BLUE_STRING_BENGALI_HEAD, AF_BLUE_PROPERTY_LATIN_TOP } diff --git a/src/autofit/afblue.h b/src/autofit/afblue.h index c44e2e385..4b6c264cf 100644 --- a/src/autofit/afblue.h +++ b/src/autofit/afblue.h @@ -90,134 +90,136 @@ FT_BEGIN_HEADER AF_BLUE_STRING_ARMENIAN_SMALL_TOP = 210, AF_BLUE_STRING_ARMENIAN_SMALL_BOTTOM = 234, AF_BLUE_STRING_ARMENIAN_SMALL_DESCENDER = 258, - AF_BLUE_STRING_BENGALI_BASE = 282, - AF_BLUE_STRING_BENGALI_TOP = 314, - AF_BLUE_STRING_BENGALI_HEAD = 342, - AF_BLUE_STRING_CHEROKEE_CAPITAL = 374, - AF_BLUE_STRING_CHEROKEE_SMALL_ASCENDER = 406, - AF_BLUE_STRING_CHEROKEE_SMALL = 438, - AF_BLUE_STRING_CHEROKEE_SMALL_DESCENDER = 470, - AF_BLUE_STRING_CYPRIOT_TOP = 486, - AF_BLUE_STRING_CYPRIOT_BOTTOM = 526, - AF_BLUE_STRING_CYPRIOT_SMALL = 561, - AF_BLUE_STRING_CYRILLIC_CAPITAL_TOP = 576, - AF_BLUE_STRING_CYRILLIC_CAPITAL_BOTTOM = 600, - AF_BLUE_STRING_CYRILLIC_SMALL = 624, - AF_BLUE_STRING_CYRILLIC_SMALL_DESCENDER = 648, - AF_BLUE_STRING_DESERET_CAPITAL_TOP = 657, - AF_BLUE_STRING_DESERET_CAPITAL_BOTTOM = 682, - AF_BLUE_STRING_DESERET_SMALL_TOP = 707, - AF_BLUE_STRING_DESERET_SMALL_BOTTOM = 732, - AF_BLUE_STRING_DEVANAGARI_BASE = 757, - AF_BLUE_STRING_DEVANAGARI_TOP = 789, - AF_BLUE_STRING_DEVANAGARI_HEAD = 821, - AF_BLUE_STRING_DEVANAGARI_BOTTOM = 853, - AF_BLUE_STRING_ETHIOPIC_TOP = 861, - AF_BLUE_STRING_ETHIOPIC_BOTTOM = 893, - AF_BLUE_STRING_GEORGIAN_MKHEDRULI_TOP = 925, - AF_BLUE_STRING_GEORGIAN_MKHEDRULI_BOTTOM = 957, - AF_BLUE_STRING_GEORGIAN_MKHEDRULI_ASCENDER = 989, - AF_BLUE_STRING_GEORGIAN_MKHEDRULI_DESCENDER = 1021, - AF_BLUE_STRING_GEORGIAN_ASOMTAVRULI_TOP = 1053, - AF_BLUE_STRING_GEORGIAN_ASOMTAVRULI_BOTTOM = 1085, - AF_BLUE_STRING_GEORGIAN_NUSKHURI_TOP = 1117, - AF_BLUE_STRING_GEORGIAN_NUSKHURI_BOTTOM = 1149, - AF_BLUE_STRING_GEORGIAN_NUSKHURI_ASCENDER = 1181, - AF_BLUE_STRING_GEORGIAN_NUSKHURI_DESCENDER = 1213, - AF_BLUE_STRING_GLAGOLITIC_CAPITAL_TOP = 1245, - AF_BLUE_STRING_GLAGOLITIC_CAPITAL_BOTTOM = 1277, - AF_BLUE_STRING_GLAGOLITIC_SMALL_TOP = 1309, - AF_BLUE_STRING_GLAGOLITIC_SMALL_BOTTOM = 1341, - AF_BLUE_STRING_GOTHIC_TOP = 1373, - AF_BLUE_STRING_GOTHIC_BOTTOM = 1413, - AF_BLUE_STRING_GREEK_CAPITAL_TOP = 1433, - AF_BLUE_STRING_GREEK_CAPITAL_BOTTOM = 1454, - AF_BLUE_STRING_GREEK_SMALL_BETA_TOP = 1472, - AF_BLUE_STRING_GREEK_SMALL = 1490, - AF_BLUE_STRING_GREEK_SMALL_DESCENDER = 1514, - AF_BLUE_STRING_GUJARATI_TOP = 1538, - AF_BLUE_STRING_GUJARATI_BOTTOM = 1570, - AF_BLUE_STRING_GUJARATI_ASCENDER = 1602, - AF_BLUE_STRING_GUJARATI_DESCENDER = 1652, - AF_BLUE_STRING_GUJARATI_DIGIT_TOP = 1685, - AF_BLUE_STRING_GURMUKHI_BASE = 1705, - AF_BLUE_STRING_GURMUKHI_HEAD = 1737, - AF_BLUE_STRING_GURMUKHI_TOP = 1769, - AF_BLUE_STRING_GURMUKHI_BOTTOM = 1801, - AF_BLUE_STRING_GURMUKHI_DIGIT_TOP = 1833, - AF_BLUE_STRING_HEBREW_TOP = 1853, - AF_BLUE_STRING_HEBREW_BOTTOM = 1877, - AF_BLUE_STRING_HEBREW_DESCENDER = 1895, - AF_BLUE_STRING_KANNADA_TOP = 1910, - AF_BLUE_STRING_KANNADA_BOTTOM = 1954, - AF_BLUE_STRING_KHMER_TOP = 1986, - AF_BLUE_STRING_KHMER_SUBSCRIPT_TOP = 2010, - AF_BLUE_STRING_KHMER_BOTTOM = 2050, - AF_BLUE_STRING_KHMER_DESCENDER = 2082, - AF_BLUE_STRING_KHMER_LARGE_DESCENDER = 2116, - AF_BLUE_STRING_KHMER_SYMBOLS_WAXING_TOP = 2203, - AF_BLUE_STRING_KHMER_SYMBOLS_WANING_BOTTOM = 2211, - AF_BLUE_STRING_LAO_TOP = 2219, - AF_BLUE_STRING_LAO_BOTTOM = 2251, - AF_BLUE_STRING_LAO_ASCENDER = 2283, - AF_BLUE_STRING_LAO_LARGE_ASCENDER = 2299, - AF_BLUE_STRING_LAO_DESCENDER = 2311, - AF_BLUE_STRING_LATIN_CAPITAL_TOP = 2335, - AF_BLUE_STRING_LATIN_CAPITAL_BOTTOM = 2351, - AF_BLUE_STRING_LATIN_SMALL_F_TOP = 2367, - AF_BLUE_STRING_LATIN_SMALL_TOP = 2381, - AF_BLUE_STRING_LATIN_SMALL_BOTTOM = 2397, - AF_BLUE_STRING_LATIN_SMALL_DESCENDER = 2413, - AF_BLUE_STRING_LATIN_SUBS_CAPITAL_TOP = 2423, - AF_BLUE_STRING_LATIN_SUBS_CAPITAL_BOTTOM = 2443, - AF_BLUE_STRING_LATIN_SUBS_SMALL_F_TOP = 2463, - AF_BLUE_STRING_LATIN_SUBS_SMALL = 2483, - AF_BLUE_STRING_LATIN_SUBS_SMALL_DESCENDER = 2519, - AF_BLUE_STRING_LATIN_SUPS_CAPITAL_TOP = 2539, - AF_BLUE_STRING_LATIN_SUPS_CAPITAL_BOTTOM = 2570, - AF_BLUE_STRING_LATIN_SUPS_SMALL_F_TOP = 2599, - AF_BLUE_STRING_LATIN_SUPS_SMALL = 2625, - AF_BLUE_STRING_LATIN_SUPS_SMALL_DESCENDER = 2650, - AF_BLUE_STRING_LISU_TOP = 2661, - AF_BLUE_STRING_LISU_BOTTOM = 2693, - AF_BLUE_STRING_MALAYALAM_TOP = 2725, - AF_BLUE_STRING_MALAYALAM_BOTTOM = 2769, - AF_BLUE_STRING_MYANMAR_TOP = 2801, - AF_BLUE_STRING_MYANMAR_BOTTOM = 2833, - AF_BLUE_STRING_MYANMAR_ASCENDER = 2865, - AF_BLUE_STRING_MYANMAR_DESCENDER = 2893, - AF_BLUE_STRING_NKO_TOP = 2925, - AF_BLUE_STRING_NKO_BOTTOM = 2949, - AF_BLUE_STRING_NKO_SMALL_TOP = 2964, - AF_BLUE_STRING_NKO_SMALL_BOTTOM = 2973, - AF_BLUE_STRING_OL_CHIKI = 2985, - AF_BLUE_STRING_OLD_TURKIC_TOP = 3009, - AF_BLUE_STRING_OLD_TURKIC_BOTTOM = 3024, - AF_BLUE_STRING_OSAGE_CAPITAL_TOP = 3044, - AF_BLUE_STRING_OSAGE_CAPITAL_BOTTOM = 3084, - AF_BLUE_STRING_OSAGE_CAPITAL_DESCENDER = 3114, - AF_BLUE_STRING_OSAGE_SMALL_TOP = 3129, - AF_BLUE_STRING_OSAGE_SMALL_BOTTOM = 3169, - AF_BLUE_STRING_OSAGE_SMALL_ASCENDER = 3209, - AF_BLUE_STRING_OSAGE_SMALL_DESCENDER = 3234, - AF_BLUE_STRING_SINHALA_TOP = 3249, - AF_BLUE_STRING_SINHALA_BOTTOM = 3281, - AF_BLUE_STRING_SINHALA_DESCENDER = 3313, - AF_BLUE_STRING_TAI_VIET_TOP = 3357, - AF_BLUE_STRING_TAI_VIET_BOTTOM = 3377, - AF_BLUE_STRING_TAMIL_TOP = 3389, - AF_BLUE_STRING_TAMIL_BOTTOM = 3421, - AF_BLUE_STRING_TELUGU_TOP = 3453, - AF_BLUE_STRING_TELUGU_BOTTOM = 3481, - AF_BLUE_STRING_THAI_TOP = 3509, - AF_BLUE_STRING_THAI_BOTTOM = 3533, - AF_BLUE_STRING_THAI_ASCENDER = 3561, - AF_BLUE_STRING_THAI_LARGE_ASCENDER = 3573, - AF_BLUE_STRING_THAI_DESCENDER = 3585, - AF_BLUE_STRING_THAI_LARGE_DESCENDER = 3601, - AF_BLUE_STRING_THAI_DIGIT_TOP = 3609, - AF_BLUE_STRING_TIFINAGH = 3621, - af_blue_1_1 = 3652, + AF_BLUE_STRING_AVESTAN_TOP = 282, + AF_BLUE_STRING_AVESTAN_BOTTOM = 302, + AF_BLUE_STRING_BENGALI_BASE = 312, + AF_BLUE_STRING_BENGALI_TOP = 344, + AF_BLUE_STRING_BENGALI_HEAD = 372, + AF_BLUE_STRING_CHEROKEE_CAPITAL = 404, + AF_BLUE_STRING_CHEROKEE_SMALL_ASCENDER = 436, + AF_BLUE_STRING_CHEROKEE_SMALL = 468, + AF_BLUE_STRING_CHEROKEE_SMALL_DESCENDER = 500, + AF_BLUE_STRING_CYPRIOT_TOP = 516, + AF_BLUE_STRING_CYPRIOT_BOTTOM = 556, + AF_BLUE_STRING_CYPRIOT_SMALL = 591, + AF_BLUE_STRING_CYRILLIC_CAPITAL_TOP = 606, + AF_BLUE_STRING_CYRILLIC_CAPITAL_BOTTOM = 630, + AF_BLUE_STRING_CYRILLIC_SMALL = 654, + AF_BLUE_STRING_CYRILLIC_SMALL_DESCENDER = 678, + AF_BLUE_STRING_DESERET_CAPITAL_TOP = 687, + AF_BLUE_STRING_DESERET_CAPITAL_BOTTOM = 712, + AF_BLUE_STRING_DESERET_SMALL_TOP = 737, + AF_BLUE_STRING_DESERET_SMALL_BOTTOM = 762, + AF_BLUE_STRING_DEVANAGARI_BASE = 787, + AF_BLUE_STRING_DEVANAGARI_TOP = 819, + AF_BLUE_STRING_DEVANAGARI_HEAD = 851, + AF_BLUE_STRING_DEVANAGARI_BOTTOM = 883, + AF_BLUE_STRING_ETHIOPIC_TOP = 891, + AF_BLUE_STRING_ETHIOPIC_BOTTOM = 923, + AF_BLUE_STRING_GEORGIAN_MKHEDRULI_TOP = 955, + AF_BLUE_STRING_GEORGIAN_MKHEDRULI_BOTTOM = 987, + AF_BLUE_STRING_GEORGIAN_MKHEDRULI_ASCENDER = 1019, + AF_BLUE_STRING_GEORGIAN_MKHEDRULI_DESCENDER = 1051, + AF_BLUE_STRING_GEORGIAN_ASOMTAVRULI_TOP = 1083, + AF_BLUE_STRING_GEORGIAN_ASOMTAVRULI_BOTTOM = 1115, + AF_BLUE_STRING_GEORGIAN_NUSKHURI_TOP = 1147, + AF_BLUE_STRING_GEORGIAN_NUSKHURI_BOTTOM = 1179, + AF_BLUE_STRING_GEORGIAN_NUSKHURI_ASCENDER = 1211, + AF_BLUE_STRING_GEORGIAN_NUSKHURI_DESCENDER = 1243, + AF_BLUE_STRING_GLAGOLITIC_CAPITAL_TOP = 1275, + AF_BLUE_STRING_GLAGOLITIC_CAPITAL_BOTTOM = 1307, + AF_BLUE_STRING_GLAGOLITIC_SMALL_TOP = 1339, + AF_BLUE_STRING_GLAGOLITIC_SMALL_BOTTOM = 1371, + AF_BLUE_STRING_GOTHIC_TOP = 1403, + AF_BLUE_STRING_GOTHIC_BOTTOM = 1443, + AF_BLUE_STRING_GREEK_CAPITAL_TOP = 1463, + AF_BLUE_STRING_GREEK_CAPITAL_BOTTOM = 1484, + AF_BLUE_STRING_GREEK_SMALL_BETA_TOP = 1502, + AF_BLUE_STRING_GREEK_SMALL = 1520, + AF_BLUE_STRING_GREEK_SMALL_DESCENDER = 1544, + AF_BLUE_STRING_GUJARATI_TOP = 1568, + AF_BLUE_STRING_GUJARATI_BOTTOM = 1600, + AF_BLUE_STRING_GUJARATI_ASCENDER = 1632, + AF_BLUE_STRING_GUJARATI_DESCENDER = 1682, + AF_BLUE_STRING_GUJARATI_DIGIT_TOP = 1715, + AF_BLUE_STRING_GURMUKHI_BASE = 1735, + AF_BLUE_STRING_GURMUKHI_HEAD = 1767, + AF_BLUE_STRING_GURMUKHI_TOP = 1799, + AF_BLUE_STRING_GURMUKHI_BOTTOM = 1831, + AF_BLUE_STRING_GURMUKHI_DIGIT_TOP = 1863, + AF_BLUE_STRING_HEBREW_TOP = 1883, + AF_BLUE_STRING_HEBREW_BOTTOM = 1907, + AF_BLUE_STRING_HEBREW_DESCENDER = 1925, + AF_BLUE_STRING_KANNADA_TOP = 1940, + AF_BLUE_STRING_KANNADA_BOTTOM = 1984, + AF_BLUE_STRING_KHMER_TOP = 2016, + AF_BLUE_STRING_KHMER_SUBSCRIPT_TOP = 2040, + AF_BLUE_STRING_KHMER_BOTTOM = 2080, + AF_BLUE_STRING_KHMER_DESCENDER = 2112, + AF_BLUE_STRING_KHMER_LARGE_DESCENDER = 2146, + AF_BLUE_STRING_KHMER_SYMBOLS_WAXING_TOP = 2233, + AF_BLUE_STRING_KHMER_SYMBOLS_WANING_BOTTOM = 2241, + AF_BLUE_STRING_LAO_TOP = 2249, + AF_BLUE_STRING_LAO_BOTTOM = 2281, + AF_BLUE_STRING_LAO_ASCENDER = 2313, + AF_BLUE_STRING_LAO_LARGE_ASCENDER = 2329, + AF_BLUE_STRING_LAO_DESCENDER = 2341, + AF_BLUE_STRING_LATIN_CAPITAL_TOP = 2365, + AF_BLUE_STRING_LATIN_CAPITAL_BOTTOM = 2381, + AF_BLUE_STRING_LATIN_SMALL_F_TOP = 2397, + AF_BLUE_STRING_LATIN_SMALL_TOP = 2411, + AF_BLUE_STRING_LATIN_SMALL_BOTTOM = 2427, + AF_BLUE_STRING_LATIN_SMALL_DESCENDER = 2443, + AF_BLUE_STRING_LATIN_SUBS_CAPITAL_TOP = 2453, + AF_BLUE_STRING_LATIN_SUBS_CAPITAL_BOTTOM = 2473, + AF_BLUE_STRING_LATIN_SUBS_SMALL_F_TOP = 2493, + AF_BLUE_STRING_LATIN_SUBS_SMALL = 2513, + AF_BLUE_STRING_LATIN_SUBS_SMALL_DESCENDER = 2549, + AF_BLUE_STRING_LATIN_SUPS_CAPITAL_TOP = 2569, + AF_BLUE_STRING_LATIN_SUPS_CAPITAL_BOTTOM = 2600, + AF_BLUE_STRING_LATIN_SUPS_SMALL_F_TOP = 2629, + AF_BLUE_STRING_LATIN_SUPS_SMALL = 2655, + AF_BLUE_STRING_LATIN_SUPS_SMALL_DESCENDER = 2680, + AF_BLUE_STRING_LISU_TOP = 2691, + AF_BLUE_STRING_LISU_BOTTOM = 2723, + AF_BLUE_STRING_MALAYALAM_TOP = 2755, + AF_BLUE_STRING_MALAYALAM_BOTTOM = 2799, + AF_BLUE_STRING_MYANMAR_TOP = 2831, + AF_BLUE_STRING_MYANMAR_BOTTOM = 2863, + AF_BLUE_STRING_MYANMAR_ASCENDER = 2895, + AF_BLUE_STRING_MYANMAR_DESCENDER = 2923, + AF_BLUE_STRING_NKO_TOP = 2955, + AF_BLUE_STRING_NKO_BOTTOM = 2979, + AF_BLUE_STRING_NKO_SMALL_TOP = 2994, + AF_BLUE_STRING_NKO_SMALL_BOTTOM = 3003, + AF_BLUE_STRING_OL_CHIKI = 3015, + AF_BLUE_STRING_OLD_TURKIC_TOP = 3039, + AF_BLUE_STRING_OLD_TURKIC_BOTTOM = 3054, + AF_BLUE_STRING_OSAGE_CAPITAL_TOP = 3074, + AF_BLUE_STRING_OSAGE_CAPITAL_BOTTOM = 3114, + AF_BLUE_STRING_OSAGE_CAPITAL_DESCENDER = 3144, + AF_BLUE_STRING_OSAGE_SMALL_TOP = 3159, + AF_BLUE_STRING_OSAGE_SMALL_BOTTOM = 3199, + AF_BLUE_STRING_OSAGE_SMALL_ASCENDER = 3239, + AF_BLUE_STRING_OSAGE_SMALL_DESCENDER = 3264, + AF_BLUE_STRING_SINHALA_TOP = 3279, + AF_BLUE_STRING_SINHALA_BOTTOM = 3311, + AF_BLUE_STRING_SINHALA_DESCENDER = 3343, + AF_BLUE_STRING_TAI_VIET_TOP = 3387, + AF_BLUE_STRING_TAI_VIET_BOTTOM = 3407, + AF_BLUE_STRING_TAMIL_TOP = 3419, + AF_BLUE_STRING_TAMIL_BOTTOM = 3451, + AF_BLUE_STRING_TELUGU_TOP = 3483, + AF_BLUE_STRING_TELUGU_BOTTOM = 3511, + AF_BLUE_STRING_THAI_TOP = 3539, + AF_BLUE_STRING_THAI_BOTTOM = 3563, + AF_BLUE_STRING_THAI_ASCENDER = 3591, + AF_BLUE_STRING_THAI_LARGE_ASCENDER = 3603, + AF_BLUE_STRING_THAI_DESCENDER = 3615, + AF_BLUE_STRING_THAI_LARGE_DESCENDER = 3631, + AF_BLUE_STRING_THAI_DIGIT_TOP = 3639, + AF_BLUE_STRING_TIFINAGH = 3651, + af_blue_1_1 = 3682, #ifdef AF_CONFIG_OPTION_CJK AF_BLUE_STRING_CJK_TOP = af_blue_1_1 + 1, AF_BLUE_STRING_CJK_BOTTOM = af_blue_1_1 + 203, @@ -279,43 +281,44 @@ FT_BEGIN_HEADER AF_BLUE_STRINGSET_ADLM = 0, AF_BLUE_STRINGSET_ARAB = 5, AF_BLUE_STRINGSET_ARMN = 9, - AF_BLUE_STRINGSET_BENG = 16, - AF_BLUE_STRINGSET_CHER = 21, - AF_BLUE_STRINGSET_CPRT = 28, - AF_BLUE_STRINGSET_CYRL = 33, - AF_BLUE_STRINGSET_DEVA = 39, - AF_BLUE_STRINGSET_DSRT = 45, - AF_BLUE_STRINGSET_ETHI = 50, - AF_BLUE_STRINGSET_GEOR = 53, - AF_BLUE_STRINGSET_GEOK = 58, - AF_BLUE_STRINGSET_GLAG = 65, - AF_BLUE_STRINGSET_GOTH = 70, - AF_BLUE_STRINGSET_GREK = 73, - AF_BLUE_STRINGSET_GUJR = 80, - AF_BLUE_STRINGSET_GURU = 86, - AF_BLUE_STRINGSET_HEBR = 92, - AF_BLUE_STRINGSET_KNDA = 96, - AF_BLUE_STRINGSET_KHMR = 99, - AF_BLUE_STRINGSET_KHMS = 105, - AF_BLUE_STRINGSET_LAO = 108, - AF_BLUE_STRINGSET_LATN = 114, - AF_BLUE_STRINGSET_LATB = 121, - AF_BLUE_STRINGSET_LATP = 128, - AF_BLUE_STRINGSET_LISU = 135, - AF_BLUE_STRINGSET_MLYM = 138, - AF_BLUE_STRINGSET_MYMR = 141, - AF_BLUE_STRINGSET_NKOO = 146, - AF_BLUE_STRINGSET_NONE = 151, - AF_BLUE_STRINGSET_OLCK = 152, - AF_BLUE_STRINGSET_ORKH = 155, - AF_BLUE_STRINGSET_OSGE = 158, - AF_BLUE_STRINGSET_SINH = 166, - AF_BLUE_STRINGSET_TAML = 170, - AF_BLUE_STRINGSET_TAVT = 173, - AF_BLUE_STRINGSET_TELU = 176, - AF_BLUE_STRINGSET_THAI = 179, - AF_BLUE_STRINGSET_TFNG = 187, - af_blue_2_1 = 190, + AF_BLUE_STRINGSET_AVST = 16, + AF_BLUE_STRINGSET_BENG = 19, + AF_BLUE_STRINGSET_CHER = 24, + AF_BLUE_STRINGSET_CPRT = 31, + AF_BLUE_STRINGSET_CYRL = 36, + AF_BLUE_STRINGSET_DEVA = 42, + AF_BLUE_STRINGSET_DSRT = 48, + AF_BLUE_STRINGSET_ETHI = 53, + AF_BLUE_STRINGSET_GEOR = 56, + AF_BLUE_STRINGSET_GEOK = 61, + AF_BLUE_STRINGSET_GLAG = 68, + AF_BLUE_STRINGSET_GOTH = 73, + AF_BLUE_STRINGSET_GREK = 76, + AF_BLUE_STRINGSET_GUJR = 83, + AF_BLUE_STRINGSET_GURU = 89, + AF_BLUE_STRINGSET_HEBR = 95, + AF_BLUE_STRINGSET_KNDA = 99, + AF_BLUE_STRINGSET_KHMR = 102, + AF_BLUE_STRINGSET_KHMS = 108, + AF_BLUE_STRINGSET_LAO = 111, + AF_BLUE_STRINGSET_LATN = 117, + AF_BLUE_STRINGSET_LATB = 124, + AF_BLUE_STRINGSET_LATP = 131, + AF_BLUE_STRINGSET_LISU = 138, + AF_BLUE_STRINGSET_MLYM = 141, + AF_BLUE_STRINGSET_MYMR = 144, + AF_BLUE_STRINGSET_NKOO = 149, + AF_BLUE_STRINGSET_NONE = 154, + AF_BLUE_STRINGSET_OLCK = 155, + AF_BLUE_STRINGSET_ORKH = 158, + AF_BLUE_STRINGSET_OSGE = 161, + AF_BLUE_STRINGSET_SINH = 169, + AF_BLUE_STRINGSET_TAML = 173, + AF_BLUE_STRINGSET_TAVT = 176, + AF_BLUE_STRINGSET_TELU = 179, + AF_BLUE_STRINGSET_THAI = 182, + AF_BLUE_STRINGSET_TFNG = 190, + af_blue_2_1 = 193, #ifdef AF_CONFIG_OPTION_CJK AF_BLUE_STRINGSET_HANI = af_blue_2_1 + 0, af_blue_2_1_1 = af_blue_2_1 + 2, diff --git a/src/autofit/afranges.c b/src/autofit/afranges.c index eec8c0a50..8a74e59b2 100644 --- a/src/autofit/afranges.c +++ b/src/autofit/afranges.c @@ -119,6 +119,19 @@ }; + const AF_Script_UniRangeRec af_avst_uniranges[] = + { + AF_UNIRANGE_REC( 0x10B00, 0x10B3F ), /* Avestan */ + AF_UNIRANGE_REC( 0, 0 ) + }; + + const AF_Script_UniRangeRec af_avst_nonbase_uniranges[] = + { + AF_UNIRANGE_REC( 0x10B39, 0x10B3F ), + AF_UNIRANGE_REC( 0, 0 ) + }; + + const AF_Script_UniRangeRec af_beng_uniranges[] = { AF_UNIRANGE_REC( 0x0980, 0x09FF ), /* Bengali */ diff --git a/src/autofit/afscript.h b/src/autofit/afscript.h index 04022dd4d..63b67e6aa 100644 --- a/src/autofit/afscript.h +++ b/src/autofit/afscript.h @@ -48,6 +48,12 @@ HINTING_BOTTOM_TO_TOP, "\xD5\xBD \xD5\x8D" ) /* ս Ս */ + SCRIPT( avst, AVST, + "Avestan", + HB_SCRIPT_AVESTAN, + HINTING_BOTTOM_TO_TOP, + "\xF0\x90\xAC\x9A" ) /* 𐬚 */ + /* there are no simple forms for letters; we thus use two digit shapes */ SCRIPT( beng, BENG, "Bengali", diff --git a/src/autofit/afstyles.h b/src/autofit/afstyles.h index b205646ad..fc73f15bd 100644 --- a/src/autofit/afstyles.h +++ b/src/autofit/afstyles.h @@ -104,6 +104,13 @@ AF_BLUE_STRINGSET_ARMN, AF_COVERAGE_DEFAULT ) + STYLE( avst_dflt, AVST_DFLT, + "Avestan default style", + AF_WRITING_SYSTEM_LATIN, + AF_SCRIPT_AVST, + AF_BLUE_STRINGSET_AVST, + AF_COVERAGE_DEFAULT ) + STYLE( beng_dflt, BENG_DFLT, "Bengali default style", AF_WRITING_SYSTEM_LATIN, From 0483fb386180b7108dd6c0e61e2c0560bce4d592 Mon Sep 17 00:00:00 2001 From: Sascha Brawer Date: Wed, 3 May 2017 20:16:24 +0200 Subject: [PATCH 078/470] [autofit] Add blue-zone support for Sundanese script. This essentially moves the Sundanese script from the `Indic' hinter to the `Latin' hinter. * src/autofit/afblue.dat: Add blue zone data for Sundanese. * src/autofit/afblue.c, src/autofit/afblue.h: Regenerated. * src/autofit/afscript.h: Add Sundanese standard character and move data out of AF_CONFIG_OPTION_INDIC block. * src/autofit/afranges.c: Move Sundanese data out of AF_CONFIG_OPTION_INDIC block. * src/autofit/afstyles.h: Update Sundanese data; in particular, use AF_WRITING_SYSTEM_LATIN. --- ChangeLog | 21 +++++++++++++++++++ src/autofit/afblue.c | 10 +++++++++ src/autofit/afblue.dat | 13 ++++++++++++ src/autofit/afblue.h | 46 +++++++++++++++++++++++------------------- src/autofit/afloader.c | 2 +- src/autofit/afranges.c | 34 +++++++++++++++---------------- src/autofit/afscript.h | 13 ++++++------ src/autofit/afstyles.h | 8 +++++++- 8 files changed, 101 insertions(+), 46 deletions(-) diff --git a/ChangeLog b/ChangeLog index f1afb3ca0..311eee0a3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,24 @@ +2017-05-03 Sascha Brawer + Werner Lemberg + + [autofit] Add blue-zone support for Sundanese script. + + This essentially moves the Sundanese script from the `Indic' hinter + to the `Latin' hinter. + + * src/autofit/afblue.dat: Add blue zone data for Sundanese. + + * src/autofit/afblue.c, src/autofit/afblue.h: Regenerated. + + * src/autofit/afscript.h: Add Sundanese standard character and move + data out of AF_CONFIG_OPTION_INDIC block. + + * src/autofit/afranges.c: Move Sundanese data out of + AF_CONFIG_OPTION_INDIC block. + + * src/autofit/afstyles.h: Update Sundanese data; in particular, use + AF_WRITING_SYSTEM_LATIN. + 2017-05-03 Sascha Brawer Werner Lemberg Date: Wed, 3 May 2017 23:21:13 +0200 Subject: [PATCH 079/470] [autofit] Add support for Unified Canadian Syllabics script. * src/autofit/afblue.dat: Add blue zone data for Unified Canadian Syllabics. * src/autofit/afblue.c, src/autofit/afblue.h: Regenerated. * src/autofit/afscript.h: Add Unified Canadian Syllabics standard character. * src/autofit/afranges.c, src/autofit/afstyles.h: Add Unified Canadian Syllabics data. --- ChangeLog | 15 ++ src/autofit/afblue.c | 20 +++ src/autofit/afblue.dat | 23 +++ src/autofit/afblue.h | 337 +++++++++++++++++++++-------------------- src/autofit/afranges.c | 13 ++ src/autofit/afscript.h | 6 + src/autofit/afstyles.h | 7 + 7 files changed, 256 insertions(+), 165 deletions(-) diff --git a/ChangeLog b/ChangeLog index 311eee0a3..d04d57684 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2017-05-03 Sascha Brawer + Werner Lemberg Werner Lemberg diff --git a/src/autofit/afblue.c b/src/autofit/afblue.c index 992d6b13e..4d60bac88 100644 --- a/src/autofit/afblue.c +++ b/src/autofit/afblue.c @@ -62,6 +62,18 @@ '\0', '\xE0', '\xA6', '\x93', ' ', '\xE0', '\xA6', '\x8F', ' ', '\xE0', '\xA6', '\xA1', ' ', '\xE0', '\xA6', '\xA4', ' ', '\xE0', '\xA6', '\xA8', ' ', '\xE0', '\xA6', '\xAC', ' ', '\xE0', '\xA6', '\xB2', ' ', '\xE0', '\xA6', '\x95', /* ও এ ড ত ন ব ল ক */ '\0', + '\xE1', '\x97', '\x9C', ' ', '\xE1', '\x96', '\xB4', ' ', '\xE1', '\x90', '\x81', ' ', '\xE1', '\x92', '\xA3', ' ', '\xE1', '\x91', '\xAB', ' ', '\xE1', '\x91', '\x8E', ' ', '\xE1', '\x94', '\x91', ' ', '\xE1', '\x97', '\xB0', /* ᗜ ᖴ ᐁ ᒣ ᑫ ᑎ ᔑ ᗰ */ + '\0', + '\xE1', '\x97', '\xB6', ' ', '\xE1', '\x96', '\xB5', ' ', '\xE1', '\x92', '\xA7', ' ', '\xE1', '\x90', '\x83', ' ', '\xE1', '\x91', '\x8C', ' ', '\xE1', '\x92', '\x8D', ' ', '\xE1', '\x94', '\x91', ' ', '\xE1', '\x97', '\xA2', /* ᗶ ᖵ ᒧ ᐃ ᑌ ᒍ ᔑ ᗢ */ + '\0', + '\xE1', '\x93', '\x93', ' ', '\xE1', '\x93', '\x95', ' ', '\xE1', '\x93', '\x80', ' ', '\xE1', '\x93', '\x82', ' ', '\xE1', '\x93', '\x84', ' ', '\xE1', '\x95', '\x84', ' ', '\xE1', '\x95', '\x86', ' ', '\xE1', '\x98', '\xA3', /* ᓓ ᓕ ᓀ ᓂ ᓄ ᕄ ᕆ ᘣ */ + '\0', + '\xE1', '\x95', '\x83', ' ', '\xE1', '\x93', '\x82', ' ', '\xE1', '\x93', '\x80', ' ', '\xE1', '\x95', '\x82', ' ', '\xE1', '\x93', '\x97', ' ', '\xE1', '\x93', '\x9A', ' ', '\xE1', '\x95', '\x86', ' ', '\xE1', '\x98', '\xA3', /* ᕃ ᓂ ᓀ ᕂ ᓗ ᓚ ᕆ ᘣ */ + '\0', + '\xE1', '\x90', '\xAA', ' ', '\xE1', '\x99', '\x86', ' ', '\xE1', '\xA3', '\x98', ' ', '\xE1', '\x90', '\xA2', ' ', '\xE1', '\x92', '\xBE', ' ', '\xE1', '\xA3', '\x97', ' ', '\xE1', '\x94', '\x86', /* ᐪ ᙆ ᣘ ᐢ ᒾ ᣗ ᔆ */ + '\0', + '\xE1', '\x99', '\x86', ' ', '\xE1', '\x97', '\xAE', ' ', '\xE1', '\x92', '\xBB', ' ', '\xE1', '\x90', '\x9E', ' ', '\xE1', '\x94', '\x86', ' ', '\xE1', '\x92', '\xA1', ' ', '\xE1', '\x92', '\xA2', ' ', '\xE1', '\x93', '\x91', /* ᙆ ᗮ ᒻ ᐞ ᔆ ᒡ ᒢ ᓑ */ + '\0', '\xE1', '\x8F', '\x86', ' ', '\xE1', '\x8E', '\xBB', ' ', '\xE1', '\x8E', '\xAC', ' ', '\xE1', '\x8F', '\x83', ' ', '\xE1', '\x8E', '\xA4', ' ', '\xE1', '\x8F', '\xA3', ' ', '\xE1', '\x8E', '\xA6', ' ', '\xE1', '\x8F', '\x95', /* Ꮖ Ꮋ Ꭼ Ꮓ Ꭴ Ꮳ Ꭶ Ꮥ */ '\0', '\xEA', '\xAE', '\x92', ' ', '\xEA', '\xAE', '\xA4', ' ', '\xEA', '\xAE', '\xB6', ' ', '\xEA', '\xAD', '\xB4', ' ', '\xEA', '\xAD', '\xBE', ' ', '\xEA', '\xAE', '\x97', ' ', '\xEA', '\xAE', '\x9D', ' ', '\xEA', '\xAE', '\xBF', /* ꮒ ꮤ ꮶ ꭴ ꭾ ꮗ ꮝ ꮿ */ @@ -393,6 +405,14 @@ AF_BLUE_PROPERTY_LATIN_X_HEIGHT }, { AF_BLUE_STRING_BENGALI_BASE, 0 }, { AF_BLUE_STRING_MAX, 0 }, + { AF_BLUE_STRING_CANADIAN_SYLLABICS_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_CANADIAN_SYLLABICS_BOTTOM, 0 }, + { AF_BLUE_STRING_CANADIAN_SYLLABICS_SMALL_TOP, AF_BLUE_PROPERTY_LATIN_TOP | + AF_BLUE_PROPERTY_LATIN_X_HEIGHT }, + { AF_BLUE_STRING_CANADIAN_SYLLABICS_SMALL_BOTTOM, 0 }, + { AF_BLUE_STRING_CANADIAN_SYLLABICS_SUPS_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_CANADIAN_SYLLABICS_SUPS_BOTTOM, 0 }, + { AF_BLUE_STRING_MAX, 0 }, { AF_BLUE_STRING_CHEROKEE_CAPITAL, AF_BLUE_PROPERTY_LATIN_TOP }, { AF_BLUE_STRING_CHEROKEE_CAPITAL, 0 }, { AF_BLUE_STRING_CHEROKEE_SMALL_ASCENDER, AF_BLUE_PROPERTY_LATIN_TOP }, diff --git a/src/autofit/afblue.dat b/src/autofit/afblue.dat index 00052f7f7..07a606e81 100644 --- a/src/autofit/afblue.dat +++ b/src/autofit/afblue.dat @@ -120,6 +120,19 @@ AF_BLUE_STRING_ENUM AF_BLUE_STRINGS_ARRAY AF_BLUE_STRING_MAX_LEN: AF_BLUE_STRING_BENGALI_HEAD "ও এ ড ত ন ব ল ক" + AF_BLUE_STRING_CANADIAN_SYLLABICS_TOP + "ᗜ ᖴ ᐁ ᒣ ᑫ ᑎ ᔑ ᗰ" + AF_BLUE_STRING_CANADIAN_SYLLABICS_BOTTOM + "ᗶ ᖵ ᒧ ᐃ ᑌ ᒍ ᔑ ᗢ" + AF_BLUE_STRING_CANADIAN_SYLLABICS_SMALL_TOP + "ᓓ ᓕ ᓀ ᓂ ᓄ ᕄ ᕆ ᘣ" + AF_BLUE_STRING_CANADIAN_SYLLABICS_SMALL_BOTTOM + "ᕃ ᓂ ᓀ ᕂ ᓗ ᓚ ᕆ ᘣ" + AF_BLUE_STRING_CANADIAN_SYLLABICS_SUPS_TOP + "ᐪ ᙆ ᣘ ᐢ ᒾ ᣗ ᔆ" + AF_BLUE_STRING_CANADIAN_SYLLABICS_SUPS_BOTTOM + "ᙆ ᗮ ᒻ ᐞ ᔆ ᒡ ᒢ ᓑ" + AF_BLUE_STRING_CHEROKEE_CAPITAL "Ꮖ Ꮋ Ꭼ Ꮓ Ꭴ Ꮳ Ꭶ Ꮥ" AF_BLUE_STRING_CHEROKEE_SMALL_ASCENDER @@ -619,6 +632,16 @@ AF_BLUE_STRINGSET_ENUM AF_BLUE_STRINGSETS_ARRAY AF_BLUE_STRINGSET_MAX_LEN: { AF_BLUE_STRING_BENGALI_BASE, 0 } { AF_BLUE_STRING_MAX, 0 } + AF_BLUE_STRINGSET_CANADIAN_SYLLABICS + { AF_BLUE_STRING_CANADIAN_SYLLABICS_TOP, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_CANADIAN_SYLLABICS_BOTTOM, 0 } + { AF_BLUE_STRING_CANADIAN_SYLLABICS_SMALL_TOP, AF_BLUE_PROPERTY_LATIN_TOP | + AF_BLUE_PROPERTY_LATIN_X_HEIGHT } + { AF_BLUE_STRING_CANADIAN_SYLLABICS_SMALL_BOTTOM, 0 } + { AF_BLUE_STRING_CANADIAN_SYLLABICS_SUPS_TOP, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_CANADIAN_SYLLABICS_SUPS_BOTTOM, 0 } + { AF_BLUE_STRING_MAX, 0 } + AF_BLUE_STRINGSET_CHER { AF_BLUE_STRING_CHEROKEE_CAPITAL, AF_BLUE_PROPERTY_LATIN_TOP } { AF_BLUE_STRING_CHEROKEE_CAPITAL, 0 } diff --git a/src/autofit/afblue.h b/src/autofit/afblue.h index 13016a2cb..fe94b1387 100644 --- a/src/autofit/afblue.h +++ b/src/autofit/afblue.h @@ -95,134 +95,140 @@ FT_BEGIN_HEADER AF_BLUE_STRING_BENGALI_BASE = 312, AF_BLUE_STRING_BENGALI_TOP = 344, AF_BLUE_STRING_BENGALI_HEAD = 372, - AF_BLUE_STRING_CHEROKEE_CAPITAL = 404, - AF_BLUE_STRING_CHEROKEE_SMALL_ASCENDER = 436, - AF_BLUE_STRING_CHEROKEE_SMALL = 468, - AF_BLUE_STRING_CHEROKEE_SMALL_DESCENDER = 500, - AF_BLUE_STRING_CYPRIOT_TOP = 516, - AF_BLUE_STRING_CYPRIOT_BOTTOM = 556, - AF_BLUE_STRING_CYPRIOT_SMALL = 591, - AF_BLUE_STRING_CYRILLIC_CAPITAL_TOP = 606, - AF_BLUE_STRING_CYRILLIC_CAPITAL_BOTTOM = 630, - AF_BLUE_STRING_CYRILLIC_SMALL = 654, - AF_BLUE_STRING_CYRILLIC_SMALL_DESCENDER = 678, - AF_BLUE_STRING_DESERET_CAPITAL_TOP = 687, - AF_BLUE_STRING_DESERET_CAPITAL_BOTTOM = 712, - AF_BLUE_STRING_DESERET_SMALL_TOP = 737, - AF_BLUE_STRING_DESERET_SMALL_BOTTOM = 762, - AF_BLUE_STRING_DEVANAGARI_BASE = 787, - AF_BLUE_STRING_DEVANAGARI_TOP = 819, - AF_BLUE_STRING_DEVANAGARI_HEAD = 851, - AF_BLUE_STRING_DEVANAGARI_BOTTOM = 883, - AF_BLUE_STRING_ETHIOPIC_TOP = 891, - AF_BLUE_STRING_ETHIOPIC_BOTTOM = 923, - AF_BLUE_STRING_GEORGIAN_MKHEDRULI_TOP = 955, - AF_BLUE_STRING_GEORGIAN_MKHEDRULI_BOTTOM = 987, - AF_BLUE_STRING_GEORGIAN_MKHEDRULI_ASCENDER = 1019, - AF_BLUE_STRING_GEORGIAN_MKHEDRULI_DESCENDER = 1051, - AF_BLUE_STRING_GEORGIAN_ASOMTAVRULI_TOP = 1083, - AF_BLUE_STRING_GEORGIAN_ASOMTAVRULI_BOTTOM = 1115, - AF_BLUE_STRING_GEORGIAN_NUSKHURI_TOP = 1147, - AF_BLUE_STRING_GEORGIAN_NUSKHURI_BOTTOM = 1179, - AF_BLUE_STRING_GEORGIAN_NUSKHURI_ASCENDER = 1211, - AF_BLUE_STRING_GEORGIAN_NUSKHURI_DESCENDER = 1243, - AF_BLUE_STRING_GLAGOLITIC_CAPITAL_TOP = 1275, - AF_BLUE_STRING_GLAGOLITIC_CAPITAL_BOTTOM = 1307, - AF_BLUE_STRING_GLAGOLITIC_SMALL_TOP = 1339, - AF_BLUE_STRING_GLAGOLITIC_SMALL_BOTTOM = 1371, - AF_BLUE_STRING_GOTHIC_TOP = 1403, - AF_BLUE_STRING_GOTHIC_BOTTOM = 1443, - AF_BLUE_STRING_GREEK_CAPITAL_TOP = 1463, - AF_BLUE_STRING_GREEK_CAPITAL_BOTTOM = 1484, - AF_BLUE_STRING_GREEK_SMALL_BETA_TOP = 1502, - AF_BLUE_STRING_GREEK_SMALL = 1520, - AF_BLUE_STRING_GREEK_SMALL_DESCENDER = 1544, - AF_BLUE_STRING_GUJARATI_TOP = 1568, - AF_BLUE_STRING_GUJARATI_BOTTOM = 1600, - AF_BLUE_STRING_GUJARATI_ASCENDER = 1632, - AF_BLUE_STRING_GUJARATI_DESCENDER = 1682, - AF_BLUE_STRING_GUJARATI_DIGIT_TOP = 1715, - AF_BLUE_STRING_GURMUKHI_BASE = 1735, - AF_BLUE_STRING_GURMUKHI_HEAD = 1767, - AF_BLUE_STRING_GURMUKHI_TOP = 1799, - AF_BLUE_STRING_GURMUKHI_BOTTOM = 1831, - AF_BLUE_STRING_GURMUKHI_DIGIT_TOP = 1863, - AF_BLUE_STRING_HEBREW_TOP = 1883, - AF_BLUE_STRING_HEBREW_BOTTOM = 1907, - AF_BLUE_STRING_HEBREW_DESCENDER = 1925, - AF_BLUE_STRING_KANNADA_TOP = 1940, - AF_BLUE_STRING_KANNADA_BOTTOM = 1984, - AF_BLUE_STRING_KHMER_TOP = 2016, - AF_BLUE_STRING_KHMER_SUBSCRIPT_TOP = 2040, - AF_BLUE_STRING_KHMER_BOTTOM = 2080, - AF_BLUE_STRING_KHMER_DESCENDER = 2112, - AF_BLUE_STRING_KHMER_LARGE_DESCENDER = 2146, - AF_BLUE_STRING_KHMER_SYMBOLS_WAXING_TOP = 2233, - AF_BLUE_STRING_KHMER_SYMBOLS_WANING_BOTTOM = 2241, - AF_BLUE_STRING_LAO_TOP = 2249, - AF_BLUE_STRING_LAO_BOTTOM = 2281, - AF_BLUE_STRING_LAO_ASCENDER = 2313, - AF_BLUE_STRING_LAO_LARGE_ASCENDER = 2329, - AF_BLUE_STRING_LAO_DESCENDER = 2341, - AF_BLUE_STRING_LATIN_CAPITAL_TOP = 2365, - AF_BLUE_STRING_LATIN_CAPITAL_BOTTOM = 2381, - AF_BLUE_STRING_LATIN_SMALL_F_TOP = 2397, - AF_BLUE_STRING_LATIN_SMALL_TOP = 2411, - AF_BLUE_STRING_LATIN_SMALL_BOTTOM = 2427, - AF_BLUE_STRING_LATIN_SMALL_DESCENDER = 2443, - AF_BLUE_STRING_LATIN_SUBS_CAPITAL_TOP = 2453, - AF_BLUE_STRING_LATIN_SUBS_CAPITAL_BOTTOM = 2473, - AF_BLUE_STRING_LATIN_SUBS_SMALL_F_TOP = 2493, - AF_BLUE_STRING_LATIN_SUBS_SMALL = 2513, - AF_BLUE_STRING_LATIN_SUBS_SMALL_DESCENDER = 2549, - AF_BLUE_STRING_LATIN_SUPS_CAPITAL_TOP = 2569, - AF_BLUE_STRING_LATIN_SUPS_CAPITAL_BOTTOM = 2600, - AF_BLUE_STRING_LATIN_SUPS_SMALL_F_TOP = 2629, - AF_BLUE_STRING_LATIN_SUPS_SMALL = 2655, - AF_BLUE_STRING_LATIN_SUPS_SMALL_DESCENDER = 2680, - AF_BLUE_STRING_LISU_TOP = 2691, - AF_BLUE_STRING_LISU_BOTTOM = 2723, - AF_BLUE_STRING_MALAYALAM_TOP = 2755, - AF_BLUE_STRING_MALAYALAM_BOTTOM = 2799, - AF_BLUE_STRING_MYANMAR_TOP = 2831, - AF_BLUE_STRING_MYANMAR_BOTTOM = 2863, - AF_BLUE_STRING_MYANMAR_ASCENDER = 2895, - AF_BLUE_STRING_MYANMAR_DESCENDER = 2923, - AF_BLUE_STRING_NKO_TOP = 2955, - AF_BLUE_STRING_NKO_BOTTOM = 2979, - AF_BLUE_STRING_NKO_SMALL_TOP = 2994, - AF_BLUE_STRING_NKO_SMALL_BOTTOM = 3003, - AF_BLUE_STRING_OL_CHIKI = 3015, - AF_BLUE_STRING_OLD_TURKIC_TOP = 3039, - AF_BLUE_STRING_OLD_TURKIC_BOTTOM = 3054, - AF_BLUE_STRING_OSAGE_CAPITAL_TOP = 3074, - AF_BLUE_STRING_OSAGE_CAPITAL_BOTTOM = 3114, - AF_BLUE_STRING_OSAGE_CAPITAL_DESCENDER = 3144, - AF_BLUE_STRING_OSAGE_SMALL_TOP = 3159, - AF_BLUE_STRING_OSAGE_SMALL_BOTTOM = 3199, - AF_BLUE_STRING_OSAGE_SMALL_ASCENDER = 3239, - AF_BLUE_STRING_OSAGE_SMALL_DESCENDER = 3264, - AF_BLUE_STRING_SINHALA_TOP = 3279, - AF_BLUE_STRING_SINHALA_BOTTOM = 3311, - AF_BLUE_STRING_SINHALA_DESCENDER = 3343, - AF_BLUE_STRING_SUNDANESE_TOP = 3387, - AF_BLUE_STRING_SUNDANESE_BOTTOM = 3411, - AF_BLUE_STRING_SUNDANESE_DESCENDER = 3443, - AF_BLUE_STRING_TAI_VIET_TOP = 3451, - AF_BLUE_STRING_TAI_VIET_BOTTOM = 3471, - AF_BLUE_STRING_TAMIL_TOP = 3483, - AF_BLUE_STRING_TAMIL_BOTTOM = 3515, - AF_BLUE_STRING_TELUGU_TOP = 3547, - AF_BLUE_STRING_TELUGU_BOTTOM = 3575, - AF_BLUE_STRING_THAI_TOP = 3603, - AF_BLUE_STRING_THAI_BOTTOM = 3627, - AF_BLUE_STRING_THAI_ASCENDER = 3655, - AF_BLUE_STRING_THAI_LARGE_ASCENDER = 3667, - AF_BLUE_STRING_THAI_DESCENDER = 3679, - AF_BLUE_STRING_THAI_LARGE_DESCENDER = 3695, - AF_BLUE_STRING_THAI_DIGIT_TOP = 3703, - AF_BLUE_STRING_TIFINAGH = 3715, - af_blue_1_1 = 3746, + AF_BLUE_STRING_CANADIAN_SYLLABICS_TOP = 404, + AF_BLUE_STRING_CANADIAN_SYLLABICS_BOTTOM = 436, + AF_BLUE_STRING_CANADIAN_SYLLABICS_SMALL_TOP = 468, + AF_BLUE_STRING_CANADIAN_SYLLABICS_SMALL_BOTTOM = 500, + AF_BLUE_STRING_CANADIAN_SYLLABICS_SUPS_TOP = 532, + AF_BLUE_STRING_CANADIAN_SYLLABICS_SUPS_BOTTOM = 560, + AF_BLUE_STRING_CHEROKEE_CAPITAL = 592, + AF_BLUE_STRING_CHEROKEE_SMALL_ASCENDER = 624, + AF_BLUE_STRING_CHEROKEE_SMALL = 656, + AF_BLUE_STRING_CHEROKEE_SMALL_DESCENDER = 688, + AF_BLUE_STRING_CYPRIOT_TOP = 704, + AF_BLUE_STRING_CYPRIOT_BOTTOM = 744, + AF_BLUE_STRING_CYPRIOT_SMALL = 779, + AF_BLUE_STRING_CYRILLIC_CAPITAL_TOP = 794, + AF_BLUE_STRING_CYRILLIC_CAPITAL_BOTTOM = 818, + AF_BLUE_STRING_CYRILLIC_SMALL = 842, + AF_BLUE_STRING_CYRILLIC_SMALL_DESCENDER = 866, + AF_BLUE_STRING_DESERET_CAPITAL_TOP = 875, + AF_BLUE_STRING_DESERET_CAPITAL_BOTTOM = 900, + AF_BLUE_STRING_DESERET_SMALL_TOP = 925, + AF_BLUE_STRING_DESERET_SMALL_BOTTOM = 950, + AF_BLUE_STRING_DEVANAGARI_BASE = 975, + AF_BLUE_STRING_DEVANAGARI_TOP = 1007, + AF_BLUE_STRING_DEVANAGARI_HEAD = 1039, + AF_BLUE_STRING_DEVANAGARI_BOTTOM = 1071, + AF_BLUE_STRING_ETHIOPIC_TOP = 1079, + AF_BLUE_STRING_ETHIOPIC_BOTTOM = 1111, + AF_BLUE_STRING_GEORGIAN_MKHEDRULI_TOP = 1143, + AF_BLUE_STRING_GEORGIAN_MKHEDRULI_BOTTOM = 1175, + AF_BLUE_STRING_GEORGIAN_MKHEDRULI_ASCENDER = 1207, + AF_BLUE_STRING_GEORGIAN_MKHEDRULI_DESCENDER = 1239, + AF_BLUE_STRING_GEORGIAN_ASOMTAVRULI_TOP = 1271, + AF_BLUE_STRING_GEORGIAN_ASOMTAVRULI_BOTTOM = 1303, + AF_BLUE_STRING_GEORGIAN_NUSKHURI_TOP = 1335, + AF_BLUE_STRING_GEORGIAN_NUSKHURI_BOTTOM = 1367, + AF_BLUE_STRING_GEORGIAN_NUSKHURI_ASCENDER = 1399, + AF_BLUE_STRING_GEORGIAN_NUSKHURI_DESCENDER = 1431, + AF_BLUE_STRING_GLAGOLITIC_CAPITAL_TOP = 1463, + AF_BLUE_STRING_GLAGOLITIC_CAPITAL_BOTTOM = 1495, + AF_BLUE_STRING_GLAGOLITIC_SMALL_TOP = 1527, + AF_BLUE_STRING_GLAGOLITIC_SMALL_BOTTOM = 1559, + AF_BLUE_STRING_GOTHIC_TOP = 1591, + AF_BLUE_STRING_GOTHIC_BOTTOM = 1631, + AF_BLUE_STRING_GREEK_CAPITAL_TOP = 1651, + AF_BLUE_STRING_GREEK_CAPITAL_BOTTOM = 1672, + AF_BLUE_STRING_GREEK_SMALL_BETA_TOP = 1690, + AF_BLUE_STRING_GREEK_SMALL = 1708, + AF_BLUE_STRING_GREEK_SMALL_DESCENDER = 1732, + AF_BLUE_STRING_GUJARATI_TOP = 1756, + AF_BLUE_STRING_GUJARATI_BOTTOM = 1788, + AF_BLUE_STRING_GUJARATI_ASCENDER = 1820, + AF_BLUE_STRING_GUJARATI_DESCENDER = 1870, + AF_BLUE_STRING_GUJARATI_DIGIT_TOP = 1903, + AF_BLUE_STRING_GURMUKHI_BASE = 1923, + AF_BLUE_STRING_GURMUKHI_HEAD = 1955, + AF_BLUE_STRING_GURMUKHI_TOP = 1987, + AF_BLUE_STRING_GURMUKHI_BOTTOM = 2019, + AF_BLUE_STRING_GURMUKHI_DIGIT_TOP = 2051, + AF_BLUE_STRING_HEBREW_TOP = 2071, + AF_BLUE_STRING_HEBREW_BOTTOM = 2095, + AF_BLUE_STRING_HEBREW_DESCENDER = 2113, + AF_BLUE_STRING_KANNADA_TOP = 2128, + AF_BLUE_STRING_KANNADA_BOTTOM = 2172, + AF_BLUE_STRING_KHMER_TOP = 2204, + AF_BLUE_STRING_KHMER_SUBSCRIPT_TOP = 2228, + AF_BLUE_STRING_KHMER_BOTTOM = 2268, + AF_BLUE_STRING_KHMER_DESCENDER = 2300, + AF_BLUE_STRING_KHMER_LARGE_DESCENDER = 2334, + AF_BLUE_STRING_KHMER_SYMBOLS_WAXING_TOP = 2421, + AF_BLUE_STRING_KHMER_SYMBOLS_WANING_BOTTOM = 2429, + AF_BLUE_STRING_LAO_TOP = 2437, + AF_BLUE_STRING_LAO_BOTTOM = 2469, + AF_BLUE_STRING_LAO_ASCENDER = 2501, + AF_BLUE_STRING_LAO_LARGE_ASCENDER = 2517, + AF_BLUE_STRING_LAO_DESCENDER = 2529, + AF_BLUE_STRING_LATIN_CAPITAL_TOP = 2553, + AF_BLUE_STRING_LATIN_CAPITAL_BOTTOM = 2569, + AF_BLUE_STRING_LATIN_SMALL_F_TOP = 2585, + AF_BLUE_STRING_LATIN_SMALL_TOP = 2599, + AF_BLUE_STRING_LATIN_SMALL_BOTTOM = 2615, + AF_BLUE_STRING_LATIN_SMALL_DESCENDER = 2631, + AF_BLUE_STRING_LATIN_SUBS_CAPITAL_TOP = 2641, + AF_BLUE_STRING_LATIN_SUBS_CAPITAL_BOTTOM = 2661, + AF_BLUE_STRING_LATIN_SUBS_SMALL_F_TOP = 2681, + AF_BLUE_STRING_LATIN_SUBS_SMALL = 2701, + AF_BLUE_STRING_LATIN_SUBS_SMALL_DESCENDER = 2737, + AF_BLUE_STRING_LATIN_SUPS_CAPITAL_TOP = 2757, + AF_BLUE_STRING_LATIN_SUPS_CAPITAL_BOTTOM = 2788, + AF_BLUE_STRING_LATIN_SUPS_SMALL_F_TOP = 2817, + AF_BLUE_STRING_LATIN_SUPS_SMALL = 2843, + AF_BLUE_STRING_LATIN_SUPS_SMALL_DESCENDER = 2868, + AF_BLUE_STRING_LISU_TOP = 2879, + AF_BLUE_STRING_LISU_BOTTOM = 2911, + AF_BLUE_STRING_MALAYALAM_TOP = 2943, + AF_BLUE_STRING_MALAYALAM_BOTTOM = 2987, + AF_BLUE_STRING_MYANMAR_TOP = 3019, + AF_BLUE_STRING_MYANMAR_BOTTOM = 3051, + AF_BLUE_STRING_MYANMAR_ASCENDER = 3083, + AF_BLUE_STRING_MYANMAR_DESCENDER = 3111, + AF_BLUE_STRING_NKO_TOP = 3143, + AF_BLUE_STRING_NKO_BOTTOM = 3167, + AF_BLUE_STRING_NKO_SMALL_TOP = 3182, + AF_BLUE_STRING_NKO_SMALL_BOTTOM = 3191, + AF_BLUE_STRING_OL_CHIKI = 3203, + AF_BLUE_STRING_OLD_TURKIC_TOP = 3227, + AF_BLUE_STRING_OLD_TURKIC_BOTTOM = 3242, + AF_BLUE_STRING_OSAGE_CAPITAL_TOP = 3262, + AF_BLUE_STRING_OSAGE_CAPITAL_BOTTOM = 3302, + AF_BLUE_STRING_OSAGE_CAPITAL_DESCENDER = 3332, + AF_BLUE_STRING_OSAGE_SMALL_TOP = 3347, + AF_BLUE_STRING_OSAGE_SMALL_BOTTOM = 3387, + AF_BLUE_STRING_OSAGE_SMALL_ASCENDER = 3427, + AF_BLUE_STRING_OSAGE_SMALL_DESCENDER = 3452, + AF_BLUE_STRING_SINHALA_TOP = 3467, + AF_BLUE_STRING_SINHALA_BOTTOM = 3499, + AF_BLUE_STRING_SINHALA_DESCENDER = 3531, + AF_BLUE_STRING_SUNDANESE_TOP = 3575, + AF_BLUE_STRING_SUNDANESE_BOTTOM = 3599, + AF_BLUE_STRING_SUNDANESE_DESCENDER = 3631, + AF_BLUE_STRING_TAI_VIET_TOP = 3639, + AF_BLUE_STRING_TAI_VIET_BOTTOM = 3659, + AF_BLUE_STRING_TAMIL_TOP = 3671, + AF_BLUE_STRING_TAMIL_BOTTOM = 3703, + AF_BLUE_STRING_TELUGU_TOP = 3735, + AF_BLUE_STRING_TELUGU_BOTTOM = 3763, + AF_BLUE_STRING_THAI_TOP = 3791, + AF_BLUE_STRING_THAI_BOTTOM = 3815, + AF_BLUE_STRING_THAI_ASCENDER = 3843, + AF_BLUE_STRING_THAI_LARGE_ASCENDER = 3855, + AF_BLUE_STRING_THAI_DESCENDER = 3867, + AF_BLUE_STRING_THAI_LARGE_DESCENDER = 3883, + AF_BLUE_STRING_THAI_DIGIT_TOP = 3891, + AF_BLUE_STRING_TIFINAGH = 3903, + af_blue_1_1 = 3934, #ifdef AF_CONFIG_OPTION_CJK AF_BLUE_STRING_CJK_TOP = af_blue_1_1 + 1, AF_BLUE_STRING_CJK_BOTTOM = af_blue_1_1 + 203, @@ -286,43 +292,44 @@ FT_BEGIN_HEADER AF_BLUE_STRINGSET_ARMN = 9, AF_BLUE_STRINGSET_AVST = 16, AF_BLUE_STRINGSET_BENG = 19, - AF_BLUE_STRINGSET_CHER = 24, - AF_BLUE_STRINGSET_CPRT = 31, - AF_BLUE_STRINGSET_CYRL = 36, - AF_BLUE_STRINGSET_DEVA = 42, - AF_BLUE_STRINGSET_DSRT = 48, - AF_BLUE_STRINGSET_ETHI = 53, - AF_BLUE_STRINGSET_GEOR = 56, - AF_BLUE_STRINGSET_GEOK = 61, - AF_BLUE_STRINGSET_GLAG = 68, - AF_BLUE_STRINGSET_GOTH = 73, - AF_BLUE_STRINGSET_GREK = 76, - AF_BLUE_STRINGSET_GUJR = 83, - AF_BLUE_STRINGSET_GURU = 89, - AF_BLUE_STRINGSET_HEBR = 95, - AF_BLUE_STRINGSET_KNDA = 99, - AF_BLUE_STRINGSET_KHMR = 102, - AF_BLUE_STRINGSET_KHMS = 108, - AF_BLUE_STRINGSET_LAO = 111, - AF_BLUE_STRINGSET_LATN = 117, - AF_BLUE_STRINGSET_LATB = 124, - AF_BLUE_STRINGSET_LATP = 131, - AF_BLUE_STRINGSET_LISU = 138, - AF_BLUE_STRINGSET_MLYM = 141, - AF_BLUE_STRINGSET_MYMR = 144, - AF_BLUE_STRINGSET_NKOO = 149, - AF_BLUE_STRINGSET_NONE = 154, - AF_BLUE_STRINGSET_OLCK = 155, - AF_BLUE_STRINGSET_ORKH = 158, - AF_BLUE_STRINGSET_OSGE = 161, - AF_BLUE_STRINGSET_SINH = 169, - AF_BLUE_STRINGSET_SUND = 173, - AF_BLUE_STRINGSET_TAML = 177, - AF_BLUE_STRINGSET_TAVT = 180, - AF_BLUE_STRINGSET_TELU = 183, - AF_BLUE_STRINGSET_THAI = 186, - AF_BLUE_STRINGSET_TFNG = 194, - af_blue_2_1 = 197, + AF_BLUE_STRINGSET_CANADIAN_SYLLABICS = 24, + AF_BLUE_STRINGSET_CHER = 31, + AF_BLUE_STRINGSET_CPRT = 38, + AF_BLUE_STRINGSET_CYRL = 43, + AF_BLUE_STRINGSET_DEVA = 49, + AF_BLUE_STRINGSET_DSRT = 55, + AF_BLUE_STRINGSET_ETHI = 60, + AF_BLUE_STRINGSET_GEOR = 63, + AF_BLUE_STRINGSET_GEOK = 68, + AF_BLUE_STRINGSET_GLAG = 75, + AF_BLUE_STRINGSET_GOTH = 80, + AF_BLUE_STRINGSET_GREK = 83, + AF_BLUE_STRINGSET_GUJR = 90, + AF_BLUE_STRINGSET_GURU = 96, + AF_BLUE_STRINGSET_HEBR = 102, + AF_BLUE_STRINGSET_KNDA = 106, + AF_BLUE_STRINGSET_KHMR = 109, + AF_BLUE_STRINGSET_KHMS = 115, + AF_BLUE_STRINGSET_LAO = 118, + AF_BLUE_STRINGSET_LATN = 124, + AF_BLUE_STRINGSET_LATB = 131, + AF_BLUE_STRINGSET_LATP = 138, + AF_BLUE_STRINGSET_LISU = 145, + AF_BLUE_STRINGSET_MLYM = 148, + AF_BLUE_STRINGSET_MYMR = 151, + AF_BLUE_STRINGSET_NKOO = 156, + AF_BLUE_STRINGSET_NONE = 161, + AF_BLUE_STRINGSET_OLCK = 162, + AF_BLUE_STRINGSET_ORKH = 165, + AF_BLUE_STRINGSET_OSGE = 168, + AF_BLUE_STRINGSET_SINH = 176, + AF_BLUE_STRINGSET_SUND = 180, + AF_BLUE_STRINGSET_TAML = 184, + AF_BLUE_STRINGSET_TAVT = 187, + AF_BLUE_STRINGSET_TELU = 190, + AF_BLUE_STRINGSET_THAI = 193, + AF_BLUE_STRINGSET_TFNG = 201, + af_blue_2_1 = 204, #ifdef AF_CONFIG_OPTION_CJK AF_BLUE_STRINGSET_HANI = af_blue_2_1 + 0, af_blue_2_1_1 = af_blue_2_1 + 2, diff --git a/src/autofit/afranges.c b/src/autofit/afranges.c index 66acf825e..1ab83f5ed 100644 --- a/src/autofit/afranges.c +++ b/src/autofit/afranges.c @@ -149,6 +149,19 @@ }; + const AF_Script_UniRangeRec af_cans_uniranges[] = + { + AF_UNIRANGE_REC( 0x1400, 0x167F ), /* Unified Canadian Aboriginal Syllabics */ + AF_UNIRANGE_REC( 0x18B0, 0x18FF ), /* Unified Canadian Aboriginal Syllabics Extended */ + AF_UNIRANGE_REC( 0, 0 ) + }; + + const AF_Script_UniRangeRec af_cans_nonbase_uniranges[] = + { + AF_UNIRANGE_REC( 0, 0 ) + }; + + const AF_Script_UniRangeRec af_cher_uniranges[] = { AF_UNIRANGE_REC( 0x13A0, 0x13FF ), /* Cherokee */ diff --git a/src/autofit/afscript.h b/src/autofit/afscript.h index 239a9cf24..120725d9c 100644 --- a/src/autofit/afscript.h +++ b/src/autofit/afscript.h @@ -61,6 +61,12 @@ HINTING_TOP_TO_BOTTOM, "\xE0\xA7\xA6 \xE0\xA7\xAA" ) /* ০ ৪ */ + SCRIPT( cans, CANS, + "Canadian Syllabics", + HB_SCRIPT_CANADIAN_SYLLABICS, + HINTING_BOTTOM_TO_TOP, + "\xE1\x91\x8C \xE1\x93\x9A" ) /* ᑌ ᓚ */ + SCRIPT( cher, CHER, "Cherokee", HB_SCRIPT_CHEROKEE, diff --git a/src/autofit/afstyles.h b/src/autofit/afstyles.h index 257f46779..8c81db5de 100644 --- a/src/autofit/afstyles.h +++ b/src/autofit/afstyles.h @@ -118,6 +118,13 @@ AF_BLUE_STRINGSET_BENG, AF_COVERAGE_DEFAULT ) + STYLE( cans_dflt, CANS_DFLT, + "Canadian Syllabics default style", + AF_WRITING_SYSTEM_LATIN, + AF_SCRIPT_CANS, + AF_BLUE_STRINGSET_CANADIAN_SYLLABICS, + AF_COVERAGE_DEFAULT ) + STYLE( cher_dflt, CHER_DFLT, "Cherokee default style", AF_WRITING_SYSTEM_LATIN, From 8cd31eb7b0c0af307f5f31109685963e522718fc Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Wed, 3 May 2017 23:54:29 +0200 Subject: [PATCH 080/470] */*: s/backwards compatibility/backward compatibility/. --- ChangeLog | 8 ++- ChangeLog.21 | 4 +- ChangeLog.22 | 4 +- ChangeLog.24 | 2 +- ChangeLog.25 | 2 +- ChangeLog.26 | 20 +++--- configure | 2 +- docs/CHANGES | 10 +-- include/freetype/freetype.h | 4 +- include/freetype/fterrors.h | 2 +- include/freetype/ftsnames.h | 4 +- include/freetype/ftstroke.h | 2 +- include/freetype/ftttdrv.h | 6 +- include/freetype/internal/psaux.h | 2 +- include/freetype/internal/tttypes.h | 2 +- include/freetype/t1tables.h | 4 +- include/freetype/ttnameid.h | 2 +- include/freetype/ttunpat.h | 2 +- src/base/ftapi.c | 2 +- src/base/ftpatent.c | 2 +- src/truetype/ttgload.c | 24 +++---- src/truetype/ttinterp.c | 98 ++++++++++++++--------------- src/truetype/ttinterp.h | 12 ++-- 23 files changed, 112 insertions(+), 108 deletions(-) diff --git a/ChangeLog b/ChangeLog index d04d57684..1dcd7f962 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2017-05-03 Werner Lemberg + + */*: s/backwards compatibility/backward compatibility/. + 2017-05-03 Sascha Brawer Werner Lemberg FT_Face_GetGlyphNameFunc FT_Name_Index_Requester => FT_Face_GetGlyphNameIndexFunc - * src/base/ftapi.c: New file. It contains backwards compatibility + * src/base/ftapi.c: New file. It contains backward compatibility functions. * include/freetype/internal/psaux.h, src/cid/cidload.c, @@ -9246,7 +9246,7 @@ { } PS_StructRec, *PS_Struct; - typedef PS_StructRec T1_Struct; /* backwards-compatibility */ + typedef PS_StructRec T1_Struct; /* backward compatibility */ Hence, we increase the coherency of the source code by effectively using the `Rec' prefix for structure types. diff --git a/ChangeLog.22 b/ChangeLog.22 index 481c25ee3..e3aec745a 100644 --- a/ChangeLog.22 +++ b/ChangeLog.22 @@ -605,7 +605,7 @@ * docs/release: Minor additions and clarifications. - * docs/CHANGES: Updated to reflect many fixes for backwards + * docs/CHANGES: Updated to reflect many fixes for backward compatibility. Still incomplete. 2006-02-26 David Turner @@ -2787,7 +2787,7 @@ 2005-06-15 Kirill Smelkov The next release will be 2.2.0, so don't worry about source code - backwards compatibility. + backward compatibility. * include/freetype/ftimage.h (FT_Outline_MoveToFunc, FT_Outline_LineToFunc, FT_Outline_ConicToFunc, diff --git a/ChangeLog.24 b/ChangeLog.24 index 577ffeddf..796763cd7 100644 --- a/ChangeLog.24 +++ b/ChangeLog.24 @@ -335,7 +335,7 @@ * include/freetype/ftmoderr.h: Fix commit from 2013-03-11. - The previous version was not backwards compatible. Reported by + The previous version was not backward compatible. Reported by Behdad. 2013-03-14 Werner Lemberg diff --git a/ChangeLog.25 b/ChangeLog.25 index 60de5640f..d7fed710d 100644 --- a/ChangeLog.25 +++ b/ChangeLog.25 @@ -244,7 +244,7 @@ All public FreeType enumeration and flag values are uppercase... - * include/tttables.h (FT_Sfnt_Tag): Implement it. For backwards + * include/tttables.h (FT_Sfnt_Tag): Implement it. For backward compatibility, retain the old values as macros. * src/base/ftfstype.c (FT_Get_FSType_Flags), src/sfnt/sfdriver.c diff --git a/ChangeLog.26 b/ChangeLog.26 index 7c1126ab8..c174b6d4c 100644 --- a/ChangeLog.26 +++ b/ChangeLog.26 @@ -563,26 +563,26 @@ * src/truetype/ttinterp.c (SUBPIXEL_HINTING): Replaced by... (NO_SUBPIXEL_HINTING, SUBPIXEL_HINTING_INFINALITY, SUBPIXEL_HINTING_MINIMAL): ...new macros. - (Direct_Move, Direct_Move_X, Direct_Move_Y): Handle backwards + (Direct_Move, Direct_Move_X, Direct_Move_Y): Handle backward compatibility. Updated. (Ins_RS, Ins_FDEF, Ins_ENDF, Ins_CALL, Ins_LOOPCALL, Ins_MD): Updated. (Ins_INSTCTRL): Handle native ClearType mode flag. Updated. - (Ins_FLIPPT, Ins_FLIPRGON, Ins_FLIPRGOFF): Handle backwards + (Ins_FLIPPT, Ins_FLIPRGON, Ins_FLIPRGOFF): Handle backward compatibility. (Move_Zp2_Point): Ditto. (Ins_SHP): Updated. - (Ins_SHPIX): Handle backwards compatibility. + (Ins_SHPIX): Handle backward compatibility. Updated. (Ins_MSIRP, Ins_MDAP, Ins_MIAP, Ins_MDRP, Ins_MIRP): Updated. (Ins_ALIGNRP): Updated. - (Ins_IUP, Ins_DELTAP): Handle backwards compatibility. + (Ins_IUP, Ins_DELTAP): Handle backward compatibility. Updated. (Ins_GETINFO): Handle v38 flags. Updated. - (TT_RunIns): Handle backwards compatibility mode. + (TT_RunIns): Handle backward compatibility mode. Updated. 2016-05-17 Nikolaus Waxweiler @@ -606,16 +606,16 @@ * src/truetype/ttinterp.h (TT_ExecContextRec): Define new fields `subpixel_hinting_lean', `vertical_lcd_lean', - `backwards_compatibility', `iupx_called', iupy_called', and + `backward_compatibility', `iupx_called', iupy_called', and `grayscale_cleartype' for new hinting mode. * src/truetype/ttdriver.c (tt_property_set): Handle v38 and v40 interpreters conditionally. * src/truetype/ttgload.c (TT_Hint_Glyph): Save phantom points unless - in v38 backwards compatibility mode. + in v38 backward compatibility mode. Updated. - (compute_glyph_metrics): Add v38 backwards compatibility mode + (compute_glyph_metrics): Add v38 backward compatibility mode constraint for adjusting advance widths. Updated. (tt_loader_init): Handle new flags `subpixel_hinting_lean', @@ -1482,7 +1482,7 @@ Still handle `__FTERRORS_H__'. - We need this for backwards compatibility. + We need this for backward compatibility. Problem reported by John Emmas . @@ -4222,7 +4222,7 @@ [truetype] Support selector index 3 of the INSTCTRL instruction. - This flag activates `native ClearType hinting', disabling backwards + This flag activates `native ClearType hinting', disabling backward compatibility mode as described in Greg Hitchcocks whitepaper. In other words, it enables unrestricted functionality of all TrueType instructions in ClearType. diff --git a/configure b/configure index e4312f9cb..68dbd9919 100755 --- a/configure +++ b/configure @@ -15,7 +15,7 @@ rm -f config.mk builds/unix/unix-def.mk builds/unix/unix-cc.mk -# respect GNUMAKE environment variable for backwards compatibility +# respect GNUMAKE environment variable for backward compatibility if test "x$GNUMAKE" = x; then if test "x$MAKE" = x; then if test "x`make -v 2>/dev/null | egrep 'GNU|makepp'`" = x; then diff --git a/docs/CHANGES b/docs/CHANGES index d96be35fc..4413a3291 100644 --- a/docs/CHANGES +++ b/docs/CHANGES @@ -342,7 +342,7 @@ CHANGES BETWEEN 2.6.2 and 2.6.3 to the user. The exception to this is `__FTERRORS_H__', which must be sometimes undefined by the user to get FreeType error strings: Both this form and the new `FTERRORS_H_' macro are - accepted for backwards compatibility. + accepted for backward compatibility. - Minor improvements mainly to the Type 1 driver. @@ -583,17 +583,17 @@ CHANGES BETWEEN 2.5.5 and 2.6 compiler warnings. - Function `FT_Bitmap_New' has been renamed to `FT_Bitmap_Init', - since this name better reflects its function. For backwards + since this name better reflects its function. For backward compatibility, the old function name is still available. - Function `FT_Get_X11_Font_Format' has been renamed to `FT_Get_Font_Format', since this name better reflects its - function. For backwards compatibility, the old function name is + function. For backward compatibility, the old function name is still available. Additionally, the header file macro for this function has been renamed to `FT_FONT_FORMATS_H' (the old name `FT_XFREE86_H' is - retained for backwards compatibility). + retained for backward compatibility). - Various improvements to the `ftgrid' demo program. @@ -1027,7 +1027,7 @@ index ebcf189..3f2ce6b 100644 II. MISCELLANEOUS - The (top-level) `configure' script now respects the MAKE - environment variable to specify a `make' binary. For backwards + environment variable to specify a `make' binary. For backward compatibility, GNUMAKE still overrides MAKE, though. - The `ftview' and `ftdiff' demo programs have been redesigned, diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h index c3bc7049f..65f8fce2c 100644 --- a/include/freetype/freetype.h +++ b/include/freetype/freetype.h @@ -771,7 +771,7 @@ FT_BEGIN_HEADER FT_ENC_TAG( FT_ENCODING_WANSUNG, 'w', 'a', 'n', 's' ), FT_ENC_TAG( FT_ENCODING_JOHAB, 'j', 'o', 'h', 'a' ), - /* for backwards compatibility */ + /* for backward compatibility */ FT_ENCODING_GB2312 = FT_ENCODING_PRC, FT_ENCODING_MS_SJIS = FT_ENCODING_SJIS, FT_ENCODING_MS_GB2312 = FT_ENCODING_PRC, @@ -2037,7 +2037,7 @@ FT_BEGIN_HEADER /* `num_params' and `params' is used. They are ignored otherwise. */ /* */ /* Ideally, both the `pathname' and `params' fields should be tagged */ - /* as `const'; this is missing for API backwards compatibility. In */ + /* as `const'; this is missing for API backward compatibility. In */ /* other words, applications should treat them as read-only. */ /* */ typedef struct FT_Open_Args_ diff --git a/include/freetype/fterrors.h b/include/freetype/fterrors.h index 021989d0d..42769fa7b 100644 --- a/include/freetype/fterrors.h +++ b/include/freetype/fterrors.h @@ -106,7 +106,7 @@ /* */ /* #undefine __FTERRORS_H__ */ /* */ - /* work for backwards compatibility. */ + /* work for backward compatibility. */ /* */ #if !( defined( FTERRORS_H_ ) && defined ( __FTERRORS_H__ ) ) #define FTERRORS_H_ diff --git a/include/freetype/ftsnames.h b/include/freetype/ftsnames.h index ff888b705..a31654057 100644 --- a/include/freetype/ftsnames.h +++ b/include/freetype/ftsnames.h @@ -243,7 +243,7 @@ FT_BEGIN_HEADER * @description: * A tag for @FT_Parameter to make @FT_Open_Face ignore typographic * family names in the `name' table (introduced in OpenType version - * 1.4). Use this for backwards compatibility with legacy systems that + * 1.4). Use this for backward compatibility with legacy systems that * have a four-faces-per-family restriction. * */ @@ -264,7 +264,7 @@ FT_BEGIN_HEADER * @description: * A tag for @FT_Parameter to make @FT_Open_Face ignore typographic * subfamily names in the `name' table (introduced in OpenType version - * 1.4). Use this for backwards compatibility with legacy systems that + * 1.4). Use this for backward compatibility with legacy systems that * have a four-faces-per-family restriction. * */ diff --git a/include/freetype/ftstroke.h b/include/freetype/ftstroke.h index 8a868089c..4a20667c5 100644 --- a/include/freetype/ftstroke.h +++ b/include/freetype/ftstroke.h @@ -136,7 +136,7 @@ FT_BEGIN_HEADER * FT_STROKER_LINEJOIN_MITER_VARIABLE generates a mitered line * join as used in XPS. FT_STROKER_LINEJOIN_MITER is an alias * for FT_STROKER_LINEJOIN_MITER_VARIABLE, retained for - * backwards compatibility. + * backward compatibility. */ typedef enum FT_Stroker_LineJoin_ { diff --git a/include/freetype/ftttdrv.h b/include/freetype/ftttdrv.h index 50e1b246a..26bc5e966 100644 --- a/include/freetype/ftttdrv.h +++ b/include/freetype/ftttdrv.h @@ -110,7 +110,7 @@ FT_BEGIN_HEADER * TrueType interpreter fully allows the advance width to be adjusted in * this mode, just the DWrite client will ignore those changes. * - * _ClearType_ _Backwards_ _Compatibility_ + * _ClearType_ _Backward_ _Compatibility_ * * This is a set of exceptions made in the TrueType interpreter to * minimize hinting techniques that were problematic with the extra @@ -118,9 +118,9 @@ FT_BEGIN_HEADER * http://www.beatstamm.com/typography/RTRCh4.htm#Sec1 and * http://www.microsoft.com/typography/cleartype/truetypecleartype.aspx. * This technique is not to be confused with ClearType compatible - * widths. ClearType backwards compatibility has no direct impact on + * widths. ClearType backward compatibility has no direct impact on * changing advance widths, but there might be an indirect impact on - * disabling some deltas. This could be worked around in backwards + * disabling some deltas. This could be worked around in backward * compatibility mode. * * _Native_ _ClearType_ _Mode_ diff --git a/include/freetype/internal/psaux.h b/include/freetype/internal/psaux.h index 286d6040c..935eb1a9c 100644 --- a/include/freetype/internal/psaux.h +++ b/include/freetype/internal/psaux.h @@ -817,7 +817,7 @@ FT_BEGIN_HEADER } PSAux_ServiceRec, *PSAux_Service; - /* backwards-compatible type definition */ + /* backward compatible type definition */ typedef PSAux_ServiceRec PSAux_Interface; diff --git a/include/freetype/internal/tttypes.h b/include/freetype/internal/tttypes.h index 9a2f7c806..c0758e25f 100644 --- a/include/freetype/internal/tttypes.h +++ b/include/freetype/internal/tttypes.h @@ -1383,7 +1383,7 @@ FT_BEGIN_HEADER /* */ /* sph_compatibility_mode :: */ /* This flag is set if we are in ClearType */ - /* backwards compatibility mode (used by the */ + /* backward compatibility mode (used by the */ /* v38 implementation of the bytecode */ /* interpreter). */ /* */ diff --git a/include/freetype/t1tables.h b/include/freetype/t1tables.h index 81c903453..3f6b36e10 100644 --- a/include/freetype/t1tables.h +++ b/include/freetype/t1tables.h @@ -291,7 +291,7 @@ FT_BEGIN_HEADER } PS_DesignMapRec, *PS_DesignMap; - /* backwards-compatible definition */ + /* backward compatible definition */ typedef PS_DesignMapRec T1_DesignMap; @@ -326,7 +326,7 @@ FT_BEGIN_HEADER } PS_BlendRec, *PS_Blend; - /* backwards-compatible definition */ + /* backward compatible definition */ typedef PS_BlendRec T1_Blend; diff --git a/include/freetype/ttnameid.h b/include/freetype/ttnameid.h index 04be3f77c..494d67718 100644 --- a/include/freetype/ttnameid.h +++ b/include/freetype/ttnameid.h @@ -1216,7 +1216,7 @@ FT_BEGIN_HEADER /* */ - /* for backwards compatibility with older FreeType versions */ + /* for backward compatibility with older FreeType versions */ #define TT_UCR_ARABIC_PRESENTATION_A \ TT_UCR_ARABIC_PRESENTATION_FORMS_A #define TT_UCR_ARABIC_PRESENTATION_B \ diff --git a/include/freetype/ttunpat.h b/include/freetype/ttunpat.h index 11f6dedc4..f5e417089 100644 --- a/include/freetype/ttunpat.h +++ b/include/freetype/ttunpat.h @@ -3,7 +3,7 @@ /* ttunpat.h */ /* */ /* Definitions for the unpatented TrueType hinting system. */ -/* Obsolete, retained for backwards compatibility. */ +/* Obsolete, retained for backward compatibility. */ /* */ /* Copyright 2003-2017 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ diff --git a/src/base/ftapi.c b/src/base/ftapi.c index 1e6c718d9..4262d37e3 100644 --- a/src/base/ftapi.c +++ b/src/base/ftapi.c @@ -38,7 +38,7 @@ /*************************************************************************/ /*************************************************************************/ - /* backwards compatibility API */ + /* backward compatibility API */ FT_BASE_DEF( void ) FT_New_Memory_Stream( FT_Library library, diff --git a/src/base/ftpatent.c b/src/base/ftpatent.c index 0925a6256..9900f99bf 100644 --- a/src/base/ftpatent.c +++ b/src/base/ftpatent.c @@ -3,7 +3,7 @@ /* ftpatent.c */ /* */ /* FreeType API for checking patented TrueType bytecode instructions */ -/* (body). Obsolete, retained for backwards compatibility. */ +/* (body). Obsolete, retained for backward compatibility. */ /* */ /* Copyright 2007-2017 by */ /* David Turner. */ diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c index 9c1e109c3..b7a844a6c 100644 --- a/src/truetype/ttgload.c +++ b/src/truetype/ttgload.c @@ -163,7 +163,7 @@ /* This may not be the right place for this, but it works... */ /* Note that we have to unconditionally load the tweaks since */ /* it is possible that glyphs individually switch ClearType's */ - /* backwards compatibility mode on and off. */ + /* backward compatibility mode on and off. */ sph_set_tweaks( loader, glyph_index ); } #endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */ @@ -821,11 +821,11 @@ #endif #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL - /* Save possibly modified glyph phantom points unless in v40 backwards */ + /* Save possibly modified glyph phantom points unless in v40 backward */ /* compatibility mode, where no movement on the x axis means no reason */ /* to change bearings or advance widths. */ if ( !( driver->interpreter_version == TT_INTERPRETER_VERSION_40 && - !loader->exec->backwards_compatibility ) ) + !loader->exec->backward_compatibility ) ) { #endif loader->pp1 = zone->cur[zone->n_points - 4]; @@ -2053,18 +2053,18 @@ glyph->metrics.horiBearingY = bbox.yMax; glyph->metrics.horiAdvance = loader->pp2.x - loader->pp1.x; - /* Adjust advance width to the value contained in the hdmx table */ - /* unless FT_LOAD_COMPUTE_METRICS is set or backwards compatibility */ - /* mode of the v40 interpreter is active. See `ttinterp.h' for */ - /* details on backwards compatibility mode. */ + /* Adjust advance width to the value contained in the hdmx table */ + /* unless FT_LOAD_COMPUTE_METRICS is set or backward compatibility */ + /* mode of the v40 interpreter is active. See `ttinterp.h' for */ + /* details on backward compatibility mode. */ if ( #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL - !( driver->interpreter_version == TT_INTERPRETER_VERSION_40 && - ( loader->exec && loader->exec->backwards_compatibility ) ) && + !( driver->interpreter_version == TT_INTERPRETER_VERSION_40 && + ( loader->exec && loader->exec->backward_compatibility ) ) && #endif - !face->postscript.isFixedPitch && - IS_HINTED( loader->load_flags ) && - !( loader->load_flags & FT_LOAD_COMPUTE_METRICS ) ) + !face->postscript.isFixedPitch && + IS_HINTED( loader->load_flags ) && + !( loader->load_flags & FT_LOAD_COMPUTE_METRICS ) ) { FT_Byte* widthp; diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c index 0c51f756d..af31408cb 100644 --- a/src/truetype/ttinterp.c +++ b/src/truetype/ttinterp.c @@ -1656,7 +1656,7 @@ /* zone :: The affected glyph zone. */ /* */ /* */ - /* See `ttinterp.h' for details on backwards compatibility mode. */ + /* See `ttinterp.h' for details on backward compatibility mode. */ /* `Touches' the point. */ /* */ static void @@ -1684,7 +1684,7 @@ /* Exception to the post-IUP curfew: Allow the x component of */ /* diagonal moves, but only post-IUP. DejaVu tries to adjust */ /* diagonal stems like on `Z' and `z' post-IUP. */ - if ( SUBPIXEL_HINTING_MINIMAL && !exc->backwards_compatibility ) + if ( SUBPIXEL_HINTING_MINIMAL && !exc->backward_compatibility ) zone->cur[point].x += FT_MulDiv( distance, v, exc->F_dot_P ); else #endif @@ -1700,10 +1700,10 @@ if ( v != 0 ) { #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL - if ( !( SUBPIXEL_HINTING_MINIMAL && - exc->backwards_compatibility && - exc->iupx_called && - exc->iupy_called ) ) + if ( !( SUBPIXEL_HINTING_MINIMAL && + exc->backward_compatibility && + exc->iupx_called && + exc->iupy_called ) ) #endif zone->cur[point].y += FT_MulDiv( distance, v, exc->F_dot_P ); @@ -1756,7 +1756,7 @@ /* */ /* The following versions are used whenever both vectors are both */ /* along one of the coordinate unit vectors, i.e. in 90% of the cases. */ - /* See `ttinterp.h' for details on backwards compatibility mode. */ + /* See `ttinterp.h' for details on backward compatibility mode. */ /* */ /*************************************************************************/ @@ -1774,7 +1774,7 @@ #endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */ #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL - if ( SUBPIXEL_HINTING_MINIMAL && !exc->backwards_compatibility ) + if ( SUBPIXEL_HINTING_MINIMAL && !exc->backward_compatibility ) zone->cur[point].x += distance; else #endif @@ -1796,7 +1796,7 @@ #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL if ( !( SUBPIXEL_HINTING_MINIMAL && - exc->backwards_compatibility && + exc->backward_compatibility && exc->iupx_called && exc->iupy_called ) ) #endif zone->cur[point].y += distance; @@ -5126,11 +5126,11 @@ #endif #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL - /* Native ClearType fonts sign a waiver that turns off all backwards */ + /* Native ClearType fonts sign a waiver that turns off all backward */ /* compatibility hacks and lets them program points to the grid like */ /* it's 1996. They might sign a waiver for just one glyph, though. */ if ( SUBPIXEL_HINTING_MINIMAL ) - exc->backwards_compatibility = !FT_BOOL( L == 4 ); + exc->backward_compatibility = !FT_BOOL( L == 4 ); #endif } } @@ -5218,11 +5218,11 @@ #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL - /* See `ttinterp.h' for details on backwards compatibility mode. */ - if ( SUBPIXEL_HINTING_MINIMAL && - exc->backwards_compatibility && - exc->iupx_called && - exc->iupy_called ) + /* See `ttinterp.h' for details on backward compatibility mode. */ + if ( SUBPIXEL_HINTING_MINIMAL && + exc->backward_compatibility && + exc->iupx_called && + exc->iupy_called ) goto Fail; #endif @@ -5273,11 +5273,11 @@ #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL - /* See `ttinterp.h' for details on backwards compatibility mode. */ - if ( SUBPIXEL_HINTING_MINIMAL && - exc->backwards_compatibility && - exc->iupx_called && - exc->iupy_called ) + /* See `ttinterp.h' for details on backward compatibility mode. */ + if ( SUBPIXEL_HINTING_MINIMAL && + exc->backward_compatibility && + exc->iupx_called && + exc->iupy_called ) return; #endif @@ -5311,11 +5311,11 @@ #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL - /* See `ttinterp.h' for details on backwards compatibility mode. */ - if ( SUBPIXEL_HINTING_MINIMAL && - exc->backwards_compatibility && - exc->iupx_called && - exc->iupy_called ) + /* See `ttinterp.h' for details on backward compatibility mode. */ + if ( SUBPIXEL_HINTING_MINIMAL && + exc->backward_compatibility && + exc->iupx_called && + exc->iupy_called ) return; #endif @@ -5378,7 +5378,7 @@ } - /* See `ttinterp.h' for details on backwards compatibility mode. */ + /* See `ttinterp.h' for details on backward compatibility mode. */ static void Move_Zp2_Point( TT_ExecContext exc, FT_UShort point, @@ -5389,8 +5389,8 @@ if ( exc->GS.freeVector.x != 0 ) { #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL - if ( !( SUBPIXEL_HINTING_MINIMAL && - exc->backwards_compatibility ) ) + if ( !( SUBPIXEL_HINTING_MINIMAL && + exc->backward_compatibility ) ) #endif exc->zp2.cur[point].x += dx; @@ -5401,10 +5401,10 @@ if ( exc->GS.freeVector.y != 0 ) { #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL - if ( !( SUBPIXEL_HINTING_MINIMAL && - exc->backwards_compatibility && - exc->iupx_called && - exc->iupy_called ) ) + if ( !( SUBPIXEL_HINTING_MINIMAL && + exc->backward_compatibility && + exc->iupx_called && + exc->iupy_called ) ) #endif exc->zp2.cur[point].y += dy; @@ -5701,8 +5701,8 @@ else #endif #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL - if ( SUBPIXEL_HINTING_MINIMAL && - exc->backwards_compatibility ) + if ( SUBPIXEL_HINTING_MINIMAL && + exc->backward_compatibility ) { /* Special case: allow SHPIX to move points in the twilight zone. */ /* Otherwise, treat SHPIX the same as DELTAP. Unbreaks various */ @@ -6466,7 +6466,7 @@ R.x = FT_MulDiv( val, dax, discriminant ); R.y = FT_MulDiv( val, day, discriminant ); - /* XXX: Block in backwards_compatibility and/or post-IUP? */ + /* XXX: Block in backward_compatibility and/or post-IUP? */ exc->zp2.cur[point].x = exc->zp1.cur[a0].x + R.x; exc->zp2.cur[point].y = exc->zp1.cur[a0].y + R.y; } @@ -6474,7 +6474,7 @@ { /* else, take the middle of the middles of A and B */ - /* XXX: Block in backwards_compatibility and/or post-IUP? */ + /* XXX: Block in backward_compatibility and/or post-IUP? */ exc->zp2.cur[point].x = ( exc->zp1.cur[a0].x + exc->zp1.cur[a1].x + exc->zp0.cur[b0].x + @@ -6866,11 +6866,11 @@ #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL - /* See `ttinterp.h' for details on backwards compatibility mode. */ + /* See `ttinterp.h' for details on backward compatibility mode. */ /* Allow IUP until it has been called on both axes. Immediately */ /* return on subsequent ones. */ - if ( SUBPIXEL_HINTING_MINIMAL && - exc->backwards_compatibility ) + if ( SUBPIXEL_HINTING_MINIMAL && + exc->backward_compatibility ) { if ( exc->iupx_called && exc->iupy_called ) return; @@ -7112,10 +7112,10 @@ { #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL - /* See `ttinterp.h' for details on backwards compatibility */ - /* mode. */ - if ( SUBPIXEL_HINTING_MINIMAL && - exc->backwards_compatibility ) + /* See `ttinterp.h' for details on backward compatibility */ + /* mode. */ + if ( SUBPIXEL_HINTING_MINIMAL && + exc->backward_compatibility ) { if ( !( exc->iupx_called && exc->iupy_called ) && ( ( exc->is_composite && exc->GS.freeVector.y != 0 ) || @@ -7259,7 +7259,7 @@ { if ( exc->ignore_x_mode ) { - /* if in ClearType backwards compatibility mode, */ + /* if in ClearType backward compatibility mode, */ /* we sometimes change the TrueType version dynamically */ K = exc->rasterizer_version; FT_TRACE6(( "Setting rasterizer version %d\n", @@ -7589,15 +7589,15 @@ #endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */ #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL - /* Toggle backwards compatibility according to what font says, except */ + /* Toggle backward compatibility according to what font says, except */ /* when it's a `tricky' font that heavily relies on the interpreter to */ - /* render glyphs correctly, e.g. DFKai-SB. Backwards compatibility */ + /* render glyphs correctly, e.g. DFKai-SB. Backward compatibility */ /* hacks may break it. */ if ( SUBPIXEL_HINTING_MINIMAL && !FT_IS_TRICKY( &exc->face->root ) ) - exc->backwards_compatibility = !( exc->GS.instruct_control & 4 ); + exc->backward_compatibility = !( exc->GS.instruct_control & 4 ); else - exc->backwards_compatibility = FALSE; + exc->backward_compatibility = FALSE; exc->iupx_called = FALSE; exc->iupy_called = FALSE; diff --git a/src/truetype/ttinterp.h b/src/truetype/ttinterp.h index 6625e16c7..55e472091 100644 --- a/src/truetype/ttinterp.h +++ b/src/truetype/ttinterp.h @@ -256,7 +256,7 @@ FT_BEGIN_HEADER * Modern TrueType fonts are usually rendered through Microsoft's * collection of rendering techniques called ClearType (e.g., subpixel * rendering and subpixel hinting). When ClearType was introduced, most - * fonts were not ready. Microsoft decided to implement a backwards + * fonts were not ready. Microsoft decided to implement a backward * compatibility mode that employed several simple to complicated * assumptions and tricks that modified the interpretation of the * bytecode contained in these fonts to make them look ClearType-y @@ -316,12 +316,12 @@ FT_BEGIN_HEADER * very specific patterns (`superhinting') for pre-ClearType-displays, * the worse the results. * - * Microsoft defines a way to turn off backwards compatibility and + * Microsoft defines a way to turn off backward compatibility and * interpret instructions as before (called `native ClearType')[2][3]. * The font designer then regains full control and is responsible for * making the font work correctly with ClearType without any * hand-holding by the interpreter or rasterizer[4]. The v40 - * interpreter assumes backwards compatibility by default, which can be + * interpreter assumes backward compatibility by default, which can be * turned off the same way by executing the following in the control * program (cf. `Ins_INSTCTRL'). * @@ -331,7 +331,7 @@ FT_BEGIN_HEADER * [1] Tricky fonts as FreeType defines them rely on the bytecode * interpreter to display correctly. Hacks can interfere with them, * so they get treated like native ClearType fonts (v40 with - * backwards compatibility turned off). Cf. `TT_RunIns'. + * backward compatibility turned off). Cf. `TT_RunIns'. * * [2] Proposed by Microsoft's Greg Hitchcock in * https://www.microsoft.com/typography/cleartype/truetypecleartype.aspx @@ -357,10 +357,10 @@ FT_BEGIN_HEADER /* is managed differently. */ FT_Bool vertical_lcd_lean; - /* Default to backwards compatibility mode in v40 interpreter. If */ + /* Default to backward compatibility mode in v40 interpreter. If */ /* this is false, it implies the interpreter is in v35 or in native */ /* ClearType mode. */ - FT_Bool backwards_compatibility; + FT_Bool backward_compatibility; /* Useful for detecting and denying post-IUP trickery that is usually */ /* used to fix pixel patterns (`superhinting'). */ From f784a5653a0f5a962ee358492740718057f7fe0c Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sun, 7 May 2017 00:45:05 +0200 Subject: [PATCH 081/470] [truetype] Add tricky font `DLCHayMedium' (from Dynalab). Reported by Roy Tam . * src/truetype/ttobjs.c (tt_check_trickyness_family): Implement it. --- ChangeLog | 8 ++++++++ src/truetype/ttobjs.c | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 1dcd7f962..85d0953c7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2017-05-07 Werner Lemberg + + [truetype] Add tricky font `DLCHayMedium' (from Dynalab). + + Reported by Roy Tam . + + * src/truetype/ttobjs.c (tt_check_trickyness_family): Implement it. + 2017-05-03 Werner Lemberg */*: s/backwards compatibility/backward compatibility/. diff --git a/src/truetype/ttobjs.c b/src/truetype/ttobjs.c index d20e3da07..8fa91962c 100644 --- a/src/truetype/ttobjs.c +++ b/src/truetype/ttobjs.c @@ -147,7 +147,7 @@ { #define TRICK_NAMES_MAX_CHARACTERS 19 -#define TRICK_NAMES_COUNT 9 +#define TRICK_NAMES_COUNT 10 static const char trick_names[TRICK_NAMES_COUNT] [TRICK_NAMES_MAX_CHARACTERS + 1] = @@ -155,6 +155,7 @@ "DFKaiSho-SB", /* dfkaisb.ttf */ "DFKaiShu", "DFKai-SB", /* kaiu.ttf */ + "DLCHayMedium", /* dftt-b5.ttf */ "HuaTianKaiTi?", /* htkt2.ttf */ "HuaTianSongTi?", /* htst3.ttf */ "Ming(for ISO10646)", /* hkscsiic.ttf & iicore.ttf */ From 0ed9fef032641c30d0398d98a01b69eca1c15224 Mon Sep 17 00:00:00 2001 From: Roy Tam Date: Sun, 7 May 2017 08:32:58 +0200 Subject: [PATCH 082/470] [truetype] More tricky fonts (mainly from Dynalab). * src/truetype/ttobjs.c (tt_check_trickyness_family, tt_check_trickyness_sfnt_ids): Add them. --- ChangeLog | 8 ++++++++ src/truetype/ttobjs.c | 44 ++++++++++++++++++++++++++++++++++--------- 2 files changed, 43 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 85d0953c7..b75348a7d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2017-05-07 Roy Tam + Werner Lemberg + + [truetype] More tricky fonts (mainly from Dynalab). + + * src/truetype/ttobjs.c (tt_check_trickyness_family, + tt_check_trickyness_sfnt_ids): Add them. + 2017-05-07 Werner Lemberg [truetype] Add tricky font `DLCHayMedium' (from Dynalab). diff --git a/src/truetype/ttobjs.c b/src/truetype/ttobjs.c index 8fa91962c..cabac367c 100644 --- a/src/truetype/ttobjs.c +++ b/src/truetype/ttobjs.c @@ -147,21 +147,42 @@ { #define TRICK_NAMES_MAX_CHARACTERS 19 -#define TRICK_NAMES_COUNT 10 +#define TRICK_NAMES_COUNT 17 static const char trick_names[TRICK_NAMES_COUNT] [TRICK_NAMES_MAX_CHARACTERS + 1] = { + /* + PostScript names are given in brackets if they differ from the + family name. The version numbers, together with the copyright or + release year data, are taken from fonts available to the + developers. + + Note that later versions of the fonts might be no longer tricky; + for example, `MingLiU' version 7.00 (file `mingliu.ttc' from + Windows 7) is an ordinary TTC with non-tricky subfonts. + */ + + "cpop", /* dftt-p7.ttf; version 1.00, 1992 [DLJGyShoMedium] */ "DFKaiSho-SB", /* dfkaisb.ttf */ "DFKaiShu", - "DFKai-SB", /* kaiu.ttf */ - "DLCHayMedium", /* dftt-b5.ttf */ + "DFKai-SB", /* kaiu.ttf; version 3.00, 1998 [DFKaiShu-SB-Estd-BF] */ + "DLC", /* dftt-m7.ttf; version 1.00, 1993 [DLCMingBold] */ + /* dftt-f5.ttf; version 1.00, 1993 [DLCFongSung] */ + "DLCHayMedium", /* dftt-b5.ttf; version 1.00, 1993 */ + "DLCHayBold", /* dftt-b7.ttf; version 1.00, 1993 */ + "DLCKaiMedium", /* dftt-k5.ttf; version 1.00, 1992 */ + "DLCLiShu", /* dftt-l5.ttf; version 1.00, 1992 */ + "DLCRoundBold", /* dftt-r7.ttf; version 1.00, 1993 */ "HuaTianKaiTi?", /* htkt2.ttf */ "HuaTianSongTi?", /* htst3.ttf */ - "Ming(for ISO10646)", /* hkscsiic.ttf & iicore.ttf */ - "MingLiU", /* mingliu.ttf & mingliu.ttc */ - "PMingLiU", /* mingliu.ttc */ - "MingLi43", /* mingli.ttf */ + "Ming(for ISO10646)", /* hkscsiic.ttf; version 0.12, 2007 [Ming] */ + /* iicore.ttf; version 0.07, 2007 [Ming] */ + "MingLiU", /* mingliu.ttf */ + /* mingliu.ttc; version 3.21, 2001 */ + "MingMedium", /* dftt-m5.ttf; version 1.00, 1993 [DLCMingMedium] */ + "PMingLiU", /* mingliu.ttc; version 3.21, 2001 */ + "MingLi43", /* mingli.ttf; version 1.00, 1992 */ }; int nn; @@ -243,7 +264,7 @@ tt_check_trickyness_sfnt_ids( TT_Face face ) { #define TRICK_SFNT_IDS_PER_FACE 3 -#define TRICK_SFNT_IDS_NUM_FACES 18 +#define TRICK_SFNT_IDS_NUM_FACES 19 static const tt_sfnt_id_rec sfnt_id[TRICK_SFNT_IDS_NUM_FACES] [TRICK_SFNT_IDS_PER_FACE] = { @@ -267,7 +288,7 @@ { 0x5A30CA3BUL, 0x00009063UL }, /* fpgm */ { 0x13A42602UL, 0x0000007EUL } /* prep */ }, - { /* DFKaiShu2 */ + { /* DFKaiShu, variant */ { 0x11E5EAD4UL, 0x00000350UL }, /* cvt */ { 0xA6E78C01UL, 0x00008998UL }, /* fpgm */ { 0x13A42602UL, 0x0000007EUL } /* prep */ @@ -341,6 +362,11 @@ { 0x00000000UL, 0x00000000UL }, /* cvt */ { 0xF055FC48UL, 0x000001C2UL }, /* fpgm */ { 0x3900DED3UL, 0x00001E18UL } /* prep */ + }, + { /* MINGLI.TTF, 1992 */ + { 0x00170003UL, 0x00000060UL }, /* cvt */ + { 0xDBB4306EUL, 0x000058AAUL }, /* fpgm */ + { 0xD643482AUL, 0x00000035UL } /* prep */ } }; From ec4cb04b310e59c1121319f9575c7e1c0028cbc8 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sun, 7 May 2017 13:06:36 +0200 Subject: [PATCH 083/470] [truetype] Add tricky font `DFGirl-W6-WIN-BF' (from Dynalab). Reported by Roy Tam . * src/truetype/ttobjs.c (tt_check_trickyness_family): Implement it. --- ChangeLog | 8 ++++++++ src/truetype/ttobjs.c | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index b75348a7d..3b22af5c4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2017-05-07 Werner Lemberg + + [truetype] Add tricky font `DFGirl-W6-WIN-BF' (from Dynalab). + + Reported by Roy Tam . + + * src/truetype/ttobjs.c (tt_check_trickyness_family): Implement it. + 2017-05-07 Roy Tam Werner Lemberg diff --git a/src/truetype/ttobjs.c b/src/truetype/ttobjs.c index cabac367c..4db0f289f 100644 --- a/src/truetype/ttobjs.c +++ b/src/truetype/ttobjs.c @@ -147,7 +147,7 @@ { #define TRICK_NAMES_MAX_CHARACTERS 19 -#define TRICK_NAMES_COUNT 17 +#define TRICK_NAMES_COUNT 18 static const char trick_names[TRICK_NAMES_COUNT] [TRICK_NAMES_MAX_CHARACTERS + 1] = @@ -164,6 +164,7 @@ */ "cpop", /* dftt-p7.ttf; version 1.00, 1992 [DLJGyShoMedium] */ + "DFGirl-W6-WIN-BF", /* dftt-h6.ttf; version 1.00, 1993 */ "DFKaiSho-SB", /* dfkaisb.ttf */ "DFKaiShu", "DFKai-SB", /* kaiu.ttf; version 3.00, 1998 [DFKaiShu-SB-Estd-BF] */ From db0fe733312ff6ca0937dae59edc51242a59d664 Mon Sep 17 00:00:00 2001 From: Sascha Brawer Date: Mon, 8 May 2017 10:00:16 +0200 Subject: [PATCH 084/470] [autofit] Add support for Carian script. * src/autofit/afblue.dat: Add blue zone data for Carian. * src/autofit/afblue.c, src/autofit/afblue.h: Regenerated. * src/autofit/afscript.h: Add Carian standard character. * src/autofit/afranges.c, src/autofit/afstyles.h: Add Carian data. --- ChangeLog | 12 ++ src/autofit/afblue.c | 7 + src/autofit/afblue.dat | 10 ++ src/autofit/afblue.h | 333 +++++++++++++++++++++-------------------- src/autofit/afranges.c | 12 ++ src/autofit/afscript.h | 6 + src/autofit/afstyles.h | 7 + 7 files changed, 222 insertions(+), 165 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3b22af5c4..5de448383 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2017-05-08 Sascha Brawer + Werner Lemberg [truetype] Add tricky font `DFGirl-W6-WIN-BF' (from Dynalab). diff --git a/src/autofit/afblue.c b/src/autofit/afblue.c index 4d60bac88..7d37e8739 100644 --- a/src/autofit/afblue.c +++ b/src/autofit/afblue.c @@ -74,6 +74,10 @@ '\0', '\xE1', '\x99', '\x86', ' ', '\xE1', '\x97', '\xAE', ' ', '\xE1', '\x92', '\xBB', ' ', '\xE1', '\x90', '\x9E', ' ', '\xE1', '\x94', '\x86', ' ', '\xE1', '\x92', '\xA1', ' ', '\xE1', '\x92', '\xA2', ' ', '\xE1', '\x93', '\x91', /* ᙆ ᗮ ᒻ ᐞ ᔆ ᒡ ᒢ ᓑ */ '\0', + '\xF0', '\x90', '\x8A', '\xA7', ' ', '\xF0', '\x90', '\x8A', '\xAB', ' ', '\xF0', '\x90', '\x8A', '\xAC', ' ', '\xF0', '\x90', '\x8A', '\xAD', ' ', '\xF0', '\x90', '\x8A', '\xB1', ' ', '\xF0', '\x90', '\x8A', '\xBA', ' ', '\xF0', '\x90', '\x8A', '\xBC', ' ', '\xF0', '\x90', '\x8A', '\xBF', /* 𐊧 𐊫 𐊬 𐊭 𐊱 𐊺 𐊼 𐊿 */ + '\0', + '\xF0', '\x90', '\x8A', '\xA3', ' ', '\xF0', '\x90', '\x8A', '\xA7', ' ', '\xF0', '\x90', '\x8A', '\xB7', ' ', '\xF0', '\x90', '\x8B', '\x80', ' ', '\xF0', '\x90', '\x8A', '\xAB', ' ', '\xF0', '\x90', '\x8A', '\xB8', ' ', '\xF0', '\x90', '\x8B', '\x89', /* 𐊣 𐊧 𐊷 𐋀 𐊫 𐊸 𐋉 */ + '\0', '\xE1', '\x8F', '\x86', ' ', '\xE1', '\x8E', '\xBB', ' ', '\xE1', '\x8E', '\xAC', ' ', '\xE1', '\x8F', '\x83', ' ', '\xE1', '\x8E', '\xA4', ' ', '\xE1', '\x8F', '\xA3', ' ', '\xE1', '\x8E', '\xA6', ' ', '\xE1', '\x8F', '\x95', /* Ꮖ Ꮋ Ꭼ Ꮓ Ꭴ Ꮳ Ꭶ Ꮥ */ '\0', '\xEA', '\xAE', '\x92', ' ', '\xEA', '\xAE', '\xA4', ' ', '\xEA', '\xAE', '\xB6', ' ', '\xEA', '\xAD', '\xB4', ' ', '\xEA', '\xAD', '\xBE', ' ', '\xEA', '\xAE', '\x97', ' ', '\xEA', '\xAE', '\x9D', ' ', '\xEA', '\xAE', '\xBF', /* ꮒ ꮤ ꮶ ꭴ ꭾ ꮗ ꮝ ꮿ */ @@ -413,6 +417,9 @@ { AF_BLUE_STRING_CANADIAN_SYLLABICS_SUPS_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, { AF_BLUE_STRING_CANADIAN_SYLLABICS_SUPS_BOTTOM, 0 }, { AF_BLUE_STRING_MAX, 0 }, + { AF_BLUE_STRING_CARIAN_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_CARIAN_BOTTOM, 0 }, + { AF_BLUE_STRING_MAX, 0 }, { AF_BLUE_STRING_CHEROKEE_CAPITAL, AF_BLUE_PROPERTY_LATIN_TOP }, { AF_BLUE_STRING_CHEROKEE_CAPITAL, 0 }, { AF_BLUE_STRING_CHEROKEE_SMALL_ASCENDER, AF_BLUE_PROPERTY_LATIN_TOP }, diff --git a/src/autofit/afblue.dat b/src/autofit/afblue.dat index 07a606e81..ba7406067 100644 --- a/src/autofit/afblue.dat +++ b/src/autofit/afblue.dat @@ -133,6 +133,11 @@ AF_BLUE_STRING_ENUM AF_BLUE_STRINGS_ARRAY AF_BLUE_STRING_MAX_LEN: AF_BLUE_STRING_CANADIAN_SYLLABICS_SUPS_BOTTOM "ᙆ ᗮ ᒻ ᐞ ᔆ ᒡ ᒢ ᓑ" + AF_BLUE_STRING_CARIAN_TOP + "𐊧 𐊫 𐊬 𐊭 𐊱 𐊺 𐊼 𐊿" + AF_BLUE_STRING_CARIAN_BOTTOM + "𐊣 𐊧 𐊷 𐋀 𐊫 𐊸 𐋉" + AF_BLUE_STRING_CHEROKEE_CAPITAL "Ꮖ Ꮋ Ꭼ Ꮓ Ꭴ Ꮳ Ꭶ Ꮥ" AF_BLUE_STRING_CHEROKEE_SMALL_ASCENDER @@ -642,6 +647,11 @@ AF_BLUE_STRINGSET_ENUM AF_BLUE_STRINGSETS_ARRAY AF_BLUE_STRINGSET_MAX_LEN: { AF_BLUE_STRING_CANADIAN_SYLLABICS_SUPS_BOTTOM, 0 } { AF_BLUE_STRING_MAX, 0 } + AF_BLUE_STRINGSET_CARI + { AF_BLUE_STRING_CARIAN_TOP, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_CARIAN_BOTTOM, 0 } + { AF_BLUE_STRING_MAX, 0 } + AF_BLUE_STRINGSET_CHER { AF_BLUE_STRING_CHEROKEE_CAPITAL, AF_BLUE_PROPERTY_LATIN_TOP } { AF_BLUE_STRING_CHEROKEE_CAPITAL, 0 } diff --git a/src/autofit/afblue.h b/src/autofit/afblue.h index fe94b1387..1af0b8fd9 100644 --- a/src/autofit/afblue.h +++ b/src/autofit/afblue.h @@ -101,134 +101,136 @@ FT_BEGIN_HEADER AF_BLUE_STRING_CANADIAN_SYLLABICS_SMALL_BOTTOM = 500, AF_BLUE_STRING_CANADIAN_SYLLABICS_SUPS_TOP = 532, AF_BLUE_STRING_CANADIAN_SYLLABICS_SUPS_BOTTOM = 560, - AF_BLUE_STRING_CHEROKEE_CAPITAL = 592, - AF_BLUE_STRING_CHEROKEE_SMALL_ASCENDER = 624, - AF_BLUE_STRING_CHEROKEE_SMALL = 656, - AF_BLUE_STRING_CHEROKEE_SMALL_DESCENDER = 688, - AF_BLUE_STRING_CYPRIOT_TOP = 704, - AF_BLUE_STRING_CYPRIOT_BOTTOM = 744, - AF_BLUE_STRING_CYPRIOT_SMALL = 779, - AF_BLUE_STRING_CYRILLIC_CAPITAL_TOP = 794, - AF_BLUE_STRING_CYRILLIC_CAPITAL_BOTTOM = 818, - AF_BLUE_STRING_CYRILLIC_SMALL = 842, - AF_BLUE_STRING_CYRILLIC_SMALL_DESCENDER = 866, - AF_BLUE_STRING_DESERET_CAPITAL_TOP = 875, - AF_BLUE_STRING_DESERET_CAPITAL_BOTTOM = 900, - AF_BLUE_STRING_DESERET_SMALL_TOP = 925, - AF_BLUE_STRING_DESERET_SMALL_BOTTOM = 950, - AF_BLUE_STRING_DEVANAGARI_BASE = 975, - AF_BLUE_STRING_DEVANAGARI_TOP = 1007, - AF_BLUE_STRING_DEVANAGARI_HEAD = 1039, - AF_BLUE_STRING_DEVANAGARI_BOTTOM = 1071, - AF_BLUE_STRING_ETHIOPIC_TOP = 1079, - AF_BLUE_STRING_ETHIOPIC_BOTTOM = 1111, - AF_BLUE_STRING_GEORGIAN_MKHEDRULI_TOP = 1143, - AF_BLUE_STRING_GEORGIAN_MKHEDRULI_BOTTOM = 1175, - AF_BLUE_STRING_GEORGIAN_MKHEDRULI_ASCENDER = 1207, - AF_BLUE_STRING_GEORGIAN_MKHEDRULI_DESCENDER = 1239, - AF_BLUE_STRING_GEORGIAN_ASOMTAVRULI_TOP = 1271, - AF_BLUE_STRING_GEORGIAN_ASOMTAVRULI_BOTTOM = 1303, - AF_BLUE_STRING_GEORGIAN_NUSKHURI_TOP = 1335, - AF_BLUE_STRING_GEORGIAN_NUSKHURI_BOTTOM = 1367, - AF_BLUE_STRING_GEORGIAN_NUSKHURI_ASCENDER = 1399, - AF_BLUE_STRING_GEORGIAN_NUSKHURI_DESCENDER = 1431, - AF_BLUE_STRING_GLAGOLITIC_CAPITAL_TOP = 1463, - AF_BLUE_STRING_GLAGOLITIC_CAPITAL_BOTTOM = 1495, - AF_BLUE_STRING_GLAGOLITIC_SMALL_TOP = 1527, - AF_BLUE_STRING_GLAGOLITIC_SMALL_BOTTOM = 1559, - AF_BLUE_STRING_GOTHIC_TOP = 1591, - AF_BLUE_STRING_GOTHIC_BOTTOM = 1631, - AF_BLUE_STRING_GREEK_CAPITAL_TOP = 1651, - AF_BLUE_STRING_GREEK_CAPITAL_BOTTOM = 1672, - AF_BLUE_STRING_GREEK_SMALL_BETA_TOP = 1690, - AF_BLUE_STRING_GREEK_SMALL = 1708, - AF_BLUE_STRING_GREEK_SMALL_DESCENDER = 1732, - AF_BLUE_STRING_GUJARATI_TOP = 1756, - AF_BLUE_STRING_GUJARATI_BOTTOM = 1788, - AF_BLUE_STRING_GUJARATI_ASCENDER = 1820, - AF_BLUE_STRING_GUJARATI_DESCENDER = 1870, - AF_BLUE_STRING_GUJARATI_DIGIT_TOP = 1903, - AF_BLUE_STRING_GURMUKHI_BASE = 1923, - AF_BLUE_STRING_GURMUKHI_HEAD = 1955, - AF_BLUE_STRING_GURMUKHI_TOP = 1987, - AF_BLUE_STRING_GURMUKHI_BOTTOM = 2019, - AF_BLUE_STRING_GURMUKHI_DIGIT_TOP = 2051, - AF_BLUE_STRING_HEBREW_TOP = 2071, - AF_BLUE_STRING_HEBREW_BOTTOM = 2095, - AF_BLUE_STRING_HEBREW_DESCENDER = 2113, - AF_BLUE_STRING_KANNADA_TOP = 2128, - AF_BLUE_STRING_KANNADA_BOTTOM = 2172, - AF_BLUE_STRING_KHMER_TOP = 2204, - AF_BLUE_STRING_KHMER_SUBSCRIPT_TOP = 2228, - AF_BLUE_STRING_KHMER_BOTTOM = 2268, - AF_BLUE_STRING_KHMER_DESCENDER = 2300, - AF_BLUE_STRING_KHMER_LARGE_DESCENDER = 2334, - AF_BLUE_STRING_KHMER_SYMBOLS_WAXING_TOP = 2421, - AF_BLUE_STRING_KHMER_SYMBOLS_WANING_BOTTOM = 2429, - AF_BLUE_STRING_LAO_TOP = 2437, - AF_BLUE_STRING_LAO_BOTTOM = 2469, - AF_BLUE_STRING_LAO_ASCENDER = 2501, - AF_BLUE_STRING_LAO_LARGE_ASCENDER = 2517, - AF_BLUE_STRING_LAO_DESCENDER = 2529, - AF_BLUE_STRING_LATIN_CAPITAL_TOP = 2553, - AF_BLUE_STRING_LATIN_CAPITAL_BOTTOM = 2569, - AF_BLUE_STRING_LATIN_SMALL_F_TOP = 2585, - AF_BLUE_STRING_LATIN_SMALL_TOP = 2599, - AF_BLUE_STRING_LATIN_SMALL_BOTTOM = 2615, - AF_BLUE_STRING_LATIN_SMALL_DESCENDER = 2631, - AF_BLUE_STRING_LATIN_SUBS_CAPITAL_TOP = 2641, - AF_BLUE_STRING_LATIN_SUBS_CAPITAL_BOTTOM = 2661, - AF_BLUE_STRING_LATIN_SUBS_SMALL_F_TOP = 2681, - AF_BLUE_STRING_LATIN_SUBS_SMALL = 2701, - AF_BLUE_STRING_LATIN_SUBS_SMALL_DESCENDER = 2737, - AF_BLUE_STRING_LATIN_SUPS_CAPITAL_TOP = 2757, - AF_BLUE_STRING_LATIN_SUPS_CAPITAL_BOTTOM = 2788, - AF_BLUE_STRING_LATIN_SUPS_SMALL_F_TOP = 2817, - AF_BLUE_STRING_LATIN_SUPS_SMALL = 2843, - AF_BLUE_STRING_LATIN_SUPS_SMALL_DESCENDER = 2868, - AF_BLUE_STRING_LISU_TOP = 2879, - AF_BLUE_STRING_LISU_BOTTOM = 2911, - AF_BLUE_STRING_MALAYALAM_TOP = 2943, - AF_BLUE_STRING_MALAYALAM_BOTTOM = 2987, - AF_BLUE_STRING_MYANMAR_TOP = 3019, - AF_BLUE_STRING_MYANMAR_BOTTOM = 3051, - AF_BLUE_STRING_MYANMAR_ASCENDER = 3083, - AF_BLUE_STRING_MYANMAR_DESCENDER = 3111, - AF_BLUE_STRING_NKO_TOP = 3143, - AF_BLUE_STRING_NKO_BOTTOM = 3167, - AF_BLUE_STRING_NKO_SMALL_TOP = 3182, - AF_BLUE_STRING_NKO_SMALL_BOTTOM = 3191, - AF_BLUE_STRING_OL_CHIKI = 3203, - AF_BLUE_STRING_OLD_TURKIC_TOP = 3227, - AF_BLUE_STRING_OLD_TURKIC_BOTTOM = 3242, - AF_BLUE_STRING_OSAGE_CAPITAL_TOP = 3262, - AF_BLUE_STRING_OSAGE_CAPITAL_BOTTOM = 3302, - AF_BLUE_STRING_OSAGE_CAPITAL_DESCENDER = 3332, - AF_BLUE_STRING_OSAGE_SMALL_TOP = 3347, - AF_BLUE_STRING_OSAGE_SMALL_BOTTOM = 3387, - AF_BLUE_STRING_OSAGE_SMALL_ASCENDER = 3427, - AF_BLUE_STRING_OSAGE_SMALL_DESCENDER = 3452, - AF_BLUE_STRING_SINHALA_TOP = 3467, - AF_BLUE_STRING_SINHALA_BOTTOM = 3499, - AF_BLUE_STRING_SINHALA_DESCENDER = 3531, - AF_BLUE_STRING_SUNDANESE_TOP = 3575, - AF_BLUE_STRING_SUNDANESE_BOTTOM = 3599, - AF_BLUE_STRING_SUNDANESE_DESCENDER = 3631, - AF_BLUE_STRING_TAI_VIET_TOP = 3639, - AF_BLUE_STRING_TAI_VIET_BOTTOM = 3659, - AF_BLUE_STRING_TAMIL_TOP = 3671, - AF_BLUE_STRING_TAMIL_BOTTOM = 3703, - AF_BLUE_STRING_TELUGU_TOP = 3735, - AF_BLUE_STRING_TELUGU_BOTTOM = 3763, - AF_BLUE_STRING_THAI_TOP = 3791, - AF_BLUE_STRING_THAI_BOTTOM = 3815, - AF_BLUE_STRING_THAI_ASCENDER = 3843, - AF_BLUE_STRING_THAI_LARGE_ASCENDER = 3855, - AF_BLUE_STRING_THAI_DESCENDER = 3867, - AF_BLUE_STRING_THAI_LARGE_DESCENDER = 3883, - AF_BLUE_STRING_THAI_DIGIT_TOP = 3891, - AF_BLUE_STRING_TIFINAGH = 3903, - af_blue_1_1 = 3934, + AF_BLUE_STRING_CARIAN_TOP = 592, + AF_BLUE_STRING_CARIAN_BOTTOM = 632, + AF_BLUE_STRING_CHEROKEE_CAPITAL = 667, + AF_BLUE_STRING_CHEROKEE_SMALL_ASCENDER = 699, + AF_BLUE_STRING_CHEROKEE_SMALL = 731, + AF_BLUE_STRING_CHEROKEE_SMALL_DESCENDER = 763, + AF_BLUE_STRING_CYPRIOT_TOP = 779, + AF_BLUE_STRING_CYPRIOT_BOTTOM = 819, + AF_BLUE_STRING_CYPRIOT_SMALL = 854, + AF_BLUE_STRING_CYRILLIC_CAPITAL_TOP = 869, + AF_BLUE_STRING_CYRILLIC_CAPITAL_BOTTOM = 893, + AF_BLUE_STRING_CYRILLIC_SMALL = 917, + AF_BLUE_STRING_CYRILLIC_SMALL_DESCENDER = 941, + AF_BLUE_STRING_DESERET_CAPITAL_TOP = 950, + AF_BLUE_STRING_DESERET_CAPITAL_BOTTOM = 975, + AF_BLUE_STRING_DESERET_SMALL_TOP = 1000, + AF_BLUE_STRING_DESERET_SMALL_BOTTOM = 1025, + AF_BLUE_STRING_DEVANAGARI_BASE = 1050, + AF_BLUE_STRING_DEVANAGARI_TOP = 1082, + AF_BLUE_STRING_DEVANAGARI_HEAD = 1114, + AF_BLUE_STRING_DEVANAGARI_BOTTOM = 1146, + AF_BLUE_STRING_ETHIOPIC_TOP = 1154, + AF_BLUE_STRING_ETHIOPIC_BOTTOM = 1186, + AF_BLUE_STRING_GEORGIAN_MKHEDRULI_TOP = 1218, + AF_BLUE_STRING_GEORGIAN_MKHEDRULI_BOTTOM = 1250, + AF_BLUE_STRING_GEORGIAN_MKHEDRULI_ASCENDER = 1282, + AF_BLUE_STRING_GEORGIAN_MKHEDRULI_DESCENDER = 1314, + AF_BLUE_STRING_GEORGIAN_ASOMTAVRULI_TOP = 1346, + AF_BLUE_STRING_GEORGIAN_ASOMTAVRULI_BOTTOM = 1378, + AF_BLUE_STRING_GEORGIAN_NUSKHURI_TOP = 1410, + AF_BLUE_STRING_GEORGIAN_NUSKHURI_BOTTOM = 1442, + AF_BLUE_STRING_GEORGIAN_NUSKHURI_ASCENDER = 1474, + AF_BLUE_STRING_GEORGIAN_NUSKHURI_DESCENDER = 1506, + AF_BLUE_STRING_GLAGOLITIC_CAPITAL_TOP = 1538, + AF_BLUE_STRING_GLAGOLITIC_CAPITAL_BOTTOM = 1570, + AF_BLUE_STRING_GLAGOLITIC_SMALL_TOP = 1602, + AF_BLUE_STRING_GLAGOLITIC_SMALL_BOTTOM = 1634, + AF_BLUE_STRING_GOTHIC_TOP = 1666, + AF_BLUE_STRING_GOTHIC_BOTTOM = 1706, + AF_BLUE_STRING_GREEK_CAPITAL_TOP = 1726, + AF_BLUE_STRING_GREEK_CAPITAL_BOTTOM = 1747, + AF_BLUE_STRING_GREEK_SMALL_BETA_TOP = 1765, + AF_BLUE_STRING_GREEK_SMALL = 1783, + AF_BLUE_STRING_GREEK_SMALL_DESCENDER = 1807, + AF_BLUE_STRING_GUJARATI_TOP = 1831, + AF_BLUE_STRING_GUJARATI_BOTTOM = 1863, + AF_BLUE_STRING_GUJARATI_ASCENDER = 1895, + AF_BLUE_STRING_GUJARATI_DESCENDER = 1945, + AF_BLUE_STRING_GUJARATI_DIGIT_TOP = 1978, + AF_BLUE_STRING_GURMUKHI_BASE = 1998, + AF_BLUE_STRING_GURMUKHI_HEAD = 2030, + AF_BLUE_STRING_GURMUKHI_TOP = 2062, + AF_BLUE_STRING_GURMUKHI_BOTTOM = 2094, + AF_BLUE_STRING_GURMUKHI_DIGIT_TOP = 2126, + AF_BLUE_STRING_HEBREW_TOP = 2146, + AF_BLUE_STRING_HEBREW_BOTTOM = 2170, + AF_BLUE_STRING_HEBREW_DESCENDER = 2188, + AF_BLUE_STRING_KANNADA_TOP = 2203, + AF_BLUE_STRING_KANNADA_BOTTOM = 2247, + AF_BLUE_STRING_KHMER_TOP = 2279, + AF_BLUE_STRING_KHMER_SUBSCRIPT_TOP = 2303, + AF_BLUE_STRING_KHMER_BOTTOM = 2343, + AF_BLUE_STRING_KHMER_DESCENDER = 2375, + AF_BLUE_STRING_KHMER_LARGE_DESCENDER = 2409, + AF_BLUE_STRING_KHMER_SYMBOLS_WAXING_TOP = 2496, + AF_BLUE_STRING_KHMER_SYMBOLS_WANING_BOTTOM = 2504, + AF_BLUE_STRING_LAO_TOP = 2512, + AF_BLUE_STRING_LAO_BOTTOM = 2544, + AF_BLUE_STRING_LAO_ASCENDER = 2576, + AF_BLUE_STRING_LAO_LARGE_ASCENDER = 2592, + AF_BLUE_STRING_LAO_DESCENDER = 2604, + AF_BLUE_STRING_LATIN_CAPITAL_TOP = 2628, + AF_BLUE_STRING_LATIN_CAPITAL_BOTTOM = 2644, + AF_BLUE_STRING_LATIN_SMALL_F_TOP = 2660, + AF_BLUE_STRING_LATIN_SMALL_TOP = 2674, + AF_BLUE_STRING_LATIN_SMALL_BOTTOM = 2690, + AF_BLUE_STRING_LATIN_SMALL_DESCENDER = 2706, + AF_BLUE_STRING_LATIN_SUBS_CAPITAL_TOP = 2716, + AF_BLUE_STRING_LATIN_SUBS_CAPITAL_BOTTOM = 2736, + AF_BLUE_STRING_LATIN_SUBS_SMALL_F_TOP = 2756, + AF_BLUE_STRING_LATIN_SUBS_SMALL = 2776, + AF_BLUE_STRING_LATIN_SUBS_SMALL_DESCENDER = 2812, + AF_BLUE_STRING_LATIN_SUPS_CAPITAL_TOP = 2832, + AF_BLUE_STRING_LATIN_SUPS_CAPITAL_BOTTOM = 2863, + AF_BLUE_STRING_LATIN_SUPS_SMALL_F_TOP = 2892, + AF_BLUE_STRING_LATIN_SUPS_SMALL = 2918, + AF_BLUE_STRING_LATIN_SUPS_SMALL_DESCENDER = 2943, + AF_BLUE_STRING_LISU_TOP = 2954, + AF_BLUE_STRING_LISU_BOTTOM = 2986, + AF_BLUE_STRING_MALAYALAM_TOP = 3018, + AF_BLUE_STRING_MALAYALAM_BOTTOM = 3062, + AF_BLUE_STRING_MYANMAR_TOP = 3094, + AF_BLUE_STRING_MYANMAR_BOTTOM = 3126, + AF_BLUE_STRING_MYANMAR_ASCENDER = 3158, + AF_BLUE_STRING_MYANMAR_DESCENDER = 3186, + AF_BLUE_STRING_NKO_TOP = 3218, + AF_BLUE_STRING_NKO_BOTTOM = 3242, + AF_BLUE_STRING_NKO_SMALL_TOP = 3257, + AF_BLUE_STRING_NKO_SMALL_BOTTOM = 3266, + AF_BLUE_STRING_OL_CHIKI = 3278, + AF_BLUE_STRING_OLD_TURKIC_TOP = 3302, + AF_BLUE_STRING_OLD_TURKIC_BOTTOM = 3317, + AF_BLUE_STRING_OSAGE_CAPITAL_TOP = 3337, + AF_BLUE_STRING_OSAGE_CAPITAL_BOTTOM = 3377, + AF_BLUE_STRING_OSAGE_CAPITAL_DESCENDER = 3407, + AF_BLUE_STRING_OSAGE_SMALL_TOP = 3422, + AF_BLUE_STRING_OSAGE_SMALL_BOTTOM = 3462, + AF_BLUE_STRING_OSAGE_SMALL_ASCENDER = 3502, + AF_BLUE_STRING_OSAGE_SMALL_DESCENDER = 3527, + AF_BLUE_STRING_SINHALA_TOP = 3542, + AF_BLUE_STRING_SINHALA_BOTTOM = 3574, + AF_BLUE_STRING_SINHALA_DESCENDER = 3606, + AF_BLUE_STRING_SUNDANESE_TOP = 3650, + AF_BLUE_STRING_SUNDANESE_BOTTOM = 3674, + AF_BLUE_STRING_SUNDANESE_DESCENDER = 3706, + AF_BLUE_STRING_TAI_VIET_TOP = 3714, + AF_BLUE_STRING_TAI_VIET_BOTTOM = 3734, + AF_BLUE_STRING_TAMIL_TOP = 3746, + AF_BLUE_STRING_TAMIL_BOTTOM = 3778, + AF_BLUE_STRING_TELUGU_TOP = 3810, + AF_BLUE_STRING_TELUGU_BOTTOM = 3838, + AF_BLUE_STRING_THAI_TOP = 3866, + AF_BLUE_STRING_THAI_BOTTOM = 3890, + AF_BLUE_STRING_THAI_ASCENDER = 3918, + AF_BLUE_STRING_THAI_LARGE_ASCENDER = 3930, + AF_BLUE_STRING_THAI_DESCENDER = 3942, + AF_BLUE_STRING_THAI_LARGE_DESCENDER = 3958, + AF_BLUE_STRING_THAI_DIGIT_TOP = 3966, + AF_BLUE_STRING_TIFINAGH = 3978, + af_blue_1_1 = 4009, #ifdef AF_CONFIG_OPTION_CJK AF_BLUE_STRING_CJK_TOP = af_blue_1_1 + 1, AF_BLUE_STRING_CJK_BOTTOM = af_blue_1_1 + 203, @@ -293,43 +295,44 @@ FT_BEGIN_HEADER AF_BLUE_STRINGSET_AVST = 16, AF_BLUE_STRINGSET_BENG = 19, AF_BLUE_STRINGSET_CANADIAN_SYLLABICS = 24, - AF_BLUE_STRINGSET_CHER = 31, - AF_BLUE_STRINGSET_CPRT = 38, - AF_BLUE_STRINGSET_CYRL = 43, - AF_BLUE_STRINGSET_DEVA = 49, - AF_BLUE_STRINGSET_DSRT = 55, - AF_BLUE_STRINGSET_ETHI = 60, - AF_BLUE_STRINGSET_GEOR = 63, - AF_BLUE_STRINGSET_GEOK = 68, - AF_BLUE_STRINGSET_GLAG = 75, - AF_BLUE_STRINGSET_GOTH = 80, - AF_BLUE_STRINGSET_GREK = 83, - AF_BLUE_STRINGSET_GUJR = 90, - AF_BLUE_STRINGSET_GURU = 96, - AF_BLUE_STRINGSET_HEBR = 102, - AF_BLUE_STRINGSET_KNDA = 106, - AF_BLUE_STRINGSET_KHMR = 109, - AF_BLUE_STRINGSET_KHMS = 115, - AF_BLUE_STRINGSET_LAO = 118, - AF_BLUE_STRINGSET_LATN = 124, - AF_BLUE_STRINGSET_LATB = 131, - AF_BLUE_STRINGSET_LATP = 138, - AF_BLUE_STRINGSET_LISU = 145, - AF_BLUE_STRINGSET_MLYM = 148, - AF_BLUE_STRINGSET_MYMR = 151, - AF_BLUE_STRINGSET_NKOO = 156, - AF_BLUE_STRINGSET_NONE = 161, - AF_BLUE_STRINGSET_OLCK = 162, - AF_BLUE_STRINGSET_ORKH = 165, - AF_BLUE_STRINGSET_OSGE = 168, - AF_BLUE_STRINGSET_SINH = 176, - AF_BLUE_STRINGSET_SUND = 180, - AF_BLUE_STRINGSET_TAML = 184, - AF_BLUE_STRINGSET_TAVT = 187, - AF_BLUE_STRINGSET_TELU = 190, - AF_BLUE_STRINGSET_THAI = 193, - AF_BLUE_STRINGSET_TFNG = 201, - af_blue_2_1 = 204, + AF_BLUE_STRINGSET_CARI = 31, + AF_BLUE_STRINGSET_CHER = 34, + AF_BLUE_STRINGSET_CPRT = 41, + AF_BLUE_STRINGSET_CYRL = 46, + AF_BLUE_STRINGSET_DEVA = 52, + AF_BLUE_STRINGSET_DSRT = 58, + AF_BLUE_STRINGSET_ETHI = 63, + AF_BLUE_STRINGSET_GEOR = 66, + AF_BLUE_STRINGSET_GEOK = 71, + AF_BLUE_STRINGSET_GLAG = 78, + AF_BLUE_STRINGSET_GOTH = 83, + AF_BLUE_STRINGSET_GREK = 86, + AF_BLUE_STRINGSET_GUJR = 93, + AF_BLUE_STRINGSET_GURU = 99, + AF_BLUE_STRINGSET_HEBR = 105, + AF_BLUE_STRINGSET_KNDA = 109, + AF_BLUE_STRINGSET_KHMR = 112, + AF_BLUE_STRINGSET_KHMS = 118, + AF_BLUE_STRINGSET_LAO = 121, + AF_BLUE_STRINGSET_LATN = 127, + AF_BLUE_STRINGSET_LATB = 134, + AF_BLUE_STRINGSET_LATP = 141, + AF_BLUE_STRINGSET_LISU = 148, + AF_BLUE_STRINGSET_MLYM = 151, + AF_BLUE_STRINGSET_MYMR = 154, + AF_BLUE_STRINGSET_NKOO = 159, + AF_BLUE_STRINGSET_NONE = 164, + AF_BLUE_STRINGSET_OLCK = 165, + AF_BLUE_STRINGSET_ORKH = 168, + AF_BLUE_STRINGSET_OSGE = 171, + AF_BLUE_STRINGSET_SINH = 179, + AF_BLUE_STRINGSET_SUND = 183, + AF_BLUE_STRINGSET_TAML = 187, + AF_BLUE_STRINGSET_TAVT = 190, + AF_BLUE_STRINGSET_TELU = 193, + AF_BLUE_STRINGSET_THAI = 196, + AF_BLUE_STRINGSET_TFNG = 204, + af_blue_2_1 = 207, #ifdef AF_CONFIG_OPTION_CJK AF_BLUE_STRINGSET_HANI = af_blue_2_1 + 0, af_blue_2_1_1 = af_blue_2_1 + 2, diff --git a/src/autofit/afranges.c b/src/autofit/afranges.c index 1ab83f5ed..bfa32da14 100644 --- a/src/autofit/afranges.c +++ b/src/autofit/afranges.c @@ -162,6 +162,18 @@ }; + const AF_Script_UniRangeRec af_cari_uniranges[] = + { + AF_UNIRANGE_REC( 0x102A0, 0x102DF ), /* Carian */ + AF_UNIRANGE_REC( 0, 0 ) + }; + + const AF_Script_UniRangeRec af_cari_nonbase_uniranges[] = + { + AF_UNIRANGE_REC( 0, 0 ) + }; + + const AF_Script_UniRangeRec af_cher_uniranges[] = { AF_UNIRANGE_REC( 0x13A0, 0x13FF ), /* Cherokee */ diff --git a/src/autofit/afscript.h b/src/autofit/afscript.h index 120725d9c..8937494bb 100644 --- a/src/autofit/afscript.h +++ b/src/autofit/afscript.h @@ -67,6 +67,12 @@ HINTING_BOTTOM_TO_TOP, "\xE1\x91\x8C \xE1\x93\x9A" ) /* ᑌ ᓚ */ + SCRIPT( cari, CARI, + "Carian", + HB_SCRIPT_CARIAN, + HINTING_BOTTOM_TO_TOP, + "\xF0\x90\x8A\xAB \xF0\x90\x8B\x89" ) /* 𐊫 𐋉 */ + SCRIPT( cher, CHER, "Cherokee", HB_SCRIPT_CHEROKEE, diff --git a/src/autofit/afstyles.h b/src/autofit/afstyles.h index 8c81db5de..0671b97fe 100644 --- a/src/autofit/afstyles.h +++ b/src/autofit/afstyles.h @@ -125,6 +125,13 @@ AF_BLUE_STRINGSET_CANADIAN_SYLLABICS, AF_COVERAGE_DEFAULT ) + STYLE( cari_dflt, CARI_DFLT, + "Carian default style", + AF_WRITING_SYSTEM_LATIN, + AF_SCRIPT_CARI, + AF_BLUE_STRINGSET_CARI, + AF_COVERAGE_DEFAULT ) + STYLE( cher_dflt, CHER_DFLT, "Cherokee default style", AF_WRITING_SYSTEM_LATIN, From f27ebb1ec45f57c3b79a7bb9c92bb7b05c78ec63 Mon Sep 17 00:00:00 2001 From: Sascha Brawer Date: Mon, 8 May 2017 10:22:26 +0200 Subject: [PATCH 085/470] [autofit] Add support for Coptic script. * src/autofit/afblue.dat: Add blue zone data for Coptic. * src/autofit/afblue.c, src/autofit/afblue.h: Regenerated. * src/autofit/afscript.h: Add Coptic standard character. * src/autofit/afranges.c, src/autofit/afstyles.h: Add Coptic data. --- ChangeLog | 12 ++ src/autofit/afblue.c | 14 ++ src/autofit/afblue.dat | 17 +++ src/autofit/afblue.h | 325 +++++++++++++++++++++-------------------- src/autofit/afranges.c | 13 ++ src/autofit/afscript.h | 6 + src/autofit/afstyles.h | 7 + 7 files changed, 234 insertions(+), 160 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5de448383..e2bf18f6b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2017-05-08 Sascha Brawer + Werner Lemberg Werner Lemberg Date: Mon, 8 May 2017 15:08:46 +0200 Subject: [PATCH 086/470] [autofit] Add support for Osmanya script. * src/autofit/afblue.dat: Add blue zone data for Osmanya. * src/autofit/afblue.c, src/autofit/afblue.h: Regenerated. * src/autofit/afscript.h: Add Osmanya standard character. * src/autofit/afranges.c, src/autofit/afstyles.h: Add Osmanya data. --- ChangeLog | 12 +++++++++ src/autofit/afblue.c | 7 +++++ src/autofit/afblue.dat | 10 +++++++ src/autofit/afblue.h | 61 ++++++++++++++++++++++-------------------- src/autofit/afranges.c | 12 +++++++++ src/autofit/afscript.h | 10 +++++-- src/autofit/afstyles.h | 7 +++++ 7 files changed, 88 insertions(+), 31 deletions(-) diff --git a/ChangeLog b/ChangeLog index e2bf18f6b..e3a61c8f2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2017-05-08 Sascha Brawer + Werner Lemberg Werner Lemberg Date: Mon, 8 May 2017 19:57:16 +0200 Subject: [PATCH 087/470] [autofit] Add support for Vai script. * src/autofit/afblue.dat: Add blue zone data for Vai. * src/autofit/afblue.c, src/autofit/afblue.h: Regenerated. * src/autofit/afscript.h: Add Vai standard character. * src/autofit/afranges.c, src/autofit/afstyles.h: Add Vai data. --- ChangeLog | 12 ++++++++++++ src/autofit/afblue.c | 7 +++++++ src/autofit/afblue.dat | 9 +++++++++ src/autofit/afblue.h | 7 +++++-- src/autofit/afranges.c | 12 ++++++++++++ src/autofit/afscript.h | 6 ++++++ src/autofit/afstyles.h | 7 +++++++ 7 files changed, 58 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index e3a61c8f2..152e8cfa1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2017-05-08 Sascha Brawer + Werner Lemberg Werner Lemberg Date: Mon, 8 May 2017 20:31:52 +0200 Subject: [PATCH 088/470] [autofit] Add support for Shavian script. * src/autofit/afblue.dat: Add blue zone data for Shavian. * src/autofit/afblue.c, src/autofit/afblue.h: Regenerated. * src/autofit/afscript.h: Add Shavian standard character. * src/autofit/afranges.c, src/autofit/afstyles.h: Add Shavian data. --- ChangeLog | 12 ++++++++ src/autofit/afblue.c | 17 ++++++++++ src/autofit/afblue.dat | 20 ++++++++++++ src/autofit/afblue.h | 70 +++++++++++++++++++++++------------------- src/autofit/afranges.c | 12 ++++++++ src/autofit/afscript.h | 6 ++++ src/autofit/afstyles.h | 7 +++++ 7 files changed, 112 insertions(+), 32 deletions(-) diff --git a/ChangeLog b/ChangeLog index 152e8cfa1..79176c60b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2017-05-08 Sascha Brawer + Werner Lemberg Werner Lemberg Date: Wed, 10 May 2017 09:13:20 +0200 Subject: [PATCH 089/470] [autofit] Add support for Buhid script. * src/autofit/afblue.dat: Add blue zone data for Buhid. * src/autofit/afblue.c, src/autofit/afblue.h: Regenerated. * src/autofit/afscript.h: Add Buhid standard character. * src/autofit/afranges.c, src/autofit/afstyles.h: Add Buhid data. --- ChangeLog | 12 ++ src/autofit/afblue.c | 14 ++ src/autofit/afblue.dat | 17 ++ src/autofit/afblue.h | 389 +++++++++++++++++++++-------------------- src/autofit/afranges.c | 13 ++ src/autofit/afscript.h | 6 + src/autofit/afstyles.h | 7 + 7 files changed, 266 insertions(+), 192 deletions(-) diff --git a/ChangeLog b/ChangeLog index 79176c60b..e2cb901a1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2017-05-10 Sascha Brawer + Werner Lemberg Werner Lemberg Date: Wed, 10 May 2017 09:36:13 +0200 Subject: [PATCH 090/470] [autofit] Add support for Saurashtra script. * src/autofit/afblue.dat: Add blue zone data for Saurashtra. * src/autofit/afblue.c, src/autofit/afblue.h: Regenerated. * src/autofit/afscript.h: Add Saurashtra standard character. * src/autofit/afranges.c, src/autofit/afstyles.h: Add Saurashtra data. --- ChangeLog | 13 +++++++ src/autofit/afblue.c | 7 ++++ src/autofit/afblue.dat | 10 ++++++ src/autofit/afblue.h | 79 ++++++++++++++++++++++-------------------- src/autofit/afranges.c | 14 ++++++++ src/autofit/afscript.h | 6 ++++ src/autofit/afstyles.h | 7 ++++ 7 files changed, 98 insertions(+), 38 deletions(-) diff --git a/ChangeLog b/ChangeLog index e2cb901a1..1352ca0f2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2017-05-10 Sascha Brawer + Werner Lemberg Werner Lemberg Date: Wed, 10 May 2017 12:39:33 +0200 Subject: [PATCH 091/470] [autofit] Add support for Bamum script. * src/autofit/afblue.dat: Add blue zone data for Bamum. * src/autofit/afblue.c, src/autofit/afblue.h: Regenerated. * src/autofit/afscript.h: Add Bamum standard character. * src/autofit/afranges.c, src/autofit/afstyles.h: Add Bamum data. --- ChangeLog | 12 ++ src/autofit/afblue.c | 7 + src/autofit/afblue.dat | 10 + src/autofit/afblue.h | 411 +++++++++++++++++++++-------------------- src/autofit/afranges.c | 18 ++ src/autofit/afscript.h | 6 + src/autofit/afstyles.h | 7 + 7 files changed, 267 insertions(+), 204 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1352ca0f2..29c7d4722 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2017-05-10 Sascha Brawer + Werner Lemberg Werner Lemberg Date: Wed, 10 May 2017 23:38:05 +0200 Subject: [PATCH 092/470] [autofit] Add support for Kayah Li script. * src/autofit/afblue.dat: Add blue zone data for Kayah Li. * src/autofit/afblue.c, src/autofit/afblue.h: Regenerated. * src/autofit/afscript.h: Add Kayah Li standard character. * src/autofit/afranges.c, src/autofit/afstyles.h: Add Kayah Li data. --- ChangeLog | 12 +++ src/autofit/afblue.c | 17 ++++ src/autofit/afblue.dat | 20 ++++ src/autofit/afblue.h | 224 +++++++++++++++++++++-------------------- src/autofit/afranges.c | 13 +++ src/autofit/afscript.h | 6 ++ src/autofit/afstyles.h | 7 ++ 7 files changed, 190 insertions(+), 109 deletions(-) diff --git a/ChangeLog b/ChangeLog index 29c7d4722..14efeef14 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2017-05-10 Sascha Brawer + Werner Lemberg Werner Lemberg Date: Thu, 11 May 2017 00:06:37 +0200 Subject: [PATCH 093/470] [autofit] Add support for Chakma script. * src/autofit/afblue.dat: Add blue zone data for Chakma. * src/autofit/afblue.c, src/autofit/afblue.h: Regenerated. * src/autofit/afscript.h: Add Chakma standard character. * src/autofit/afranges.c, src/autofit/afstyles.h: Add Chakma data. --- ChangeLog | 12 ++ src/autofit/afblue.c | 10 ++ src/autofit/afblue.dat | 13 ++ src/autofit/afblue.h | 390 +++++++++++++++++++++-------------------- src/autofit/afranges.c | 14 ++ src/autofit/afscript.h | 6 + src/autofit/afstyles.h | 7 + 7 files changed, 259 insertions(+), 193 deletions(-) diff --git a/ChangeLog b/ChangeLog index 14efeef14..ba1a9fcdd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2017-05-11 Sascha Brawer + Werner Lemberg Werner Lemberg Date: Thu, 11 May 2017 00:11:59 +0200 Subject: [PATCH 094/470] s/AF_BLUE_STRINGSET_CANADIAN_SYLLABICS/AF_BLUE_STRINGSET_CANS/. --- src/autofit/afblue.dat | 2 +- src/autofit/afblue.h | 2 +- src/autofit/afstyles.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/autofit/afblue.dat b/src/autofit/afblue.dat index a70d328ac..454923e9c 100644 --- a/src/autofit/afblue.dat +++ b/src/autofit/afblue.dat @@ -723,7 +723,7 @@ AF_BLUE_STRINGSET_ENUM AF_BLUE_STRINGSETS_ARRAY AF_BLUE_STRINGSET_MAX_LEN: { AF_BLUE_STRING_CHAKMA_DESCENDER, 0 } { AF_BLUE_STRING_MAX, 0 } - AF_BLUE_STRINGSET_CANADIAN_SYLLABICS + AF_BLUE_STRINGSET_CANS { AF_BLUE_STRING_CANADIAN_SYLLABICS_TOP, AF_BLUE_PROPERTY_LATIN_TOP } { AF_BLUE_STRING_CANADIAN_SYLLABICS_BOTTOM, 0 } { AF_BLUE_STRING_CANADIAN_SYLLABICS_SMALL_TOP, AF_BLUE_PROPERTY_LATIN_TOP | diff --git a/src/autofit/afblue.h b/src/autofit/afblue.h index 453c0eae1..e227dbf50 100644 --- a/src/autofit/afblue.h +++ b/src/autofit/afblue.h @@ -326,7 +326,7 @@ FT_BEGIN_HEADER AF_BLUE_STRINGSET_BENG = 22, AF_BLUE_STRINGSET_BUHD = 27, AF_BLUE_STRINGSET_CAKM = 32, - AF_BLUE_STRINGSET_CANADIAN_SYLLABICS = 36, + AF_BLUE_STRINGSET_CANS = 36, AF_BLUE_STRINGSET_CARI = 43, AF_BLUE_STRINGSET_CHER = 46, AF_BLUE_STRINGSET_COPT = 53, diff --git a/src/autofit/afstyles.h b/src/autofit/afstyles.h index f6ec29034..a5e13d894 100644 --- a/src/autofit/afstyles.h +++ b/src/autofit/afstyles.h @@ -143,7 +143,7 @@ "Canadian Syllabics default style", AF_WRITING_SYSTEM_LATIN, AF_SCRIPT_CANS, - AF_BLUE_STRINGSET_CANADIAN_SYLLABICS, + AF_BLUE_STRINGSET_CANS, AF_COVERAGE_DEFAULT ) STYLE( cari_dflt, CARI_DFLT, From 2e209c6cbe535b2234f8559832ff97905402d231 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Thu, 11 May 2017 00:28:05 +0200 Subject: [PATCH 095/470] Update CHANGES file. --- docs/CHANGES | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/CHANGES b/docs/CHANGES index 4413a3291..dc702a901 100644 --- a/docs/CHANGES +++ b/docs/CHANGES @@ -21,6 +21,14 @@ CHANGES BETWEEN 2.7.1 and 2.8 FREETYPE_PROPERTIES=pcf:no-long-family-names=1 + - Support for the following scripts has been added to the + auto-hinter. + + Adlam, Avestan, Bamum, Buhid, Carian, Chakma, Coptic, Cypriot, + Deseret, Glagolitic, Gothic, Kayah, Lisu, N'Ko, Ol Chiki, Old + Turkic, Osage, Osmanya, Saurashtra, Shavian, Sundanese, Tai + Viet, Tifinagh, Unified Canadian Syllabics, Vai + II. IMPORTANT BUG FIXES From 603121c05024aa0b9326bd07eda007da53fcbba4 Mon Sep 17 00:00:00 2001 From: Hin-Tak Leung Date: Fri, 12 May 2017 07:52:36 +0200 Subject: [PATCH 096/470] Fix `FT_UINT_TO_POINTER' macro for Windows. * builds/unix/ftconfig.in, builds/vms/ftconfig.h, include/freetype/config/ftconfig.h (FT_UINT_TO_POINTER) [_WIN64]: Fix definition. --- ChangeLog | 8 ++++++++ builds/unix/ftconfig.in | 2 +- builds/vms/ftconfig.h | 2 +- include/freetype/config/ftconfig.h | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index ba1a9fcdd..708b7c142 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2017-05-12 Hin-Tak Leung + + Fix `FT_UINT_TO_POINTER' macro for Windows. + + * builds/unix/ftconfig.in, builds/vms/ftconfig.h, + include/freetype/config/ftconfig.h (FT_UINT_TO_POINTER) [_WIN64]: + Fix definition. + 2017-05-11 Sascha Brawer Werner Lemberg Date: Sat, 13 May 2017 06:28:08 +0200 Subject: [PATCH 097/470] formats.txt: Properly document PFB. --- docs/formats.txt | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/docs/formats.txt b/docs/formats.txt index 5e56073cc..1c494f063 100644 --- a/docs/formats.txt +++ b/docs/formats.txt @@ -7,9 +7,12 @@ Table fields wrapper format The format used to represent the font data. In the table below it is used only if the font format differs. Possible values are - `SFNT' (binary), `PS' (a text header, followed by binary or text - data), `LZW' (compressed with either `gzip' or `compress'), and - `BZ2' (compressed with `bzip2`). + + SFNT binary + PFB binary + PS a text header, followed by binary or text data + LZW compressed with either `gzip' or `compress' + BZ2 compressed with `bzip2'. font format How the font is to be accessed, possibly after converting the file @@ -95,6 +98,9 @@ which isn't supported yet please send a mail too. --- PS TYPE_1 --- type1 T1_SPEC.pdf + (PFA, Type 1 font resource) + PFB PS TYPE_1 --- type1 T1_SPEC.pdf, + 5040.Download_Fonts.pdf (`normal' Type 1 font) --- PS TYPE_1 CID cid PLRM.pdf (CID Font Type 0; Type 9 font) @@ -197,3 +203,7 @@ accept it fully. --- end of formats.txt --- + +Local Variables: +coding: utf-8 +End: From a12a34451a99cbbcad55d466940fd445171927fd Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sat, 13 May 2017 06:29:04 +0200 Subject: [PATCH 098/470] * Version 2.8 released. ======================= Tag sources with `VER-2-8'. * docs/VERSION.TXT: Add entry for version 2.8. * docs/CHANGES: Updated. * README, Jamfile (RefDoc), builds/windows/vc2005/freetype.vcproj, builds/windows/vc2005/index.html, builds/windows/vc2008/freetype.vcproj, builds/windows/vc2008/index.html, builds/windows/vc2010/freetype.vcxproj, builds/windows/vc2010/index.html, builds/windows/visualc/freetype.dsp, builds/windows/visualc/freetype.vcproj, builds/windows/visualc/index.html, builds/windows/visualce/freetype.dsp, builds/windows/visualce/freetype.vcproj, builds/windows/visualce/index.html, builds/wince/vc2005-ce/freetype.vcproj, builds/wince/vc2005-ce/index.html, builds/wince/vc2008-ce/freetype.vcproj, builds/wince/vc2008-ce/index.html: s/2.7.1/2.8/, s/271/28/. * include/freetype/freetype.h (FREETYPE_MINOR): Set to 8. (FREETYPE_PATCH): Set to 0. * builds/unix/configure.raw (version_info): Set to 20:0:14. * CMakeLists.txt (VERSION_MINOR): Set to 8. (VERSION_PATCH): Set to 0. --- CMakeLists.txt | 4 +- ChangeLog | 35 +++++++++++ Jamfile | 2 +- README | 10 +-- builds/unix/configure.raw | 2 +- builds/wince/vc2005-ce/freetype.vcproj | 76 +++++++++++----------- builds/wince/vc2005-ce/index.html | 10 +-- builds/wince/vc2008-ce/freetype.vcproj | 76 +++++++++++----------- builds/wince/vc2008-ce/index.html | 10 +-- builds/windows/vc2005/freetype.vcproj | 12 ++-- builds/windows/vc2005/index.html | 10 +-- builds/windows/vc2008/freetype.vcproj | 12 ++-- builds/windows/vc2008/index.html | 10 +-- builds/windows/vc2010/freetype.vcxproj | 24 +++---- builds/windows/vc2010/index.html | 14 ++--- builds/windows/visualc/freetype.dsp | 20 +++--- builds/windows/visualc/freetype.vcproj | 12 ++-- builds/windows/visualc/index.html | 10 +-- builds/windows/visualce/freetype.dsp | 20 +++--- builds/windows/visualce/freetype.vcproj | 84 ++++++++++++------------- builds/windows/visualce/index.html | 10 +-- docs/CHANGES | 3 + docs/VERSIONS.TXT | 1 + docs/freetype-config.1 | 2 +- include/freetype/freetype.h | 8 +-- include/freetype/ftautoh.h | 5 +- include/freetype/ftcffdrv.h | 3 +- include/freetype/ftlcdfil.h | 3 +- 28 files changed, 265 insertions(+), 223 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 63f576701..d1b053e2b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -153,8 +153,8 @@ endif () set(VERSION_MAJOR "2") -set(VERSION_MINOR "7") -set(VERSION_PATCH "1") +set(VERSION_MINOR "8") +set(VERSION_PATCH "0") set(PROJECT_VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}) set(SHARED_LIBRARY_VERSION ${VERSION_MAJOR}.${VERSION_MINOR}) diff --git a/ChangeLog b/ChangeLog index 708b7c142..b81af155d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,38 @@ +2017-05-13 Werner Lemberg + + * Version 2.8 released. + ======================= + + + Tag sources with `VER-2-8'. + + * docs/VERSION.TXT: Add entry for version 2.8. + * docs/CHANGES: Updated. + + * README, Jamfile (RefDoc), builds/windows/vc2005/freetype.vcproj, + builds/windows/vc2005/index.html, + builds/windows/vc2008/freetype.vcproj, + builds/windows/vc2008/index.html, + builds/windows/vc2010/freetype.vcxproj, + builds/windows/vc2010/index.html, + builds/windows/visualc/freetype.dsp, + builds/windows/visualc/freetype.vcproj, + builds/windows/visualc/index.html, + builds/windows/visualce/freetype.dsp, + builds/windows/visualce/freetype.vcproj, + builds/windows/visualce/index.html, + builds/wince/vc2005-ce/freetype.vcproj, + builds/wince/vc2005-ce/index.html, + builds/wince/vc2008-ce/freetype.vcproj, + builds/wince/vc2008-ce/index.html: s/2.7.1/2.8/, s/271/28/. + + * include/freetype/freetype.h (FREETYPE_MINOR): Set to 8. + (FREETYPE_PATCH): Set to 0. + + * builds/unix/configure.raw (version_info): Set to 20:0:14. + * CMakeLists.txt (VERSION_MINOR): Set to 8. + (VERSION_PATCH): Set to 0. + 2017-05-12 Hin-Tak Leung Fix `FT_UINT_TO_POINTER' macro for Windows. diff --git a/Jamfile b/Jamfile index bd45e9457..5df9b8fef 100644 --- a/Jamfile +++ b/Jamfile @@ -210,7 +210,7 @@ actions RefDoc { python $(FT2_SRC)/tools/docmaker/docmaker.py --prefix=ft2 - --title=FreeType-2.7.1 + --title=FreeType-2.8 --output=$(DOC_DIR) $(FT2_INCLUDE)/freetype/*.h $(FT2_INCLUDE)/freetype/config/*.h diff --git a/README b/README index fc7c4175b..926e9dc11 100644 --- a/README +++ b/README @@ -1,5 +1,5 @@ - FreeType 2.7.1 - ============== + FreeType 2.8 + ============ Homepage: http://www.freetype.org @@ -24,9 +24,9 @@ and download one of the following files. - freetype-doc-2.7.1.tar.bz2 - freetype-doc-2.7.1.tar.gz - ftdoc271.zip + freetype-doc-2.8.tar.bz2 + freetype-doc-2.8.tar.gz + ftdoc28.zip To view the documentation online, go to diff --git a/builds/unix/configure.raw b/builds/unix/configure.raw index 5bc0e4958..ef6debed4 100644 --- a/builds/unix/configure.raw +++ b/builds/unix/configure.raw @@ -17,7 +17,7 @@ AC_CONFIG_SRCDIR([ftconfig.in]) # Don't forget to update `docs/VERSIONS.TXT'! -version_info='19:0:13' +version_info='20:0:14' AC_SUBST([version_info]) ft_version=`echo $version_info | tr : .` AC_SUBST([ft_version]) diff --git a/builds/wince/vc2005-ce/freetype.vcproj b/builds/wince/vc2005-ce/freetype.vcproj index 279abeefa..a1c0e3729 100644 --- a/builds/wince/vc2005-ce/freetype.vcproj +++ b/builds/wince/vc2005-ce/freetype.vcproj @@ -21,7 +21,7 @@ - + @@ -41,7 +41,7 @@ - + @@ -61,7 +61,7 @@ - + @@ -81,7 +81,7 @@ - + @@ -101,7 +101,7 @@ - + @@ -121,7 +121,7 @@ - + @@ -141,7 +141,7 @@ - + @@ -161,7 +161,7 @@ - + @@ -181,7 +181,7 @@ - + @@ -201,7 +201,7 @@ - + @@ -221,7 +221,7 @@ - + @@ -241,7 +241,7 @@ - + @@ -261,7 +261,7 @@ - + @@ -281,7 +281,7 @@ - + @@ -301,7 +301,7 @@ - + @@ -321,7 +321,7 @@ - + @@ -341,7 +341,7 @@ - + @@ -361,7 +361,7 @@ - + @@ -381,7 +381,7 @@ - + @@ -401,7 +401,7 @@ - + @@ -421,7 +421,7 @@ - + @@ -441,7 +441,7 @@ - + @@ -461,7 +461,7 @@ - + @@ -481,7 +481,7 @@ - + @@ -501,7 +501,7 @@ - + @@ -521,7 +521,7 @@ - + @@ -541,7 +541,7 @@ - + @@ -561,7 +561,7 @@ - + @@ -581,7 +581,7 @@ - + @@ -601,7 +601,7 @@ - + @@ -621,7 +621,7 @@ - + @@ -641,7 +641,7 @@ - + @@ -661,7 +661,7 @@ - + @@ -681,7 +681,7 @@ - + @@ -701,7 +701,7 @@ - + @@ -721,7 +721,7 @@ - + @@ -741,7 +741,7 @@ - + @@ -758,7 +758,7 @@ - + diff --git a/builds/wince/vc2005-ce/index.html b/builds/wince/vc2005-ce/index.html index 58d6093bc..fcb52bc5b 100644 --- a/builds/wince/vc2005-ce/index.html +++ b/builds/wince/vc2005-ce/index.html @@ -21,14 +21,14 @@ the following targets:
  • PPC/SP WM6 (Windows Mobile 6)
  • -It compiles the following libraries from the FreeType 2.7.1 sources:

    +It compiles the following libraries from the FreeType 2.8 sources:

      -    freetype271.lib     - release build; single threaded
      -    freetype271_D.lib   - debug build;   single threaded
      -    freetype271MT.lib   - release build; multi-threaded
      -    freetype271MT_D.lib - debug build;   multi-threaded
      + freetype28.lib - release build; single threaded + freetype28_D.lib - debug build; single threaded + freetype28MT.lib - release build; multi-threaded + freetype28MT_D.lib - debug build; multi-threaded

    Be sure to extract the files with the Windows (CR+LF) line endings. ZIP diff --git a/builds/wince/vc2008-ce/freetype.vcproj b/builds/wince/vc2008-ce/freetype.vcproj index ca306ceff..273aa53d4 100644 --- a/builds/wince/vc2008-ce/freetype.vcproj +++ b/builds/wince/vc2008-ce/freetype.vcproj @@ -88,7 +88,7 @@ /> PPC/SP WM6 (Windows Mobile 6) -It compiles the following libraries from the FreeType 2.7.1 sources:

    +It compiles the following libraries from the FreeType 2.8 sources:

      -    freetype271.lib     - release build; single threaded
      -    freetype271_D.lib   - debug build;   single threaded
      -    freetype271MT.lib   - release build; multi-threaded
      -    freetype271MT_D.lib - debug build;   multi-threaded
      + freetype28.lib - release build; single threaded + freetype28_D.lib - debug build; single threaded + freetype28MT.lib - release build; multi-threaded + freetype28MT_D.lib - debug build; multi-threaded

    Be sure to extract the files with the Windows (CR+LF) line endings. ZIP diff --git a/builds/windows/vc2005/freetype.vcproj b/builds/windows/vc2005/freetype.vcproj index b643840c2..e5e67d5b3 100644 --- a/builds/windows/vc2005/freetype.vcproj +++ b/builds/windows/vc2005/freetype.vcproj @@ -16,7 +16,7 @@ - + @@ -33,7 +33,7 @@ - + @@ -50,7 +50,7 @@ - + @@ -67,7 +67,7 @@ - + @@ -84,7 +84,7 @@ - + @@ -101,7 +101,7 @@ - + diff --git a/builds/windows/vc2005/index.html b/builds/windows/vc2005/index.html index c3a5ab7d5..4bd9b75b7 100644 --- a/builds/windows/vc2005/index.html +++ b/builds/windows/vc2005/index.html @@ -11,14 +11,14 @@

    This directory contains project files for Visual C++, named freetype.vcproj, and Visual Studio, called freetype.sln. It -compiles the following libraries from the FreeType 2.7.1 sources:

    +compiles the following libraries from the FreeType 2.8 sources:

      -    freetype271.lib     - release build; single threaded
      -    freetype271_D.lib   - debug build;   single threaded
      -    freetype271MT.lib   - release build; multi-threaded
      -    freetype271MT_D.lib - debug build;   multi-threaded
      + freetype28.lib - release build; single threaded + freetype28_D.lib - debug build; single threaded + freetype28MT.lib - release build; multi-threaded + freetype28MT_D.lib - debug build; multi-threaded

    Be sure to extract the files with the Windows (CR+LF) line endings. ZIP diff --git a/builds/windows/vc2008/freetype.vcproj b/builds/windows/vc2008/freetype.vcproj index 20d82c4bf..a8bc67295 100644 --- a/builds/windows/vc2008/freetype.vcproj +++ b/builds/windows/vc2008/freetype.vcproj @@ -70,7 +70,7 @@ /> This directory contains project files for Visual C++, named freetype.vcproj, and Visual Studio, called freetype.sln. It -compiles the following libraries from the FreeType 2.7.1 sources:

    +compiles the following libraries from the FreeType 2.8 sources:

      -    freetype271.lib     - release build; single threaded
      -    freetype271_D.lib   - debug build;   single threaded
      -    freetype271MT.lib   - release build; multi-threaded
      -    freetype271MT_D.lib - debug build;   multi-threaded
      + freetype28.lib - release build; single threaded + freetype28_D.lib - debug build; single threaded + freetype28MT.lib - release build; multi-threaded + freetype28MT_D.lib - debug build; multi-threaded

    Be sure to extract the files with the Windows (CR+LF) line endings. ZIP diff --git a/builds/windows/vc2010/freetype.vcxproj b/builds/windows/vc2010/freetype.vcxproj index 64a71f8bc..e4f11fc11 100644 --- a/builds/windows/vc2010/freetype.vcxproj +++ b/builds/windows/vc2010/freetype.vcxproj @@ -191,18 +191,18 @@ - freetype271d - freetype271d - freetype271MTd - freetype271MTd - freetype271STd - freetype271STd - freetype271 - freetype271 - freetype271MT - freetype271MT - freetype271ST - freetype271ST + freetype28d + freetype28d + freetype28MTd + freetype28MTd + freetype28STd + freetype28STd + freetype28 + freetype28 + freetype28MT + freetype28MT + freetype28ST + freetype28ST diff --git a/builds/windows/vc2010/index.html b/builds/windows/vc2010/index.html index 8e465913a..c2b580045 100644 --- a/builds/windows/vc2010/index.html +++ b/builds/windows/vc2010/index.html @@ -12,16 +12,16 @@

    This directory contains a project file for Visual C++ (VS.NET 2010 or newer), named freetype.vcxproj, and Visual Studio, called freetype.sln. It compiles the following libraries from the -FreeType 2.7.1 sources:

    +FreeType 2.8 sources:

      -    freetype271.lib    - release build
      -    freetype271d.lib   - debug build
      -    freetype271ST.lib  - release build; single threaded
      -    freetype271STd.lib - debug build;   single threaded
      -    freetype271MT.lib  - release build; multi-threaded
      -    freetype271MTd.lib - debug build;   multi-threaded
      + freetype28.lib - release build + freetype28d.lib - debug build + freetype28ST.lib - release build; single threaded + freetype28STd.lib - debug build; single threaded + freetype28MT.lib - release build; multi-threaded + freetype28MTd.lib - debug build; multi-threaded

    Both Win32 and x64 builds are supported.

    diff --git a/builds/windows/visualc/freetype.dsp b/builds/windows/visualc/freetype.dsp index f6eeeb368..fc14b48ce 100644 --- a/builds/windows/visualc/freetype.dsp +++ b/builds/windows/visualc/freetype.dsp @@ -54,7 +54,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LIB32=link.exe -lib # ADD BASE LIB32 /nologo -# ADD LIB32 /nologo /out:"..\..\..\objs\freetype271.lib" +# ADD LIB32 /nologo /out:"..\..\..\objs\freetype28.lib" !ELSEIF "$(CFG)" == "freetype - Win32 Debug" @@ -78,7 +78,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LIB32=link.exe -lib # ADD BASE LIB32 /nologo -# ADD LIB32 /nologo /out:"..\..\..\objs\freetype271_D.lib" +# ADD LIB32 /nologo /out:"..\..\..\objs\freetype28_D.lib" !ELSEIF "$(CFG)" == "freetype - Win32 Debug Multithreaded" @@ -102,8 +102,8 @@ BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LIB32=link.exe -lib -# ADD BASE LIB32 /nologo /out:"lib\freetype271_D.lib" -# ADD LIB32 /nologo /out:"..\..\..\objs\freetype271MT_D.lib" +# ADD BASE LIB32 /nologo /out:"lib\freetype28_D.lib" +# ADD LIB32 /nologo /out:"..\..\..\objs\freetype28MT_D.lib" !ELSEIF "$(CFG)" == "freetype - Win32 Release Multithreaded" @@ -126,8 +126,8 @@ BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LIB32=link.exe -lib -# ADD BASE LIB32 /nologo /out:"lib\freetype271.lib" -# ADD LIB32 /nologo /out:"..\..\..\objs\freetype271MT.lib" +# ADD BASE LIB32 /nologo /out:"lib\freetype28.lib" +# ADD LIB32 /nologo /out:"..\..\..\objs\freetype28MT.lib" !ELSEIF "$(CFG)" == "freetype - Win32 Release Singlethreaded" @@ -151,8 +151,8 @@ BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LIB32=link.exe -lib -# ADD BASE LIB32 /nologo /out:"..\..\..\objs\freetype271.lib" -# ADD LIB32 /out:"..\..\..\objs\freetype271ST.lib" +# ADD BASE LIB32 /nologo /out:"..\..\..\objs\freetype28.lib" +# ADD LIB32 /out:"..\..\..\objs\freetype28ST.lib" # SUBTRACT LIB32 /nologo !ELSEIF "$(CFG)" == "freetype - Win32 Debug Singlethreaded" @@ -177,8 +177,8 @@ BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LIB32=link.exe -lib -# ADD BASE LIB32 /nologo /out:"..\..\..\objs\freetype271_D.lib" -# ADD LIB32 /nologo /out:"..\..\..\objs\freetype271ST_D.lib" +# ADD BASE LIB32 /nologo /out:"..\..\..\objs\freetype28_D.lib" +# ADD LIB32 /nologo /out:"..\..\..\objs\freetype28ST_D.lib" !ENDIF diff --git a/builds/windows/visualc/freetype.vcproj b/builds/windows/visualc/freetype.vcproj index 69c084cce..968f2ee75 100644 --- a/builds/windows/visualc/freetype.vcproj +++ b/builds/windows/visualc/freetype.vcproj @@ -69,7 +69,7 @@ /> This directory contains project files for Visual C++, named freetype.dsp, and Visual Studio, called freetype.sln. It -compiles the following libraries from the FreeType 2.7.1 sources:

    +compiles the following libraries from the FreeType 2.8 sources:

      -    freetype271.lib     - release build; single threaded
      -    freetype271_D.lib   - debug build;   single threaded
      -    freetype271MT.lib   - release build; multi-threaded
      -    freetype271MT_D.lib - debug build;   multi-threaded
      + freetype28.lib - release build; single threaded + freetype28_D.lib - debug build; single threaded + freetype28MT.lib - release build; multi-threaded + freetype28MT_D.lib - debug build; multi-threaded

    Be sure to extract the files with the Windows (CR+LF) line endings. ZIP diff --git a/builds/windows/visualce/freetype.dsp b/builds/windows/visualce/freetype.dsp index f6eeeb368..fc14b48ce 100644 --- a/builds/windows/visualce/freetype.dsp +++ b/builds/windows/visualce/freetype.dsp @@ -54,7 +54,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LIB32=link.exe -lib # ADD BASE LIB32 /nologo -# ADD LIB32 /nologo /out:"..\..\..\objs\freetype271.lib" +# ADD LIB32 /nologo /out:"..\..\..\objs\freetype28.lib" !ELSEIF "$(CFG)" == "freetype - Win32 Debug" @@ -78,7 +78,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LIB32=link.exe -lib # ADD BASE LIB32 /nologo -# ADD LIB32 /nologo /out:"..\..\..\objs\freetype271_D.lib" +# ADD LIB32 /nologo /out:"..\..\..\objs\freetype28_D.lib" !ELSEIF "$(CFG)" == "freetype - Win32 Debug Multithreaded" @@ -102,8 +102,8 @@ BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LIB32=link.exe -lib -# ADD BASE LIB32 /nologo /out:"lib\freetype271_D.lib" -# ADD LIB32 /nologo /out:"..\..\..\objs\freetype271MT_D.lib" +# ADD BASE LIB32 /nologo /out:"lib\freetype28_D.lib" +# ADD LIB32 /nologo /out:"..\..\..\objs\freetype28MT_D.lib" !ELSEIF "$(CFG)" == "freetype - Win32 Release Multithreaded" @@ -126,8 +126,8 @@ BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LIB32=link.exe -lib -# ADD BASE LIB32 /nologo /out:"lib\freetype271.lib" -# ADD LIB32 /nologo /out:"..\..\..\objs\freetype271MT.lib" +# ADD BASE LIB32 /nologo /out:"lib\freetype28.lib" +# ADD LIB32 /nologo /out:"..\..\..\objs\freetype28MT.lib" !ELSEIF "$(CFG)" == "freetype - Win32 Release Singlethreaded" @@ -151,8 +151,8 @@ BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LIB32=link.exe -lib -# ADD BASE LIB32 /nologo /out:"..\..\..\objs\freetype271.lib" -# ADD LIB32 /out:"..\..\..\objs\freetype271ST.lib" +# ADD BASE LIB32 /nologo /out:"..\..\..\objs\freetype28.lib" +# ADD LIB32 /out:"..\..\..\objs\freetype28ST.lib" # SUBTRACT LIB32 /nologo !ELSEIF "$(CFG)" == "freetype - Win32 Debug Singlethreaded" @@ -177,8 +177,8 @@ BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LIB32=link.exe -lib -# ADD BASE LIB32 /nologo /out:"..\..\..\objs\freetype271_D.lib" -# ADD LIB32 /nologo /out:"..\..\..\objs\freetype271ST_D.lib" +# ADD BASE LIB32 /nologo /out:"..\..\..\objs\freetype28_D.lib" +# ADD LIB32 /nologo /out:"..\..\..\objs\freetype28ST_D.lib" !ENDIF diff --git a/builds/windows/visualce/freetype.vcproj b/builds/windows/visualce/freetype.vcproj index 55c874df8..f28b3c140 100644 --- a/builds/windows/visualce/freetype.vcproj +++ b/builds/windows/visualce/freetype.vcproj @@ -87,7 +87,7 @@ /> PPC/SP WM6 (Windows Mobile 6) -It compiles the following libraries from the FreeType 2.7.1 sources:

    +It compiles the following libraries from the FreeType 2.8 sources:

      -    freetype271.lib     - release build; single threaded
      -    freetype271_D.lib   - debug build;   single threaded
      -    freetype271MT.lib   - release build; multi-threaded
      -    freetype271MT_D.lib - debug build;   multi-threaded
      + freetype28.lib - release build; single threaded + freetype28_D.lib - debug build; single threaded + freetype28MT.lib - release build; multi-threaded + freetype28MT_D.lib - debug build; multi-threaded

    Be sure to extract the files with the Windows (CR+LF) line endings. ZIP diff --git a/docs/CHANGES b/docs/CHANGES index dc702a901..3ee9510d0 100644 --- a/docs/CHANGES +++ b/docs/CHANGES @@ -100,6 +100,9 @@ CHANGES BETWEEN 2.7.1 and 2.8 - FT_LOAD_TARGET_LCD is now a variant of FT_LOAD_TARGET_LIGHT; this should provide better rendering results. + - A mode to display light auto-hinting with sub-pixel positioning + has been added to `ftdiff'. + ====================================================================== diff --git a/docs/VERSIONS.TXT b/docs/VERSIONS.TXT index ec491de01..e116d34cb 100644 --- a/docs/VERSIONS.TXT +++ b/docs/VERSIONS.TXT @@ -52,6 +52,7 @@ on _most_ systems, but not all of them: release libtool so ------------------------------- + 2.8.0 20.0.14 6.14.0 2.7.1 19.0.13 6.13.0 2.7.0 18.6.12 6.12.6 2.6.5 18.5.12 6.12.5 diff --git a/docs/freetype-config.1 b/docs/freetype-config.1 index d98400d2d..eaaa1b95b 100644 --- a/docs/freetype-config.1 +++ b/docs/freetype-config.1 @@ -1,4 +1,4 @@ -.TH FREETYPE-CONFIG 1 "December 2016" "FreeType 2.7.1" +.TH FREETYPE-CONFIG 1 "May 2017" "FreeType 2.8" . . .SH NAME diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h index 65f8fce2c..2989fbb5e 100644 --- a/include/freetype/freetype.h +++ b/include/freetype/freetype.h @@ -826,8 +826,8 @@ FT_BEGIN_HEADER /* */ /* platform_id :: An ID number describing the platform for the */ /* following encoding ID. This comes directly from */ - /* the TrueType specification gets emulated */ - /* for other formats. */ + /* the TrueType specification and gets emulated for */ + /* other formats. */ /* */ /* encoding_id :: A platform specific encoding number. This also */ /* comes from the TrueType specification and gets */ @@ -4441,8 +4441,8 @@ FT_BEGIN_HEADER * */ #define FREETYPE_MAJOR 2 -#define FREETYPE_MINOR 7 -#define FREETYPE_PATCH 1 +#define FREETYPE_MINOR 8 +#define FREETYPE_PATCH 0 /*************************************************************************/ diff --git a/include/freetype/ftautoh.h b/include/freetype/ftautoh.h index dc00ae1ab..abd540f0b 100644 --- a/include/freetype/ftautoh.h +++ b/include/freetype/ftautoh.h @@ -448,7 +448,7 @@ FT_BEGIN_HEADER * no-stem-darkening[autofit] * * @description: - * *Experimental* *only,* *requires* *linear* *alpha* *blending* *and* + * *Experimental* *only*, *requires* *linear* *alpha* *blending* *and* * *gamma* *correction* * * Stem darkening emboldens glyphs at smaller sizes to make them more @@ -483,7 +483,8 @@ FT_BEGIN_HEADER */ - /* + /************************************************************************** + * * @constant: * FT_PARAM_TAG_STEM_DARKENING * diff --git a/include/freetype/ftcffdrv.h b/include/freetype/ftcffdrv.h index c55b5916b..477b6ddb1 100644 --- a/include/freetype/ftcffdrv.h +++ b/include/freetype/ftcffdrv.h @@ -293,7 +293,8 @@ FT_BEGIN_HEADER */ - /* + /************************************************************************** + * * @constant: * FT_PARAM_TAG_RANDOM_SEED * diff --git a/include/freetype/ftlcdfil.h b/include/freetype/ftlcdfil.h index cc9a43c3b..680bd90c8 100644 --- a/include/freetype/ftlcdfil.h +++ b/include/freetype/ftlcdfil.h @@ -279,7 +279,8 @@ FT_BEGIN_HEADER unsigned char *weights ); - /* + /************************************************************************** + * * @constant: * FT_PARAM_TAG_LCD_FILTER_WEIGHTS * From e99b26aadae8fa057debf995e4b8017e18c2b995 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sun, 14 May 2017 21:57:27 +0200 Subject: [PATCH 099/470] Remove remnants of raster pool. * include/freetype/internal/ftobjs.h (FT_LibraryRec): Remove `raster_pool' and `raster_pool_size' fields. * src/base/ftobjs.c (FT_New_Library), src/raster/ftrend1.c (ft_raster1_init), src/smooth/ftsmooth.c (ft_smooth_init): Updated. --- ChangeLog | 10 ++++++++++ include/freetype/ftimage.h | 20 ++++++++++---------- include/freetype/internal/ftobjs.h | 9 --------- src/base/ftobjs.c | 4 ---- src/raster/ftrend1.c | 7 +------ src/smooth/ftsmooth.c | 7 +------ 6 files changed, 22 insertions(+), 35 deletions(-) diff --git a/ChangeLog b/ChangeLog index b81af155d..0c22bdc52 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2017-05-14 Werner Lemberg + + Remove remnants of raster pool. + + * include/freetype/internal/ftobjs.h (FT_LibraryRec): Remove + `raster_pool' and `raster_pool_size' fields. + + * src/base/ftobjs.c (FT_New_Library), src/raster/ftrend1.c + (ft_raster1_init), src/smooth/ftsmooth.c (ft_smooth_init): Updated. + 2017-05-13 Werner Lemberg * Version 2.8 released. diff --git a/include/freetype/ftimage.h b/include/freetype/ftimage.h index 1a049ef16..1c789e5a4 100644 --- a/include/freetype/ftimage.h +++ b/include/freetype/ftimage.h @@ -1064,24 +1064,24 @@ FT_BEGIN_HEADER /* */ /* */ /* FreeType used to provide an area of memory called the `render */ - /* pool' available to all registered rasters. This was not thread */ - /* safe however and now FreeType never allocates this pool. NULL */ - /* is always passed in as pool_base. */ + /* pool' available to all registered rasterizers. This was not */ + /* thread safe, however, and now FreeType never allocates this pool. */ /* */ - /* This function is called each time the render pool changes, or just */ - /* after a new raster object is created. */ + /* This function is called after a new raster object is created. */ /* */ /* */ /* raster :: A handle to the new raster object. */ /* */ - /* pool_base :: The address in memory of the render pool. */ + /* pool_base :: Previously, the address in memory of the render pool. */ + /* Set this to NULL. */ /* */ - /* pool_size :: The size in bytes of the render pool. */ + /* pool_size :: Previously, the size in bytes of the render pool. */ + /* Set this to 0. */ /* */ /* */ - /* Rasters should ignore the render pool and rely on dynamic or stack */ - /* allocation if they want to (a handle to the memory allocator is */ - /* passed to the raster constructor). */ + /* Rasterizers should rely on dynamic or stack allocation if they */ + /* want to (a handle to the memory allocator is passed to the */ + /* rasterizer constructor). */ /* */ typedef void (*FT_Raster_ResetFunc)( FT_Raster raster, diff --git a/include/freetype/internal/ftobjs.h b/include/freetype/internal/ftobjs.h index 558409166..06b6597ea 100644 --- a/include/freetype/internal/ftobjs.h +++ b/include/freetype/internal/ftobjs.h @@ -856,11 +856,6 @@ FT_BEGIN_HEADER /* */ /* auto_hinter :: The auto-hinter module interface. */ /* */ - /* raster_pool :: The raster object's render pool. This can */ - /* ideally be changed dynamically at run-time. */ - /* */ - /* raster_pool_size :: The size of the render pool in bytes. */ - /* */ /* debug_hooks :: An array of four function pointers that allow */ /* debuggers to hook into a font format's */ /* interpreter. Currently, only the TrueType */ @@ -903,10 +898,6 @@ FT_BEGIN_HEADER FT_Renderer cur_renderer; /* current outline renderer */ FT_Module auto_hinter; - FT_Byte* raster_pool; /* scan-line conversion */ - /* render pool */ - FT_ULong raster_pool_size; /* size of render pool in bytes */ - FT_DebugHook_Func debug_hooks[4]; #ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c index 539116e85..75e498890 100644 --- a/src/base/ftobjs.c +++ b/src/base/ftobjs.c @@ -4973,10 +4973,6 @@ goto Fail; #endif - /* we don't use raster_pool anymore. */ - library->raster_pool_size = 0; - library->raster_pool = NULL; - library->version_major = FREETYPE_MAJOR; library->version_minor = FREETYPE_MINOR; library->version_patch = FREETYPE_PATCH; diff --git a/src/raster/ftrend1.c b/src/raster/ftrend1.c index 1a83e9e47..e52ca1db5 100644 --- a/src/raster/ftrend1.c +++ b/src/raster/ftrend1.c @@ -31,12 +31,7 @@ static FT_Error ft_raster1_init( FT_Renderer render ) { - FT_Library library = FT_MODULE_LIBRARY( render ); - - - render->clazz->raster_class->raster_reset( render->raster, - library->raster_pool, - library->raster_pool_size ); + render->clazz->raster_class->raster_reset( render->raster, NULL, 0 ); return FT_Err_Ok; } diff --git a/src/smooth/ftsmooth.c b/src/smooth/ftsmooth.c index 435854e67..cd7a87b0f 100644 --- a/src/smooth/ftsmooth.c +++ b/src/smooth/ftsmooth.c @@ -31,12 +31,7 @@ static FT_Error ft_smooth_init( FT_Renderer render ) { - FT_Library library = FT_MODULE_LIBRARY( render ); - - - render->clazz->raster_class->raster_reset( render->raster, - library->raster_pool, - library->raster_pool_size ); + render->clazz->raster_class->raster_reset( render->raster, NULL, 0 ); return 0; } From a7f276a281b2741b14beadb00f5d8414c464e07c Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Mon, 15 May 2017 00:25:37 -0400 Subject: [PATCH 100/470] [autofit] Make autohint warping NORMAL option. This moves warping option from LIGHT to NORMAL mode. This makes LIGHT truly void of hinting in x-direction, with left side bearing never changed and right side bearing only altered by advance rounding. Therefore, LIGHT is now ready to return fractional advance. As a NORMAL option, warping substitutes normal hinting. * src/autofit/afcjk.c (af_cjk_hints_apply): Updated. * src/autofit/aflatin.c (af_latin_hints_apply): Updated. * src/autofit/aflatin2.c (af_latin2_hints_apply): Updated. * src/autofit/afloader.c (af_loader_load_glyph): Handle warping phantom points as normal. --- ChangeLog | 17 +++++++++++++++++ src/autofit/afcjk.c | 12 +++--------- src/autofit/aflatin.c | 12 +++--------- src/autofit/aflatin2.c | 12 +++--------- src/autofit/afloader.c | 8 ++++---- 5 files changed, 30 insertions(+), 31 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0c22bdc52..1d40059c3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +2017-05-15 Alexei Podtelezhnikov + + [autofit] Make autohint warping NORMAL option. + + This moves warping option from LIGHT to NORMAL mode. This makes LIGHT + truly void of hinting in x-direction, with left side bearing never + changed and right side bearing only altered by advance rounding. + Therefore, LIGHT is now ready to return fractional advance. As a + NORMAL option, warping substitutes normal hinting. + + * src/autofit/afcjk.c (af_cjk_hints_apply): Updated. + * src/autofit/aflatin.c (af_latin_hints_apply): Updated. + * src/autofit/aflatin2.c (af_latin2_hints_apply): Updated. + + * src/autofit/afloader.c (af_loader_load_glyph): Handle warping + phantom points as normal. + 2017-05-14 Werner Lemberg Remove remnants of raster pool. diff --git a/src/autofit/afcjk.c b/src/autofit/afcjk.c index 61e29cded..897533d14 100644 --- a/src/autofit/afcjk.c +++ b/src/autofit/afcjk.c @@ -2272,13 +2272,7 @@ goto Exit; /* analyze glyph outline */ -#ifdef AF_CONFIG_OPTION_USE_WARPER - if ( ( metrics->root.scaler.render_mode == FT_RENDER_MODE_LIGHT && - AF_HINTS_DO_WARP( hints ) ) || - AF_HINTS_DO_HORIZONTAL( hints ) ) -#else if ( AF_HINTS_DO_HORIZONTAL( hints ) ) -#endif { error = af_cjk_hints_detect_features( hints, AF_DIMENSION_HORZ ); if ( error ) @@ -2304,9 +2298,9 @@ { #ifdef AF_CONFIG_OPTION_USE_WARPER - if ( dim == AF_DIMENSION_HORZ && - metrics->root.scaler.render_mode == FT_RENDER_MODE_LIGHT && - AF_HINTS_DO_WARP( hints ) ) + if ( dim == AF_DIMENSION_HORZ && + metrics->root.scaler.render_mode == FT_RENDER_MODE_NORMAL && + AF_HINTS_DO_WARP( hints ) ) { AF_WarperRec warper; FT_Fixed scale; diff --git a/src/autofit/aflatin.c b/src/autofit/aflatin.c index 11fa523c8..cdbc1b7ab 100644 --- a/src/autofit/aflatin.c +++ b/src/autofit/aflatin.c @@ -3492,13 +3492,7 @@ goto Exit; /* analyze glyph outline */ -#ifdef AF_CONFIG_OPTION_USE_WARPER - if ( ( metrics->root.scaler.render_mode == FT_RENDER_MODE_LIGHT && - AF_HINTS_DO_WARP( hints ) ) || - AF_HINTS_DO_HORIZONTAL( hints ) ) -#else if ( AF_HINTS_DO_HORIZONTAL( hints ) ) -#endif { axis = &metrics->axis[AF_DIMENSION_HORZ]; error = af_latin_hints_detect_features( hints, @@ -3528,9 +3522,9 @@ for ( dim = 0; dim < AF_DIMENSION_MAX; dim++ ) { #ifdef AF_CONFIG_OPTION_USE_WARPER - if ( dim == AF_DIMENSION_HORZ && - metrics->root.scaler.render_mode == FT_RENDER_MODE_LIGHT && - AF_HINTS_DO_WARP( hints ) ) + if ( dim == AF_DIMENSION_HORZ && + metrics->root.scaler.render_mode == FT_RENDER_MODE_NORMAL && + AF_HINTS_DO_WARP( hints ) ) { AF_WarperRec warper; FT_Fixed scale; diff --git a/src/autofit/aflatin2.c b/src/autofit/aflatin2.c index 0607278b1..fb4244511 100644 --- a/src/autofit/aflatin2.c +++ b/src/autofit/aflatin2.c @@ -2340,13 +2340,7 @@ goto Exit; /* analyze glyph outline */ -#ifdef AF_CONFIG_OPTION_USE_WARPER - if ( ( metrics->root.scaler.render_mode == FT_RENDER_MODE_LIGHT && - AF_HINTS_DO_WARP( hints ) ) || - AF_HINTS_DO_HORIZONTAL( hints ) ) -#else if ( AF_HINTS_DO_HORIZONTAL( hints ) ) -#endif { error = af_latin2_hints_detect_features( hints, AF_DIMENSION_HORZ ); if ( error ) @@ -2366,9 +2360,9 @@ for ( dim = 0; dim < AF_DIMENSION_MAX; dim++ ) { #ifdef AF_CONFIG_OPTION_USE_WARPER - if ( dim == AF_DIMENSION_HORZ && - metrics->root.scaler.render_mode == FT_RENDER_MODE_LIGHT && - AF_HINTS_DO_WARP( hints ) ) + if ( dim == AF_DIMENSION_HORZ && + metrics->root.scaler.render_mode == FT_RENDER_MODE_NORMAL && + AF_HINTS_DO_WARP( hints ) ) { AF_WarperRec warper; FT_Fixed scale; diff --git a/src/autofit/afloader.c b/src/autofit/afloader.c index 78c4368b6..067ebd17f 100644 --- a/src/autofit/afloader.c +++ b/src/autofit/afloader.c @@ -483,8 +483,8 @@ FT_Pos pp2x = loader->pp2.x; - loader->pp1.x = FT_PIX_ROUND( pp1x ); - loader->pp2.x = FT_PIX_ROUND( pp2x ); + loader->pp1.x = FT_PIX_ROUND( pp1x + hints->xmin_delta ); + loader->pp2.x = FT_PIX_ROUND( pp2x + hints->xmax_delta ); slot->lsb_delta = loader->pp1.x - pp1x; slot->rsb_delta = loader->pp2.x - pp2x; @@ -498,8 +498,8 @@ FT_Pos pp2x = loader->pp2.x; - loader->pp1.x = FT_PIX_ROUND( pp1x + hints->xmin_delta ); - loader->pp2.x = FT_PIX_ROUND( pp2x + hints->xmax_delta ); + loader->pp1.x = FT_PIX_ROUND( pp1x ); + loader->pp2.x = FT_PIX_ROUND( pp2x ); slot->lsb_delta = loader->pp1.x - pp1x; slot->rsb_delta = loader->pp2.x - pp2x; From 6e5445a232cbdbf18a45629cf2f12a81c043607f Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Mon, 15 May 2017 21:24:04 +0200 Subject: [PATCH 101/470] [truetype] Fix error handling for embedded bitmaps. Problem reported by Hin-Tak Leung . * src/truetype/ttgload.c (TT_Load_Glyph) [TT_CONFIG_OPTION_EMBEDDED_BITMAPS]: Handle error if font is not scalable. --- ChangeLog | 10 ++++++++++ src/truetype/ttgload.c | 8 +++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 1d40059c3..ad8ef9506 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2017-05-15 Werner Lemberg + + [truetype] Fix error handling for embedded bitmaps. + + Problem reported by Hin-Tak Leung . + + * src/truetype/ttgload.c (TT_Load_Glyph) + [TT_CONFIG_OPTION_EMBEDDED_BITMAPS]: Handle error if font is not + scalable. + 2017-05-15 Alexei Podtelezhnikov [autofit] Make autohint warping NORMAL option. diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c index b7a844a6c..68a9b4ad5 100644 --- a/src/truetype/ttgload.c +++ b/src/truetype/ttgload.c @@ -2621,7 +2621,13 @@ IS_DEFAULT_INSTANCE ) { error = load_sbit_image( size, glyph, glyph_index, load_flags ); - if ( !error ) + if ( error ) + { + /* return error if font is not scalable */ + if ( !FT_IS_SCALABLE( glyph->face ) ) + return error; + } + else { if ( FT_IS_SCALABLE( glyph->face ) ) { From 5efda13f60d5845d5df6437f2b8d3f55898393fe Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Mon, 15 May 2017 21:26:01 +0200 Subject: [PATCH 102/470] [sfnt] Return proper scaling values for SBIX bitmaps. Problem reported by Hin-Tak Leung . * src/sfnt/ttsbit.c (tt_face_load_strike_metrics): Implement it. --- ChangeLog | 8 ++++++++ src/sfnt/ttsbit.c | 9 +++++++++ 2 files changed, 17 insertions(+) diff --git a/ChangeLog b/ChangeLog index ad8ef9506..c78412264 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2017-05-15 Werner Lemberg + + [sfnt] Return proper scaling values for SBIX bitmaps. + + Problem reported by Hin-Tak Leung . + + * src/sfnt/ttsbit.c (tt_face_load_strike_metrics): Implement it. + 2017-05-15 Werner Lemberg [truetype] Fix error handling for embedded bitmaps. diff --git a/src/sfnt/ttsbit.c b/src/sfnt/ttsbit.c index 0c76a5577..59b2168bb 100644 --- a/src/sfnt/ttsbit.c +++ b/src/sfnt/ttsbit.c @@ -448,6 +448,15 @@ metrics->max_advance = FT_MulDiv( hori->advance_Width_Max, ppem_ * 64, upem ); + /* set the scale values (in 16.16 units) so advances */ + /* from the hmtx and vmtx table are scaled correctly */ + metrics->x_scale = FT_MulDiv( metrics->x_ppem, + 64 * 0x10000, + face->header.Units_Per_EM ); + metrics->y_scale = FT_MulDiv( metrics->y_ppem, + 64 * 0x10000, + face->header.Units_Per_EM ); + return error; } From 548704f426a436acd6839816dc595cf0c90ae665 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Wed, 17 May 2017 07:40:50 +0200 Subject: [PATCH 103/470] Code sorting. --- src/autofit/afscript.h | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/autofit/afscript.h b/src/autofit/afscript.h index 7547a9e6f..cb815dbb4 100644 --- a/src/autofit/afscript.h +++ b/src/autofit/afscript.h @@ -187,12 +187,6 @@ HINTING_BOTTOM_TO_TOP, "\xEA\xA4\x8D \xEA\xA4\x80" ) /* ꤍ ꤀ */ - SCRIPT( knda, KNDA, - "Kannada", - HB_SCRIPT_KANNADA, - HINTING_BOTTOM_TO_TOP, - "\xE0\xB3\xA6 \xE0\xB2\xAC" ) /* ೌ ಏ */ - /* only digit zero has a simple shape in the Khmer script */ SCRIPT( khmr, KHMR, "Khmer", @@ -206,6 +200,12 @@ HINTING_BOTTOM_TO_TOP, "\xE1\xA7\xA1 \xE1\xA7\xAA" ) /* ᧥ ᧪ */ + SCRIPT( knda, KNDA, + "Kannada", + HB_SCRIPT_KANNADA, + HINTING_BOTTOM_TO_TOP, + "\xE0\xB3\xA6 \xE0\xB2\xAC" ) /* ೌ ಏ */ + /* only digit zero has a simple shape in the Lao script */ SCRIPT( lao, LAO, "Lao", @@ -330,18 +330,18 @@ HINTING_BOTTOM_TO_TOP, "\xE0\xB1\xA6 \xE0\xB1\xA7" ) /* ์ ๧ */ - SCRIPT( thai, THAI, - "Thai", - HB_SCRIPT_THAI, - HINTING_BOTTOM_TO_TOP, - "\xE0\xB8\xB2 \xE0\xB9\x85 \xE0\xB9\x90" ) /* า ๅ ๐ */ - SCRIPT( tfng, TFNG, "Tifinagh", HB_SCRIPT_TIFINAGH, HINTING_BOTTOM_TO_TOP, "\xE2\xB5\x94" ) /* ⵔ */ + SCRIPT( thai, THAI, + "Thai", + HB_SCRIPT_THAI, + HINTING_BOTTOM_TO_TOP, + "\xE0\xB8\xB2 \xE0\xB9\x85 \xE0\xB9\x90" ) /* า ๅ ๐ */ + SCRIPT( vaii, VAII, "Vai", HB_SCRIPT_VAI, From 881f64475f9e375f10bbd06766edf5003fffc6f2 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Wed, 17 May 2017 07:56:53 +0200 Subject: [PATCH 104/470] [autofit] More code sorting. --- src/autofit/afblue.c | 12 ++++++------ src/autofit/afblue.dat | 20 ++++++++++---------- src/autofit/afblue.h | 10 +++++----- src/autofit/afstyles.h | 28 ++++++++++++++-------------- 4 files changed, 35 insertions(+), 35 deletions(-) diff --git a/src/autofit/afblue.c b/src/autofit/afblue.c index a00c3a076..fedeacf79 100644 --- a/src/autofit/afblue.c +++ b/src/autofit/afblue.c @@ -592,9 +592,6 @@ { AF_BLUE_STRING_KAYAH_LI_DESCENDER, 0 }, { AF_BLUE_STRING_KAYAH_LI_LARGE_DESCENDER, 0 }, { AF_BLUE_STRING_MAX, 0 }, - { AF_BLUE_STRING_KANNADA_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, - { AF_BLUE_STRING_KANNADA_BOTTOM, 0 }, - { AF_BLUE_STRING_MAX, 0 }, { AF_BLUE_STRING_KHMER_TOP, AF_BLUE_PROPERTY_LATIN_TOP | AF_BLUE_PROPERTY_LATIN_X_HEIGHT }, { AF_BLUE_STRING_KHMER_SUBSCRIPT_TOP, AF_BLUE_PROPERTY_LATIN_SUB_TOP }, @@ -606,6 +603,9 @@ AF_BLUE_PROPERTY_LATIN_X_HEIGHT }, { AF_BLUE_STRING_KHMER_SYMBOLS_WANING_BOTTOM, 0 }, { AF_BLUE_STRING_MAX, 0 }, + { AF_BLUE_STRING_KANNADA_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_KANNADA_BOTTOM, 0 }, + { AF_BLUE_STRING_MAX, 0 }, { AF_BLUE_STRING_LAO_TOP, AF_BLUE_PROPERTY_LATIN_TOP | AF_BLUE_PROPERTY_LATIN_X_HEIGHT }, { AF_BLUE_STRING_LAO_BOTTOM, 0 }, @@ -701,6 +701,9 @@ { AF_BLUE_STRING_TELUGU_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, { AF_BLUE_STRING_TELUGU_BOTTOM, 0 }, { AF_BLUE_STRING_MAX, 0 }, + { AF_BLUE_STRING_TIFINAGH, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_TIFINAGH, 0 }, + { AF_BLUE_STRING_MAX, 0 }, { AF_BLUE_STRING_THAI_TOP, AF_BLUE_PROPERTY_LATIN_TOP | AF_BLUE_PROPERTY_LATIN_X_HEIGHT }, { AF_BLUE_STRING_THAI_BOTTOM, 0 }, @@ -710,9 +713,6 @@ { AF_BLUE_STRING_THAI_LARGE_DESCENDER, 0 }, { AF_BLUE_STRING_THAI_DIGIT_TOP, 0 }, { AF_BLUE_STRING_MAX, 0 }, - { AF_BLUE_STRING_TIFINAGH, AF_BLUE_PROPERTY_LATIN_TOP }, - { AF_BLUE_STRING_TIFINAGH, 0 }, - { AF_BLUE_STRING_MAX, 0 }, { AF_BLUE_STRING_VAI_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, { AF_BLUE_STRING_VAI_BOTTOM, 0 }, { AF_BLUE_STRING_MAX, 0 }, diff --git a/src/autofit/afblue.dat b/src/autofit/afblue.dat index 454923e9c..f62eb82a1 100644 --- a/src/autofit/afblue.dat +++ b/src/autofit/afblue.dat @@ -872,11 +872,6 @@ AF_BLUE_STRINGSET_ENUM AF_BLUE_STRINGSETS_ARRAY AF_BLUE_STRINGSET_MAX_LEN: { AF_BLUE_STRING_KAYAH_LI_LARGE_DESCENDER, 0 } { AF_BLUE_STRING_MAX, 0 } - AF_BLUE_STRINGSET_KNDA - { AF_BLUE_STRING_KANNADA_TOP, AF_BLUE_PROPERTY_LATIN_TOP } - { AF_BLUE_STRING_KANNADA_BOTTOM, 0 } - { AF_BLUE_STRING_MAX, 0 } - AF_BLUE_STRINGSET_KHMR { AF_BLUE_STRING_KHMER_TOP, AF_BLUE_PROPERTY_LATIN_TOP | AF_BLUE_PROPERTY_LATIN_X_HEIGHT } @@ -892,6 +887,11 @@ AF_BLUE_STRINGSET_ENUM AF_BLUE_STRINGSETS_ARRAY AF_BLUE_STRINGSET_MAX_LEN: { AF_BLUE_STRING_KHMER_SYMBOLS_WANING_BOTTOM, 0 } { AF_BLUE_STRING_MAX, 0 } + AF_BLUE_STRINGSET_KNDA + { AF_BLUE_STRING_KANNADA_TOP, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_KANNADA_BOTTOM, 0 } + { AF_BLUE_STRING_MAX, 0 } + AF_BLUE_STRINGSET_LAO { AF_BLUE_STRING_LAO_TOP, AF_BLUE_PROPERTY_LATIN_TOP | AF_BLUE_PROPERTY_LATIN_X_HEIGHT } @@ -1027,6 +1027,11 @@ AF_BLUE_STRINGSET_ENUM AF_BLUE_STRINGSETS_ARRAY AF_BLUE_STRINGSET_MAX_LEN: { AF_BLUE_STRING_TELUGU_BOTTOM, 0 } { AF_BLUE_STRING_MAX, 0 } + AF_BLUE_STRINGSET_TFNG + { AF_BLUE_STRING_TIFINAGH, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_TIFINAGH, 0 } + { AF_BLUE_STRING_MAX, 0 } + AF_BLUE_STRINGSET_THAI { AF_BLUE_STRING_THAI_TOP, AF_BLUE_PROPERTY_LATIN_TOP | AF_BLUE_PROPERTY_LATIN_X_HEIGHT } @@ -1038,11 +1043,6 @@ AF_BLUE_STRINGSET_ENUM AF_BLUE_STRINGSETS_ARRAY AF_BLUE_STRINGSET_MAX_LEN: { AF_BLUE_STRING_THAI_DIGIT_TOP, 0 } { AF_BLUE_STRING_MAX, 0 } - AF_BLUE_STRINGSET_TFNG - { AF_BLUE_STRING_TIFINAGH, AF_BLUE_PROPERTY_LATIN_TOP } - { AF_BLUE_STRING_TIFINAGH, 0 } - { AF_BLUE_STRING_MAX, 0 } - AF_BLUE_STRINGSET_VAII { AF_BLUE_STRING_VAI_TOP, AF_BLUE_PROPERTY_LATIN_TOP } { AF_BLUE_STRING_VAI_BOTTOM, 0 } diff --git a/src/autofit/afblue.h b/src/autofit/afblue.h index e227dbf50..99ef51cd4 100644 --- a/src/autofit/afblue.h +++ b/src/autofit/afblue.h @@ -344,9 +344,9 @@ FT_BEGIN_HEADER AF_BLUE_STRINGSET_GURU = 116, AF_BLUE_STRINGSET_HEBR = 122, AF_BLUE_STRINGSET_KALI = 126, - AF_BLUE_STRINGSET_KNDA = 132, - AF_BLUE_STRINGSET_KHMR = 135, - AF_BLUE_STRINGSET_KHMS = 141, + AF_BLUE_STRINGSET_KHMR = 132, + AF_BLUE_STRINGSET_KHMS = 138, + AF_BLUE_STRINGSET_KNDA = 141, AF_BLUE_STRINGSET_LAO = 144, AF_BLUE_STRINGSET_LATN = 150, AF_BLUE_STRINGSET_LATB = 157, @@ -367,8 +367,8 @@ FT_BEGIN_HEADER AF_BLUE_STRINGSET_TAML = 222, AF_BLUE_STRINGSET_TAVT = 225, AF_BLUE_STRINGSET_TELU = 228, - AF_BLUE_STRINGSET_THAI = 231, - AF_BLUE_STRINGSET_TFNG = 239, + AF_BLUE_STRINGSET_TFNG = 231, + AF_BLUE_STRINGSET_THAI = 234, AF_BLUE_STRINGSET_VAII = 242, af_blue_2_1 = 245, #ifdef AF_CONFIG_OPTION_CJK diff --git a/src/autofit/afstyles.h b/src/autofit/afstyles.h index a5e13d894..281559eea 100644 --- a/src/autofit/afstyles.h +++ b/src/autofit/afstyles.h @@ -255,13 +255,6 @@ AF_BLUE_STRINGSET_KALI, AF_COVERAGE_DEFAULT ) - STYLE( knda_dflt, KNDA_DFLT, - "Kannada default style", - AF_WRITING_SYSTEM_LATIN, - AF_SCRIPT_KNDA, - AF_BLUE_STRINGSET_KNDA, - AF_COVERAGE_DEFAULT ) - STYLE( khmr_dflt, KHMR_DFLT, "Khmer default style", AF_WRITING_SYSTEM_LATIN, @@ -276,6 +269,13 @@ AF_BLUE_STRINGSET_KHMS, AF_COVERAGE_DEFAULT ) + STYLE( knda_dflt, KNDA_DFLT, + "Kannada default style", + AF_WRITING_SYSTEM_LATIN, + AF_SCRIPT_KNDA, + AF_BLUE_STRINGSET_KNDA, + AF_COVERAGE_DEFAULT ) + STYLE( lao_dflt, LAO_DFLT, "Lao default style", AF_WRITING_SYSTEM_LATIN, @@ -420,13 +420,6 @@ AF_BLUE_STRINGSET_TELU, AF_COVERAGE_DEFAULT ) - STYLE( thai_dflt, THAI_DFLT, - "Thai default style", - AF_WRITING_SYSTEM_LATIN, - AF_SCRIPT_THAI, - AF_BLUE_STRINGSET_THAI, - AF_COVERAGE_DEFAULT ) - STYLE( tfng_dflt, TFNG_DFLT, "Tifinagh default style", AF_WRITING_SYSTEM_LATIN, @@ -434,6 +427,13 @@ AF_BLUE_STRINGSET_TFNG, AF_COVERAGE_DEFAULT ) + STYLE( thai_dflt, THAI_DFLT, + "Thai default style", + AF_WRITING_SYSTEM_LATIN, + AF_SCRIPT_THAI, + AF_BLUE_STRINGSET_THAI, + AF_COVERAGE_DEFAULT ) + STYLE( vaii_dflt, VAII_DFLT, "Vai default style", AF_WRITING_SYSTEM_LATIN, From ab2599ea3f09ba8da4f50b877021d23241d22609 Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Sat, 20 May 2017 00:35:21 -0400 Subject: [PATCH 105/470] [smooth] Implement minimal dynamic padding for LCD filtering. Extra bitmap padding for LCD filtering depends on the filter. The default 5-tap filter needs 2 extra subpixels. The light 3-tap filter needs only 1 extra subpixel. This space could be already available due to rounding. In order to optimize the padding, we now expand CBox for the given filter weights before rounding. This change breakes current Skia (and Firefox). * include/freetype/internal/ftobjs.h (FT_LibraryRec) [FT_CONFIG_OPTION_SUBPIXEL_RENDERING]: Remove `lcd_extra' field. * src/base/ftlcdfil.c (FT_Library_SetLcdFilterWeights, FT_Library_SetLcdFilter): Remove `lcd_extra' initializations. * src/smooth/ftsmooth.c (ft_smooth_render_generic): Implement dymanic LCD padding. --- ChangeLog | 21 +++++++++++++ include/freetype/internal/ftobjs.h | 4 --- src/base/ftlcdfil.c | 5 ---- src/smooth/ftsmooth.c | 47 +++++++++++++++--------------- 4 files changed, 44 insertions(+), 33 deletions(-) diff --git a/ChangeLog b/ChangeLog index c78412264..5e41f88cc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,24 @@ +2017-05-20 Alexei Podtelezhnikov + + [smooth] Implement minimal dynamic padding for LCD filtering. + + Extra bitmap padding for LCD filtering depends on the filter. The + default 5-tap filter needs 2 extra subpixels. The light 3-tap filter + needs only 1 extra subpixel. This space could be already available + due to rounding. In order to optimize the padding, we now expand + CBox for the given filter weights before rounding. + + This change breakes current Skia (and Firefox). + + * include/freetype/internal/ftobjs.h (FT_LibraryRec) + [FT_CONFIG_OPTION_SUBPIXEL_RENDERING]: Remove `lcd_extra' field. + + * src/base/ftlcdfil.c (FT_Library_SetLcdFilterWeights, + FT_Library_SetLcdFilter): Remove `lcd_extra' initializations. + + * src/smooth/ftsmooth.c (ft_smooth_render_generic): Implement dymanic + LCD padding. + 2017-05-15 Werner Lemberg [sfnt] Return proper scaling values for SBIX bitmaps. diff --git a/include/freetype/internal/ftobjs.h b/include/freetype/internal/ftobjs.h index 06b6597ea..73961b95f 100644 --- a/include/freetype/internal/ftobjs.h +++ b/include/freetype/internal/ftobjs.h @@ -864,9 +864,6 @@ FT_BEGIN_HEADER /* lcd_filter :: If subpixel rendering is activated, the */ /* selected LCD filter mode. */ /* */ - /* lcd_extra :: If subpixel rendering is activated, the number */ - /* of extra pixels needed for the LCD filter. */ - /* */ /* lcd_weights :: If subpixel rendering is activated, the LCD */ /* filter weights, if any. */ /* */ @@ -902,7 +899,6 @@ FT_BEGIN_HEADER #ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING FT_LcdFilter lcd_filter; - FT_Int lcd_extra; /* number of extra pixels */ FT_LcdFiveTapFilter lcd_weights; /* filter weights, if any */ FT_Bitmap_LcdFilterFunc lcd_filter_func; /* filtering callback */ #endif diff --git a/src/base/ftlcdfil.c b/src/base/ftlcdfil.c index 611b39f57..65dbf342e 100644 --- a/src/base/ftlcdfil.c +++ b/src/base/ftlcdfil.c @@ -296,7 +296,6 @@ ft_memcpy( library->lcd_weights, weights, FT_LCD_FILTER_FIVE_TAPS ); library->lcd_filter_func = ft_lcd_filter_fir; - library->lcd_extra = 2; return FT_Err_Ok; } @@ -319,7 +318,6 @@ { case FT_LCD_FILTER_NONE: library->lcd_filter_func = NULL; - library->lcd_extra = 0; break; case FT_LCD_FILTER_DEFAULT: @@ -327,7 +325,6 @@ default_weights, FT_LCD_FILTER_FIVE_TAPS ); library->lcd_filter_func = ft_lcd_filter_fir; - library->lcd_extra = 2; break; case FT_LCD_FILTER_LIGHT: @@ -335,7 +332,6 @@ light_weights, FT_LCD_FILTER_FIVE_TAPS ); library->lcd_filter_func = ft_lcd_filter_fir; - library->lcd_extra = 2; break; #ifdef USE_LEGACY @@ -343,7 +339,6 @@ case FT_LCD_FILTER_LEGACY: case FT_LCD_FILTER_LEGACY1: library->lcd_filter_func = _ft_lcd_filter_legacy; - library->lcd_extra = 0; break; #endif diff --git a/src/smooth/ftsmooth.c b/src/smooth/ftsmooth.c index cd7a87b0f..061d251b1 100644 --- a/src/smooth/ftsmooth.c +++ b/src/smooth/ftsmooth.c @@ -119,7 +119,6 @@ #ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING - FT_Int lcd_extra = 0; FT_LcdFiveTapFilter lcd_weights = { 0 }; FT_Bool have_custom_weight = FALSE; FT_Bitmap_LcdFilterFunc lcd_filter_func = NULL; @@ -147,13 +146,12 @@ { /* * A per-font filter is set. It always uses the default 5-tap - * in-place FIR filter that needs 2 extra pixels. + * in-place FIR filter. */ ft_memcpy( lcd_weights, slot->face->internal->lcd_weights, FT_LCD_FILTER_FIVE_TAPS ); lcd_filter_func = ft_lcd_filter_fir; - lcd_extra = 2; } else { @@ -167,7 +165,6 @@ slot->library->lcd_weights, FT_LCD_FILTER_FIVE_TAPS ); lcd_filter_func = slot->library->lcd_filter_func; - lcd_extra = slot->library->lcd_extra; } #endif /*FT_CONFIG_OPTION_SUBPIXEL_RENDERING */ @@ -196,6 +193,28 @@ /* taking into account the origin shift */ FT_Outline_Get_CBox( outline, &cbox ); +#ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING + /* add minimal padding for LCD filter depending on specific weights */ + if ( lcd_filter_func) + { + if ( hmul ) + { + cbox.xMax += lcd_weights[4] ? 43 + : lcd_weights[3] ? 22 : 0; + cbox.xMin -= lcd_weights[0] ? 43 + : lcd_weights[1] ? 22 : 0; + } + + if ( vmul ) + { + cbox.yMax += lcd_weights[0] ? 43 + : lcd_weights[1] ? 22 : 0; + cbox.yMin -= lcd_weights[4] ? 43 + : lcd_weights[3] ? 22 : 0; + } + } +#endif + cbox.xMin = FT_PIX_FLOOR( cbox.xMin + x_shift ); cbox.yMin = FT_PIX_FLOOR( cbox.yMin + y_shift ); cbox.xMax = FT_PIX_CEIL( cbox.xMax + x_shift ); @@ -225,26 +244,6 @@ if ( vmul ) height *= 3; -#ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING - if ( lcd_filter_func ) - { - if ( hmul ) - { - x_shift += 64 * ( lcd_extra >> 1 ); - x_left -= lcd_extra >> 1; - width += 3 * lcd_extra; - pitch = FT_PAD_CEIL( width, 4 ); - } - - if ( vmul ) - { - y_shift += 64 * ( lcd_extra >> 1 ); - y_top += lcd_extra >> 1; - height += 3 * lcd_extra; - } - } -#endif - /* * XXX: on 16bit system, we return an error for huge bitmap * to prevent an overflow. From a0455468fdb8dd1959596d0c8c8a3ff07ee495a3 Mon Sep 17 00:00:00 2001 From: Nikolaus Waxweiler Date: Sat, 20 May 2017 07:28:46 +0200 Subject: [PATCH 106/470] [truetype] Always use interpreter v35 for B/W rendering (#51051). * src/truetype/ttgload.c (tt_loader_init) [TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL]: Adjust `subpixel_hinting_lean', `grayscale_cleartype', and `vertical_lcd_lean' accordingly. * src/truetype/ttinterp.c (Ins_GETINFO): Updated. (TT_RunIns): Update `backward_compatibility' flag. --- ChangeLog | 12 ++++++++++ src/truetype/ttgload.c | 20 +++++++++++------ src/truetype/ttinterp.c | 20 ++++++++++++----- src/truetype/ttinterp.h | 50 +++++++++++++++++++++++++++-------------- 4 files changed, 73 insertions(+), 29 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5e41f88cc..1f39aefb6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2017-05-20 Nikolaus Waxweiler + + [truetype] Always use interpreter v35 for B/W rendering (#51051). + + * src/truetype/ttgload.c (tt_loader_init) + [TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL]: Adjust + `subpixel_hinting_lean', `grayscale_cleartype', and + `vertical_lcd_lean' accordingly. + + * src/truetype/ttinterp.c (Ins_GETINFO): Updated. + (TT_RunIns): Update `backward_compatibility' flag. + 2017-05-20 Alexei Podtelezhnikov [smooth] Implement minimal dynamic padding for LCD filtering. diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c index 68a9b4ad5..e5a3da37a 100644 --- a/src/truetype/ttgload.c +++ b/src/truetype/ttgload.c @@ -2339,13 +2339,19 @@ #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL if ( driver->interpreter_version == TT_INTERPRETER_VERSION_40 ) { - subpixel_hinting_lean = TRUE; - grayscale_cleartype = !FT_BOOL( load_flags & - FT_LOAD_TARGET_LCD || - load_flags & - FT_LOAD_TARGET_LCD_V ); - exec->vertical_lcd_lean = FT_BOOL( load_flags & - FT_LOAD_TARGET_LCD_V ); + subpixel_hinting_lean = + FT_BOOL( FT_LOAD_TARGET_MODE( load_flags ) != + FT_RENDER_MODE_MONO ); + grayscale_cleartype = + FT_BOOL( subpixel_hinting_lean && + !( ( load_flags & + FT_LOAD_TARGET_LCD ) || + ( load_flags & + FT_LOAD_TARGET_LCD_V ) ) ); + exec->vertical_lcd_lean = + FT_BOOL( subpixel_hinting_lean && + ( load_flags & + FT_LOAD_TARGET_LCD_V ) ); } else { diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c index af31408cb..0c48c2562 100644 --- a/src/truetype/ttinterp.c +++ b/src/truetype/ttinterp.c @@ -7345,7 +7345,7 @@ /* */ /* The only smoothing method FreeType supports unless someone sets */ /* FT_LOAD_TARGET_MONO. */ - if ( ( args[0] & 2048 ) != 0 ) + if ( ( args[0] & 2048 ) != 0 && exc->subpixel_hinting_lean ) K |= 1 << 18; /********************************/ @@ -7589,11 +7589,21 @@ #endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */ #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL - /* Toggle backward compatibility according to what font says, except */ - /* when it's a `tricky' font that heavily relies on the interpreter to */ - /* render glyphs correctly, e.g. DFKai-SB. Backward compatibility */ - /* hacks may break it. */ + /* + * Toggle backward compatibility according to what font wants, except + * when + * + * 1) we have a `tricky' font that heavily relies on the interpreter to + * render glyphs correctly, for example DFKai-SB, or + * 2) FT_RENDER_MODE_MONO (i.e, monochome rendering) is requested. + * + * In those cases, backward compatibility needs to be turned off to get + * correct rendering. The rendering is then completely up to the + * font's programming. + * + */ if ( SUBPIXEL_HINTING_MINIMAL && + exc->subpixel_hinting_lean && !FT_IS_TRICKY( &exc->face->root ) ) exc->backward_compatibility = !( exc->GS.instruct_control & 4 ); else diff --git a/src/truetype/ttinterp.h b/src/truetype/ttinterp.h index 55e472091..abbecfcee 100644 --- a/src/truetype/ttinterp.h +++ b/src/truetype/ttinterp.h @@ -253,23 +253,38 @@ FT_BEGIN_HEADER #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL /* - * Modern TrueType fonts are usually rendered through Microsoft's - * collection of rendering techniques called ClearType (e.g., subpixel - * rendering and subpixel hinting). When ClearType was introduced, most - * fonts were not ready. Microsoft decided to implement a backward - * compatibility mode that employed several simple to complicated - * assumptions and tricks that modified the interpretation of the - * bytecode contained in these fonts to make them look ClearType-y - * somehow. Most (web)fonts that were released since then have come to - * rely on these hacks to render correctly, even some of Microsoft's - * flagship ClearType fonts (Calibri, Cambria, Segoe UI). + * FreeType supports ClearType-like hinting of TrueType fonts through + * the version 40 interpreter. This is achieved through several hacks + * in the base (v35) interpreter, as detailed below. * - * The minimal subpixel hinting code (interpreter version 40) employs a - * small list of font-agnostic hacks to bludgeon non-native-ClearType - * fonts (except tricky ones[1]) into submission. It will not try to - * toggle hacks for specific fonts for performance and complexity - * reasons. The focus is on modern (web)fonts rather than legacy fonts - * that were made for black-and-white rendering. + * ClearType is an umbrella term for several rendering techniques + * employed by Microsoft's various GUI and rendering toolkit + * implementations, most importantly: subpixel rendering for using the + * RGB subpixels of LCDs to approximately triple the perceived + * resolution on the x-axis and subpixel hinting for positioning stems + * on subpixel borders. TrueType programming is explicit, i.e., fonts + * must be programmed to take advantage of ClearType's possibilities. + * + * When ClearType was introduced, it seemed unlikely that all fonts + * would be reprogrammed, so Microsoft decided to implement a backward + * compatibility mode. It employs several simple to complicated + * assumptions and tricks, many of them font-dependent, that modify the + * interpretation of the bytecode contained in these fonts to retrofit + * them into a ClearType-y look. The quality of the results varies. + * Most (web)fonts that were released since then have come to rely on + * these hacks to render correctly, even some of Microsoft's flagship + * fonts (e.g., Calibri, Cambria, Segoe UI). + * + * FreeType's minimal subpixel hinting code (interpreter version 40) + * employs a small list of font-agnostic hacks loosely based on the + * public information available on Microsoft's compatibility mode[2]. + * The focus is on modern (web)fonts rather than legacy fonts that were + * made for monochrome rendering. It will not match ClearType rendering + * exactly. Unlike the `Infinality' code (interpreter version 38) that + * came before, it will not try to toggle hacks for specific fonts for + * performance and complexity reasons. It will fall back to version 35 + * behavior for tricky fonts[1] or when monochrome rendering is + * requested. * * Major hacks * @@ -347,7 +362,8 @@ FT_BEGIN_HEADER * */ - /* Using v40 implies subpixel hinting. Used to detect interpreter */ + /* Using v40 implies subpixel hinting, unless FT_RENDER_MODE_MONO has been + * requested. Used to detect interpreter */ /* version switches. `_lean' to differentiate from the Infinality */ /* `subpixel_hinting', which is managed differently. */ FT_Bool subpixel_hinting_lean; From 082f2faf5007812bac6a1f783c7dcc6f49d761fe Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Wed, 24 May 2017 07:40:46 +0200 Subject: [PATCH 107/470] [bdf, pcf] Support ISO646.1991-IRV character encoding (aka ASCII). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Problem reported by Marek KaĹĄĂ­k , cf. https://bugzilla.redhat.com/show_bug.cgi?id=1451795 * src/bdf/bdfdrivr.c (BDF_Face_Init), src/pcf/pcfdrivr.c (PCF_Face_Init): Implement it. --- ChangeLog | 11 +++++++++++ src/bdf/bdfdrivr.c | 6 +++++- src/pcf/pcfdrivr.c | 6 +++++- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1f39aefb6..4d13109f9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2017-05-24 Werner Lemberg + + [bdf, pcf] Support ISO646.1991-IRV character encoding (aka ASCII). + + Problem reported by Marek KaĹĄĂ­k , cf. + + https://bugzilla.redhat.com/show_bug.cgi?id=1451795 + + * src/bdf/bdfdrivr.c (BDF_Face_Init), src/pcf/pcfdrivr.c + (PCF_Face_Init): Implement it. + 2017-05-20 Nikolaus Waxweiler [truetype] Always use interpreter v35 for B/W rendering (#51051). diff --git a/src/bdf/bdfdrivr.c b/src/bdf/bdfdrivr.c index a2242be01..c0a5a5c50 100644 --- a/src/bdf/bdfdrivr.c +++ b/src/bdf/bdfdrivr.c @@ -545,7 +545,11 @@ THE SOFTWARE. if ( !ft_strcmp( s, "10646" ) || ( !ft_strcmp( s, "8859" ) && !ft_strcmp( face->charset_encoding, "1" ) ) ) - unicode_charmap = 1; + unicode_charmap = 1; + /* another name for ASCII */ + else if ( !ft_strcmp( s, "646.1991" ) && + !ft_strcmp( face->charset_encoding, "IRV" ) ) + unicode_charmap = 1; } { diff --git a/src/pcf/pcfdrivr.c b/src/pcf/pcfdrivr.c index 9f4d36d11..505309416 100644 --- a/src/pcf/pcfdrivr.c +++ b/src/pcf/pcfdrivr.c @@ -387,7 +387,11 @@ THE SOFTWARE. if ( !ft_strcmp( s, "10646" ) || ( !ft_strcmp( s, "8859" ) && !ft_strcmp( face->charset_encoding, "1" ) ) ) - unicode_charmap = 1; + unicode_charmap = 1; + /* another name for ASCII */ + else if ( !ft_strcmp( s, "646.1991" ) && + !ft_strcmp( face->charset_encoding, "IRV" ) ) + unicode_charmap = 1; } } From a9331c0f4d17a86251f7b16343af03e8055191af Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sat, 27 May 2017 15:50:25 +0200 Subject: [PATCH 108/470] [truetype] Fix handling of design coordinates (#51127). * src/truetype/ttgxvar.c (tt_set_mm_blend): Compute all design coordinates if we have to create the `blends->coord' array. (TT_Get_MM_Blend, TT_Get_Var_Design): Select default instance coordinates if no instance is selected yet. --- ChangeLog | 9 +++++++++ src/truetype/ttgxvar.c | 28 +++++++++++++++++++++++++--- 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4d13109f9..f4f64d1c3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2017-05-27 Werner Lemberg + + [truetype] Fix handling of design coordinates (#51127). + + * src/truetype/ttgxvar.c (tt_set_mm_blend): Compute all design + coordinates if we have to create the `blends->coord' array. + (TT_Get_MM_Blend, TT_Get_Var_Design): Select default instance + coordinates if no instance is selected yet. + 2017-05-24 Werner Lemberg [bdf, pcf] Support ISO646.1991-IRV character encoding (aka ASCII). diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c index 0cedb6bdf..16a2e56ba 100644 --- a/src/truetype/ttgxvar.c +++ b/src/truetype/ttgxvar.c @@ -2281,7 +2281,10 @@ GX_Blend blend; FT_MM_Var* mmvar; FT_UInt i, j; - FT_Bool is_default_instance = 1; + + FT_Bool is_default_instance = TRUE; + FT_Bool all_design_coords = FALSE; + FT_Memory memory = face->root.memory; enum @@ -2327,7 +2330,7 @@ } if ( coords[i] != 0 ) - is_default_instance = 0; + is_default_instance = FALSE; } FT_TRACE5(( "\n" )); @@ -2340,6 +2343,9 @@ { if ( FT_NEW_ARRAY( blend->coords, mmvar->num_axis ) ) goto Exit; + + /* the first time we have to compute all design coordinates */ + all_design_coords = TRUE; } if ( !blend->normalizedcoords ) @@ -2388,7 +2394,7 @@ if ( set_design_coords ) ft_var_to_design( face, - num_coords, + all_design_coords ? blend->num_axis : num_coords, blend->normalizedcoords, blend->coords ); @@ -2529,6 +2535,14 @@ blend = face->blend; + if ( !blend->coords ) + { + /* select default instance coordinates */ + /* if no instance is selected yet */ + if ( FT_SET_ERROR( tt_set_mm_blend( face, 0, NULL, 1 ) ) ) + return error; + } + nc = num_coords; if ( num_coords > blend->num_axis ) { @@ -2686,6 +2700,14 @@ blend = face->blend; + if ( !blend->coords ) + { + /* select default instance coordinates */ + /* if no instance is selected yet */ + if ( FT_SET_ERROR( tt_set_mm_blend( face, 0, NULL, 1 ) ) ) + return error; + } + nc = num_coords; if ( num_coords > blend->num_axis ) { From 93572190822160f0671b32000ea6a01d9a0ffd07 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sun, 28 May 2017 07:20:09 +0200 Subject: [PATCH 109/470] Fix negation of INT_MIN and LONG_MIN (#46149). * src/base/ftcalc.c (FT_MOVE_SIGN): Add argument to pass unsigned value, to be used as the result. (FT_MulDiv, FT_MulDiv_No_Round, FT_DivFix, FT_MulFix, FT_Vector_NormLen): Updated. --- ChangeLog | 9 ++++++ src/base/ftcalc.c | 73 ++++++++++++++++++++++++----------------------- 2 files changed, 46 insertions(+), 36 deletions(-) diff --git a/ChangeLog b/ChangeLog index f4f64d1c3..feb14f71a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2017-05-28 Werner Lemberg + + Fix negation of INT_MIN and LONG_MIN (#46149). + + * src/base/ftcalc.c (FT_MOVE_SIGN): Add argument to pass unsigned + value, to be used as the result. + (FT_MulDiv, FT_MulDiv_No_Round, FT_DivFix, FT_MulFix, + FT_Vector_NormLen): Updated. + 2017-05-27 Werner Lemberg [truetype] Fix handling of design coordinates (#51127). diff --git a/src/base/ftcalc.c b/src/base/ftcalc.c index f0525502f..b4b66e402 100644 --- a/src/base/ftcalc.c +++ b/src/base/ftcalc.c @@ -68,14 +68,15 @@ #define FT_COMPONENT trace_calc - /* transfer sign leaving a positive number */ -#define FT_MOVE_SIGN( x, s ) \ - FT_BEGIN_STMNT \ - if ( x < 0 ) \ - { \ - x = -x; \ - s = -s; \ - } \ + /* transfer sign, leaving a positive number; */ + /* we need an unsigned value to safely negate INT_MIN (or LONG_MIN) */ +#define FT_MOVE_SIGN( x, x_unsigned, s ) \ + FT_BEGIN_STMNT \ + if ( x < 0 ) \ + { \ + x_unsigned = -x_unsigned; \ + s = -s; \ + } \ FT_END_STMNT /* The following three functions are available regardless of whether */ @@ -179,14 +180,14 @@ FT_Long d_; - FT_MOVE_SIGN( a_, s ); - FT_MOVE_SIGN( b_, s ); - FT_MOVE_SIGN( c_, s ); - a = (FT_UInt64)a_; b = (FT_UInt64)b_; c = (FT_UInt64)c_; + FT_MOVE_SIGN( a_, a, s ); + FT_MOVE_SIGN( b_, b, s ); + FT_MOVE_SIGN( c_, c, s ); + d = c > 0 ? ( a * b + ( c >> 1 ) ) / c : 0x7FFFFFFFUL; @@ -208,14 +209,14 @@ FT_Long d_; - FT_MOVE_SIGN( a_, s ); - FT_MOVE_SIGN( b_, s ); - FT_MOVE_SIGN( c_, s ); - a = (FT_UInt64)a_; b = (FT_UInt64)b_; c = (FT_UInt64)c_; + FT_MOVE_SIGN( a_, a, s ); + FT_MOVE_SIGN( b_, b, s ); + FT_MOVE_SIGN( c_, c, s ); + d = c > 0 ? a * b / c : 0x7FFFFFFFUL; @@ -257,12 +258,12 @@ FT_Long q_; - FT_MOVE_SIGN( a_, s ); - FT_MOVE_SIGN( b_, s ); - a = (FT_UInt64)a_; b = (FT_UInt64)b_; + FT_MOVE_SIGN( a_, a, s ); + FT_MOVE_SIGN( b_, a, s ); + q = b > 0 ? ( ( a << 16 ) + ( b >> 1 ) ) / b : 0x7FFFFFFFUL; @@ -422,14 +423,14 @@ /* XXX: this function does not allow 64-bit arguments */ - FT_MOVE_SIGN( a_, s ); - FT_MOVE_SIGN( b_, s ); - FT_MOVE_SIGN( c_, s ); - a = (FT_UInt32)a_; b = (FT_UInt32)b_; c = (FT_UInt32)c_; + FT_MOVE_SIGN( a_, a, s ); + FT_MOVE_SIGN( b_, b, s ); + FT_MOVE_SIGN( c_, c, s ); + if ( c == 0 ) a = 0x7FFFFFFFUL; @@ -470,14 +471,14 @@ /* XXX: this function does not allow 64-bit arguments */ - FT_MOVE_SIGN( a_, s ); - FT_MOVE_SIGN( b_, s ); - FT_MOVE_SIGN( c_, s ); - a = (FT_UInt32)a_; b = (FT_UInt32)b_; c = (FT_UInt32)c_; + FT_MOVE_SIGN( a_, a, s ); + FT_MOVE_SIGN( b_, b, s ); + FT_MOVE_SIGN( c_, c, s ); + if ( c == 0 ) a = 0x7FFFFFFFUL; @@ -575,12 +576,12 @@ /* XXX: this function does not allow 64-bit arguments */ - FT_MOVE_SIGN( a_, s ); - FT_MOVE_SIGN( b_, s ); - a = (FT_UInt32)a_; b = (FT_UInt32)b_; + FT_MOVE_SIGN( a_, a, s ); + FT_MOVE_SIGN( b_, b, s ); + if ( a + ( b >> 8 ) <= 8190UL ) a = ( a * b + 0x8000UL ) >> 16; else @@ -614,12 +615,12 @@ /* XXX: this function does not allow 64-bit arguments */ - FT_MOVE_SIGN( a_, s ); - FT_MOVE_SIGN( b_, s ); - a = (FT_UInt32)a_; b = (FT_UInt32)b_; + FT_MOVE_SIGN( a_, a, s ); + FT_MOVE_SIGN( b_, b, s ); + if ( b == 0 ) { /* check for division by 0 */ @@ -770,12 +771,12 @@ FT_Int sx = 1, sy = 1, shift; - FT_MOVE_SIGN( x_, sx ); - FT_MOVE_SIGN( y_, sy ); - x = (FT_UInt32)x_; y = (FT_UInt32)y_; + FT_MOVE_SIGN( x_, x, sx ); + FT_MOVE_SIGN( y_, y, sy ); + /* trivial cases */ if ( x == 0 ) { From 2e4188d83364219d0ff3a207fa7d3980844dded4 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sun, 28 May 2017 07:46:22 +0200 Subject: [PATCH 110/470] [cff] s/cf2_floatToFixed/cf2_doubleToFixed/. The new name better describes what the macro actually does; additionally, we don't need a trailing `f' for literals (there was only a single such instance in the code, but this caused a clang warning because the macro itself uses `double' literals). * src/cff/cf2blues.c, src/cff/cf2blues.h, src/cff/cf2fixed.h, src/cff/cf2font.c, src/cff/cf2hints.c: Updated. --- ChangeLog | 12 ++++++++++++ src/cff/cf2blues.c | 4 ++-- src/cff/cf2blues.h | 2 +- src/cff/cf2fixed.h | 2 +- src/cff/cf2font.c | 2 +- src/cff/cf2hints.c | 18 +++++++++--------- 6 files changed, 26 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index feb14f71a..5ba0f51c4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2017-05-28 Werner Lemberg + + [cff] s/cf2_floatToFixed/cf2_doubleToFixed/. + + The new name better describes what the macro actually does; + additionally, we don't need a trailing `f' for literals (there was + only a single such instance in the code, but this caused a clang + warning because the macro itself uses `double' literals). + + * src/cff/cf2blues.c, src/cff/cf2blues.h, src/cff/cf2fixed.h, + src/cff/cf2font.c, src/cff/cf2hints.c: Updated. + 2017-05-28 Werner Lemberg Fix negation of INT_MIN and LONG_MIN (#46149). diff --git a/src/cff/cf2blues.c b/src/cff/cf2blues.c index 250f89e0d..141d0fcae 100644 --- a/src/cff/cf2blues.c +++ b/src/cff/cf2blues.c @@ -408,8 +408,8 @@ /* Note: constant changed from 0.5 to 0.6 to avoid a problem with */ /* 10ppem Arial */ - blues->boost = cf2_floatToFixed( .6 ) - - FT_MulDiv( cf2_floatToFixed ( .6 ), + blues->boost = cf2_doubleToFixed( .6 ) - + FT_MulDiv( cf2_doubleToFixed ( .6 ), blues->scale, blues->blueScale ); if ( blues->boost > 0x7FFF ) diff --git a/src/cff/cf2blues.h b/src/cff/cf2blues.h index 96fb60f38..a6bcd9de5 100644 --- a/src/cff/cf2blues.h +++ b/src/cff/cf2blues.h @@ -111,7 +111,7 @@ FT_BEGIN_HEADER * Constant used for hint adjustment and for synthetic em box hint * placement. */ -#define CF2_MIN_COUNTER cf2_floatToFixed( 0.5 ) +#define CF2_MIN_COUNTER cf2_doubleToFixed( 0.5 ) /* shared typedef is in cf2glue.h */ diff --git a/src/cff/cf2fixed.h b/src/cff/cf2fixed.h index 2e4b5032f..d8e695b15 100644 --- a/src/cff/cf2fixed.h +++ b/src/cff/cf2fixed.h @@ -63,7 +63,7 @@ FT_BEGIN_HEADER ( (FT_Short)( ( (FT_UInt32)(x) + 0x8000U ) >> 16 ) ) #define cf2_fixedRound( x ) \ ( (CF2_Fixed)( ( (FT_UInt32)(x) + 0x8000U ) & 0xFFFF0000UL ) ) -#define cf2_floatToFixed( f ) \ +#define cf2_doubleToFixed( f ) \ ( (CF2_Fixed)( (f) * 65536.0 + 0.5 ) ) #define cf2_fixedAbs( x ) \ ( (x) < 0 ? -(x) : (x) ) diff --git a/src/cff/cf2font.c b/src/cff/cf2font.c index a86e3619b..25514373b 100644 --- a/src/cff/cf2font.c +++ b/src/cff/cf2font.c @@ -117,7 +117,7 @@ return; /* protect against range problems and divide by zero */ - if ( emRatio < cf2_floatToFixed( .01 ) ) + if ( emRatio < cf2_doubleToFixed( .01 ) ) return; if ( stemDarkened ) diff --git a/src/cff/cf2hints.c b/src/cff/cf2hints.c index c8f7dfeba..a6fcef44d 100644 --- a/src/cff/cf2hints.c +++ b/src/cff/cf2hints.c @@ -1063,7 +1063,7 @@ cf2_fixedAbs( glyphpath->yOffset ) ); /* .1 character space unit */ - glyphpath->snapThreshold = cf2_floatToFixed( 0.1f ); + glyphpath->snapThreshold = cf2_doubleToFixed( 0.1 ); glyphpath->moveIsPending = TRUE; glyphpath->pathIsOpen = FALSE; @@ -1489,9 +1489,9 @@ else { /* +x +y */ - *x = FT_MulFix( cf2_floatToFixed( 0.7 ), + *x = FT_MulFix( cf2_doubleToFixed( 0.7 ), glyphpath->xOffset ); - *y = FT_MulFix( cf2_floatToFixed( 1.0 - 0.7 ), + *y = FT_MulFix( cf2_doubleToFixed( 1.0 - 0.7 ), glyphpath->yOffset ); } } @@ -1514,9 +1514,9 @@ else { /* +x -y */ - *x = FT_MulFix( cf2_floatToFixed( -0.7 ), + *x = FT_MulFix( cf2_doubleToFixed( -0.7 ), glyphpath->xOffset ); - *y = FT_MulFix( cf2_floatToFixed( 1.0 - 0.7 ), + *y = FT_MulFix( cf2_doubleToFixed( 1.0 - 0.7 ), glyphpath->yOffset ); } } @@ -1542,9 +1542,9 @@ else { /* -x +y */ - *x = FT_MulFix( cf2_floatToFixed( 0.7 ), + *x = FT_MulFix( cf2_doubleToFixed( 0.7 ), glyphpath->xOffset ); - *y = FT_MulFix( cf2_floatToFixed( 1.0 + 0.7 ), + *y = FT_MulFix( cf2_doubleToFixed( 1.0 + 0.7 ), glyphpath->yOffset ); } } @@ -1567,9 +1567,9 @@ else { /* -x -y */ - *x = FT_MulFix( cf2_floatToFixed( -0.7 ), + *x = FT_MulFix( cf2_doubleToFixed( -0.7 ), glyphpath->xOffset ); - *y = FT_MulFix( cf2_floatToFixed( 1.0 + 0.7 ), + *y = FT_MulFix( cf2_doubleToFixed( 1.0 + 0.7 ), glyphpath->yOffset ); } } From 9d04fa7015aa1b14e906a1599d09280ab9938874 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sun, 28 May 2017 07:57:24 +0200 Subject: [PATCH 111/470] * include/freetype/internal/ftcalc.h (FLOAT_TO_FIXED): Remove. This macro is not used. --- ChangeLog | 6 ++++++ include/freetype/internal/ftcalc.h | 1 - 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 5ba0f51c4..5d7c7d82f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2017-05-28 Werner Lemberg + + * include/freetype/internal/ftcalc.h (FLOAT_TO_FIXED): Remove. + + This macro is not used. + 2017-05-28 Werner Lemberg [cff] s/cf2_floatToFixed/cf2_doubleToFixed/. diff --git a/include/freetype/internal/ftcalc.h b/include/freetype/internal/ftcalc.h index c9ac9d824..df6c3766d 100644 --- a/include/freetype/internal/ftcalc.h +++ b/include/freetype/internal/ftcalc.h @@ -403,7 +403,6 @@ FT_BEGIN_HEADER #define INT_TO_F2DOT14( x ) ( (FT_Long)(x) << 14 ) #define INT_TO_FIXED( x ) ( (FT_Long)(x) << 16 ) #define F2DOT14_TO_FIXED( x ) ( (FT_Long)(x) << 2 ) -#define FLOAT_TO_FIXED( x ) ( (FT_Long)( x * 65536.0 ) ) #define FIXED_TO_INT( x ) ( FT_RoundFix( x ) >> 16 ) #define ROUND_F26DOT6( x ) ( x >= 0 ? ( ( (x) + 32 ) & -64 ) \ From fbe2fe4c7513246a666fb0cffffd29e7f6f3af4b Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Mon, 29 May 2017 13:29:28 +0200 Subject: [PATCH 112/470] Handle some integer overflow run-time errors (#46149, #48979). This commit (mainly for 32bit CPUs) is the first of a series of similar commits to handle known integer overflows. Basically, all of them are harmless, since they affect rendering of glyphs only, not posing security threats. It is expected that fuzzying will show up more overflows, to be fixed in due course. The idea is to mark places where overflows can occur, using macros that simply cast to unsigned integers, because overflow arithmetic is well defined in this case. Doing so suppresses run-time errors of sanitizers without adding computational overhead. * include/freetype/internal/ftcalc.h (OVERFLOW_ADD_INT, OVERFLOW_SUB_INT, OVERFLOW_MUL_INT, OVERFLOW_ADD_LONG, OVERFLOW_SUB_LONG, OVERFLOW_MUL_LONG): New macros. * src/base/ftcalc.c (FT_RoundFix, FT_CeilFix, FT_Matrix_Multiply, FT_Matrix_Multiply_Scaled, FT_Vector_Transform_Scaled, ft_corner_orientation): Use new macros. * src/base/ftoutln.c (FT_Outline_Get_Orientation): Use new macros. --- ChangeLog | 25 ++++++++++++ include/freetype/freetype.h | 6 +++ include/freetype/ftglyph.h | 3 ++ include/freetype/internal/ftcalc.h | 23 +++++++++++ src/base/ftcalc.c | 64 ++++++++++++++++++------------ src/base/ftoutln.c | 4 +- 6 files changed, 99 insertions(+), 26 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5d7c7d82f..7a9244ef9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,28 @@ +2017-05-29 Werner Lemberg + + Handle some integer overflow run-time errors (#46149, #48979). + + This commit (mainly for 32bit CPUs) is the first of a series of + similar commits to handle known integer overflows. Basically, all + of them are harmless, since they affect rendering of glyphs only, + not posing security threats. It is expected that fuzzying will show + up more overflows, to be fixed in due course. + + The idea is to mark places where overflows can occur, using macros + that simply cast to unsigned integers, because overflow arithmetic + is well defined in this case. Doing so suppresses run-time errors + of sanitizers without adding computational overhead. + + * include/freetype/internal/ftcalc.h (OVERFLOW_ADD_INT, + OVERFLOW_SUB_INT, OVERFLOW_MUL_INT, OVERFLOW_ADD_LONG, + OVERFLOW_SUB_LONG, OVERFLOW_MUL_LONG): New macros. + + * src/base/ftcalc.c (FT_RoundFix, FT_CeilFix, FT_Matrix_Multiply, + FT_Matrix_Multiply_Scaled, FT_Vector_Transform_Scaled, + ft_corner_orientation): Use new macros. + + * src/base/ftoutln.c (FT_Outline_Get_Orientation): Use new macros. + 2017-05-28 Werner Lemberg * include/freetype/internal/ftcalc.h (FLOAT_TO_FIXED): Remove. diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h index 2989fbb5e..bd7f6a3fb 100644 --- a/include/freetype/freetype.h +++ b/include/freetype/freetype.h @@ -4327,6 +4327,9 @@ FT_BEGIN_HEADER /* `a' rounded to the nearest 16.16 fixed integer, halfway cases away */ /* from zero. */ /* */ + /* */ + /* The function uses wrap-around arithmetic. */ + /* */ FT_EXPORT( FT_Fixed ) FT_RoundFix( FT_Fixed a ); @@ -4345,6 +4348,9 @@ FT_BEGIN_HEADER /* */ /* `a' rounded towards plus infinity. */ /* */ + /* */ + /* The function uses wrap-around arithmetic. */ + /* */ FT_EXPORT( FT_Fixed ) FT_CeilFix( FT_Fixed a ); diff --git a/include/freetype/ftglyph.h b/include/freetype/ftglyph.h index 79879a7ac..5869bc1ce 100644 --- a/include/freetype/ftglyph.h +++ b/include/freetype/ftglyph.h @@ -566,6 +566,9 @@ FT_BEGIN_HEADER /* */ /* The result is undefined if either `a' or `b' is zero. */ /* */ + /* Since the function uses wrap-around arithmetic, results become */ + /* meaningless if the arguments are very large. */ + /* */ FT_EXPORT( void ) FT_Matrix_Multiply( const FT_Matrix* a, FT_Matrix* b ); diff --git a/include/freetype/internal/ftcalc.h b/include/freetype/internal/ftcalc.h index df6c3766d..1cd32c892 100644 --- a/include/freetype/internal/ftcalc.h +++ b/include/freetype/internal/ftcalc.h @@ -408,6 +408,29 @@ FT_BEGIN_HEADER #define ROUND_F26DOT6( x ) ( x >= 0 ? ( ( (x) + 32 ) & -64 ) \ : ( -( ( 32 - (x) ) & -64 ) ) ) + /* + * The following macros have two purposes. + * + * . Tag places where overflow is expected and harmless. + * + * . Avoid run-time sanitizer errors. + * + * Use with care! + */ +#define OVERFLOW_ADD_INT( a, b ) \ + (FT_Int)( (FT_UInt)(a) + (FT_UInt)(b) ) +#define OVERFLOW_SUB_INT( a, b ) \ + (FT_Int)( (FT_UInt)(a) - (FT_UInt)(b) ) +#define OVERFLOW_MUL_INT( a, b ) \ + (FT_Int)( (FT_UInt)(a) * (FT_UInt)(b) ) + +#define OVERFLOW_ADD_LONG( a, b ) \ + (FT_Long)( (FT_ULong)(a) + (FT_ULong)(b) ) +#define OVERFLOW_SUB_LONG( a, b ) \ + (FT_Long)( (FT_ULong)(a) - (FT_ULong)(b) ) +#define OVERFLOW_MUL_LONG( a, b ) \ + (FT_Long)( (FT_ULong)(a) * (FT_ULong)(b) ) + FT_END_HEADER diff --git a/src/base/ftcalc.c b/src/base/ftcalc.c index b4b66e402..bc1c47ff1 100644 --- a/src/base/ftcalc.c +++ b/src/base/ftcalc.c @@ -87,7 +87,8 @@ FT_EXPORT_DEF( FT_Fixed ) FT_RoundFix( FT_Fixed a ) { - return ( a + 0x8000L - ( a < 0 ) ) & ~0xFFFFL; + return ( OVERFLOW_ADD_LONG( a, + 0x8000L - ( a < 0 ) ) ) & ~0xFFFFL; } @@ -96,7 +97,7 @@ FT_EXPORT_DEF( FT_Fixed ) FT_CeilFix( FT_Fixed a ) { - return ( a + 0xFFFFL ) & ~0xFFFFL; + return ( OVERFLOW_ADD_LONG( a, 0xFFFFL ) ) & ~0xFFFFL; } @@ -667,13 +668,19 @@ if ( !a || !b ) return; - xx = FT_MulFix( a->xx, b->xx ) + FT_MulFix( a->xy, b->yx ); - xy = FT_MulFix( a->xx, b->xy ) + FT_MulFix( a->xy, b->yy ); - yx = FT_MulFix( a->yx, b->xx ) + FT_MulFix( a->yy, b->yx ); - yy = FT_MulFix( a->yx, b->xy ) + FT_MulFix( a->yy, b->yy ); - - b->xx = xx; b->xy = xy; - b->yx = yx; b->yy = yy; + xx = OVERFLOW_ADD_LONG( FT_MulFix( a->xx, b->xx ), + FT_MulFix( a->xy, b->yx ) ); + xy = OVERFLOW_ADD_LONG( FT_MulFix( a->xx, b->xy ), + FT_MulFix( a->xy, b->yy ) ); + yx = OVERFLOW_ADD_LONG( FT_MulFix( a->yx, b->xx ), + FT_MulFix( a->yy, b->yx ) ); + yy = OVERFLOW_ADD_LONG( FT_MulFix( a->yx, b->xy ), + FT_MulFix( a->yy, b->yy ) ); + + b->xx = xx; + b->xy = xy; + b->yx = yx; + b->yy = yy; } @@ -723,13 +730,19 @@ if ( !a || !b ) return; - xx = FT_MulDiv( a->xx, b->xx, val ) + FT_MulDiv( a->xy, b->yx, val ); - xy = FT_MulDiv( a->xx, b->xy, val ) + FT_MulDiv( a->xy, b->yy, val ); - yx = FT_MulDiv( a->yx, b->xx, val ) + FT_MulDiv( a->yy, b->yx, val ); - yy = FT_MulDiv( a->yx, b->xy, val ) + FT_MulDiv( a->yy, b->yy, val ); - - b->xx = xx; b->xy = xy; - b->yx = yx; b->yy = yy; + xx = OVERFLOW_ADD_LONG( FT_MulDiv( a->xx, b->xx, val ), + FT_MulDiv( a->xy, b->yx, val ) ); + xy = OVERFLOW_ADD_LONG( FT_MulDiv( a->xx, b->xy, val ), + FT_MulDiv( a->xy, b->yy, val ) ); + yx = OVERFLOW_ADD_LONG( FT_MulDiv( a->yx, b->xx, val ), + FT_MulDiv( a->yy, b->yx, val ) ); + yy = OVERFLOW_ADD_LONG( FT_MulDiv( a->yx, b->xy, val ), + FT_MulDiv( a->yy, b->yy, val ) ); + + b->xx = xx; + b->xy = xy; + b->yx = yx; + b->yy = yy; } @@ -748,11 +761,10 @@ if ( !vector || !matrix ) return; - xz = FT_MulDiv( vector->x, matrix->xx, val ) + - FT_MulDiv( vector->y, matrix->xy, val ); - - yz = FT_MulDiv( vector->x, matrix->yx, val ) + - FT_MulDiv( vector->y, matrix->yy, val ); + xz = OVERFLOW_ADD_LONG( FT_MulDiv( vector->x, matrix->xx, val ), + FT_MulDiv( vector->y, matrix->xy, val ) ); + yz = OVERFLOW_ADD_LONG( FT_MulDiv( vector->x, matrix->yx, val ), + FT_MulDiv( vector->y, matrix->yy, val ) ); vector->x = xz; vector->y = yz; @@ -914,11 +926,13 @@ FT_Int result; - if ( (FT_ULong)FT_ABS( in_x ) + (FT_ULong)FT_ABS( out_y ) <= 131071UL && - (FT_ULong)FT_ABS( in_y ) + (FT_ULong)FT_ABS( out_x ) <= 131071UL ) + /* we silently ignore overflow errors, since such large values */ + /* lead to even more (harmless) rendering errors later on */ + if ( OVERFLOW_ADD_LONG( FT_ABS( in_x ), FT_ABS( out_y ) ) <= 131071L && + OVERFLOW_ADD_LONG( FT_ABS( in_y ), FT_ABS( out_x ) ) <= 131071L ) { - FT_Long z1 = in_x * out_y; - FT_Long z2 = in_y * out_x; + FT_Long z1 = OVERFLOW_MUL_LONG( in_x, out_y ); + FT_Long z2 = OVERFLOW_MUL_LONG( in_y, out_x ); if ( z1 > z2 ) diff --git a/src/base/ftoutln.c b/src/base/ftoutln.c index 464a066dc..794ddbc47 100644 --- a/src/base/ftoutln.c +++ b/src/base/ftoutln.c @@ -1088,7 +1088,9 @@ v_cur.x = points[n].x >> xshift; v_cur.y = points[n].y >> yshift; - area += ( v_cur.y - v_prev.y ) * ( v_cur.x + v_prev.x ); + area = OVERFLOW_ADD_LONG( + area, + ( v_cur.y - v_prev.y ) * ( v_cur.x + v_prev.x ) ); v_prev = v_cur; } From f01463297f3d5db9cdfa59df4714c68bbef16e89 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Mon, 29 May 2017 21:04:27 +0200 Subject: [PATCH 113/470] [pcf] 32bit integer overflow run-time errors (#46149). * src/pcf/pcfread.c (pcf_get_accel): Add sanity checks for `fontAscent' and `fontDescent'. (pcf_load_font): Add sanity checks for global height. Add sanity checks for AVERAGE_WIDTH, POINT_SIZE, PIXEL_SIZE, RESOLUTION_X, and RESOLUTION_Y properties. --- ChangeLog | 10 ++++++ src/pcf/pcfread.c | 78 +++++++++++++++++++++++++++++++++++++++++------ 2 files changed, 79 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7a9244ef9..8a6667721 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2017-05-29 Werner Lemberg + + [pcf] 32bit integer overflow run-time errors (#46149). + + * src/pcf/pcfread.c (pcf_get_accel): Add sanity checks for + `fontAscent' and `fontDescent'. + (pcf_load_font): Add sanity checks for global height. + Add sanity checks for AVERAGE_WIDTH, POINT_SIZE, PIXEL_SIZE, + RESOLUTION_X, and RESOLUTION_Y properties. + 2017-05-29 Werner Lemberg Handle some integer overflow run-time errors (#46149, #48979). diff --git a/src/pcf/pcfread.c b/src/pcf/pcfread.c index 3eacf2baf..da216b05f 100644 --- a/src/pcf/pcfread.c +++ b/src/pcf/pcfread.c @@ -1162,6 +1162,20 @@ THE SOFTWARE. accel->fontDescent, accel->maxOverlap )); + /* sanity checks */ + if ( FT_ABS( accel->fontAscent ) > 0x7FFF ) + { + accel->fontAscent = accel->fontAscent < 0 ? -0x7FFF : 0x7FFF; + FT_TRACE0(( "pfc_get_accel: clamping font ascent to value %d\n", + accel->fontAscent )); + } + if ( FT_ABS( accel->fontDescent ) > 0x7FFF ) + { + accel->fontDescent = accel->fontDescent < 0 ? -0x7FFF : 0x7FFF; + FT_TRACE0(( "pfc_get_accel: clamping font descent to value %d\n", + accel->fontDescent )); + } + FT_TRACE5(( " minbounds:" )); error = pcf_get_metric( stream, format & ( ~PCF_FORMAT_MASK ), @@ -1496,8 +1510,16 @@ THE SOFTWARE. if ( face->accel.fontAscent + face->accel.fontDescent < 0 ) FT_TRACE0(( "pcf_load_font: negative height\n" )); #endif - bsize->height = FT_ABS( (FT_Short)( face->accel.fontAscent + - face->accel.fontDescent ) ); + if ( FT_ABS( face->accel.fontAscent + + face->accel.fontDescent ) > 0x7FFF ) + { + bsize->height = 0x7FFF; + FT_TRACE0(( "pcf_load_font: clamping height to value %d\n", + bsize->height )); + } + else + bsize->height = FT_ABS( (FT_Short)( face->accel.fontAscent + + face->accel.fontDescent ) ); prop = pcf_find_property( face, "AVERAGE_WIDTH" ); if ( prop ) @@ -1506,10 +1528,20 @@ THE SOFTWARE. if ( prop->value.l < 0 ) FT_TRACE0(( "pcf_load_font: negative average width\n" )); #endif - bsize->width = FT_ABS( (FT_Short)( ( prop->value.l ) + 5 ) / 10 ); + if ( ( FT_ABS( prop->value.l ) > 0x7FFFL * 10 - 5 ) ) + { + bsize->width = 0x7FFF; + FT_TRACE0(( "pcf_load_font: clamping average width to value %d\n", + bsize->width )); + } + else + bsize->width = FT_ABS( (FT_Short)( ( prop->value.l + 5 ) / 10 ) ); } else + { + /* this is a heuristical value */ bsize->width = (FT_Short)FT_MulDiv( bsize->height, 2, 3 ); + } prop = pcf_find_property( face, "POINT_SIZE" ); if ( prop ) @@ -1519,9 +1551,16 @@ THE SOFTWARE. FT_TRACE0(( "pcf_load_font: negative point size\n" )); #endif /* convert from 722.7 decipoints to 72 points per inch */ - bsize->size = FT_MulDiv( FT_ABS( prop->value.l ), - 64 * 7200, - 72270L ); + if ( FT_ABS( prop->value.l ) > 0x504C2L ) /* 0x7FFF * 72270/7200 */ + { + bsize->size = 0x7FFF; + FT_TRACE0(( "pcf_load_font: clamping point size to value %d\n", + bsize->size )); + } + else + bsize->size = FT_MulDiv( FT_ABS( prop->value.l ), + 64 * 7200, + 72270L ); } prop = pcf_find_property( face, "PIXEL_SIZE" ); @@ -1531,7 +1570,14 @@ THE SOFTWARE. if ( prop->value.l < 0 ) FT_TRACE0(( "pcf_load_font: negative pixel size\n" )); #endif - bsize->y_ppem = FT_ABS( (FT_Short)prop->value.l ) << 6; + if ( FT_ABS( prop->value.l ) > 0x7FFF ) + { + bsize->y_ppem = 0x7FFF << 6; + FT_TRACE0(( "pcf_load_font: clamping pixel size to value %d\n", + bsize->y_ppem )); + } + else + bsize->y_ppem = FT_ABS( (FT_Short)prop->value.l ) << 6; } prop = pcf_find_property( face, "RESOLUTION_X" ); @@ -1541,7 +1587,14 @@ THE SOFTWARE. if ( prop->value.l < 0 ) FT_TRACE0(( "pcf_load_font: negative X resolution\n" )); #endif - resolution_x = FT_ABS( (FT_Short)prop->value.l ); + if ( FT_ABS( prop->value.l ) > 0x7FFF ) + { + resolution_x = 0x7FFF; + FT_TRACE0(( "pcf_load_font: clamping X resolution to value %d\n", + resolution_x )); + } + else + resolution_x = FT_ABS( (FT_Short)prop->value.l ); } prop = pcf_find_property( face, "RESOLUTION_Y" ); @@ -1551,7 +1604,14 @@ THE SOFTWARE. if ( prop->value.l < 0 ) FT_TRACE0(( "pcf_load_font: negative Y resolution\n" )); #endif - resolution_y = FT_ABS( (FT_Short)prop->value.l ); + if ( FT_ABS( prop->value.l ) > 0x7FFF ) + { + resolution_y = 0x7FFF; + FT_TRACE0(( "pcf_load_font: clamping Y resolution to value %d\n", + resolution_y )); + } + else + resolution_y = FT_ABS( (FT_Short)prop->value.l ); } if ( bsize->y_ppem == 0 ) From 0e7b9f864f517dfe0bc37419c037dd299fdd2a27 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Tue, 30 May 2017 22:22:19 +0200 Subject: [PATCH 114/470] [psaux] Correctly handle sequences of multiple number signs. * src/psaux/psconv.c (PS_Conv_Strtol, PS_Conv_ToFixed): Return zero if we encounter more than a single sign. --- ChangeLog | 7 +++++++ src/psaux/psconv.c | 8 ++++++++ 2 files changed, 15 insertions(+) diff --git a/ChangeLog b/ChangeLog index 8a6667721..9c79afe7d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2017-05-30 Werner Lemberg + + [psaux] Correctly handle sequences of multiple number signs. + + * src/psaux/psconv.c (PS_Conv_Strtol, PS_Conv_ToFixed): Return zero + if we encounter more than a single sign. + 2017-05-29 Werner Lemberg [pcf] 32bit integer overflow run-time errors (#46149). diff --git a/src/psaux/psconv.c b/src/psaux/psconv.c index b09248219..d125b0834 100644 --- a/src/psaux/psconv.c +++ b/src/psaux/psconv.c @@ -111,6 +111,10 @@ p++; if ( p == limit ) goto Bad; + + /* only a single sign is allowed */ + if ( *p == '-' || *p == '+' ) + return 0; } num_limit = 0x7FFFFFFFL / base; @@ -215,6 +219,10 @@ p++; if ( p == limit ) goto Bad; + + /* only a single sign is allowed */ + if ( *p == '-' || *p == '+' ) + return 0; } /* read the integer part */ From 9b710cd56eb66c379686e82d7fe371c212aebc37 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Tue, 30 May 2017 22:35:41 +0200 Subject: [PATCH 115/470] [cff] 32bit integer overflow run-time errors 1/2 (#46149). This commit handles the old engine. * src/cff/cffgload.c: Include FT_INTERNAL_CALC_H. (cff_decoder_parse_charstrings): Use OVERFLOW_ADD_LONG and OVERFLOW_SUB_LONG where needed. * src/cff/cffparse.c: Include FT_INTERNAL_CALC_H. (power_ten_limits): New static array. (do_fixed): Use it to prevent multiplication overflow. (cff_parser_run): Use OVERFLOW_ADD_LONG. --- ChangeLog | 15 ++++ src/cff/cffgload.c | 207 ++++++++++++++++++++++++++------------------- src/cff/cffparse.c | 28 +++++- 3 files changed, 161 insertions(+), 89 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9c79afe7d..dc3f7f5c9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2017-05-30 Werner Lemberg + + [cff] 32bit integer overflow run-time errors 1/2 (#46149). + + This commit handles the old engine. + + * src/cff/cffgload.c: Include FT_INTERNAL_CALC_H. + (cff_decoder_parse_charstrings): Use OVERFLOW_ADD_LONG and + OVERFLOW_SUB_LONG where needed. + + * src/cff/cffparse.c: Include FT_INTERNAL_CALC_H. + (power_ten_limits): New static array. + (do_fixed): Use it to prevent multiplication overflow. + (cff_parser_run): Use OVERFLOW_ADD_LONG. + 2017-05-30 Werner Lemberg [psaux] Correctly handle sequences of multiple number signs. diff --git a/src/cff/cffgload.c b/src/cff/cffgload.c index 940804850..52b9bf34e 100644 --- a/src/cff/cffgload.c +++ b/src/cff/cffgload.c @@ -20,6 +20,7 @@ #include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_STREAM_H #include FT_INTERNAL_SFNT_H +#include FT_INTERNAL_CALC_H #include FT_OUTLINE_H #include FT_CFF_DRIVER_H @@ -1450,8 +1451,8 @@ cff_builder_close_contour( builder ); builder->path_begun = 0; - x += args[-2]; - y += args[-1]; + x = OVERFLOW_ADD_LONG( x, args[-2] ); + y = OVERFLOW_ADD_LONG( y, args[-1] ); args = stack; break; @@ -1460,7 +1461,7 @@ cff_builder_close_contour( builder ); builder->path_begun = 0; - y += args[-1]; + y = OVERFLOW_ADD_LONG( y, args[-1] ); args = stack; break; @@ -1469,7 +1470,7 @@ cff_builder_close_contour( builder ); builder->path_begun = 0; - x += args[-1]; + x = OVERFLOW_ADD_LONG( x, args[-1] ); args = stack; break; @@ -1486,8 +1487,8 @@ args -= num_args & ~1; while ( args < decoder->top ) { - x += args[0]; - y += args[1]; + x = OVERFLOW_ADD_LONG( x, args[0] ); + y = OVERFLOW_ADD_LONG( y, args[1] ); cff_builder_add_point( builder, x, y, 1 ); args += 2; } @@ -1519,9 +1520,9 @@ while ( args < decoder->top ) { if ( phase ) - x += args[0]; + x = OVERFLOW_ADD_LONG( x, args[0] ); else - y += args[0]; + y = OVERFLOW_ADD_LONG( y, args[0] ); if ( cff_builder_add_point1( builder, x, y ) ) goto Fail; @@ -1552,15 +1553,18 @@ args -= nargs; while ( args < decoder->top ) { - x += args[0]; - y += args[1]; + x = OVERFLOW_ADD_LONG( x, args[0] ); + y = OVERFLOW_ADD_LONG( y, args[1] ); cff_builder_add_point( builder, x, y, 0 ); - x += args[2]; - y += args[3]; + + x = OVERFLOW_ADD_LONG( x, args[2] ); + y = OVERFLOW_ADD_LONG( y, args[3] ); cff_builder_add_point( builder, x, y, 0 ); - x += args[4]; - y += args[5]; + + x = OVERFLOW_ADD_LONG( x, args[4] ); + y = OVERFLOW_ADD_LONG( y, args[5] ); cff_builder_add_point( builder, x, y, 1 ); + args += 6; } args = stack; @@ -1589,7 +1593,7 @@ if ( nargs & 1 ) { - x += args[0]; + x = OVERFLOW_ADD_LONG( x, args[0] ); args++; nargs--; } @@ -1599,13 +1603,16 @@ while ( args < decoder->top ) { - y += args[0]; + y = OVERFLOW_ADD_LONG( y, args[0] ); cff_builder_add_point( builder, x, y, 0 ); - x += args[1]; - y += args[2]; + + x = OVERFLOW_ADD_LONG( x, args[1] ); + y = OVERFLOW_ADD_LONG( y, args[2] ); cff_builder_add_point( builder, x, y, 0 ); - y += args[3]; + + y = OVERFLOW_ADD_LONG( y, args[3] ); cff_builder_add_point( builder, x, y, 1 ); + args += 4; } args = stack; @@ -1633,7 +1640,7 @@ args -= nargs; if ( nargs & 1 ) { - y += args[0]; + y = OVERFLOW_ADD_LONG( y, args[0] ); args++; nargs--; } @@ -1643,13 +1650,16 @@ while ( args < decoder->top ) { - x += args[0]; + x = OVERFLOW_ADD_LONG( x, args[0] ); cff_builder_add_point( builder, x, y, 0 ); - x += args[1]; - y += args[2]; + + x = OVERFLOW_ADD_LONG( x, args[1] ); + y = OVERFLOW_ADD_LONG( y, args[2] ); cff_builder_add_point( builder, x, y, 0 ); - x += args[3]; + + x = OVERFLOW_ADD_LONG( x, args[3] ); cff_builder_add_point( builder, x, y, 1 ); + args += 4; } args = stack; @@ -1688,26 +1698,30 @@ nargs -= 4; if ( phase ) { - x += args[0]; + x = OVERFLOW_ADD_LONG( x, args[0] ); cff_builder_add_point( builder, x, y, 0 ); - x += args[1]; - y += args[2]; + + x = OVERFLOW_ADD_LONG( x, args[1] ); + y = OVERFLOW_ADD_LONG( y, args[2] ); cff_builder_add_point( builder, x, y, 0 ); - y += args[3]; + + y = OVERFLOW_ADD_LONG( y, args[3] ); if ( nargs == 1 ) - x += args[4]; + x = OVERFLOW_ADD_LONG( x, args[4] ); cff_builder_add_point( builder, x, y, 1 ); } else { - y += args[0]; + y = OVERFLOW_ADD_LONG( y, args[0] ); cff_builder_add_point( builder, x, y, 0 ); - x += args[1]; - y += args[2]; + + x = OVERFLOW_ADD_LONG( x, args[1] ); + y = OVERFLOW_ADD_LONG( y, args[2] ); cff_builder_add_point( builder, x, y, 0 ); - x += args[3]; + + x = OVERFLOW_ADD_LONG( x, args[3] ); if ( nargs == 1 ) - y += args[4]; + y = OVERFLOW_ADD_LONG( y, args[4] ); cff_builder_add_point( builder, x, y, 1 ); } args += 4; @@ -1740,23 +1754,27 @@ /* first, add the line segments */ while ( num_lines > 0 ) { - x += args[0]; - y += args[1]; + x = OVERFLOW_ADD_LONG( x, args[0] ); + y = OVERFLOW_ADD_LONG( y, args[1] ); cff_builder_add_point( builder, x, y, 1 ); + args += 2; num_lines--; } /* then the curve */ - x += args[0]; - y += args[1]; + x = OVERFLOW_ADD_LONG( x, args[0] ); + y = OVERFLOW_ADD_LONG( y, args[1] ); cff_builder_add_point( builder, x, y, 0 ); - x += args[2]; - y += args[3]; + + x = OVERFLOW_ADD_LONG( x, args[2] ); + y = OVERFLOW_ADD_LONG( y, args[3] ); cff_builder_add_point( builder, x, y, 0 ); - x += args[4]; - y += args[5]; + + x = OVERFLOW_ADD_LONG( x, args[4] ); + y = OVERFLOW_ADD_LONG( y, args[5] ); cff_builder_add_point( builder, x, y, 1 ); + args = stack; } break; @@ -1785,23 +1803,27 @@ /* first, add the curves */ while ( num_curves > 0 ) { - x += args[0]; - y += args[1]; + x = OVERFLOW_ADD_LONG( x, args[0] ); + y = OVERFLOW_ADD_LONG( y, args[1] ); cff_builder_add_point( builder, x, y, 0 ); - x += args[2]; - y += args[3]; + + x = OVERFLOW_ADD_LONG( x, args[2] ); + y = OVERFLOW_ADD_LONG( y, args[3] ); cff_builder_add_point( builder, x, y, 0 ); - x += args[4]; - y += args[5]; + + x = OVERFLOW_ADD_LONG( x, args[4] ); + y = OVERFLOW_ADD_LONG( y, args[5] ); cff_builder_add_point( builder, x, y, 1 ); + args += 6; num_curves--; } /* then the final line */ - x += args[0]; - y += args[1]; + x = OVERFLOW_ADD_LONG( x, args[0] ); + y = OVERFLOW_ADD_LONG( y, args[1] ); cff_builder_add_point( builder, x, y, 1 ); + args = stack; } break; @@ -1824,33 +1846,33 @@ start_y = y; /* first control point */ - x += args[0]; - y += args[1]; + x = OVERFLOW_ADD_LONG( x, args[0] ); + y = OVERFLOW_ADD_LONG( y, args[1] ); cff_builder_add_point( builder, x, y, 0 ); /* second control point */ - x += args[2]; - y += args[3]; + x = OVERFLOW_ADD_LONG( x, args[2] ); + y = OVERFLOW_ADD_LONG( y, args[3] ); cff_builder_add_point( builder, x, y, 0 ); /* join point; on curve, with y-value the same as the last */ /* control point's y-value */ - x += args[4]; + x = OVERFLOW_ADD_LONG( x, args[4] ); cff_builder_add_point( builder, x, y, 1 ); /* third control point, with y-value the same as the join */ /* point's y-value */ - x += args[5]; + x = OVERFLOW_ADD_LONG( x, args[5] ); cff_builder_add_point( builder, x, y, 0 ); /* fourth control point */ - x += args[6]; - y += args[7]; + x = OVERFLOW_ADD_LONG( x, args[6] ); + y = OVERFLOW_ADD_LONG( y, args[7] ); cff_builder_add_point( builder, x, y, 0 ); /* ending point, with y-value the same as the start */ - x += args[8]; - y = start_y; + x = OVERFLOW_ADD_LONG( x, args[8] ); + y = start_y; cff_builder_add_point( builder, x, y, 1 ); args = stack; @@ -1873,32 +1895,32 @@ start_y = y; /* first control point */ - x += args[0]; + x = OVERFLOW_ADD_LONG( x, args[0] ); cff_builder_add_point( builder, x, y, 0 ); /* second control point */ - x += args[1]; - y += args[2]; + x = OVERFLOW_ADD_LONG( x, args[1] ); + y = OVERFLOW_ADD_LONG( y, args[2] ); cff_builder_add_point( builder, x, y, 0 ); /* join point; on curve, with y-value the same as the last */ /* control point's y-value */ - x += args[3]; + x = OVERFLOW_ADD_LONG( x, args[3] ); cff_builder_add_point( builder, x, y, 1 ); /* third control point, with y-value the same as the join */ /* point's y-value */ - x += args[4]; + x = OVERFLOW_ADD_LONG( x, args[4] ); cff_builder_add_point( builder, x, y, 0 ); /* fourth control point */ - x += args[5]; - y = start_y; + x = OVERFLOW_ADD_LONG( x, args[5] ); + y = start_y; cff_builder_add_point( builder, x, y, 0 ); /* ending point, with y-value the same as the start point's */ /* y-value -- we don't add this point, though */ - x += args[6]; + x = OVERFLOW_ADD_LONG( x, args[6] ); cff_builder_add_point( builder, x, y, 1 ); args = stack; @@ -1934,8 +1956,8 @@ /* grab up to the last argument */ for ( count = 5; count > 0; count-- ) { - dx += temp[0]; - dy += temp[1]; + dx = OVERFLOW_ADD_LONG( dx, temp[0] ); + dy = OVERFLOW_ADD_LONG( dy, temp[1] ); temp += 2; } @@ -1949,8 +1971,8 @@ for ( count = 5; count > 0; count-- ) { - x += args[0]; - y += args[1]; + x = OVERFLOW_ADD_LONG( x, args[0] ); + y = OVERFLOW_ADD_LONG( y, args[1] ); cff_builder_add_point( builder, x, y, (FT_Bool)( count == 3 ) ); args += 2; @@ -1959,13 +1981,13 @@ /* is last operand an x- or y-delta? */ if ( horizontal ) { - x += args[0]; - y = start_y; + x = OVERFLOW_ADD_LONG( x, args[0] ); + y = start_y; } else { - x = start_x; - y += args[0]; + x = start_x; + y = OVERFLOW_ADD_LONG( y, args[0] ); } cff_builder_add_point( builder, x, y, 1 ); @@ -1987,8 +2009,8 @@ for ( count = 6; count > 0; count-- ) { - x += args[0]; - y += args[1]; + x = OVERFLOW_ADD_LONG( x, args[0] ); + y = OVERFLOW_ADD_LONG( y, args[1] ); cff_builder_add_point( builder, x, y, (FT_Bool)( count == 4 || count == 1 ) ); args += 2; @@ -2066,21 +2088,26 @@ FT_TRACE4(( " abs\n" )); if ( args[0] < 0 ) - args[0] = -args[0]; + { + if ( args[0] == FT_LONG_MIN ) + args[0] = FT_LONG_MAX; + else + args[0] = -args[0]; + } args++; break; case cff_op_add: FT_TRACE4(( " add\n" )); - args[0] += args[1]; + args[0] = OVERFLOW_ADD_LONG( args[0], args[1] ); args++; break; case cff_op_sub: FT_TRACE4(( " sub\n" )); - args[0] -= args[1]; + args[0] = OVERFLOW_SUB_LONG( args[0], args[1] ); args++; break; @@ -2094,6 +2121,8 @@ case cff_op_neg: FT_TRACE4(( " neg\n" )); + if ( args[0] == FT_LONG_MIN ) + args[0] = FT_LONG_MAX; args[0] = -args[0]; args++; break; @@ -2350,12 +2379,13 @@ FT_TRACE4(( " hsbw (invalid op)\n" )); - decoder->glyph_width = decoder->nominal_width + ( args[1] >> 16 ); + decoder->glyph_width = + OVERFLOW_ADD_LONG( 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]; + x = OVERFLOW_ADD_LONG( decoder->builder.pos_x, args[0] ); y = decoder->builder.pos_y; args = stack; break; @@ -2367,13 +2397,14 @@ FT_TRACE4(( " sbw (invalid op)\n" )); - decoder->glyph_width = decoder->nominal_width + ( args[2] >> 16 ); + decoder->glyph_width = + OVERFLOW_ADD_LONG( 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]; + x = OVERFLOW_ADD_LONG( decoder->builder.pos_x, args[0] ); + y = OVERFLOW_ADD_LONG( decoder->builder.pos_y, args[1] ); args = stack; break; @@ -2384,8 +2415,8 @@ FT_TRACE4(( " setcurrentpoint (invalid op)\n" )); - x = decoder->builder.pos_x + args[0]; - y = decoder->builder.pos_y + args[1]; + x = OVERFLOW_ADD_LONG( decoder->builder.pos_x, args[0] ); + y = OVERFLOW_ADD_LONG( decoder->builder.pos_y, args[1] ); args = stack; break; diff --git a/src/cff/cffparse.c b/src/cff/cffparse.c index e1511bdbd..6d617e26e 100644 --- a/src/cff/cffparse.c +++ b/src/cff/cffparse.c @@ -20,6 +20,7 @@ #include "cffparse.h" #include FT_INTERNAL_STREAM_H #include FT_INTERNAL_DEBUG_H +#include FT_INTERNAL_CALC_H #include "cfferrs.h" #include "cffpic.h" @@ -156,6 +157,22 @@ 1000000000L }; + /* maximum values allowed for multiplying */ + /* with the corresponding `power_tens' element */ + static const FT_Long power_ten_limits[] = + { + FT_LONG_MAX / 1L, + FT_LONG_MAX / 10L, + FT_LONG_MAX / 100L, + FT_LONG_MAX / 1000L, + FT_LONG_MAX / 10000L, + FT_LONG_MAX / 100000L, + FT_LONG_MAX / 1000000L, + FT_LONG_MAX / 10000000L, + FT_LONG_MAX / 100000000L, + FT_LONG_MAX / 1000000000L, + }; + /* read a real */ static FT_Fixed @@ -484,7 +501,15 @@ if ( scaling ) + { + if ( FT_ABS( val ) > power_ten_limits[scaling] ) + { + val = val > 0 ? 0x7FFFFFFFL : -0x7FFFFFFFFL; + goto Overflow; + } + val *= power_tens[scaling]; + } if ( val > 0x7FFF ) { @@ -1585,7 +1610,8 @@ val = 0; while ( num_args > 0 ) { - val += cff_parse_num( parser, data++ ); + val = OVERFLOW_ADD_LONG( val, + cff_parse_num( parser, data++ ) ); switch ( field->size ) { case (8 / FT_CHAR_BIT): From e66d7300fec2f9fc60e43a924af1972b07ee316b Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Wed, 31 May 2017 16:16:50 +0200 Subject: [PATCH 116/470] [cff] 32bit integer overflow run-time errors 2/2 (#46149). This commit handles the new engine. * include/freetype/internal/ftcalc.h (OVERFLOW_ADD_INT32, OVERFLOW_SUB_INT32, OVERFLOW_MUL_INT32, NEG_INT, NEG_LONG, NEG_INT32): New macros. * src/cff/cf2ft.c (cf2_getScaleAndHintFlag): Use OVERFLOW_ADD_INT32. * src/cff/cf2hints.c (cf2_getWindingMomentum, cf2_hint_init, cf2_hintmap_map, cf2_glyphpath_hintPoint, cf2_glyphpath_computeIntersection, cf2_glyphpath_computeOffset, cf2_glyphpath_lineTo, cf2_glyphpath_curveTo): Use OVERFLOW_ADD_INT32, OVERFLOW_SUB_INT32, OVERFLOW_MUL_INT32, and NEG_INT32 where appropriate. * src/cff/cf2intrp.c (cf2_doFlex, cf2_doBlend, cf2_interpT2CharString): Ditto. Also add some other code where needed to avoid overflow. --- ChangeLog | 23 ++++ include/freetype/internal/ftcalc.h | 13 ++ src/cff/cf2ft.c | 6 +- src/cff/cf2hints.c | 162 +++++++++++++---------- src/cff/cf2intrp.c | 205 ++++++++++++++++++++--------- 5 files changed, 276 insertions(+), 133 deletions(-) diff --git a/ChangeLog b/ChangeLog index dc3f7f5c9..c38b5af66 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,26 @@ +2017-05-31 Werner Lemberg + + [cff] 32bit integer overflow run-time errors 2/2 (#46149). + + This commit handles the new engine. + + * include/freetype/internal/ftcalc.h (OVERFLOW_ADD_INT32, + OVERFLOW_SUB_INT32, OVERFLOW_MUL_INT32, NEG_INT, NEG_LONG, + NEG_INT32): New macros. + + * src/cff/cf2ft.c (cf2_getScaleAndHintFlag): Use OVERFLOW_ADD_INT32. + + * src/cff/cf2hints.c (cf2_getWindingMomentum, cf2_hint_init, + cf2_hintmap_map, cf2_glyphpath_hintPoint, + cf2_glyphpath_computeIntersection, cf2_glyphpath_computeOffset, + cf2_glyphpath_lineTo, cf2_glyphpath_curveTo): Use + OVERFLOW_ADD_INT32, OVERFLOW_SUB_INT32, OVERFLOW_MUL_INT32, and + NEG_INT32 where appropriate. + + * src/cff/cf2intrp.c (cf2_doFlex, cf2_doBlend, + cf2_interpT2CharString): Ditto. + Also add some other code where needed to avoid overflow. + 2017-05-30 Werner Lemberg [cff] 32bit integer overflow run-time errors 1/2 (#46149). diff --git a/include/freetype/internal/ftcalc.h b/include/freetype/internal/ftcalc.h index 1cd32c892..2b040feea 100644 --- a/include/freetype/internal/ftcalc.h +++ b/include/freetype/internal/ftcalc.h @@ -423,6 +423,8 @@ FT_BEGIN_HEADER (FT_Int)( (FT_UInt)(a) - (FT_UInt)(b) ) #define OVERFLOW_MUL_INT( a, b ) \ (FT_Int)( (FT_UInt)(a) * (FT_UInt)(b) ) +#define NEG_INT( a ) \ + (FT_Int)( -(FT_UInt)(a) ) #define OVERFLOW_ADD_LONG( a, b ) \ (FT_Long)( (FT_ULong)(a) + (FT_ULong)(b) ) @@ -430,6 +432,17 @@ FT_BEGIN_HEADER (FT_Long)( (FT_ULong)(a) - (FT_ULong)(b) ) #define OVERFLOW_MUL_LONG( a, b ) \ (FT_Long)( (FT_ULong)(a) * (FT_ULong)(b) ) +#define NEG_LONG( a ) \ + (FT_Long)( -(FT_ULong)(a) ) + +#define OVERFLOW_ADD_INT32( a, b ) \ + (FT_Int32)( (FT_UInt32)(a) + (FT_UInt32)(b) ) +#define OVERFLOW_SUB_INT32( a, b ) \ + (FT_Int32)( (FT_UInt32)(a) - (FT_UInt32)(b) ) +#define OVERFLOW_MUL_INT32( a, b ) \ + (FT_Int32)( (FT_UInt32)(a) * (FT_UInt32)(b) ) +#define NEG_INT32( a ) \ + (FT_Int32)( -(FT_UInt32)(a) ) FT_END_HEADER diff --git a/src/cff/cf2ft.c b/src/cff/cf2ft.c index eb8472f11..3bc007b9b 100644 --- a/src/cff/cf2ft.c +++ b/src/cff/cf2ft.c @@ -267,8 +267,10 @@ if ( *hinted ) { - *x_scale = ( decoder->builder.glyph->x_scale + 32 ) / 64; - *y_scale = ( decoder->builder.glyph->y_scale + 32 ) / 64; + *x_scale = OVERFLOW_ADD_INT32( decoder->builder.glyph->x_scale, + 32 ) / 64; + *y_scale = OVERFLOW_ADD_INT32( decoder->builder.glyph->y_scale, + 32 ) / 64; } else { diff --git a/src/cff/cf2hints.c b/src/cff/cf2hints.c index a6fcef44d..5efb180dc 100644 --- a/src/cff/cf2hints.c +++ b/src/cff/cf2hints.c @@ -74,8 +74,8 @@ /* cross product of pt1 position from origin with pt2 position from */ /* pt1; we reduce the precision so that the result fits into 32 bits */ - return ( x1 >> 16 ) * ( ( y2 - y1 ) >> 16 ) - - ( y1 >> 16 ) * ( ( x2 - x1 ) >> 16 ); + return ( x1 >> 16 ) * ( OVERFLOW_SUB_INT32( y2, y1 ) >> 16 ) - + ( y1 >> 16 ) * ( OVERFLOW_SUB_INT32( x2, x1 ) >> 16 ); } @@ -185,11 +185,11 @@ /* darkening. Bottoms are not changed; tops are incremented by twice */ /* `darkenY'. */ if ( cf2_hint_isTop( hint ) ) - hint->csCoord += 2 * font->darkenY; + hint->csCoord = OVERFLOW_ADD_INT32( hint->csCoord, 2 * font->darkenY ); - hint->csCoord += hintOrigin; - hint->scale = scale; - hint->index = indexStemHint; /* index in original stem hint array */ + hint->csCoord = OVERFLOW_ADD_INT32( hint->csCoord, hintOrigin ); + hint->scale = scale; + hint->index = indexStemHint; /* index in original stem hint array */ /* if original stem hint has been used, use the same position */ if ( hint->flags != 0 && stemHint->used ) @@ -314,6 +314,7 @@ /* start linear search from last hit */ CF2_UInt i = hintmap->lastIndex; + FT_ASSERT( hintmap->lastIndex < CF2_MAX_HINT_EDGES ); /* search up */ @@ -330,9 +331,10 @@ if ( i == 0 && csCoord < hintmap->edge[0].csCoord ) { /* special case for points below first edge: use uniform scale */ - return FT_MulFix( csCoord - hintmap->edge[0].csCoord, - hintmap->scale ) + - hintmap->edge[0].dsCoord; + return OVERFLOW_ADD_INT32( + FT_MulFix( csCoord - hintmap->edge[0].csCoord, + hintmap->scale ), + hintmap->edge[0].dsCoord ); } else { @@ -340,9 +342,10 @@ * Note: entries with duplicate csCoord are allowed. * Use edge[i], the highest entry where csCoord >= entry[i].csCoord */ - return FT_MulFix( csCoord - hintmap->edge[i].csCoord, - hintmap->edge[i].scale ) + - hintmap->edge[i].dsCoord; + return OVERFLOW_ADD_INT32( + FT_MulFix( csCoord - hintmap->edge[i].csCoord, + hintmap->edge[i].scale ), + hintmap->edge[i].dsCoord ); } } } @@ -781,7 +784,7 @@ cf2_arrstack_size( hStemHintArray ) + cf2_arrstack_size( vStemHintArray ) ); if ( !cf2_hintmask_isValid( hintMask ) ) - return; /* too many stem hints */ + return; /* too many stem hints */ } /* begin by clearing the map */ @@ -797,7 +800,7 @@ /* Defense-in-depth. Should never return here. */ if ( bitCount > hintMask->bitCount ) - return; + return; /* synthetic embox hints get highest priority */ if ( font->blues.doEmBoxHints ) @@ -1095,16 +1098,20 @@ FT_Vector pt; /* hinted point in upright DS */ - pt.x = FT_MulFix( glyphpath->scaleX, x ) + - FT_MulFix( glyphpath->scaleC, y ); + pt.x = OVERFLOW_ADD_INT32( FT_MulFix( glyphpath->scaleX, x ), + FT_MulFix( glyphpath->scaleC, y ) ); pt.y = cf2_hintmap_map( hintmap, y ); - ppt->x = FT_MulFix( glyphpath->font->outerTransform.a, pt.x ) + - FT_MulFix( glyphpath->font->outerTransform.c, pt.y ) + - glyphpath->fractionalTranslation.x; - ppt->y = FT_MulFix( glyphpath->font->outerTransform.b, pt.x ) + - FT_MulFix( glyphpath->font->outerTransform.d, pt.y ) + - glyphpath->fractionalTranslation.y; + ppt->x = OVERFLOW_ADD_INT32( + FT_MulFix( glyphpath->font->outerTransform.a, pt.x ), + OVERFLOW_ADD_INT32( + FT_MulFix( glyphpath->font->outerTransform.c, pt.y ), + glyphpath->fractionalTranslation.x ) ); + ppt->y = OVERFLOW_ADD_INT32( + FT_MulFix( glyphpath->font->outerTransform.b, pt.x ), + OVERFLOW_ADD_INT32( + FT_MulFix( glyphpath->font->outerTransform.d, pt.y ), + glyphpath->fractionalTranslation.y ) ); } @@ -1154,12 +1161,12 @@ CF2_Fixed denominator, s; - u.x = CF2_CS_SCALE( u2->x - u1->x ); - u.y = CF2_CS_SCALE( u2->y - u1->y ); - v.x = CF2_CS_SCALE( v2->x - v1->x ); - v.y = CF2_CS_SCALE( v2->y - v1->y ); - w.x = CF2_CS_SCALE( v1->x - u1->x ); - w.y = CF2_CS_SCALE( v1->y - u1->y ); + u.x = CF2_CS_SCALE( OVERFLOW_SUB_INT32( u2->x, u1->x ) ); + u.y = CF2_CS_SCALE( OVERFLOW_SUB_INT32( u2->y, u1->y ) ); + v.x = CF2_CS_SCALE( OVERFLOW_SUB_INT32( v2->x, v1->x ) ); + v.y = CF2_CS_SCALE( OVERFLOW_SUB_INT32( v2->y, v1->y ) ); + w.x = CF2_CS_SCALE( OVERFLOW_SUB_INT32( v1->x, u1->x ) ); + w.y = CF2_CS_SCALE( OVERFLOW_SUB_INT32( v1->y, u1->y ) ); denominator = cf2_perp( u, v ); @@ -1168,8 +1175,13 @@ s = FT_DivFix( cf2_perp( w, v ), denominator ); - intersection->x = u1->x + FT_MulFix( s, u2->x - u1->x ); - intersection->y = u1->y + FT_MulFix( s, u2->y - u1->y ); + intersection->x = OVERFLOW_ADD_INT32( + u1->x, + FT_MulFix( s, OVERFLOW_SUB_INT32( u2->x, u1->x ) ) ); + intersection->y = OVERFLOW_ADD_INT32( + u1->y, + FT_MulFix( s, OVERFLOW_SUB_INT32( u2->y, u1->y ) ) ); + /* * Special case snapping for horizontal and vertical lines. @@ -1180,25 +1192,35 @@ * */ - if ( u1->x == u2->x && - cf2_fixedAbs( intersection->x - u1->x ) < glyphpath->snapThreshold ) + if ( u1->x == u2->x && + cf2_fixedAbs( OVERFLOW_SUB_INT32( + intersection->x, + u1->x ) ) < glyphpath->snapThreshold ) intersection->x = u1->x; - if ( u1->y == u2->y && - cf2_fixedAbs( intersection->y - u1->y ) < glyphpath->snapThreshold ) + if ( u1->y == u2->y && + cf2_fixedAbs( OVERFLOW_SUB_INT32( + intersection->y, + u1->y ) ) < glyphpath->snapThreshold ) intersection->y = u1->y; - if ( v1->x == v2->x && - cf2_fixedAbs( intersection->x - v1->x ) < glyphpath->snapThreshold ) + if ( v1->x == v2->x && + cf2_fixedAbs( OVERFLOW_SUB_INT32( + intersection->x, + v1->x ) ) < glyphpath->snapThreshold ) intersection->x = v1->x; - if ( v1->y == v2->y && - cf2_fixedAbs( intersection->y - v1->y ) < glyphpath->snapThreshold ) + if ( v1->y == v2->y && + cf2_fixedAbs( OVERFLOW_SUB_INT32( + intersection->y, + v1->y ) ) < glyphpath->snapThreshold ) intersection->y = v1->y; /* limit the intersection distance from midpoint of u2 and v1 */ - if ( cf2_fixedAbs( intersection->x - ( u2->x + v1->x ) / 2 ) > - glyphpath->miterLimit || - cf2_fixedAbs( intersection->y - ( u2->y + v1->y ) / 2 ) > - glyphpath->miterLimit ) + if ( cf2_fixedAbs( intersection->x - + OVERFLOW_ADD_INT32( u2->x, v1->x ) / 2 ) > + glyphpath->miterLimit || + cf2_fixedAbs( intersection->y - + OVERFLOW_ADD_INT32( u2->y, v1->y ) / 2 ) > + glyphpath->miterLimit ) return FALSE; return TRUE; @@ -1446,16 +1468,16 @@ CF2_Fixed* x, CF2_Fixed* y ) { - CF2_Fixed dx = x2 - x1; - CF2_Fixed dy = y2 - y1; + CF2_Fixed dx = OVERFLOW_SUB_INT32( x2, x1 ); + CF2_Fixed dy = OVERFLOW_SUB_INT32( y2, y1 ); /* note: negative offsets don't work here; negate deltas to change */ /* quadrants, below */ if ( glyphpath->font->reverseWinding ) { - dx = -dx; - dy = -dy; + dx = NEG_INT32( dx ); + dy = NEG_INT32( dy ); } *x = *y = 0; @@ -1474,13 +1496,13 @@ { /* first quadrant, +x +y */ - if ( dx > 2 * dy ) + if ( dx > OVERFLOW_MUL_INT32( 2, dy ) ) { /* +x */ *x = 0; *y = 0; } - else if ( dy > 2 * dx ) + else if ( dy > OVERFLOW_MUL_INT32( 2, dx ) ) { /* +y */ *x = glyphpath->xOffset; @@ -1499,16 +1521,16 @@ { /* fourth quadrant, +x -y */ - if ( dx > -2 * dy ) + if ( dx > OVERFLOW_MUL_INT32( -2, dy ) ) { /* +x */ *x = 0; *y = 0; } - else if ( -dy > 2 * dx ) + else if ( NEG_INT32( dy ) > OVERFLOW_MUL_INT32( 2, dx ) ) { /* -y */ - *x = -glyphpath->xOffset; + *x = NEG_INT32( glyphpath->xOffset ); *y = glyphpath->yOffset; } else @@ -1527,13 +1549,13 @@ { /* second quadrant, -x +y */ - if ( -dx > 2 * dy ) + if ( NEG_INT32( dx ) > OVERFLOW_MUL_INT32( 2, dy ) ) { /* -x */ *x = 0; - *y = 2 * glyphpath->yOffset; + *y = OVERFLOW_MUL_INT32( 2, glyphpath->yOffset ); } - else if ( dy > -2 * dx ) + else if ( dy > OVERFLOW_MUL_INT32( -2, dx ) ) { /* +y */ *x = glyphpath->xOffset; @@ -1552,16 +1574,16 @@ { /* third quadrant, -x -y */ - if ( -dx > -2 * dy ) + if ( NEG_INT32( dx ) > OVERFLOW_MUL_INT32( -2, dy ) ) { /* -x */ *x = 0; - *y = 2 * glyphpath->yOffset; + *y = OVERFLOW_MUL_INT32( 2, glyphpath->yOffset ); } - else if ( -dy > -2 * dx ) + else if ( NEG_INT32( dy ) > OVERFLOW_MUL_INT32( -2, dx ) ) { /* -y */ - *x = -glyphpath->xOffset; + *x = NEG_INT32( glyphpath->xOffset ); *y = glyphpath->yOffset; } else @@ -1675,10 +1697,10 @@ &yOffset ); /* construct offset points */ - P0.x = glyphpath->currentCS.x + xOffset; - P0.y = glyphpath->currentCS.y + yOffset; - P1.x = x + xOffset; - P1.y = y + yOffset; + P0.x = OVERFLOW_ADD_INT32( glyphpath->currentCS.x, xOffset ); + P0.y = OVERFLOW_ADD_INT32( glyphpath->currentCS.y, yOffset ); + P1.x = OVERFLOW_ADD_INT32( x, xOffset ); + P1.y = OVERFLOW_ADD_INT32( y, yOffset ); if ( glyphpath->moveIsPending ) { @@ -1757,15 +1779,15 @@ cf2_getWindingMomentum( x1, y1, x2, y2 ); /* construct offset points */ - P0.x = glyphpath->currentCS.x + xOffset1; - P0.y = glyphpath->currentCS.y + yOffset1; - P1.x = x1 + xOffset1; - P1.y = y1 + yOffset1; + P0.x = OVERFLOW_ADD_INT32( glyphpath->currentCS.x, xOffset1 ); + P0.y = OVERFLOW_ADD_INT32( glyphpath->currentCS.y, yOffset1 ); + P1.x = OVERFLOW_ADD_INT32( x1, xOffset1 ); + P1.y = OVERFLOW_ADD_INT32( y1, yOffset1 ); /* note: preserve angle of final segment by using offset3 at both ends */ - P2.x = x2 + xOffset3; - P2.y = y2 + yOffset3; - P3.x = x3 + xOffset3; - P3.y = y3 + yOffset3; + P2.x = OVERFLOW_ADD_INT32( x2, xOffset3 ); + P2.y = OVERFLOW_ADD_INT32( y2, yOffset3 ); + P3.x = OVERFLOW_ADD_INT32( x3, xOffset3 ); + P3.y = OVERFLOW_ADD_INT32( y3, yOffset3 ); if ( glyphpath->moveIsPending ) { diff --git a/src/cff/cf2intrp.c b/src/cff/cf2intrp.c index 40bd9059a..8f0785d59 100644 --- a/src/cff/cf2intrp.c +++ b/src/cff/cf2intrp.c @@ -348,7 +348,9 @@ { vals[i + 2] = vals[i]; if ( readFromStack[i] ) - vals[i + 2] += cf2_stack_getReal( opStack, idx++ ); + vals[i + 2] = OVERFLOW_ADD_INT32( vals[i + 2], + cf2_stack_getReal( opStack, + idx++ ) ); } if ( isHFlex ) @@ -363,24 +365,26 @@ if ( lastIsX ) { - vals[12] = vals[10] + lastVal; + vals[12] = OVERFLOW_ADD_INT32( vals[10], lastVal ); vals[13] = *curY; } else { vals[12] = *curX; - vals[13] = vals[11] + lastVal; + vals[13] = OVERFLOW_ADD_INT32( vals[11], lastVal ); } } else { if ( readFromStack[10] ) - vals[12] = vals[10] + cf2_stack_getReal( opStack, idx++ ); + vals[12] = OVERFLOW_ADD_INT32( vals[10], + cf2_stack_getReal( opStack, idx++ ) ); else vals[12] = *curX; if ( readFromStack[11] ) - vals[13] = vals[11] + cf2_stack_getReal( opStack, idx ); + vals[13] = OVERFLOW_ADD_INT32( vals[11], + cf2_stack_getReal( opStack, idx ) ); else vals[13] = *curY; } @@ -426,7 +430,10 @@ for ( j = 1; j < blend->lenBV; j++ ) - sum += FT_MulFix( *weight++, cf2_stack_getReal( opStack, delta++ ) ); + sum = OVERFLOW_ADD_INT32( + sum, + FT_MulFix( *weight++, + cf2_stack_getReal( opStack, delta++ ) ) ); /* store blended result */ cf2_stack_setReal( opStack, i + base, sum ); @@ -767,7 +774,7 @@ if ( font->decoder->width_only ) goto exit; - curY += cf2_stack_popFixed( opStack ); + curY = OVERFLOW_ADD_INT32( curY, cf2_stack_popFixed( opStack ) ); cf2_glyphpath_moveTo( &glyphPath, curX, curY ); @@ -783,8 +790,12 @@ for ( idx = 0; idx < count; idx += 2 ) { - curX += cf2_stack_getReal( opStack, idx + 0 ); - curY += cf2_stack_getReal( opStack, idx + 1 ); + curX = OVERFLOW_ADD_INT32( curX, + cf2_stack_getReal( opStack, + idx + 0 ) ); + curY = OVERFLOW_ADD_INT32( curY, + cf2_stack_getReal( opStack, + idx + 1 ) ); cf2_glyphpath_lineTo( &glyphPath, curX, curY ); } @@ -810,9 +821,9 @@ if ( isX ) - curX += v; + curX = OVERFLOW_ADD_INT32( curX, v ); else - curY += v; + curY = OVERFLOW_ADD_INT32( curY, v ); isX = !isX; @@ -835,13 +846,21 @@ while ( idx + 6 <= count ) { - CF2_Fixed x1 = cf2_stack_getReal( opStack, idx + 0 ) + curX; - CF2_Fixed y1 = cf2_stack_getReal( opStack, idx + 1 ) + curY; - CF2_Fixed x2 = cf2_stack_getReal( opStack, idx + 2 ) + x1; - CF2_Fixed y2 = cf2_stack_getReal( opStack, idx + 3 ) + y1; - CF2_Fixed x3 = cf2_stack_getReal( opStack, idx + 4 ) + x2; - CF2_Fixed y3 = cf2_stack_getReal( opStack, idx + 5 ) + y2; + CF2_Fixed x1, y1, x2, y2, x3, y3; + + x1 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, idx + 0 ), + curX ); + y1 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, idx + 1 ), + curY ); + x2 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, idx + 2 ), + x1 ); + y2 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, idx + 3 ), + y1 ); + x3 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, idx + 4 ), + x2 ); + y3 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, idx + 5 ), + y2 ); cf2_glyphpath_curveTo( &glyphPath, x1, y1, x2, y2, x3, y3 ); @@ -852,8 +871,12 @@ if ( op1 == cf2_cmdRCURVELINE ) { - curX += cf2_stack_getReal( opStack, idx + 0 ); - curY += cf2_stack_getReal( opStack, idx + 1 ); + curX = OVERFLOW_ADD_INT32( curX, + cf2_stack_getReal( opStack, + idx + 0 ) ); + curY = OVERFLOW_ADD_INT32( curY, + cf2_stack_getReal( opStack, + idx + 1 ) ); cf2_glyphpath_lineTo( &glyphPath, curX, curY ); } @@ -1129,7 +1152,10 @@ arg = cf2_stack_popFixed( opStack ); - cf2_stack_pushFixed( opStack, FT_ABS( arg ) ); + if ( arg < -CF2_FIXED_MAX ) + cf2_stack_pushFixed( opStack, CF2_FIXED_MAX ); + else + cf2_stack_pushFixed( opStack, FT_ABS( arg ) ); } continue; /* do not clear the stack */ @@ -1144,7 +1170,9 @@ summand2 = cf2_stack_popFixed( opStack ); summand1 = cf2_stack_popFixed( opStack ); - cf2_stack_pushFixed( opStack, summand1 + summand2 ); + cf2_stack_pushFixed( opStack, + OVERFLOW_ADD_INT32( summand1, + summand2 ) ); } continue; /* do not clear the stack */ @@ -1159,7 +1187,9 @@ subtrahend = cf2_stack_popFixed( opStack ); minuend = cf2_stack_popFixed( opStack ); - cf2_stack_pushFixed( opStack, minuend - subtrahend ); + cf2_stack_pushFixed( opStack, + OVERFLOW_SUB_INT32( minuend, + subtrahend ) ); } continue; /* do not clear the stack */ @@ -1174,7 +1204,8 @@ divisor = cf2_stack_popFixed( opStack ); dividend = cf2_stack_popFixed( opStack ); - cf2_stack_pushFixed( opStack, FT_DivFix( dividend, divisor ) ); + cf2_stack_pushFixed( opStack, + FT_DivFix( dividend, divisor ) ); } continue; /* do not clear the stack */ @@ -1187,7 +1218,10 @@ arg = cf2_stack_popFixed( opStack ); - cf2_stack_pushFixed( opStack, -arg ); + if ( arg < -CF2_FIXED_MAX ) + cf2_stack_pushFixed( opStack, CF2_FIXED_MAX ); + else + cf2_stack_pushFixed( opStack, -arg ); } continue; /* do not clear the stack */ @@ -1257,7 +1291,8 @@ arg2 = cf2_stack_popFixed( opStack ); arg1 = cf2_stack_popFixed( opStack ); - cf2_stack_pushFixed( opStack, cond1 <= cond2 ? arg1 : arg2 ); + cf2_stack_pushFixed( opStack, + cond1 <= cond2 ? arg1 : arg2 ); } continue; /* do not clear the stack */ @@ -1291,7 +1326,8 @@ factor2 = cf2_stack_popFixed( opStack ); factor1 = cf2_stack_popFixed( opStack ); - cf2_stack_pushFixed( opStack, FT_MulFix( factor1, factor2 ) ); + cf2_stack_pushFixed( opStack, + FT_MulFix( factor1, factor2 ) ); } continue; /* do not clear the stack */ @@ -1305,7 +1341,9 @@ arg = cf2_stack_popFixed( opStack ); if ( arg > 0 ) { - FT_Fixed root = arg; + /* use a start value that doesn't make */ + /* the algorithm's addition overflow */ + FT_Fixed root = arg < 10 ? arg : arg >> 1; FT_Fixed new_root; @@ -1369,7 +1407,8 @@ if ( size > 0 ) { - /* for `cf2_stack_getReal', index 0 is bottom of stack */ + /* for `cf2_stack_getReal', */ + /* index 0 is bottom of stack */ CF2_UInt gr_idx; @@ -1381,7 +1420,8 @@ gr_idx = size - 1 - (CF2_UInt)idx; cf2_stack_pushFixed( opStack, - cf2_stack_getReal( opStack, gr_idx ) ); + cf2_stack_getReal( opStack, + gr_idx ) ); } } continue; /* do not clear the stack */ @@ -1416,7 +1456,8 @@ cf2_stack_count( opStack ) == 5 ) { if ( !haveWidth ) - *width = cf2_stack_getReal( opStack, 0 ) + nominalWidthX; + *width = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, 0 ), + nominalWidthX ); } /* width is defined or default after this */ @@ -1564,7 +1605,8 @@ FT_TRACE4(( " rmoveto\n" )); if ( cf2_stack_count( opStack ) > 2 && !haveWidth ) - *width = cf2_stack_getReal( opStack, 0 ) + nominalWidthX; + *width = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, 0 ), + nominalWidthX ); /* width is defined or default after this */ haveWidth = TRUE; @@ -1583,7 +1625,8 @@ FT_TRACE4(( " hmoveto\n" )); if ( cf2_stack_count( opStack ) > 1 && !haveWidth ) - *width = cf2_stack_getReal( opStack, 0 ) + nominalWidthX; + *width = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, 0 ), + nominalWidthX ); /* width is defined or default after this */ haveWidth = TRUE; @@ -1591,7 +1634,7 @@ if ( font->decoder->width_only ) goto exit; - curX += cf2_stack_popFixed( opStack ); + curX = OVERFLOW_ADD_INT32( curX, cf2_stack_popFixed( opStack ) ); cf2_glyphpath_moveTo( &glyphPath, curX, curY ); @@ -1607,8 +1650,12 @@ while ( idx + 6 < count ) { - curX += cf2_stack_getReal( opStack, idx + 0 ); - curY += cf2_stack_getReal( opStack, idx + 1 ); + curX = OVERFLOW_ADD_INT32( curX, + cf2_stack_getReal( opStack, + idx + 0 ) ); + curY = OVERFLOW_ADD_INT32( curY, + cf2_stack_getReal( opStack, + idx + 1 ) ); cf2_glyphpath_lineTo( &glyphPath, curX, curY ); idx += 2; @@ -1616,13 +1663,27 @@ while ( idx < count ) { - CF2_Fixed x1 = cf2_stack_getReal( opStack, idx + 0 ) + curX; - CF2_Fixed y1 = cf2_stack_getReal( opStack, idx + 1 ) + curY; - CF2_Fixed x2 = cf2_stack_getReal( opStack, idx + 2 ) + x1; - CF2_Fixed y2 = cf2_stack_getReal( opStack, idx + 3 ) + y1; - CF2_Fixed x3 = cf2_stack_getReal( opStack, idx + 4 ) + x2; - CF2_Fixed y3 = cf2_stack_getReal( opStack, idx + 5 ) + y2; + CF2_Fixed x1, y1, x2, y2, x3, y3; + + x1 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, + idx + 0 ), + curX ); + y1 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, + idx + 1 ), + curY ); + x2 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, + idx + 2 ), + x1 ); + y2 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, + idx + 3 ), + y1 ); + x3 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, + idx + 4 ), + x2 ); + y3 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, + idx + 5 ), + y2 ); cf2_glyphpath_curveTo( &glyphPath, x1, y1, x2, y2, x3, y3 ); @@ -1656,18 +1717,23 @@ if ( ( count - idx ) & 1 ) { - x1 = cf2_stack_getReal( opStack, idx ) + curX; + x1 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, idx ), + curX ); idx++; } else x1 = curX; - y1 = cf2_stack_getReal( opStack, idx + 0 ) + curY; - x2 = cf2_stack_getReal( opStack, idx + 1 ) + x1; - y2 = cf2_stack_getReal( opStack, idx + 2 ) + y1; + y1 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, idx + 0 ), + curY ); + x2 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, idx + 1 ), + x1 ); + y2 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, idx + 2 ), + y1 ); x3 = x2; - y3 = cf2_stack_getReal( opStack, idx + 3 ) + y2; + y3 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, idx + 3 ), + y2 ); cf2_glyphpath_curveTo( &glyphPath, x1, y1, x2, y2, x3, y3 ); @@ -1701,17 +1767,22 @@ if ( ( count - idx ) & 1 ) { - y1 = cf2_stack_getReal( opStack, idx ) + curY; + y1 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, idx ), + curY ); idx++; } else y1 = curY; - x1 = cf2_stack_getReal( opStack, idx + 0 ) + curX; - x2 = cf2_stack_getReal( opStack, idx + 1 ) + x1; - y2 = cf2_stack_getReal( opStack, idx + 2 ) + y1; - x3 = cf2_stack_getReal( opStack, idx + 3 ) + x2; + x1 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, idx + 0 ), + curX ); + x2 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, idx + 1 ), + x1 ); + y2 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, idx + 2 ), + y1 ); + x3 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, idx + 3 ), + x2 ); y3 = y2; cf2_glyphpath_curveTo( &glyphPath, x1, y1, x2, y2, x3, y3 ); @@ -1750,15 +1821,21 @@ if ( alternate ) { - x1 = cf2_stack_getReal( opStack, idx + 0 ) + curX; + x1 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, idx + 0 ), + curX ); y1 = curY; - x2 = cf2_stack_getReal( opStack, idx + 1 ) + x1; - y2 = cf2_stack_getReal( opStack, idx + 2 ) + y1; - y3 = cf2_stack_getReal( opStack, idx + 3 ) + y2; + x2 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, idx + 1 ), + x1 ); + y2 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, idx + 2 ), + y1 ); + y3 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, idx + 3 ), + y2 ); if ( count - idx == 5 ) { - x3 = cf2_stack_getReal( opStack, idx + 4 ) + x2; + x3 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, + idx + 4 ), + x2 ); idx++; } @@ -1770,14 +1847,20 @@ else { x1 = curX; - y1 = cf2_stack_getReal( opStack, idx + 0 ) + curY; - x2 = cf2_stack_getReal( opStack, idx + 1 ) + x1; - y2 = cf2_stack_getReal( opStack, idx + 2 ) + y1; - x3 = cf2_stack_getReal( opStack, idx + 3 ) + x2; + y1 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, idx + 0 ), + curY ); + x2 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, idx + 1 ), + x1 ); + y2 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, idx + 2 ), + y1 ); + x3 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, idx + 3 ), + x2 ); if ( count - idx == 5 ) { - y3 = cf2_stack_getReal( opStack, idx + 4 ) + y2; + y3 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, + idx + 4 ), + y2 ); idx++; } From 8d435c463d22f6de35015b244d6f9bb433beb7e6 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Thu, 1 Jun 2017 07:09:44 +0200 Subject: [PATCH 117/470] * src/truetype/ttinterp.c (TT_RunIns): Adjust loop counter again. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Problem reported by Marek KaĹĄĂ­k . The problematic font that exceeds the old limit is Padauk-Bold, version 3.002, containing bytecode generated by a buggy version of ttfautohint. --- ChangeLog | 10 ++++++++++ src/truetype/ttinterp.c | 3 +-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index c38b5af66..a0447129b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2017-06-01 Werner Lemberg + + * src/truetype/ttinterp.c (TT_RunIns): Adjust loop counter again. + + Problem reported by Marek KaĹĄĂ­k . + + The problematic font that exceeds the old limit is Padauk-Bold, + version 3.002, containing bytecode generated by a buggy version of + ttfautohint. + 2017-05-31 Werner Lemberg [cff] 32bit integer overflow run-time errors 2/2 (#46149). diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c index 0c48c2562..775d11047 100644 --- a/src/truetype/ttinterp.c +++ b/src/truetype/ttinterp.c @@ -7649,8 +7649,7 @@ FT_MAX( 50, exc->cvtSize / 10 ); else - exc->loopcall_counter_max = FT_MAX( 100, - 10 * exc->cvtSize ); + exc->loopcall_counter_max = 300 + 8 * exc->cvtSize; /* as a protection against an unreasonable number of CVT entries */ /* we assume at most 100 control values per glyph for the counter */ From 4a1f1a6d2a5118ae45f0f950a824ad7a1363a044 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Thu, 1 Jun 2017 13:15:54 +0200 Subject: [PATCH 118/470] [psaux] 32bit integer overflow tun-time errors (#46149). * src/psaux/t1decode.c (t1_decoder_parse_charstrings): Use OVERFLOW_ADD_LONG and OVERFLOW_SUB_LONG where appropriate. --- ChangeLog | 7 ++++ src/psaux/t1decode.c | 92 +++++++++++++++++++++++++------------------- 2 files changed, 60 insertions(+), 39 deletions(-) diff --git a/ChangeLog b/ChangeLog index a0447129b..57753f2cc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2017-06-01 Werner Lemberg + + [psaux] 32bit integer overflow tun-time errors (#46149). + + * src/psaux/t1decode.c (t1_decoder_parse_charstrings): Use + OVERFLOW_ADD_LONG and OVERFLOW_SUB_LONG where appropriate. + 2017-06-01 Werner Lemberg * src/truetype/ttinterp.c (TT_RunIns): Adjust loop counter again. diff --git a/src/psaux/t1decode.c b/src/psaux/t1decode.c index 7dd45135d..04de1228d 100644 --- a/src/psaux/t1decode.c +++ b/src/psaux/t1decode.c @@ -864,7 +864,9 @@ for ( mm = 1; mm < blend->num_designs; mm++ ) - tmp += FT_MulFix( *delta++, blend->weight_vector[mm] ); + tmp = OVERFLOW_ADD_LONG( + tmp, + FT_MulFix( *delta++, blend->weight_vector[mm] ) ); *values++ = tmp; } @@ -904,7 +906,7 @@ if ( arg_cnt != 2 ) goto Unexpected_OtherSubr; - top[0] += top[1]; /* XXX (over|under)flow */ + top[0] = OVERFLOW_ADD_LONG( top[0], top[1] ); known_othersubr_result_cnt = 1; break; @@ -915,7 +917,7 @@ if ( arg_cnt != 2 ) goto Unexpected_OtherSubr; - top[0] -= top[1]; /* XXX (over|under)flow */ + top[0] = OVERFLOW_SUB_LONG( top[0], top[1] ); known_othersubr_result_cnt = 1; break; @@ -1147,11 +1149,13 @@ builder->parse_state = T1_Parse_Have_Width; - builder->left_bearing.x += top[0]; - builder->advance.x = top[1]; - builder->advance.y = 0; + builder->left_bearing.x = OVERFLOW_ADD_LONG( + builder->left_bearing.x, top[0] ); - orig_x = x = builder->pos_x + top[0]; + builder->advance.x = top[1]; + builder->advance.y = 0; + + orig_x = x = OVERFLOW_ADD_LONG( builder->pos_x, top[0] ); orig_y = y = builder->pos_y; FT_UNUSED( orig_y ); @@ -1177,13 +1181,16 @@ builder->parse_state = T1_Parse_Have_Width; - builder->left_bearing.x += top[0]; - builder->left_bearing.y += top[1]; - builder->advance.x = top[2]; - builder->advance.y = top[3]; + builder->left_bearing.x = OVERFLOW_ADD_LONG( + builder->left_bearing.x, top[0] ); + builder->left_bearing.y = OVERFLOW_ADD_LONG( + builder->left_bearing.y, top[1] ); + + builder->advance.x = top[2]; + builder->advance.y = top[3]; - x = builder->pos_x + top[0]; - y = builder->pos_y + top[1]; + x = OVERFLOW_ADD_LONG( builder->pos_x, top[0] ); + y = OVERFLOW_ADD_LONG( builder->pos_y, top[1] ); /* the `metrics_only' indicates that we only want to compute */ /* the glyph's metrics (lsb + advance width), not load the */ @@ -1210,13 +1217,14 @@ if ( FT_SET_ERROR( t1_builder_start_point( builder, x, y ) ) ) goto Fail; - x += top[0]; + x = OVERFLOW_ADD_LONG( x, top[0] ); goto Add_Line; case op_hmoveto: FT_TRACE4(( " hmoveto" )); - x += top[0]; + x = OVERFLOW_ADD_LONG( x, top[0] ); + if ( !decoder->flex_state ) { if ( builder->parse_state == T1_Parse_Start ) @@ -1232,12 +1240,14 @@ FT_SET_ERROR( t1_builder_check_points( builder, 3 ) ) ) goto Fail; - x += top[0]; + x = OVERFLOW_ADD_LONG( x, top[0] ); t1_builder_add_point( builder, x, y, 0 ); - x += top[1]; - y += top[2]; + + x = OVERFLOW_ADD_LONG( x, top[1] ); + y = OVERFLOW_ADD_LONG( y, top[2] ); t1_builder_add_point( builder, x, y, 0 ); - y += top[3]; + + y = OVERFLOW_ADD_LONG( y, top[3] ); t1_builder_add_point( builder, x, y, 1 ); break; @@ -1247,8 +1257,8 @@ if ( FT_SET_ERROR( t1_builder_start_point( builder, x, y ) ) ) goto Fail; - x += top[0]; - y += top[1]; + x = OVERFLOW_ADD_LONG( x, top[0] ); + y = OVERFLOW_ADD_LONG( y, top[1] ); Add_Line: if ( FT_SET_ERROR( t1_builder_add_point1( builder, x, y ) ) ) @@ -1258,8 +1268,9 @@ case op_rmoveto: FT_TRACE4(( " rmoveto" )); - x += top[0]; - y += top[1]; + x = OVERFLOW_ADD_LONG( x, top[0] ); + y = OVERFLOW_ADD_LONG( y, top[1] ); + if ( !decoder->flex_state ) { if ( builder->parse_state == T1_Parse_Start ) @@ -1275,16 +1286,16 @@ FT_SET_ERROR( t1_builder_check_points( builder, 3 ) ) ) goto Fail; - x += top[0]; - y += top[1]; + x = OVERFLOW_ADD_LONG( x, top[0] ); + y = OVERFLOW_ADD_LONG( y, top[1] ); t1_builder_add_point( builder, x, y, 0 ); - x += top[2]; - y += top[3]; + x = OVERFLOW_ADD_LONG( x, top[2] ); + y = OVERFLOW_ADD_LONG( y, top[3] ); t1_builder_add_point( builder, x, y, 0 ); - x += top[4]; - y += top[5]; + x = OVERFLOW_ADD_LONG( x, top[4] ); + y = OVERFLOW_ADD_LONG( y, top[5] ); t1_builder_add_point( builder, x, y, 1 ); break; @@ -1295,12 +1306,14 @@ FT_SET_ERROR( t1_builder_check_points( builder, 3 ) ) ) goto Fail; - y += top[0]; + y = OVERFLOW_ADD_LONG( y, top[0] ); t1_builder_add_point( builder, x, y, 0 ); - x += top[1]; - y += top[2]; + + x = OVERFLOW_ADD_LONG( x, top[1] ); + y = OVERFLOW_ADD_LONG( y, top[2] ); t1_builder_add_point( builder, x, y, 0 ); - x += top[3]; + + x = OVERFLOW_ADD_LONG( x, top[3] ); t1_builder_add_point( builder, x, y, 1 ); break; @@ -1310,13 +1323,14 @@ if ( FT_SET_ERROR( t1_builder_start_point( builder, x, y ) ) ) goto Fail; - y += top[0]; + y = OVERFLOW_ADD_LONG( y, top[0] ); goto Add_Line; case op_vmoveto: FT_TRACE4(( " vmoveto" )); - y += top[0]; + y = OVERFLOW_ADD_LONG( y, top[0] ); + if ( !decoder->flex_state ) { if ( builder->parse_state == T1_Parse_Start ) @@ -1473,7 +1487,7 @@ /* record vertical hint */ if ( hinter ) { - top[0] += orig_x; + top[0] = OVERFLOW_ADD_LONG( top[0], orig_x ); hinter->stem( hinter->hints, 0, top ); } break; @@ -1487,9 +1501,9 @@ FT_Pos dx = orig_x; - top[0] += dx; - top[2] += dx; - top[4] += dx; + top[0] = OVERFLOW_ADD_LONG( top[0], dx ); + top[2] = OVERFLOW_ADD_LONG( top[2], dx ); + top[4] = OVERFLOW_ADD_LONG( top[4], dx ); hinter->stem3( hinter->hints, 0, top ); } break; From 0ad326236607df0802dc72c4f13b3f35484b7672 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Thu, 1 Jun 2017 17:00:37 +0200 Subject: [PATCH 119/470] * src/base/ftglyph.c (FT_Get_Glyph): Check `slot->advance'. --- ChangeLog | 4 ++++ src/base/ftglyph.c | 13 +++++++++++++ 2 files changed, 17 insertions(+) diff --git a/ChangeLog b/ChangeLog index 57753f2cc..35b18c12d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2017-06-01 Werner Lemberg + + * src/base/ftglyph.c (FT_Get_Glyph): Check `slot->advance'. + 2017-06-01 Werner Lemberg [psaux] 32bit integer overflow tun-time errors (#46149). diff --git a/src/base/ftglyph.c b/src/base/ftglyph.c index 9bfb33050..62d94cbd3 100644 --- a/src/base/ftglyph.c +++ b/src/base/ftglyph.c @@ -408,6 +408,19 @@ goto Exit; /* copy advance while converting 26.6 to 16.16 format */ + if ( slot->advance.x >= 0x8000L * 64 || + slot->advance.x <= -0x8000L * 64 ) + { + FT_ERROR(( "FT_Get_Glyph: advance width too large\n" )); + return FT_THROW( Invalid_Argument ); + } + if ( slot->advance.y >= 0x8000L * 64 || + slot->advance.y <= -0x8000L * 64 ) + { + FT_ERROR(( "FT_Get_Glyph: advance height too large\n" )); + return FT_THROW( Invalid_Argument ); + } + glyph->advance.x = slot->advance.x * 1024; glyph->advance.y = slot->advance.y * 1024; From a607e3919d2445942ca58b126b060b262e023e16 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Thu, 1 Jun 2017 17:03:07 +0200 Subject: [PATCH 120/470] Minor comment. --- include/freetype/ftglyph.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/freetype/ftglyph.h b/include/freetype/ftglyph.h index 5869bc1ce..db1a2c8ba 100644 --- a/include/freetype/ftglyph.h +++ b/include/freetype/ftglyph.h @@ -231,6 +231,12 @@ FT_BEGIN_HEADER /* */ /* FreeType error code. 0~means success. */ /* */ + /* */ + /* Because `*aglyph->advance.x' and '*aglyph->advance.y' are 16.16 */ + /* fixed-point numbers, `slot->advance.x' and `slot->advance.y' */ + /* (which are in 26.6 fixed-point format) must be in the range */ + /* ]-32768;32768[. */ + /* */ FT_EXPORT( FT_Error ) FT_Get_Glyph( FT_GlyphSlot slot, FT_Glyph *aglyph ); From cd02d359a6d0455e9d16b87bf9665961c4699538 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Thu, 1 Jun 2017 17:05:39 +0200 Subject: [PATCH 121/470] [smooth] Some 32bit integer overflow run-time errors. * src/smooth/ftgrays.c [STANDALONE] (OVERFLOW_ADD_LONG, OVERFLOW_SUB_LONG, OVERFLOW_MUL_LONG, NEG_LONG): New macros. [!STANDALONE]: Include FT_INTERNAL_CALC_H. (gray_render_cubic): Use those macros where appropriate. --- ChangeLog | 9 +++++++++ src/smooth/ftgrays.c | 17 +++++++++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 35b18c12d..04d70a39d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2017-06-01 Werner Lemberg + + [smooth] Some 32bit integer overflow run-time errors. + + * src/smooth/ftgrays.c [STANDALONE] (OVERFLOW_ADD_LONG, + OVERFLOW_SUB_LONG, OVERFLOW_MUL_LONG, NEG_LONG): New macros. + [!STANDALONE]: Include FT_INTERNAL_CALC_H. + (gray_render_cubic): Use those macros where appropriate. + 2017-06-01 Werner Lemberg * src/base/ftglyph.c (FT_Get_Glyph): Check `slot->advance'. diff --git a/src/smooth/ftgrays.c b/src/smooth/ftgrays.c index e9a3ce7a7..04f0c2ab3 100644 --- a/src/smooth/ftgrays.c +++ b/src/smooth/ftgrays.c @@ -141,6 +141,16 @@ #define FT_INT_MAX INT_MAX #define FT_ULONG_MAX ULONG_MAX +#define OVERFLOW_ADD_LONG( a, b ) \ + (long)( (unsigned long)(a) + (unsigned long)(b) ) +#define OVERFLOW_SUB_LONG( a, b ) \ + (long)( (unsigned long)(a) - (unsigned long)(b) ) +#define OVERFLOW_MUL_LONG( a, b ) \ + (long)( (unsigned long)(a) * (unsigned long)(b) ) +#define NEG_LONG( a ) \ + (long)( -(unsigned long)(a) ) + + #define ft_memset memset #define ft_setjmp setjmp @@ -264,6 +274,7 @@ typedef ptrdiff_t FT_PtrDist; #include "ftgrays.h" #include FT_INTERNAL_OBJECTS_H #include FT_INTERNAL_DEBUG_H +#include FT_INTERNAL_CALC_H #include FT_OUTLINE_H #include "ftsmerrs.h" @@ -1135,7 +1146,8 @@ typedef ptrdiff_t FT_PtrDist; /* s is L * the perpendicular distance from P1 to the line P0-P3. */ dx1 = arc[1].x - arc[0].x; dy1 = arc[1].y - arc[0].y; - s = FT_ABS( dy * dx1 - dx * dy1 ); + s = FT_ABS( OVERFLOW_SUB_LONG( OVERFLOW_MUL_LONG( dy, dx1 ), + OVERFLOW_MUL_LONG( dx, dy1 ) ) ); if ( s > s_limit ) goto Split; @@ -1143,7 +1155,8 @@ typedef ptrdiff_t FT_PtrDist; /* s is L * the perpendicular distance from P2 to the line P0-P3. */ dx2 = arc[2].x - arc[0].x; dy2 = arc[2].y - arc[0].y; - s = FT_ABS( dy * dx2 - dx * dy2 ); + s = FT_ABS( OVERFLOW_SUB_LONG( OVERFLOW_MUL_LONG( dy, dx2 ), + OVERFLOW_MUL_LONG( dx, dy2 ) ) ); if ( s > s_limit ) goto Split; From 3802ca8b643dbc966d12ef11ed8e2e5893cabef2 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Fri, 2 Jun 2017 08:44:20 +0200 Subject: [PATCH 122/470] [cff] Fix integer overflows. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2027 https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2028 * src/cff/cf2hints.c (cf2_hintmap_insertHint), src/cff/cf2intrp.c (cf2_doFlex): Use OVERFLOW_ADD_INT32 and OVERFLOW_SUB_INT32. --- ChangeLog | 12 ++++++++++++ src/cff/cf2hints.c | 18 ++++++++++-------- src/cff/cf2intrp.c | 7 +++++-- 3 files changed, 27 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 04d70a39d..15b77ab39 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2017-06-02 Werner Lemberg + + [cff] Fix integer overflows. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2027 + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2028 + + * src/cff/cf2hints.c (cf2_hintmap_insertHint), src/cff/cf2intrp.c + (cf2_doFlex): Use OVERFLOW_ADD_INT32 and OVERFLOW_SUB_INT32. + 2017-06-01 Werner Lemberg [smooth] Some 32bit integer overflow run-time errors. diff --git a/src/cff/cf2hints.c b/src/cff/cf2hints.c index 5efb180dc..dbd3c8864 100644 --- a/src/cff/cf2hints.c +++ b/src/cff/cf2hints.c @@ -638,14 +638,16 @@ { /* Use hint map to position the center of stem, and nominal scale */ /* to position the two edges. This preserves the stem width. */ - CF2_Fixed midpoint = cf2_hintmap_map( - hintmap->initialHintMap, - ( secondHintEdge->csCoord + - firstHintEdge->csCoord ) / 2 ); - CF2_Fixed halfWidth = FT_MulFix( - ( secondHintEdge->csCoord - - firstHintEdge->csCoord ) / 2, - hintmap->scale ); + CF2_Fixed midpoint = + cf2_hintmap_map( + hintmap->initialHintMap, + OVERFLOW_ADD_INT32( secondHintEdge->csCoord, + firstHintEdge->csCoord ) / 2 ); + CF2_Fixed halfWidth = + FT_MulFix( + OVERFLOW_SUB_INT32( secondHintEdge->csCoord, + firstHintEdge->csCoord ) / 2, + hintmap->scale ); firstHintEdge->dsCoord = midpoint - halfWidth; diff --git a/src/cff/cf2intrp.c b/src/cff/cf2intrp.c index 8f0785d59..463b7e89b 100644 --- a/src/cff/cf2intrp.c +++ b/src/cff/cf2intrp.c @@ -358,8 +358,11 @@ if ( doConditionalLastRead ) { - FT_Bool lastIsX = (FT_Bool)( cf2_fixedAbs( vals[10] - *curX ) > - cf2_fixedAbs( vals[11] - *curY ) ); + FT_Bool lastIsX = (FT_Bool)( + cf2_fixedAbs( OVERFLOW_SUB_INT32( vals[10], + *curX ) ) > + cf2_fixedAbs( OVERFLOW_SUB_INT32( vals[11], + *curY ) ) ); CF2_Fixed lastVal = cf2_stack_getReal( opStack, idx ); From 47a03e9b2366bba091bc21d011ab60782538243a Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Fri, 2 Jun 2017 09:06:36 +0200 Subject: [PATCH 123/470] [bdf] Fix integer scanning routines. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2029 * src/bdf/bdflib.c (_bdf_atoul, _bdf_atol, _bdf_atous, _bdf_atos): Stop scanning if result would overflow. --- ChangeLog | 11 +++++++++++ src/bdf/bdflib.c | 40 ++++++++++++++++++++++++++++++++++++---- 2 files changed, 47 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 15b77ab39..6d921bacb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2017-06-02 Werner Lemberg + + [bdf] Fix integer scanning routines. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2029 + + * src/bdf/bdflib.c (_bdf_atoul, _bdf_atol, _bdf_atous, _bdf_atos): + Stop scanning if result would overflow. + 2017-06-02 Werner Lemberg [cff] Fix integer overflows. diff --git a/src/bdf/bdflib.c b/src/bdf/bdflib.c index 7fd95a738..bf10887fd 100644 --- a/src/bdf/bdflib.c +++ b/src/bdf/bdflib.c @@ -704,7 +704,15 @@ return 0; for ( v = 0; sbitset( ddigits, *s ); s++ ) - v = v * 10 + a2i[(int)*s]; + { + if ( v < ( ULONG_MAX - 9 ) / 10 ) + v = v * 10 + a2i[(int)*s]; + else + { + v = ULONG_MAX; + break; + } + } return v; } @@ -729,7 +737,15 @@ } for ( v = 0; sbitset( ddigits, *s ); s++ ) - v = v * 10 + a2i[(int)*s]; + { + if ( v < ( LONG_MAX - 9 ) / 10 ) + v = v * 10 + a2i[(int)*s]; + else + { + v = LONG_MAX; + break; + } + } return ( !neg ) ? v : -v; } @@ -746,7 +762,15 @@ return 0; for ( v = 0; sbitset( ddigits, *s ); s++ ) - v = (unsigned short)( v * 10 + a2i[(int)*s] ); + { + if ( v < ( USHRT_MAX - 9 ) / 10 ) + v = (unsigned short)( v * 10 + a2i[(int)*s] ); + else + { + v = USHRT_MAX; + break; + } + } return v; } @@ -771,7 +795,15 @@ } for ( v = 0; sbitset( ddigits, *s ); s++ ) - v = (short)( v * 10 + a2i[(int)*s] ); + { + if ( v < ( SHRT_MAX - 9 ) / 10 ) + v = (short)( v * 10 + a2i[(int)*s] ); + else + { + v = SHRT_MAX; + break; + } + } return (short)( ( !neg ) ? v : -v ); } From 03b0cc2ea9b63f57ec58f77d8cc1350691d7140a Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Fri, 2 Jun 2017 09:16:52 +0200 Subject: [PATCH 124/470] [bdf] Don't left-shift negative numbers. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2031 * src/bdf/bdfdrivr.c (BDF_Face_Init): Use multiplication. --- ChangeLog | 10 ++++++++++ src/bdf/bdfdrivr.c | 4 ++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6d921bacb..6194a2fe6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2017-06-02 Werner Lemberg + + [bdf] Don't left-shift negative numbers. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2031 + + * src/bdf/bdfdrivr.c (BDF_Face_Init): Use multiplication. + 2017-06-02 Werner Lemberg [bdf] Fix integer scanning routines. diff --git a/src/bdf/bdfdrivr.c b/src/bdf/bdfdrivr.c index c0a5a5c50..540d367c6 100644 --- a/src/bdf/bdfdrivr.c +++ b/src/bdf/bdfdrivr.c @@ -455,11 +455,11 @@ THE SOFTWARE. bsize->size = (FT_Pos)( ( prop->value.l * 64 * 7200 + 36135L ) / 72270L ); else - bsize->size = bsize->width << 6; + bsize->size = bsize->width * 64; prop = bdf_get_font_property( font, "PIXEL_SIZE" ); if ( prop ) - bsize->y_ppem = (FT_Short)prop->value.l << 6; + bsize->y_ppem = (FT_Short)prop->value.l * 64; prop = bdf_get_font_property( font, "RESOLUTION_X" ); if ( prop ) From 7a4276fb9095430b86b329f52fb8dfe26f966dcd Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Fri, 2 Jun 2017 09:21:37 +0200 Subject: [PATCH 125/470] [cff] More integer overflows. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2032 * src/cff/cf2blues.c (cf2_blues_init): Use OVERFLOW_SUB_INT32. --- ChangeLog | 10 ++++++++++ src/cff/cf2blues.c | 9 ++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6194a2fe6..1b7335db6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2017-06-02 Werner Lemberg + + [cff] More integer overflows. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2032 + + * src/cff/cf2blues.c (cf2_blues_init): Use OVERFLOW_SUB_INT32. + 2017-06-02 Werner Lemberg [bdf] Don't left-shift negative numbers. diff --git a/src/cff/cf2blues.c b/src/cff/cf2blues.c index 141d0fcae..950c71473 100644 --- a/src/cff/cf2blues.c +++ b/src/cff/cf2blues.c @@ -301,7 +301,8 @@ /* top edge */ flatFamilyEdge = cf2_blueToFixed( familyOtherBlues[j + 1] ); - diff = cf2_fixedAbs( flatEdge - flatFamilyEdge ); + diff = cf2_fixedAbs( OVERFLOW_SUB_INT32( flatEdge, + flatFamilyEdge ) ); if ( diff < minDiff && diff < csUnitsPerPixel ) { @@ -319,7 +320,8 @@ /* top edge */ flatFamilyEdge = cf2_blueToFixed( familyBlues[1] ); - diff = cf2_fixedAbs( flatEdge - flatFamilyEdge ); + diff = cf2_fixedAbs( OVERFLOW_SUB_INT32( flatEdge, + flatFamilyEdge ) ); if ( diff < minDiff && diff < csUnitsPerPixel ) blues->zone[i].csFlatEdge = flatFamilyEdge; @@ -342,7 +344,8 @@ /* adjust edges of top zone upward by twice darkening amount */ flatFamilyEdge += 2 * font->darkenY; /* bottom edge */ - diff = cf2_fixedAbs( flatEdge - flatFamilyEdge ); + diff = cf2_fixedAbs( OVERFLOW_SUB_INT32( flatEdge, + flatFamilyEdge ) ); if ( diff < minDiff && diff < csUnitsPerPixel ) { From 0716c6ab7a1c43ba88192498d23e84178e216820 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Fri, 2 Jun 2017 19:24:03 +0200 Subject: [PATCH 126/470] [cff] Even more integer overflows. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2046 * src/cff/cf2intrp.c (cf2_doStems, cf2_interpT2CharString): Use OVERFLOW_ADD_INT32. --- ChangeLog | 11 +++++++++++ src/cff/cf2intrp.c | 14 ++++++++------ 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1b7335db6..77446ec4a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2017-06-02 Werner Lemberg + + [cff] Even more integer overflows. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2046 + + * src/cff/cf2intrp.c (cf2_doStems, cf2_interpT2CharString): Use + OVERFLOW_ADD_INT32. + 2017-06-02 Werner Lemberg [cff] More integer overflows. diff --git a/src/cff/cf2intrp.c b/src/cff/cf2intrp.c index 463b7e89b..356475828 100644 --- a/src/cff/cf2intrp.c +++ b/src/cff/cf2intrp.c @@ -304,10 +304,12 @@ CF2_StemHintRec stemhint; - stemhint.min = - position += cf2_stack_getReal( opStack, i ); - stemhint.max = - position += cf2_stack_getReal( opStack, i + 1 ); + stemhint.min = + position = OVERFLOW_ADD_INT32( position, + cf2_stack_getReal( opStack, i ) ); + stemhint.max = + position = OVERFLOW_ADD_INT32( position, + cf2_stack_getReal( opStack, i + 1 ) ); stemhint.used = FALSE; stemhint.maxDS = @@ -1617,8 +1619,8 @@ if ( font->decoder->width_only ) goto exit; - curY += cf2_stack_popFixed( opStack ); - curX += cf2_stack_popFixed( opStack ); + curY = OVERFLOW_ADD_INT32( curY, cf2_stack_popFixed( opStack ) ); + curX = OVERFLOW_ADD_INT32( curX, cf2_stack_popFixed( opStack ) ); cf2_glyphpath_moveTo( &glyphPath, curX, curY ); From c5a225413ffd6f3e032cede5a14d64a2c2c047a2 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sat, 3 Jun 2017 06:13:10 +0200 Subject: [PATCH 127/470] ftcalc.h: Avoid left-shift of negative numbers. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2055 * include/freetype/internal/ftcalc.h (INT_TO_F26DOT6, INT_TO_F2DOT14, INT_TO_FIXED, F2DOT14_TO_FIXED): Use multiplication. --- ChangeLog | 11 +++++++++++ include/freetype/internal/ftcalc.h | 8 ++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 77446ec4a..5976f0ea0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2017-06-03 Werner Lemberg + + ftcalc.h: Avoid left-shift of negative numbers. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2055 + + * include/freetype/internal/ftcalc.h (INT_TO_F26DOT6, + INT_TO_F2DOT14, INT_TO_FIXED, F2DOT14_TO_FIXED): Use multiplication. + 2017-06-02 Werner Lemberg [cff] Even more integer overflows. diff --git a/include/freetype/internal/ftcalc.h b/include/freetype/internal/ftcalc.h index 2b040feea..5902e190e 100644 --- a/include/freetype/internal/ftcalc.h +++ b/include/freetype/internal/ftcalc.h @@ -399,10 +399,10 @@ FT_BEGIN_HEADER #endif /* 0 */ -#define INT_TO_F26DOT6( x ) ( (FT_Long)(x) << 6 ) -#define INT_TO_F2DOT14( x ) ( (FT_Long)(x) << 14 ) -#define INT_TO_FIXED( x ) ( (FT_Long)(x) << 16 ) -#define F2DOT14_TO_FIXED( x ) ( (FT_Long)(x) << 2 ) +#define INT_TO_F26DOT6( x ) ( (FT_Long)(x) * 64 ) /* << 6 */ +#define INT_TO_F2DOT14( x ) ( (FT_Long)(x) * 16384 ) /* << 14 */ +#define INT_TO_FIXED( x ) ( (FT_Long)(x) * 65536 ) /* << 16 */ +#define F2DOT14_TO_FIXED( x ) ( (FT_Long)(x) * 4 ) /* << 2 */ #define FIXED_TO_INT( x ) ( FT_RoundFix( x ) >> 16 ) #define ROUND_F26DOT6( x ) ( x >= 0 ? ( ( (x) + 32 ) & -64 ) \ From 1ea343228d8987afae5f58908581c1e59e26e9ad Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sat, 3 Jun 2017 06:52:13 +0200 Subject: [PATCH 128/470] [cff, truetype] Integer overflows. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2047 https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2057 * src/cff/cf2hints.c (cf2_hintmap_map): Use OVERFLOW_SUB_INT32. * src/truetype/ttinterp.c (Ins_ADD): Use OVERFLOW_ADD_LONG. (Ins_SUB): Use OVERFLOW_SUB_LONG. (Ins_NEG): Use NEG_LONG. --- ChangeLog | 15 +++++++++++++++ src/cff/cf2hints.c | 3 ++- src/truetype/ttinterp.c | 6 +++--- src/type1/t1load.c | 4 ++-- 4 files changed, 22 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5976f0ea0..83a239af1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2017-06-03 Werner Lemberg + + [cff, truetype] Integer overflows. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2047 + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2057 + + * src/cff/cf2hints.c (cf2_hintmap_map): Use OVERFLOW_SUB_INT32. + + * src/truetype/ttinterp.c (Ins_ADD): Use OVERFLOW_ADD_LONG. + (Ins_SUB): Use OVERFLOW_SUB_LONG. + (Ins_NEG): Use NEG_LONG. + 2017-06-03 Werner Lemberg ftcalc.h: Avoid left-shift of negative numbers. diff --git a/src/cff/cf2hints.c b/src/cff/cf2hints.c index dbd3c8864..89af2ff7a 100644 --- a/src/cff/cf2hints.c +++ b/src/cff/cf2hints.c @@ -343,7 +343,8 @@ * Use edge[i], the highest entry where csCoord >= entry[i].csCoord */ return OVERFLOW_ADD_INT32( - FT_MulFix( csCoord - hintmap->edge[i].csCoord, + FT_MulFix( OVERFLOW_SUB_INT32( csCoord, + hintmap->edge[i].csCoord ), hintmap->edge[i].scale ), hintmap->edge[i].dsCoord ); } diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c index 775d11047..cbb754094 100644 --- a/src/truetype/ttinterp.c +++ b/src/truetype/ttinterp.c @@ -2826,7 +2826,7 @@ static void Ins_ADD( FT_Long* args ) { - args[0] += args[1]; + args[0] = OVERFLOW_ADD_LONG( args[0], args[1] ); } @@ -2839,7 +2839,7 @@ static void Ins_SUB( FT_Long* args ) { - args[0] -= args[1]; + args[0] = OVERFLOW_SUB_LONG( args[0], args[1] ); } @@ -2895,7 +2895,7 @@ static void Ins_NEG( FT_Long* args ) { - args[0] = -args[0]; + args[0] = NEG_LONG( args[0] ); } diff --git a/src/type1/t1load.c b/src/type1/t1load.c index f5c661f7d..f569d6bec 100644 --- a/src/type1/t1load.c +++ b/src/type1/t1load.c @@ -329,8 +329,8 @@ for ( i = 0; i < mmaster.num_axis; i++ ) { mmvar->axis[i].name = mmaster.axis[i].name; - mmvar->axis[i].minimum = INT_TO_FIXED( mmaster.axis[i].minimum); - mmvar->axis[i].maximum = INT_TO_FIXED( mmaster.axis[i].maximum); + mmvar->axis[i].minimum = INT_TO_FIXED( mmaster.axis[i].minimum ); + mmvar->axis[i].maximum = INT_TO_FIXED( mmaster.axis[i].maximum ); mmvar->axis[i].def = ( mmvar->axis[i].minimum + mmvar->axis[i].maximum ) / 2; /* Does not apply. But this value is in range */ From 2c2e6403b7c16cd1e3b20d18acdc935898eee040 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sat, 3 Jun 2017 07:38:11 +0200 Subject: [PATCH 129/470] [bdf] Synchronize sanity checks with pcf driver. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2054 https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2058 * src/bdf/bdfdrivr.c (BDF_Face_Init): Check font ascent and descent. Check AVERAGE_WIDTH, POINT_SIZE, PIXEL_SIZE, RESOLUTION_X, and RESOLUTION_Y properties. --- ChangeLog | 13 ++++++ src/bdf/bdfdrivr.c | 108 ++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 111 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 83a239af1..0bf03f3ec 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2017-06-03 Werner Lemberg + + [bdf] Synchronize sanity checks with pcf driver. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2054 + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2058 + + * src/bdf/bdfdrivr.c (BDF_Face_Init): Check font ascent and descent. + Check AVERAGE_WIDTH, POINT_SIZE, PIXEL_SIZE, RESOLUTION_X, and + RESOLUTION_Y properties. + 2017-06-03 Werner Lemberg [cff, truetype] Integer overflows. diff --git a/src/bdf/bdfdrivr.c b/src/bdf/bdfdrivr.c index 540d367c6..c7b9b4111 100644 --- a/src/bdf/bdfdrivr.c +++ b/src/bdf/bdfdrivr.c @@ -373,7 +373,7 @@ THE SOFTWARE. /* we have a bdf font: let's construct the face object */ face->bdffont = font; - /* BDF could not have multiple face in single font file. + /* BDF cannot have multiple faces in a single font file. * XXX: non-zero face_index is already invalid argument, but * Type1, Type42 driver has a convention to return * an invalid argument error when the font could be @@ -441,42 +441,130 @@ THE SOFTWARE. FT_ZERO( bsize ); + /* sanity checks */ + if ( FT_ABS( font->font_ascent ) > 0x7FFF ) + { + font->font_ascent = font->font_ascent < 0 ? -0x7FFF : 0x7FFF; + FT_TRACE0(( "BDF_Face_Init: clamping font ascent to value %d\n", + font->font_ascent )); + } + if ( FT_ABS( font->font_descent ) > 0x7FFF ) + { + font->font_descent = font->font_descent < 0 ? -0x7FFF : 0x7FFF; + FT_TRACE0(( "BDF_Face_Init: clamping font descent to value %d\n", + font->font_descent )); + } + bsize->height = (FT_Short)( font->font_ascent + font->font_descent ); prop = bdf_get_font_property( font, "AVERAGE_WIDTH" ); if ( prop ) - bsize->width = (FT_Short)( ( prop->value.l + 5 ) / 10 ); + { +#ifdef FT_DEBUG_LEVEL_TRACE + if ( prop->value.l < 0 ) + FT_TRACE0(( "BDF_Face_Init: negative average width\n" )); +#endif + if ( ( FT_ABS( prop->value.l ) > 0x7FFFL * 10 - 5 ) ) + { + bsize->width = 0x7FFF; + FT_TRACE0(( "BDF_Face_Init: clamping average width to value %d\n", + bsize->width )); + } + else + bsize->width = FT_ABS( (FT_Short)( ( prop->value.l + 5 ) / 10 ) ); + } else - bsize->width = (FT_Short)( bsize->height * 2/3 ); + { + /* this is a heuristical value */ + bsize->width = (FT_Short)FT_MulDiv( bsize->height, 2, 3 ); + } prop = bdf_get_font_property( font, "POINT_SIZE" ); if ( prop ) + { +#ifdef FT_DEBUG_LEVEL_TRACE + if ( prop->value.l < 0 ) + FT_TRACE0(( "BDF_Face_Init: negative point size\n" )); +#endif /* convert from 722.7 decipoints to 72 points per inch */ - bsize->size = - (FT_Pos)( ( prop->value.l * 64 * 7200 + 36135L ) / 72270L ); + if ( FT_ABS( prop->value.l ) > 0x504C2L ) /* 0x7FFF * 72270/7200 */ + { + bsize->size = 0x7FFF; + FT_TRACE0(( "BDF_Face_Init: clamping point size to value %d\n", + bsize->size )); + } + else + bsize->size = FT_MulDiv( FT_ABS( prop->value.l ), + 64 * 7200, + 72270L ); + } else + { + /* this is a heuristical value */ bsize->size = bsize->width * 64; + } prop = bdf_get_font_property( font, "PIXEL_SIZE" ); if ( prop ) - bsize->y_ppem = (FT_Short)prop->value.l * 64; + { +#ifdef FT_DEBUG_LEVEL_TRACE + if ( prop->value.l < 0 ) + FT_TRACE0(( "BDF_Face_Init: negative pixel size\n" )); +#endif + if ( FT_ABS( prop->value.l ) > 0x7FFF ) + { + bsize->y_ppem = 0x7FFF << 6; + FT_TRACE0(( "BDF_Face_Init: clamping pixel size to value %d\n", + bsize->y_ppem )); + } + else + bsize->y_ppem = FT_ABS( (FT_Short)prop->value.l ) << 6; + } prop = bdf_get_font_property( font, "RESOLUTION_X" ); if ( prop ) - resolution_x = (FT_Short)prop->value.l; + { +#ifdef FT_DEBUG_LEVEL_TRACE + if ( prop->value.l < 0 ) + FT_TRACE0(( "BDF_Face_Init: negative X resolution\n" )); +#endif + if ( FT_ABS( prop->value.l ) > 0x7FFF ) + { + resolution_x = 0x7FFF; + FT_TRACE0(( "BDF_Face_Init: clamping X resolution to value %d\n", + resolution_x )); + } + else + resolution_x = FT_ABS( (FT_Short)prop->value.l ); + } prop = bdf_get_font_property( font, "RESOLUTION_Y" ); if ( prop ) - resolution_y = (FT_Short)prop->value.l; + { +#ifdef FT_DEBUG_LEVEL_TRACE + if ( prop->value.l < 0 ) + FT_TRACE0(( "BDF_Face_Init: negative Y resolution\n" )); +#endif + if ( FT_ABS( prop->value.l ) > 0x7FFF ) + { + resolution_y = 0x7FFF; + FT_TRACE0(( "BDF_Face_Init: clamping Y resolution to value %d\n", + resolution_y )); + } + else + resolution_y = FT_ABS( (FT_Short)prop->value.l ); + } if ( bsize->y_ppem == 0 ) { bsize->y_ppem = bsize->size; if ( resolution_y ) - bsize->y_ppem = bsize->y_ppem * resolution_y / 72; + bsize->y_ppem = FT_MulDiv( bsize->y_ppem, resolution_y, 72 ); } if ( resolution_x && resolution_y ) - bsize->x_ppem = bsize->y_ppem * resolution_x / resolution_y; + bsize->x_ppem = FT_MulDiv( bsize->y_ppem, + resolution_x, + resolution_y ); else bsize->x_ppem = bsize->y_ppem; } From c9a9cf59159e65c43843f4a2e5966ff486058ace Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sat, 3 Jun 2017 09:41:50 +0200 Subject: [PATCH 130/470] * builds/unix/freetype-config.in: Fix pkg-config test (#51162). Patch directly taken from bug report. --- ChangeLog | 6 ++++++ builds/unix/freetype-config.in | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 0bf03f3ec..f36748ca0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2017-06-03 Werner Lemberg + + * builds/unix/freetype-config.in: Fix pkg-config test (#51162). + + Patch directly taken from bug report. + 2017-06-03 Werner Lemberg [bdf] Synchronize sanity checks with pcf driver. diff --git a/builds/unix/freetype-config.in b/builds/unix/freetype-config.in index 97de13449..22eb8379e 100644 --- a/builds/unix/freetype-config.in +++ b/builds/unix/freetype-config.in @@ -14,7 +14,7 @@ export LC_ALL # if `pkg-config' is available, use values from `freetype2.pc' -pkg-config --version >/dev/null 2>&1 +pkg-config --atleast-pkgconfig-version 0.24 >/dev/null 2>&1 if test $? -eq 0 ; then # note that option `--variable' is not affected by the # PKG_CONFIG_SYSROOT_DIR environment variable From addb2dddb6fd4be32ea16b44831e4cc99bbc9693 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sat, 3 Jun 2017 21:05:42 +0200 Subject: [PATCH 131/470] [base, cff, truetype] Integer overflows. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2060 https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2062 https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2063 https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2068 * src/base/ftobjs.c (ft_glyphslot_grid_fit_metrics): Use OVERFLOW_ADD_LONG and OVERFLOW_SUB_LONG. * src/cff/cf2blues.c (cf2_blues_capture), src/cff/cf2hints.c (cf2_hintmap_adjustHints): Use OVERFLOW_SUB_INT32. * src/truetype/ttgload.c (compute_glyph_metrics): User OVERFLOW_SUB_LONG. * src/truetype/ttinterp.c (Direct_Move, Direct_Move_Orig, Direct_Move_X, Direct_Move_Y, Direct_Move_Orig_X, Direct_Move_Orig_Y, Move_Zp2_Point, Ins_MSIRP): Use OVERFLOW_ADD_LONG and OVERFLOW_SUB_LONG. --- ChangeLog | 27 +++++++++++++++++++- src/base/ftobjs.c | 24 ++++++++++++------ src/cff/cf2blues.c | 3 ++- src/cff/cf2hints.c | 12 ++++++--- src/truetype/ttgload.c | 7 +++--- src/truetype/ttinterp.c | 56 +++++++++++++++++++++++++++-------------- 6 files changed, 93 insertions(+), 36 deletions(-) diff --git a/ChangeLog b/ChangeLog index f36748ca0..e3a42c226 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,28 @@ +2017-06-03 Werner Lemberg + + [base, cff, truetype] Integer overflows. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2060 + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2062 + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2063 + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2068 + + * src/base/ftobjs.c (ft_glyphslot_grid_fit_metrics): Use + OVERFLOW_ADD_LONG and OVERFLOW_SUB_LONG. + + * src/cff/cf2blues.c (cf2_blues_capture), src/cff/cf2hints.c + (cf2_hintmap_adjustHints): Use OVERFLOW_SUB_INT32. + + * src/truetype/ttgload.c (compute_glyph_metrics): User + OVERFLOW_SUB_LONG. + + * src/truetype/ttinterp.c (Direct_Move, Direct_Move_Orig, + Direct_Move_X, Direct_Move_Y, Direct_Move_Orig_X, + Direct_Move_Orig_Y, Move_Zp2_Point, Ins_MSIRP): Use + OVERFLOW_ADD_LONG and OVERFLOW_SUB_LONG. + 2017-06-03 Werner Lemberg * builds/unix/freetype-config.in: Fix pkg-config test (#51162). @@ -2855,7 +2880,7 @@ [cff] Implement CFF2 support (2/2). The font variation code. All parts dependent on the GX code in the - `truetype' module are guarded with TT_CONFIG_OPTION_GX_VAR_SUPPORT. + `truetype' module are guarded with TT_CONFIG_OPTION_GX_VAR_SUPPORT. In other words, you can still compile the `cff' module without defining TT_CONFIG_OPTION_GX_VAR_SUPPORT (which brings you CFF2 support without font variation). diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c index 75e498890..cd5874c9d 100644 --- a/src/base/ftobjs.c +++ b/src/base/ftobjs.c @@ -581,28 +581,36 @@ metrics->horiBearingX = FT_PIX_FLOOR( metrics->horiBearingX ); metrics->horiBearingY = FT_PIX_CEIL ( metrics->horiBearingY ); - right = FT_PIX_CEIL( metrics->vertBearingX + metrics->width ); - bottom = FT_PIX_CEIL( metrics->vertBearingY + metrics->height ); + right = FT_PIX_CEIL( OVERFLOW_ADD_LONG( metrics->vertBearingX, + metrics->width ) ); + bottom = FT_PIX_CEIL( OVERFLOW_ADD_LONG( metrics->vertBearingY, + metrics->height ) ); metrics->vertBearingX = FT_PIX_FLOOR( metrics->vertBearingX ); metrics->vertBearingY = FT_PIX_FLOOR( metrics->vertBearingY ); - metrics->width = right - metrics->vertBearingX; - metrics->height = bottom - metrics->vertBearingY; + metrics->width = OVERFLOW_SUB_LONG( right, + metrics->vertBearingX ); + metrics->height = OVERFLOW_SUB_LONG( bottom, + metrics->vertBearingY ); } else { metrics->vertBearingX = FT_PIX_FLOOR( metrics->vertBearingX ); metrics->vertBearingY = FT_PIX_FLOOR( metrics->vertBearingY ); - right = FT_PIX_CEIL ( metrics->horiBearingX + metrics->width ); - bottom = FT_PIX_FLOOR( metrics->horiBearingY - metrics->height ); + right = FT_PIX_CEIL ( OVERFLOW_ADD_LONG( metrics->horiBearingX, + metrics->width ) ); + bottom = FT_PIX_FLOOR( OVERFLOW_SUB_LONG( metrics->horiBearingY, + metrics->height ) ); metrics->horiBearingX = FT_PIX_FLOOR( metrics->horiBearingX ); metrics->horiBearingY = FT_PIX_CEIL ( metrics->horiBearingY ); - metrics->width = right - metrics->horiBearingX; - metrics->height = metrics->horiBearingY - bottom; + metrics->width = OVERFLOW_SUB_LONG( right, + metrics->horiBearingX ); + metrics->height = OVERFLOW_SUB_LONG( metrics->horiBearingY, + bottom ); } metrics->horiAdvance = FT_PIX_ROUND( metrics->horiAdvance ); diff --git a/src/cff/cf2blues.c b/src/cff/cf2blues.c index 950c71473..a94254d82 100644 --- a/src/cff/cf2blues.c +++ b/src/cff/cf2blues.c @@ -502,7 +502,8 @@ if ( blues->suppressOvershoot ) dsNew = blues->zone[i].dsFlatEdge; - else if ( ( blues->zone[i].csTopEdge - bottomHintEdge->csCoord ) >= + else if ( OVERFLOW_SUB_INT32( blues->zone[i].csTopEdge, + bottomHintEdge->csCoord ) >= blues->blueShift ) { /* guarantee minimum of 1 pixel overshoot */ diff --git a/src/cff/cf2hints.c b/src/cff/cf2hints.c index 89af2ff7a..d7938c9c6 100644 --- a/src/cff/cf2hints.c +++ b/src/cff/cf2hints.c @@ -512,8 +512,10 @@ if ( hintmap->edge[i].csCoord != hintmap->edge[i - 1].csCoord ) hintmap->edge[i - 1].scale = FT_DivFix( - hintmap->edge[i].dsCoord - hintmap->edge[i - 1].dsCoord, - hintmap->edge[i].csCoord - hintmap->edge[i - 1].csCoord ); + OVERFLOW_SUB_INT32( hintmap->edge[i].dsCoord, + hintmap->edge[i - 1].dsCoord ), + OVERFLOW_SUB_INT32( hintmap->edge[i].csCoord, + hintmap->edge[i - 1].csCoord ) ); } if ( isPair ) @@ -521,8 +523,10 @@ if ( hintmap->edge[j].csCoord != hintmap->edge[j - 1].csCoord ) hintmap->edge[j - 1].scale = FT_DivFix( - hintmap->edge[j].dsCoord - hintmap->edge[j - 1].dsCoord, - hintmap->edge[j].csCoord - hintmap->edge[j - 1].csCoord ); + OVERFLOW_SUB_INT32( hintmap->edge[j].dsCoord, + hintmap->edge[j - 1].dsCoord ), + OVERFLOW_SUB_INT32( hintmap->edge[j].csCoord, + hintmap->edge[j - 1].csCoord ) ); i += 1; /* skip upper edge on next loop */ } diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c index e5a3da37a..66e8228d3 100644 --- a/src/truetype/ttgload.c +++ b/src/truetype/ttgload.c @@ -2100,8 +2100,8 @@ } /* set glyph dimensions */ - glyph->metrics.width = bbox.xMax - bbox.xMin; - glyph->metrics.height = bbox.yMax - bbox.yMin; + glyph->metrics.width = OVERFLOW_SUB_LONG( bbox.xMax, bbox.xMin ); + glyph->metrics.height = OVERFLOW_SUB_LONG( bbox.yMax, bbox.yMin ); /* Now take care of vertical metrics. In the case where there is */ /* no vertical information within the font (relatively common), */ @@ -2137,7 +2137,8 @@ /* table in the font. Otherwise, we use the */ /* values defined in the horizontal header. */ - height = (FT_Short)FT_DivFix( bbox.yMax - bbox.yMin, + height = (FT_Short)FT_DivFix( OVERFLOW_SUB_LONG( bbox.yMax, + bbox.yMin ), y_scale ); if ( face->os2.version != 0xFFFFU ) advance = (FT_Pos)( face->os2.sTypoAscender - diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c index cbb754094..85e9e0823 100644 --- a/src/truetype/ttinterp.c +++ b/src/truetype/ttinterp.c @@ -1676,7 +1676,9 @@ if ( SUBPIXEL_HINTING_INFINALITY && ( !exc->ignore_x_mode || ( exc->sph_tweak_flags & SPH_TWEAK_ALLOW_X_DMOVE ) ) ) - zone->cur[point].x += FT_MulDiv( distance, v, exc->F_dot_P ); + zone->cur[point].x = OVERFLOW_ADD_LONG( + zone->cur[point].x, + FT_MulDiv( distance, v, exc->F_dot_P ) ); else #endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */ @@ -1685,12 +1687,16 @@ /* diagonal moves, but only post-IUP. DejaVu tries to adjust */ /* diagonal stems like on `Z' and `z' post-IUP. */ if ( SUBPIXEL_HINTING_MINIMAL && !exc->backward_compatibility ) - zone->cur[point].x += FT_MulDiv( distance, v, exc->F_dot_P ); + zone->cur[point].x = OVERFLOW_ADD_LONG( + zone->cur[point].x, + FT_MulDiv( distance, v, exc->F_dot_P ) ); else #endif if ( NO_SUBPIXEL_HINTING ) - zone->cur[point].x += FT_MulDiv( distance, v, exc->F_dot_P ); + zone->cur[point].x = OVERFLOW_ADD_LONG( + zone->cur[point].x, + FT_MulDiv( distance, v, exc->F_dot_P ) ); zone->tags[point] |= FT_CURVE_TAG_TOUCH_X; } @@ -1705,7 +1711,9 @@ exc->iupx_called && exc->iupy_called ) ) #endif - zone->cur[point].y += FT_MulDiv( distance, v, exc->F_dot_P ); + zone->cur[point].y = OVERFLOW_ADD_LONG( + zone->cur[point].y, + FT_MulDiv( distance, v, exc->F_dot_P ) ); zone->tags[point] |= FT_CURVE_TAG_TOUCH_Y; } @@ -1741,12 +1749,16 @@ v = exc->GS.freeVector.x; if ( v != 0 ) - zone->org[point].x += FT_MulDiv( distance, v, exc->F_dot_P ); + zone->org[point].x = OVERFLOW_ADD_LONG( + zone->org[point].x, + FT_MulDiv( distance, v, exc->F_dot_P ) ); v = exc->GS.freeVector.y; if ( v != 0 ) - zone->org[point].y += FT_MulDiv( distance, v, exc->F_dot_P ); + zone->org[point].y = OVERFLOW_ADD_LONG( + zone->org[point].y, + FT_MulDiv( distance, v, exc->F_dot_P ) ); } @@ -1769,18 +1781,18 @@ { #ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY if ( SUBPIXEL_HINTING_INFINALITY && !exc->ignore_x_mode ) - zone->cur[point].x += distance; + zone->cur[point].x = OVERFLOW_ADD_LONG( zone->cur[point].x, distance ); else #endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */ #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL if ( SUBPIXEL_HINTING_MINIMAL && !exc->backward_compatibility ) - zone->cur[point].x += distance; + zone->cur[point].x = OVERFLOW_ADD_LONG( zone->cur[point].x, distance ); else #endif if ( NO_SUBPIXEL_HINTING ) - zone->cur[point].x += distance; + zone->cur[point].x = OVERFLOW_ADD_LONG( zone->cur[point].x, distance ); zone->tags[point] |= FT_CURVE_TAG_TOUCH_X; } @@ -1799,7 +1811,7 @@ exc->backward_compatibility && exc->iupx_called && exc->iupy_called ) ) #endif - zone->cur[point].y += distance; + zone->cur[point].y = OVERFLOW_ADD_LONG( zone->cur[point].y, distance ); zone->tags[point] |= FT_CURVE_TAG_TOUCH_Y; } @@ -1823,7 +1835,7 @@ { FT_UNUSED( exc ); - zone->org[point].x += distance; + zone->org[point].x = OVERFLOW_ADD_LONG( zone->org[point].x, distance ); } @@ -1835,7 +1847,7 @@ { FT_UNUSED( exc ); - zone->org[point].y += distance; + zone->org[point].y = OVERFLOW_ADD_LONG( zone->org[point].y, distance ); } @@ -5392,7 +5404,8 @@ if ( !( SUBPIXEL_HINTING_MINIMAL && exc->backward_compatibility ) ) #endif - exc->zp2.cur[point].x += dx; + exc->zp2.cur[point].x = OVERFLOW_ADD_LONG( exc->zp2.cur[point].x, + dx ); if ( touch ) exc->zp2.tags[point] |= FT_CURVE_TAG_TOUCH_X; @@ -5406,7 +5419,8 @@ exc->iupx_called && exc->iupy_called ) ) #endif - exc->zp2.cur[point].y += dy; + exc->zp2.cur[point].y = OVERFLOW_ADD_LONG( exc->zp2.cur[point].y, + dy ); if ( touch ) exc->zp2.tags[point] |= FT_CURVE_TAG_TOUCH_Y; @@ -5781,14 +5795,18 @@ #ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY /* subpixel hinting - make MSIRP respect CVT cut-in; */ - if ( SUBPIXEL_HINTING_INFINALITY && - exc->ignore_x_mode && - exc->GS.freeVector.x != 0 && - FT_ABS( distance - args[1] ) >= control_value_cutin ) + if ( SUBPIXEL_HINTING_INFINALITY && + exc->ignore_x_mode && + exc->GS.freeVector.x != 0 && + FT_ABS( OVERFLOW_SUB_LONG( distance, + args[1] ) ) >= control_value_cutin ) distance = args[1]; #endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */ - exc->func_move( exc, &exc->zp1, point, args[1] - distance ); + exc->func_move( exc, + &exc->zp1, + point, + OVERFLOW_SUB_LONG( args[1], distance ) ); exc->GS.rp1 = exc->GS.rp0; exc->GS.rp2 = point; From 9fa8a2997f869c6172a12a9497b3ca649806ec4d Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sun, 4 Jun 2017 20:43:08 +0200 Subject: [PATCH 132/470] [cff, truetype] Integer overflows. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2075 https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2088 * src/cff/cf2font.c (cf2_font_setup): Use OVERFLOW_MUL_INT32. * src/truetype/ttinterp.c (Ins_ISECT): Use OVERFLOW_MUL_LONG, OVERFLOW_ADD_LONG, and OVERFLOW_SUB_LONG. --- ChangeLog | 14 ++++++++++++ src/cff/cf2font.c | 2 +- src/truetype/ttinterp.c | 48 ++++++++++++++++++++++------------------- 3 files changed, 41 insertions(+), 23 deletions(-) diff --git a/ChangeLog b/ChangeLog index e3a42c226..7f68614ad 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2017-06-04 Werner Lemberg + + [cff, truetype] Integer overflows. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2075 + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2088 + + * src/cff/cf2font.c (cf2_font_setup): Use OVERFLOW_MUL_INT32. + + * src/truetype/ttinterp.c (Ins_ISECT): Use OVERFLOW_MUL_LONG, + OVERFLOW_ADD_LONG, and OVERFLOW_SUB_LONG. + 2017-06-03 Werner Lemberg [base, cff, truetype] Integer overflows. diff --git a/src/cff/cf2font.c b/src/cff/cf2font.c index 25514373b..c81f93845 100644 --- a/src/cff/cf2font.c +++ b/src/cff/cf2font.c @@ -447,7 +447,7 @@ /* choose a constant for StdHW that depends on font contrast */ stdHW = cf2_getStdHW( decoder ); - if ( stdHW > 0 && font->stdVW > 2 * stdHW ) + if ( stdHW > 0 && font->stdVW > OVERFLOW_MUL_INT32( 2, stdHW ) ) font->stdHW = FT_DivFix( cf2_intToFixed( 75 ), emRatio ); else { diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c index 85e9e0823..d39504a26 100644 --- a/src/truetype/ttinterp.c +++ b/src/truetype/ttinterp.c @@ -6455,19 +6455,19 @@ /* Cramer's rule */ - dbx = exc->zp0.cur[b1].x - exc->zp0.cur[b0].x; - dby = exc->zp0.cur[b1].y - exc->zp0.cur[b0].y; + dbx = OVERFLOW_SUB_LONG( exc->zp0.cur[b1].x, exc->zp0.cur[b0].x ); + dby = OVERFLOW_SUB_LONG( exc->zp0.cur[b1].y, exc->zp0.cur[b0].y ); - dax = exc->zp1.cur[a1].x - exc->zp1.cur[a0].x; - day = exc->zp1.cur[a1].y - exc->zp1.cur[a0].y; + dax = OVERFLOW_SUB_LONG( exc->zp1.cur[a1].x, exc->zp1.cur[a0].x ); + day = OVERFLOW_SUB_LONG( exc->zp1.cur[a1].y, exc->zp1.cur[a0].y ); - dx = exc->zp0.cur[b0].x - exc->zp1.cur[a0].x; - dy = exc->zp0.cur[b0].y - exc->zp1.cur[a0].y; + dx = OVERFLOW_SUB_LONG( exc->zp0.cur[b0].x, exc->zp1.cur[a0].x ); + dy = OVERFLOW_SUB_LONG( exc->zp0.cur[b0].y, exc->zp1.cur[a0].y ); - discriminant = FT_MulDiv( dax, -dby, 0x40 ) + - FT_MulDiv( day, dbx, 0x40 ); - dotproduct = FT_MulDiv( dax, dbx, 0x40 ) + - FT_MulDiv( day, dby, 0x40 ); + discriminant = OVERFLOW_ADD_LONG( FT_MulDiv( dax, -dby, 0x40 ), + FT_MulDiv( day, dbx, 0x40 ) ); + dotproduct = OVERFLOW_ADD_LONG( FT_MulDiv( dax, dbx, 0x40 ), + FT_MulDiv( day, dby, 0x40 ) ); /* The discriminant above is actually a cross product of vectors */ /* da and db. Together with the dot product, they can be used as */ @@ -6477,30 +6477,34 @@ /* discriminant = |da||db|sin(angle) . */ /* We use these equations to reject grazing intersections by */ /* thresholding abs(tan(angle)) at 1/19, corresponding to 3 degrees. */ - if ( 19 * FT_ABS( discriminant ) > FT_ABS( dotproduct ) ) + if ( OVERFLOW_MUL_LONG( 19, FT_ABS( discriminant ) ) > + FT_ABS( dotproduct ) ) { - val = FT_MulDiv( dx, -dby, 0x40 ) + FT_MulDiv( dy, dbx, 0x40 ); + val = OVERFLOW_ADD_LONG( FT_MulDiv( dx, -dby, 0x40 ), + FT_MulDiv( dy, dbx, 0x40 ) ); R.x = FT_MulDiv( val, dax, discriminant ); R.y = FT_MulDiv( val, day, discriminant ); /* XXX: Block in backward_compatibility and/or post-IUP? */ - exc->zp2.cur[point].x = exc->zp1.cur[a0].x + R.x; - exc->zp2.cur[point].y = exc->zp1.cur[a0].y + R.y; + exc->zp2.cur[point].x = OVERFLOW_ADD_LONG( exc->zp1.cur[a0].x, R.x ); + exc->zp2.cur[point].y = OVERFLOW_ADD_LONG( exc->zp1.cur[a0].y, R.y ); } else { /* else, take the middle of the middles of A and B */ /* XXX: Block in backward_compatibility and/or post-IUP? */ - exc->zp2.cur[point].x = ( exc->zp1.cur[a0].x + - exc->zp1.cur[a1].x + - exc->zp0.cur[b0].x + - exc->zp0.cur[b1].x ) / 4; - exc->zp2.cur[point].y = ( exc->zp1.cur[a0].y + - exc->zp1.cur[a1].y + - exc->zp0.cur[b0].y + - exc->zp0.cur[b1].y ) / 4; + exc->zp2.cur[point].x = + OVERFLOW_ADD_LONG( OVERFLOW_ADD_LONG( exc->zp1.cur[a0].x, + exc->zp1.cur[a1].x ), + OVERFLOW_ADD_LONG( exc->zp0.cur[b0].x, + exc->zp0.cur[b1].x ) ) / 4; + exc->zp2.cur[point].y = + OVERFLOW_ADD_LONG( OVERFLOW_ADD_LONG( exc->zp1.cur[a0].y, + exc->zp1.cur[a1].y ), + OVERFLOW_ADD_LONG( exc->zp0.cur[b0].y, + exc->zp0.cur[b1].y ) ) / 4; } exc->zp2.tags[point] |= FT_CURVE_TAG_TOUCH_BOTH; From 8667042997cb9095d3c925417b29f5a3163ab352 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Mon, 5 Jun 2017 06:20:53 +0200 Subject: [PATCH 133/470] [cff] Integer overflow. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2089 * src/cff/cffload.c (cff_blend_doBlend): User OVERFLOW_ADD_INT32. --- ChangeLog | 10 ++++++++++ src/cff/cffload.c | 9 ++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7f68614ad..6442e8754 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2017-06-05 Werner Lemberg + + [cff] Integer overflow. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2089 + + * src/cff/cffload.c (cff_blend_doBlend): User OVERFLOW_ADD_INT32. + 2017-06-04 Werner Lemberg [cff, truetype] Integer overflows. diff --git a/src/cff/cffload.c b/src/cff/cffload.c index 3beaeb1c8..2ee438755 100644 --- a/src/cff/cffload.c +++ b/src/cff/cffload.c @@ -1352,9 +1352,12 @@ sum = cff_parse_num( parser, &parser->stack[i + base] ) * 65536; for ( j = 1; j < blend->lenBV; j++ ) - sum += FT_MulFix( *weight++, - cff_parse_num( parser, - &parser->stack[delta++] ) * 65536 ); + sum = OVERFLOW_ADD_INT32( + sum, + FT_MulFix( + *weight++, + cff_parse_num( parser, + &parser->stack[delta++] ) * 65536 ) ); /* point parser stack to new value on blend_stack */ parser->stack[i + base] = subFont->blend_top; From 24848a3d58cdd3ffd40ef3ddd68407d18f678b52 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Tue, 6 Jun 2017 12:05:04 +0200 Subject: [PATCH 134/470] [cff] Integer overflow. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2109 https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2110 https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2122 * src/cff/cf2blues.c (cf2_blues_init): Use OVERFLOW_SUB_INT32. * src/cff/cf2hints.c (cf2_hintmap_map): Synchronize if-else branches. --- ChangeLog | 15 +++++++++++++++ src/cff/cf2blues.c | 5 +++-- src/cff/cf2hints.c | 3 ++- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6442e8754..8d4e31676 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2017-06-06 Werner Lemberg + + [cff] Integer overflow. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2109 + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2110 + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2122 + + * src/cff/cf2blues.c (cf2_blues_init): Use OVERFLOW_SUB_INT32. + + * src/cff/cf2hints.c (cf2_hintmap_map): Synchronize if-else + branches. + 2017-06-05 Werner Lemberg [cff] Integer overflow. diff --git a/src/cff/cf2blues.c b/src/cff/cf2blues.c index a94254d82..262be8322 100644 --- a/src/cff/cf2blues.c +++ b/src/cff/cf2blues.c @@ -194,8 +194,9 @@ blues->zone[blues->count].csTopEdge = cf2_blueToFixed( blueValues[i + 1] ); - zoneHeight = blues->zone[blues->count].csTopEdge - - blues->zone[blues->count].csBottomEdge; + zoneHeight = OVERFLOW_SUB_INT32( + blues->zone[blues->count].csTopEdge, + blues->zone[blues->count].csBottomEdge ); if ( zoneHeight < 0 ) { diff --git a/src/cff/cf2hints.c b/src/cff/cf2hints.c index d7938c9c6..e326c1b66 100644 --- a/src/cff/cf2hints.c +++ b/src/cff/cf2hints.c @@ -332,7 +332,8 @@ { /* special case for points below first edge: use uniform scale */ return OVERFLOW_ADD_INT32( - FT_MulFix( csCoord - hintmap->edge[0].csCoord, + FT_MulFix( OVERFLOW_SUB_INT32( csCoord, + hintmap->edge[0].csCoord ), hintmap->scale ), hintmap->edge[0].dsCoord ); } From 7bffeacd7ef77d050e8bcbbc4e4ab761fa7861b9 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Wed, 7 Jun 2017 17:08:01 +0200 Subject: [PATCH 135/470] [cff, truetype] Integer overflows. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2133 https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2137 * src/cff/cf2hints.c (cf2_hint_init): Use OVERFLOW_SUB_INT32. * src/truetype/ttinterp.c (PROJECT, DUALPROJ): Use OVERFLOW_SUB_LONG. --- ChangeLog | 16 +++++++++++++++- src/cff/cf2hints.c | 2 +- src/truetype/ttinterp.c | 14 +++++++++----- 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8d4e31676..0c57dc774 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,20 @@ +2017-06-07 Werner Lemberg + + [cff, truetype] Integer overflows. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2133 + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2137 + + * src/cff/cf2hints.c (cf2_hint_init): Use OVERFLOW_SUB_INT32. + + * src/truetype/ttinterp.c (PROJECT, DUALPROJ): Use + OVERFLOW_SUB_LONG. + 2017-06-06 Werner Lemberg - [cff] Integer overflow. + [cff] Integer overflows. Reported as diff --git a/src/cff/cf2hints.c b/src/cff/cf2hints.c index e326c1b66..634b280bb 100644 --- a/src/cff/cf2hints.c +++ b/src/cff/cf2hints.c @@ -105,7 +105,7 @@ stemHintArray, indexStemHint ); - width = stemHint->max - stemHint->min; + width = OVERFLOW_SUB_INT32( stemHint->max, stemHint->min ); if ( width == cf2_intToFixed( -21 ) ) { diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c index d39504a26..7ac9b38d8 100644 --- a/src/truetype/ttinterp.c +++ b/src/truetype/ttinterp.c @@ -65,11 +65,15 @@ TT_INTERPRETER_VERSION_40 ) #endif -#define PROJECT( v1, v2 ) \ - exc->func_project( exc, (v1)->x - (v2)->x, (v1)->y - (v2)->y ) - -#define DUALPROJ( v1, v2 ) \ - exc->func_dualproj( exc, (v1)->x - (v2)->x, (v1)->y - (v2)->y ) +#define PROJECT( v1, v2 ) \ + exc->func_project( exc, \ + OVERFLOW_SUB_LONG( (v1)->x, (v2)->x ), \ + OVERFLOW_SUB_LONG( (v1)->y, (v2)->y ) ) + +#define DUALPROJ( v1, v2 ) \ + exc->func_dualproj( exc, \ + OVERFLOW_SUB_LONG( (v1)->x, (v2)->x ), \ + OVERFLOW_SUB_LONG( (v1)->y, (v2)->y ) ) #define FAST_PROJECT( v ) \ exc->func_project( exc, (v)->x, (v)->y ) From dcd8de272f940065b6a326b16518e3e5acb695a6 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Fri, 9 Jun 2017 11:21:58 +0200 Subject: [PATCH 136/470] */*: Remove `OVERFLOW_' prefix. This increases readability. --- ChangeLog | 6 + include/freetype/internal/ftcalc.h | 18 +-- src/base/ftcalc.c | 53 ++++---- src/base/ftobjs.c | 32 ++--- src/base/ftoutln.c | 5 +- src/cff/cf2blues.c | 18 +-- src/cff/cf2font.c | 2 +- src/cff/cf2ft.c | 6 +- src/cff/cf2hints.c | 163 +++++++++++------------ src/cff/cf2intrp.c | 204 +++++++++++------------------ src/cff/cffgload.c | 166 +++++++++++------------ src/cff/cffload.c | 2 +- src/cff/cffparse.c | 3 +- src/psaux/t1decode.c | 80 +++++------ src/smooth/ftgrays.c | 12 +- src/truetype/ttgload.c | 8 +- src/truetype/ttinterp.c | 134 ++++++++++--------- 17 files changed, 421 insertions(+), 491 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0c57dc774..8c19a0fe2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2017-06-09 Werner Lemberg + + */*: Remove `OVERFLOW_' prefix. + + This increases readability. + 2017-06-07 Werner Lemberg [cff, truetype] Integer overflows. diff --git a/include/freetype/internal/ftcalc.h b/include/freetype/internal/ftcalc.h index 5902e190e..524096d41 100644 --- a/include/freetype/internal/ftcalc.h +++ b/include/freetype/internal/ftcalc.h @@ -417,29 +417,29 @@ FT_BEGIN_HEADER * * Use with care! */ -#define OVERFLOW_ADD_INT( a, b ) \ +#define ADD_INT( a, b ) \ (FT_Int)( (FT_UInt)(a) + (FT_UInt)(b) ) -#define OVERFLOW_SUB_INT( a, b ) \ +#define SUB_INT( a, b ) \ (FT_Int)( (FT_UInt)(a) - (FT_UInt)(b) ) -#define OVERFLOW_MUL_INT( a, b ) \ +#define MUL_INT( a, b ) \ (FT_Int)( (FT_UInt)(a) * (FT_UInt)(b) ) #define NEG_INT( a ) \ (FT_Int)( -(FT_UInt)(a) ) -#define OVERFLOW_ADD_LONG( a, b ) \ +#define ADD_LONG( a, b ) \ (FT_Long)( (FT_ULong)(a) + (FT_ULong)(b) ) -#define OVERFLOW_SUB_LONG( a, b ) \ +#define SUB_LONG( a, b ) \ (FT_Long)( (FT_ULong)(a) - (FT_ULong)(b) ) -#define OVERFLOW_MUL_LONG( a, b ) \ +#define MUL_LONG( a, b ) \ (FT_Long)( (FT_ULong)(a) * (FT_ULong)(b) ) #define NEG_LONG( a ) \ (FT_Long)( -(FT_ULong)(a) ) -#define OVERFLOW_ADD_INT32( a, b ) \ +#define ADD_INT32( a, b ) \ (FT_Int32)( (FT_UInt32)(a) + (FT_UInt32)(b) ) -#define OVERFLOW_SUB_INT32( a, b ) \ +#define SUB_INT32( a, b ) \ (FT_Int32)( (FT_UInt32)(a) - (FT_UInt32)(b) ) -#define OVERFLOW_MUL_INT32( a, b ) \ +#define MUL_INT32( a, b ) \ (FT_Int32)( (FT_UInt32)(a) * (FT_UInt32)(b) ) #define NEG_INT32( a ) \ (FT_Int32)( -(FT_UInt32)(a) ) diff --git a/src/base/ftcalc.c b/src/base/ftcalc.c index bc1c47ff1..9e42d784d 100644 --- a/src/base/ftcalc.c +++ b/src/base/ftcalc.c @@ -87,8 +87,7 @@ FT_EXPORT_DEF( FT_Fixed ) FT_RoundFix( FT_Fixed a ) { - return ( OVERFLOW_ADD_LONG( a, - 0x8000L - ( a < 0 ) ) ) & ~0xFFFFL; + return ( ADD_LONG( a, 0x8000L - ( a < 0 ) ) ) & ~0xFFFFL; } @@ -97,7 +96,7 @@ FT_EXPORT_DEF( FT_Fixed ) FT_CeilFix( FT_Fixed a ) { - return ( OVERFLOW_ADD_LONG( a, 0xFFFFL ) ) & ~0xFFFFL; + return ( ADD_LONG( a, 0xFFFFL ) ) & ~0xFFFFL; } @@ -668,14 +667,14 @@ if ( !a || !b ) return; - xx = OVERFLOW_ADD_LONG( FT_MulFix( a->xx, b->xx ), - FT_MulFix( a->xy, b->yx ) ); - xy = OVERFLOW_ADD_LONG( FT_MulFix( a->xx, b->xy ), - FT_MulFix( a->xy, b->yy ) ); - yx = OVERFLOW_ADD_LONG( FT_MulFix( a->yx, b->xx ), - FT_MulFix( a->yy, b->yx ) ); - yy = OVERFLOW_ADD_LONG( FT_MulFix( a->yx, b->xy ), - FT_MulFix( a->yy, b->yy ) ); + xx = ADD_LONG( FT_MulFix( a->xx, b->xx ), + FT_MulFix( a->xy, b->yx ) ); + xy = ADD_LONG( FT_MulFix( a->xx, b->xy ), + FT_MulFix( a->xy, b->yy ) ); + yx = ADD_LONG( FT_MulFix( a->yx, b->xx ), + FT_MulFix( a->yy, b->yx ) ); + yy = ADD_LONG( FT_MulFix( a->yx, b->xy ), + FT_MulFix( a->yy, b->yy ) ); b->xx = xx; b->xy = xy; @@ -730,14 +729,14 @@ if ( !a || !b ) return; - xx = OVERFLOW_ADD_LONG( FT_MulDiv( a->xx, b->xx, val ), - FT_MulDiv( a->xy, b->yx, val ) ); - xy = OVERFLOW_ADD_LONG( FT_MulDiv( a->xx, b->xy, val ), - FT_MulDiv( a->xy, b->yy, val ) ); - yx = OVERFLOW_ADD_LONG( FT_MulDiv( a->yx, b->xx, val ), - FT_MulDiv( a->yy, b->yx, val ) ); - yy = OVERFLOW_ADD_LONG( FT_MulDiv( a->yx, b->xy, val ), - FT_MulDiv( a->yy, b->yy, val ) ); + xx = ADD_LONG( FT_MulDiv( a->xx, b->xx, val ), + FT_MulDiv( a->xy, b->yx, val ) ); + xy = ADD_LONG( FT_MulDiv( a->xx, b->xy, val ), + FT_MulDiv( a->xy, b->yy, val ) ); + yx = ADD_LONG( FT_MulDiv( a->yx, b->xx, val ), + FT_MulDiv( a->yy, b->yx, val ) ); + yy = ADD_LONG( FT_MulDiv( a->yx, b->xy, val ), + FT_MulDiv( a->yy, b->yy, val ) ); b->xx = xx; b->xy = xy; @@ -761,10 +760,10 @@ if ( !vector || !matrix ) return; - xz = OVERFLOW_ADD_LONG( FT_MulDiv( vector->x, matrix->xx, val ), - FT_MulDiv( vector->y, matrix->xy, val ) ); - yz = OVERFLOW_ADD_LONG( FT_MulDiv( vector->x, matrix->yx, val ), - FT_MulDiv( vector->y, matrix->yy, val ) ); + xz = ADD_LONG( FT_MulDiv( vector->x, matrix->xx, val ), + FT_MulDiv( vector->y, matrix->xy, val ) ); + yz = ADD_LONG( FT_MulDiv( vector->x, matrix->yx, val ), + FT_MulDiv( vector->y, matrix->yy, val ) ); vector->x = xz; vector->y = yz; @@ -928,11 +927,11 @@ /* we silently ignore overflow errors, since such large values */ /* lead to even more (harmless) rendering errors later on */ - if ( OVERFLOW_ADD_LONG( FT_ABS( in_x ), FT_ABS( out_y ) ) <= 131071L && - OVERFLOW_ADD_LONG( FT_ABS( in_y ), FT_ABS( out_x ) ) <= 131071L ) + if ( ADD_LONG( FT_ABS( in_x ), FT_ABS( out_y ) ) <= 131071L && + ADD_LONG( FT_ABS( in_y ), FT_ABS( out_x ) ) <= 131071L ) { - FT_Long z1 = OVERFLOW_MUL_LONG( in_x, out_y ); - FT_Long z2 = OVERFLOW_MUL_LONG( in_y, out_x ); + FT_Long z1 = MUL_LONG( in_x, out_y ); + FT_Long z2 = MUL_LONG( in_y, out_x ); if ( z1 > z2 ) diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c index cd5874c9d..e190de3a3 100644 --- a/src/base/ftobjs.c +++ b/src/base/ftobjs.c @@ -581,36 +581,36 @@ metrics->horiBearingX = FT_PIX_FLOOR( metrics->horiBearingX ); metrics->horiBearingY = FT_PIX_CEIL ( metrics->horiBearingY ); - right = FT_PIX_CEIL( OVERFLOW_ADD_LONG( metrics->vertBearingX, - metrics->width ) ); - bottom = FT_PIX_CEIL( OVERFLOW_ADD_LONG( metrics->vertBearingY, - metrics->height ) ); + right = FT_PIX_CEIL( ADD_LONG( metrics->vertBearingX, + metrics->width ) ); + bottom = FT_PIX_CEIL( ADD_LONG( metrics->vertBearingY, + metrics->height ) ); metrics->vertBearingX = FT_PIX_FLOOR( metrics->vertBearingX ); metrics->vertBearingY = FT_PIX_FLOOR( metrics->vertBearingY ); - metrics->width = OVERFLOW_SUB_LONG( right, - metrics->vertBearingX ); - metrics->height = OVERFLOW_SUB_LONG( bottom, - metrics->vertBearingY ); + metrics->width = SUB_LONG( right, + metrics->vertBearingX ); + metrics->height = SUB_LONG( bottom, + metrics->vertBearingY ); } else { metrics->vertBearingX = FT_PIX_FLOOR( metrics->vertBearingX ); metrics->vertBearingY = FT_PIX_FLOOR( metrics->vertBearingY ); - right = FT_PIX_CEIL ( OVERFLOW_ADD_LONG( metrics->horiBearingX, - metrics->width ) ); - bottom = FT_PIX_FLOOR( OVERFLOW_SUB_LONG( metrics->horiBearingY, - metrics->height ) ); + right = FT_PIX_CEIL ( ADD_LONG( metrics->horiBearingX, + metrics->width ) ); + bottom = FT_PIX_FLOOR( SUB_LONG( metrics->horiBearingY, + metrics->height ) ); metrics->horiBearingX = FT_PIX_FLOOR( metrics->horiBearingX ); metrics->horiBearingY = FT_PIX_CEIL ( metrics->horiBearingY ); - metrics->width = OVERFLOW_SUB_LONG( right, - metrics->horiBearingX ); - metrics->height = OVERFLOW_SUB_LONG( metrics->horiBearingY, - bottom ); + metrics->width = SUB_LONG( right, + metrics->horiBearingX ); + metrics->height = SUB_LONG( metrics->horiBearingY, + bottom ); } metrics->horiAdvance = FT_PIX_ROUND( metrics->horiAdvance ); diff --git a/src/base/ftoutln.c b/src/base/ftoutln.c index 794ddbc47..9ceb9cf1b 100644 --- a/src/base/ftoutln.c +++ b/src/base/ftoutln.c @@ -1088,9 +1088,8 @@ v_cur.x = points[n].x >> xshift; v_cur.y = points[n].y >> yshift; - area = OVERFLOW_ADD_LONG( - area, - ( v_cur.y - v_prev.y ) * ( v_cur.x + v_prev.x ) ); + area = ADD_LONG( area, + ( v_cur.y - v_prev.y ) * ( v_cur.x + v_prev.x ) ); v_prev = v_cur; } diff --git a/src/cff/cf2blues.c b/src/cff/cf2blues.c index 262be8322..a22a2e88c 100644 --- a/src/cff/cf2blues.c +++ b/src/cff/cf2blues.c @@ -194,9 +194,8 @@ blues->zone[blues->count].csTopEdge = cf2_blueToFixed( blueValues[i + 1] ); - zoneHeight = OVERFLOW_SUB_INT32( - blues->zone[blues->count].csTopEdge, - blues->zone[blues->count].csBottomEdge ); + zoneHeight = SUB_INT32( blues->zone[blues->count].csTopEdge, + blues->zone[blues->count].csBottomEdge ); if ( zoneHeight < 0 ) { @@ -302,8 +301,7 @@ /* top edge */ flatFamilyEdge = cf2_blueToFixed( familyOtherBlues[j + 1] ); - diff = cf2_fixedAbs( OVERFLOW_SUB_INT32( flatEdge, - flatFamilyEdge ) ); + diff = cf2_fixedAbs( SUB_INT32( flatEdge, flatFamilyEdge ) ); if ( diff < minDiff && diff < csUnitsPerPixel ) { @@ -321,8 +319,7 @@ /* top edge */ flatFamilyEdge = cf2_blueToFixed( familyBlues[1] ); - diff = cf2_fixedAbs( OVERFLOW_SUB_INT32( flatEdge, - flatFamilyEdge ) ); + diff = cf2_fixedAbs( SUB_INT32( flatEdge, flatFamilyEdge ) ); if ( diff < minDiff && diff < csUnitsPerPixel ) blues->zone[i].csFlatEdge = flatFamilyEdge; @@ -345,8 +342,7 @@ /* adjust edges of top zone upward by twice darkening amount */ flatFamilyEdge += 2 * font->darkenY; /* bottom edge */ - diff = cf2_fixedAbs( OVERFLOW_SUB_INT32( flatEdge, - flatFamilyEdge ) ); + diff = cf2_fixedAbs( SUB_INT32( flatEdge, flatFamilyEdge ) ); if ( diff < minDiff && diff < csUnitsPerPixel ) { @@ -503,8 +499,8 @@ if ( blues->suppressOvershoot ) dsNew = blues->zone[i].dsFlatEdge; - else if ( OVERFLOW_SUB_INT32( blues->zone[i].csTopEdge, - bottomHintEdge->csCoord ) >= + else if ( SUB_INT32( blues->zone[i].csTopEdge, + bottomHintEdge->csCoord ) >= blues->blueShift ) { /* guarantee minimum of 1 pixel overshoot */ diff --git a/src/cff/cf2font.c b/src/cff/cf2font.c index c81f93845..4ac71a8d7 100644 --- a/src/cff/cf2font.c +++ b/src/cff/cf2font.c @@ -447,7 +447,7 @@ /* choose a constant for StdHW that depends on font contrast */ stdHW = cf2_getStdHW( decoder ); - if ( stdHW > 0 && font->stdVW > OVERFLOW_MUL_INT32( 2, stdHW ) ) + if ( stdHW > 0 && font->stdVW > MUL_INT32( 2, stdHW ) ) font->stdHW = FT_DivFix( cf2_intToFixed( 75 ), emRatio ); else { diff --git a/src/cff/cf2ft.c b/src/cff/cf2ft.c index 3bc007b9b..c6c00d162 100644 --- a/src/cff/cf2ft.c +++ b/src/cff/cf2ft.c @@ -267,10 +267,8 @@ if ( *hinted ) { - *x_scale = OVERFLOW_ADD_INT32( decoder->builder.glyph->x_scale, - 32 ) / 64; - *y_scale = OVERFLOW_ADD_INT32( decoder->builder.glyph->y_scale, - 32 ) / 64; + *x_scale = ADD_INT32( decoder->builder.glyph->x_scale, 32 ) / 64; + *y_scale = ADD_INT32( decoder->builder.glyph->y_scale, 32 ) / 64; } else { diff --git a/src/cff/cf2hints.c b/src/cff/cf2hints.c index 634b280bb..9643bd470 100644 --- a/src/cff/cf2hints.c +++ b/src/cff/cf2hints.c @@ -74,8 +74,8 @@ /* cross product of pt1 position from origin with pt2 position from */ /* pt1; we reduce the precision so that the result fits into 32 bits */ - return ( x1 >> 16 ) * ( OVERFLOW_SUB_INT32( y2, y1 ) >> 16 ) - - ( y1 >> 16 ) * ( OVERFLOW_SUB_INT32( x2, x1 ) >> 16 ); + return ( x1 >> 16 ) * ( SUB_INT32( y2, y1 ) >> 16 ) - + ( y1 >> 16 ) * ( SUB_INT32( x2, x1 ) >> 16 ); } @@ -105,7 +105,7 @@ stemHintArray, indexStemHint ); - width = OVERFLOW_SUB_INT32( stemHint->max, stemHint->min ); + width = SUB_INT32( stemHint->max, stemHint->min ); if ( width == cf2_intToFixed( -21 ) ) { @@ -185,9 +185,9 @@ /* darkening. Bottoms are not changed; tops are incremented by twice */ /* `darkenY'. */ if ( cf2_hint_isTop( hint ) ) - hint->csCoord = OVERFLOW_ADD_INT32( hint->csCoord, 2 * font->darkenY ); + hint->csCoord = ADD_INT32( hint->csCoord, 2 * font->darkenY ); - hint->csCoord = OVERFLOW_ADD_INT32( hint->csCoord, hintOrigin ); + hint->csCoord = ADD_INT32( hint->csCoord, hintOrigin ); hint->scale = scale; hint->index = indexStemHint; /* index in original stem hint array */ @@ -331,11 +331,10 @@ if ( i == 0 && csCoord < hintmap->edge[0].csCoord ) { /* special case for points below first edge: use uniform scale */ - return OVERFLOW_ADD_INT32( - FT_MulFix( OVERFLOW_SUB_INT32( csCoord, + return ADD_INT32( FT_MulFix( SUB_INT32( csCoord, hintmap->edge[0].csCoord ), - hintmap->scale ), - hintmap->edge[0].dsCoord ); + hintmap->scale ), + hintmap->edge[0].dsCoord ); } else { @@ -343,11 +342,10 @@ * Note: entries with duplicate csCoord are allowed. * Use edge[i], the highest entry where csCoord >= entry[i].csCoord */ - return OVERFLOW_ADD_INT32( - FT_MulFix( OVERFLOW_SUB_INT32( csCoord, + return ADD_INT32( FT_MulFix( SUB_INT32( csCoord, hintmap->edge[i].csCoord ), - hintmap->edge[i].scale ), - hintmap->edge[i].dsCoord ); + hintmap->edge[i].scale ), + hintmap->edge[i].dsCoord ); } } } @@ -512,10 +510,9 @@ { if ( hintmap->edge[i].csCoord != hintmap->edge[i - 1].csCoord ) hintmap->edge[i - 1].scale = - FT_DivFix( - OVERFLOW_SUB_INT32( hintmap->edge[i].dsCoord, + FT_DivFix( SUB_INT32( hintmap->edge[i].dsCoord, hintmap->edge[i - 1].dsCoord ), - OVERFLOW_SUB_INT32( hintmap->edge[i].csCoord, + SUB_INT32( hintmap->edge[i].csCoord, hintmap->edge[i - 1].csCoord ) ); } @@ -523,10 +520,9 @@ { if ( hintmap->edge[j].csCoord != hintmap->edge[j - 1].csCoord ) hintmap->edge[j - 1].scale = - FT_DivFix( - OVERFLOW_SUB_INT32( hintmap->edge[j].dsCoord, + FT_DivFix( SUB_INT32( hintmap->edge[j].dsCoord, hintmap->edge[j - 1].dsCoord ), - OVERFLOW_SUB_INT32( hintmap->edge[j].csCoord, + SUB_INT32( hintmap->edge[j].csCoord, hintmap->edge[j - 1].csCoord ) ); i += 1; /* skip upper edge on next loop */ @@ -647,13 +643,12 @@ CF2_Fixed midpoint = cf2_hintmap_map( hintmap->initialHintMap, - OVERFLOW_ADD_INT32( secondHintEdge->csCoord, - firstHintEdge->csCoord ) / 2 ); + ADD_INT32( secondHintEdge->csCoord, + firstHintEdge->csCoord ) / 2 ); CF2_Fixed halfWidth = - FT_MulFix( - OVERFLOW_SUB_INT32( secondHintEdge->csCoord, + FT_MulFix( SUB_INT32( secondHintEdge->csCoord, firstHintEdge->csCoord ) / 2, - hintmap->scale ); + hintmap->scale ); firstHintEdge->dsCoord = midpoint - halfWidth; @@ -1106,18 +1101,18 @@ FT_Vector pt; /* hinted point in upright DS */ - pt.x = OVERFLOW_ADD_INT32( FT_MulFix( glyphpath->scaleX, x ), - FT_MulFix( glyphpath->scaleC, y ) ); + pt.x = ADD_INT32( FT_MulFix( glyphpath->scaleX, x ), + FT_MulFix( glyphpath->scaleC, y ) ); pt.y = cf2_hintmap_map( hintmap, y ); - ppt->x = OVERFLOW_ADD_INT32( + ppt->x = ADD_INT32( FT_MulFix( glyphpath->font->outerTransform.a, pt.x ), - OVERFLOW_ADD_INT32( + ADD_INT32( FT_MulFix( glyphpath->font->outerTransform.c, pt.y ), glyphpath->fractionalTranslation.x ) ); - ppt->y = OVERFLOW_ADD_INT32( + ppt->y = ADD_INT32( FT_MulFix( glyphpath->font->outerTransform.b, pt.x ), - OVERFLOW_ADD_INT32( + ADD_INT32( FT_MulFix( glyphpath->font->outerTransform.d, pt.y ), glyphpath->fractionalTranslation.y ) ); } @@ -1169,12 +1164,12 @@ CF2_Fixed denominator, s; - u.x = CF2_CS_SCALE( OVERFLOW_SUB_INT32( u2->x, u1->x ) ); - u.y = CF2_CS_SCALE( OVERFLOW_SUB_INT32( u2->y, u1->y ) ); - v.x = CF2_CS_SCALE( OVERFLOW_SUB_INT32( v2->x, v1->x ) ); - v.y = CF2_CS_SCALE( OVERFLOW_SUB_INT32( v2->y, v1->y ) ); - w.x = CF2_CS_SCALE( OVERFLOW_SUB_INT32( v1->x, u1->x ) ); - w.y = CF2_CS_SCALE( OVERFLOW_SUB_INT32( v1->y, u1->y ) ); + u.x = CF2_CS_SCALE( SUB_INT32( u2->x, u1->x ) ); + u.y = CF2_CS_SCALE( SUB_INT32( u2->y, u1->y ) ); + v.x = CF2_CS_SCALE( SUB_INT32( v2->x, v1->x ) ); + v.y = CF2_CS_SCALE( SUB_INT32( v2->y, v1->y ) ); + w.x = CF2_CS_SCALE( SUB_INT32( v1->x, u1->x ) ); + w.y = CF2_CS_SCALE( SUB_INT32( v1->y, u1->y ) ); denominator = cf2_perp( u, v ); @@ -1183,12 +1178,10 @@ s = FT_DivFix( cf2_perp( w, v ), denominator ); - intersection->x = OVERFLOW_ADD_INT32( - u1->x, - FT_MulFix( s, OVERFLOW_SUB_INT32( u2->x, u1->x ) ) ); - intersection->y = OVERFLOW_ADD_INT32( - u1->y, - FT_MulFix( s, OVERFLOW_SUB_INT32( u2->y, u1->y ) ) ); + intersection->x = ADD_INT32( u1->x, + FT_MulFix( s, SUB_INT32( u2->x, u1->x ) ) ); + intersection->y = ADD_INT32( u1->y, + FT_MulFix( s, SUB_INT32( u2->y, u1->y ) ) ); /* @@ -1200,35 +1193,29 @@ * */ - if ( u1->x == u2->x && - cf2_fixedAbs( OVERFLOW_SUB_INT32( - intersection->x, - u1->x ) ) < glyphpath->snapThreshold ) + if ( u1->x == u2->x && + cf2_fixedAbs( SUB_INT32( intersection->x, + u1->x ) ) < glyphpath->snapThreshold ) intersection->x = u1->x; - if ( u1->y == u2->y && - cf2_fixedAbs( OVERFLOW_SUB_INT32( - intersection->y, - u1->y ) ) < glyphpath->snapThreshold ) + if ( u1->y == u2->y && + cf2_fixedAbs( SUB_INT32( intersection->y, + u1->y ) ) < glyphpath->snapThreshold ) intersection->y = u1->y; - if ( v1->x == v2->x && - cf2_fixedAbs( OVERFLOW_SUB_INT32( - intersection->x, - v1->x ) ) < glyphpath->snapThreshold ) + if ( v1->x == v2->x && + cf2_fixedAbs( SUB_INT32( intersection->x, + v1->x ) ) < glyphpath->snapThreshold ) intersection->x = v1->x; - if ( v1->y == v2->y && - cf2_fixedAbs( OVERFLOW_SUB_INT32( - intersection->y, - v1->y ) ) < glyphpath->snapThreshold ) + if ( v1->y == v2->y && + cf2_fixedAbs( SUB_INT32( intersection->y, + v1->y ) ) < glyphpath->snapThreshold ) intersection->y = v1->y; /* limit the intersection distance from midpoint of u2 and v1 */ - if ( cf2_fixedAbs( intersection->x - - OVERFLOW_ADD_INT32( u2->x, v1->x ) / 2 ) > - glyphpath->miterLimit || - cf2_fixedAbs( intersection->y - - OVERFLOW_ADD_INT32( u2->y, v1->y ) / 2 ) > - glyphpath->miterLimit ) + if ( cf2_fixedAbs( intersection->x - ADD_INT32( u2->x, v1->x ) / 2 ) > + glyphpath->miterLimit || + cf2_fixedAbs( intersection->y - ADD_INT32( u2->y, v1->y ) / 2 ) > + glyphpath->miterLimit ) return FALSE; return TRUE; @@ -1476,8 +1463,8 @@ CF2_Fixed* x, CF2_Fixed* y ) { - CF2_Fixed dx = OVERFLOW_SUB_INT32( x2, x1 ); - CF2_Fixed dy = OVERFLOW_SUB_INT32( y2, y1 ); + CF2_Fixed dx = SUB_INT32( x2, x1 ); + CF2_Fixed dy = SUB_INT32( y2, y1 ); /* note: negative offsets don't work here; negate deltas to change */ @@ -1504,13 +1491,13 @@ { /* first quadrant, +x +y */ - if ( dx > OVERFLOW_MUL_INT32( 2, dy ) ) + if ( dx > MUL_INT32( 2, dy ) ) { /* +x */ *x = 0; *y = 0; } - else if ( dy > OVERFLOW_MUL_INT32( 2, dx ) ) + else if ( dy > MUL_INT32( 2, dx ) ) { /* +y */ *x = glyphpath->xOffset; @@ -1529,13 +1516,13 @@ { /* fourth quadrant, +x -y */ - if ( dx > OVERFLOW_MUL_INT32( -2, dy ) ) + if ( dx > MUL_INT32( -2, dy ) ) { /* +x */ *x = 0; *y = 0; } - else if ( NEG_INT32( dy ) > OVERFLOW_MUL_INT32( 2, dx ) ) + else if ( NEG_INT32( dy ) > MUL_INT32( 2, dx ) ) { /* -y */ *x = NEG_INT32( glyphpath->xOffset ); @@ -1557,13 +1544,13 @@ { /* second quadrant, -x +y */ - if ( NEG_INT32( dx ) > OVERFLOW_MUL_INT32( 2, dy ) ) + if ( NEG_INT32( dx ) > MUL_INT32( 2, dy ) ) { /* -x */ *x = 0; - *y = OVERFLOW_MUL_INT32( 2, glyphpath->yOffset ); + *y = MUL_INT32( 2, glyphpath->yOffset ); } - else if ( dy > OVERFLOW_MUL_INT32( -2, dx ) ) + else if ( dy > MUL_INT32( -2, dx ) ) { /* +y */ *x = glyphpath->xOffset; @@ -1582,13 +1569,13 @@ { /* third quadrant, -x -y */ - if ( NEG_INT32( dx ) > OVERFLOW_MUL_INT32( -2, dy ) ) + if ( NEG_INT32( dx ) > MUL_INT32( -2, dy ) ) { /* -x */ *x = 0; - *y = OVERFLOW_MUL_INT32( 2, glyphpath->yOffset ); + *y = MUL_INT32( 2, glyphpath->yOffset ); } - else if ( NEG_INT32( dy ) > OVERFLOW_MUL_INT32( -2, dx ) ) + else if ( NEG_INT32( dy ) > MUL_INT32( -2, dx ) ) { /* -y */ *x = NEG_INT32( glyphpath->xOffset ); @@ -1705,10 +1692,10 @@ &yOffset ); /* construct offset points */ - P0.x = OVERFLOW_ADD_INT32( glyphpath->currentCS.x, xOffset ); - P0.y = OVERFLOW_ADD_INT32( glyphpath->currentCS.y, yOffset ); - P1.x = OVERFLOW_ADD_INT32( x, xOffset ); - P1.y = OVERFLOW_ADD_INT32( y, yOffset ); + P0.x = ADD_INT32( glyphpath->currentCS.x, xOffset ); + P0.y = ADD_INT32( glyphpath->currentCS.y, yOffset ); + P1.x = ADD_INT32( x, xOffset ); + P1.y = ADD_INT32( y, yOffset ); if ( glyphpath->moveIsPending ) { @@ -1787,15 +1774,15 @@ cf2_getWindingMomentum( x1, y1, x2, y2 ); /* construct offset points */ - P0.x = OVERFLOW_ADD_INT32( glyphpath->currentCS.x, xOffset1 ); - P0.y = OVERFLOW_ADD_INT32( glyphpath->currentCS.y, yOffset1 ); - P1.x = OVERFLOW_ADD_INT32( x1, xOffset1 ); - P1.y = OVERFLOW_ADD_INT32( y1, yOffset1 ); + P0.x = ADD_INT32( glyphpath->currentCS.x, xOffset1 ); + P0.y = ADD_INT32( glyphpath->currentCS.y, yOffset1 ); + P1.x = ADD_INT32( x1, xOffset1 ); + P1.y = ADD_INT32( y1, yOffset1 ); /* note: preserve angle of final segment by using offset3 at both ends */ - P2.x = OVERFLOW_ADD_INT32( x2, xOffset3 ); - P2.y = OVERFLOW_ADD_INT32( y2, yOffset3 ); - P3.x = OVERFLOW_ADD_INT32( x3, xOffset3 ); - P3.y = OVERFLOW_ADD_INT32( y3, yOffset3 ); + P2.x = ADD_INT32( x2, xOffset3 ); + P2.y = ADD_INT32( y2, yOffset3 ); + P3.x = ADD_INT32( x3, xOffset3 ); + P3.y = ADD_INT32( y3, yOffset3 ); if ( glyphpath->moveIsPending ) { diff --git a/src/cff/cf2intrp.c b/src/cff/cf2intrp.c index 356475828..a43d33ecd 100644 --- a/src/cff/cf2intrp.c +++ b/src/cff/cf2intrp.c @@ -305,11 +305,11 @@ stemhint.min = - position = OVERFLOW_ADD_INT32( position, - cf2_stack_getReal( opStack, i ) ); + position = ADD_INT32( position, + cf2_stack_getReal( opStack, i ) ); stemhint.max = - position = OVERFLOW_ADD_INT32( position, - cf2_stack_getReal( opStack, i + 1 ) ); + position = ADD_INT32( position, + cf2_stack_getReal( opStack, i + 1 ) ); stemhint.used = FALSE; stemhint.maxDS = @@ -350,9 +350,8 @@ { vals[i + 2] = vals[i]; if ( readFromStack[i] ) - vals[i + 2] = OVERFLOW_ADD_INT32( vals[i + 2], - cf2_stack_getReal( opStack, - idx++ ) ); + vals[i + 2] = ADD_INT32( vals[i + 2], cf2_stack_getReal( opStack, + idx++ ) ); } if ( isHFlex ) @@ -361,35 +360,33 @@ if ( doConditionalLastRead ) { FT_Bool lastIsX = (FT_Bool)( - cf2_fixedAbs( OVERFLOW_SUB_INT32( vals[10], - *curX ) ) > - cf2_fixedAbs( OVERFLOW_SUB_INT32( vals[11], - *curY ) ) ); + cf2_fixedAbs( SUB_INT32( vals[10], *curX ) ) > + cf2_fixedAbs( SUB_INT32( vals[11], *curY ) ) ); CF2_Fixed lastVal = cf2_stack_getReal( opStack, idx ); if ( lastIsX ) { - vals[12] = OVERFLOW_ADD_INT32( vals[10], lastVal ); + vals[12] = ADD_INT32( vals[10], lastVal ); vals[13] = *curY; } else { vals[12] = *curX; - vals[13] = OVERFLOW_ADD_INT32( vals[11], lastVal ); + vals[13] = ADD_INT32( vals[11], lastVal ); } } else { if ( readFromStack[10] ) - vals[12] = OVERFLOW_ADD_INT32( vals[10], - cf2_stack_getReal( opStack, idx++ ) ); + vals[12] = ADD_INT32( vals[10], + cf2_stack_getReal( opStack, idx++ ) ); else vals[12] = *curX; if ( readFromStack[11] ) - vals[13] = OVERFLOW_ADD_INT32( vals[11], - cf2_stack_getReal( opStack, idx ) ); + vals[13] = ADD_INT32( vals[11], + cf2_stack_getReal( opStack, idx ) ); else vals[13] = *curY; } @@ -435,10 +432,10 @@ for ( j = 1; j < blend->lenBV; j++ ) - sum = OVERFLOW_ADD_INT32( - sum, - FT_MulFix( *weight++, - cf2_stack_getReal( opStack, delta++ ) ) ); + sum = ADD_INT32( sum, + FT_MulFix( *weight++, + cf2_stack_getReal( opStack, + delta++ ) ) ); /* store blended result */ cf2_stack_setReal( opStack, i + base, sum ); @@ -779,7 +776,7 @@ if ( font->decoder->width_only ) goto exit; - curY = OVERFLOW_ADD_INT32( curY, cf2_stack_popFixed( opStack ) ); + curY = ADD_INT32( curY, cf2_stack_popFixed( opStack ) ); cf2_glyphpath_moveTo( &glyphPath, curX, curY ); @@ -795,12 +792,10 @@ for ( idx = 0; idx < count; idx += 2 ) { - curX = OVERFLOW_ADD_INT32( curX, - cf2_stack_getReal( opStack, - idx + 0 ) ); - curY = OVERFLOW_ADD_INT32( curY, - cf2_stack_getReal( opStack, - idx + 1 ) ); + curX = ADD_INT32( curX, cf2_stack_getReal( opStack, + idx + 0 ) ); + curY = ADD_INT32( curY, cf2_stack_getReal( opStack, + idx + 1 ) ); cf2_glyphpath_lineTo( &glyphPath, curX, curY ); } @@ -826,9 +821,9 @@ if ( isX ) - curX = OVERFLOW_ADD_INT32( curX, v ); + curX = ADD_INT32( curX, v ); else - curY = OVERFLOW_ADD_INT32( curY, v ); + curY = ADD_INT32( curY, v ); isX = !isX; @@ -854,18 +849,12 @@ CF2_Fixed x1, y1, x2, y2, x3, y3; - x1 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, idx + 0 ), - curX ); - y1 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, idx + 1 ), - curY ); - x2 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, idx + 2 ), - x1 ); - y2 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, idx + 3 ), - y1 ); - x3 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, idx + 4 ), - x2 ); - y3 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, idx + 5 ), - y2 ); + x1 = ADD_INT32( cf2_stack_getReal( opStack, idx + 0 ), curX ); + y1 = ADD_INT32( cf2_stack_getReal( opStack, idx + 1 ), curY ); + x2 = ADD_INT32( cf2_stack_getReal( opStack, idx + 2 ), x1 ); + y2 = ADD_INT32( cf2_stack_getReal( opStack, idx + 3 ), y1 ); + x3 = ADD_INT32( cf2_stack_getReal( opStack, idx + 4 ), x2 ); + y3 = ADD_INT32( cf2_stack_getReal( opStack, idx + 5 ), y2 ); cf2_glyphpath_curveTo( &glyphPath, x1, y1, x2, y2, x3, y3 ); @@ -876,12 +865,10 @@ if ( op1 == cf2_cmdRCURVELINE ) { - curX = OVERFLOW_ADD_INT32( curX, - cf2_stack_getReal( opStack, - idx + 0 ) ); - curY = OVERFLOW_ADD_INT32( curY, - cf2_stack_getReal( opStack, - idx + 1 ) ); + curX = ADD_INT32( curX, cf2_stack_getReal( opStack, + idx + 0 ) ); + curY = ADD_INT32( curY, cf2_stack_getReal( opStack, + idx + 1 ) ); cf2_glyphpath_lineTo( &glyphPath, curX, curY ); } @@ -1176,8 +1163,8 @@ summand1 = cf2_stack_popFixed( opStack ); cf2_stack_pushFixed( opStack, - OVERFLOW_ADD_INT32( summand1, - summand2 ) ); + ADD_INT32( summand1, + summand2 ) ); } continue; /* do not clear the stack */ @@ -1193,8 +1180,7 @@ minuend = cf2_stack_popFixed( opStack ); cf2_stack_pushFixed( opStack, - OVERFLOW_SUB_INT32( minuend, - subtrahend ) ); + SUB_INT32( minuend, subtrahend ) ); } continue; /* do not clear the stack */ @@ -1461,8 +1447,8 @@ cf2_stack_count( opStack ) == 5 ) { if ( !haveWidth ) - *width = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, 0 ), - nominalWidthX ); + *width = ADD_INT32( cf2_stack_getReal( opStack, 0 ), + nominalWidthX ); } /* width is defined or default after this */ @@ -1610,8 +1596,8 @@ FT_TRACE4(( " rmoveto\n" )); if ( cf2_stack_count( opStack ) > 2 && !haveWidth ) - *width = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, 0 ), - nominalWidthX ); + *width = ADD_INT32( cf2_stack_getReal( opStack, 0 ), + nominalWidthX ); /* width is defined or default after this */ haveWidth = TRUE; @@ -1619,8 +1605,8 @@ if ( font->decoder->width_only ) goto exit; - curY = OVERFLOW_ADD_INT32( curY, cf2_stack_popFixed( opStack ) ); - curX = OVERFLOW_ADD_INT32( curX, cf2_stack_popFixed( opStack ) ); + curY = ADD_INT32( curY, cf2_stack_popFixed( opStack ) ); + curX = ADD_INT32( curX, cf2_stack_popFixed( opStack ) ); cf2_glyphpath_moveTo( &glyphPath, curX, curY ); @@ -1630,8 +1616,8 @@ FT_TRACE4(( " hmoveto\n" )); if ( cf2_stack_count( opStack ) > 1 && !haveWidth ) - *width = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, 0 ), - nominalWidthX ); + *width = ADD_INT32( cf2_stack_getReal( opStack, 0 ), + nominalWidthX ); /* width is defined or default after this */ haveWidth = TRUE; @@ -1639,7 +1625,7 @@ if ( font->decoder->width_only ) goto exit; - curX = OVERFLOW_ADD_INT32( curX, cf2_stack_popFixed( opStack ) ); + curX = ADD_INT32( curX, cf2_stack_popFixed( opStack ) ); cf2_glyphpath_moveTo( &glyphPath, curX, curY ); @@ -1655,12 +1641,10 @@ while ( idx + 6 < count ) { - curX = OVERFLOW_ADD_INT32( curX, - cf2_stack_getReal( opStack, - idx + 0 ) ); - curY = OVERFLOW_ADD_INT32( curY, - cf2_stack_getReal( opStack, - idx + 1 ) ); + curX = ADD_INT32( curX, cf2_stack_getReal( opStack, + idx + 0 ) ); + curY = ADD_INT32( curY, cf2_stack_getReal( opStack, + idx + 1 ) ); cf2_glyphpath_lineTo( &glyphPath, curX, curY ); idx += 2; @@ -1671,24 +1655,12 @@ CF2_Fixed x1, y1, x2, y2, x3, y3; - x1 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, - idx + 0 ), - curX ); - y1 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, - idx + 1 ), - curY ); - x2 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, - idx + 2 ), - x1 ); - y2 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, - idx + 3 ), - y1 ); - x3 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, - idx + 4 ), - x2 ); - y3 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, - idx + 5 ), - y2 ); + x1 = ADD_INT32( cf2_stack_getReal( opStack, idx + 0 ), curX ); + y1 = ADD_INT32( cf2_stack_getReal( opStack, idx + 1 ), curY ); + x2 = ADD_INT32( cf2_stack_getReal( opStack, idx + 2 ), x1 ); + y2 = ADD_INT32( cf2_stack_getReal( opStack, idx + 3 ), y1 ); + x3 = ADD_INT32( cf2_stack_getReal( opStack, idx + 4 ), x2 ); + y3 = ADD_INT32( cf2_stack_getReal( opStack, idx + 5 ), y2 ); cf2_glyphpath_curveTo( &glyphPath, x1, y1, x2, y2, x3, y3 ); @@ -1722,23 +1694,18 @@ if ( ( count - idx ) & 1 ) { - x1 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, idx ), - curX ); + x1 = ADD_INT32( cf2_stack_getReal( opStack, idx ), curX ); idx++; } else x1 = curX; - y1 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, idx + 0 ), - curY ); - x2 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, idx + 1 ), - x1 ); - y2 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, idx + 2 ), - y1 ); + y1 = ADD_INT32( cf2_stack_getReal( opStack, idx + 0 ), curY ); + x2 = ADD_INT32( cf2_stack_getReal( opStack, idx + 1 ), x1 ); + y2 = ADD_INT32( cf2_stack_getReal( opStack, idx + 2 ), y1 ); x3 = x2; - y3 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, idx + 3 ), - y2 ); + y3 = ADD_INT32( cf2_stack_getReal( opStack, idx + 3 ), y2 ); cf2_glyphpath_curveTo( &glyphPath, x1, y1, x2, y2, x3, y3 ); @@ -1772,22 +1739,17 @@ if ( ( count - idx ) & 1 ) { - y1 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, idx ), - curY ); + y1 = ADD_INT32( cf2_stack_getReal( opStack, idx ), curY ); idx++; } else y1 = curY; - x1 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, idx + 0 ), - curX ); - x2 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, idx + 1 ), - x1 ); - y2 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, idx + 2 ), - y1 ); - x3 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, idx + 3 ), - x2 ); + x1 = ADD_INT32( cf2_stack_getReal( opStack, idx + 0 ), curX ); + x2 = ADD_INT32( cf2_stack_getReal( opStack, idx + 1 ), x1 ); + y2 = ADD_INT32( cf2_stack_getReal( opStack, idx + 2 ), y1 ); + x3 = ADD_INT32( cf2_stack_getReal( opStack, idx + 3 ), x2 ); y3 = y2; cf2_glyphpath_curveTo( &glyphPath, x1, y1, x2, y2, x3, y3 ); @@ -1826,21 +1788,15 @@ if ( alternate ) { - x1 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, idx + 0 ), - curX ); + x1 = ADD_INT32( cf2_stack_getReal( opStack, idx + 0 ), curX ); y1 = curY; - x2 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, idx + 1 ), - x1 ); - y2 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, idx + 2 ), - y1 ); - y3 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, idx + 3 ), - y2 ); + x2 = ADD_INT32( cf2_stack_getReal( opStack, idx + 1 ), x1 ); + y2 = ADD_INT32( cf2_stack_getReal( opStack, idx + 2 ), y1 ); + y3 = ADD_INT32( cf2_stack_getReal( opStack, idx + 3 ), y2 ); if ( count - idx == 5 ) { - x3 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, - idx + 4 ), - x2 ); + x3 = ADD_INT32( cf2_stack_getReal( opStack, idx + 4 ), x2 ); idx++; } @@ -1852,20 +1808,14 @@ else { x1 = curX; - y1 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, idx + 0 ), - curY ); - x2 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, idx + 1 ), - x1 ); - y2 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, idx + 2 ), - y1 ); - x3 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, idx + 3 ), - x2 ); + y1 = ADD_INT32( cf2_stack_getReal( opStack, idx + 0 ), curY ); + x2 = ADD_INT32( cf2_stack_getReal( opStack, idx + 1 ), x1 ); + y2 = ADD_INT32( cf2_stack_getReal( opStack, idx + 2 ), y1 ); + x3 = ADD_INT32( cf2_stack_getReal( opStack, idx + 3 ), x2 ); if ( count - idx == 5 ) { - y3 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, - idx + 4 ), - y2 ); + y3 = ADD_INT32( cf2_stack_getReal( opStack, idx + 4 ), y2 ); idx++; } diff --git a/src/cff/cffgload.c b/src/cff/cffgload.c index 52b9bf34e..20f3a2c28 100644 --- a/src/cff/cffgload.c +++ b/src/cff/cffgload.c @@ -1451,8 +1451,8 @@ cff_builder_close_contour( builder ); builder->path_begun = 0; - x = OVERFLOW_ADD_LONG( x, args[-2] ); - y = OVERFLOW_ADD_LONG( y, args[-1] ); + x = ADD_LONG( x, args[-2] ); + y = ADD_LONG( y, args[-1] ); args = stack; break; @@ -1461,7 +1461,7 @@ cff_builder_close_contour( builder ); builder->path_begun = 0; - y = OVERFLOW_ADD_LONG( y, args[-1] ); + y = ADD_LONG( y, args[-1] ); args = stack; break; @@ -1470,7 +1470,7 @@ cff_builder_close_contour( builder ); builder->path_begun = 0; - x = OVERFLOW_ADD_LONG( x, args[-1] ); + x = ADD_LONG( x, args[-1] ); args = stack; break; @@ -1487,8 +1487,8 @@ args -= num_args & ~1; while ( args < decoder->top ) { - x = OVERFLOW_ADD_LONG( x, args[0] ); - y = OVERFLOW_ADD_LONG( y, args[1] ); + x = ADD_LONG( x, args[0] ); + y = ADD_LONG( y, args[1] ); cff_builder_add_point( builder, x, y, 1 ); args += 2; } @@ -1520,9 +1520,9 @@ while ( args < decoder->top ) { if ( phase ) - x = OVERFLOW_ADD_LONG( x, args[0] ); + x = ADD_LONG( x, args[0] ); else - y = OVERFLOW_ADD_LONG( y, args[0] ); + y = ADD_LONG( y, args[0] ); if ( cff_builder_add_point1( builder, x, y ) ) goto Fail; @@ -1553,16 +1553,16 @@ args -= nargs; while ( args < decoder->top ) { - x = OVERFLOW_ADD_LONG( x, args[0] ); - y = OVERFLOW_ADD_LONG( y, args[1] ); + x = ADD_LONG( x, args[0] ); + y = ADD_LONG( y, args[1] ); cff_builder_add_point( builder, x, y, 0 ); - x = OVERFLOW_ADD_LONG( x, args[2] ); - y = OVERFLOW_ADD_LONG( y, args[3] ); + x = ADD_LONG( x, args[2] ); + y = ADD_LONG( y, args[3] ); cff_builder_add_point( builder, x, y, 0 ); - x = OVERFLOW_ADD_LONG( x, args[4] ); - y = OVERFLOW_ADD_LONG( y, args[5] ); + x = ADD_LONG( x, args[4] ); + y = ADD_LONG( y, args[5] ); cff_builder_add_point( builder, x, y, 1 ); args += 6; @@ -1593,7 +1593,7 @@ if ( nargs & 1 ) { - x = OVERFLOW_ADD_LONG( x, args[0] ); + x = ADD_LONG( x, args[0] ); args++; nargs--; } @@ -1603,14 +1603,14 @@ while ( args < decoder->top ) { - y = OVERFLOW_ADD_LONG( y, args[0] ); + y = ADD_LONG( y, args[0] ); cff_builder_add_point( builder, x, y, 0 ); - x = OVERFLOW_ADD_LONG( x, args[1] ); - y = OVERFLOW_ADD_LONG( y, args[2] ); + x = ADD_LONG( x, args[1] ); + y = ADD_LONG( y, args[2] ); cff_builder_add_point( builder, x, y, 0 ); - y = OVERFLOW_ADD_LONG( y, args[3] ); + y = ADD_LONG( y, args[3] ); cff_builder_add_point( builder, x, y, 1 ); args += 4; @@ -1640,7 +1640,7 @@ args -= nargs; if ( nargs & 1 ) { - y = OVERFLOW_ADD_LONG( y, args[0] ); + y = ADD_LONG( y, args[0] ); args++; nargs--; } @@ -1650,14 +1650,14 @@ while ( args < decoder->top ) { - x = OVERFLOW_ADD_LONG( x, args[0] ); + x = ADD_LONG( x, args[0] ); cff_builder_add_point( builder, x, y, 0 ); - x = OVERFLOW_ADD_LONG( x, args[1] ); - y = OVERFLOW_ADD_LONG( y, args[2] ); + x = ADD_LONG( x, args[1] ); + y = ADD_LONG( y, args[2] ); cff_builder_add_point( builder, x, y, 0 ); - x = OVERFLOW_ADD_LONG( x, args[3] ); + x = ADD_LONG( x, args[3] ); cff_builder_add_point( builder, x, y, 1 ); args += 4; @@ -1698,30 +1698,30 @@ nargs -= 4; if ( phase ) { - x = OVERFLOW_ADD_LONG( x, args[0] ); + x = ADD_LONG( x, args[0] ); cff_builder_add_point( builder, x, y, 0 ); - x = OVERFLOW_ADD_LONG( x, args[1] ); - y = OVERFLOW_ADD_LONG( y, args[2] ); + x = ADD_LONG( x, args[1] ); + y = ADD_LONG( y, args[2] ); cff_builder_add_point( builder, x, y, 0 ); - y = OVERFLOW_ADD_LONG( y, args[3] ); + y = ADD_LONG( y, args[3] ); if ( nargs == 1 ) - x = OVERFLOW_ADD_LONG( x, args[4] ); + x = ADD_LONG( x, args[4] ); cff_builder_add_point( builder, x, y, 1 ); } else { - y = OVERFLOW_ADD_LONG( y, args[0] ); + y = ADD_LONG( y, args[0] ); cff_builder_add_point( builder, x, y, 0 ); - x = OVERFLOW_ADD_LONG( x, args[1] ); - y = OVERFLOW_ADD_LONG( y, args[2] ); + x = ADD_LONG( x, args[1] ); + y = ADD_LONG( y, args[2] ); cff_builder_add_point( builder, x, y, 0 ); - x = OVERFLOW_ADD_LONG( x, args[3] ); + x = ADD_LONG( x, args[3] ); if ( nargs == 1 ) - y = OVERFLOW_ADD_LONG( y, args[4] ); + y = ADD_LONG( y, args[4] ); cff_builder_add_point( builder, x, y, 1 ); } args += 4; @@ -1754,8 +1754,8 @@ /* first, add the line segments */ while ( num_lines > 0 ) { - x = OVERFLOW_ADD_LONG( x, args[0] ); - y = OVERFLOW_ADD_LONG( y, args[1] ); + x = ADD_LONG( x, args[0] ); + y = ADD_LONG( y, args[1] ); cff_builder_add_point( builder, x, y, 1 ); args += 2; @@ -1763,16 +1763,16 @@ } /* then the curve */ - x = OVERFLOW_ADD_LONG( x, args[0] ); - y = OVERFLOW_ADD_LONG( y, args[1] ); + x = ADD_LONG( x, args[0] ); + y = ADD_LONG( y, args[1] ); cff_builder_add_point( builder, x, y, 0 ); - x = OVERFLOW_ADD_LONG( x, args[2] ); - y = OVERFLOW_ADD_LONG( y, args[3] ); + x = ADD_LONG( x, args[2] ); + y = ADD_LONG( y, args[3] ); cff_builder_add_point( builder, x, y, 0 ); - x = OVERFLOW_ADD_LONG( x, args[4] ); - y = OVERFLOW_ADD_LONG( y, args[5] ); + x = ADD_LONG( x, args[4] ); + y = ADD_LONG( y, args[5] ); cff_builder_add_point( builder, x, y, 1 ); args = stack; @@ -1803,16 +1803,16 @@ /* first, add the curves */ while ( num_curves > 0 ) { - x = OVERFLOW_ADD_LONG( x, args[0] ); - y = OVERFLOW_ADD_LONG( y, args[1] ); + x = ADD_LONG( x, args[0] ); + y = ADD_LONG( y, args[1] ); cff_builder_add_point( builder, x, y, 0 ); - x = OVERFLOW_ADD_LONG( x, args[2] ); - y = OVERFLOW_ADD_LONG( y, args[3] ); + x = ADD_LONG( x, args[2] ); + y = ADD_LONG( y, args[3] ); cff_builder_add_point( builder, x, y, 0 ); - x = OVERFLOW_ADD_LONG( x, args[4] ); - y = OVERFLOW_ADD_LONG( y, args[5] ); + x = ADD_LONG( x, args[4] ); + y = ADD_LONG( y, args[5] ); cff_builder_add_point( builder, x, y, 1 ); args += 6; @@ -1820,8 +1820,8 @@ } /* then the final line */ - x = OVERFLOW_ADD_LONG( x, args[0] ); - y = OVERFLOW_ADD_LONG( y, args[1] ); + x = ADD_LONG( x, args[0] ); + y = ADD_LONG( y, args[1] ); cff_builder_add_point( builder, x, y, 1 ); args = stack; @@ -1846,32 +1846,32 @@ start_y = y; /* first control point */ - x = OVERFLOW_ADD_LONG( x, args[0] ); - y = OVERFLOW_ADD_LONG( y, args[1] ); + x = ADD_LONG( x, args[0] ); + y = ADD_LONG( y, args[1] ); cff_builder_add_point( builder, x, y, 0 ); /* second control point */ - x = OVERFLOW_ADD_LONG( x, args[2] ); - y = OVERFLOW_ADD_LONG( y, args[3] ); + x = ADD_LONG( x, args[2] ); + y = ADD_LONG( y, args[3] ); cff_builder_add_point( builder, x, y, 0 ); /* join point; on curve, with y-value the same as the last */ /* control point's y-value */ - x = OVERFLOW_ADD_LONG( x, args[4] ); + x = ADD_LONG( x, args[4] ); cff_builder_add_point( builder, x, y, 1 ); /* third control point, with y-value the same as the join */ /* point's y-value */ - x = OVERFLOW_ADD_LONG( x, args[5] ); + x = ADD_LONG( x, args[5] ); cff_builder_add_point( builder, x, y, 0 ); /* fourth control point */ - x = OVERFLOW_ADD_LONG( x, args[6] ); - y = OVERFLOW_ADD_LONG( y, args[7] ); + x = ADD_LONG( x, args[6] ); + y = ADD_LONG( y, args[7] ); cff_builder_add_point( builder, x, y, 0 ); /* ending point, with y-value the same as the start */ - x = OVERFLOW_ADD_LONG( x, args[8] ); + x = ADD_LONG( x, args[8] ); y = start_y; cff_builder_add_point( builder, x, y, 1 ); @@ -1895,32 +1895,32 @@ start_y = y; /* first control point */ - x = OVERFLOW_ADD_LONG( x, args[0] ); + x = ADD_LONG( x, args[0] ); cff_builder_add_point( builder, x, y, 0 ); /* second control point */ - x = OVERFLOW_ADD_LONG( x, args[1] ); - y = OVERFLOW_ADD_LONG( y, args[2] ); + x = ADD_LONG( x, args[1] ); + y = ADD_LONG( y, args[2] ); cff_builder_add_point( builder, x, y, 0 ); /* join point; on curve, with y-value the same as the last */ /* control point's y-value */ - x = OVERFLOW_ADD_LONG( x, args[3] ); + x = ADD_LONG( x, args[3] ); cff_builder_add_point( builder, x, y, 1 ); /* third control point, with y-value the same as the join */ /* point's y-value */ - x = OVERFLOW_ADD_LONG( x, args[4] ); + x = ADD_LONG( x, args[4] ); cff_builder_add_point( builder, x, y, 0 ); /* fourth control point */ - x = OVERFLOW_ADD_LONG( x, args[5] ); + x = ADD_LONG( x, args[5] ); y = start_y; cff_builder_add_point( builder, x, y, 0 ); /* ending point, with y-value the same as the start point's */ /* y-value -- we don't add this point, though */ - x = OVERFLOW_ADD_LONG( x, args[6] ); + x = ADD_LONG( x, args[6] ); cff_builder_add_point( builder, x, y, 1 ); args = stack; @@ -1956,8 +1956,8 @@ /* grab up to the last argument */ for ( count = 5; count > 0; count-- ) { - dx = OVERFLOW_ADD_LONG( dx, temp[0] ); - dy = OVERFLOW_ADD_LONG( dy, temp[1] ); + dx = ADD_LONG( dx, temp[0] ); + dy = ADD_LONG( dy, temp[1] ); temp += 2; } @@ -1971,8 +1971,8 @@ for ( count = 5; count > 0; count-- ) { - x = OVERFLOW_ADD_LONG( x, args[0] ); - y = OVERFLOW_ADD_LONG( y, args[1] ); + x = ADD_LONG( x, args[0] ); + y = ADD_LONG( y, args[1] ); cff_builder_add_point( builder, x, y, (FT_Bool)( count == 3 ) ); args += 2; @@ -1981,13 +1981,13 @@ /* is last operand an x- or y-delta? */ if ( horizontal ) { - x = OVERFLOW_ADD_LONG( x, args[0] ); + x = ADD_LONG( x, args[0] ); y = start_y; } else { x = start_x; - y = OVERFLOW_ADD_LONG( y, args[0] ); + y = ADD_LONG( y, args[0] ); } cff_builder_add_point( builder, x, y, 1 ); @@ -2009,8 +2009,8 @@ for ( count = 6; count > 0; count-- ) { - x = OVERFLOW_ADD_LONG( x, args[0] ); - y = OVERFLOW_ADD_LONG( y, args[1] ); + x = ADD_LONG( x, args[0] ); + y = ADD_LONG( y, args[1] ); cff_builder_add_point( builder, x, y, (FT_Bool)( count == 4 || count == 1 ) ); args += 2; @@ -2100,14 +2100,14 @@ case cff_op_add: FT_TRACE4(( " add\n" )); - args[0] = OVERFLOW_ADD_LONG( args[0], args[1] ); + args[0] = ADD_LONG( args[0], args[1] ); args++; break; case cff_op_sub: FT_TRACE4(( " sub\n" )); - args[0] = OVERFLOW_SUB_LONG( args[0], args[1] ); + args[0] = SUB_LONG( args[0], args[1] ); args++; break; @@ -2380,12 +2380,12 @@ FT_TRACE4(( " hsbw (invalid op)\n" )); decoder->glyph_width = - OVERFLOW_ADD_LONG( decoder->nominal_width, ( args[1] >> 16 ) ); + ADD_LONG( decoder->nominal_width, ( args[1] >> 16 ) ); decoder->builder.left_bearing.x = args[0]; decoder->builder.left_bearing.y = 0; - x = OVERFLOW_ADD_LONG( decoder->builder.pos_x, args[0] ); + x = ADD_LONG( decoder->builder.pos_x, args[0] ); y = decoder->builder.pos_y; args = stack; break; @@ -2398,13 +2398,13 @@ FT_TRACE4(( " sbw (invalid op)\n" )); decoder->glyph_width = - OVERFLOW_ADD_LONG( decoder->nominal_width, ( args[2] >> 16 ) ); + ADD_LONG( decoder->nominal_width, ( args[2] >> 16 ) ); decoder->builder.left_bearing.x = args[0]; decoder->builder.left_bearing.y = args[1]; - x = OVERFLOW_ADD_LONG( decoder->builder.pos_x, args[0] ); - y = OVERFLOW_ADD_LONG( decoder->builder.pos_y, args[1] ); + x = ADD_LONG( decoder->builder.pos_x, args[0] ); + y = ADD_LONG( decoder->builder.pos_y, args[1] ); args = stack; break; @@ -2415,8 +2415,8 @@ FT_TRACE4(( " setcurrentpoint (invalid op)\n" )); - x = OVERFLOW_ADD_LONG( decoder->builder.pos_x, args[0] ); - y = OVERFLOW_ADD_LONG( decoder->builder.pos_y, args[1] ); + x = ADD_LONG( decoder->builder.pos_x, args[0] ); + y = ADD_LONG( decoder->builder.pos_y, args[1] ); args = stack; break; diff --git a/src/cff/cffload.c b/src/cff/cffload.c index 2ee438755..12420384a 100644 --- a/src/cff/cffload.c +++ b/src/cff/cffload.c @@ -1352,7 +1352,7 @@ sum = cff_parse_num( parser, &parser->stack[i + base] ) * 65536; for ( j = 1; j < blend->lenBV; j++ ) - sum = OVERFLOW_ADD_INT32( + sum = ADD_INT32( sum, FT_MulFix( *weight++, diff --git a/src/cff/cffparse.c b/src/cff/cffparse.c index 6d617e26e..ae55bbb85 100644 --- a/src/cff/cffparse.c +++ b/src/cff/cffparse.c @@ -1610,8 +1610,7 @@ val = 0; while ( num_args > 0 ) { - val = OVERFLOW_ADD_LONG( val, - cff_parse_num( parser, data++ ) ); + val = ADD_LONG( val, cff_parse_num( parser, data++ ) ); switch ( field->size ) { case (8 / FT_CHAR_BIT): diff --git a/src/psaux/t1decode.c b/src/psaux/t1decode.c index 04de1228d..1250b53f5 100644 --- a/src/psaux/t1decode.c +++ b/src/psaux/t1decode.c @@ -864,9 +864,9 @@ for ( mm = 1; mm < blend->num_designs; mm++ ) - tmp = OVERFLOW_ADD_LONG( - tmp, - FT_MulFix( *delta++, blend->weight_vector[mm] ) ); + tmp = ADD_LONG( tmp, + FT_MulFix( *delta++, + blend->weight_vector[mm] ) ); *values++ = tmp; } @@ -906,7 +906,7 @@ if ( arg_cnt != 2 ) goto Unexpected_OtherSubr; - top[0] = OVERFLOW_ADD_LONG( top[0], top[1] ); + top[0] = ADD_LONG( top[0], top[1] ); known_othersubr_result_cnt = 1; break; @@ -917,7 +917,7 @@ if ( arg_cnt != 2 ) goto Unexpected_OtherSubr; - top[0] = OVERFLOW_SUB_LONG( top[0], top[1] ); + top[0] = SUB_LONG( top[0], top[1] ); known_othersubr_result_cnt = 1; break; @@ -1149,13 +1149,13 @@ builder->parse_state = T1_Parse_Have_Width; - builder->left_bearing.x = OVERFLOW_ADD_LONG( - builder->left_bearing.x, top[0] ); + builder->left_bearing.x = ADD_LONG( builder->left_bearing.x, + top[0] ); builder->advance.x = top[1]; builder->advance.y = 0; - orig_x = x = OVERFLOW_ADD_LONG( builder->pos_x, top[0] ); + orig_x = x = ADD_LONG( builder->pos_x, top[0] ); orig_y = y = builder->pos_y; FT_UNUSED( orig_y ); @@ -1181,16 +1181,16 @@ builder->parse_state = T1_Parse_Have_Width; - builder->left_bearing.x = OVERFLOW_ADD_LONG( - builder->left_bearing.x, top[0] ); - builder->left_bearing.y = OVERFLOW_ADD_LONG( - builder->left_bearing.y, top[1] ); + builder->left_bearing.x = ADD_LONG( builder->left_bearing.x, + top[0] ); + builder->left_bearing.y = ADD_LONG( builder->left_bearing.y, + top[1] ); builder->advance.x = top[2]; builder->advance.y = top[3]; - x = OVERFLOW_ADD_LONG( builder->pos_x, top[0] ); - y = OVERFLOW_ADD_LONG( builder->pos_y, top[1] ); + x = ADD_LONG( builder->pos_x, top[0] ); + y = ADD_LONG( builder->pos_y, top[1] ); /* the `metrics_only' indicates that we only want to compute */ /* the glyph's metrics (lsb + advance width), not load the */ @@ -1217,13 +1217,13 @@ if ( FT_SET_ERROR( t1_builder_start_point( builder, x, y ) ) ) goto Fail; - x = OVERFLOW_ADD_LONG( x, top[0] ); + x = ADD_LONG( x, top[0] ); goto Add_Line; case op_hmoveto: FT_TRACE4(( " hmoveto" )); - x = OVERFLOW_ADD_LONG( x, top[0] ); + x = ADD_LONG( x, top[0] ); if ( !decoder->flex_state ) { @@ -1240,14 +1240,14 @@ FT_SET_ERROR( t1_builder_check_points( builder, 3 ) ) ) goto Fail; - x = OVERFLOW_ADD_LONG( x, top[0] ); + x = ADD_LONG( x, top[0] ); t1_builder_add_point( builder, x, y, 0 ); - x = OVERFLOW_ADD_LONG( x, top[1] ); - y = OVERFLOW_ADD_LONG( y, top[2] ); + x = ADD_LONG( x, top[1] ); + y = ADD_LONG( y, top[2] ); t1_builder_add_point( builder, x, y, 0 ); - y = OVERFLOW_ADD_LONG( y, top[3] ); + y = ADD_LONG( y, top[3] ); t1_builder_add_point( builder, x, y, 1 ); break; @@ -1257,8 +1257,8 @@ if ( FT_SET_ERROR( t1_builder_start_point( builder, x, y ) ) ) goto Fail; - x = OVERFLOW_ADD_LONG( x, top[0] ); - y = OVERFLOW_ADD_LONG( y, top[1] ); + x = ADD_LONG( x, top[0] ); + y = ADD_LONG( y, top[1] ); Add_Line: if ( FT_SET_ERROR( t1_builder_add_point1( builder, x, y ) ) ) @@ -1268,8 +1268,8 @@ case op_rmoveto: FT_TRACE4(( " rmoveto" )); - x = OVERFLOW_ADD_LONG( x, top[0] ); - y = OVERFLOW_ADD_LONG( y, top[1] ); + x = ADD_LONG( x, top[0] ); + y = ADD_LONG( y, top[1] ); if ( !decoder->flex_state ) { @@ -1286,16 +1286,16 @@ FT_SET_ERROR( t1_builder_check_points( builder, 3 ) ) ) goto Fail; - x = OVERFLOW_ADD_LONG( x, top[0] ); - y = OVERFLOW_ADD_LONG( y, top[1] ); + x = ADD_LONG( x, top[0] ); + y = ADD_LONG( y, top[1] ); t1_builder_add_point( builder, x, y, 0 ); - x = OVERFLOW_ADD_LONG( x, top[2] ); - y = OVERFLOW_ADD_LONG( y, top[3] ); + x = ADD_LONG( x, top[2] ); + y = ADD_LONG( y, top[3] ); t1_builder_add_point( builder, x, y, 0 ); - x = OVERFLOW_ADD_LONG( x, top[4] ); - y = OVERFLOW_ADD_LONG( y, top[5] ); + x = ADD_LONG( x, top[4] ); + y = ADD_LONG( y, top[5] ); t1_builder_add_point( builder, x, y, 1 ); break; @@ -1306,14 +1306,14 @@ FT_SET_ERROR( t1_builder_check_points( builder, 3 ) ) ) goto Fail; - y = OVERFLOW_ADD_LONG( y, top[0] ); + y = ADD_LONG( y, top[0] ); t1_builder_add_point( builder, x, y, 0 ); - x = OVERFLOW_ADD_LONG( x, top[1] ); - y = OVERFLOW_ADD_LONG( y, top[2] ); + x = ADD_LONG( x, top[1] ); + y = ADD_LONG( y, top[2] ); t1_builder_add_point( builder, x, y, 0 ); - x = OVERFLOW_ADD_LONG( x, top[3] ); + x = ADD_LONG( x, top[3] ); t1_builder_add_point( builder, x, y, 1 ); break; @@ -1323,13 +1323,13 @@ if ( FT_SET_ERROR( t1_builder_start_point( builder, x, y ) ) ) goto Fail; - y = OVERFLOW_ADD_LONG( y, top[0] ); + y = ADD_LONG( y, top[0] ); goto Add_Line; case op_vmoveto: FT_TRACE4(( " vmoveto" )); - y = OVERFLOW_ADD_LONG( y, top[0] ); + y = ADD_LONG( y, top[0] ); if ( !decoder->flex_state ) { @@ -1487,7 +1487,7 @@ /* record vertical hint */ if ( hinter ) { - top[0] = OVERFLOW_ADD_LONG( top[0], orig_x ); + top[0] = ADD_LONG( top[0], orig_x ); hinter->stem( hinter->hints, 0, top ); } break; @@ -1501,9 +1501,9 @@ FT_Pos dx = orig_x; - top[0] = OVERFLOW_ADD_LONG( top[0], dx ); - top[2] = OVERFLOW_ADD_LONG( top[2], dx ); - top[4] = OVERFLOW_ADD_LONG( top[4], dx ); + top[0] = ADD_LONG( top[0], dx ); + top[2] = ADD_LONG( top[2], dx ); + top[4] = ADD_LONG( top[4], dx ); hinter->stem3( hinter->hints, 0, top ); } break; diff --git a/src/smooth/ftgrays.c b/src/smooth/ftgrays.c index 04f0c2ab3..df645e66c 100644 --- a/src/smooth/ftgrays.c +++ b/src/smooth/ftgrays.c @@ -141,11 +141,11 @@ #define FT_INT_MAX INT_MAX #define FT_ULONG_MAX ULONG_MAX -#define OVERFLOW_ADD_LONG( a, b ) \ +#define ADD_LONG( a, b ) \ (long)( (unsigned long)(a) + (unsigned long)(b) ) -#define OVERFLOW_SUB_LONG( a, b ) \ +#define SUB_LONG( a, b ) \ (long)( (unsigned long)(a) - (unsigned long)(b) ) -#define OVERFLOW_MUL_LONG( a, b ) \ +#define MUL_LONG( a, b ) \ (long)( (unsigned long)(a) * (unsigned long)(b) ) #define NEG_LONG( a ) \ (long)( -(unsigned long)(a) ) @@ -1146,8 +1146,7 @@ typedef ptrdiff_t FT_PtrDist; /* s is L * the perpendicular distance from P1 to the line P0-P3. */ dx1 = arc[1].x - arc[0].x; dy1 = arc[1].y - arc[0].y; - s = FT_ABS( OVERFLOW_SUB_LONG( OVERFLOW_MUL_LONG( dy, dx1 ), - OVERFLOW_MUL_LONG( dx, dy1 ) ) ); + s = FT_ABS( SUB_LONG( MUL_LONG( dy, dx1 ), MUL_LONG( dx, dy1 ) ) ); if ( s > s_limit ) goto Split; @@ -1155,8 +1154,7 @@ typedef ptrdiff_t FT_PtrDist; /* s is L * the perpendicular distance from P2 to the line P0-P3. */ dx2 = arc[2].x - arc[0].x; dy2 = arc[2].y - arc[0].y; - s = FT_ABS( OVERFLOW_SUB_LONG( OVERFLOW_MUL_LONG( dy, dx2 ), - OVERFLOW_MUL_LONG( dx, dy2 ) ) ); + s = FT_ABS( SUB_LONG( MUL_LONG( dy, dx2 ), MUL_LONG( dx, dy2 ) ) ); if ( s > s_limit ) goto Split; diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c index 66e8228d3..d1351e795 100644 --- a/src/truetype/ttgload.c +++ b/src/truetype/ttgload.c @@ -2100,8 +2100,8 @@ } /* set glyph dimensions */ - glyph->metrics.width = OVERFLOW_SUB_LONG( bbox.xMax, bbox.xMin ); - glyph->metrics.height = OVERFLOW_SUB_LONG( bbox.yMax, bbox.yMin ); + glyph->metrics.width = SUB_LONG( bbox.xMax, bbox.xMin ); + glyph->metrics.height = SUB_LONG( bbox.yMax, bbox.yMin ); /* Now take care of vertical metrics. In the case where there is */ /* no vertical information within the font (relatively common), */ @@ -2137,8 +2137,8 @@ /* table in the font. Otherwise, we use the */ /* values defined in the horizontal header. */ - height = (FT_Short)FT_DivFix( OVERFLOW_SUB_LONG( bbox.yMax, - bbox.yMin ), + height = (FT_Short)FT_DivFix( SUB_LONG( bbox.yMax, + bbox.yMin ), y_scale ); if ( face->os2.version != 0xFFFFU ) advance = (FT_Pos)( face->os2.sTypoAscender - diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c index 7ac9b38d8..28c1d3aa7 100644 --- a/src/truetype/ttinterp.c +++ b/src/truetype/ttinterp.c @@ -65,15 +65,15 @@ TT_INTERPRETER_VERSION_40 ) #endif -#define PROJECT( v1, v2 ) \ - exc->func_project( exc, \ - OVERFLOW_SUB_LONG( (v1)->x, (v2)->x ), \ - OVERFLOW_SUB_LONG( (v1)->y, (v2)->y ) ) +#define PROJECT( v1, v2 ) \ + exc->func_project( exc, \ + SUB_LONG( (v1)->x, (v2)->x ), \ + SUB_LONG( (v1)->y, (v2)->y ) ) -#define DUALPROJ( v1, v2 ) \ - exc->func_dualproj( exc, \ - OVERFLOW_SUB_LONG( (v1)->x, (v2)->x ), \ - OVERFLOW_SUB_LONG( (v1)->y, (v2)->y ) ) +#define DUALPROJ( v1, v2 ) \ + exc->func_dualproj( exc, \ + SUB_LONG( (v1)->x, (v2)->x ), \ + SUB_LONG( (v1)->y, (v2)->y ) ) #define FAST_PROJECT( v ) \ exc->func_project( exc, (v)->x, (v)->y ) @@ -1680,9 +1680,10 @@ if ( SUBPIXEL_HINTING_INFINALITY && ( !exc->ignore_x_mode || ( exc->sph_tweak_flags & SPH_TWEAK_ALLOW_X_DMOVE ) ) ) - zone->cur[point].x = OVERFLOW_ADD_LONG( - zone->cur[point].x, - FT_MulDiv( distance, v, exc->F_dot_P ) ); + zone->cur[point].x = ADD_LONG( zone->cur[point].x, + FT_MulDiv( distance, + v, + exc->F_dot_P ) ); else #endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */ @@ -1691,16 +1692,18 @@ /* diagonal moves, but only post-IUP. DejaVu tries to adjust */ /* diagonal stems like on `Z' and `z' post-IUP. */ if ( SUBPIXEL_HINTING_MINIMAL && !exc->backward_compatibility ) - zone->cur[point].x = OVERFLOW_ADD_LONG( - zone->cur[point].x, - FT_MulDiv( distance, v, exc->F_dot_P ) ); + zone->cur[point].x = ADD_LONG( zone->cur[point].x, + FT_MulDiv( distance, + v, + exc->F_dot_P ) ); else #endif if ( NO_SUBPIXEL_HINTING ) - zone->cur[point].x = OVERFLOW_ADD_LONG( - zone->cur[point].x, - FT_MulDiv( distance, v, exc->F_dot_P ) ); + zone->cur[point].x = ADD_LONG( zone->cur[point].x, + FT_MulDiv( distance, + v, + exc->F_dot_P ) ); zone->tags[point] |= FT_CURVE_TAG_TOUCH_X; } @@ -1715,9 +1718,10 @@ exc->iupx_called && exc->iupy_called ) ) #endif - zone->cur[point].y = OVERFLOW_ADD_LONG( - zone->cur[point].y, - FT_MulDiv( distance, v, exc->F_dot_P ) ); + zone->cur[point].y = ADD_LONG( zone->cur[point].y, + FT_MulDiv( distance, + v, + exc->F_dot_P ) ); zone->tags[point] |= FT_CURVE_TAG_TOUCH_Y; } @@ -1753,16 +1757,18 @@ v = exc->GS.freeVector.x; if ( v != 0 ) - zone->org[point].x = OVERFLOW_ADD_LONG( - zone->org[point].x, - FT_MulDiv( distance, v, exc->F_dot_P ) ); + zone->org[point].x = ADD_LONG( zone->org[point].x, + FT_MulDiv( distance, + v, + exc->F_dot_P ) ); v = exc->GS.freeVector.y; if ( v != 0 ) - zone->org[point].y = OVERFLOW_ADD_LONG( - zone->org[point].y, - FT_MulDiv( distance, v, exc->F_dot_P ) ); + zone->org[point].y = ADD_LONG( zone->org[point].y, + FT_MulDiv( distance, + v, + exc->F_dot_P ) ); } @@ -1785,18 +1791,18 @@ { #ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY if ( SUBPIXEL_HINTING_INFINALITY && !exc->ignore_x_mode ) - zone->cur[point].x = OVERFLOW_ADD_LONG( zone->cur[point].x, distance ); + zone->cur[point].x = ADD_LONG( zone->cur[point].x, distance ); else #endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */ #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL if ( SUBPIXEL_HINTING_MINIMAL && !exc->backward_compatibility ) - zone->cur[point].x = OVERFLOW_ADD_LONG( zone->cur[point].x, distance ); + zone->cur[point].x = ADD_LONG( zone->cur[point].x, distance ); else #endif if ( NO_SUBPIXEL_HINTING ) - zone->cur[point].x = OVERFLOW_ADD_LONG( zone->cur[point].x, distance ); + zone->cur[point].x = ADD_LONG( zone->cur[point].x, distance ); zone->tags[point] |= FT_CURVE_TAG_TOUCH_X; } @@ -1815,7 +1821,7 @@ exc->backward_compatibility && exc->iupx_called && exc->iupy_called ) ) #endif - zone->cur[point].y = OVERFLOW_ADD_LONG( zone->cur[point].y, distance ); + zone->cur[point].y = ADD_LONG( zone->cur[point].y, distance ); zone->tags[point] |= FT_CURVE_TAG_TOUCH_Y; } @@ -1839,7 +1845,7 @@ { FT_UNUSED( exc ); - zone->org[point].x = OVERFLOW_ADD_LONG( zone->org[point].x, distance ); + zone->org[point].x = ADD_LONG( zone->org[point].x, distance ); } @@ -1851,7 +1857,7 @@ { FT_UNUSED( exc ); - zone->org[point].y = OVERFLOW_ADD_LONG( zone->org[point].y, distance ); + zone->org[point].y = ADD_LONG( zone->org[point].y, distance ); } @@ -2842,7 +2848,7 @@ static void Ins_ADD( FT_Long* args ) { - args[0] = OVERFLOW_ADD_LONG( args[0], args[1] ); + args[0] = ADD_LONG( args[0], args[1] ); } @@ -2855,7 +2861,7 @@ static void Ins_SUB( FT_Long* args ) { - args[0] = OVERFLOW_SUB_LONG( args[0], args[1] ); + args[0] = SUB_LONG( args[0], args[1] ); } @@ -5408,8 +5414,7 @@ if ( !( SUBPIXEL_HINTING_MINIMAL && exc->backward_compatibility ) ) #endif - exc->zp2.cur[point].x = OVERFLOW_ADD_LONG( exc->zp2.cur[point].x, - dx ); + exc->zp2.cur[point].x = ADD_LONG( exc->zp2.cur[point].x, dx ); if ( touch ) exc->zp2.tags[point] |= FT_CURVE_TAG_TOUCH_X; @@ -5423,8 +5428,7 @@ exc->iupx_called && exc->iupy_called ) ) #endif - exc->zp2.cur[point].y = OVERFLOW_ADD_LONG( exc->zp2.cur[point].y, - dy ); + exc->zp2.cur[point].y = ADD_LONG( exc->zp2.cur[point].y, dy ); if ( touch ) exc->zp2.tags[point] |= FT_CURVE_TAG_TOUCH_Y; @@ -5799,18 +5803,17 @@ #ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY /* subpixel hinting - make MSIRP respect CVT cut-in; */ - if ( SUBPIXEL_HINTING_INFINALITY && - exc->ignore_x_mode && - exc->GS.freeVector.x != 0 && - FT_ABS( OVERFLOW_SUB_LONG( distance, - args[1] ) ) >= control_value_cutin ) + if ( SUBPIXEL_HINTING_INFINALITY && + exc->ignore_x_mode && + exc->GS.freeVector.x != 0 && + FT_ABS( SUB_LONG( distance, args[1] ) ) >= control_value_cutin ) distance = args[1]; #endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */ exc->func_move( exc, &exc->zp1, point, - OVERFLOW_SUB_LONG( args[1], distance ) ); + SUB_LONG( args[1], distance ) ); exc->GS.rp1 = exc->GS.rp0; exc->GS.rp2 = point; @@ -6459,19 +6462,19 @@ /* Cramer's rule */ - dbx = OVERFLOW_SUB_LONG( exc->zp0.cur[b1].x, exc->zp0.cur[b0].x ); - dby = OVERFLOW_SUB_LONG( exc->zp0.cur[b1].y, exc->zp0.cur[b0].y ); + dbx = SUB_LONG( exc->zp0.cur[b1].x, exc->zp0.cur[b0].x ); + dby = SUB_LONG( exc->zp0.cur[b1].y, exc->zp0.cur[b0].y ); - dax = OVERFLOW_SUB_LONG( exc->zp1.cur[a1].x, exc->zp1.cur[a0].x ); - day = OVERFLOW_SUB_LONG( exc->zp1.cur[a1].y, exc->zp1.cur[a0].y ); + dax = SUB_LONG( exc->zp1.cur[a1].x, exc->zp1.cur[a0].x ); + day = SUB_LONG( exc->zp1.cur[a1].y, exc->zp1.cur[a0].y ); - dx = OVERFLOW_SUB_LONG( exc->zp0.cur[b0].x, exc->zp1.cur[a0].x ); - dy = OVERFLOW_SUB_LONG( exc->zp0.cur[b0].y, exc->zp1.cur[a0].y ); + dx = SUB_LONG( exc->zp0.cur[b0].x, exc->zp1.cur[a0].x ); + dy = SUB_LONG( exc->zp0.cur[b0].y, exc->zp1.cur[a0].y ); - discriminant = OVERFLOW_ADD_LONG( FT_MulDiv( dax, -dby, 0x40 ), - FT_MulDiv( day, dbx, 0x40 ) ); - dotproduct = OVERFLOW_ADD_LONG( FT_MulDiv( dax, dbx, 0x40 ), - FT_MulDiv( day, dby, 0x40 ) ); + discriminant = ADD_LONG( FT_MulDiv( dax, -dby, 0x40 ), + FT_MulDiv( day, dbx, 0x40 ) ); + dotproduct = ADD_LONG( FT_MulDiv( dax, dbx, 0x40 ), + FT_MulDiv( day, dby, 0x40 ) ); /* The discriminant above is actually a cross product of vectors */ /* da and db. Together with the dot product, they can be used as */ @@ -6481,18 +6484,17 @@ /* discriminant = |da||db|sin(angle) . */ /* We use these equations to reject grazing intersections by */ /* thresholding abs(tan(angle)) at 1/19, corresponding to 3 degrees. */ - if ( OVERFLOW_MUL_LONG( 19, FT_ABS( discriminant ) ) > - FT_ABS( dotproduct ) ) + if ( MUL_LONG( 19, FT_ABS( discriminant ) ) > FT_ABS( dotproduct ) ) { - val = OVERFLOW_ADD_LONG( FT_MulDiv( dx, -dby, 0x40 ), - FT_MulDiv( dy, dbx, 0x40 ) ); + val = ADD_LONG( FT_MulDiv( dx, -dby, 0x40 ), + FT_MulDiv( dy, dbx, 0x40 ) ); R.x = FT_MulDiv( val, dax, discriminant ); R.y = FT_MulDiv( val, day, discriminant ); /* XXX: Block in backward_compatibility and/or post-IUP? */ - exc->zp2.cur[point].x = OVERFLOW_ADD_LONG( exc->zp1.cur[a0].x, R.x ); - exc->zp2.cur[point].y = OVERFLOW_ADD_LONG( exc->zp1.cur[a0].y, R.y ); + exc->zp2.cur[point].x = ADD_LONG( exc->zp1.cur[a0].x, R.x ); + exc->zp2.cur[point].y = ADD_LONG( exc->zp1.cur[a0].y, R.y ); } else { @@ -6500,15 +6502,11 @@ /* XXX: Block in backward_compatibility and/or post-IUP? */ exc->zp2.cur[point].x = - OVERFLOW_ADD_LONG( OVERFLOW_ADD_LONG( exc->zp1.cur[a0].x, - exc->zp1.cur[a1].x ), - OVERFLOW_ADD_LONG( exc->zp0.cur[b0].x, - exc->zp0.cur[b1].x ) ) / 4; + ADD_LONG( ADD_LONG( exc->zp1.cur[a0].x, exc->zp1.cur[a1].x ), + ADD_LONG( exc->zp0.cur[b0].x, exc->zp0.cur[b1].x ) ) / 4; exc->zp2.cur[point].y = - OVERFLOW_ADD_LONG( OVERFLOW_ADD_LONG( exc->zp1.cur[a0].y, - exc->zp1.cur[a1].y ), - OVERFLOW_ADD_LONG( exc->zp0.cur[b0].y, - exc->zp0.cur[b1].y ) ) / 4; + ADD_LONG( ADD_LONG( exc->zp1.cur[a0].y, exc->zp1.cur[a1].y ), + ADD_LONG( exc->zp0.cur[b0].y, exc->zp0.cur[b1].y ) ) / 4; } exc->zp2.tags[point] |= FT_CURVE_TAG_TOUCH_BOTH; From faf34d29e222598a392ad65858813d161ebd50ac Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Fri, 9 Jun 2017 20:31:24 +0200 Subject: [PATCH 137/470] Remove unused macros. * include/freetype/internal/ftcalc.h (ADD_INT, SUB_INT, MUL_INT, NEG_INT): Deleted. --- ChangeLog | 7 +++++++ include/freetype/internal/ftcalc.h | 9 --------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8c19a0fe2..cd3786db7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2017-06-09 Werner Lemberg + + Remove unused macros. + + * include/freetype/internal/ftcalc.h (ADD_INT, SUB_INT, MUL_INT, + NEG_INT): Deleted. + 2017-06-09 Werner Lemberg */*: Remove `OVERFLOW_' prefix. diff --git a/include/freetype/internal/ftcalc.h b/include/freetype/internal/ftcalc.h index 524096d41..d93a05488 100644 --- a/include/freetype/internal/ftcalc.h +++ b/include/freetype/internal/ftcalc.h @@ -417,15 +417,6 @@ FT_BEGIN_HEADER * * Use with care! */ -#define ADD_INT( a, b ) \ - (FT_Int)( (FT_UInt)(a) + (FT_UInt)(b) ) -#define SUB_INT( a, b ) \ - (FT_Int)( (FT_UInt)(a) - (FT_UInt)(b) ) -#define MUL_INT( a, b ) \ - (FT_Int)( (FT_UInt)(a) * (FT_UInt)(b) ) -#define NEG_INT( a ) \ - (FT_Int)( -(FT_UInt)(a) ) - #define ADD_LONG( a, b ) \ (FT_Long)( (FT_ULong)(a) + (FT_ULong)(b) ) #define SUB_LONG( a, b ) \ From 96d26926d1f36ce3feb1d16dfa6f0bfdf6297ec6 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Fri, 9 Jun 2017 20:34:28 +0200 Subject: [PATCH 138/470] Provide more macros for flooring, ceiling, and rounding. These versions don't produce run-time errors due to integer overflow. * include/freetype/internal/ftobjs.h: Include FT_INTERNAL_CALC_H. (FT_PAD_ROUND_LONG, FT_PAD_CEIL_LONG, FT_PIX_ROUND_LONG, FT_PIX_CEIL_LONG): New macros. (FT_PAD_ROUND_INT32, FT_PAD_CEIL_INT32, FT_PIX_ROUND_INT32, FT_PIX_CEIL_INT32): New macros. --- ChangeLog | 13 +++++++++++++ include/freetype/internal/ftobjs.h | 21 +++++++++++++++++++-- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index cd3786db7..494d11f0f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2017-06-09 Werner Lemberg + + Provide more macros for flooring, ceiling, and rounding. + + These versions don't produce run-time errors due to integer + overflow. + + * include/freetype/internal/ftobjs.h: Include FT_INTERNAL_CALC_H. + (FT_PAD_ROUND_LONG, FT_PAD_CEIL_LONG, FT_PIX_ROUND_LONG, + FT_PIX_CEIL_LONG): New macros. + (FT_PAD_ROUND_INT32, FT_PAD_CEIL_INT32, FT_PIX_ROUND_INT32, + FT_PIX_CEIL_INT32): New macros. + 2017-06-09 Werner Lemberg Remove unused macros. diff --git a/include/freetype/internal/ftobjs.h b/include/freetype/internal/ftobjs.h index 73961b95f..4231be238 100644 --- a/include/freetype/internal/ftobjs.h +++ b/include/freetype/internal/ftobjs.h @@ -36,6 +36,7 @@ #include FT_INTERNAL_AUTOHINT_H #include FT_INTERNAL_SERVICE_H #include FT_INTERNAL_PIC_H +#include FT_INTERNAL_CALC_H #ifdef FT_CONFIG_OPTION_INCREMENTAL #include FT_INCREMENTAL_H @@ -85,13 +86,29 @@ FT_BEGIN_HEADER /* we use FT_TYPEOF to suppress signedness compilation warnings */ #define FT_PAD_FLOOR( x, n ) ( (x) & ~FT_TYPEOF( x )( (n)-1 ) ) -#define FT_PAD_ROUND( x, n ) FT_PAD_FLOOR( (x) + ((n)/2), n ) -#define FT_PAD_CEIL( x, n ) FT_PAD_FLOOR( (x) + ((n)-1), n ) +#define FT_PAD_ROUND( x, n ) FT_PAD_FLOOR( (x) + (n)/2, n ) +#define FT_PAD_CEIL( x, n ) FT_PAD_FLOOR( (x) + (n)-1, n ) #define FT_PIX_FLOOR( x ) ( (x) & ~FT_TYPEOF( x )63 ) #define FT_PIX_ROUND( x ) FT_PIX_FLOOR( (x) + 32 ) #define FT_PIX_CEIL( x ) FT_PIX_FLOOR( (x) + 63 ) + /* specialized versions (for signed values) */ + /* that don't produce run-time errors due to integer overflow */ +#define FT_PAD_ROUND_LONG( x, n ) FT_PAD_FLOOR( ADD_LONG( (x), (n) / 2 ), \ + n ) +#define FT_PAD_CEIL_LONG( x, n ) FT_PAD_FLOOR( ADD_LONG( (x), (n) - 1 ), \ + n ) +#define FT_PIX_ROUND_LONG( x ) FT_PIX_FLOOR( ADD_LONG( (x), 32 ) ) +#define FT_PIX_CEIL_LONG( x ) FT_PIX_FLOOR( ADD_LONG( (x), 63 ) ) + +#define FT_PAD_ROUND_INT32( x, n ) FT_PAD_FLOOR( ADD_INT32( (x), (n) / 2 ), \ + n ) +#define FT_PAD_CEIL_INT32( x, n ) FT_PAD_FLOOR( ADD_INT32( (x), (n) - 1 ), \ + n ) +#define FT_PIX_ROUND_INT32( x ) FT_PIX_FLOOR( ADD_INT32( (x), 32 ) ) +#define FT_PIX_CEIL_INT32( x ) FT_PIX_FLOOR( ADD_INT32( (x), 63 ) ) + /* * character classification functions -- since these are used to parse From 9038837ee23460ce98715fe0f68497e7dcb69174 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Fri, 9 Jun 2017 20:42:46 +0200 Subject: [PATCH 139/470] [cff, truetype] Integer overflows. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2144 https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2151 https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2153 https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2173 https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2186 * src/cff/cf2blues.c (cf2_blues_init): Use SUB_INT32. * src/truetype/ttinterp.c (Round_None, Round_To_Grid, Round_To_Half_Grid, Round_Down_To_Grid, Round_Up_To_Grid, Round_To_Double_Grid, Round_Super, Round_Super_45): Use ADD_LONG, SUB_LONG, NEG_LONG, FT_PIX_ROUND_LONG, FT_PIX_CEIL_LONG, FT_PAD_ROUND_LONG (Ins_SxVTL, Ins_MIRP): Use SUB_LONG. (_iup_worker_shift): Use SUB_LONG and ADD_LONG. --- ChangeLog | 22 +++++++++++++++ src/cff/cf2blues.c | 4 +-- src/truetype/ttinterp.c | 61 +++++++++++++++++++++++++---------------- 3 files changed, 61 insertions(+), 26 deletions(-) diff --git a/ChangeLog b/ChangeLog index 494d11f0f..3c4662490 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,25 @@ +2017-06-09 Werner Lemberg + + [cff, truetype] Integer overflows. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2144 + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2151 + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2153 + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2173 + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2186 + + * src/cff/cf2blues.c (cf2_blues_init): Use SUB_INT32. + + * src/truetype/ttinterp.c (Round_None, Round_To_Grid, + Round_To_Half_Grid, Round_Down_To_Grid, Round_Up_To_Grid, + Round_To_Double_Grid, Round_Super, Round_Super_45): Use ADD_LONG, + SUB_LONG, NEG_LONG, FT_PIX_ROUND_LONG, FT_PIX_CEIL_LONG, + FT_PAD_ROUND_LONG + (Ins_SxVTL, Ins_MIRP): Use SUB_LONG. + (_iup_worker_shift): Use SUB_LONG and ADD_LONG. + 2017-06-09 Werner Lemberg Provide more macros for flooring, ceiling, and rounding. diff --git a/src/cff/cf2blues.c b/src/cff/cf2blues.c index a22a2e88c..5ba5f9ceb 100644 --- a/src/cff/cf2blues.c +++ b/src/cff/cf2blues.c @@ -243,8 +243,8 @@ blues->zone[blues->count].csTopEdge = cf2_blueToFixed( otherBlues[i + 1] ); - zoneHeight = blues->zone[blues->count].csTopEdge - - blues->zone[blues->count].csBottomEdge; + zoneHeight = SUB_INT32( blues->zone[blues->count].csTopEdge, + blues->zone[blues->count].csBottomEdge ); if ( zoneHeight < 0 ) { diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c index 28c1d3aa7..e527dfdf4 100644 --- a/src/truetype/ttinterp.c +++ b/src/truetype/ttinterp.c @@ -1895,13 +1895,13 @@ if ( distance >= 0 ) { - val = distance + compensation; + val = ADD_LONG( distance, compensation ); if ( val < 0 ) val = 0; } else { - val = distance - compensation; + val = SUB_LONG( distance, compensation ); if ( val > 0 ) val = 0; } @@ -1937,13 +1937,14 @@ if ( distance >= 0 ) { - val = FT_PIX_ROUND( distance + compensation ); + val = FT_PIX_ROUND_LONG( ADD_LONG( distance, compensation ) ); if ( val < 0 ) val = 0; } else { - val = -FT_PIX_ROUND( compensation - distance ); + val = NEG_LONG( FT_PIX_ROUND_LONG( SUB_LONG( compensation, + distance ) ) ); if ( val > 0 ) val = 0; } @@ -1980,13 +1981,16 @@ if ( distance >= 0 ) { - val = FT_PIX_FLOOR( distance + compensation ) + 32; + val = ADD_LONG( FT_PIX_FLOOR( ADD_LONG( distance, compensation ) ), + 32 ); if ( val < 0 ) val = 32; } else { - val = -( FT_PIX_FLOOR( compensation - distance ) + 32 ); + val = NEG_LONG( ADD_LONG( FT_PIX_FLOOR( SUB_LONG( compensation, + distance ) ), + 32 ) ); if ( val > 0 ) val = -32; } @@ -2023,13 +2027,13 @@ if ( distance >= 0 ) { - val = FT_PIX_FLOOR( distance + compensation ); + val = FT_PIX_FLOOR( ADD_LONG( distance, compensation ) ); if ( val < 0 ) val = 0; } else { - val = -FT_PIX_FLOOR( compensation - distance ); + val = NEG_LONG( FT_PIX_FLOOR( SUB_LONG( compensation, distance ) ) ); if ( val > 0 ) val = 0; } @@ -2066,13 +2070,14 @@ if ( distance >= 0 ) { - val = FT_PIX_CEIL( distance + compensation ); + val = FT_PIX_CEIL_LONG( ADD_LONG( distance, compensation ) ); if ( val < 0 ) val = 0; } else { - val = -FT_PIX_CEIL( compensation - distance ); + val = NEG_LONG( FT_PIX_CEIL_LONG( SUB_LONG( compensation, + distance ) ) ); if ( val > 0 ) val = 0; } @@ -2109,13 +2114,14 @@ if ( distance >= 0 ) { - val = FT_PAD_ROUND( distance + compensation, 32 ); + val = FT_PAD_ROUND_LONG( ADD_LONG( distance, compensation ), 32 ); if ( val < 0 ) val = 0; } else { - val = -FT_PAD_ROUND( compensation - distance, 32 ); + val = NEG_LONG( FT_PAD_ROUND_LONG( SUB_LONG( compensation, distance ), + 32 ) ); if ( val > 0 ) val = 0; } @@ -2156,7 +2162,8 @@ if ( distance >= 0 ) { - val = ( distance - exc->phase + exc->threshold + compensation ) & + val = ADD_LONG( distance, + exc->threshold - exc->phase + compensation ) & -exc->period; val += exc->phase; if ( val < 0 ) @@ -2164,8 +2171,9 @@ } else { - val = -( ( exc->threshold - exc->phase - distance + compensation ) & - -exc->period ); + val = NEG_LONG( SUB_LONG( exc->threshold - exc->phase + compensation, + distance ) & + -exc->period ); val -= exc->phase; if ( val > 0 ) val = -exc->phase; @@ -2205,7 +2213,8 @@ if ( distance >= 0 ) { - val = ( ( distance - exc->phase + exc->threshold + compensation ) / + val = ( ADD_LONG( distance, + exc->threshold - exc->phase + compensation ) / exc->period ) * exc->period; val += exc->phase; if ( val < 0 ) @@ -2213,8 +2222,9 @@ } else { - val = -( ( ( exc->threshold - exc->phase - distance + compensation ) / - exc->period ) * exc->period ); + val = NEG_LONG( ( SUB_LONG( exc->threshold - exc->phase + compensation, + distance ) / + exc->period ) * exc->period ); val -= exc->phase; if ( val > 0 ) val = -exc->phase; @@ -4233,8 +4243,8 @@ p1 = exc->zp1.cur + aIdx2; p2 = exc->zp2.cur + aIdx1; - A = p1->x - p2->x; - B = p1->y - p2->y; + A = SUB_LONG( p1->x, p2->x ); + B = SUB_LONG( p1->y, p2->y ); /* If p1 == p2, SPvTL and SFvTL behave the same as */ /* SPvTCA[X] and SFvTCA[X], respectively. */ @@ -6315,7 +6325,10 @@ } #endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */ - exc->func_move( exc, &exc->zp1, point, distance - cur_dist ); + exc->func_move( exc, + &exc->zp1, + point, + SUB_LONG( distance, cur_dist ) ); #ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY if ( SUBPIXEL_HINTING_INFINALITY ) @@ -6757,14 +6770,14 @@ FT_F26Dot6 dx; - dx = worker->curs[p].x - worker->orgs[p].x; + dx = SUB_LONG( worker->curs[p].x, worker->orgs[p].x ); if ( dx != 0 ) { for ( i = p1; i < p; i++ ) - worker->curs[i].x += dx; + worker->curs[i].x = ADD_LONG( worker->curs[i].x, dx ); for ( i = p + 1; i <= p2; i++ ) - worker->curs[i].x += dx; + worker->curs[i].x = ADD_LONG( worker->curs[i].x, dx ); } } From 2c4fba9c91d31cacd7db3a684acee34276c8b5b5 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sat, 10 Jun 2017 11:03:41 +0200 Subject: [PATCH 140/470] * src/base/ftcalc.c (FT_DivFix): Fix embarrassing typo. Bug introduced 2017-05-28. --- ChangeLog | 6 ++++++ src/base/ftcalc.c | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 3c4662490..49ed49505 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2017-06-10 Werner Lemberg + + * src/base/ftcalc.c (FT_DivFix): Fix embarrassing typo. + + Bug introduced 2017-05-28. + 2017-06-09 Werner Lemberg [cff, truetype] Integer overflows. diff --git a/src/base/ftcalc.c b/src/base/ftcalc.c index 9e42d784d..cb10612d4 100644 --- a/src/base/ftcalc.c +++ b/src/base/ftcalc.c @@ -262,7 +262,7 @@ b = (FT_UInt64)b_; FT_MOVE_SIGN( a_, a, s ); - FT_MOVE_SIGN( b_, a, s ); + FT_MOVE_SIGN( b_, b, s ); q = b > 0 ? ( ( a << 16 ) + ( b >> 1 ) ) / b : 0x7FFFFFFFUL; From 5f2a72cbc716703cd1e38f21e4cc52624a819e18 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sat, 10 Jun 2017 11:29:24 +0200 Subject: [PATCH 141/470] [truetype] Fix TT_Set_Var_Design. Reported by Nikolaus Waxweiler . * src/truetype/ttgxvar.c (TT_Set_Var_Design): Correctly handle the case where we have less input coordinates than axes. --- ChangeLog | 9 +++++++++ src/truetype/ttgxvar.c | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 49ed49505..e6441ffeb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2017-06-10 Werner Lemberg + + [truetype] Fix TT_Set_Var_Design. + + Reported by Nikolaus Waxweiler . + + * src/truetype/ttgxvar.c (TT_Set_Var_Design): Correctly handle the + case where we have less input coordinates than axes. + 2017-06-10 Werner Lemberg * src/base/ftcalc.c (FT_DivFix): Fix embarrassing typo. diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c index 16a2e56ba..f2049796d 100644 --- a/src/truetype/ttgxvar.c +++ b/src/truetype/ttgxvar.c @@ -2640,7 +2640,7 @@ num_coords * sizeof ( FT_Fixed ) ); a = mmvar->axis + num_coords; - c = coords + num_coords; + c = blend->coords + num_coords; for ( i = num_coords; i < mmvar->num_axis; i++, a++, c++ ) *c = a->def; @@ -2650,7 +2650,7 @@ if ( !face->blend->avar_loaded ) ft_var_load_avar( face ); - ft_var_to_normalized( face, num_coords, coords, normalized ); + ft_var_to_normalized( face, num_coords, blend->coords, normalized ); error = tt_set_mm_blend( face, mmvar->num_axis, normalized, 0 ); From 3ed3a96181625286f5899118f884fb4b125ebda2 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sun, 11 Jun 2017 13:50:37 +0200 Subject: [PATCH 142/470] [cff] Integer overflows. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2200 https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2210 * src/cff/cf2hints.c (cf2_hintmap_insertHint): Use SUB_INT32 and ADD_INT32. * src/cff/cf2intrp.c (cf2_interpT2CharString) : Use ADD_INT32. --- ChangeLog | 15 +++++++++++++++ src/cff/cf2hints.c | 6 +++--- src/cff/cf2intrp.c | 3 ++- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index e6441ffeb..ef882374a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2017-06-11 Werner Lemberg + + [cff] Integer overflows. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2200 + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2210 + + * src/cff/cf2hints.c (cf2_hintmap_insertHint): Use SUB_INT32 and + ADD_INT32. + + * src/cff/cf2intrp.c (cf2_interpT2CharString) : Use + ADD_INT32. + 2017-06-10 Werner Lemberg [truetype] Fix TT_Set_Var_Design. diff --git a/src/cff/cf2hints.c b/src/cff/cf2hints.c index 9643bd470..0951e1e7a 100644 --- a/src/cff/cf2hints.c +++ b/src/cff/cf2hints.c @@ -651,8 +651,8 @@ hintmap->scale ); - firstHintEdge->dsCoord = midpoint - halfWidth; - secondHintEdge->dsCoord = midpoint + halfWidth; + firstHintEdge->dsCoord = SUB_INT32( midpoint, halfWidth ); + secondHintEdge->dsCoord = ADD_INT32( midpoint, halfWidth ); } else firstHintEdge->dsCoord = cf2_hintmap_map( hintmap->initialHintMap, @@ -721,7 +721,7 @@ /* insert first edge */ hintmap->edge[indexInsert] = *firstHintEdge; /* copy struct */ - hintmap->count += 1; + hintmap->count += 1; if ( isPair ) { diff --git a/src/cff/cf2intrp.c b/src/cff/cf2intrp.c index a43d33ecd..a81628074 100644 --- a/src/cff/cf2intrp.c +++ b/src/cff/cf2intrp.c @@ -768,7 +768,8 @@ FT_TRACE4(( " vmoveto\n" )); if ( cf2_stack_count( opStack ) > 1 && !haveWidth ) - *width = cf2_stack_getReal( opStack, 0 ) + nominalWidthX; + *width = ADD_INT32( cf2_stack_getReal( opStack, 0 ), + nominalWidthX ); /* width is defined or default after this */ haveWidth = TRUE; From 5c402d97afcc98cbb8d8e049409533f747c4c514 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Tue, 13 Jun 2017 06:56:48 +0200 Subject: [PATCH 143/470] [cff, truetype] Integer overflows. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2216 https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2218 * src/cff/cf2fixed.h (cf2_fixedAbs): Use NEG_INT32. * src/truetype/ttinterp.c (Ins_IP): Use SUB_LONG. --- ChangeLog | 13 +++++++++++++ src/cff/cf2fixed.h | 2 +- src/truetype/ttinterp.c | 14 +++++++++----- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index ef882374a..fe0f79507 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2017-06-13 Werner Lemberg + + [cff, truetype] Integer overflows. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2216 + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2218 + + * src/cff/cf2fixed.h (cf2_fixedAbs): Use NEG_INT32. + + * src/truetype/ttinterp.c (Ins_IP): Use SUB_LONG. + 2017-06-11 Werner Lemberg [cff] Integer overflows. diff --git a/src/cff/cf2fixed.h b/src/cff/cf2fixed.h index d8e695b15..a041184bd 100644 --- a/src/cff/cf2fixed.h +++ b/src/cff/cf2fixed.h @@ -66,7 +66,7 @@ FT_BEGIN_HEADER #define cf2_doubleToFixed( f ) \ ( (CF2_Fixed)( (f) * 65536.0 + 0.5 ) ) #define cf2_fixedAbs( x ) \ - ( (x) < 0 ? -(x) : (x) ) + ( (x) < 0 ? NEG_INT32( x ) : (x) ) #define cf2_fixedFloor( x ) \ ( (CF2_Fixed)( (FT_UInt32)(x) & 0xFFFF0000UL ) ) #define cf2_fixedFraction( x ) \ diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c index e527dfdf4..4e1167afb 100644 --- a/src/truetype/ttinterp.c +++ b/src/truetype/ttinterp.c @@ -6627,9 +6627,11 @@ FT_Vector vec; - vec.x = FT_MulFix( exc->zp1.orus[exc->GS.rp2].x - orus_base->x, + vec.x = FT_MulFix( SUB_LONG( exc->zp1.orus[exc->GS.rp2].x, + orus_base->x ), exc->metrics.x_scale ); - vec.y = FT_MulFix( exc->zp1.orus[exc->GS.rp2].y - orus_base->y, + vec.y = FT_MulFix( SUB_LONG( exc->zp1.orus[exc->GS.rp2].y, + orus_base->y ), exc->metrics.y_scale ); old_range = FAST_DUALPROJ( &vec ); @@ -6664,9 +6666,11 @@ FT_Vector vec; - vec.x = FT_MulFix( exc->zp2.orus[point].x - orus_base->x, + vec.x = FT_MulFix( SUB_LONG( exc->zp2.orus[point].x, + orus_base->x ), exc->metrics.x_scale ); - vec.y = FT_MulFix( exc->zp2.orus[point].y - orus_base->y, + vec.y = FT_MulFix( SUB_LONG( exc->zp2.orus[point].y, + orus_base->y ), exc->metrics.y_scale ); org_dist = FAST_DUALPROJ( &vec ); @@ -6705,7 +6709,7 @@ exc->func_move( exc, &exc->zp2, (FT_UShort)point, - new_dist - cur_dist ); + SUB_LONG( new_dist, cur_dist ) ); } Fail: From 79e3789f81e14266578e71196ce71ecf5381d142 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Wed, 14 Jun 2017 07:51:04 +0200 Subject: [PATCH 144/470] * src/winfonts/winfnt.c (FNT_Face_Init): Don't set active encoding. FreeType only sets a default active encoding for Unicode. --- ChangeLog | 6 ++++++ include/freetype/freetype.h | 3 ++- src/bdf/bdfdrivr.c | 6 ------ src/pcf/pcfdrivr.c | 6 ------ src/pfr/pfrobjs.c | 6 ------ src/sfnt/sfobjs.c | 9 --------- src/type1/t1objs.c | 6 ------ src/type42/t42objs.c | 6 ------ src/winfonts/winfnt.c | 4 ---- 9 files changed, 8 insertions(+), 44 deletions(-) diff --git a/ChangeLog b/ChangeLog index fe0f79507..74dc50f1b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2017-06-13 Werner Lemberg + + * src/winfonts/winfnt.c (FNT_Face_Init): Don't set active encoding. + + FreeType only sets a default active encoding for Unicode. + 2017-06-13 Werner Lemberg [cff, truetype] Integer overflows. diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h index bd7f6a3fb..bb59d0901 100644 --- a/include/freetype/freetype.h +++ b/include/freetype/freetype.h @@ -575,7 +575,8 @@ FT_BEGIN_HEADER /* */ /* When a new face is created (either through @FT_New_Face or */ /* @FT_Open_Face), the library looks for a Unicode charmap within */ - /* the list and automatically activates it. */ + /* the list and automatically activates it. If there is no Unicode */ + /* charmap, FreeType doesn't set an `active' charmap. */ /* */ /* */ /* See @FT_CharMapRec for the publicly accessible fields of a given */ diff --git a/src/bdf/bdfdrivr.c b/src/bdf/bdfdrivr.c index c7b9b4111..09cb489d2 100644 --- a/src/bdf/bdfdrivr.c +++ b/src/bdf/bdfdrivr.c @@ -658,12 +658,6 @@ THE SOFTWARE. } error = FT_CMap_New( &bdf_cmap_class, NULL, &charmap, NULL ); - -#if 0 - /* Select default charmap */ - if ( bdfface->num_charmaps ) - bdfface->charmap = bdfface->charmaps[0]; -#endif } goto Exit; diff --git a/src/pcf/pcfdrivr.c b/src/pcf/pcfdrivr.c index 505309416..169f75e95 100644 --- a/src/pcf/pcfdrivr.c +++ b/src/pcf/pcfdrivr.c @@ -413,12 +413,6 @@ THE SOFTWARE. } error = FT_CMap_New( &pcf_cmap_class, NULL, &charmap, NULL ); - -#if 0 - /* Select default charmap */ - if ( pcfface->num_charmaps ) - pcfface->charmap = pcfface->charmaps[0]; -#endif } } diff --git a/src/pfr/pfrobjs.c b/src/pfr/pfrobjs.c index 4b1703f51..514af8050 100644 --- a/src/pfr/pfrobjs.c +++ b/src/pfr/pfrobjs.c @@ -264,12 +264,6 @@ charmap.encoding = FT_ENCODING_UNICODE; error = FT_CMap_New( &pfr_cmap_class_rec, NULL, &charmap, NULL ); - -#if 0 - /* select default charmap */ - if ( pfrface->num_charmaps ) - pfrface->charmap = pfrface->charmaps[0]; -#endif } /* check whether we have loaded any kerning pairs */ diff --git a/src/sfnt/sfobjs.c b/src/sfnt/sfobjs.c index ac2e620e5..3f54d5d5c 100644 --- a/src/sfnt/sfobjs.c +++ b/src/sfnt/sfobjs.c @@ -1482,15 +1482,6 @@ charmap->encoding = sfnt_find_encoding( charmap->platform_id, charmap->encoding_id ); - -#if 0 - if ( !root->charmap && - charmap->encoding == FT_ENCODING_UNICODE ) - { - /* set 'root->charmap' to the first Unicode encoding we find */ - root->charmap = charmap; - } -#endif } } diff --git a/src/type1/t1objs.c b/src/type1/t1objs.c index 97c16b0fd..5ac1292ae 100644 --- a/src/type1/t1objs.c +++ b/src/type1/t1objs.c @@ -555,12 +555,6 @@ if ( clazz ) error = FT_CMap_New( clazz, NULL, &charmap, NULL ); - -#if 0 - /* Select default charmap */ - if (root->num_charmaps) - root->charmap = root->charmaps[0]; -#endif } } diff --git a/src/type42/t42objs.c b/src/type42/t42objs.c index 87e5206b7..1c4ebd768 100644 --- a/src/type42/t42objs.c +++ b/src/type42/t42objs.c @@ -394,12 +394,6 @@ if ( clazz ) error = FT_CMap_New( clazz, NULL, &charmap, NULL ); - -#if 0 - /* Select default charmap */ - if ( root->num_charmaps ) - root->charmap = root->charmaps[0]; -#endif } } Exit: diff --git a/src/winfonts/winfnt.c b/src/winfonts/winfnt.c index 9811fbb05..5cdb85a36 100644 --- a/src/winfonts/winfnt.c +++ b/src/winfonts/winfnt.c @@ -859,10 +859,6 @@ NULL ); if ( error ) goto Fail; - - /* Select default charmap */ - if ( root->num_charmaps ) - root->charmap = root->charmaps[0]; } /* set up remaining flags */ From dbeb7bce7f76cdd786ce4022e0b45a653f68db5d Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Thu, 15 Jun 2017 19:39:50 +0200 Subject: [PATCH 145/470] [bdf, cff] Integer overflows. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2244 https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2261 * src/bdf/bdfdrivr.c (BDF_Face_Init): Replace calls to FT_ABS with direct code to avoid value negation. * src/cff/cf2blues.c (cf2_blues_capture): Use SUB_INT32 and ADD_INT32. --- ChangeLog | 15 +++++++++++++++ src/bdf/bdfdrivr.c | 16 +++++++++------- src/cff/cf2blues.c | 12 ++++++------ 3 files changed, 30 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 74dc50f1b..e4a4db9ee 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2017-06-15 Werner Lemberg + + [bdf, cff] Integer overflows. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2244 + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2261 + + * src/bdf/bdfdrivr.c (BDF_Face_Init): Replace calls to FT_ABS with + direct code to avoid value negation. + + * src/cff/cf2blues.c (cf2_blues_capture): Use SUB_INT32 and + ADD_INT32. + 2017-06-13 Werner Lemberg * src/winfonts/winfnt.c (FNT_Face_Init): Don't set active encoding. diff --git a/src/bdf/bdfdrivr.c b/src/bdf/bdfdrivr.c index 09cb489d2..37e6eea1c 100644 --- a/src/bdf/bdfdrivr.c +++ b/src/bdf/bdfdrivr.c @@ -442,13 +442,13 @@ THE SOFTWARE. FT_ZERO( bsize ); /* sanity checks */ - if ( FT_ABS( font->font_ascent ) > 0x7FFF ) + if ( font->font_ascent > 0x7FFF || font->font_ascent < -0x7FFF ) { font->font_ascent = font->font_ascent < 0 ? -0x7FFF : 0x7FFF; FT_TRACE0(( "BDF_Face_Init: clamping font ascent to value %d\n", font->font_ascent )); } - if ( FT_ABS( font->font_descent ) > 0x7FFF ) + if ( font->font_descent > 0x7FFF || font->font_descent < -0x7FFF ) { font->font_descent = font->font_descent < 0 ? -0x7FFF : 0x7FFF; FT_TRACE0(( "BDF_Face_Init: clamping font descent to value %d\n", @@ -464,7 +464,8 @@ THE SOFTWARE. if ( prop->value.l < 0 ) FT_TRACE0(( "BDF_Face_Init: negative average width\n" )); #endif - if ( ( FT_ABS( prop->value.l ) > 0x7FFFL * 10 - 5 ) ) + if ( prop->value.l > 0x7FFFL * 10 - 5 || + prop->value.l < -( 0x7FFFL * 10 - 5 ) ) { bsize->width = 0x7FFF; FT_TRACE0(( "BDF_Face_Init: clamping average width to value %d\n", @@ -487,7 +488,8 @@ THE SOFTWARE. FT_TRACE0(( "BDF_Face_Init: negative point size\n" )); #endif /* convert from 722.7 decipoints to 72 points per inch */ - if ( FT_ABS( prop->value.l ) > 0x504C2L ) /* 0x7FFF * 72270/7200 */ + if ( prop->value.l > 0x504C2L || /* 0x7FFF * 72270/7200 */ + prop->value.l < -0x504C2L ) { bsize->size = 0x7FFF; FT_TRACE0(( "BDF_Face_Init: clamping point size to value %d\n", @@ -511,7 +513,7 @@ THE SOFTWARE. if ( prop->value.l < 0 ) FT_TRACE0(( "BDF_Face_Init: negative pixel size\n" )); #endif - if ( FT_ABS( prop->value.l ) > 0x7FFF ) + if ( prop->value.l > 0x7FFF || prop->value.l < -0x7FFF ) { bsize->y_ppem = 0x7FFF << 6; FT_TRACE0(( "BDF_Face_Init: clamping pixel size to value %d\n", @@ -528,7 +530,7 @@ THE SOFTWARE. if ( prop->value.l < 0 ) FT_TRACE0(( "BDF_Face_Init: negative X resolution\n" )); #endif - if ( FT_ABS( prop->value.l ) > 0x7FFF ) + if ( prop->value.l > 0x7FFF || prop->value.l < -0x7FFF ) { resolution_x = 0x7FFF; FT_TRACE0(( "BDF_Face_Init: clamping X resolution to value %d\n", @@ -545,7 +547,7 @@ THE SOFTWARE. if ( prop->value.l < 0 ) FT_TRACE0(( "BDF_Face_Init: negative Y resolution\n" )); #endif - if ( FT_ABS( prop->value.l ) > 0x7FFF ) + if ( prop->value.l > 0x7FFF || prop->value.l < -0x7FFF ) { resolution_y = 0x7FFF; FT_TRACE0(( "BDF_Face_Init: clamping Y resolution to value %d\n", diff --git a/src/cff/cf2blues.c b/src/cff/cf2blues.c index 5ba5f9ceb..f5b44b21c 100644 --- a/src/cff/cf2blues.c +++ b/src/cff/cf2blues.c @@ -489,10 +489,10 @@ if ( blues->zone[i].bottomZone && cf2_hint_isBottom( bottomHintEdge ) ) { - if ( ( blues->zone[i].csBottomEdge - csFuzz ) <= - bottomHintEdge->csCoord && + if ( SUB_INT32( blues->zone[i].csBottomEdge, csFuzz ) <= + bottomHintEdge->csCoord && bottomHintEdge->csCoord <= - ( blues->zone[i].csTopEdge + csFuzz ) ) + ADD_INT32( blues->zone[i].csTopEdge, csFuzz ) ) { /* bottom edge captured by bottom zone */ @@ -524,10 +524,10 @@ if ( !blues->zone[i].bottomZone && cf2_hint_isTop( topHintEdge ) ) { - if ( ( blues->zone[i].csBottomEdge - csFuzz ) <= - topHintEdge->csCoord && + if ( ( SUB_INT32( blues->zone[i].csBottomEdge, csFuzz ) ) <= + topHintEdge->csCoord && topHintEdge->csCoord <= - ( blues->zone[i].csTopEdge + csFuzz ) ) + ADD_INT32( blues->zone[i].csTopEdge, csFuzz ) ) { /* top edge captured by top zone */ From 4dc00cf5c045074c5a324a1c87d166ba1ad728c3 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Fri, 16 Jun 2017 13:33:09 +0200 Subject: [PATCH 146/470] [truetype] Integer overflows. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2270 https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2278 * src/truetype/ttinterp.c (Ins_MDRP, _iup_worker_interpolate): Use ADD_LONG and SUB_LONG. --- ChangeLog | 12 ++++++++++++ src/truetype/ttinterp.c | 27 ++++++++++++++++----------- 2 files changed, 28 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index e4a4db9ee..90247f9ec 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2017-06-16 Werner Lemberg + + [truetype] Integer overflows. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2270 + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2278 + + * src/truetype/ttinterp.c (Ins_MDRP, _iup_worker_interpolate): Use + ADD_LONG and SUB_LONG. + 2017-06-15 Werner Lemberg [bdf, cff] Integer overflows. diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c index 4e1167afb..bf198f77c 100644 --- a/src/truetype/ttinterp.c +++ b/src/truetype/ttinterp.c @@ -6062,8 +6062,10 @@ FT_Vector vec; - vec.x = FT_MulFix( vec1->x - vec2->x, exc->metrics.x_scale ); - vec.y = FT_MulFix( vec1->y - vec2->y, exc->metrics.y_scale ); + vec.x = FT_MulFix( SUB_LONG( vec1->x, vec2->x ), + exc->metrics.x_scale ); + vec.y = FT_MulFix( SUB_LONG( vec1->y, vec2->y ), + exc->metrics.y_scale ); org_dist = FAST_DUALPROJ( &vec ); } @@ -6125,7 +6127,7 @@ org_dist = PROJECT( exc->zp1.cur + point, exc->zp0.cur + exc->GS.rp0 ); - exc->func_move( exc, &exc->zp1, point, distance - org_dist ); + exc->func_move( exc, &exc->zp1, point, SUB_LONG( distance, org_dist ) ); Fail: exc->GS.rp1 = exc->GS.rp0; @@ -6826,8 +6828,8 @@ org2 = worker->orgs[ref2].x; cur1 = worker->curs[ref1].x; cur2 = worker->curs[ref2].x; - delta1 = cur1 - org1; - delta2 = cur2 - org2; + delta1 = SUB_LONG( cur1, org1 ); + delta2 = SUB_LONG( cur2, org2 ); if ( cur1 == cur2 || orus1 == orus2 ) { @@ -6839,10 +6841,10 @@ if ( x <= org1 ) - x += delta1; + x = ADD_LONG( x, delta1 ); else if ( x >= org2 ) - x += delta2; + x = ADD_LONG( x, delta2 ); else x = cur1; @@ -6863,20 +6865,23 @@ if ( x <= org1 ) - x += delta1; + x = ADD_LONG( x, delta1 ); else if ( x >= org2 ) - x += delta2; + x = ADD_LONG( x, delta2 ); else { if ( !scale_valid ) { scale_valid = 1; - scale = FT_DivFix( cur2 - cur1, orus2 - orus1 ); + scale = FT_DivFix( SUB_LONG( cur2, cur1 ), + SUB_LONG( orus2, orus1 ) ); } - x = cur1 + FT_MulFix( worker->orus[i].x - orus1, scale ); + x = ADD_LONG( cur1, + FT_MulFix( SUB_LONG( worker->orus[i].x, orus1 ), + scale ) ); } worker->curs[i].x = x; } From 7b7278334cf3da01bb955f8ec0a33259a03dbb38 Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Sat, 17 Jun 2017 23:28:14 -0400 Subject: [PATCH 147/470] [base, smooth] LCD filtering cleanups. * src/base/ftlcdlil.c (ft_lcd_filter_fir, _ft_lcd_filter_legacy): Clean up, start filtering from the bottom-left origin. * src/smooth/ftsmooth.c (ft_smooth_render_generic): Updated. --- ChangeLog | 9 ++ src/base/ftlcdfil.c | 214 ++++++++++++++++++------------------------ src/smooth/ftsmooth.c | 6 +- 3 files changed, 104 insertions(+), 125 deletions(-) diff --git a/ChangeLog b/ChangeLog index 90247f9ec..b5069b1c1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2017-06-17 Alexei Podtelezhnikov + + [base, smooth] LCD filtering cleanups. + + * src/base/ftlcdlil.c (ft_lcd_filter_fir, _ft_lcd_filter_legacy): + Clean up, start filtering from the bottom-left origin. + + * src/smooth/ftsmooth.c (ft_smooth_render_generic): Updated. + 2017-06-16 Werner Lemberg [truetype] Integer overflows. diff --git a/src/base/ftlcdfil.c b/src/base/ftlcdfil.c index 65dbf342e..6d35e35cb 100644 --- a/src/base/ftlcdfil.c +++ b/src/base/ftlcdfil.c @@ -35,135 +35,113 @@ FT_Render_Mode mode, FT_LcdFiveTapFilter weights ) { - FT_UInt width = (FT_UInt)bitmap->width; - FT_UInt height = (FT_UInt)bitmap->rows; + FT_UInt width = (FT_UInt)bitmap->width; + FT_UInt height = (FT_UInt)bitmap->rows; + FT_Int pitch = bitmap->pitch; + FT_Byte* origin = bitmap->buffer; + /* take care of bitmap flow */ + if ( pitch > 0 ) + origin += pitch * (FT_Int)( height - 1 ); + /* horizontal in-place FIR filter */ - if ( mode == FT_RENDER_MODE_LCD && width >= 4 ) + if ( mode == FT_RENDER_MODE_LCD && width >= 2 ) { - FT_Byte* line = bitmap->buffer; - + FT_Byte* line = origin; - /* take care of bitmap flow */ - if ( bitmap->pitch < 0 ) - line -= bitmap->pitch * (FT_Int)( bitmap->rows - 1 ); - /* `fir' and `pix' must be at least 32 bit wide, since the sum of */ - /* the values in `weights' can exceed 0xFF */ + /* `fir' must be at least 32 bit wide, since the sum of */ + /* the values in `weights' can exceed 0xFF */ - for ( ; height > 0; height--, line += bitmap->pitch ) + for ( ; height > 0; height--, line -= pitch ) { - FT_UInt fir[4]; /* below, `pix' is used as the 5th element */ - FT_UInt val1, xx; + FT_UInt fir[5]; + FT_UInt val, xx; - val1 = line[0]; - fir[0] = weights[2] * val1; - fir[1] = weights[3] * val1; - fir[2] = weights[4] * val1; - fir[3] = 0; + val = line[0]; + fir[2] = weights[2] * val; + fir[3] = weights[3] * val; + fir[4] = weights[4] * val; - val1 = line[1]; - fir[0] += weights[1] * val1; - fir[1] += weights[2] * val1; - fir[2] += weights[3] * val1; - fir[3] += weights[4] * val1; + val = line[1]; + fir[1] = fir[2] + weights[1] * val; + fir[2] = fir[3] + weights[2] * val; + fir[3] = fir[4] + weights[3] * val; + fir[4] = weights[4] * val; for ( xx = 2; xx < width; xx++ ) { - FT_UInt val, pix; - - val = line[xx]; - pix = fir[0] + weights[0] * val; - fir[0] = fir[1] + weights[1] * val; - fir[1] = fir[2] + weights[2] * val; - fir[2] = fir[3] + weights[3] * val; - fir[3] = weights[4] * val; - - pix >>= 8; - pix |= (FT_UInt)-(FT_Int)( pix >> 8 ); - line[xx - 2] = (FT_Byte)pix; + fir[0] = fir[1] + weights[0] * val; + fir[1] = fir[2] + weights[1] * val; + fir[2] = fir[3] + weights[2] * val; + fir[3] = fir[4] + weights[3] * val; + fir[4] = weights[4] * val; + + fir[0] >>= 8; + fir[0] |= (FT_UInt)-(FT_Int)( fir[0] >> 8 ); + line[xx - 2] = (FT_Byte)fir[0]; } - { - FT_UInt pix; + fir[1] >>= 8; + fir[1] |= (FT_UInt)-(FT_Int)( fir[1] >> 8 ); + line[xx - 2] = (FT_Byte)fir[1]; - - pix = fir[0] >> 8; - pix |= (FT_UInt)-(FT_Int)( pix >> 8 ); - line[xx - 2] = (FT_Byte)pix; - - pix = fir[1] >> 8; - pix |= (FT_UInt)-(FT_Int)( pix >> 8 ); - line[xx - 1] = (FT_Byte)pix; - } + fir[2] >>= 8; + fir[2] |= (FT_UInt)-(FT_Int)( fir[2] >> 8 ); + line[xx - 1] = (FT_Byte)fir[2]; } } /* vertical in-place FIR filter */ - else if ( mode == FT_RENDER_MODE_LCD_V && height >= 4 ) + else if ( mode == FT_RENDER_MODE_LCD_V && height >= 2 ) { - FT_Byte* column = bitmap->buffer; - FT_Int pitch = bitmap->pitch; - + FT_Byte* column = origin; - /* take care of bitmap flow */ - if ( bitmap->pitch < 0 ) - column -= bitmap->pitch * (FT_Int)( bitmap->rows - 1 ); for ( ; width > 0; width--, column++ ) { FT_Byte* col = column; - FT_UInt fir[4]; /* below, `pix' is used as the 5th element */ - FT_UInt val1, yy; + FT_UInt fir[5]; + FT_UInt val, yy; - val1 = col[0]; - fir[0] = weights[2] * val1; - fir[1] = weights[3] * val1; - fir[2] = weights[4] * val1; - fir[3] = 0; - col += pitch; + val = col[0]; + fir[2] = weights[2] * val; + fir[3] = weights[3] * val; + fir[4] = weights[4] * val; + col -= pitch; - val1 = col[0]; - fir[0] += weights[1] * val1; - fir[1] += weights[2] * val1; - fir[2] += weights[3] * val1; - fir[3] += weights[4] * val1; - col += pitch; + val = col[0]; + fir[1] = fir[2] + weights[1] * val; + fir[2] = fir[3] + weights[2] * val; + fir[3] = fir[4] + weights[3] * val; + fir[4] = weights[4] * val; + col -= pitch; - for ( yy = 2; yy < height; yy++ ) + for ( yy = 2; yy < height; yy++, col -= pitch ) { - FT_UInt val, pix; - - val = col[0]; - pix = fir[0] + weights[0] * val; - fir[0] = fir[1] + weights[1] * val; - fir[1] = fir[2] + weights[2] * val; - fir[2] = fir[3] + weights[3] * val; - fir[3] = weights[4] * val; - - pix >>= 8; - pix |= (FT_UInt)-(FT_Int)( pix >> 8 ); - col[-2 * pitch] = (FT_Byte)pix; - col += pitch; + fir[0] = fir[1] + weights[0] * val; + fir[1] = fir[2] + weights[1] * val; + fir[2] = fir[3] + weights[2] * val; + fir[3] = fir[4] + weights[3] * val; + fir[4] = weights[4] * val; + + fir[0] >>= 8; + fir[0] |= (FT_UInt)-(FT_Int)( fir[0] >> 8 ); + col[pitch * 2] = (FT_Byte)fir[0]; } - { - FT_UInt pix; - - - pix = fir[0] >> 8; - pix |= (FT_UInt)-(FT_Int)( pix >> 8 ); - col[-2 * pitch] = (FT_Byte)pix; + fir[1] >>= 8; + fir[1] |= (FT_UInt)-(FT_Int)( fir[1] >> 8 ); + col[pitch * 2] = (FT_Byte)fir[1]; - pix = fir[1] >> 8; - pix |= (FT_UInt)-(FT_Int)( pix >> 8 ); - col[-pitch] = (FT_Byte)pix; - } + fir[2] >>= 8; + fir[2] |= (FT_UInt)-(FT_Int)( fir[2] >> 8 ); + col[pitch] = (FT_Byte)fir[2]; } } } @@ -177,9 +155,10 @@ FT_Render_Mode mode, FT_Byte* weights ) { - FT_UInt width = (FT_UInt)bitmap->width; - FT_UInt height = (FT_UInt)bitmap->rows; - FT_Int pitch = bitmap->pitch; + FT_UInt width = (FT_UInt)bitmap->width; + FT_UInt height = (FT_UInt)bitmap->rows; + FT_Int pitch = bitmap->pitch; + FT_Byte* origin = bitmap->buffer; static const unsigned int filters[3][3] = { @@ -191,33 +170,31 @@ FT_UNUSED( weights ); + /* take care of bitmap flow */ + if ( pitch > 0 ) + origin += pitch * (FT_Int)( height - 1 ); + /* horizontal in-place intra-pixel filter */ if ( mode == FT_RENDER_MODE_LCD && width >= 3 ) { - FT_Byte* line = bitmap->buffer; + FT_Byte* line = origin; - /* take care of bitmap flow */ - if ( bitmap->pitch < 0 ) - line -= bitmap->pitch * (FT_Int)( bitmap->rows - 1 ); - - for ( ; height > 0; height--, line += pitch ) + for ( ; height > 0; height--, line -= pitch ) { FT_UInt xx; for ( xx = 0; xx < width; xx += 3 ) { - FT_UInt r = 0; - FT_UInt g = 0; - FT_UInt b = 0; + FT_UInt r, g, b; FT_UInt p; p = line[xx]; - r += filters[0][0] * p; - g += filters[0][1] * p; - b += filters[0][2] * p; + r = filters[0][0] * p; + g = filters[0][1] * p; + b = filters[0][2] * p; p = line[xx + 1]; r += filters[1][0] * p; @@ -237,31 +214,24 @@ } else if ( mode == FT_RENDER_MODE_LCD_V && height >= 3 ) { - FT_Byte* column = bitmap->buffer; - + FT_Byte* column = origin; - /* take care of bitmap flow */ - if ( bitmap->pitch < 0 ) - column -= bitmap->pitch * (FT_Int)( bitmap->rows - 1 ); for ( ; width > 0; width--, column++ ) { - FT_Byte* col = column; - FT_Byte* col_end = col + (FT_Int)height * pitch; + FT_Byte* col = column - 2 * pitch; - for ( ; col < col_end; col += 3 * pitch ) + for ( ; height > 0; height -= 3, col -= 3 * pitch ) { - FT_UInt r = 0; - FT_UInt g = 0; - FT_UInt b = 0; + FT_UInt r, g, b; FT_UInt p; p = col[0]; - r += filters[0][0] * p; - g += filters[0][1] * p; - b += filters[0][2] * p; + r = filters[0][0] * p; + g = filters[0][1] * p; + b = filters[0][2] * p; p = col[pitch]; r += filters[1][0] * p; @@ -275,7 +245,7 @@ col[0] = (FT_Byte)( r / 65536 ); col[pitch] = (FT_Byte)( g / 65536 ); - col[2 * pitch] = (FT_Byte)( b / 65536 ); + col[pitch * 2] = (FT_Byte)( b / 65536 ); } } } diff --git a/src/smooth/ftsmooth.c b/src/smooth/ftsmooth.c index 061d251b1..fd12e666a 100644 --- a/src/smooth/ftsmooth.c +++ b/src/smooth/ftsmooth.c @@ -207,10 +207,10 @@ if ( vmul ) { - cbox.yMax += lcd_weights[0] ? 43 - : lcd_weights[1] ? 22 : 0; - cbox.yMin -= lcd_weights[4] ? 43 + cbox.yMax += lcd_weights[4] ? 43 : lcd_weights[3] ? 22 : 0; + cbox.yMin -= lcd_weights[0] ? 43 + : lcd_weights[1] ? 22 : 0; } } #endif From 8c763fb1be3c709bd69e13278569a25c4c30ea84 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Tue, 20 Jun 2017 07:49:52 +0200 Subject: [PATCH 148/470] [cff, truetype] Integer overflows. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2300 https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2313 * src/cff/cf2hints.c (cf2_hintmap_adjustHints): Use ADD_INT32. * src/truetype/ttinterp.c (Ins_ABS): Avoid FT_ABS. --- ChangeLog | 13 +++++++++++++ src/cff/cf2hints.c | 30 +++++++++++++++++++----------- src/truetype/ttinterp.c | 3 ++- 3 files changed, 34 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index b5069b1c1..e50665b1e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2017-06-16 Werner Lemberg + + [cff, truetype] Integer overflows. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2300 + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2313 + + * src/cff/cf2hints.c (cf2_hintmap_adjustHints): Use ADD_INT32. + + * src/truetype/ttinterp.c (Ins_ABS): Avoid FT_ABS. + 2017-06-17 Alexei Podtelezhnikov [base, smooth] LCD filtering cleanups. diff --git a/src/cff/cf2hints.c b/src/cff/cf2hints.c index 0951e1e7a..e0f2cc91c 100644 --- a/src/cff/cf2hints.c +++ b/src/cff/cf2hints.c @@ -440,14 +440,16 @@ /* is there room to move up? */ /* there is if we are at top of array or the next edge is at or */ /* beyond proposed move up? */ - if ( j >= hintmap->count - 1 || + if ( j >= hintmap->count - 1 || hintmap->edge[j + 1].dsCoord >= - hintmap->edge[j].dsCoord + moveUp + upMinCounter ) + ADD_INT32( hintmap->edge[j].dsCoord, + moveUp + upMinCounter ) ) { /* there is room to move up; is there also room to move down? */ - if ( i == 0 || + if ( i == 0 || hintmap->edge[i - 1].dsCoord <= - hintmap->edge[i].dsCoord + moveDown - downMinCounter ) + ADD_INT32( hintmap->edge[i].dsCoord, + moveDown - downMinCounter ) ) { /* move smaller absolute amount */ move = ( -moveDown < moveUp ) ? moveDown : moveUp; /* optimum */ @@ -458,9 +460,10 @@ else { /* is there room to move down? */ - if ( i == 0 || + if ( i == 0 || hintmap->edge[i - 1].dsCoord <= - hintmap->edge[i].dsCoord + moveDown - downMinCounter ) + ADD_INT32( hintmap->edge[i].dsCoord, + moveDown - downMinCounter ) ) { move = moveDown; /* true if non-optimum move */ @@ -494,9 +497,11 @@ } /* move the edge(s) */ - hintmap->edge[i].dsCoord += move; + hintmap->edge[i].dsCoord = ADD_INT32( hintmap->edge[i].dsCoord, + move ); if ( isPair ) - hintmap->edge[j].dsCoord += move; + hintmap->edge[j].dsCoord = ADD_INT32( hintmap->edge[j].dsCoord, + move ); } /* assert there are no overlaps in device space */ @@ -544,15 +549,18 @@ /* is there room to move up? */ if ( hintmap->edge[j + 1].dsCoord >= - hintmap->edge[j].dsCoord + hintMove->moveUp + CF2_MIN_COUNTER ) + ADD_INT32( hintmap->edge[j].dsCoord, + hintMove->moveUp + CF2_MIN_COUNTER ) ) { /* there is more room now, move edge up */ - hintmap->edge[j].dsCoord += hintMove->moveUp; + hintmap->edge[j].dsCoord = ADD_INT32( hintmap->edge[j].dsCoord, + hintMove->moveUp ); if ( cf2_hint_isPair( &hintmap->edge[j] ) ) { FT_ASSERT( j > 0 ); - hintmap->edge[j - 1].dsCoord += hintMove->moveUp; + hintmap->edge[j - 1].dsCoord = + ADD_INT32( hintmap->edge[j - 1].dsCoord, hintMove->moveUp ); } } } diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c index bf198f77c..c6605bb92 100644 --- a/src/truetype/ttinterp.c +++ b/src/truetype/ttinterp.c @@ -2914,7 +2914,8 @@ static void Ins_ABS( FT_Long* args ) { - args[0] = FT_ABS( args[0] ); + if ( args[0] < 0 ) + args[0] = NEG_LONG( args[0] ); } From c8829e4bc18c99b8cc0f747216c2191ec669e11a Mon Sep 17 00:00:00 2001 From: Tony Theodore Date: Tue, 20 Jun 2017 12:24:05 +0200 Subject: [PATCH 149/470] Fix pkg-config in freetype-config for cross-compiling (#51274). * builds/unix/unix-def.in (PKG_CONFIG): New variable. (freetype-config): Use it in sed expression. * builds/unix/freetype-config.in: s/pkg-config/%PKG_CONFIG%/. --- ChangeLog | 11 ++++++++++- builds/unix/freetype-config.in | 18 +++++++++--------- builds/unix/unix-def.in | 2 ++ 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index e50665b1e..bc65cbb67 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,13 @@ -2017-06-16 Werner Lemberg +2017-06-20 Tony Theodore + + Fix pkg-config in freetype-config for cross-compiling (#51274). + + * builds/unix/unix-def.in (PKG_CONFIG): New variable. + (freetype-config): Use it in sed expression. + + * builds/unix/freetype-config.in: s/pkg-config/%PKG_CONFIG%/. + +2017-06-20 Werner Lemberg [cff, truetype] Integer overflows. diff --git a/builds/unix/freetype-config.in b/builds/unix/freetype-config.in index 22eb8379e..2c1c160f8 100644 --- a/builds/unix/freetype-config.in +++ b/builds/unix/freetype-config.in @@ -14,7 +14,7 @@ export LC_ALL # if `pkg-config' is available, use values from `freetype2.pc' -pkg-config --atleast-pkgconfig-version 0.24 >/dev/null 2>&1 +%PKG_CONFIG% --atleast-pkgconfig-version 0.24 >/dev/null 2>&1 if test $? -eq 0 ; then # note that option `--variable' is not affected by the # PKG_CONFIG_SYSROOT_DIR environment variable @@ -23,17 +23,17 @@ if test $? -eq 0 ; then export PKG_CONFIG_SYSROOT_DIR fi - prefix=`pkg-config --variable prefix freetype2` - exec_prefix=`pkg-config --variable exec_prefix freetype2` + prefix=`%PKG_CONFIG% --variable prefix freetype2` + exec_prefix=`%PKG_CONFIG% --variable exec_prefix freetype2` - includedir=`pkg-config --variable includedir freetype2` - libdir=`pkg-config --variable libdir freetype2` + includedir=`%PKG_CONFIG% --variable includedir freetype2` + libdir=`%PKG_CONFIG% --variable libdir freetype2` - version=`pkg-config --modversion freetype2` + version=`%PKG_CONFIG% --modversion freetype2` - cflags=`pkg-config --cflags freetype2` - dynamic_libs=`pkg-config --libs freetype2` - static_libs=`pkg-config --static --libs freetype2` + cflags=`%PKG_CONFIG% --cflags freetype2` + dynamic_libs=`%PKG_CONFIG% --libs freetype2` + static_libs=`%PKG_CONFIG% --static --libs freetype2` else prefix="%prefix%" exec_prefix="%exec_prefix%" diff --git a/builds/unix/unix-def.in b/builds/unix/unix-def.in index feae99b65..34e06e380 100644 --- a/builds/unix/unix-def.in +++ b/builds/unix/unix-def.in @@ -62,6 +62,7 @@ version_info := @version_info@ # Variables needed for `freetype-config' and `freetype.pc'. # +PKG_CONFIG := @PKG_CONFIG@ REQUIRES_PRIVATE := @REQUIRES_PRIVATE@ LIBS_PRIVATE := @LIBS_PRIVATE@ LIBSSTATIC_CONFIG := @LIBSSTATIC_CONFIG@ @@ -102,6 +103,7 @@ NO_OUTPUT := 2> /dev/null $(OBJ_BUILD)/freetype-config: $(TOP_DIR)/builds/unix/freetype-config.in rm -f $@ $@.tmp sed -e 's|%LIBSSTATIC_CONFIG%|$(LIBSSTATIC_CONFIG)|' \ + -e 's|%PKG_CONFIG%|$(PKG_CONFIG)|' \ -e 's|%build_libtool_libs%|$(build_libtool_libs)|' \ -e 's|%exec_prefix%|$(exec_prefix)|' \ -e 's|%ft_version%|$(ft_version)|' \ From 390048fa468dfee06f722da6b8ca1b79022480d6 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Tue, 20 Jun 2017 18:03:20 +0200 Subject: [PATCH 150/470] Remove deprecated comment. --- src/sfnt/ttpost.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/sfnt/ttpost.c b/src/sfnt/ttpost.c index 540d5f254..a47ece0ec 100644 --- a/src/sfnt/ttpost.c +++ b/src/sfnt/ttpost.c @@ -325,7 +325,6 @@ FT_UNUSED( post_limit ); - /* UNDOCUMENTED! This value appears only in the Apple TT specs. */ if ( FT_READ_USHORT( num_glyphs ) ) goto Exit; From 75cb071b3fbfa2315c5d458fee2bb465a14568ae Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Wed, 21 Jun 2017 22:52:37 -0400 Subject: [PATCH 151/470] [sfnt] Synthesize a Unicode charmap if one is missing. * src/sfnt/ttcmap.h (tt_cmap_unicode_class_rec): Declare it. * src/sfnt/ttcmap.c (tt_get_glyph_name, tt_cmap_unicode_init, tt_cmap_unicode_done, tt_cmap_unicode_char_index, tt_cmap_unicode_char_next, tt_cmap_unicode_class_rec): Implement synthetic Unicode charmap class. (tt_get_cmap_info): Make sure the callback is available. * src/sfnt/sfobjs.c (sfnt_load_face) [FT_CONFIG_OPTION_POSTSCRIPT_NAMES]: If Unicode charmap is missing, synthesize one. * include/freetype/config/ftoption.h: Document it. * devel/ftoption.h: Ditto. --- ChangeLog | 18 +++++ devel/ftoption.h | 2 +- include/freetype/config/ftoption.h | 2 +- src/sfnt/sfobjs.c | 35 ++++++++- src/sfnt/ttcmap.c | 110 ++++++++++++++++++++++++++++- src/sfnt/ttcmap.h | 2 + 6 files changed, 163 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index bc65cbb67..3c95165f8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,21 @@ +2017-06-21 Alexei Podtelezhnikov + + [sfnt] Synthesize a Unicode charmap if one is missing. + + * src/sfnt/ttcmap.h (tt_cmap_unicode_class_rec): Declare it. + * src/sfnt/ttcmap.c (tt_get_glyph_name, tt_cmap_unicode_init, + tt_cmap_unicode_done, tt_cmap_unicode_char_index, + tt_cmap_unicode_char_next, tt_cmap_unicode_class_rec): Implement + synthetic Unicode charmap class. + (tt_get_cmap_info): Make sure the callback is available. + + * src/sfnt/sfobjs.c (sfnt_load_face) + [FT_CONFIG_OPTION_POSTSCRIPT_NAMES]: If Unicode charmap is missing, + synthesize one. + + * include/freetype/config/ftoption.h: Document it. + * devel/ftoption.h: Ditto. + 2017-06-20 Tony Theodore Fix pkg-config in freetype-config for cross-compiling (#51274). diff --git a/devel/ftoption.h b/devel/ftoption.h index db661e7fc..a690ea2d0 100644 --- a/devel/ftoption.h +++ b/devel/ftoption.h @@ -327,7 +327,7 @@ FT_BEGIN_HEADER /* */ /* - The TrueType driver will provide its own set of glyph names, */ /* if you build it to support postscript names in the TrueType */ - /* `post' table. */ + /* `post' table, but will not synthesize a missing Unicode charmap. */ /* */ /* - The Type 1 driver will not be able to synthesize a Unicode */ /* charmap out of the glyphs found in the fonts. */ diff --git a/include/freetype/config/ftoption.h b/include/freetype/config/ftoption.h index 1bf6e8f53..935e20d8d 100644 --- a/include/freetype/config/ftoption.h +++ b/include/freetype/config/ftoption.h @@ -327,7 +327,7 @@ FT_BEGIN_HEADER /* */ /* - The TrueType driver will provide its own set of glyph names, */ /* if you build it to support postscript names in the TrueType */ - /* `post' table. */ + /* `post' table, but will not synthesize a missing Unicode charmap. */ /* */ /* - The Type 1 driver will not be able to synthesize a Unicode */ /* charmap out of the glyphs found in the fonts. */ diff --git a/src/sfnt/sfobjs.c b/src/sfnt/sfobjs.c index 3f54d5d5c..04303e99e 100644 --- a/src/sfnt/sfobjs.c +++ b/src/sfnt/sfobjs.c @@ -1464,7 +1464,8 @@ /* Polish the charmaps. */ /* */ /* Try to set the charmap encoding according to the platform & */ - /* encoding ID of each charmap. */ + /* encoding ID of each charmap. Emulate Unicode charmap if one */ + /* is missing. */ /* */ tt_face_build_cmaps( face ); /* ignore errors */ @@ -1472,7 +1473,10 @@ /* set the encoding fields */ { - FT_Int m; + FT_Int m; +#ifdef FT_CONFIG_OPTION_POSTSCRIPT_NAMES + FT_Bool has_unicode = FALSE; +#endif for ( m = 0; m < root->num_charmaps; m++ ) @@ -1482,6 +1486,33 @@ charmap->encoding = sfnt_find_encoding( charmap->platform_id, charmap->encoding_id ); + +#ifdef FT_CONFIG_OPTION_POSTSCRIPT_NAMES + + if ( charmap->encoding == FT_ENCODING_UNICODE ) + has_unicode = TRUE; + } + + /* synthesize Unicode charmap if one is missing */ + if ( !has_unicode ) + { + FT_CharMapRec cmaprec; + + + cmaprec.face = root; + cmaprec.platform_id = TT_PLATFORM_MICROSOFT; + cmaprec.encoding_id = TT_MS_ID_UNICODE_CS; + cmaprec.encoding = FT_ENCODING_UNICODE; + + + error = FT_CMap_New( (FT_CMap_Class)&tt_cmap_unicode_class_rec, + NULL, &cmaprec, NULL ); + if ( error && + FT_ERR_NEQ( error, No_Unicode_Glyph_Name ) ) + FT_TRACE2(( "sfnt_load_face: failed to emulate Unicode\n" )); + +#endif /* FT_CONFIG_OPTION_POSTSCRIPT_NAMES */ + } } diff --git a/src/sfnt/ttcmap.c b/src/sfnt/ttcmap.c index 5afa6ae4b..ec583d122 100644 --- a/src/sfnt/ttcmap.c +++ b/src/sfnt/ttcmap.c @@ -3622,6 +3622,110 @@ #endif /* TT_CONFIG_CMAP_FORMAT_14 */ + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** SYNTHETIC UNICODE *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + /* This charmap is generated using postscript glyph names. */ + +#ifdef FT_CONFIG_OPTION_POSTSCRIPT_NAMES + + FT_CALLBACK_DEF( const char * ) + tt_get_glyph_name( TT_Face face, + FT_UInt idx ) + { + FT_String* PSname; + + + tt_face_get_ps_name( face, idx, &PSname ); + + return PSname; + } + + + FT_CALLBACK_DEF( FT_Error ) + tt_cmap_unicode_init( PS_Unicodes unicodes, + FT_Pointer pointer ) + { + TT_Face face = (TT_Face)FT_CMAP_FACE( unicodes ); + FT_Memory memory = FT_FACE_MEMORY( face ); + FT_Service_PsCMaps psnames = (FT_Service_PsCMaps)face->psnames; + + FT_UNUSED( pointer ); + + + return psnames->unicodes_init( memory, + unicodes, + face->root.num_glyphs, + (PS_GetGlyphNameFunc)&tt_get_glyph_name, + (PS_FreeGlyphNameFunc)NULL, + (FT_Pointer)face ); + } + + + FT_CALLBACK_DEF( void ) + tt_cmap_unicode_done( PS_Unicodes unicodes ) + { + FT_Face face = FT_CMAP_FACE( unicodes ); + FT_Memory memory = FT_FACE_MEMORY( face ); + + + FT_FREE( unicodes->maps ); + unicodes->num_maps = 0; + } + + + FT_CALLBACK_DEF( FT_UInt ) + tt_cmap_unicode_char_index( PS_Unicodes unicodes, + FT_UInt32 char_code ) + { + TT_Face face = (TT_Face)FT_CMAP_FACE( unicodes ); + FT_Service_PsCMaps psnames = (FT_Service_PsCMaps)face->psnames; + + + return psnames->unicodes_char_index( unicodes, char_code ); + } + + + FT_CALLBACK_DEF( FT_UInt32 ) + tt_cmap_unicode_char_next( PS_Unicodes unicodes, + FT_UInt32 *pchar_code ) + { + TT_Face face = (TT_Face)FT_CMAP_FACE( unicodes ); + FT_Service_PsCMaps psnames = (FT_Service_PsCMaps)face->psnames; + + + return psnames->unicodes_char_next( unicodes, pchar_code ); + } + + + FT_DEFINE_TT_CMAP( + tt_cmap_unicode_class_rec, + + sizeof ( PS_UnicodesRec ), + + (FT_CMap_InitFunc) tt_cmap_unicode_init, /* init */ + (FT_CMap_DoneFunc) tt_cmap_unicode_done, /* done */ + (FT_CMap_CharIndexFunc)tt_cmap_unicode_char_index, /* char_index */ + (FT_CMap_CharNextFunc) tt_cmap_unicode_char_next, /* char_next */ + + (FT_CMap_CharVarIndexFunc) NULL, /* char_var_index */ + (FT_CMap_CharVarIsDefaultFunc)NULL, /* char_var_default */ + (FT_CMap_VariantListFunc) NULL, /* variant_list */ + (FT_CMap_CharVariantListFunc) NULL, /* charvariant_list */ + (FT_CMap_VariantCharListFunc) NULL, /* variantchar_list */ + + -1, + (TT_CMap_ValidateFunc)NULL, /* validate */ + (TT_CMap_Info_GetFunc)NULL /* get_cmap_info */ + ) + +#endif /* FT_CONFIG_OPTION_POSTSCRIPT_NAMES */ + #ifndef FT_CONFIG_OPTION_PIC static const TT_CMap_Class tt_cmap_classes[] = @@ -3801,8 +3905,10 @@ FT_CMap cmap = (FT_CMap)charmap; TT_CMap_Class clazz = (TT_CMap_Class)cmap->clazz; - - return clazz->get_cmap_info( charmap, cmap_info ); + if ( clazz->get_cmap_info ) + return clazz->get_cmap_info( charmap, cmap_info ); + else + return FT_THROW( Invalid_CharMap_Format ); } diff --git a/src/sfnt/ttcmap.h b/src/sfnt/ttcmap.h index 83f12df24..ab02f9bba 100644 --- a/src/sfnt/ttcmap.h +++ b/src/sfnt/ttcmap.h @@ -141,6 +141,8 @@ FT_BEGIN_HEADER #define TT_VALID_GLYPH_COUNT( x ) TT_VALIDATOR( x )->num_glyphs + FT_CALLBACK_TABLE const TT_CMap_ClassRec tt_cmap_unicode_class_rec; + FT_LOCAL( FT_Error ) tt_face_build_cmaps( TT_Face face ); From 298e2ea5a6c2e3264f8abaa8b1d2371fb4c77f4d Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Thu, 22 Jun 2017 11:52:43 +0200 Subject: [PATCH 152/470] [cff, truetype] Integer overflows. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2323 https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2328 * src/cff/cf2blues.c (cf2_blues_capture): Use ADD_INT32 and SUB_INT32. * src/truetype/ttinterp.c (Ins_SDPVTL): Use SUB_LONG and NEG_LONG. --- ChangeLog | 14 ++++++++++++++ src/cff/cf2blues.c | 9 +++++---- src/truetype/ttinterp.c | 24 ++++++++++++------------ 3 files changed, 31 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3c95165f8..f40f4db38 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2017-06-22 Werner Lemberg + + [cff, truetype] Integer overflows. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2323 + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2328 + + * src/cff/cf2blues.c (cf2_blues_capture): Use ADD_INT32 and + SUB_INT32. + + * src/truetype/ttinterp.c (Ins_SDPVTL): Use SUB_LONG and NEG_LONG. + 2017-06-21 Alexei Podtelezhnikov [sfnt] Synthesize a Unicode charmap if one is missing. diff --git a/src/cff/cf2blues.c b/src/cff/cf2blues.c index f5b44b21c..f9f5bbb8f 100644 --- a/src/cff/cf2blues.c +++ b/src/cff/cf2blues.c @@ -515,7 +515,7 @@ dsNew = cf2_fixedRound( bottomHintEdge->dsCoord ); } - dsMove = dsNew - bottomHintEdge->dsCoord; + dsMove = SUB_INT32( dsNew, bottomHintEdge->dsCoord ); captured = TRUE; break; @@ -549,7 +549,7 @@ dsNew = cf2_fixedRound( topHintEdge->dsCoord ); } - dsMove = dsNew - topHintEdge->dsCoord; + dsMove = SUB_INT32( dsNew, topHintEdge->dsCoord ); captured = TRUE; break; @@ -562,13 +562,14 @@ /* move both edges and flag them `locked' */ if ( cf2_hint_isValid( bottomHintEdge ) ) { - bottomHintEdge->dsCoord += dsMove; + bottomHintEdge->dsCoord = ADD_INT32( bottomHintEdge->dsCoord, + dsMove ); cf2_hint_lock( bottomHintEdge ); } if ( cf2_hint_isValid( topHintEdge ) ) { - topHintEdge->dsCoord += dsMove; + topHintEdge->dsCoord = ADD_INT32( topHintEdge->dsCoord, dsMove ); cf2_hint_lock( topHintEdge ); } } diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c index c6605bb92..a032923ed 100644 --- a/src/truetype/ttinterp.c +++ b/src/truetype/ttinterp.c @@ -4927,12 +4927,12 @@ } { - FT_Vector* v1 = exc->zp1.org + p2; - FT_Vector* v2 = exc->zp2.org + p1; + FT_Vector* v1 = exc->zp1.org + p2; + FT_Vector* v2 = exc->zp2.org + p1; - A = v1->x - v2->x; - B = v1->y - v2->y; + A = SUB_LONG( v1->x, v2->x ); + B = SUB_LONG( v1->y, v2->y ); /* If v1 == v2, SDPvTL behaves the same as */ /* SVTCA[X], respectively. */ @@ -4948,9 +4948,9 @@ if ( ( opcode & 1 ) != 0 ) { - C = B; /* counter clockwise rotation */ - B = A; - A = -C; + C = B; /* counter clockwise rotation */ + B = A; + A = NEG_LONG( C ); } Normalize( A, B, &exc->GS.dualVector ); @@ -4960,8 +4960,8 @@ FT_Vector* v2 = exc->zp2.cur + p1; - A = v1->x - v2->x; - B = v1->y - v2->y; + A = SUB_LONG( v1->x, v2->x ); + B = SUB_LONG( v1->y, v2->y ); if ( A == 0 && B == 0 ) { @@ -4972,9 +4972,9 @@ if ( ( opcode & 1 ) != 0 ) { - C = B; /* counter clockwise rotation */ - B = A; - A = -C; + C = B; /* counter clockwise rotation */ + B = A; + A = NEG_LONG( C ); } Normalize( A, B, &exc->GS.projVector ); From b27cef27ffc37cb14190a1860523d6a1aa9bc783 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sat, 24 Jun 2017 20:17:46 +0200 Subject: [PATCH 153/470] [truetype] Integer overflows. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2364 * src/truetype/ttinterp.c (Ins_ISECT): Use NEG_LONG. --- ChangeLog | 10 ++++++++++ src/truetype/ttinterp.c | 4 ++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index f40f4db38..f992e068a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2017-06-24 Werner Lemberg + + [truetype] Integer overflows. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2364 + + * src/truetype/ttinterp.c (Ins_ISECT): Use NEG_LONG. + 2017-06-22 Werner Lemberg [cff, truetype] Integer overflows. diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c index a032923ed..8e7809a7d 100644 --- a/src/truetype/ttinterp.c +++ b/src/truetype/ttinterp.c @@ -6487,7 +6487,7 @@ dx = SUB_LONG( exc->zp0.cur[b0].x, exc->zp1.cur[a0].x ); dy = SUB_LONG( exc->zp0.cur[b0].y, exc->zp1.cur[a0].y ); - discriminant = ADD_LONG( FT_MulDiv( dax, -dby, 0x40 ), + discriminant = ADD_LONG( FT_MulDiv( dax, NEG_LONG( dby ), 0x40 ), FT_MulDiv( day, dbx, 0x40 ) ); dotproduct = ADD_LONG( FT_MulDiv( dax, dbx, 0x40 ), FT_MulDiv( day, dby, 0x40 ) ); @@ -6502,7 +6502,7 @@ /* thresholding abs(tan(angle)) at 1/19, corresponding to 3 degrees. */ if ( MUL_LONG( 19, FT_ABS( discriminant ) ) > FT_ABS( dotproduct ) ) { - val = ADD_LONG( FT_MulDiv( dx, -dby, 0x40 ), + val = ADD_LONG( FT_MulDiv( dx, NEG_LONG( dby ), 0x40 ), FT_MulDiv( dy, dbx, 0x40 ) ); R.x = FT_MulDiv( val, dax, discriminant ); From dde8f5abbe5a27af2186c3f0e2c702612d7ca930 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Tue, 27 Jun 2017 06:16:04 +0200 Subject: [PATCH 154/470] [truetype] Integer overflows. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2384 https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2391 * src/base/ftcalc.c (FT_MulDiv, FT_MulDiv_No_Round, FT_DivFix): Use NEG_LONG. * src/truetype/ttinterp.c (Ins_SxVTL): Use NEG_LONG. --- ChangeLog | 14 ++++++++++++++ src/base/ftcalc.c | 14 +++++++------- src/truetype/ttinterp.c | 6 +++--- 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index f992e068a..f79ab736d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2017-06-27 Werner Lemberg + + [truetype] Integer overflows. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2384 + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2391 + + * src/base/ftcalc.c (FT_MulDiv, FT_MulDiv_No_Round, FT_DivFix): Use + NEG_LONG. + + * src/truetype/ttinterp.c (Ins_SxVTL): Use NEG_LONG. + 2017-06-24 Werner Lemberg [truetype] Integer overflows. diff --git a/src/base/ftcalc.c b/src/base/ftcalc.c index cb10612d4..f27fcfda0 100644 --- a/src/base/ftcalc.c +++ b/src/base/ftcalc.c @@ -193,7 +193,7 @@ d_ = (FT_Long)d; - return s < 0 ? -d_ : d_; + return s < 0 ? NEG_LONG( d_ ) : d_; } @@ -222,7 +222,7 @@ d_ = (FT_Long)d; - return s < 0 ? -d_ : d_; + return s < 0 ? NEG_LONG( d_ ) : d_; } @@ -269,7 +269,7 @@ q_ = (FT_Long)q; - return s < 0 ? -q_ : q_; + return s < 0 ? NEG_LONG( q_ ) : q_; } @@ -456,7 +456,7 @@ a_ = (FT_Long)a; - return s < 0 ? -a_ : a_; + return s < 0 ? NEG_LONG( a_ ) : a_; } @@ -499,7 +499,7 @@ a_ = (FT_Long)a; - return s < 0 ? -a_ : a_; + return s < 0 ? NEG_LONG( a_ ) : a_; } @@ -595,7 +595,7 @@ a_ = (FT_Long)a; - return s < 0 ? -a_ : a_; + return s < 0 ? NEG_LONG( a_ ) : a_; #endif /* 0 */ @@ -648,7 +648,7 @@ q_ = (FT_Long)q; - return s < 0 ? -q_ : q_; + return s < 0 ? NEG_LONG( q_ ) : q_; } diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c index 8e7809a7d..24318bf1b 100644 --- a/src/truetype/ttinterp.c +++ b/src/truetype/ttinterp.c @@ -4260,9 +4260,9 @@ if ( ( opcode & 1 ) != 0 ) { - C = B; /* counter clockwise rotation */ - B = A; - A = -C; + C = B; /* counter clockwise rotation */ + B = A; + A = NEG_LONG( C ); } Normalize( A, B, Vec ); From 2e7bb5e825880301e762f41fd0efa2aa18a4421f Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Tue, 27 Jun 2017 16:56:38 +0200 Subject: [PATCH 155/470] * src/cff/cffparse.c (do_fixed): Fix typo. Spotted by chris . --- ChangeLog | 6 ++++++ src/cff/cffparse.c | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index f79ab736d..e9a047bca 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2017-06-27 Werner Lemberg + + * src/cff/cffparse.c (do_fixed): Fix typo. + + Spotted by chris . + 2017-06-27 Werner Lemberg [truetype] Integer overflows. diff --git a/src/cff/cffparse.c b/src/cff/cffparse.c index ae55bbb85..9d7bf6d22 100644 --- a/src/cff/cffparse.c +++ b/src/cff/cffparse.c @@ -504,7 +504,7 @@ { if ( FT_ABS( val ) > power_ten_limits[scaling] ) { - val = val > 0 ? 0x7FFFFFFFL : -0x7FFFFFFFFL; + val = val > 0 ? 0x7FFFFFFFL : -0x7FFFFFFFL; goto Overflow; } From 7819aeb622a94be0d89caf8382f290d0266c4aed Mon Sep 17 00:00:00 2001 From: Ben Wagner Date: Wed, 28 Jun 2017 22:57:41 +0200 Subject: [PATCH 156/470] Avoid Microsoft compiler warnings (#51331). While clang's sanitizer recommends a cast to unsigned for safe negation (to handle -INT_MIN), both MSVC and Visualc emit warning C4146 if an unsigned value gets negated. * include/freetype/internal/ftcalc.h (NEG_LONG, NEG_INT32), src/base/ftcalc.c (FT_MOVE_SIGN): Replace negation with a subtraction. --- ChangeLog | 12 ++++++++++++ include/freetype/internal/ftcalc.h | 4 ++-- src/base/ftcalc.c | 2 +- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index e9a047bca..a233f703c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2017-06-28 Ben Wagner + + Avoid Microsoft compiler warnings (#51331). + + While clang's sanitizer recommends a cast to unsigned for safe + negation (to handle -INT_MIN), both MSVC and Visualc emit warning + C4146 if an unsigned value gets negated. + + * include/freetype/internal/ftcalc.h (NEG_LONG, NEG_INT32), + src/base/ftcalc.c (FT_MOVE_SIGN): Replace negation with a + subtraction. + 2017-06-27 Werner Lemberg * src/cff/cffparse.c (do_fixed): Fix typo. diff --git a/include/freetype/internal/ftcalc.h b/include/freetype/internal/ftcalc.h index d93a05488..8b35f03d8 100644 --- a/include/freetype/internal/ftcalc.h +++ b/include/freetype/internal/ftcalc.h @@ -424,7 +424,7 @@ FT_BEGIN_HEADER #define MUL_LONG( a, b ) \ (FT_Long)( (FT_ULong)(a) * (FT_ULong)(b) ) #define NEG_LONG( a ) \ - (FT_Long)( -(FT_ULong)(a) ) + (FT_Long)( (FT_ULong)0 - (FT_ULong)(a) ) #define ADD_INT32( a, b ) \ (FT_Int32)( (FT_UInt32)(a) + (FT_UInt32)(b) ) @@ -433,7 +433,7 @@ FT_BEGIN_HEADER #define MUL_INT32( a, b ) \ (FT_Int32)( (FT_UInt32)(a) * (FT_UInt32)(b) ) #define NEG_INT32( a ) \ - (FT_Int32)( -(FT_UInt32)(a) ) + (FT_Int32)( (FT_UInt32)0 - (FT_UInt32)(a) ) FT_END_HEADER diff --git a/src/base/ftcalc.c b/src/base/ftcalc.c index f27fcfda0..fa28e79b3 100644 --- a/src/base/ftcalc.c +++ b/src/base/ftcalc.c @@ -74,7 +74,7 @@ FT_BEGIN_STMNT \ if ( x < 0 ) \ { \ - x_unsigned = -x_unsigned; \ + x_unsigned = 0u - (x_unsigned); \ s = -s; \ } \ FT_END_STMNT From abeb28f161bc11be4fcdb8af50ab4b736d34a3e5 Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Sat, 1 Jul 2017 16:48:32 -0400 Subject: [PATCH 157/470] * src/sfnt/sfobjs.c (sfnt_load_face): Ignore No_Unicode_Glyph_Name. --- ChangeLog | 4 ++++ src/sfnt/sfobjs.c | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index a233f703c..30cf6304a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2017-07-01 Alexei Podtelezhnikov + + * src/sfnt/sfobjs.c (sfnt_load_face): Ignore No_Unicode_Glyph_Name. + 2017-06-28 Ben Wagner Avoid Microsoft compiler warnings (#51331). diff --git a/src/sfnt/sfobjs.c b/src/sfnt/sfobjs.c index 04303e99e..152690878 100644 --- a/src/sfnt/sfobjs.c +++ b/src/sfnt/sfobjs.c @@ -1509,7 +1509,8 @@ NULL, &cmaprec, NULL ); if ( error && FT_ERR_NEQ( error, No_Unicode_Glyph_Name ) ) - FT_TRACE2(( "sfnt_load_face: failed to emulate Unicode\n" )); + goto Exit; + error = FT_Err_Ok; #endif /* FT_CONFIG_OPTION_POSTSCRIPT_NAMES */ From ca799e9be52526739691f120285a27b91fd15d68 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Mon, 3 Jul 2017 06:27:52 +0200 Subject: [PATCH 158/470] [truetype] Integer overflow. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2455 * src/truetype/ttinterp.c (Ins_SCFS): Use SUB_LONG. --- ChangeLog | 10 ++++++++++ src/truetype/ttinterp.c | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 30cf6304a..c6e8229af 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2017-07-03 Werner Lemberg + + [truetype] Integer overflow. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2455 + + * src/truetype/ttinterp.c (Ins_SCFS): Use SUB_LONG. + 2017-07-01 Alexei Podtelezhnikov * src/sfnt/sfobjs.c (sfnt_load_face): Ignore No_Unicode_Glyph_Name. diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c index 24318bf1b..f8bf4af71 100644 --- a/src/truetype/ttinterp.c +++ b/src/truetype/ttinterp.c @@ -4803,7 +4803,7 @@ K = FAST_PROJECT( &exc->zp2.cur[L] ); - exc->func_move( exc, &exc->zp2, L, args[1] - K ); + exc->func_move( exc, &exc->zp2, L, SUB_LONG( args[1], K ) ); /* UNDOCUMENTED! The MS rasterizer does that with */ /* twilight points (confirmed by Greg Hitchcock) */ From c56d8851ea987023cc73981a70d261b3f6427545 Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Mon, 3 Jul 2017 22:49:07 -0400 Subject: [PATCH 159/470] * src/base/ftlcdfil.c (ft_lcd_filter_fir): Improve code. --- ChangeLog | 6 +++++- src/base/ftlcdfil.c | 28 ++++++++-------------------- 2 files changed, 13 insertions(+), 21 deletions(-) diff --git a/ChangeLog b/ChangeLog index c6e8229af..8b2d72275 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2017-07-03 Alexei Podtelezhnikov + + * src/base/ftlcdfil.c (ft_lcd_filter_fir): Improve code. + 2017-07-03 Werner Lemberg [truetype] Integer overflow. @@ -112,7 +116,7 @@ [base, smooth] LCD filtering cleanups. - * src/base/ftlcdlil.c (ft_lcd_filter_fir, _ft_lcd_filter_legacy): + * src/base/ftlcdfil.c (ft_lcd_filter_fir, _ft_lcd_filter_legacy): Clean up, start filtering from the bottom-left origin. * src/smooth/ftsmooth.c (ft_smooth_render_generic): Updated. diff --git a/src/base/ftlcdfil.c b/src/base/ftlcdfil.c index 6d35e35cb..60c813fd9 100644 --- a/src/base/ftlcdfil.c +++ b/src/base/ftlcdfil.c @@ -29,6 +29,8 @@ /* define USE_LEGACY to implement the legacy filter */ #define USE_LEGACY +#define FT_SHIFTCLAMP( x ) ( x >>= 8, (FT_Byte)( x > 255 ? 255 : x ) ) + /* FIR filter used by the default and light filters */ FT_BASE( void ) ft_lcd_filter_fir( FT_Bitmap* bitmap, @@ -80,18 +82,11 @@ fir[3] = fir[4] + weights[3] * val; fir[4] = weights[4] * val; - fir[0] >>= 8; - fir[0] |= (FT_UInt)-(FT_Int)( fir[0] >> 8 ); - line[xx - 2] = (FT_Byte)fir[0]; + line[xx - 2] = FT_SHIFTCLAMP( fir[0] ); } - fir[1] >>= 8; - fir[1] |= (FT_UInt)-(FT_Int)( fir[1] >> 8 ); - line[xx - 2] = (FT_Byte)fir[1]; - - fir[2] >>= 8; - fir[2] |= (FT_UInt)-(FT_Int)( fir[2] >> 8 ); - line[xx - 1] = (FT_Byte)fir[2]; + line[xx - 2] = FT_SHIFTCLAMP( fir[1] ); + line[xx - 1] = FT_SHIFTCLAMP( fir[2] ); } } @@ -130,18 +125,11 @@ fir[3] = fir[4] + weights[3] * val; fir[4] = weights[4] * val; - fir[0] >>= 8; - fir[0] |= (FT_UInt)-(FT_Int)( fir[0] >> 8 ); - col[pitch * 2] = (FT_Byte)fir[0]; + col[pitch * 2] = FT_SHIFTCLAMP( fir[0] ); } - fir[1] >>= 8; - fir[1] |= (FT_UInt)-(FT_Int)( fir[1] >> 8 ); - col[pitch * 2] = (FT_Byte)fir[1]; - - fir[2] >>= 8; - fir[2] |= (FT_UInt)-(FT_Int)( fir[2] >> 8 ); - col[pitch] = (FT_Byte)fir[2]; + col[pitch * 2] = FT_SHIFTCLAMP( fir[1] ); + col[pitch] = FT_SHIFTCLAMP( fir[2] ); } } } From 1c85479d2d1de54a4b592ffbef0ae24f498053d2 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Tue, 4 Jul 2017 08:08:54 +0200 Subject: [PATCH 160/470] [truetype] Prevent address overflow (#51365). * src/truetype/ttgxvar.c (FT_Stream_SeekSet): Add guard. --- ChangeLog | 6 ++++++ src/truetype/ttgxvar.c | 6 ++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8b2d72275..f1ca0f516 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2017-07-04 Werner Lemberg + + [truetype] Prevent address overflow (#51365). + + * src/truetype/ttgxvar.c (FT_Stream_SeekSet): Add guard. + 2017-07-03 Alexei Podtelezhnikov * src/base/ftlcdfil.c (ft_lcd_filter_fir): Improve code. diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c index f2049796d..9125afd10 100644 --- a/src/truetype/ttgxvar.c +++ b/src/truetype/ttgxvar.c @@ -60,8 +60,10 @@ #define FT_Stream_FTell( stream ) \ (FT_ULong)( (stream)->cursor - (stream)->base ) -#define FT_Stream_SeekSet( stream, off ) \ - ( (stream)->cursor = (stream)->base + (off) ) +#define FT_Stream_SeekSet( stream, off ) \ + (stream)->cursor = ( (off) < (stream)->limit - (stream)->base ) \ + ? (stream)->base + (off) \ + : (stream)->limit /*************************************************************************/ From 4261e497d85b4c99613d48cfe20a1cb3d2efcbdd Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Wed, 5 Jul 2017 23:00:23 +0200 Subject: [PATCH 161/470] * src/truetype/ttgxvar.c (FT_Stream_SeekSet): Fix warning (#51395). --- ChangeLog | 4 ++++ src/truetype/ttgxvar.c | 9 +++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index f1ca0f516..f290bd535 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2017-07-05 Werner Lemberg + + * src/truetype/ttgxvar.c (FT_Stream_SeekSet): Fix warning (#51395). + 2017-07-04 Werner Lemberg [truetype] Prevent address overflow (#51365). diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c index 9125afd10..68458362e 100644 --- a/src/truetype/ttgxvar.c +++ b/src/truetype/ttgxvar.c @@ -60,10 +60,11 @@ #define FT_Stream_FTell( stream ) \ (FT_ULong)( (stream)->cursor - (stream)->base ) -#define FT_Stream_SeekSet( stream, off ) \ - (stream)->cursor = ( (off) < (stream)->limit - (stream)->base ) \ - ? (stream)->base + (off) \ - : (stream)->limit +#define FT_Stream_SeekSet( stream, off ) \ + (stream)->cursor = \ + ( (off) < (FT_ULong)( (stream)->limit - (stream)->base ) ) \ + ? (stream)->base + (off) \ + : (stream)->limit /*************************************************************************/ From cf8d9b4ce3fa2c6cd9ccb25585bc17a355c987b0 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Wed, 5 Jul 2017 23:07:01 +0200 Subject: [PATCH 162/470] * src/sfnt/ttcmap.c (tt_cmap_unicode_class_rec): Fix warning. --- ChangeLog | 4 ++++ src/sfnt/ttcmap.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index f290bd535..767309f7d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2017-07-05 Werner Lemberg + + * src/sfnt/ttcmap.c (tt_cmap_unicode_class_rec): Fix warning. + 2017-07-05 Werner Lemberg * src/truetype/ttgxvar.c (FT_Stream_SeekSet): Fix warning (#51395). diff --git a/src/sfnt/ttcmap.c b/src/sfnt/ttcmap.c index ec583d122..ef03e0442 100644 --- a/src/sfnt/ttcmap.c +++ b/src/sfnt/ttcmap.c @@ -3719,7 +3719,7 @@ (FT_CMap_CharVariantListFunc) NULL, /* charvariant_list */ (FT_CMap_VariantCharListFunc) NULL, /* variantchar_list */ - -1, + ~0U, (TT_CMap_ValidateFunc)NULL, /* validate */ (TT_CMap_Info_GetFunc)NULL /* get_cmap_info */ ) From 762de5e2850d16ab0ef671e3e307b99df1956eb9 Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Thu, 6 Jul 2017 22:31:57 -0400 Subject: [PATCH 163/470] Tweak suggested use of `lsb_delta' and `rsb_delta'. --- include/freetype/freetype.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h index bb59d0901..7301863bb 100644 --- a/include/freetype/freetype.h +++ b/include/freetype/freetype.h @@ -1795,9 +1795,9 @@ FT_BEGIN_HEADER /* */ /* */ /* */ - /* if ( prev_rsb_delta - slot->lsb_delta >= 32 ) */ + /* if ( prev_rsb_delta - slot->lsb_delta > 32 ) */ /* origin_x -= 64; */ - /* else if ( prev_rsb_delta - slot->lsb_delta < -32 ) */ + /* else if ( prev_rsb_delta - slot->lsb_delta < -31 ) */ /* origin_x += 64; */ /* */ /* prev_rsb_delta = slot->rsb_delta; */ From 9ea83c788923f9d9ab966e77cb570a3f2be6a8d9 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Fri, 7 Jul 2017 17:09:43 +0200 Subject: [PATCH 164/470] [cff] Integer overflow. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2517 * src/cff/cf2blues.c (cf2_blues_capture): Use SUB_INT32. --- ChangeLog | 10 ++++++++++ src/cff/cf2blues.c | 9 +++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 767309f7d..235e4093e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2017-07-07 Werner Lemberg + + [cff] Integer overflow. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2517 + + * src/cff/cf2blues.c (cf2_blues_capture): Use SUB_INT32. + 2017-07-05 Werner Lemberg * src/sfnt/ttcmap.c (tt_cmap_unicode_class_rec): Fix warning. diff --git a/src/cff/cf2blues.c b/src/cff/cf2blues.c index f9f5bbb8f..c491f2f9e 100644 --- a/src/cff/cf2blues.c +++ b/src/cff/cf2blues.c @@ -524,17 +524,18 @@ if ( !blues->zone[i].bottomZone && cf2_hint_isTop( topHintEdge ) ) { - if ( ( SUB_INT32( blues->zone[i].csBottomEdge, csFuzz ) ) <= - topHintEdge->csCoord && + if ( SUB_INT32( blues->zone[i].csBottomEdge, csFuzz ) <= + topHintEdge->csCoord && topHintEdge->csCoord <= - ADD_INT32( blues->zone[i].csTopEdge, csFuzz ) ) + ADD_INT32( blues->zone[i].csTopEdge, csFuzz ) ) { /* top edge captured by top zone */ if ( blues->suppressOvershoot ) dsNew = blues->zone[i].dsFlatEdge; - else if ( ( topHintEdge->csCoord - blues->zone[i].csBottomEdge ) >= + else if ( SUB_INT32( topHintEdge->csCoord, + blues->zone[i].csBottomEdge ) >= blues->blueShift ) { /* guarantee minimum of 1 pixel overshoot */ From 39af82ebbf3b55f45300eccc7660f388efd09d0b Mon Sep 17 00:00:00 2001 From: Hin-Tak Leung Date: Tue, 11 Jul 2017 01:53:01 +0100 Subject: [PATCH 165/470] Changelog: typo, chromium issue id is 2276 instead of 2278 Signed-off-by: Hin-Tak Leung --- ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 235e4093e..fc9efa84a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -152,7 +152,7 @@ Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2270 - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2278 + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2276 * src/truetype/ttinterp.c (Ins_MDRP, _iup_worker_interpolate): Use ADD_LONG and SUB_LONG. From 3d083fc213c7df18662e1c452b2f8ad56bfa2c4c Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Wed, 12 Jul 2017 00:24:48 +0200 Subject: [PATCH 166/470] * src/truetype/ttpload.c (tt_face_get_location): Off-by-one typo. Also improve tracing message. Problem reported as https://bugs.chromium.org/p/chromium/issues/detail?id=738919 --- ChangeLog | 10 ++++++++++ src/truetype/ttpload.c | 8 ++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index fc9efa84a..708c71aac 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2017-07-12 Werner Lemberg + + * src/truetype/ttpload.c (tt_face_get_location): Off-by-one typo. + + Also improve tracing message. + + Problem reported as + + https://bugs.chromium.org/p/chromium/issues/detail?id=738919 + 2017-07-07 Werner Lemberg [cff] Integer overflow. diff --git a/src/truetype/ttpload.c b/src/truetype/ttpload.c index 70ac15da4..bcf6b34f6 100644 --- a/src/truetype/ttpload.c +++ b/src/truetype/ttpload.c @@ -247,13 +247,13 @@ if ( pos2 > face->glyf_len ) { /* We try to sanitize the last `loca' entry. */ - if ( gindex == face->num_locations - 1 ) + if ( gindex == face->num_locations - 2 ) { FT_TRACE1(( "tt_face_get_location:" - " too large offset (0x%08lx) found for glyph index %ld,\n" + " too large size (%ld bytes) found for glyph index %ld,\n" " " - " truncating at the end of `glyf' table (0x%08lx)\n", - pos2, gindex + 1, face->glyf_len )); + " truncating at the end of `glyf' table to %ld bytes\n", + pos2 - pos1, gindex, face->glyf_len - pos1 )); pos2 = face->glyf_len; } else From 229a5535b53b308a8edda894fe112517c6d03b00 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Wed, 12 Jul 2017 10:48:41 +0200 Subject: [PATCH 167/470] CHANGES: Add information on global metrics rounding. I missed to add this important information. --- docs/CHANGES | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/docs/CHANGES b/docs/CHANGES index 3ee9510d0..ae5bb2f0e 100644 --- a/docs/CHANGES +++ b/docs/CHANGES @@ -44,6 +44,20 @@ CHANGES BETWEEN 2.7.1 and 2.8 configuration option. However, it is strongly recommended to avoid that, adjusting font sizes instead. + - Global size metrics values in the `FT_Size_Metrics' structure + can be different for TrueType fonts. Reason is that in older + FreeType versions the metrics were rounded differently to + integer pixels compared to all other font formats, yielding an + inconsistent behaviour if you used non-native hinting. Starting + with this version, global size metrics for TrueType fonts are + handled the same as other font formats: `ascender' gets rounded + up, `descender' gets rounded down, `height' gets normally + rounded, and `max_advance' gets normally rounded, too. + + If you need more precise values of (global) ascender, descender, + height, or `max_advance', please take the corresponding values + from the `FT_Face' structure and scale them manually. + - If a TrueType font gets loaded with FT_LOAD_NO_HINTING, FreeType now scales the font linearly again (bug introduced in version 2.4.6). From b5cab5c9ca4afd8282a7f187185336c1c543c623 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Wed, 12 Jul 2017 21:58:35 +0200 Subject: [PATCH 168/470] Document how to scale manually. --- include/freetype/freetype.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h index 7301863bb..34ad48a48 100644 --- a/include/freetype/freetype.h +++ b/include/freetype/freetype.h @@ -1530,7 +1530,13 @@ FT_BEGIN_HEADER /* values of the corresponding fields in @FT_FaceRec. Some values */ /* like ascender or descender are rounded for historical reasons; */ /* more precise values (for outline fonts) can be derived by scaling */ - /* the corresponding @FT_FaceRec values manually. */ + /* the corresponding @FT_FaceRec values manually, with code similar */ + /* to the following. */ + /* */ + /* { */ + /* scaled_ascender = FT_MulFix( face->root.ascender, */ + /* size_metrics->y_scale ); */ + /* } */ /* */ /* Note that due to glyph hinting and the selected rendering mode */ /* these values are usually not exact; consequently, they must be */ From 134de096e07c4b700ccff5226fcfe4c90ae2ed04 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Wed, 12 Jul 2017 22:16:37 +0200 Subject: [PATCH 169/470] [base] Integer overflow. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2573 * src/base/ftobjs.c (ft_glyphslot_grid_fit_metrics): Use FT_PIX_CEIL_LONG and FT_PIX_ROUND_LONG. --- ChangeLog | 11 +++++++++++ src/base/ftobjs.c | 20 ++++++++++---------- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 708c71aac..d9bc844f4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2017-07-12 Werner Lemberg + + [base] Integer overflow. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2573 + + * src/base/ftobjs.c (ft_glyphslot_grid_fit_metrics): Use + FT_PIX_CEIL_LONG and FT_PIX_ROUND_LONG. + 2017-07-12 Werner Lemberg * src/truetype/ttpload.c (tt_face_get_location): Off-by-one typo. diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c index e190de3a3..1d8bc2d6c 100644 --- a/src/base/ftobjs.c +++ b/src/base/ftobjs.c @@ -579,12 +579,12 @@ if ( vertical ) { metrics->horiBearingX = FT_PIX_FLOOR( metrics->horiBearingX ); - metrics->horiBearingY = FT_PIX_CEIL ( metrics->horiBearingY ); + metrics->horiBearingY = FT_PIX_CEIL_LONG( metrics->horiBearingY ); - right = FT_PIX_CEIL( ADD_LONG( metrics->vertBearingX, - metrics->width ) ); - bottom = FT_PIX_CEIL( ADD_LONG( metrics->vertBearingY, - metrics->height ) ); + right = FT_PIX_CEIL_LONG( ADD_LONG( metrics->vertBearingX, + metrics->width ) ); + bottom = FT_PIX_CEIL_LONG( ADD_LONG( metrics->vertBearingY, + metrics->height ) ); metrics->vertBearingX = FT_PIX_FLOOR( metrics->vertBearingX ); metrics->vertBearingY = FT_PIX_FLOOR( metrics->vertBearingY ); @@ -599,13 +599,13 @@ metrics->vertBearingX = FT_PIX_FLOOR( metrics->vertBearingX ); metrics->vertBearingY = FT_PIX_FLOOR( metrics->vertBearingY ); - right = FT_PIX_CEIL ( ADD_LONG( metrics->horiBearingX, - metrics->width ) ); + right = FT_PIX_CEIL_LONG( ADD_LONG( metrics->horiBearingX, + metrics->width ) ); bottom = FT_PIX_FLOOR( SUB_LONG( metrics->horiBearingY, metrics->height ) ); metrics->horiBearingX = FT_PIX_FLOOR( metrics->horiBearingX ); - metrics->horiBearingY = FT_PIX_CEIL ( metrics->horiBearingY ); + metrics->horiBearingY = FT_PIX_CEIL_LONG( metrics->horiBearingY ); metrics->width = SUB_LONG( right, metrics->horiBearingX ); @@ -613,8 +613,8 @@ bottom ); } - metrics->horiAdvance = FT_PIX_ROUND( metrics->horiAdvance ); - metrics->vertAdvance = FT_PIX_ROUND( metrics->vertAdvance ); + metrics->horiAdvance = FT_PIX_ROUND_LONG( metrics->horiAdvance ); + metrics->vertAdvance = FT_PIX_ROUND_LONG( metrics->vertAdvance ); } #endif /* GRID_FIT_METRICS */ From fe0a7d9df5b45430b6a36627c857f0393c77fbb5 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Thu, 13 Jul 2017 10:25:42 +0200 Subject: [PATCH 170/470] [base] Fix memory leak. Reported as https://bugs.chromium.org/p/chromium/issues/detail?id=738362 * src/base/ftglyph.c (FT_Get_Glyph): Do proper deallocation in case of error. --- ChangeLog | 11 +++++++++++ src/base/ftglyph.c | 7 +++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index d9bc844f4..56168da4c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2017-07-13 Werner Lemberg + + [base] Fix memory leak. + + Reported as + + https://bugs.chromium.org/p/chromium/issues/detail?id=738362 + + * src/base/ftglyph.c (FT_Get_Glyph): Do proper deallocation in case + of error. + 2017-07-12 Werner Lemberg [base] Integer overflow. diff --git a/src/base/ftglyph.c b/src/base/ftglyph.c index 62d94cbd3..3f78a8c36 100644 --- a/src/base/ftglyph.c +++ b/src/base/ftglyph.c @@ -412,13 +412,15 @@ slot->advance.x <= -0x8000L * 64 ) { FT_ERROR(( "FT_Get_Glyph: advance width too large\n" )); - return FT_THROW( Invalid_Argument ); + error = FT_THROW( Invalid_Argument ); + goto Exit2; } if ( slot->advance.y >= 0x8000L * 64 || slot->advance.y <= -0x8000L * 64 ) { FT_ERROR(( "FT_Get_Glyph: advance height too large\n" )); - return FT_THROW( Invalid_Argument ); + error = FT_THROW( Invalid_Argument ); + goto Exit2; } glyph->advance.x = slot->advance.x * 1024; @@ -427,6 +429,7 @@ /* now import the image from the glyph slot */ error = clazz->glyph_init( glyph, slot ); + Exit2: /* if an error occurred, destroy the glyph */ if ( error ) FT_Done_Glyph( glyph ); From 38bdf22bfe68432aebdd33c198a0bd11b4ebb96f Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Thu, 13 Jul 2017 10:28:09 +0200 Subject: [PATCH 171/470] [truetype] Improve code comment. --- src/truetype/ttobjs.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/truetype/ttobjs.c b/src/truetype/ttobjs.c index 4db0f289f..53e402be1 100644 --- a/src/truetype/ttobjs.c +++ b/src/truetype/ttobjs.c @@ -1230,7 +1230,9 @@ /* */ /* size :: A handle to the target size object. */ /* */ - /* only_height :: Only recompute ascender, descender, and height. */ + /* only_height :: Only recompute ascender, descender, and height; */ + /* this flag is used for variation fonts where */ + /* `tt_size_reset' is used as an iterator function. */ /* */ FT_LOCAL_DEF( FT_Error ) tt_size_reset( TT_Size size, @@ -1277,7 +1279,11 @@ size->ttmetrics.valid = TRUE; if ( only_height ) + { + /* we must not recompute the scaling values here since */ + /* `tt_size_reset' was already called (with only_height = 0) */ return FT_Err_Ok; + } if ( face->header.Flags & 8 ) { From 933f4cbe792b777b826282dba9e55edb7b22a14d Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Wed, 26 Jul 2017 23:32:32 +0200 Subject: [PATCH 172/470] [cff] Integer overflow. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2738 * src/cff/cf2hints.c (cf2_glyphpath_computeOffset, cf2_glyphpath_curveTo): Use ADD_INT32. --- ChangeLog | 11 +++++++++++ src/cff/cf2hints.c | 10 ++++++---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 56168da4c..375975eae 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2017-07-26 Werner Lemberg + + [cff] Integer overflow. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2738 + + * src/cff/cf2hints.c (cf2_glyphpath_computeOffset, + cf2_glyphpath_curveTo): Use ADD_INT32. + 2017-07-13 Werner Lemberg [base] Fix memory leak. diff --git a/src/cff/cf2hints.c b/src/cff/cf2hints.c index e0f2cc91c..656eb2cff 100644 --- a/src/cff/cf2hints.c +++ b/src/cff/cf2hints.c @@ -1489,8 +1489,9 @@ return; /* add momentum for this path element */ - glyphpath->callbacks->windingMomentum += - cf2_getWindingMomentum( x1, y1, x2, y2 ); + glyphpath->callbacks->windingMomentum = + ADD_INT32( glyphpath->callbacks->windingMomentum, + cf2_getWindingMomentum( x1, y1, x2, y2 ) ); /* note: allow mixed integer and fixed multiplication here */ if ( dx >= 0 ) @@ -1778,8 +1779,9 @@ &yOffset3 ); /* add momentum from the middle segment */ - glyphpath->callbacks->windingMomentum += - cf2_getWindingMomentum( x1, y1, x2, y2 ); + glyphpath->callbacks->windingMomentum = + ADD_INT32( glyphpath->callbacks->windingMomentum, + cf2_getWindingMomentum( x1, y1, x2, y2 ) ); /* construct offset points */ P0.x = ADD_INT32( glyphpath->currentCS.x, xOffset1 ); From ce367774d20072018d46bfe26f7c7b823dfad79c Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Tue, 1 Aug 2017 08:24:51 +0200 Subject: [PATCH 173/470] [sfnt, truetype] Minor adjustments for OpenType 1.8.2. * src/sfnt/sfobjs.c (sfnt_load_face): The units per EM value has now (tighter) limits. * src/truetype/ttgload.c (load_truetype_glyph): The new OpenType version explicitly allows all negative values for the number of contours if we have a composite glyph (this is for better backwards compatibility I guess), but it still recommends value -1. --- ChangeLog | 12 ++++++++++++ src/sfnt/sfobjs.c | 5 ++++- src/truetype/ttgload.c | 11 ++++------- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 375975eae..7f50f7133 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2017-08-01 Werner Lemberg + + [sfnt, truetype] Minor adjustments for OpenType 1.8.2. + + * src/sfnt/sfobjs.c (sfnt_load_face): The units per EM value has now + (tighter) limits. + + * src/truetype/ttgload.c (load_truetype_glyph): The new OpenType + version explicitly allows all negative values for the number of + contours if we have a composite glyph (this is for better backwards + compatibility I guess), but it still recommends value -1. + 2017-07-26 Werner Lemberg [cff] Integer overflow. diff --git a/src/sfnt/sfobjs.c b/src/sfnt/sfobjs.c index 152690878..58f67c03e 100644 --- a/src/sfnt/sfobjs.c +++ b/src/sfnt/sfobjs.c @@ -1224,7 +1224,10 @@ goto Exit; } - if ( face->header.Units_Per_EM == 0 ) + /* OpenType 1.8.2 introduced limits to this value; */ + /* however, they make sense for older SFNT fonts also */ + if ( face->header.Units_Per_EM < 16 || + face->header.Units_Per_EM > 16384 ) { error = FT_THROW( Invalid_Table ); diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c index d1351e795..086ebca52 100644 --- a/src/truetype/ttgload.c +++ b/src/truetype/ttgload.c @@ -1686,7 +1686,7 @@ /***********************************************************************/ /* otherwise, load a composite! */ - else if ( loader->n_contours == -1 ) + else if ( loader->n_contours < 0 ) { FT_Memory memory = face->root.memory; @@ -1697,6 +1697,9 @@ FT_ListNode node, node2; + /* normalize the `n_contours' value */ + loader->n_contours = -1; + /* * We store the glyph index directly in the `node->data' pointer, * following the glib solution (cf. macro `GUINT_TO_POINTER') with a @@ -1991,12 +1994,6 @@ } } } - else - { - /* invalid composite count (negative but not -1) */ - error = FT_THROW( Invalid_Outline ); - goto Exit; - } /***********************************************************************/ /***********************************************************************/ From 55bbb98f5c5a89230127d6b998a6e23e634b5d0e Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 1 Aug 2017 09:17:02 +0200 Subject: [PATCH 174/470] [truetype] Fix loading of named instances. * src/truetype/ttgxvar.c (TT_Get_MM_Var): Preserve file position while loading the `avar' table. --- ChangeLog | 7 +++++++ include/freetype/ftmm.h | 2 +- src/truetype/ttgxvar.c | 11 ++++++++++- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7f50f7133..a04fddd20 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2017-08-01 Behdad Esfahbod + + [truetype] Fix loading of named instances. + + * src/truetype/ttgxvar.c (TT_Get_MM_Var): Preserve file position + while loading the `avar' table. + 2017-08-01 Werner Lemberg [sfnt, truetype] Minor adjustments for OpenType 1.8.2. diff --git a/include/freetype/ftmm.h b/include/freetype/ftmm.h index c41b80ea6..1f48a4945 100644 --- a/include/freetype/ftmm.h +++ b/include/freetype/ftmm.h @@ -178,7 +178,7 @@ FT_BEGIN_HEADER /* strid :: The entry in `name' table identifying this instance. */ /* */ /* psid :: The entry in `name' table identifying a PostScript name */ - /* for this instance. */ + /* for this instance. Value 0 indicates a missing entry. */ /* */ typedef struct FT_Var_Named_Style_ { diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c index 68458362e..df42b3bfd 100644 --- a/src/truetype/ttgxvar.c +++ b/src/truetype/ttgxvar.c @@ -2139,8 +2139,16 @@ goto Exit; if ( fvar_head.instanceCount && !face->blend->avar_loaded ) + { + FT_ULong offset = FT_STREAM_POS(); + + ft_var_load_avar( face ); + if ( FT_STREAM_SEEK( offset ) ) + goto Exit; + } + ns = mmvar->namedstyle; nsc = face->blend->normalized_stylecoords; for ( i = 0; i < fvar_head.instanceCount; i++, ns++ ) @@ -2157,6 +2165,7 @@ for ( j = 0; j < fvar_head.axisCount; j++, c++ ) *c = FT_GET_LONG(); + /* valid psid values are 6 and [256;32767] */ if ( usePsName ) ns->psid = FT_GET_USHORT(); @@ -2174,7 +2183,7 @@ SFNT_Service sfnt = (SFNT_Service)face->sfnt; FT_Int found, dummy1, dummy2; - FT_UInt strid = 0xFFFFFFFFUL; + FT_UInt strid = ~0U; /* the default instance is missing in array the */ From e6b9b6bafccfc6fb0d85925f9ac444b25b351a5f Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Tue, 1 Aug 2017 09:34:24 +0200 Subject: [PATCH 175/470] Update CHANGES file. --- docs/CHANGES | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/docs/CHANGES b/docs/CHANGES index ae5bb2f0e..cea3f27c9 100644 --- a/docs/CHANGES +++ b/docs/CHANGES @@ -1,4 +1,22 @@ +CHANGES BETWEEN 2.8 and 2.8.1 + + I. IMPORTANT BUG FIXES + + - B/W hinting of TrueType fonts didn't work properly if + interpreter version 38 or 40 was selected. + + - Some severe problems within the handling of TrueType Variation + Fonts were found and fixed. + + + II. MISCELLANEOUS + + - More sanity checks. + + +====================================================================== + CHANGES BETWEEN 2.7.1 and 2.8 I. IMPORTANT CHANGES From 7e50824288fac5a36c2938fdb3e1c949ea53f982 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Tue, 1 Aug 2017 12:44:35 +0200 Subject: [PATCH 176/470] * src/truetype/ttgxvar.c (TT_Get_MM_Var): Fix thinko. --- ChangeLog | 4 ++++ include/freetype/ftmm.h | 3 ++- src/truetype/ttgxvar.c | 4 +++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index a04fddd20..3843d48a2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2017-08-01 Werner Lemberg + + * src/truetype/ttgxvar.c (TT_Get_MM_Var): Fix thinko. + 2017-08-01 Behdad Esfahbod [truetype] Fix loading of named instances. diff --git a/include/freetype/ftmm.h b/include/freetype/ftmm.h index 1f48a4945..b1bc1ed82 100644 --- a/include/freetype/ftmm.h +++ b/include/freetype/ftmm.h @@ -178,7 +178,8 @@ FT_BEGIN_HEADER /* strid :: The entry in `name' table identifying this instance. */ /* */ /* psid :: The entry in `name' table identifying a PostScript name */ - /* for this instance. Value 0 indicates a missing entry. */ + /* for this instance. Value 0xFFFF indicates a missing */ + /* entry. */ /* */ typedef struct FT_Var_Named_Style_ { diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c index df42b3bfd..5a87df139 100644 --- a/src/truetype/ttgxvar.c +++ b/src/truetype/ttgxvar.c @@ -2165,9 +2165,11 @@ for ( j = 0; j < fvar_head.axisCount; j++, c++ ) *c = FT_GET_LONG(); - /* valid psid values are 6 and [256;32767] */ + /* valid psid values are 6, [256;32767], and 0xFFFF */ if ( usePsName ) ns->psid = FT_GET_USHORT(); + else + ns->psid = 0xFFFF; ft_var_to_normalized( face, fvar_head.axisCount, From 7f44c2db247bdbaea4b369f214fde9614737196e Mon Sep 17 00:00:00 2001 From: Nikolaus Waxweiler Date: Thu, 3 Aug 2017 06:15:30 +0200 Subject: [PATCH 177/470] [truetype] Do not set any ClearType flags in v40 monochrome mode. This fixes weird behavior of instructions that resulted in rendering differences between v35 and v40 in monochrome mode, e.g., in `timesbi.ttf'. * src/truetype/ttinterp.c (Ins_GETINFO) [TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL]: Check `subpixel_hinting_lean'. --- ChangeLog | 12 ++++++++++++ src/truetype/ttinterp.c | 6 +++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 3843d48a2..eac89db8b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2017-08-03 Nikolaus Waxweiler + + [truetype] Do not set any ClearType flags in v40 monochrome mode. + + This fixes weird behavior of instructions that resulted in rendering + differences between v35 and v40 in monochrome mode, e.g., in + `timesbi.ttf'. + + * src/truetype/ttinterp.c (Ins_GETINFO) + [TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL]: Check + `subpixel_hinting_lean'. + 2017-08-01 Werner Lemberg * src/truetype/ttgxvar.c (TT_Get_MM_Var): Fix thinko. diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c index f8bf4af71..8636d5e3f 100644 --- a/src/truetype/ttinterp.c +++ b/src/truetype/ttinterp.c @@ -7357,7 +7357,11 @@ K |= 1 << 12; #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL - if ( SUBPIXEL_HINTING_MINIMAL ) + /* Toggle the following flags only outside of monochrome mode. */ + /* Otherwise, instructions may behave weirdly and rendering results */ + /* may differ between v35 and v40 mode, e.g., in `Times New Roman */ + /* Bold Italic'. */ + if ( SUBPIXEL_HINTING_MINIMAL && exc->subpixel_hinting_lean ) { /********************************/ /* HINTING FOR SUBPIXEL */ From 24e256ab005c68a3894845ef3b7764338f9442a4 Mon Sep 17 00:00:00 2001 From: Nikolaus Waxweiler Date: Fri, 4 Aug 2017 08:25:31 +0200 Subject: [PATCH 178/470] [truetype] Fix metrics of B/W hinting in v40 mode. Phantom points are now saved outside v40 backwards compatibility mode. This fixes the jumping glyphs when switching between v35 and v40 monochrome mode. * src/truetype/ttgload.c (TT_Hint_Glyph): Fix inversed bool logic. --- ChangeLog | 10 ++++++++++ src/truetype/ttgload.c | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index eac89db8b..6243e18ba 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2017-08-03 Nikolaus Waxweiler + + [truetype] Fix metrics of B/W hinting in v40 mode. + + Phantom points are now saved outside v40 backwards compatibility + mode. This fixes the jumping glyphs when switching between v35 and + v40 monochrome mode. + + * src/truetype/ttgload.c (TT_Hint_Glyph): Fix inversed bool logic. + 2017-08-03 Nikolaus Waxweiler [truetype] Do not set any ClearType flags in v40 monochrome mode. diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c index 086ebca52..bfda76175 100644 --- a/src/truetype/ttgload.c +++ b/src/truetype/ttgload.c @@ -825,7 +825,7 @@ /* compatibility mode, where no movement on the x axis means no reason */ /* to change bearings or advance widths. */ if ( !( driver->interpreter_version == TT_INTERPRETER_VERSION_40 && - !loader->exec->backward_compatibility ) ) + loader->exec->backward_compatibility ) ) { #endif loader->pp1 = zone->cur[zone->n_points - 4]; From f43b3094ef9eec177caafdbc4e73a14be000d127 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sat, 5 Aug 2017 18:22:17 +0200 Subject: [PATCH 179/470] [base, truetype] New function `FT_Get_Var_Axis_Flags'. The reserved `flags' field got a value in OpenType version 1.8.2; unfortunately, the public `FT_Var_Axis' structure misses the corresponding element. Since we can't add a new field, we add an access function. * src/base/ftmm.c (FT_Get_Var_Axis_Flags): New function. * include/freetype/ftmm.h (FT_VAR_AXIS_FLAG_HIDDEN): New macro. Updated. * src/truetype/ttgxvar.c (TT_Get_MM_Var): Increase allocated memory of `mmvar' to hold axis flags. Fill the axis flags array. * docs/CHANGES: Updated. --- ChangeLog | 20 ++++++++++++++++++ docs/CHANGES | 4 ++++ include/freetype/ftmm.h | 46 ++++++++++++++++++++++++++++++++++++++++- src/base/ftmm.c | 24 +++++++++++++++++++++ src/truetype/ttgxvar.c | 45 ++++++++++++++++++++++++++-------------- 5 files changed, 123 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6243e18ba..30f18b73c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,23 @@ +2017-08-05 Werner Lemberg + + [base, truetype] New function `FT_Get_Var_Axis_Flags'. + + The reserved `flags' field got a value in OpenType version 1.8.2; + unfortunately, the public `FT_Var_Axis' structure misses the + corresponding element. Since we can't add a new field, we add an + access function. + + * src/base/ftmm.c (FT_Get_Var_Axis_Flags): New function. + + * include/freetype/ftmm.h (FT_VAR_AXIS_FLAG_HIDDEN): New macro. + Updated. + + * src/truetype/ttgxvar.c (TT_Get_MM_Var): Increase allocated memory + of `mmvar' to hold axis flags. + Fill the axis flags array. + + * docs/CHANGES: Updated. + 2017-08-03 Nikolaus Waxweiler [truetype] Fix metrics of B/W hinting in v40 mode. diff --git a/docs/CHANGES b/docs/CHANGES index cea3f27c9..a62aab767 100644 --- a/docs/CHANGES +++ b/docs/CHANGES @@ -12,6 +12,10 @@ CHANGES BETWEEN 2.8 and 2.8.1 II. MISCELLANEOUS + - Using the new function `FT_Get_Var_Axis_Flags', an application + can access the `flags' field of a variation axis (introduced in + OpenType version 1.8.2) + - More sanity checks. diff --git a/include/freetype/ftmm.h b/include/freetype/ftmm.h index b1bc1ed82..b4c594189 100644 --- a/include/freetype/ftmm.h +++ b/include/freetype/ftmm.h @@ -196,7 +196,7 @@ FT_BEGIN_HEADER /* FT_MM_Var */ /* */ /* */ - /* A structure to model the axes and space of a Adobe MM, TrueType */ + /* A structure to model the axes and space of an Adobe MM, TrueType */ /* GX, or OpenType variation font. */ /* */ /* Some fields are specific to one format and not to the others. */ @@ -480,6 +480,50 @@ FT_BEGIN_HEADER FT_UInt num_coords, FT_Fixed* coords ); + + /*************************************************************************/ + /* */ + /* */ + /* FT_VAR_AXIS_FLAG_XXX */ + /* */ + /* */ + /* A list of bit flags used in the return value of */ + /* @FT_Get_Var_Axis_Flags. */ + /* */ + /* */ + /* FT_VAR_AXIS_FLAG_HIDDEN :: */ + /* The variation axis should not be exposed to user interfaces. */ + /* */ +#define FT_VAR_AXIS_FLAG_HIDDEN 1 + + + /*************************************************************************/ + /* */ + /* */ + /* FT_Get_Var_Axis_Flags */ + /* */ + /* */ + /* Get the `flags' field of an OpenType Variation Axis Record. */ + /* */ + /* Not meaningful for Adobe MM fonts (`*flags' is always zero). */ + /* */ + /* */ + /* master :: The variation descriptor. */ + /* */ + /* axis_index :: The index of the requested variation axis. */ + /* */ + /* */ + /* flags :: The `flags' field. See @FT_VAR_AXIS_FLAG_XXX for */ + /* possible values. */ + /* */ + /* */ + /* FreeType error code. 0~means success. */ + /* */ + FT_EXPORT( FT_Error ) + FT_Get_Var_Axis_Flags( FT_MM_Var* master, + FT_UInt axis_index, + FT_UInt* flags ); + /* */ diff --git a/src/base/ftmm.c b/src/base/ftmm.c index 2cb56a39b..c8450087b 100644 --- a/src/base/ftmm.c +++ b/src/base/ftmm.c @@ -402,4 +402,28 @@ } + /* documentation is in ftmm.h */ + + FT_EXPORT_DEF( FT_Error ) + FT_Get_Var_Axis_Flags( FT_MM_Var* master, + FT_UInt axis_index, + FT_UInt* flags ) + { + FT_UShort* axis_flags; + + + if ( !master || !flags ) + return FT_THROW( Invalid_Argument ); + + if ( axis_index >= master->num_axis ) + return FT_THROW( Invalid_Argument ); + + /* the axis flags array immediately follows the data of `master' */ + axis_flags = (FT_UShort*)&( master[1] ); + *flags = axis_flags[axis_index]; + + return FT_Err_Ok; + } + + /* END */ diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c index 5a87df139..49aa53a68 100644 --- a/src/truetype/ttgxvar.c +++ b/src/truetype/ttgxvar.c @@ -395,14 +395,14 @@ /* some macros we need */ - #define FT_FIXED_ONE ( (FT_Fixed)0x10000 ) +#define FT_FIXED_ONE ( (FT_Fixed)0x10000 ) - #define FT_fdot14ToFixed( x ) \ - ( (FT_Fixed)( (FT_ULong)(x) << 2 ) ) - #define FT_intToFixed( i ) \ - ( (FT_Fixed)( (FT_ULong)(i) << 16 ) ) - #define FT_fixedToInt( x ) \ - ( (FT_Short)( ( (FT_UInt32)(x) + 0x8000U ) >> 16 ) ) +#define FT_fdot14ToFixed( x ) \ + ( (FT_Fixed)( (FT_ULong)(x) << 2 ) ) +#define FT_intToFixed( i ) \ + ( (FT_Fixed)( (FT_ULong)(i) << 16 ) ) +#define FT_fixedToInt( x ) \ + ( (FT_Short)( ( (FT_UInt32)(x) + 0x8000U ) >> 16 ) ) static FT_Error @@ -1956,6 +1956,7 @@ GX_FVar_Head fvar_head; FT_Bool usePsName; FT_UInt num_instances; + FT_UShort* axis_flags; static const FT_Frame_Field fvar_fields[] = { @@ -2041,14 +2042,16 @@ /* in fvar's table of named instances */ num_instances = face->root.style_flags >> 16; - /* cannot overflow 32-bit arithmetic because of the size limits */ - /* used in the `fvar' table validity check in `sfnt_init_face' */ + /* prepare storage area for MM data; this cannot overflow */ + /* 32-bit arithmetic because of the size limits used in the */ + /* `fvar' table validity check in `sfnt_init_face' */ face->blend->mmvar_len = sizeof ( FT_MM_Var ) + + fvar_head.axisCount * sizeof ( FT_UShort ) + fvar_head.axisCount * sizeof ( FT_Var_Axis ) + num_instances * sizeof ( FT_Var_Named_Style ) + num_instances * fvar_head.axisCount * sizeof ( FT_Fixed ) + - 5 * fvar_head.axisCount; + fvar_head.axisCount * 5; if ( FT_ALLOC( mmvar, face->blend->mmvar_len ) ) goto Exit; @@ -2065,8 +2068,12 @@ /* (or tuples, as called by Apple) */ mmvar->num_namedstyles = num_instances; + + /* alas, no public field in `FT_Var_Axis' for axis flags */ + axis_flags = + (FT_UShort*)&( mmvar[1] ); mmvar->axis = - (FT_Var_Axis*)&( mmvar[1] ); + (FT_Var_Axis*)&( axis_flags[fvar_head.axisCount] ); mmvar->namedstyle = (FT_Var_Named_Style*)&( mmvar->axis[fvar_head.axisCount] ); @@ -2110,6 +2117,8 @@ a->name[3] = (FT_String)( ( a->tag ) & 0xFF ); a->name[4] = '\0'; + *axis_flags = axis_rec.flags; + if ( a->minimum > a->def || a->def > a->maximum ) { @@ -2121,13 +2130,17 @@ a->maximum = a->def; } - FT_TRACE5(( " \"%s\": minimum=%.5f, default=%.5f, maximum=%.5f\n", + FT_TRACE5(( " \"%s\":" + " minimum=%.5f, default=%.5f, maximum=%.5f," + " flags=0x%04X\n", a->name, a->minimum / 65536.0, a->def / 65536.0, - a->maximum / 65536.0 )); + a->maximum / 65536.0, + *axis_flags )); a++; + axis_flags++; } FT_TRACE5(( "\n" )); @@ -2244,13 +2257,15 @@ goto Exit; FT_MEM_COPY( mmvar, face->blend->mmvar, face->blend->mmvar_len ); + axis_flags = + (FT_UShort*)&( mmvar[1] ); mmvar->axis = - (FT_Var_Axis*)&( mmvar[1] ); + (FT_Var_Axis*)&( axis_flags[mmvar->num_axis] ); mmvar->namedstyle = (FT_Var_Named_Style*)&( mmvar->axis[mmvar->num_axis] ); + next_coords = (FT_Fixed*)&( mmvar->namedstyle[mmvar->num_namedstyles] ); - for ( n = 0; n < mmvar->num_namedstyles; n++ ) { mmvar->namedstyle[n].coords = next_coords; From 17196b7c747cf8a7309efda54c99a89d456f0512 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sat, 5 Aug 2017 18:58:34 +0200 Subject: [PATCH 180/470] [truetype] Integer overflow. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2868 * src/truetype/ttinterp.c (Ins_ALIGNRP): Use NEG_LONG. --- ChangeLog | 10 ++++++++++ src/truetype/ttinterp.c | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 30f18b73c..987d5734c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2017-06-27 Werner Lemberg + + [truetype] Integer overflow. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2868 + + * src/truetype/ttinterp.c (Ins_ALIGNRP): Use NEG_LONG. + 2017-08-05 Werner Lemberg [base, truetype] New function `FT_Get_Var_Axis_Flags'. diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c index 8636d5e3f..bc201554e 100644 --- a/src/truetype/ttinterp.c +++ b/src/truetype/ttinterp.c @@ -6421,7 +6421,7 @@ distance = PROJECT( exc->zp1.cur + point, exc->zp0.cur + exc->GS.rp0 ); - exc->func_move( exc, &exc->zp1, point, -distance ); + exc->func_move( exc, &exc->zp1, point, NEG_LONG( distance ) ); } exc->GS.loop--; From 986a21b73a775f47ba9518ef38e57bf4e6c9167a Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sun, 6 Aug 2017 06:35:19 +0200 Subject: [PATCH 181/470] CHANGES update suggested by Nikolaus. --- docs/CHANGES | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/CHANGES b/docs/CHANGES index a62aab767..6c99f4e9d 100644 --- a/docs/CHANGES +++ b/docs/CHANGES @@ -18,6 +18,11 @@ CHANGES BETWEEN 2.8 and 2.8.1 - More sanity checks. + - The internal representation of buffers for LCD rendering has + changed (to be more precise, the amount of padding gets computed + differently). Applications that use the FreeType API are not + affected. + ====================================================================== From a9d8e90cafbe0ecc55424162e109abf12d6c08b7 Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Tue, 8 Aug 2017 21:42:37 -0400 Subject: [PATCH 182/470] * src/sftnt/ttpost.c (format): Use otspec-compliant versions. --- ChangeLog | 4 ++++ src/sfnt/ttpost.c | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 987d5734c..9e4e4c2b6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2017-08-08 Alexei Podtelezhnikov + + * src/sftnt/ttpost.c (format): Use otspec-compliant versions. + 2017-06-27 Werner Lemberg [truetype] Integer overflow. diff --git a/src/sfnt/ttpost.c b/src/sfnt/ttpost.c index a47ece0ec..69929c8d4 100644 --- a/src/sfnt/ttpost.c +++ b/src/sfnt/ttpost.c @@ -407,7 +407,7 @@ /* now read postscript table */ if ( format == 0x00020000L ) error = load_format_20( face, stream, post_limit ); - else if ( format == 0x00028000L ) + else if ( format == 0x00025000L ) error = load_format_25( face, stream, post_limit ); else error = FT_THROW( Invalid_File_Format ); @@ -446,7 +446,7 @@ FT_FREE( table->glyph_names ); table->num_names = 0; } - else if ( format == 0x00028000L ) + else if ( format == 0x00025000L ) { TT_Post_25 table = &names->names.format_25; @@ -542,7 +542,7 @@ *PSname = (FT_String*)table->glyph_names[name_index - 258]; } } - else if ( format == 0x00028000L ) + else if ( format == 0x00025000L ) { TT_Post_25 table = &names->names.format_25; From 5710ef989da2be3db21d875ac48eb980564c052b Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Tue, 8 Aug 2017 22:00:35 -0400 Subject: [PATCH 183/470] * src/smooth/ftsmooth.c (ft_smooth_render_generic): Clean up. --- ChangeLog | 4 ++++ src/smooth/ftsmooth.c | 18 +++++------------- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9e4e4c2b6..d40137f49 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2017-08-08 Alexei Podtelezhnikov + + * src/smooth/ftsmooth.c (ft_smooth_render_generic): Clean up. + 2017-08-08 Alexei Podtelezhnikov * src/sftnt/ttpost.c (format): Use otspec-compliant versions. diff --git a/src/smooth/ftsmooth.c b/src/smooth/ftsmooth.c index fd12e666a..11a739aa8 100644 --- a/src/smooth/ftsmooth.c +++ b/src/smooth/ftsmooth.c @@ -106,9 +106,6 @@ FT_Pos y_shift = 0; FT_Pos x_left, y_top; FT_Pos width, height, pitch; -#ifndef FT_CONFIG_OPTION_SUBPIXEL_RENDERING - FT_Pos height_org, width_org; -#endif FT_Int hmul = ( mode == FT_RENDER_MODE_LCD ); FT_Int vmul = ( mode == FT_RENDER_MODE_LCD_V ); @@ -195,7 +192,7 @@ #ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING /* add minimal padding for LCD filter depending on specific weights */ - if ( lcd_filter_func) + if ( lcd_filter_func ) { if ( hmul ) { @@ -229,11 +226,6 @@ width = (FT_ULong)( cbox.xMax - cbox.xMin ) >> 6; height = (FT_ULong)( cbox.yMax - cbox.yMin ) >> 6; -#ifndef FT_CONFIG_OPTION_SUBPIXEL_RENDERING - width_org = width; - height_org = height; -#endif - pitch = width; if ( hmul ) { @@ -359,13 +351,13 @@ FT_UInt hh; - for ( hh = height_org; hh > 0; hh--, line += pitch ) + for ( hh = height; hh > 0; hh--, line += pitch ) { FT_UInt xx; FT_Byte* end = line + width; - for ( xx = width_org; xx > 0; xx-- ) + for ( xx = width / 3; xx > 0; xx-- ) { FT_UInt pixel = line[xx-1]; @@ -381,12 +373,12 @@ /* expand it vertically */ if ( vmul ) { - FT_Byte* read = bitmap->buffer + ( height - height_org ) * pitch; + FT_Byte* read = bitmap->buffer + ( height - height / 3 ) * pitch; FT_Byte* write = bitmap->buffer; FT_UInt hh; - for ( hh = height_org; hh > 0; hh-- ) + for ( hh = height / 3; hh > 0; hh-- ) { ft_memcpy( write, read, pitch ); write += pitch; From 410f3799b6a193e20b34c574e6f0f2be2428b1eb Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Thu, 9 Mar 2017 00:08:38 -0500 Subject: [PATCH 184/470] [smooth] Harmony LCD rendering. This is a new technology for LCD-optimized rendering. It capitalizes on the fact that each color channel grid is shifted by a third of a pixel. Therefore it is logical to render 3 separate monochrome bitmaps shifting the outline by 1/3 pixel, and then combine them. Importantly, the resulting output does not require additional LCD filtering. * src/smooth/ftsmooth.c (ft_smooth_render_generic) [!FT_CONFIG_OPTION_SUBPIXEL_RENDERING]: Implement new LCD-optimized rendering. * include/freetype/ftlcdfil.h, include/freetype/freetype.h, include/freetype/config/ftoption.h, devel/ftoption.h: Updated documentation. --- ChangeLog | 19 +++++ devel/ftoption.h | 21 ++--- include/freetype/config/ftoption.h | 19 ++--- include/freetype/freetype.h | 12 +-- include/freetype/ftlcdfil.h | 19 +++-- src/smooth/ftsmooth.c | 133 ++++++++++++++++++++--------- 6 files changed, 148 insertions(+), 75 deletions(-) diff --git a/ChangeLog b/ChangeLog index d40137f49..6c648549f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,22 @@ +2017-08-08 Alexei Podtelezhnikov + + [smooth] Harmony LCD rendering. + + This is a new technology for LCD-optimized rendering. It capitalizes + on the fact that each color channel grid is shifted by a third of a + pixel. Therefore it is logical to render 3 separate monochrome + bitmaps shifting the outline by 1/3 pixel, and then combine them. + Importantly, the resulting output does not require additional LCD + filtering. + + * src/smooth/ftsmooth.c (ft_smooth_render_generic) + [!FT_CONFIG_OPTION_SUBPIXEL_RENDERING]: Implement new LCD-optimized + rendering. + + * include/freetype/ftlcdfil.h, include/freetype/freetype.h, + include/freetype/config/ftoption.h, devel/ftoption.h: Updated + documentation. + 2017-08-08 Alexei Podtelezhnikov * src/smooth/ftsmooth.c (ft_smooth_render_generic): Clean up. diff --git a/devel/ftoption.h b/devel/ftoption.h index a690ea2d0..9f9cac129 100644 --- a/devel/ftoption.h +++ b/devel/ftoption.h @@ -107,22 +107,19 @@ FT_BEGIN_HEADER /*************************************************************************/ /* */ - /* Uncomment the line below if you want to activate sub-pixel rendering */ - /* (a.k.a. LCD rendering, or ClearType) in this build of the library. */ + /* Uncomment the line below if you want to activate LCD rendering */ + /* technology similar to ClearType in this build of the library. This */ + /* technology triples the resolution in the direction color subpixels. */ + /* To mitigate color fringes inherent to this technology, you also need */ + /* to explicitly set up LCD filtering. */ /* */ /* Note that this feature is covered by several Microsoft patents */ /* and should not be activated in any default build of the library. */ + /* When this macro is not defined, FreeType offers alternative LCD */ + /* rendering technology that produces excellent output without LCD */ + /* filtering. */ /* */ - /* 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 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. */ - /* */ -#define FT_CONFIG_OPTION_SUBPIXEL_RENDERING +/* #define FT_CONFIG_OPTION_SUBPIXEL_RENDERING */ /*************************************************************************/ diff --git a/include/freetype/config/ftoption.h b/include/freetype/config/ftoption.h index 935e20d8d..2fbe80b9b 100644 --- a/include/freetype/config/ftoption.h +++ b/include/freetype/config/ftoption.h @@ -107,20 +107,17 @@ FT_BEGIN_HEADER /*************************************************************************/ /* */ - /* Uncomment the line below if you want to activate sub-pixel rendering */ - /* (a.k.a. LCD rendering, or ClearType) in this build of the library. */ + /* Uncomment the line below if you want to activate LCD rendering */ + /* technology similar to ClearType in this build of the library. This */ + /* technology triples the resolution in the direction color subpixels. */ + /* To mitigate color fringes inherent to this technology, you also need */ + /* to explicitly set up LCD filtering. */ /* */ /* Note that this feature is covered by several Microsoft patents */ /* and should not be activated in any default build of the library. */ - /* */ - /* 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 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. */ + /* When this macro is not defined, FreeType offers alternative LCD */ + /* rendering technology that produces excellent output without LCD */ + /* filtering. */ /* */ /* #define FT_CONFIG_OPTION_SUBPIXEL_RENDERING */ diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h index 34ad48a48..a57fb35b9 100644 --- a/include/freetype/freetype.h +++ b/include/freetype/freetype.h @@ -3131,11 +3131,13 @@ FT_BEGIN_HEADER /* glyph outline in pixels and use the @FT_PIXEL_MODE_LCD_V mode. */ /* */ /* */ - /* The LCD-optimized glyph bitmaps produced by `FT_Render_Glyph' can */ - /* be filtered to reduce color-fringes by using */ - /* @FT_Library_SetLcdFilter (not active in the default builds). It */ - /* is up to the caller to either call `FT_Library_SetLcdFilter' (if */ - /* available) or do the filtering itself. */ + /* Should you define FT_CONFIG_OPTION_SUBPIXEL_RENDERING in your */ + /* `ftoption.h', which enables patented ClearType-style rendering, */ + /* the LCD-optimized glyph bitmaps should be filtered to reduce color */ + /* fringes inherent to this technology. You can either set up LCD */ + /* filtering with @FT_Library_SetLcdFilter or @FT_Face_Properties, */ + /* or do the filtering yourself. The default FreeType LCD rendering */ + /* technology does not require filtering. */ /* */ /* The selected render mode only affects vector glyphs of a font. */ /* Embedded bitmaps often have a different pixel mode like */ diff --git a/include/freetype/ftlcdfil.h b/include/freetype/ftlcdfil.h index 680bd90c8..bdaf9af90 100644 --- a/include/freetype/ftlcdfil.h +++ b/include/freetype/ftlcdfil.h @@ -44,9 +44,16 @@ FT_BEGIN_HEADER * Reduce color fringes of subpixel-rendered bitmaps. * * @description: - * Subpixel rendering exploits the color-striped structure of LCD - * pixels, increasing the available resolution in the direction of the - * stripe (usually horizontal RGB) by a factor of~3. Since these + * Should you #define FT_CONFIG_OPTION_SUBPIXEL_RENDERING in your + * `ftoption.h', which enables patented ClearType-style rendering, + * the LCD-optimized glyph bitmaps should be filtered to reduce color + * fringes inherent to this technology. The default FreeType LCD + * rendering uses different technology, and API described below, + * although available, does nothing. + * + * ClearType-style LCD rendering exploits the color-striped structure of + * LCD pixels, increasing the available resolution in the direction of + * the stripe (usually horizontal RGB) by a factor of~3. Since these * subpixels are color pixels, using them unfiltered creates severe * color fringes. Use the @FT_Library_SetLcdFilter API to specify a * low-pass filter, which is then applied to subpixel-rendered bitmaps @@ -54,12 +61,6 @@ FT_BEGIN_HEADER * the higher resolution to reduce color fringes, making the glyph image * slightly blurrier. Positional improvements will remain. * - * Note that no filter is active by default, and that this function is - * *not* implemented in default builds of the library. You need to - * #define FT_CONFIG_OPTION_SUBPIXEL_RENDERING in your `ftoption.h' file - * in order to activate it and explicitly call @FT_Library_SetLcdFilter - * to enable it. - * * A filter should have two properties: * * 1) It should be normalized, meaning the sum of the 5~components diff --git a/src/smooth/ftsmooth.c b/src/smooth/ftsmooth.c index 11a739aa8..4b81d3441 100644 --- a/src/smooth/ftsmooth.c +++ b/src/smooth/ftsmooth.c @@ -190,7 +190,23 @@ /* taking into account the origin shift */ FT_Outline_Get_CBox( outline, &cbox ); -#ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING +#ifndef FT_CONFIG_OPTION_SUBPIXEL_RENDERING + + /* add minimal padding for LCD rendering */ + if ( hmul ) + { + cbox.xMax += 21; + cbox.xMin -= 21; + } + + if ( vmul ) + { + cbox.yMax += 21; + cbox.yMin -= 21; + } + +#else /* FT_CONFIG_OPTION_SUBPIXEL_RENDERING */ + /* add minimal padding for LCD filter depending on specific weights */ if ( lcd_filter_func ) { @@ -210,7 +226,8 @@ : lcd_weights[1] ? 22 : 0; } } -#endif + +#endif /* FT_CONFIG_OPTION_SUBPIXEL_RENDERING */ cbox.xMin = FT_PIX_FLOOR( cbox.xMin + x_shift ); cbox.yMin = FT_PIX_FLOOR( cbox.yMin + y_shift ); @@ -339,57 +356,97 @@ #else /* !FT_CONFIG_OPTION_SUBPIXEL_RENDERING */ - /* render outline into bitmap */ - error = render->raster_render( render->raster, ¶ms ); - if ( error ) - goto Exit; - - /* expand it horizontally */ - if ( hmul ) + if ( hmul ) /* lcd */ { - FT_Byte* line = bitmap->buffer; - FT_UInt hh; + FT_Byte* line; + FT_Byte* temp; + FT_Int i, j; + /* Render 3 separate monochrome bitmaps, shifting the outline */ + /* by 1/3 pixel. */ + width /= 3; - for ( hh = height; hh > 0; hh--, line += pitch ) - { - FT_UInt xx; - FT_Byte* end = line + width; + FT_Outline_Translate( outline, 21, 0 ); + error = render->raster_render( render->raster, ¶ms ); + if ( error ) + goto Exit; - for ( xx = width / 3; xx > 0; xx-- ) - { - FT_UInt pixel = line[xx-1]; + FT_Outline_Translate( outline, -21, 0 ); + bitmap->buffer += width; + error = render->raster_render( render->raster, ¶ms ); + if ( error ) + goto Exit; - end[-3] = (FT_Byte)pixel; - end[-2] = (FT_Byte)pixel; - end[-1] = (FT_Byte)pixel; - end -= 3; + FT_Outline_Translate( outline, -21, 0 ); + bitmap->buffer += width; + + error = render->raster_render( render->raster, ¶ms ); + if ( error ) + goto Exit; + + FT_Outline_Translate( outline, 21, 0 ); + bitmap->buffer -= 2 * width; + + /* XXX: Rearrange the bytes according to FT_PIXEL_MODE_LCD. */ + /* XXX: It is more efficient to render every third byte above. */ + + if ( FT_ALLOC( temp, (FT_ULong)pitch ) ) + goto Exit; + + for ( i = 0; i < height; i++ ) + { + line = bitmap->buffer + i * pitch; + for ( j = 0; j < width; j++ ) + { + temp[3 * j ] = line[j]; + temp[3 * j + 1] = line[j + width]; + temp[3 * j + 2] = line[j + width + width]; } + FT_MEM_COPY( line, temp, pitch ); } - } - /* expand it vertically */ - if ( vmul ) + FT_FREE( temp ); + } + else if ( vmul ) /* lcd_v */ { - FT_Byte* read = bitmap->buffer + ( height - height / 3 ) * pitch; - FT_Byte* write = bitmap->buffer; - FT_UInt hh; + /* Render 3 separate monochrome bitmaps, shifting the outline */ + /* by 1/3 pixel. Triple the pitch to render on each third row. */ + bitmap->pitch *= 3; + bitmap->rows /= 3; + FT_Outline_Translate( outline, 0, 21 ); + bitmap->buffer += 2 * pitch; - for ( hh = height / 3; hh > 0; hh-- ) - { - ft_memcpy( write, read, pitch ); - write += pitch; + error = render->raster_render( render->raster, ¶ms ); + if ( error ) + goto Exit; - ft_memcpy( write, read, pitch ); - write += pitch; + FT_Outline_Translate( outline, 0, -21 ); + bitmap->buffer -= pitch; - ft_memcpy( write, read, pitch ); - write += pitch; - read += pitch; - } + error = render->raster_render( render->raster, ¶ms ); + if ( error ) + goto Exit; + + FT_Outline_Translate( outline, 0, -21 ); + bitmap->buffer -= pitch; + + error = render->raster_render( render->raster, ¶ms ); + if ( error ) + goto Exit; + + FT_Outline_Translate( outline, 0, 21 ); + + bitmap->pitch /= 3; + bitmap->rows *= 3; + } + else /* grayscale */ + { + error = render->raster_render( render->raster, ¶ms ); + if ( error ) + goto Exit; } #endif /* !FT_CONFIG_OPTION_SUBPIXEL_RENDERING */ From c87fec0299533fee9b20505a4955c7f2f5c5bed7 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Wed, 9 Aug 2017 07:45:12 +0200 Subject: [PATCH 185/470] [psnames] Really fix issue #49949. We now use a separate preprocessor macro to handle both definition and declaration of the glyph name arrays. * src/psnames/psmodule.c (DEFINE_PS_TABLE_DATA): New macro. * src/tools/glnames.py (StringTable::dump, StringTable::dump_sublist): Use `DEFINE_PS_TABLE_DATA'. (dump_encoding): Ditto. (main): Use `wb' mode for writing the output file, which works on Windows also. * src/psnames/pstables.h: Regenerated. --- ChangeLog | 19 ++++++++++++++++++- src/psnames/psmodule.c | 13 +++++++++++++ src/psnames/pstables.h | 36 ++++++++++++++++++------------------ src/tools/glnames.py | 26 +++++++++++++------------- 4 files changed, 62 insertions(+), 32 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6c648549f..c512808d4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +2017-08-08 Werner Lemberg + + [psnames] Really fix issue #49949. + + We now use a separate preprocessor macro to handle both definition + and declaration of the glyph name arrays. + + * src/psnames/psmodule.c (DEFINE_PS_TABLE_DATA): New macro. + + * src/tools/glnames.py (StringTable::dump, + StringTable::dump_sublist): Use `DEFINE_PS_TABLE_DATA'. + (dump_encoding): Ditto. + (main): Use `wb' mode for writing the output file, which works on + Windows also. + + * src/psnames/pstables.h: Regenerated. + 2017-08-08 Alexei Podtelezhnikov [smooth] Harmony LCD rendering. @@ -25,7 +42,7 @@ * src/sftnt/ttpost.c (format): Use otspec-compliant versions. -2017-06-27 Werner Lemberg +2017-08-05 Werner Lemberg [truetype] Integer overflow. diff --git a/src/psnames/psmodule.c b/src/psnames/psmodule.c index 3ff8cb911..44ba9ec6a 100644 --- a/src/psnames/psmodule.c +++ b/src/psnames/psmodule.c @@ -23,8 +23,21 @@ #include "psmodule.h" + /* + * The file `pstables.h' with its arrays and its function + * `ft_get_adobe_glyph_index' is useful for other projects also (for + * example, `pdfium' is using it). However, if used as a C++ header, + * including it in two different source files makes it necessary to use + * `extern const' for the declaration of its arrays, otherwise the data + * would be duplicated as mandated by the C++ standard. + * + * For this reason, we use `DEFINE_PS_TABLES' to guard the function + * definitions, and `DEFINE_PS_TABLES_DATA' to provide both proper array + * declarations and definitions. + */ #include "pstables.h" #define DEFINE_PS_TABLES +#define DEFINE_PS_TABLES_DATA #include "pstables.h" #include "psnamerr.h" diff --git a/src/psnames/pstables.h b/src/psnames/pstables.h index e0f5e3080..2a2b717d8 100644 --- a/src/psnames/pstables.h +++ b/src/psnames/pstables.h @@ -19,7 +19,7 @@ /* This file has been generated automatically -- do not edit! */ -#ifndef DEFINE_PS_TABLES +#ifndef DEFINE_PS_TABLES_DATA #ifdef __cplusplus extern "C" #else @@ -27,7 +27,7 @@ #endif #endif const char ft_standard_glyph_names[3696] -#ifdef DEFINE_PS_TABLES +#ifdef DEFINE_PS_TABLES_DATA = { '.','n','u','l','l', 0, @@ -451,7 +451,7 @@ 'R','o','m','a','n', 0, 'S','e','m','i','b','o','l','d', 0, } -#endif /* DEFINE_PS_TABLES */ +#endif /* DEFINE_PS_TABLES_DATA */ ; @@ -459,7 +459,7 @@ /* Values are offsets into the `ft_standard_glyph_names' table */ -#ifndef DEFINE_PS_TABLES +#ifndef DEFINE_PS_TABLES_DATA #ifdef __cplusplus extern "C" #else @@ -467,7 +467,7 @@ #endif #endif const short ft_mac_names[FT_NUM_MAC_NAMES] -#ifdef DEFINE_PS_TABLES +#ifdef DEFINE_PS_TABLES_DATA = { 253, 0, 6, 261, 267, 274, 283, 294, 301, 309, 758, 330, 340, 351, @@ -490,7 +490,7 @@ 1270,1313,1323,1171,1290,1332,1211,1235,1276, 169, 175, 182, 189, 200, 209, 218, 225, 232, 239, 246 } -#endif /* DEFINE_PS_TABLES */ +#endif /* DEFINE_PS_TABLES_DATA */ ; @@ -498,7 +498,7 @@ /* Values are offsets into the `ft_standard_glyph_names' table */ -#ifndef DEFINE_PS_TABLES +#ifndef DEFINE_PS_TABLES_DATA #ifdef __cplusplus extern "C" #else @@ -506,7 +506,7 @@ #endif #endif const short ft_sid_names[FT_NUM_SID_NAMES] -#ifdef DEFINE_PS_TABLES +#ifdef DEFINE_PS_TABLES_DATA = { 253, 261, 267, 274, 283, 294, 301, 309, 319, 330, 340, 351, 360, 365, @@ -538,12 +538,12 @@ 3418,3430,3442,3454,3471,3483,3498,3506,3518,3530,3542,3559,3574,3586, 3597,3612,3620,3628,3636,3644,3650,3655,3660,3666,3673,3681,3687 } -#endif /* DEFINE_PS_TABLES */ +#endif /* DEFINE_PS_TABLES_DATA */ ; /* the following are indices into the SID name table */ -#ifndef DEFINE_PS_TABLES +#ifndef DEFINE_PS_TABLES_DATA #ifdef __cplusplus extern "C" #else @@ -551,7 +551,7 @@ #endif #endif const unsigned short t1_standard_encoding[256] -#ifdef DEFINE_PS_TABLES +#ifdef DEFINE_PS_TABLES_DATA = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -571,12 +571,12 @@ 0,138, 0,139, 0, 0, 0, 0,140,141,142,143, 0, 0, 0, 0, 0,144, 0, 0, 0,145, 0, 0,146,147,148,149, 0, 0, 0, 0 } -#endif /* DEFINE_PS_TABLES */ +#endif /* DEFINE_PS_TABLES_DATA */ ; /* the following are indices into the SID name table */ -#ifndef DEFINE_PS_TABLES +#ifndef DEFINE_PS_TABLES_DATA #ifdef __cplusplus extern "C" #else @@ -584,7 +584,7 @@ #endif #endif const unsigned short t1_expert_encoding[256] -#ifdef DEFINE_PS_TABLES +#ifdef DEFINE_PS_TABLES_DATA = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -604,7 +604,7 @@ 347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362, 363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378 } -#endif /* DEFINE_PS_TABLES */ +#endif /* DEFINE_PS_TABLES_DATA */ ; @@ -619,7 +619,7 @@ #ifdef FT_CONFIG_OPTION_ADOBE_GLYPH_LIST -#ifndef DEFINE_PS_TABLES +#ifndef DEFINE_PS_TABLES_DATA #ifdef __cplusplus extern "C" #else @@ -627,7 +627,7 @@ #endif #endif const unsigned char ft_adobe_glyph_list[55997L] -#ifdef DEFINE_PS_TABLES +#ifdef DEFINE_PS_TABLES_DATA = { 0, 52, 0,106, 2,167, 3, 63, 4,220, 6,125, 9,143, 10, 23, @@ -4131,7 +4131,7 @@ 182,117, 2,218,167,218,178,232,233,242,225,231,225,238, 97,128, 48, 90,235,225,244,225,235,225,238, 97,128, 48,186 } -#endif /* DEFINE_PS_TABLES */ +#endif /* DEFINE_PS_TABLES_DATA */ ; diff --git a/src/tools/glnames.py b/src/tools/glnames.py index 9ed158862..3270eebb3 100644 --- a/src/tools/glnames.py +++ b/src/tools/glnames.py @@ -4920,7 +4920,7 @@ class StringTable: def dump( self, file ): write = file.write - write( "#ifndef DEFINE_PS_TABLES\n" ) + write( "#ifndef DEFINE_PS_TABLES_DATA\n" ) write( "#ifdef __cplusplus\n" ) write( ' extern "C"\n' ) write( "#else\n" ) @@ -4929,7 +4929,7 @@ class StringTable: write( "#endif\n" ) write( " const char " + self.master_table + "[" + repr( self.total ) + "]\n" ) - write( "#ifdef DEFINE_PS_TABLES\n" ) + write( "#ifdef DEFINE_PS_TABLES_DATA\n" ) write( " =\n" ) write( " {\n" ) @@ -4941,7 +4941,7 @@ class StringTable: write( line ) write( " }\n" ) - write( "#endif /* DEFINE_PS_TABLES */\n" ) + write( "#endif /* DEFINE_PS_TABLES_DATA */\n" ) write( " ;\n\n\n" ) def dump_sublist( self, file, table_name, macro_name, sublist ): @@ -4950,7 +4950,7 @@ class StringTable: write( " /* Values are offsets into the `" + self.master_table + "' table */\n\n" ) - write( "#ifndef DEFINE_PS_TABLES\n" ) + write( "#ifndef DEFINE_PS_TABLES_DATA\n" ) write( "#ifdef __cplusplus\n" ) write( ' extern "C"\n' ) write( "#else\n" ) @@ -4959,7 +4959,7 @@ class StringTable: write( "#endif\n" ) write( " const short " + table_name + "[" + macro_name + "]\n" ) - write( "#ifdef DEFINE_PS_TABLES\n" ) + write( "#ifdef DEFINE_PS_TABLES_DATA\n" ) write( " =\n" ) write( " {\n" ) @@ -4979,7 +4979,7 @@ class StringTable: write( line ) write( "\n" ) write( " }\n" ) - write( "#endif /* DEFINE_PS_TABLES */\n" ) + write( "#endif /* DEFINE_PS_TABLES_DATA */\n" ) write( " ;\n\n\n" ) @@ -5213,7 +5213,7 @@ def dump_encoding( file, encoding_name, encoding_list ): write = file.write write( " /* the following are indices into the SID name table */\n" ) - write( "#ifndef DEFINE_PS_TABLES\n" ) + write( "#ifndef DEFINE_PS_TABLES_DATA\n" ) write( "#ifdef __cplusplus\n" ) write( ' extern "C"\n' ) write( "#else\n" ) @@ -5222,7 +5222,7 @@ def dump_encoding( file, encoding_name, encoding_list ): write( "#endif\n" ) write( " const unsigned short " + encoding_name + "[" + repr( len( encoding_list ) ) + "]\n" ) - write( "#ifdef DEFINE_PS_TABLES\n" ) + write( "#ifdef DEFINE_PS_TABLES_DATA\n" ) write( " =\n" ) write( " {\n" ) @@ -5241,14 +5241,14 @@ def dump_encoding( file, encoding_name, encoding_list ): write( line ) write( "\n" ) write( " }\n" ) - write( "#endif /* DEFINE_PS_TABLES */\n" ) + write( "#endif /* DEFINE_PS_TABLES_DATA */\n" ) write( " ;\n\n\n" ) def dump_array( the_array, write, array_name ): """dumps a given encoding""" - write( "#ifndef DEFINE_PS_TABLES\n" ) + write( "#ifndef DEFINE_PS_TABLES_DATA\n" ) write( "#ifdef __cplusplus\n" ) write( ' extern "C"\n' ) write( "#else\n" ) @@ -5257,7 +5257,7 @@ def dump_array( the_array, write, array_name ): write( "#endif\n" ) write( " const unsigned char " + array_name + "[" + repr( len( the_array ) ) + "L]\n" ) - write( "#ifdef DEFINE_PS_TABLES\n" ) + write( "#ifdef DEFINE_PS_TABLES_DATA\n" ) write( " =\n" ) write( " {\n" ) @@ -5282,7 +5282,7 @@ def dump_array( the_array, write, array_name ): write( line ) write( "\n" ) write( " }\n" ) - write( "#endif /* DEFINE_PS_TABLES */\n" ) + write( "#endif /* DEFINE_PS_TABLES_DATA */\n" ) write( " ;\n\n\n" ) @@ -5293,7 +5293,7 @@ def main(): print __doc__ % sys.argv[0] sys.exit( 1 ) - file = open( sys.argv[1], "w\n" ) + file = open( sys.argv[1], "wb" ) write = file.write count_sid = len( sid_standard_names ) From f2e121ab11d1c9deb460d844d94f1d9fe6074f35 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Thu, 10 Aug 2017 12:56:50 +0200 Subject: [PATCH 186/470] [base] Minor API improvement for default variation axis setting. * src/base/ftmm.c (FT_Set_MM_Design_Coordinates, FT_Set_Var_Design_Coordinates, FT_Set_MM_Blend_Coordinates, FT_Set_Var_Blend_Coordinates): Allow coords==NULL if num_coords==0. * docs/CHANGES: Updated. --- ChangeLog | 10 ++++++++++ docs/CHANGES | 11 +++++++++++ include/freetype/ftmm.h | 15 +++++++++++++++ src/base/ftmm.c | 8 ++++---- 4 files changed, 40 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index c512808d4..7fc94e776 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2017-08-10 Werner Lemberg + + [base] Minor API improvement for default variation axis setting. + + * src/base/ftmm.c (FT_Set_MM_Design_Coordinates, + FT_Set_Var_Design_Coordinates, FT_Set_MM_Blend_Coordinates, + FT_Set_Var_Blend_Coordinates): Allow coords==NULL if num_coords==0. + + * docs/CHANGES: Updated. + 2017-08-08 Werner Lemberg [psnames] Really fix issue #49949. diff --git a/docs/CHANGES b/docs/CHANGES index 6c99f4e9d..592f6a457 100644 --- a/docs/CHANGES +++ b/docs/CHANGES @@ -9,6 +9,9 @@ CHANGES BETWEEN 2.8 and 2.8.1 - Some severe problems within the handling of TrueType Variation Fonts were found and fixed. + - Function `FT_Set_Var_Design_Coordinates' didn't correctly handle + the case with less input coordinates than axes. + II. MISCELLANEOUS @@ -23,6 +26,14 @@ CHANGES BETWEEN 2.8 and 2.8.1 differently). Applications that use the FreeType API are not affected. + - To reset all design axis values of a variation font to its + default values you can now say + + error = FT_Set_Var_Design_Coordinates( face, 0, NULL ); + + This also works with functions `FT_Set_MM_Design_Coordinates' + and `FT_Set_MM_Blend_Coordinates'. + ====================================================================== diff --git a/include/freetype/ftmm.h b/include/freetype/ftmm.h index b4c594189..80ac98d61 100644 --- a/include/freetype/ftmm.h +++ b/include/freetype/ftmm.h @@ -322,6 +322,11 @@ FT_BEGIN_HEADER /* */ /* FreeType error code. 0~means success. */ /* */ + /* */ + /* To reset all axes to the default values, call the function with */ + /* `num_coords' set to zero and `coords' set to NULL (new feature in */ + /* FreeType version 2.8.1). */ + /* */ FT_EXPORT( FT_Error ) FT_Set_MM_Design_Coordinates( FT_Face face, FT_UInt num_coords, @@ -352,6 +357,11 @@ FT_BEGIN_HEADER /* */ /* FreeType error code. 0~means success. */ /* */ + /* */ + /* To reset all axes to the default values, call the function with */ + /* `num_coords' set to zero and `coords' set to NULL (new feature in */ + /* FreeType version 2.8.1). */ + /* */ FT_EXPORT( FT_Error ) FT_Set_Var_Design_Coordinates( FT_Face face, FT_UInt num_coords, @@ -416,6 +426,11 @@ FT_BEGIN_HEADER /* */ /* FreeType error code. 0~means success. */ /* */ + /* */ + /* To reset all axes to the default values, call the function with */ + /* `num_coords' set to zero and `coords' set to NULL (new feature in */ + /* FreeType version 2.8.1). */ + /* */ FT_EXPORT( FT_Error ) FT_Set_MM_Blend_Coordinates( FT_Face face, FT_UInt num_coords, diff --git a/src/base/ftmm.c b/src/base/ftmm.c index c8450087b..43877ece4 100644 --- a/src/base/ftmm.c +++ b/src/base/ftmm.c @@ -158,7 +158,7 @@ /* check of `face' delayed to `ft_face_get_mm_service' */ - if ( !coords ) + if ( num_coords && !coords ) return FT_THROW( Invalid_Argument ); error = ft_face_get_mm_service( face, &service ); @@ -194,7 +194,7 @@ /* check of `face' delayed to `ft_face_get_mm_service' */ - if ( !coords ) + if ( num_coords && !coords ) return FT_THROW( Invalid_Argument ); error = ft_face_get_mm_service( face, &service_mm ); @@ -266,7 +266,7 @@ /* check of `face' delayed to `ft_face_get_mm_service' */ - if ( !coords ) + if ( num_coords && !coords ) return FT_THROW( Invalid_Argument ); error = ft_face_get_mm_service( face, &service_mm ); @@ -313,7 +313,7 @@ /* check of `face' delayed to `ft_face_get_mm_service' */ - if ( !coords ) + if ( num_coords && !coords ) return FT_THROW( Invalid_Argument ); error = ft_face_get_mm_service( face, &service_mm ); From e77ee789faaf5697143027452df6669afede0a57 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Fri, 11 Aug 2017 07:11:43 +0200 Subject: [PATCH 187/470] CHANGES: Minor update. --- docs/CHANGES | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/CHANGES b/docs/CHANGES index 592f6a457..b37dd1c4b 100644 --- a/docs/CHANGES +++ b/docs/CHANGES @@ -34,6 +34,9 @@ CHANGES BETWEEN 2.8 and 2.8.1 This also works with functions `FT_Set_MM_Design_Coordinates' and `FT_Set_MM_Blend_Coordinates'. + - FreeType now synthesizes a missing Unicode cmap for (older) + TrueType fonts also if glyph names are available. + ====================================================================== From b45043c44030337c1f7006f8c3d19fdfffe541f6 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Fri, 11 Aug 2017 09:34:20 +0200 Subject: [PATCH 188/470] [sfnt, truetype] Improve handling of missing sbits. Requested by Behdad. Modern bitmap-only SFNTs like `NotoColorEmoji.ttf' don't contain entries in the bitmap strike(s) for empty glyphs. Instead, they rely that a space glyph gets created from the font's metrics data. This commit makes FreeType behave accordingly. * include/freetype/fterrdef.h (FT_Err_Missing_Bitmap): New error code. * src/sfnt/ttsbit.c (tt_sbit_decoder_load_image): Change error codes to make a distinction between a missing bitmap in a composite and a simple missing bitmap. * src/truetype/ttgload.c (TT_Load_Glyph): For a missing bitmap (in a bitmap-only font), synthesize an empty bitmap glyph if metrics are available. --- ChangeLog | 22 +++++++++++++++ include/freetype/fterrdef.h | 2 ++ src/sfnt/ttsbit.c | 11 ++++++-- src/truetype/ttgload.c | 55 +++++++++++++++++++++++++++++++++++-- 4 files changed, 86 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7fc94e776..4091498f9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,25 @@ +2017-08-11 Werner Lemberg + + [sfnt, truetype] Improve handling of missing sbits. + + Requested by Behdad. + + Modern bitmap-only SFNTs like `NotoColorEmoji.ttf' don't contain + entries in the bitmap strike(s) for empty glyphs. Instead, they + rely that a space glyph gets created from the font's metrics data. + This commit makes FreeType behave accordingly. + + * include/freetype/fterrdef.h (FT_Err_Missing_Bitmap): New error + code. + + * src/sfnt/ttsbit.c (tt_sbit_decoder_load_image): Change error codes + to make a distinction between a missing bitmap in a composite and a + simple missing bitmap. + + * src/truetype/ttgload.c (TT_Load_Glyph): For a missing bitmap (in a + bitmap-only font), synthesize an empty bitmap glyph if metrics are + available. + 2017-08-10 Werner Lemberg [base] Minor API improvement for default variation axis setting. diff --git a/include/freetype/fterrdef.h b/include/freetype/fterrdef.h index cabbac827..6a6dc85b8 100644 --- a/include/freetype/fterrdef.h +++ b/include/freetype/fterrdef.h @@ -233,6 +233,8 @@ "invalid PostScript (post) table" ) FT_ERRORDEF_( DEF_In_Glyf_Bytecode, 0x9C, "found FDEF or IDEF opcode in glyf bytecode" ) + FT_ERRORDEF_( Missing_Bitmap, 0x9D, + "missing bitmap in strike" ) /* CFF, CID, and Type 1 errors */ diff --git a/src/sfnt/ttsbit.c b/src/sfnt/ttsbit.c index 59b2168bb..f41847b0a 100644 --- a/src/sfnt/ttsbit.c +++ b/src/sfnt/ttsbit.c @@ -1448,10 +1448,17 @@ return FT_THROW( Invalid_Table ); NoBitmap: + if ( recurse_count ) + { + FT_TRACE4(( "tt_sbit_decoder_load_image:" + " missing subglyph sbit with glyph index %d\n", + glyph_index )); + return FT_THROW( Invalid_Composite ); + } + FT_TRACE4(( "tt_sbit_decoder_load_image:" " no sbit found for glyph index %d\n", glyph_index )); - - return FT_THROW( Invalid_Argument ); + return FT_THROW( Missing_Bitmap ); } diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c index bfda76175..5e102c615 100644 --- a/src/truetype/ttgload.c +++ b/src/truetype/ttgload.c @@ -87,7 +87,7 @@ /*************************************************************************/ /* */ /* Return the vertical metrics in font units for a given glyph. */ - /* See macro `TT_LOADER_SET_PP' below for explanations. */ + /* See function `tt_loader_set_pp' below for explanations. */ /* */ FT_LOCAL_DEF( void ) TT_Get_VMetrics( TT_Face face, @@ -2625,7 +2625,58 @@ IS_DEFAULT_INSTANCE ) { error = load_sbit_image( size, glyph, glyph_index, load_flags ); - if ( error ) + if ( FT_ERR_EQ( error, Missing_Bitmap ) ) + { + /* the bitmap strike is incomplete and misses the requested glyph; */ + /* if we have a bitmap-only font, return an empty glyph */ + if ( !FT_IS_SCALABLE( glyph->face ) ) + { + TT_Face face = (TT_Face)glyph->face; + FT_Short left_bearing = 0, top_bearing = 0; + FT_UShort advance_width = 0, advance_height = 0; + + + /* to return an empty glyph, however, we need metrics data */ + /* from the `hmtx' (or `vmtx') table; the assumption is that */ + /* empty glyphs are missing intentionally, representing */ + /* whitespace - not having at least horizontal metrics is */ + /* thus considered an error */ + if ( !face->horz_metrics_size ) + return error; + + /* we now construct an empty bitmap glyph */ + TT_Get_HMetrics( face, glyph_index, + &left_bearing, + &advance_width ); + TT_Get_VMetrics( face, glyph_index, + 0, + &top_bearing, + &advance_height ); + + glyph->outline.n_points = 0; + glyph->outline.n_contours = 0; + + glyph->metrics.width = 0; + glyph->metrics.height = 0; + + glyph->metrics.horiBearingX = left_bearing; + glyph->metrics.horiBearingY = 0; + glyph->metrics.horiAdvance = advance_width; + + glyph->metrics.vertBearingX = 0; + glyph->metrics.vertBearingY = top_bearing; + glyph->metrics.vertAdvance = advance_height; + + glyph->format = FT_GLYPH_FORMAT_BITMAP; + glyph->bitmap.pixel_mode = FT_PIXEL_MODE_MONO; + + glyph->bitmap_left = 0; + glyph->bitmap_top = 0; + + return FT_Err_Ok; + } + } + else if ( error ) { /* return error if font is not scalable */ if ( !FT_IS_SCALABLE( glyph->face ) ) From 9f5783bb1a7999b79d6acb6185b8830fc240a089 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sun, 13 Aug 2017 09:40:18 +0200 Subject: [PATCH 189/470] Minor. --- builds/unix/configure.raw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builds/unix/configure.raw b/builds/unix/configure.raw index ef6debed4..b2bb16045 100644 --- a/builds/unix/configure.raw +++ b/builds/unix/configure.raw @@ -275,7 +275,7 @@ if test "x$GCC" = xyes; then } ])], - [AC_MSG_RESULT([ok, add it to XX_ANSIFLAGS]) + [AC_MSG_RESULT([ok, adding to XX_ANSIFLAGS]) XX_ANSIFLAGS="${XX_ANSIFLAGS} ${a}" ], [AC_MSG_RESULT([no])]) From 10ad11ab958ebddf0948af359122b13512e09ff1 Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Sun, 13 Aug 2017 23:08:39 -0400 Subject: [PATCH 190/470] Harmony CHANGES. --- docs/CHANGES | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/docs/CHANGES b/docs/CHANGES index b37dd1c4b..f3e4b062b 100644 --- a/docs/CHANGES +++ b/docs/CHANGES @@ -13,7 +13,18 @@ CHANGES BETWEEN 2.8 and 2.8.1 the case with less input coordinates than axes. - II. MISCELLANEOUS + II. IMPORTANT CHANGES + + - By default, FreeType now offers high quality LCD-optimized + output without resorting to ClearType techniques of resolution + tripling and filtering. In this method, called Harmony, each + color channel is generated separately after shifting the glyph + outline, capitalizing on the fact that the color grids on LCD + panels are shifted by a third of a pixel. This output is + indistinguishable from ClearType with a light 3-tap filter. + + + III. MISCELLANEOUS - Using the new function `FT_Get_Var_Axis_Flags', an application can access the `flags' field of a variation axis (introduced in From f53ccf6f8f3d1c5c717b0edd0529ef677c981f22 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Tue, 15 Aug 2017 07:17:42 +0200 Subject: [PATCH 191/470] Minor comment fix. --- include/freetype/ftmac.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/include/freetype/ftmac.h b/include/freetype/ftmac.h index ad97c6e4c..a1656eec0 100644 --- a/include/freetype/ftmac.h +++ b/include/freetype/ftmac.h @@ -35,11 +35,12 @@ FT_BEGIN_HEADER -/* gcc-3.4.1 and later can warn about functions tagged as deprecated */ + /* gcc-3.1 and later can warn about functions tagged as deprecated */ #ifndef FT_DEPRECATED_ATTRIBUTE -#if defined(__GNUC__) && \ - ((__GNUC__ >= 4) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1))) -#define FT_DEPRECATED_ATTRIBUTE __attribute__((deprecated)) +#if defined( __GNUC__ ) && \ + ( ( __GNUC__ >= 4 ) || \ + ( ( __GNUC__ == 3 ) && ( __GNUC_MINOR__ >= 1 ) ) ) +#define FT_DEPRECATED_ATTRIBUTE __attribute__(( deprecated )) #else #define FT_DEPRECATED_ATTRIBUTE #endif From c9d7c03fa1b5c6244759ade814c546da04080646 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 15 Aug 2017 08:48:17 +0200 Subject: [PATCH 192/470] [sfnt] Speed up PNG image loading. This reduces the overhead of `premultiply_data' by 60%. * src/sfnt/pngshim.c (premultiply_data): Provide code which uses gcc's (and clang's) `vector_byte' attribute to process 4 pixels at a time. --- ChangeLog | 10 +++++++++ src/sfnt/pngshim.c | 53 +++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 60 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4091498f9..06ea99e9e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2017-08-15 Behdad Esfahbod + + [sfnt] Speed up PNG image loading. + + This reduces the overhead of `premultiply_data' by 60%. + + * src/sfnt/pngshim.c (premultiply_data): Provide code which uses + gcc's (and clang's) `vector_byte' attribute to process 4 pixels at a + time. + 2017-08-11 Werner Lemberg [sfnt, truetype] Improve handling of missing sbits. diff --git a/src/sfnt/pngshim.c b/src/sfnt/pngshim.c index b9b296ea5..90a56699f 100644 --- a/src/sfnt/pngshim.c +++ b/src/sfnt/pngshim.c @@ -49,18 +49,65 @@ } - /* Premultiplies data and converts RGBA bytes => native endian. */ + /* Premultiplies data and converts RGBA bytes => BGRA. */ static void premultiply_data( png_structp png, png_row_infop row_info, png_bytep data ) { - unsigned int i; + unsigned int i = 0, limit; FT_UNUSED( png ); + /* the `vector_size' attribute was introduced in gcc 3.1, which */ + /* predates clang; the `__BYTE_ORDER__' preprocessor symbol was */ + /* introduced in gcc 4.6 and clang 3.2, respectively */ +#if ( ( defined( __GNUC__ ) && \ + ( ( __GNUC__ >= 5 ) || \ + ( ( __GNUC__ == 4 ) && ( __GNUC_MINOR__ >= 6 ) ) ) ) || \ + ( defined( __clang__ ) && \ + ( ( __clang_major__ >= 4 ) || \ + ( ( __clang_major__ == 3 ) && ( __clang_minor__ >= 2 ) ) ) ) ) && \ + defined( __OPTIMIZE__ ) && \ + __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ - for ( i = 0; i < row_info->rowbytes; i += 4 ) + typedef unsigned short v82 __attribute__(( vector_size( 16 ) )); + + + /* process blocks of 16 bytes in one rush, which gives a nice speed-up */ + limit = row_info->rowbytes - 16 + 1; + for ( ; i < limit; i += 16 ) + { + char* base = &data[i]; + + v82 s, s0, s1, a; + v82 ma = { 1, 1, 3, 3, 5, 5, 7, 7 }; + v82 o1 = { 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF }; + v82 m0 = { 1, 0, 3, 2, 5, 4, 7, 6 }; + + + memcpy( &s, base, 16 ); /* RGBA RGBA RGBA RGBA */ + s0 = s & 0xFF; /* R B R B R B R B */ + s1 = s >> 8; /* G A G A G A G A */ + + a = __builtin_shuffle( s1, ma ); /* A A A A A A A A */ + s1 |= o1; /* G 1 G 1 G 1 G 1 */ + s0 = __builtin_shuffle( s0, m0 ); /* B R B R B R B R */ + + s0 *= a; + s1 *= a; + s0 += 0x80; + s1 += 0x80; + s0 = ( s0 + ( s0 >> 8 ) ) >> 8; + s1 = ( s1 + ( s1 >> 8 ) ) >> 8; + + s = s0 | ( s1 << 8 ); + memcpy( base, &s, 16 ); + } +#endif /* use `vector_size' */ + + limit = row_info->rowbytes; + for ( ; i < limit; i += 4 ) { unsigned char* base = &data[i]; unsigned int alpha = base[3]; From cadd29de08abd1bba38d42a76efdb4971d45d01e Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Wed, 16 Aug 2017 13:32:17 +0200 Subject: [PATCH 193/470] * src/sfnt/pngshim.c (premultiply_data): Fix compiler warnings. --- ChangeLog | 4 ++++ src/sfnt/pngshim.c | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 06ea99e9e..ca92d3275 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2017-08-16 Werner Lemberg + + * src/sfnt/pngshim.c (premultiply_data): Fix compiler warnings. + 2017-08-15 Behdad Esfahbod [sfnt] Speed up PNG image loading. diff --git a/src/sfnt/pngshim.c b/src/sfnt/pngshim.c index 90a56699f..503ea4330 100644 --- a/src/sfnt/pngshim.c +++ b/src/sfnt/pngshim.c @@ -57,8 +57,6 @@ { unsigned int i = 0, limit; - FT_UNUSED( png ); - /* the `vector_size' attribute was introduced in gcc 3.1, which */ /* predates clang; the `__BYTE_ORDER__' preprocessor symbol was */ /* introduced in gcc 4.6 and clang 3.2, respectively */ @@ -78,7 +76,7 @@ limit = row_info->rowbytes - 16 + 1; for ( ; i < limit; i += 16 ) { - char* base = &data[i]; + unsigned char* base = &data[i]; v82 s, s0, s1, a; v82 ma = { 1, 1, 3, 3, 5, 5, 7, 7 }; @@ -106,6 +104,8 @@ } #endif /* use `vector_size' */ + FT_UNUSED( png ); + limit = row_info->rowbytes; for ( ; i < limit; i += 4 ) { From 7653c76533dcde3d87bd7af5a2c12e8c95412c12 Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Thu, 17 Aug 2017 21:28:32 -0400 Subject: [PATCH 194/470] [sfnt] Avoid synthetic unicode for symbol fonts with PUA. Reported as https://bugs.chromium.org/p/chromium/issues/detail?id=754574 * src/sfnt/sfobjs.c (sfnt_load_face): Check for FT_ENCODING_MS_SYMBOL. --- ChangeLog | 10 ++++++++++ src/sfnt/sfobjs.c | 3 ++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index ca92d3275..236842ee8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2017-08-17 Alexei Podtelezhnikov + + [sfnt] Avoid synthetic unicode for symbol fonts with PUA. + + Reported as + + https://bugs.chromium.org/p/chromium/issues/detail?id=754574 + + * src/sfnt/sfobjs.c (sfnt_load_face): Check for FT_ENCODING_MS_SYMBOL. + 2017-08-16 Werner Lemberg * src/sfnt/pngshim.c (premultiply_data): Fix compiler warnings. diff --git a/src/sfnt/sfobjs.c b/src/sfnt/sfobjs.c index 58f67c03e..289eeef7b 100644 --- a/src/sfnt/sfobjs.c +++ b/src/sfnt/sfobjs.c @@ -1492,7 +1492,8 @@ #ifdef FT_CONFIG_OPTION_POSTSCRIPT_NAMES - if ( charmap->encoding == FT_ENCODING_UNICODE ) + if ( charmap->encoding == FT_ENCODING_UNICODE || + charmap->encoding == FT_ENCODING_MS_SYMBOL ) /* PUA */ has_unicode = TRUE; } From 0aca17cf53f099f9ea34b3797949076073b60b5d Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Tue, 22 Aug 2017 08:25:14 +0200 Subject: [PATCH 195/470] [truetype] Integer overflow. Changes triggered by https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3107 * src/truetype/ttinterp.c (Ins_MDRP, Ins_MIRP, Ins_ALIGNPTS): Use NEG_LONG. --- ChangeLog | 11 +++++++++++ src/truetype/ttinterp.c | 15 +++++++++------ 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 236842ee8..10319520e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2017-08-22 Werner Lemberg + + [truetype] Integer overflow. + + Changes triggered by + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3107 + + * src/truetype/ttinterp.c (Ins_MDRP, Ins_MIRP, Ins_ALIGNPTS): Use + NEG_LONG. + 2017-08-17 Alexei Podtelezhnikov [sfnt] Avoid synthetic unicode for symbol fonts with PUA. diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c index bc201554e..ddcc839bb 100644 --- a/src/truetype/ttinterp.c +++ b/src/truetype/ttinterp.c @@ -6119,8 +6119,8 @@ } else { - if ( distance > -minimum_distance ) - distance = -minimum_distance; + if ( distance > NEG_LONG( minimum_distance ) ) + distance = NEG_LONG( minimum_distance ); } } @@ -6303,8 +6303,8 @@ } else { - if ( distance > -minimum_distance ) - distance = -minimum_distance; + if ( distance > NEG_LONG( minimum_distance ) ) + distance = NEG_LONG( minimum_distance ); } } @@ -6355,7 +6355,10 @@ } if ( reverse_move ) - exc->func_move( exc, &exc->zp1, point, -( distance - cur_dist ) ); + exc->func_move( exc, + &exc->zp1, + point, + SUB_LONG( cur_dist, distance ) ); } #endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */ @@ -6557,7 +6560,7 @@ distance = PROJECT( exc->zp0.cur + p2, exc->zp1.cur + p1 ) / 2; exc->func_move( exc, &exc->zp1, p1, distance ); - exc->func_move( exc, &exc->zp0, p2, -distance ); + exc->func_move( exc, &exc->zp0, p2, NEG_LONG( distance ) ); } From bd28952e23bcd268a623ea5202e1cde4a92defe4 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Tue, 22 Aug 2017 08:41:03 +0200 Subject: [PATCH 196/470] [base] Don't zero out allocated memory twice (#51816). Patch applied from bug report. * src/base/ftutil.c (ft_mem_qrealloc): Use low-level allocation to avoid unnecessary overhead. --- ChangeLog | 9 +++++++++ src/base/ftutil.c | 10 ++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 10319520e..c9bdca424 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2017-08-22 Werner Lemberg + + [base] Don't zero out allocated memory twice (#51816). + + Patch applied from bug report. + + * src/base/ftutil.c (ft_mem_qrealloc): Use low-level allocation to + avoid unnecessary overhead. + 2017-08-22 Werner Lemberg [truetype] Integer overflow. diff --git a/src/base/ftutil.c b/src/base/ftutil.c index dccc209f4..7bd5bee87 100644 --- a/src/base/ftutil.c +++ b/src/base/ftutil.c @@ -135,7 +135,7 @@ ft_mem_free( memory, block ); block = NULL; } - else if ( new_count > FT_INT_MAX/item_size ) + else if ( new_count > FT_INT_MAX / item_size ) { error = FT_THROW( Array_Too_Large ); } @@ -143,13 +143,15 @@ { FT_ASSERT( !block ); - block = ft_mem_alloc( memory, new_count*item_size, &error ); + block = memory->alloc( memory, new_count * item_size ); + if ( block == NULL ) + error = FT_THROW( Out_Of_Memory ); } else { FT_Pointer block2; - FT_Long cur_size = cur_count*item_size; - FT_Long new_size = new_count*item_size; + FT_Long cur_size = cur_count * item_size; + FT_Long new_size = new_count * item_size; block2 = memory->realloc( memory, cur_size, new_size, block ); From e1d0249e5aeb76fb0bd5b1b6a6ac71599be871bf Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Wed, 23 Aug 2017 08:18:22 +0200 Subject: [PATCH 197/470] [sfnt] Fix clang compilation (#51788). * src/sfnt/pngshim.c (premultiply_data): Use vectors instead of scalars. (vector_shuffle): New macro to take of a different built-in function name on clang. --- ChangeLog | 9 +++++++++ src/sfnt/pngshim.c | 34 +++++++++++++++++++++++++--------- 2 files changed, 34 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index c9bdca424..ffaf8f4a8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2017-08-23 Werner Lemberg + + [sfnt] Fix clang compilation (#51788). + + * src/sfnt/pngshim.c (premultiply_data): Use vectors instead of + scalars. + (vector_shuffle): New macro to take of a different built-in function + name on clang. + 2017-08-22 Werner Lemberg [base] Don't zero out allocated memory twice (#51816). diff --git a/src/sfnt/pngshim.c b/src/sfnt/pngshim.c index 503ea4330..b05c6de06 100644 --- a/src/sfnt/pngshim.c +++ b/src/sfnt/pngshim.c @@ -69,6 +69,15 @@ defined( __OPTIMIZE__ ) && \ __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ +#ifdef __clang__ + /* the clang documentation doesn't cover the two-argument case of */ + /* `__builtin_shufflevector'; however, it is is implemented since */ + /* version 2.8 */ +#define vector_shuffle __builtin_shufflevector +#else +#define vector_shuffle __builtin_shuffle +#endif + typedef unsigned short v82 __attribute__(( vector_size( 16 ) )); @@ -79,27 +88,34 @@ unsigned char* base = &data[i]; v82 s, s0, s1, a; + + /* clang <= 3.9 can't apply scalar values to vectors */ + /* (or rather, it needs a different syntax) */ + v82 n0x80 = { 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80 }; + v82 n0xFF = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; + v82 n8 = { 8, 8, 8, 8, 8, 8, 8, 8 }; + v82 ma = { 1, 1, 3, 3, 5, 5, 7, 7 }; v82 o1 = { 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF }; v82 m0 = { 1, 0, 3, 2, 5, 4, 7, 6 }; memcpy( &s, base, 16 ); /* RGBA RGBA RGBA RGBA */ - s0 = s & 0xFF; /* R B R B R B R B */ - s1 = s >> 8; /* G A G A G A G A */ + s0 = s & n0xFF; /* R B R B R B R B */ + s1 = s >> n8; /* G A G A G A G A */ - a = __builtin_shuffle( s1, ma ); /* A A A A A A A A */ + a = vector_shuffle( s1, ma ); /* A A A A A A A A */ s1 |= o1; /* G 1 G 1 G 1 G 1 */ - s0 = __builtin_shuffle( s0, m0 ); /* B R B R B R B R */ + s0 = vector_shuffle( s0, m0 ); /* B R B R B R B R */ s0 *= a; s1 *= a; - s0 += 0x80; - s1 += 0x80; - s0 = ( s0 + ( s0 >> 8 ) ) >> 8; - s1 = ( s1 + ( s1 >> 8 ) ) >> 8; + s0 += n0x80; + s1 += n0x80; + s0 = ( s0 + ( s0 >> n8 ) ) >> n8; + s1 = ( s1 + ( s1 >> n8 ) ) >> n8; - s = s0 | ( s1 << 8 ); + s = s0 | ( s1 << n8 ); memcpy( base, &s, 16 ); } #endif /* use `vector_size' */ From 587264cfd528f2e8fbb180bc4798ad58d20ceb85 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Wed, 23 Aug 2017 09:14:14 +0200 Subject: [PATCH 198/470] Typo. --- ChangeLog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index ffaf8f4a8..1c749f962 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,8 +4,8 @@ * src/sfnt/pngshim.c (premultiply_data): Use vectors instead of scalars. - (vector_shuffle): New macro to take of a different built-in function - name on clang. + (vector_shuffle): New macro to take care of a different built-in + function name on clang. 2017-08-22 Werner Lemberg From f0898b9259d4b3b99a1e720924683730dd36d3db Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Fri, 25 Aug 2017 21:40:01 -0400 Subject: [PATCH 199/470] Swap `ALLOC_MULT' arguments (#51833). * src/base/ftbitmap.c (ft_bitmap_assure_buffer): Updated. * src/winfonts/winfnt.c (FNT_Load_Glyph): Updated. * src/raster/ftrend1.c (ft_raster1_render): Updated. --- ChangeLog | 8 ++++++++ src/base/ftbitmap.c | 2 +- src/raster/ftrend1.c | 2 +- src/winfonts/winfnt.c | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1c749f962..8d67fcb5a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2017-08-25 Alexei Podtelezhnikov + + Swap `ALLOC_MULT' arguments (#51833). + + * src/base/ftbitmap.c (ft_bitmap_assure_buffer): Updated. + * src/winfonts/winfnt.c (FNT_Load_Glyph): Updated. + * src/raster/ftrend1.c (ft_raster1_render): Updated. + 2017-08-23 Werner Lemberg [sfnt] Fix clang compilation (#51788). diff --git a/src/base/ftbitmap.c b/src/base/ftbitmap.c index 88c88c4c1..ee50c2f30 100644 --- a/src/base/ftbitmap.c +++ b/src/base/ftbitmap.c @@ -226,7 +226,7 @@ } /* otherwise allocate new buffer */ - if ( FT_QALLOC_MULT( buffer, new_pitch, bitmap->rows + ypixels ) ) + if ( FT_QALLOC_MULT( buffer, bitmap->rows + ypixels, new_pitch ) ) return error; /* new rows get added at the top of the bitmap, */ diff --git a/src/raster/ftrend1.c b/src/raster/ftrend1.c index e52ca1db5..185a7f6fc 100644 --- a/src/raster/ftrend1.c +++ b/src/raster/ftrend1.c @@ -189,7 +189,7 @@ bitmap->rows = height; bitmap->pitch = (int)pitch; - if ( FT_ALLOC_MULT( bitmap->buffer, pitch, height ) ) + if ( FT_ALLOC_MULT( bitmap->buffer, height, pitch ) ) goto Exit; slot->internal->flags |= FT_GLYPH_OWN_BITMAP; diff --git a/src/winfonts/winfnt.c b/src/winfonts/winfnt.c index 5cdb85a36..4c4796231 100644 --- a/src/winfonts/winfnt.c +++ b/src/winfonts/winfnt.c @@ -1091,7 +1091,7 @@ /* note: since glyphs are stored in columns and not in rows we */ /* can't use ft_glyphslot_set_bitmap */ - if ( FT_ALLOC_MULT( bitmap->buffer, pitch, bitmap->rows ) ) + if ( FT_ALLOC_MULT( bitmap->buffer, bitmap->rows, pitch ) ) goto Exit; column = (FT_Byte*)bitmap->buffer; From 7d017ba810d0b29a941f83188ac39cf3c8d52a48 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Tue, 5 Sep 2017 15:28:21 +0200 Subject: [PATCH 200/470] [bdf] Fix size and resolution handling. * src/bdf/bdfdrivr.c (BDF_Face_Init): Use `SIZE' values if `POINT_SIZE', `RESOLUTION_X', or `RESOLUTION_Y' properties are missing. * docs/CHANGES: Document it. --- ChangeLog | 10 ++++++++++ docs/CHANGES | 6 ++++++ src/bdf/bdfdrivr.c | 32 ++++++++++++++++++++++++++------ 3 files changed, 42 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8d67fcb5a..6ae91dd6f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2017-09-05 Werner Lemberg + + [bdf] Fix size and resolution handling. + + * src/bdf/bdfdrivr.c (BDF_Face_Init): Use `SIZE' values if + `POINT_SIZE', `RESOLUTION_X', or `RESOLUTION_Y' properties are + missing. + + * docs/CHANGES: Document it. + 2017-08-25 Alexei Podtelezhnikov Swap `ALLOC_MULT' arguments (#51833). diff --git a/docs/CHANGES b/docs/CHANGES index f3e4b062b..7bb5fceb5 100644 --- a/docs/CHANGES +++ b/docs/CHANGES @@ -48,6 +48,12 @@ CHANGES BETWEEN 2.8 and 2.8.1 - FreeType now synthesizes a missing Unicode cmap for (older) TrueType fonts also if glyph names are available. + - FreeType has improved handling of BDF fonts without the + `POINT_SIZE', `RESOLUTION_X', or `RESOLUTION_Y' properties; the + library now uses the values of the `SIZE' keyword if they are + missing. Previously, `SIZE' was completely ignored, and + FreeType used heuristic values instead. + ====================================================================== diff --git a/src/bdf/bdfdrivr.c b/src/bdf/bdfdrivr.c index 37e6eea1c..fb7781000 100644 --- a/src/bdf/bdfdrivr.c +++ b/src/bdf/bdfdrivr.c @@ -437,6 +437,7 @@ THE SOFTWARE. { FT_Bitmap_Size* bsize = bdfface->available_sizes; FT_Short resolution_x = 0, resolution_y = 0; + long value; FT_ZERO( bsize ); @@ -500,6 +501,17 @@ THE SOFTWARE. 64 * 7200, 72270L ); } + else if ( font->point_size ) + { + if ( font->point_size > 0x7FFF ) + { + bsize->size = 0x7FFF; + FT_TRACE0(( "BDF_Face_Init: clamping point size to value %d\n", + bsize->size )); + } + else + bsize->size = (FT_Pos)font->point_size << 6; + } else { /* this is a heuristical value */ @@ -525,36 +537,44 @@ THE SOFTWARE. prop = bdf_get_font_property( font, "RESOLUTION_X" ); if ( prop ) + value = prop->value.l; + else + value = (long)font->resolution_x; + if ( value ) { #ifdef FT_DEBUG_LEVEL_TRACE - if ( prop->value.l < 0 ) + if ( value < 0 ) FT_TRACE0(( "BDF_Face_Init: negative X resolution\n" )); #endif - if ( prop->value.l > 0x7FFF || prop->value.l < -0x7FFF ) + if ( value > 0x7FFF || value < -0x7FFF ) { resolution_x = 0x7FFF; FT_TRACE0(( "BDF_Face_Init: clamping X resolution to value %d\n", resolution_x )); } else - resolution_x = FT_ABS( (FT_Short)prop->value.l ); + resolution_x = FT_ABS( (FT_Short)value ); } prop = bdf_get_font_property( font, "RESOLUTION_Y" ); if ( prop ) + value = prop->value.l; + else + value = (long)font->resolution_y; + if ( value ) { #ifdef FT_DEBUG_LEVEL_TRACE - if ( prop->value.l < 0 ) + if ( value < 0 ) FT_TRACE0(( "BDF_Face_Init: negative Y resolution\n" )); #endif - if ( prop->value.l > 0x7FFF || prop->value.l < -0x7FFF ) + if ( value > 0x7FFF || value < -0x7FFF ) { resolution_y = 0x7FFF; FT_TRACE0(( "BDF_Face_Init: clamping Y resolution to value %d\n", resolution_y )); } else - resolution_y = FT_ABS( (FT_Short)prop->value.l ); + resolution_y = FT_ABS( (FT_Short)value ); } if ( bsize->y_ppem == 0 ) From a3dd6d99a4c9f61667e5c996c0997cdd0207fc73 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Tue, 5 Sep 2017 23:02:04 +0200 Subject: [PATCH 201/470] Fix multiple calls of `FT_Bitmap_Convert'. The documentation of `FT_Bitmap_Convert' says that multiple calls do proper reallocation of the target FT_Bitmap object. However, this failed for the sequence non-empty bitmap empty bitmap non-empty bitmap Reason was that `FT_Bitmap_Convert' only reallocated the bitmap buffer if it became too small; it didn't make the buffer smaller. For an empty bitmap following a non-empty one, only the buffer dimension got set to zero, without deallocation. If the next call was a non-empty buffer again, an assertion in `ft_mem_qrealloc' was triggered. * src/base/ftbitmap.c (FT_Bitmap_Convert): Always reallocate target buffer to the correct size. * docs/CHANGES: Document it. --- ChangeLog | 24 ++++++++++++++++++++++++ docs/CHANGES | 4 ++++ src/base/ftbitmap.c | 3 +-- 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6ae91dd6f..c69772955 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,27 @@ +2017-09-05 Werner Lemberg + + Fix multiple calls of `FT_Bitmap_Convert'. + + The documentation of `FT_Bitmap_Convert' says that multiple calls do + proper reallocation of the target FT_Bitmap object. However, this + failed for the sequence + + non-empty bitmap + empty bitmap + non-empty bitmap + + Reason was that `FT_Bitmap_Convert' only reallocated the bitmap + buffer if it became too small; it didn't make the buffer smaller. + For an empty bitmap following a non-empty one, only the buffer + dimension got set to zero, without deallocation. If the next call + was a non-empty buffer again, an assertion in `ft_mem_qrealloc' was + triggered. + + * src/base/ftbitmap.c (FT_Bitmap_Convert): Always reallocate target + buffer to the correct size. + + * docs/CHANGES: Document it. + 2017-09-05 Werner Lemberg [bdf] Fix size and resolution handling. diff --git a/docs/CHANGES b/docs/CHANGES index 7bb5fceb5..2bac995e2 100644 --- a/docs/CHANGES +++ b/docs/CHANGES @@ -54,6 +54,10 @@ CHANGES BETWEEN 2.8 and 2.8.1 missing. Previously, `SIZE' was completely ignored, and FreeType used heuristic values instead. + - Multiple calls to `FT_Bitmap_Convert' do work now as advertised. + Previously, they failed with an assertion error if there was an + empty bitmap between non-empty ones. + ====================================================================== diff --git a/src/base/ftbitmap.c b/src/base/ftbitmap.c index ee50c2f30..e567a0453 100644 --- a/src/base/ftbitmap.c +++ b/src/base/ftbitmap.c @@ -534,8 +534,7 @@ (FT_ULong)target->rows > FT_ULONG_MAX / (FT_ULong)target_pitch ) return FT_THROW( Invalid_Argument ); - if ( target->rows * (FT_ULong)target_pitch > old_size && - FT_QREALLOC( target->buffer, + if ( FT_QREALLOC( target->buffer, old_size, target->rows * (FT_UInt)target_pitch ) ) return error; From e0b480d1917c96c591961f800e63914cf42da69b Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Wed, 6 Sep 2017 21:21:14 -0400 Subject: [PATCH 202/470] s/ /~/ --- include/freetype/fterrors.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/freetype/fterrors.h b/include/freetype/fterrors.h index 42769fa7b..ae382c419 100644 --- a/include/freetype/fterrors.h +++ b/include/freetype/fterrors.h @@ -38,15 +38,15 @@ /* The configuration macro FT_CONFIG_OPTION_USE_MODULE_ERRORS can be */ /* defined in `ftoption.h' in order to make the higher byte indicate */ /* the module where the error has happened (this is not compatible */ - /* with standard builds of FreeType 2, however). See the file */ + /* with standard builds of FreeType~2, however). See the file */ /* `ftmoderr.h' for more details. */ /* */ /* *Error* *Message* *Strings* */ /* */ /* Error definitions are set up with special macros that allow client */ /* applications to build a table of error message strings. The */ - /* strings are not included in a normal build of FreeType 2 to */ - /* save space (most client applications do not use them). */ + /* strings are not included in a normal build of FreeType~2 to save */ + /* space (most client applications do not use them). */ /* */ /* To do so, you have to define the following macros before including */ /* this file. */ From 22a7f5b8afd1087d485d6442f25638a5823c1264 Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Thu, 7 Sep 2017 22:36:02 -0400 Subject: [PATCH 203/470] Branding fixes. --- ChangeLog.24 | 4 ++-- ChangeLog.25 | 2 +- builds/mac/ftmac.c | 4 ++-- builds/windows/detect.mk | 2 +- docs/CHANGES | 2 +- docs/INSTALL.VMS | 12 ++++++------ docs/VERSIONS.TXT | 2 +- src/base/ftmac.c | 2 +- src/base/ftobjs.c | 2 +- src/base/ftsynth.c | 2 +- src/gxvalid/README | 2 +- src/pcf/README | 4 ++-- vms_make.com | 14 +++++++------- 13 files changed, 27 insertions(+), 27 deletions(-) diff --git a/ChangeLog.24 b/ChangeLog.24 index 796763cd7..e33b8f5e9 100644 --- a/ChangeLog.24 +++ b/ChangeLog.24 @@ -1860,10 +1860,10 @@ Fix `checking if gcc static flag -static works' test. On my linux build tree, I receive yes answer in every package I - build except freetype for this test checking if gcc static flag + build except FreeType for this test checking if gcc static flag `-static' works - On freetype, no is received, unless bzip2 and zlib are disabled using + In FreeType, no is received, unless bzip2 and zlib are disabled using ./configure --without-bzip2 --without-zlib diff --git a/ChangeLog.25 b/ChangeLog.25 index d7fed710d..f3e5cc1ac 100644 --- a/ChangeLog.25 +++ b/ChangeLog.25 @@ -2116,7 +2116,7 @@ builds/unix/unix-def.in (freetype-config, freetype2.pc): Handle HarfBuzz. - * docs/INSTALL.UNIX: Document interdependency of Freetype with + * docs/INSTALL.UNIX: Document interdependency of FreeType with HarfBuzz. 2014-02-28 Alexei Podtelezhnikov diff --git a/builds/mac/ftmac.c b/builds/mac/ftmac.c index 60cf73e5a..f5747a401 100644 --- a/builds/mac/ftmac.c +++ b/builds/mac/ftmac.c @@ -1423,7 +1423,7 @@ typedef short ResourceIndex; /* accepts an FSRef instead of a path. */ /* */ /* This function is deprecated because Carbon data types (FSRef) */ - /* are not cross-platform, and thus not suitable for the freetype API. */ + /* are not cross-platform, and thus not suitable for the FreeType API. */ FT_EXPORT_DEF( FT_Error ) FT_New_Face_From_FSRef( FT_Library library, const FSRef* ref, @@ -1481,7 +1481,7 @@ typedef short ResourceIndex; /* accepts an FSSpec instead of a path. */ /* */ /* This function is deprecated because Carbon data types (FSSpec) */ - /* are not cross-platform, and thus not suitable for the freetype API. */ + /* are not cross-platform, and thus not suitable for the FreeType API. */ FT_EXPORT_DEF( FT_Error ) FT_New_Face_From_FSSpec( FT_Library library, const FSSpec* spec, diff --git a/builds/windows/detect.mk b/builds/windows/detect.mk index 350d15605..2032934f5 100644 --- a/builds/windows/detect.mk +++ b/builds/windows/detect.mk @@ -77,7 +77,7 @@ ifeq ($(PLATFORM),windows) # So we need to hack. # # Kudos to Eli Zaretskii (DJGPP guru) that helped debug it. - # Details are available in threads of the freetype mailing list + # Details are available in threads of the FreeType mailing list # (2004-11-11), and then in the devel mailing list (2004-11-20 to -23). # ifeq ($(OS),Windows_NT) diff --git a/docs/CHANGES b/docs/CHANGES index 2bac995e2..9a62c9e04 100644 --- a/docs/CHANGES +++ b/docs/CHANGES @@ -824,7 +824,7 @@ CHANGES BETWEEN 2.5.2 and 2.5.3 and install FreeType again. With FreeType's `configure' script the procedure boils down to - configure, build, and install Freetype, then configure, compile, + configure, build, and install FreeType, then configure, compile, and install HarfBuzz, then configure, compile, and install FreeType again (after executing `make distclean'). diff --git a/docs/INSTALL.VMS b/docs/INSTALL.VMS index 7a5174d2e..6ba48d39b 100644 --- a/docs/INSTALL.VMS +++ b/docs/INSTALL.VMS @@ -1,7 +1,7 @@ -How to build the freetype2 library on VMS +How to build the FreeType 2 library on VMS ----------------------------------------- -It is actually very straightforward to install the Freetype2 library. +It is actually very straightforward to install the FreeType 2 library. Just execute vms_make.com from the toplevel directory to build the library. This procedure currently accepts the following options: @@ -15,10 +15,10 @@ ccopt= Options to pass to the C compiler e.g. ccopt=/float=ieee In case you did download the demos, place them in a separate directory -sharing the same toplevel as the directory of Freetype2 and follow the -same instructions as above for the demos from there. The build -process relies on this to figure the location of the Freetype2 include -files. +sharing the same top level as the directory of FreeType 2 and follow +the same instructions as above for the demos from there. The build +process relies on this to figure out the location of the FreeType 2 +include files. To rebuild the sources it is necessary to have MMS/MMK installed on diff --git a/docs/VERSIONS.TXT b/docs/VERSIONS.TXT index e116d34cb..a4e1980f2 100644 --- a/docs/VERSIONS.TXT +++ b/docs/VERSIONS.TXT @@ -99,7 +99,7 @@ other release numbers. #include #include FT_FREETYPE_H #if (FREETYPE_MAJOR*1000 + FREETYPE_MINOR)*1000 + FREETYPE_PATCH < 2000009 -#error Freetype version too low. +#error FreeType version too low. #endif ], [AC_MSG_RESULT(yes) diff --git a/src/base/ftmac.c b/src/base/ftmac.c index 4b92066da..4e76585e5 100644 --- a/src/base/ftmac.c +++ b/src/base/ftmac.c @@ -1005,7 +1005,7 @@ /* accepts an FSRef instead of a path. */ /* */ /* This function is deprecated because Carbon data types (FSRef) */ - /* are not cross-platform, and thus not suitable for the freetype API. */ + /* are not cross-platform, and thus not suitable for the FreeType API. */ FT_EXPORT_DEF( FT_Error ) FT_New_Face_From_FSRef( FT_Library library, const FSRef* ref, diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c index 1d8bc2d6c..6db8136cf 100644 --- a/src/base/ftobjs.c +++ b/src/base/ftobjs.c @@ -4557,7 +4557,7 @@ if ( !clazz ) return FT_THROW( Invalid_Argument ); - /* check freetype version */ + /* check FreeType version */ if ( clazz->module_requires > FREETYPE_VER_FIXED ) return FT_THROW( Invalid_Version ); diff --git a/src/base/ftsynth.c b/src/base/ftsynth.c index 66dae6037..5cf386f48 100644 --- a/src/base/ftsynth.c +++ b/src/base/ftsynth.c @@ -123,7 +123,7 @@ /* * XXX: overflow check for 16-bit system, for compatibility - * with FT_GlyphSlot_Embolden() since freetype-2.1.10. + * with FT_GlyphSlot_Embolden() since FreeType 2.1.10. * unfortunately, this function return no informations * about the cause of error. */ diff --git a/src/gxvalid/README b/src/gxvalid/README index 7201459aa..200f66cb1 100644 --- a/src/gxvalid/README +++ b/src/gxvalid/README @@ -9,7 +9,7 @@ gxvalid: TrueType GX validator additional tables in TrueType font which are used by `QuickDraw GX Text', Apple Advanced Typography (AAT). In addition, gxvalid can validates `kern' tables which have been extended for AAT. Like the - otvalid module, gxvalid uses Freetype 2's validator framework + otvalid module, gxvalid uses FreeType 2's validator framework (ftvalid). You can link gxvalid with your program; before running your own layout diff --git a/src/pcf/README b/src/pcf/README index 10eff15fb..09ea970ed 100644 --- a/src/pcf/README +++ b/src/pcf/README @@ -41,8 +41,8 @@ value given as argument into the corresponding glyph number. Known problems ************** -- dealing explicitly with encodings breaks the uniformity of freetype2 - api. +- dealing explicitly with encodings breaks the uniformity of FreeType 2 + API. - except for encodings properties, client applications have no visibility of the PCF_Face object. This means that applications diff --git a/vms_make.com b/vms_make.com index ea5631826..db0dca611 100644 --- a/vms_make.com +++ b/vms_make.com @@ -1,4 +1,4 @@ -$! make Freetype2 under OpenVMS +$! make FreeType 2 under OpenVMS $! $! Copyright 2003-2017 by $! David Turner, Robert Wilhelm, and Werner Lemberg. @@ -10,7 +10,7 @@ $! indicate that you have read the license and understand and accept it $! fully. $! $! -$! External libraries (like Freetype, XPM, etc.) are supported via the +$! External libraries (like FreeType, XPM, etc.) are supported via the $! config file VMSLIB.DAT. Please check the sample file, which is part of this $! distribution, for the information you need to provide $! @@ -26,12 +26,12 @@ $! In case of problems with the install you might contact me at $! zinser@zinser.no-ip.info (preferred) or $! zinser@sysdev.deutsche-boerse.com (work) $! -$! Make procedure history for Freetype2 +$! Make procedure history for FreeType 2 $! $!------------------------------------------------------------------------------ $! Version history $! 0.01 20040401 First version to receive a number -$! 0.02 20041030 Add error handling, Freetype 2.1.9 +$! 0.02 20041030 Add error handling, FreeType 2.1.9 $! $ on error then goto err_exit $ true = 1 @@ -128,7 +128,7 @@ $ERR_LIB: $ write sys$output "Error reading config file vmslib.dat" $ goto err_exit $FT2_ERR: -$ write sys$output "Could not locate Freetype 2 include files" +$ write sys$output "Could not locate FreeType 2 include files" $ goto err_exit $ERR_EXIT: $ set message/facil/ident/sever/text @@ -1070,7 +1070,7 @@ $ then $ type/out=vmslib.dat sys$input ! ! This is a simple driver file with information used by vms_make.com to -! check if external libraries (like t1lib and freetype) are available on +! check if external libraries (like t1lib and FreeType) are available on ! the system. ! ! Layout of the file: @@ -1148,7 +1148,7 @@ $ if f$locate("EXE",libtype) .lt. f$length(libtype) then lqual = "/share" $ write optf libloc , lqual $ if (f$trnlnm("topt") .nes. "") then write topt libloc , lqual $! -$! Nasty hack to get the freetype includes to work +$! Nasty hack to get the FreeType includes to work $! $ ft2def = false $ if ((libname .eqs. "FREETYPE") .and. - From 5c4e40d7fd1fa1f971733d8c7e559962bb49f195 Mon Sep 17 00:00:00 2001 From: suzuki toshiya Date: Sat, 9 Sep 2017 00:59:33 +0900 Subject: [PATCH 204/470] [sfnt, truetype] Register the tags for marginal fonts. The first 32bit of standard TrueType variants is 0x00010000, `OTTO', `ttcf', `true' or `typ1'. 2 marginal dfonts on legacy Mac OS X, Keyboard.dfont and LastResort.dfont, have the sfnt resources starting 0xA5 followed by `kbd' or `lst'. Considering the following data could be parsed as conventional TrueType fonts, the header checking is updated to allow these tags. It seems that recent Mac OS X has already switched to normal TTF for these fonts. See the discussion at http://u88.n24.queensu.ca/exiftool/forum/index.php?topic=3931.0 * include/freetype/tttags.h (TTAG_0xA5kbd, TTAG_0xA5lst): New header tags for Keyboard.dfont and LastResort.dfont. * src/sfnt/sfobjs.c (sfnt_open_font): Accept the sfnt resource starts with TTAG_0xA5kbd or TTAG_0xA5lst. * src/truetype/ttobjs.c (tt_face_init): Accept the face with the format tag is TTAG_0xA5kbd or TTAG_0xA5lst. --- include/freetype/tttags.h | 6 ++++++ src/sfnt/sfobjs.c | 2 ++ src/truetype/ttobjs.c | 8 +++++--- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/include/freetype/tttags.h b/include/freetype/tttags.h index 32eb2fdc2..b7d3bac0f 100644 --- a/include/freetype/tttags.h +++ b/include/freetype/tttags.h @@ -106,6 +106,12 @@ FT_BEGIN_HEADER #define TTAG_VVAR FT_MAKE_TAG( 'V', 'V', 'A', 'R' ) #define TTAG_wOFF FT_MAKE_TAG( 'w', 'O', 'F', 'F' ) +/* used by "Keyboard.dfont" on legacy Mac OS X */ +#define TTAG_0xA5kbd FT_MAKE_TAG( 0xA5, 'k', 'b', 'd' ) + +/* used by "LastResort.dfont" on legacy Mac OS X */ +#define TTAG_0xA5lst FT_MAKE_TAG( 0xA5, 'l', 's', 't' ) + FT_END_HEADER diff --git a/src/sfnt/sfobjs.c b/src/sfnt/sfobjs.c index 289eeef7b..69bf0a5c3 100644 --- a/src/sfnt/sfobjs.c +++ b/src/sfnt/sfobjs.c @@ -787,6 +787,8 @@ tag != TTAG_OTTO && tag != TTAG_true && tag != TTAG_typ1 && + tag != TTAG_0xA5kbd && + tag != TTAG_0xA5lst && tag != 0x00020000UL ) { FT_TRACE2(( " not a font using the SFNT container format\n" )); diff --git a/src/truetype/ttobjs.c b/src/truetype/ttobjs.c index 53e402be1..783df3040 100644 --- a/src/truetype/ttobjs.c +++ b/src/truetype/ttobjs.c @@ -576,9 +576,11 @@ /* We must also be able to accept Mac/GX fonts, as well as OT ones. */ /* The 0x00020000 tag is completely undocumented; some fonts from */ /* Arphic made for Chinese Windows 3.1 have this. */ - if ( face->format_tag != 0x00010000L && /* MS fonts */ - face->format_tag != 0x00020000L && /* CJK fonts for Win 3.1 */ - face->format_tag != TTAG_true ) /* Mac fonts */ + if ( face->format_tag != 0x00010000L && /* MS fonts */ + face->format_tag != 0x00020000L && /* CJK fonts for Win 3.1 */ + face->format_tag != TTAG_true && /* Mac fonts */ + face->format_tag != TTAG_0xA5kbd && /* Keyboard.dfont for legacy Mac OS X */ + face->format_tag != TTAG_0xA5lst ) /* LastResort.dfont for legacy Mac OS X */ { FT_TRACE2(( " not a TTF font\n" )); goto Bad_Format; From 71f661804e88db5b12cc1a143e03ef53b5eab894 Mon Sep 17 00:00:00 2001 From: suzuki toshiya Date: Sat, 9 Sep 2017 01:05:44 +0900 Subject: [PATCH 205/470] ChangeLog for last commit. --- ChangeLog | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/ChangeLog b/ChangeLog index c69772955..3b2620509 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,25 @@ +2017-09-08 suzuki toshiya + + [sfnt, truetype] Register the tags for marginal fonts. + + The first 32bit of standard TrueType variants is 0x00010000, + `OTTO', `ttcf', `true' or `typ1'. 2 marginal dfonts on legacy Mac + OS X, Keyboard.dfont and LastResort.dfont, have the sfnt resources + starting 0xA5 followed by `kbd' or `lst'. Considering the following + data could be parsed as conventional TrueType fonts, the header + checking is updated to allow these tags. It seems that recent Mac + OS X has already switched to normal TTF for these fonts. + + See the discussion at + http://u88.n24.queensu.ca/exiftool/forum/index.php?topic=3931.0 + + * include/freetype/tttags.h (TTAG_0xA5kbd, TTAG_0xA5lst): New header + tags for Keyboard.dfont and LastResort.dfont. + * src/sfnt/sfobjs.c (sfnt_open_font): Accept the sfnt resource + starts with TTAG_0xA5kbd or TTAG_0xA5lst. + * src/truetype/ttobjs.c (tt_face_init): Accept the face with the + format tag is TTAG_0xA5kbd or TTAG_0xA5lst. + 2017-09-05 Werner Lemberg Fix multiple calls of `FT_Bitmap_Convert'. From 3ef59e59e0d59030b1a8949a7776e14b5ae91cc6 Mon Sep 17 00:00:00 2001 From: suzuki toshiya Date: Sat, 9 Sep 2017 01:28:24 +0900 Subject: [PATCH 206/470] [base] Remove a check for resource ID in the resource fork driver. LastResort.dfont has a marginal resource ID 0xFFFF for sfnt resource. Inside Macintosh: More Macintosh Toolbox, `Resource IDs' (1-46), tells that some IDs are reserved and should not be used. FreeType2 just uses resource ID to sort the fragmented resource. To accept the marginal fonts, the checking is removed. * src/base/ftrfork.c (FT_Raccess_Get_DataOffsets): Remove res_id validity check, fix a trace message format. --- ChangeLog | 13 +++++++++++++ src/base/ftrfork.c | 10 ++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3b2620509..cdeb6b604 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2017-09-08 suzuki toshiya + + [base] Remove a check for resource ID in the resource fork driver. + + LastResort.dfont has a marginal resource ID 0xFFFF for sfnt + resource. Inside Macintosh: More Macintosh Toolbox, `Resource IDs' + (1-46), tells that some IDs are reserved and should not be used. + FreeType2 just uses resource ID to sort the fragmented resource. + To accept the marginal fonts, the checking is removed. + + * src/base/ftrfork.c (FT_Raccess_Get_DataOffsets): Remove res_id + validity check, fix a trace message format. + 2017-09-08 suzuki toshiya [sfnt, truetype] Register the tags for marginal fonts. diff --git a/src/base/ftrfork.c b/src/base/ftrfork.c index f7b81375d..f5ad2874d 100644 --- a/src/base/ftrfork.c +++ b/src/base/ftrfork.c @@ -271,7 +271,13 @@ if ( FT_STREAM_SKIP( 4 ) ) /* mbz */ goto Exit; - if ( ref[j].res_id < 0 || temp < 0 ) + /* + * According to Inside Macintosh: More Macintosh Toolbox, + * "Resource IDs" (1-46), there are some reserved IDs. + * However, FreeType2 is not a font synthesizer, no need + * to check the acceptable resource ID. + */ + if ( temp < 0 ) { error = FT_THROW( Invalid_Table ); goto Exit; @@ -281,7 +287,7 @@ FT_TRACE3(( " [%d]:" " resource_id=0x%04x, offset=0x%08x\n", - j, ref[j].res_id, ref[j].offset )); + j, (FT_UShort)ref[j].res_id, ref[j].offset )); } if ( sort_by_res_id ) From 33b390a63b99936c084a26eb789bd3bd6851fa83 Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Fri, 8 Sep 2017 21:34:47 -0400 Subject: [PATCH 207/470] Warping documentation updates. --- docs/CHANGES | 2 ++ include/freetype/ftautoh.h | 14 +++++++------- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/docs/CHANGES b/docs/CHANGES index 9a62c9e04..7f1c2088d 100644 --- a/docs/CHANGES +++ b/docs/CHANGES @@ -58,6 +58,8 @@ CHANGES BETWEEN 2.8 and 2.8.1 Previously, they failed with an assertion error if there was an empty bitmap between non-empty ones. + - Warping now works in `normal' hinting, replacing it. + ====================================================================== diff --git a/include/freetype/ftautoh.h b/include/freetype/ftautoh.h index abd540f0b..2bb675ae4 100644 --- a/include/freetype/ftautoh.h +++ b/include/freetype/ftautoh.h @@ -404,12 +404,12 @@ FT_BEGIN_HEADER * activate the warp hinting code in the auto-hinter, this property * switches warping on and off. * - * Warping only works in `light' auto-hinting mode. The idea of the - * code is to slightly scale and shift a glyph along the non-hinted - * dimension (which is usually the horizontal axis) so that as much of - * its segments are aligned (more or less) to the grid. To find out a - * glyph's optimal scaling and shifting value, various parameter - * combinations are tried and scored. + * Warping only works in `normal' auto-hinting mode replacing it. + * The idea of the code is to slightly scale and shift a glyph along + * the non-hinted dimension (which is usually the horizontal axis) so + * that as much of its segments are aligned (more or less) to the grid. + * To find out a glyph's optimal scaling and shifting value, various + * parameter combinations are tried and scored. * * By default, warping is off. The example below shows how to switch on * warping (omitting the error handling). @@ -437,7 +437,7 @@ FT_BEGIN_HEADER * * Since warping is a global property of the auto-hinter it is best to * change its value before rendering any face. Otherwise, you should - * reload all faces that get auto-hinted in `light' hinting mode. + * reload all faces that get auto-hinted in `normal' hinting mode. * */ From e2e56f9dd54b1af0fcd6e93c887e51d2e6d41497 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sat, 9 Sep 2017 06:31:03 +0200 Subject: [PATCH 208/470] Officially announce end of 16bit compiler support. --- docs/CHANGES | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/CHANGES b/docs/CHANGES index 7f1c2088d..bedf486a3 100644 --- a/docs/CHANGES +++ b/docs/CHANGES @@ -60,6 +60,11 @@ CHANGES BETWEEN 2.8 and 2.8.1 - Warping now works in `normal' hinting, replacing it. + - 16bit compiler support is now officially ended. We didn't + provide any maintainance since many years, and given that there + were no error or problem reports either it seems that it is no + longer needed. + ====================================================================== From 0ab2b62d3fa6b3c5a50ece8b322bf21cc0e38d52 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sat, 9 Sep 2017 08:08:47 +0200 Subject: [PATCH 209/470] [autofit] Improve communication with ftgrid. * src/autofit/afhints.c (af_glyph_hints_get_segment_offset): Provide values in font units. --- ChangeLog | 7 +++++++ src/autofit/afhints.c | 6 +++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index cdeb6b604..d6ba1c897 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2017-09-09 Werner Lemberg + + [autofit] Improve communication with ftgrid. + + * src/autofit/afhints.c (af_glyph_hints_get_segment_offset): + Provide values in font units. + 2017-09-08 suzuki toshiya [base] Remove a check for resource ID in the resource fork driver. diff --git a/src/autofit/afhints.c b/src/autofit/afhints.c index f1ff0baef..1b21c06c2 100644 --- a/src/autofit/afhints.c +++ b/src/autofit/afhints.c @@ -507,15 +507,15 @@ return FT_THROW( Invalid_Argument ); seg = &axis->segments[idx]; - *offset = ( dim == AF_DIMENSION_HORZ ) ? seg->first->ox - : seg->first->oy; + *offset = ( dim == AF_DIMENSION_HORZ ) ? seg->first->fx + : seg->first->fy; if ( seg->edge ) *is_blue = (FT_Bool)( seg->edge->blue_edge != 0 ); else *is_blue = FALSE; if ( *is_blue ) - *blue_offset = seg->edge->blue_edge->cur; + *blue_offset = seg->edge->blue_edge->org; else *blue_offset = 0; From 0683f0df7c807d0131ccd2fcdf665bbcfb27d6b2 Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Sat, 9 Sep 2017 13:01:11 -0400 Subject: [PATCH 210/470] Warping CHANGES. --- docs/CHANGES | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/CHANGES b/docs/CHANGES index bedf486a3..839eefb36 100644 --- a/docs/CHANGES +++ b/docs/CHANGES @@ -58,7 +58,9 @@ CHANGES BETWEEN 2.8 and 2.8.1 Previously, they failed with an assertion error if there was an empty bitmap between non-empty ones. - - Warping now works in `normal' hinting, replacing it. + - The warping option has moved from `light' to `normal' hinting + where it replaces the original hinting algorithm. The `light' + mode is now always void of any hinting in x-direction. - 16bit compiler support is now officially ended. We didn't provide any maintainance since many years, and given that there From d1b6c6e2119eb526c1420996f00fe5904de1b25b Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Sun, 10 Sep 2017 22:35:21 -0400 Subject: [PATCH 211/470] Typo. --- include/freetype/freetype.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h index a57fb35b9..378ba1dd0 100644 --- a/include/freetype/freetype.h +++ b/include/freetype/freetype.h @@ -1781,7 +1781,7 @@ FT_BEGIN_HEADER /* and add it to `origin_x'> */ /* */ /* origin_x += slot->advance.x; */ - /* origin_x += slot->rsb_delta - slot->lsb_relta; */ + /* origin_x += slot->rsb_delta - slot->lsb_delta; */ /* endfor */ /* } */ /* */ From 3e4b79970e0681bd2481392420a0eb4dc7820b70 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Mon, 11 Sep 2017 08:51:44 +0200 Subject: [PATCH 212/470] * src/sfnt/ttkern.c (tt_face_load_kern): Reject format 2 tables. Reported by Behdad. --- ChangeLog | 6 ++++++ src/sfnt/ttkern.c | 8 +++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index d6ba1c897..cc30bad58 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2017-09-11 Werner Lemberg + + * src/sfnt/ttkern.c (tt_face_load_kern): Reject format 2 tables. + + Reported by Behdad. + 2017-09-09 Werner Lemberg [autofit] Improve communication with ftgrid. diff --git a/src/sfnt/ttkern.c b/src/sfnt/ttkern.c index c97e5789a..53d2436ae 100644 --- a/src/sfnt/ttkern.c +++ b/src/sfnt/ttkern.c @@ -85,7 +85,7 @@ for ( nn = 0; nn < num_tables; nn++ ) { - FT_UInt num_pairs, length, coverage; + FT_UInt num_pairs, length, coverage, format; FT_Byte* p_next; FT_UInt32 mask = (FT_UInt32)1UL << nn; @@ -107,6 +107,12 @@ if ( p_next > p_limit ) /* handle broken table */ p_next = p_limit; + format = coverage >> 8; + + /* we currently only support format 0 kerning tables */ + if ( format != 0 ) + goto NextTable; + /* only use horizontal kerning tables */ if ( ( coverage & 3U ) != 0x0001 || p + 8 > p_next ) From babe13ec5ce9b76862e101ec033fefbf746683eb Mon Sep 17 00:00:00 2001 From: Azzuro Date: Mon, 11 Sep 2017 10:47:29 +0200 Subject: [PATCH 213/470] [build] Improve builds with different MS Visual Studio versions. * builds/windows/vc2010/freetype.vcxproj: Switch platform toolset according to the Visual Studio version. --- ChangeLog | 7 +++++ builds/windows/vc2010/freetype.vcxproj | 38 ++++++++++++++++++-------- 2 files changed, 33 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index cc30bad58..cdd6ee24b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2017-09-11 Azzuro + + [build] Improve builds with different MS Visual Studio versions. + + * builds/windows/vc2010/freetype.vcxproj: Switch platform toolset + according to the Visual Studio version. + 2017-09-11 Werner Lemberg * src/sfnt/ttkern.c (tt_face_load_kern): Reject format 2 tables. diff --git a/builds/windows/vc2010/freetype.vcxproj b/builds/windows/vc2010/freetype.vcxproj index e4f11fc11..592657d29 100644 --- a/builds/windows/vc2010/freetype.vcxproj +++ b/builds/windows/vc2010/freetype.vcxproj @@ -50,6 +50,32 @@ x64 + + + + 4.0 + + + + v100 + + + + v120 + + + + v140 + + + + v141 + + {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B} @@ -58,73 +84,61 @@ StaticLibrary false MultiByte - v100 StaticLibrary false MultiByte - v100 StaticLibrary false MultiByte - v100 StaticLibrary false MultiByte - v100 StaticLibrary false MultiByte - v100 StaticLibrary false MultiByte - v100 StaticLibrary false MultiByte - v100 StaticLibrary false MultiByte - v100 StaticLibrary false MultiByte - v100 StaticLibrary false MultiByte - v100 StaticLibrary false MultiByte - v100 StaticLibrary false MultiByte - v100 From 21658c31f705edd4c94798eee62ce5b5241814b9 Mon Sep 17 00:00:00 2001 From: suzuki toshiya Date: Tue, 12 Sep 2017 15:59:18 +0900 Subject: [PATCH 214/470] [autofit, sfnt] Fix for `make multi'. * src/autofit/afshaper.c: Include FT_ADVANCE_H, to use FT_Get_Advance() in it. * src/sfnt/ttcmap.c: Include FT_SERVICE_POSTSCRIPT_CMAPS_H to use PS_Unicodes in it, also include `ttpost.h' to use tt_face_get_ps_name() in it. --- ChangeLog | 10 ++++++++++ src/autofit/afshaper.c | 1 + src/sfnt/ttcmap.c | 2 ++ 3 files changed, 13 insertions(+) diff --git a/ChangeLog b/ChangeLog index cdd6ee24b..b9d69c04c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2017-09-12 suzuki toshiya + + [autofit, sfnt] Fix for `make multi'. + + * src/autofit/afshaper.c: Include FT_ADVANCE_H, to use + FT_Get_Advance() in it. + * src/sfnt/ttcmap.c: Include FT_SERVICE_POSTSCRIPT_CMAPS_H + to use PS_Unicodes in it, also include `ttpost.h' to use + tt_face_get_ps_name() in it. + 2017-09-11 Azzuro [build] Improve builds with different MS Visual Studio versions. diff --git a/src/autofit/afshaper.c b/src/autofit/afshaper.c index da92fad3e..d25996421 100644 --- a/src/autofit/afshaper.c +++ b/src/autofit/afshaper.c @@ -18,6 +18,7 @@ #include #include FT_FREETYPE_H +#include FT_ADVANCES_H #include "afglobal.h" #include "aftypes.h" #include "afshaper.h" diff --git a/src/sfnt/ttcmap.c b/src/sfnt/ttcmap.c index ef03e0442..b995e5c05 100644 --- a/src/sfnt/ttcmap.c +++ b/src/sfnt/ttcmap.c @@ -23,8 +23,10 @@ #include FT_INTERNAL_VALIDATE_H #include FT_INTERNAL_STREAM_H +#include FT_SERVICE_POSTSCRIPT_CMAPS_H #include "ttload.h" #include "ttcmap.h" +#include "ttpost.h" #include "sfntpic.h" From 96dcc8ad6ef67f8703efd239f081ed27c7f039a2 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Wed, 13 Sep 2017 08:16:23 +0200 Subject: [PATCH 215/470] [autofit] Really fix #41334 (#52000). * src/autofit/aflatin.c (af_latin_hints_compute_segments): Set `segment->delta' everywhere. --- ChangeLog | 7 +++++++ src/autofit/aflatin.c | 21 +++++++++++++-------- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index b9d69c04c..b25a82268 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2017-09-13 Werner Lemberg + + [autofit] Really fix #41334 (#52000). + + * src/autofit/aflatin.c (af_latin_hints_compute_segments): Set + `segment->delta' everywhere. + 2017-09-12 suzuki toshiya [autofit, sfnt] Fix for `make multi'. diff --git a/src/autofit/aflatin.c b/src/autofit/aflatin.c index cdbc1b7ab..02b3b8bbd 100644 --- a/src/autofit/aflatin.c +++ b/src/autofit/aflatin.c @@ -1690,9 +1690,11 @@ if ( prev_max_on_coord > max_on_coord ) max_on_coord = prev_max_on_coord; - prev_segment->last = point; - prev_segment->pos = (FT_Short)( ( min_pos + - max_pos ) >> 1 ); + prev_segment->last = point; + prev_segment->pos = (FT_Short)( ( min_pos + + max_pos ) >> 1 ); + prev_segment->delta = (FT_Short)( ( max_pos - + min_pos ) >> 1 ); if ( ( min_flags | max_flags ) & AF_FLAG_CONTROL && ( max_on_coord - min_on_coord ) < flat_threshold ) @@ -1720,9 +1722,11 @@ if ( max_pos > prev_max_pos ) prev_max_pos = max_pos; - prev_segment->last = point; - prev_segment->pos = (FT_Short)( ( prev_min_pos + - prev_max_pos ) >> 1 ); + prev_segment->last = point; + prev_segment->pos = (FT_Short)( ( prev_min_pos + + prev_max_pos ) >> 1 ); + prev_segment->delta = (FT_Short)( ( prev_max_pos - + prev_min_pos ) >> 1 ); } else { @@ -1733,8 +1737,9 @@ if ( prev_max_pos > max_pos ) max_pos = prev_max_pos; - segment->last = point; - segment->pos = (FT_Short)( ( min_pos + max_pos ) >> 1 ); + segment->last = point; + segment->pos = (FT_Short)( ( min_pos + max_pos ) >> 1 ); + segment->delta = (FT_Short)( ( max_pos - min_pos ) >> 1 ); if ( ( min_flags | max_flags ) & AF_FLAG_CONTROL && ( max_on_coord - min_on_coord ) < flat_threshold ) From 5ad845771a7389e72e4868dd1d4f0986f812b705 Mon Sep 17 00:00:00 2001 From: suzuki toshiya Date: Wed, 13 Sep 2017 15:49:15 +0900 Subject: [PATCH 216/470] [cache] Fix a possible overflow by signed integer comparison. Improve the code by 5d3ff05615dda6d1325ed612381a17a0df04c975 , issues are found by Behdad Esfahbod and Werner Lemberg. * src/cache/ftcbasic.c (FTC_ImageCache_Lookup): Replace a subtraction to check higher bit by a bit operation, and cpp-conditionalize for appropriate systems. Add better documentation to the comment. (FTC_ImageCache_LookupScaler): Ditto. (FTC_SBitCache_Lookup): Ditto. (FTC_SBitCache_LookupScaler): Ditto. --- ChangeLog | 15 +++++++++++++++ src/cache/ftcbasic.c | 42 ++++++++++++++++++++++++++++++++++++++---- 2 files changed, 53 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index b25a82268..62618f814 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2017-09-13 suzuki toshiya + + [cache] Fix a possible overflow by signed integer comparison. + + Improve the code by 5d3ff05615dda6d1325ed612381a17a0df04c975 , + issues are found by Behdad Esfahbod and Werner Lemberg. + + * src/cache/ftcbasic.c (FTC_ImageCache_Lookup): Replace + a subtraction to check higher bit by a bit operation, + and cpp-conditionalize for appropriate systems. Add better + documentation to the comment. + (FTC_ImageCache_LookupScaler): Ditto. + (FTC_SBitCache_Lookup): Ditto. + (FTC_SBitCache_LookupScaler): Ditto. + 2017-09-13 Werner Lemberg [autofit] Really fix #41334 (#52000). diff --git a/src/cache/ftcbasic.c b/src/cache/ftcbasic.c index 289bd5c43..59221f2fa 100644 --- a/src/cache/ftcbasic.c +++ b/src/cache/ftcbasic.c @@ -304,10 +304,19 @@ if ( anode ) *anode = NULL; - if ( (FT_ULong)( type->flags - FT_INT_MIN ) > FT_UINT_MAX ) +/* + * internal FTC_BasicAttr->load_flags is typed FT_UInt, + * but public FT_ImageType->flags is typed FT_Int32 + * + * On 16bit systems, higher bits of type->flags + * could not be handled. + */ +#if 0xFFFFFFFFUL > FT_UINT_MAX + if ( (type->flags & (FT_ULong)FT_UINT_MAX) ) FT_TRACE1(( "FTC_ImageCache_Lookup:" " higher bits in load_flags 0x%x are dropped\n", (FT_ULong)type->flags & ~((FT_ULong)FT_UINT_MAX) )); +#endif query.attrs.scaler.face_id = type->face_id; query.attrs.scaler.width = type->width; @@ -377,11 +386,19 @@ if ( anode ) *anode = NULL; - /* `FT_Load_Glyph' and `FT_Load_Char' take FT_UInt flags */ +/* + * internal FTC_BasicAttr->load_flags is typed FT_UInt, + * but public FT_Face->face_flags is typed FT_Long. + * + * On long > int systems, higher bits of load_flags + * could not be handled. + */ +#if FT_ULONG_MAX > FT_UINT_MAX if ( load_flags > FT_UINT_MAX ) FT_TRACE1(( "FTC_ImageCache_LookupScaler:" " higher bits in load_flags 0x%x are dropped\n", load_flags & ~((FT_ULong)FT_UINT_MAX) )); +#endif query.attrs.scaler = scaler[0]; query.attrs.load_flags = (FT_UInt)load_flags; @@ -487,10 +504,19 @@ *ansbit = NULL; - if ( (FT_ULong)( type->flags - FT_INT_MIN ) > FT_UINT_MAX ) +/* + * internal FTC_BasicAttr->load_flags is typed FT_UInt, + * but public FT_ImageType->flags is typed FT_Int32 + * + * On 16bit systems, higher bits of type->flags + * could not be handled. + */ +#if 0xFFFFFFFFUL > FT_UINT_MAX + if ( (type->flags & (FT_ULong)FT_UINT_MAX) ) FT_TRACE1(( "FTC_ImageCache_Lookup:" " higher bits in load_flags 0x%x are dropped\n", (FT_ULong)type->flags & ~((FT_ULong)FT_UINT_MAX) )); +#endif query.attrs.scaler.face_id = type->face_id; query.attrs.scaler.width = type->width; @@ -562,11 +588,19 @@ *ansbit = NULL; - /* `FT_Load_Glyph' and `FT_Load_Char' take FT_UInt flags */ +/* + * internal FTC_BasicAttr->load_flags is typed FT_UInt, + * but public FT_Face->face_flags is typed FT_Long. + * + * On long > int systems, higher bits of load_flags + * could not be handled. + */ +#if FT_ULONG_MAX > FT_UINT_MAX if ( load_flags > FT_UINT_MAX ) FT_TRACE1(( "FTC_ImageCache_LookupScaler:" " higher bits in load_flags 0x%x are dropped\n", load_flags & ~((FT_ULong)FT_UINT_MAX) )); +#endif query.attrs.scaler = scaler[0]; query.attrs.load_flags = (FT_UInt)load_flags; From b757ddb1629d524cd92eb9b39ce298e0dffd57fd Mon Sep 17 00:00:00 2001 From: suzuki toshiya Date: Wed, 13 Sep 2017 22:17:03 +0900 Subject: [PATCH 217/470] [sfnt] lowest gcc for vectors ( e1d0249e ) is changed to 4.7. __builtin_shuffle() was introduced in gcc-4.7. The lowest gcc to enable vector operation is delayed from 4.6 to 4.7. * src/sfnt/pngshim.c (premultiply_data): Fix cpp-macro to enable the vector operation, to change the lowest gcc version from 4.6 to 4.7. --- ChangeLog | 11 +++++++++++ src/sfnt/pngshim.c | 5 +++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 62618f814..4708ba577 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2017-09-13 suzuki toshiya + + [sfnt] lowest gcc for vectors ( e1d0249e ) is changed to 4.7. + + __builtin_shuffle() was introduced in gcc-4.7. The lowest + gcc to enable vector operation is delayed from 4.6 to 4.7. + + * src/sfnt/pngshim.c (premultiply_data): Fix cpp-macro to + enable the vector operation, to change the lowest gcc version + from 4.6 to 4.7. + 2017-09-13 suzuki toshiya [cache] Fix a possible overflow by signed integer comparison. diff --git a/src/sfnt/pngshim.c b/src/sfnt/pngshim.c index b05c6de06..7dc343526 100644 --- a/src/sfnt/pngshim.c +++ b/src/sfnt/pngshim.c @@ -59,10 +59,11 @@ /* the `vector_size' attribute was introduced in gcc 3.1, which */ /* predates clang; the `__BYTE_ORDER__' preprocessor symbol was */ - /* introduced in gcc 4.6 and clang 3.2, respectively */ + /* introduced in gcc 4.6 and clang 3.2, respectively. */ + /* __builtin_shuffle() for gcc was introduced in gcc 4.7.0. */ #if ( ( defined( __GNUC__ ) && \ ( ( __GNUC__ >= 5 ) || \ - ( ( __GNUC__ == 4 ) && ( __GNUC_MINOR__ >= 6 ) ) ) ) || \ + ( ( __GNUC__ == 4 ) && ( __GNUC_MINOR__ >= 7 ) ) ) ) || \ ( defined( __clang__ ) && \ ( ( __clang_major__ >= 4 ) || \ ( ( __clang_major__ == 3 ) && ( __clang_minor__ >= 2 ) ) ) ) ) && \ From 7cb6f2173a00e506d544f7acfe53d6786048ff87 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Thu, 14 Sep 2017 12:09:37 +0200 Subject: [PATCH 218/470] Formatting. --- src/cache/ftcbasic.c | 52 ++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 28 deletions(-) diff --git a/src/cache/ftcbasic.c b/src/cache/ftcbasic.c index 59221f2fa..bd51a5319 100644 --- a/src/cache/ftcbasic.c +++ b/src/cache/ftcbasic.c @@ -304,13 +304,12 @@ if ( anode ) *anode = NULL; -/* - * internal FTC_BasicAttr->load_flags is typed FT_UInt, - * but public FT_ImageType->flags is typed FT_Int32 - * - * On 16bit systems, higher bits of type->flags - * could not be handled. - */ + /* + * Internal `FTC_BasicAttr->load_flags' is of type `FT_UInt', + * but public `FT_ImageType->flags' is of type `FT_Int32' + * + * On 16bit systems, higher bits of type->flags cannot be handled. + */ #if 0xFFFFFFFFUL > FT_UINT_MAX if ( (type->flags & (FT_ULong)FT_UINT_MAX) ) FT_TRACE1(( "FTC_ImageCache_Lookup:" @@ -386,13 +385,12 @@ if ( anode ) *anode = NULL; -/* - * internal FTC_BasicAttr->load_flags is typed FT_UInt, - * but public FT_Face->face_flags is typed FT_Long. - * - * On long > int systems, higher bits of load_flags - * could not be handled. - */ + /* + * Internal `FTC_BasicAttr->load_flags' is of type `FT_UInt', + * but public `FT_Face->face_flags' is of type `FT_Long'. + * + * On long > int systems, higher bits of load_flags cannot be handled. + */ #if FT_ULONG_MAX > FT_UINT_MAX if ( load_flags > FT_UINT_MAX ) FT_TRACE1(( "FTC_ImageCache_LookupScaler:" @@ -504,13 +502,12 @@ *ansbit = NULL; -/* - * internal FTC_BasicAttr->load_flags is typed FT_UInt, - * but public FT_ImageType->flags is typed FT_Int32 - * - * On 16bit systems, higher bits of type->flags - * could not be handled. - */ + /* + * Internal `FTC_BasicAttr->load_flags' is of type `FT_UInt', + * but public `FT_ImageType->flags' is of type `FT_Int32'. + * + * On 16bit systems, higher bits of type->flags cannot be handled. + */ #if 0xFFFFFFFFUL > FT_UINT_MAX if ( (type->flags & (FT_ULong)FT_UINT_MAX) ) FT_TRACE1(( "FTC_ImageCache_Lookup:" @@ -588,13 +585,12 @@ *ansbit = NULL; -/* - * internal FTC_BasicAttr->load_flags is typed FT_UInt, - * but public FT_Face->face_flags is typed FT_Long. - * - * On long > int systems, higher bits of load_flags - * could not be handled. - */ + /* + * Internal `FTC_BasicAttr->load_flags' is of type `FT_UInt', + * but public `FT_Face->face_flags' is of type `FT_Long'. + * + * On long > int systems, higher bits of load_flags cannot be handled. + */ #if FT_ULONG_MAX > FT_UINT_MAX if ( load_flags > FT_UINT_MAX ) FT_TRACE1(( "FTC_ImageCache_LookupScaler:" From 17eb2406983228ccb33a88d7e72b6c1e5e48d830 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Thu, 14 Sep 2017 22:39:51 +0200 Subject: [PATCH 219/470] Update fuzzer-bot URL. --- src/tools/ftfuzzer/README | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/tools/ftfuzzer/README b/src/tools/ftfuzzer/README index 53f907177..20336ae2e 100644 --- a/src/tools/ftfuzzer/README +++ b/src/tools/ftfuzzer/README @@ -29,10 +29,14 @@ Usage: The exact flags and commands may vary. + https://github.com/google/oss-fuzz/tree/master/projects/freetype2 There is a continuous fuzzing bot that runs ftfuzzer. - https://github.com/google/libfuzzer-bot/tree/master/freetype + https://oss-fuzz.com + +(You need an account to be able to see coverage reports and the like +on oss-fuzz.com.) Check the bot configuration for the most current settings. From 1264d9a64ba79b9531fc1c5b2a53ff382b507200 Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Fri, 15 Sep 2017 21:49:34 -0400 Subject: [PATCH 220/470] Minor. --- include/freetype/ftoutln.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/freetype/ftoutln.h b/include/freetype/ftoutln.h index 07f73ebb1..56f56a960 100644 --- a/include/freetype/ftoutln.h +++ b/include/freetype/ftoutln.h @@ -385,6 +385,9 @@ FT_BEGIN_HEADER /* @FT_Outline_Embolden, which uses the same strength in both */ /* directions. */ /* */ + /* */ + /* 2.4.10 */ + /* */ FT_EXPORT( FT_Error ) FT_Outline_EmboldenXY( FT_Outline* outline, FT_Pos xstrength, From c28e9c9b3e2cb708afb14fc7572a7380266fc71b Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Fri, 15 Sep 2017 22:23:01 -0400 Subject: [PATCH 221/470] Typos. --- ChangeLog | 12 ++++++------ docs/CHANGES | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4708ba577..f41a12d1f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -265,7 +265,7 @@ 2017-08-08 Alexei Podtelezhnikov - * src/sftnt/ttpost.c (format): Use otspec-compliant versions. + * src/sfnt/ttpost.c (format): Use otspec-compliant versions. 2017-08-05 Werner Lemberg @@ -1012,7 +1012,7 @@ due to rounding. In order to optimize the padding, we now expand CBox for the given filter weights before rounding. - This change breakes current Skia (and Firefox). + This change breaks current Skia (and Firefox). * include/freetype/internal/ftobjs.h (FT_LibraryRec) [FT_CONFIG_OPTION_SUBPIXEL_RENDERING]: Remove `lcd_extra' field. @@ -1397,7 +1397,7 @@ [truetype] Do linear scaling for FT_LOAD_NO_HINTING (#50470). - * src/truetype/ttobs.h (TT_SizeRec): Add field `hinted_metrics' to + * src/truetype/ttobjs.h (TT_SizeRec): Add field `hinted_metrics' to hold hinted metrics. Make `metrics' a pointer so that `tt_glyph_load' can easily switch between metrics. @@ -2166,7 +2166,7 @@ * src/sfnt/sfdriver.c (search_name_id): Rename to... (sfnt_get_name_id): ... this. - (sfnt_get_ps_name, sfnt_interface): Udpated. + (sfnt_get_ps_name, sfnt_interface): Updated. 2017-03-04 Werner Lemberg @@ -2592,7 +2592,7 @@ * include/freetype/ftsnames.h (FT_SfntLangTag): New structure. (FT_Get_Sfnt_LangTag): New declaration. - * src/base/ftsnames.c (FT_Get_Sfnt_LangTag): New funtion. + * src/base/ftsnames.c (FT_Get_Sfnt_LangTag): New function. * docs/CHANGES: Updated. @@ -4615,7 +4615,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1270288 - * src/cff/cf2interp.c (cf2_interpT2CharString): Initialize `storage' + * src/cff/cf2intrp.c (cf2_interpT2CharString): Initialize `storage' array to handle a `get' opcode without a previous `put'. 2016-09-05 Alexei Podtelezhnikov diff --git a/docs/CHANGES b/docs/CHANGES index 839eefb36..1a016dc24 100644 --- a/docs/CHANGES +++ b/docs/CHANGES @@ -63,7 +63,7 @@ CHANGES BETWEEN 2.8 and 2.8.1 mode is now always void of any hinting in x-direction. - 16bit compiler support is now officially ended. We didn't - provide any maintainance since many years, and given that there + provide any maintenance since many years, and given that there were no error or problem reports either it seems that it is no longer needed. From 39ce3ac499d4cd7371031a062f410953c8ecce29 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sat, 16 Sep 2017 19:08:17 +0200 Subject: [PATCH 222/470] * Version 2.8.1 released. ========================= Tag sources with `VER-2-8-1'. * docs/VERSION.TXT: Add entry for version 2.8.1. * docs/CHANGES: Updated. * README, Jamfile (RefDoc), builds/windows/vc2005/freetype.vcproj, builds/windows/vc2005/index.html, builds/windows/vc2008/freetype.vcproj, builds/windows/vc2008/index.html, builds/windows/vc2010/freetype.vcxproj, builds/windows/vc2010/index.html, builds/windows/visualc/freetype.dsp, builds/windows/visualc/freetype.vcproj, builds/windows/visualc/index.html, builds/windows/visualce/freetype.dsp, builds/windows/visualce/freetype.vcproj, builds/windows/visualce/index.html, builds/wince/vc2005-ce/freetype.vcproj, builds/wince/vc2005-ce/index.html, builds/wince/vc2008-ce/freetype.vcproj, builds/wince/vc2008-ce/index.html: s/2.8/2.8.1/, s/28/281/. * include/freetype/freetype.h (FREETYPE_PATCH): Set to 1. * builds/unix/configure.raw (version_info): Set to 21:0:15. * CMakeLists.txt (VERSION_PATCH): Set to 1. --- CMakeLists.txt | 2 +- ChangeLog | 35 ++++++++++- Jamfile | 2 +- README | 10 +-- builds/unix/configure.raw | 2 +- builds/wince/vc2005-ce/freetype.vcproj | 76 +++++++++++----------- builds/wince/vc2005-ce/index.html | 10 +-- builds/wince/vc2008-ce/freetype.vcproj | 76 +++++++++++----------- builds/wince/vc2008-ce/index.html | 10 +-- builds/windows/vc2005/freetype.vcproj | 12 ++-- builds/windows/vc2005/index.html | 10 +-- builds/windows/vc2008/freetype.vcproj | 12 ++-- builds/windows/vc2008/index.html | 10 +-- builds/windows/vc2010/freetype.vcxproj | 24 +++---- builds/windows/vc2010/index.html | 14 ++--- builds/windows/visualc/freetype.dsp | 20 +++--- builds/windows/visualc/freetype.vcproj | 12 ++-- builds/windows/visualc/index.html | 10 +-- builds/windows/visualce/freetype.dsp | 20 +++--- builds/windows/visualce/freetype.vcproj | 84 ++++++++++++------------- builds/windows/visualce/index.html | 10 +-- docs/CHANGES | 12 ++++ docs/VERSIONS.TXT | 1 + docs/freetype-config.1 | 2 +- include/freetype/freetype.h | 2 +- src/base/ftcalc.c | 2 +- src/cache/ftcbasic.c | 2 +- src/sfnt/pngshim.c | 4 +- src/sfnt/ttcmap.h | 2 +- src/smooth/ftsmooth.c | 1 + src/truetype/ttobjs.c | 10 +-- 31 files changed, 273 insertions(+), 226 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d1b053e2b..8115f1a4b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -154,7 +154,7 @@ endif () set(VERSION_MAJOR "2") set(VERSION_MINOR "8") -set(VERSION_PATCH "0") +set(VERSION_PATCH "1") set(PROJECT_VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}) set(SHARED_LIBRARY_VERSION ${VERSION_MAJOR}.${VERSION_MINOR}) diff --git a/ChangeLog b/ChangeLog index f41a12d1f..f6de03c78 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,39 @@ +2017-09-16 Werner Lemberg + + * Version 2.8.1 released. + ========================= + + + Tag sources with `VER-2-8-1'. + + * docs/VERSION.TXT: Add entry for version 2.8.1. + * docs/CHANGES: Updated. + + * README, Jamfile (RefDoc), builds/windows/vc2005/freetype.vcproj, + builds/windows/vc2005/index.html, + builds/windows/vc2008/freetype.vcproj, + builds/windows/vc2008/index.html, + builds/windows/vc2010/freetype.vcxproj, + builds/windows/vc2010/index.html, + builds/windows/visualc/freetype.dsp, + builds/windows/visualc/freetype.vcproj, + builds/windows/visualc/index.html, + builds/windows/visualce/freetype.dsp, + builds/windows/visualce/freetype.vcproj, + builds/windows/visualce/index.html, + builds/wince/vc2005-ce/freetype.vcproj, + builds/wince/vc2005-ce/index.html, + builds/wince/vc2008-ce/freetype.vcproj, + builds/wince/vc2008-ce/index.html: s/2.8/2.8.1/, s/28/281/. + + * include/freetype/freetype.h (FREETYPE_PATCH): Set to 1. + + * builds/unix/configure.raw (version_info): Set to 21:0:15. + * CMakeLists.txt (VERSION_PATCH): Set to 1. + 2017-09-13 suzuki toshiya - [sfnt] lowest gcc for vectors ( e1d0249e ) is changed to 4.7. + [sfnt] lowest gcc for vectors (e1d0249e) is changed to 4.7. __builtin_shuffle() was introduced in gcc-4.7. The lowest gcc to enable vector operation is delayed from 4.6 to 4.7. diff --git a/Jamfile b/Jamfile index 5df9b8fef..aa3d9f0db 100644 --- a/Jamfile +++ b/Jamfile @@ -210,7 +210,7 @@ actions RefDoc { python $(FT2_SRC)/tools/docmaker/docmaker.py --prefix=ft2 - --title=FreeType-2.8 + --title=FreeType-2.8.1 --output=$(DOC_DIR) $(FT2_INCLUDE)/freetype/*.h $(FT2_INCLUDE)/freetype/config/*.h diff --git a/README b/README index 926e9dc11..35324b0a7 100644 --- a/README +++ b/README @@ -1,5 +1,5 @@ - FreeType 2.8 - ============ + FreeType 2.8.1 + ============== Homepage: http://www.freetype.org @@ -24,9 +24,9 @@ and download one of the following files. - freetype-doc-2.8.tar.bz2 - freetype-doc-2.8.tar.gz - ftdoc28.zip + freetype-doc-2.8.1.tar.bz2 + freetype-doc-2.8.1.tar.gz + ftdoc281.zip To view the documentation online, go to diff --git a/builds/unix/configure.raw b/builds/unix/configure.raw index b2bb16045..d91a73266 100644 --- a/builds/unix/configure.raw +++ b/builds/unix/configure.raw @@ -17,7 +17,7 @@ AC_CONFIG_SRCDIR([ftconfig.in]) # Don't forget to update `docs/VERSIONS.TXT'! -version_info='20:0:14' +version_info='21:0:15' AC_SUBST([version_info]) ft_version=`echo $version_info | tr : .` AC_SUBST([ft_version]) diff --git a/builds/wince/vc2005-ce/freetype.vcproj b/builds/wince/vc2005-ce/freetype.vcproj index a1c0e3729..880527946 100644 --- a/builds/wince/vc2005-ce/freetype.vcproj +++ b/builds/wince/vc2005-ce/freetype.vcproj @@ -21,7 +21,7 @@ - + @@ -41,7 +41,7 @@ - + @@ -61,7 +61,7 @@ - + @@ -81,7 +81,7 @@ - + @@ -101,7 +101,7 @@ - + @@ -121,7 +121,7 @@ - + @@ -141,7 +141,7 @@ - + @@ -161,7 +161,7 @@ - + @@ -181,7 +181,7 @@ - + @@ -201,7 +201,7 @@ - + @@ -221,7 +221,7 @@ - + @@ -241,7 +241,7 @@ - + @@ -261,7 +261,7 @@ - + @@ -281,7 +281,7 @@ - + @@ -301,7 +301,7 @@ - + @@ -321,7 +321,7 @@ - + @@ -341,7 +341,7 @@ - + @@ -361,7 +361,7 @@ - + @@ -381,7 +381,7 @@ - + @@ -401,7 +401,7 @@ - + @@ -421,7 +421,7 @@ - + @@ -441,7 +441,7 @@ - + @@ -461,7 +461,7 @@ - + @@ -481,7 +481,7 @@ - + @@ -501,7 +501,7 @@ - + @@ -521,7 +521,7 @@ - + @@ -541,7 +541,7 @@ - + @@ -561,7 +561,7 @@ - + @@ -581,7 +581,7 @@ - + @@ -601,7 +601,7 @@ - + @@ -621,7 +621,7 @@ - + @@ -641,7 +641,7 @@ - + @@ -661,7 +661,7 @@ - + @@ -681,7 +681,7 @@ - + @@ -701,7 +701,7 @@ - + @@ -721,7 +721,7 @@ - + @@ -741,7 +741,7 @@ - + @@ -758,7 +758,7 @@ - + diff --git a/builds/wince/vc2005-ce/index.html b/builds/wince/vc2005-ce/index.html index fcb52bc5b..87fbc5adc 100644 --- a/builds/wince/vc2005-ce/index.html +++ b/builds/wince/vc2005-ce/index.html @@ -21,14 +21,14 @@ the following targets:

  • PPC/SP WM6 (Windows Mobile 6)
  • -It compiles the following libraries from the FreeType 2.8 sources:

    +It compiles the following libraries from the FreeType 2.8.1 sources:

      -    freetype28.lib     - release build; single threaded
      -    freetype28_D.lib   - debug build;   single threaded
      -    freetype28MT.lib   - release build; multi-threaded
      -    freetype28MT_D.lib - debug build;   multi-threaded
      + freetype281.lib - release build; single threaded + freetype281_D.lib - debug build; single threaded + freetype281MT.lib - release build; multi-threaded + freetype281MT_D.lib - debug build; multi-threaded

    Be sure to extract the files with the Windows (CR+LF) line endings. ZIP diff --git a/builds/wince/vc2008-ce/freetype.vcproj b/builds/wince/vc2008-ce/freetype.vcproj index 273aa53d4..2616df8b4 100644 --- a/builds/wince/vc2008-ce/freetype.vcproj +++ b/builds/wince/vc2008-ce/freetype.vcproj @@ -88,7 +88,7 @@ /> PPC/SP WM6 (Windows Mobile 6) -It compiles the following libraries from the FreeType 2.8 sources:

    +It compiles the following libraries from the FreeType 2.8.1 sources:

      -    freetype28.lib     - release build; single threaded
      -    freetype28_D.lib   - debug build;   single threaded
      -    freetype28MT.lib   - release build; multi-threaded
      -    freetype28MT_D.lib - debug build;   multi-threaded
      + freetype281.lib - release build; single threaded + freetype281_D.lib - debug build; single threaded + freetype281MT.lib - release build; multi-threaded + freetype281MT_D.lib - debug build; multi-threaded

    Be sure to extract the files with the Windows (CR+LF) line endings. ZIP diff --git a/builds/windows/vc2005/freetype.vcproj b/builds/windows/vc2005/freetype.vcproj index e5e67d5b3..099c527b2 100644 --- a/builds/windows/vc2005/freetype.vcproj +++ b/builds/windows/vc2005/freetype.vcproj @@ -16,7 +16,7 @@ - + @@ -33,7 +33,7 @@ - + @@ -50,7 +50,7 @@ - + @@ -67,7 +67,7 @@ - + @@ -84,7 +84,7 @@ - + @@ -101,7 +101,7 @@ - + diff --git a/builds/windows/vc2005/index.html b/builds/windows/vc2005/index.html index 4bd9b75b7..2a0014889 100644 --- a/builds/windows/vc2005/index.html +++ b/builds/windows/vc2005/index.html @@ -11,14 +11,14 @@

    This directory contains project files for Visual C++, named freetype.vcproj, and Visual Studio, called freetype.sln. It -compiles the following libraries from the FreeType 2.8 sources:

    +compiles the following libraries from the FreeType 2.8.1 sources:

      -    freetype28.lib     - release build; single threaded
      -    freetype28_D.lib   - debug build;   single threaded
      -    freetype28MT.lib   - release build; multi-threaded
      -    freetype28MT_D.lib - debug build;   multi-threaded
      + freetype281.lib - release build; single threaded + freetype281_D.lib - debug build; single threaded + freetype281MT.lib - release build; multi-threaded + freetype281MT_D.lib - debug build; multi-threaded

    Be sure to extract the files with the Windows (CR+LF) line endings. ZIP diff --git a/builds/windows/vc2008/freetype.vcproj b/builds/windows/vc2008/freetype.vcproj index a8bc67295..5b505dab9 100644 --- a/builds/windows/vc2008/freetype.vcproj +++ b/builds/windows/vc2008/freetype.vcproj @@ -70,7 +70,7 @@ /> This directory contains project files for Visual C++, named freetype.vcproj, and Visual Studio, called freetype.sln. It -compiles the following libraries from the FreeType 2.8 sources:

    +compiles the following libraries from the FreeType 2.8.1 sources:

      -    freetype28.lib     - release build; single threaded
      -    freetype28_D.lib   - debug build;   single threaded
      -    freetype28MT.lib   - release build; multi-threaded
      -    freetype28MT_D.lib - debug build;   multi-threaded
      + freetype281.lib - release build; single threaded + freetype281_D.lib - debug build; single threaded + freetype281MT.lib - release build; multi-threaded + freetype281MT_D.lib - debug build; multi-threaded

    Be sure to extract the files with the Windows (CR+LF) line endings. ZIP diff --git a/builds/windows/vc2010/freetype.vcxproj b/builds/windows/vc2010/freetype.vcxproj index 592657d29..5d8182e79 100644 --- a/builds/windows/vc2010/freetype.vcxproj +++ b/builds/windows/vc2010/freetype.vcxproj @@ -205,18 +205,18 @@ - freetype28d - freetype28d - freetype28MTd - freetype28MTd - freetype28STd - freetype28STd - freetype28 - freetype28 - freetype28MT - freetype28MT - freetype28ST - freetype28ST + freetype281d + freetype281d + freetype281MTd + freetype281MTd + freetype281STd + freetype281STd + freetype281 + freetype281 + freetype281MT + freetype281MT + freetype281ST + freetype281ST diff --git a/builds/windows/vc2010/index.html b/builds/windows/vc2010/index.html index c2b580045..8209e2427 100644 --- a/builds/windows/vc2010/index.html +++ b/builds/windows/vc2010/index.html @@ -12,16 +12,16 @@

    This directory contains a project file for Visual C++ (VS.NET 2010 or newer), named freetype.vcxproj, and Visual Studio, called freetype.sln. It compiles the following libraries from the -FreeType 2.8 sources:

    +FreeType 2.8.1 sources:

      -    freetype28.lib    - release build
      -    freetype28d.lib   - debug build
      -    freetype28ST.lib  - release build; single threaded
      -    freetype28STd.lib - debug build;   single threaded
      -    freetype28MT.lib  - release build; multi-threaded
      -    freetype28MTd.lib - debug build;   multi-threaded
      + freetype281.lib - release build + freetype281d.lib - debug build + freetype281ST.lib - release build; single threaded + freetype281STd.lib - debug build; single threaded + freetype281MT.lib - release build; multi-threaded + freetype281MTd.lib - debug build; multi-threaded

    Both Win32 and x64 builds are supported.

    diff --git a/builds/windows/visualc/freetype.dsp b/builds/windows/visualc/freetype.dsp index fc14b48ce..1a613128f 100644 --- a/builds/windows/visualc/freetype.dsp +++ b/builds/windows/visualc/freetype.dsp @@ -54,7 +54,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LIB32=link.exe -lib # ADD BASE LIB32 /nologo -# ADD LIB32 /nologo /out:"..\..\..\objs\freetype28.lib" +# ADD LIB32 /nologo /out:"..\..\..\objs\freetype281.lib" !ELSEIF "$(CFG)" == "freetype - Win32 Debug" @@ -78,7 +78,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LIB32=link.exe -lib # ADD BASE LIB32 /nologo -# ADD LIB32 /nologo /out:"..\..\..\objs\freetype28_D.lib" +# ADD LIB32 /nologo /out:"..\..\..\objs\freetype281_D.lib" !ELSEIF "$(CFG)" == "freetype - Win32 Debug Multithreaded" @@ -102,8 +102,8 @@ BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LIB32=link.exe -lib -# ADD BASE LIB32 /nologo /out:"lib\freetype28_D.lib" -# ADD LIB32 /nologo /out:"..\..\..\objs\freetype28MT_D.lib" +# ADD BASE LIB32 /nologo /out:"lib\freetype281_D.lib" +# ADD LIB32 /nologo /out:"..\..\..\objs\freetype281MT_D.lib" !ELSEIF "$(CFG)" == "freetype - Win32 Release Multithreaded" @@ -126,8 +126,8 @@ BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LIB32=link.exe -lib -# ADD BASE LIB32 /nologo /out:"lib\freetype28.lib" -# ADD LIB32 /nologo /out:"..\..\..\objs\freetype28MT.lib" +# ADD BASE LIB32 /nologo /out:"lib\freetype281.lib" +# ADD LIB32 /nologo /out:"..\..\..\objs\freetype281MT.lib" !ELSEIF "$(CFG)" == "freetype - Win32 Release Singlethreaded" @@ -151,8 +151,8 @@ BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LIB32=link.exe -lib -# ADD BASE LIB32 /nologo /out:"..\..\..\objs\freetype28.lib" -# ADD LIB32 /out:"..\..\..\objs\freetype28ST.lib" +# ADD BASE LIB32 /nologo /out:"..\..\..\objs\freetype281.lib" +# ADD LIB32 /out:"..\..\..\objs\freetype281ST.lib" # SUBTRACT LIB32 /nologo !ELSEIF "$(CFG)" == "freetype - Win32 Debug Singlethreaded" @@ -177,8 +177,8 @@ BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LIB32=link.exe -lib -# ADD BASE LIB32 /nologo /out:"..\..\..\objs\freetype28_D.lib" -# ADD LIB32 /nologo /out:"..\..\..\objs\freetype28ST_D.lib" +# ADD BASE LIB32 /nologo /out:"..\..\..\objs\freetype281_D.lib" +# ADD LIB32 /nologo /out:"..\..\..\objs\freetype281ST_D.lib" !ENDIF diff --git a/builds/windows/visualc/freetype.vcproj b/builds/windows/visualc/freetype.vcproj index 968f2ee75..67b147e47 100644 --- a/builds/windows/visualc/freetype.vcproj +++ b/builds/windows/visualc/freetype.vcproj @@ -69,7 +69,7 @@ /> This directory contains project files for Visual C++, named freetype.dsp, and Visual Studio, called freetype.sln. It -compiles the following libraries from the FreeType 2.8 sources:

    +compiles the following libraries from the FreeType 2.8.1 sources:

      -    freetype28.lib     - release build; single threaded
      -    freetype28_D.lib   - debug build;   single threaded
      -    freetype28MT.lib   - release build; multi-threaded
      -    freetype28MT_D.lib - debug build;   multi-threaded
      + freetype281.lib - release build; single threaded + freetype281_D.lib - debug build; single threaded + freetype281MT.lib - release build; multi-threaded + freetype281MT_D.lib - debug build; multi-threaded

    Be sure to extract the files with the Windows (CR+LF) line endings. ZIP diff --git a/builds/windows/visualce/freetype.dsp b/builds/windows/visualce/freetype.dsp index fc14b48ce..1a613128f 100644 --- a/builds/windows/visualce/freetype.dsp +++ b/builds/windows/visualce/freetype.dsp @@ -54,7 +54,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LIB32=link.exe -lib # ADD BASE LIB32 /nologo -# ADD LIB32 /nologo /out:"..\..\..\objs\freetype28.lib" +# ADD LIB32 /nologo /out:"..\..\..\objs\freetype281.lib" !ELSEIF "$(CFG)" == "freetype - Win32 Debug" @@ -78,7 +78,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LIB32=link.exe -lib # ADD BASE LIB32 /nologo -# ADD LIB32 /nologo /out:"..\..\..\objs\freetype28_D.lib" +# ADD LIB32 /nologo /out:"..\..\..\objs\freetype281_D.lib" !ELSEIF "$(CFG)" == "freetype - Win32 Debug Multithreaded" @@ -102,8 +102,8 @@ BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LIB32=link.exe -lib -# ADD BASE LIB32 /nologo /out:"lib\freetype28_D.lib" -# ADD LIB32 /nologo /out:"..\..\..\objs\freetype28MT_D.lib" +# ADD BASE LIB32 /nologo /out:"lib\freetype281_D.lib" +# ADD LIB32 /nologo /out:"..\..\..\objs\freetype281MT_D.lib" !ELSEIF "$(CFG)" == "freetype - Win32 Release Multithreaded" @@ -126,8 +126,8 @@ BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LIB32=link.exe -lib -# ADD BASE LIB32 /nologo /out:"lib\freetype28.lib" -# ADD LIB32 /nologo /out:"..\..\..\objs\freetype28MT.lib" +# ADD BASE LIB32 /nologo /out:"lib\freetype281.lib" +# ADD LIB32 /nologo /out:"..\..\..\objs\freetype281MT.lib" !ELSEIF "$(CFG)" == "freetype - Win32 Release Singlethreaded" @@ -151,8 +151,8 @@ BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LIB32=link.exe -lib -# ADD BASE LIB32 /nologo /out:"..\..\..\objs\freetype28.lib" -# ADD LIB32 /out:"..\..\..\objs\freetype28ST.lib" +# ADD BASE LIB32 /nologo /out:"..\..\..\objs\freetype281.lib" +# ADD LIB32 /out:"..\..\..\objs\freetype281ST.lib" # SUBTRACT LIB32 /nologo !ELSEIF "$(CFG)" == "freetype - Win32 Debug Singlethreaded" @@ -177,8 +177,8 @@ BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LIB32=link.exe -lib -# ADD BASE LIB32 /nologo /out:"..\..\..\objs\freetype28_D.lib" -# ADD LIB32 /nologo /out:"..\..\..\objs\freetype28ST_D.lib" +# ADD BASE LIB32 /nologo /out:"..\..\..\objs\freetype281_D.lib" +# ADD LIB32 /nologo /out:"..\..\..\objs\freetype281ST_D.lib" !ENDIF diff --git a/builds/windows/visualce/freetype.vcproj b/builds/windows/visualce/freetype.vcproj index f28b3c140..90084b40b 100644 --- a/builds/windows/visualce/freetype.vcproj +++ b/builds/windows/visualce/freetype.vcproj @@ -87,7 +87,7 @@ /> PPC/SP WM6 (Windows Mobile 6) -It compiles the following libraries from the FreeType 2.8 sources:

    +It compiles the following libraries from the FreeType 2.8.1 sources:

      -    freetype28.lib     - release build; single threaded
      -    freetype28_D.lib   - debug build;   single threaded
      -    freetype28MT.lib   - release build; multi-threaded
      -    freetype28MT_D.lib - debug build;   multi-threaded
      + freetype281.lib - release build; single threaded + freetype281_D.lib - debug build; single threaded + freetype281MT.lib - release build; multi-threaded + freetype281MT_D.lib - debug build; multi-threaded

    Be sure to extract the files with the Windows (CR+LF) line endings. ZIP diff --git a/docs/CHANGES b/docs/CHANGES index 1a016dc24..510da893c 100644 --- a/docs/CHANGES +++ b/docs/CHANGES @@ -67,6 +67,18 @@ CHANGES BETWEEN 2.8 and 2.8.1 were no error or problem reports either it seems that it is no longer needed. + - The `ftgrid' demo program can now toggle the display of grid lines + with the `G' key. + + - The `ftgrid' demo program can toggle a different set of colors + (suitable to color-blind people) with the `C' key. + + - The `ftgrid' demo program now supports the `-e' command line option + to select a cmap. + + - The `ftdump' demo program has a new command line option `-t' to + output the SFNT table list. + ====================================================================== diff --git a/docs/VERSIONS.TXT b/docs/VERSIONS.TXT index a4e1980f2..eac4fc816 100644 --- a/docs/VERSIONS.TXT +++ b/docs/VERSIONS.TXT @@ -52,6 +52,7 @@ on _most_ systems, but not all of them: release libtool so ------------------------------- + 2.8.1 21.0.15 6.15.0 2.8.0 20.0.14 6.14.0 2.7.1 19.0.13 6.13.0 2.7.0 18.6.12 6.12.6 diff --git a/docs/freetype-config.1 b/docs/freetype-config.1 index eaaa1b95b..0170b1168 100644 --- a/docs/freetype-config.1 +++ b/docs/freetype-config.1 @@ -1,4 +1,4 @@ -.TH FREETYPE-CONFIG 1 "May 2017" "FreeType 2.8" +.TH FREETYPE-CONFIG 1 "September 2017" "FreeType 2.8.1" . . .SH NAME diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h index 378ba1dd0..b0c261799 100644 --- a/include/freetype/freetype.h +++ b/include/freetype/freetype.h @@ -4457,7 +4457,7 @@ FT_BEGIN_HEADER */ #define FREETYPE_MAJOR 2 #define FREETYPE_MINOR 8 -#define FREETYPE_PATCH 0 +#define FREETYPE_PATCH 1 /*************************************************************************/ diff --git a/src/base/ftcalc.c b/src/base/ftcalc.c index fa28e79b3..00d63c6e6 100644 --- a/src/base/ftcalc.c +++ b/src/base/ftcalc.c @@ -74,7 +74,7 @@ FT_BEGIN_STMNT \ if ( x < 0 ) \ { \ - x_unsigned = 0u - (x_unsigned); \ + x_unsigned = 0U - (x_unsigned); \ s = -s; \ } \ FT_END_STMNT diff --git a/src/cache/ftcbasic.c b/src/cache/ftcbasic.c index bd51a5319..e804776ab 100644 --- a/src/cache/ftcbasic.c +++ b/src/cache/ftcbasic.c @@ -306,7 +306,7 @@ /* * Internal `FTC_BasicAttr->load_flags' is of type `FT_UInt', - * but public `FT_ImageType->flags' is of type `FT_Int32' + * but public `FT_ImageType->flags' is of type `FT_Int32'. * * On 16bit systems, higher bits of type->flags cannot be handled. */ diff --git a/src/sfnt/pngshim.c b/src/sfnt/pngshim.c index 7dc343526..560db4835 100644 --- a/src/sfnt/pngshim.c +++ b/src/sfnt/pngshim.c @@ -57,10 +57,10 @@ { unsigned int i = 0, limit; - /* the `vector_size' attribute was introduced in gcc 3.1, which */ + /* The `vector_size' attribute was introduced in gcc 3.1, which */ /* predates clang; the `__BYTE_ORDER__' preprocessor symbol was */ /* introduced in gcc 4.6 and clang 3.2, respectively. */ - /* __builtin_shuffle() for gcc was introduced in gcc 4.7.0. */ + /* `__builtin_shuffle' for gcc was introduced in gcc 4.7.0. */ #if ( ( defined( __GNUC__ ) && \ ( ( __GNUC__ >= 5 ) || \ ( ( __GNUC__ == 4 ) && ( __GNUC_MINOR__ >= 7 ) ) ) ) || \ diff --git a/src/sfnt/ttcmap.h b/src/sfnt/ttcmap.h index ab02f9bba..f7de0437b 100644 --- a/src/sfnt/ttcmap.h +++ b/src/sfnt/ttcmap.h @@ -141,7 +141,7 @@ FT_BEGIN_HEADER #define TT_VALID_GLYPH_COUNT( x ) TT_VALIDATOR( x )->num_glyphs - FT_CALLBACK_TABLE const TT_CMap_ClassRec tt_cmap_unicode_class_rec; + FT_CALLBACK_TABLE const TT_CMap_ClassRec tt_cmap_unicode_class_rec; FT_LOCAL( FT_Error ) tt_face_build_cmaps( TT_Face face ); diff --git a/src/smooth/ftsmooth.c b/src/smooth/ftsmooth.c index 4b81d3441..963435de1 100644 --- a/src/smooth/ftsmooth.c +++ b/src/smooth/ftsmooth.c @@ -362,6 +362,7 @@ FT_Byte* temp; FT_Int i, j; + /* Render 3 separate monochrome bitmaps, shifting the outline */ /* by 1/3 pixel. */ width /= 3; diff --git a/src/truetype/ttobjs.c b/src/truetype/ttobjs.c index 783df3040..081fa2f1a 100644 --- a/src/truetype/ttobjs.c +++ b/src/truetype/ttobjs.c @@ -576,11 +576,11 @@ /* We must also be able to accept Mac/GX fonts, as well as OT ones. */ /* The 0x00020000 tag is completely undocumented; some fonts from */ /* Arphic made for Chinese Windows 3.1 have this. */ - if ( face->format_tag != 0x00010000L && /* MS fonts */ - face->format_tag != 0x00020000L && /* CJK fonts for Win 3.1 */ - face->format_tag != TTAG_true && /* Mac fonts */ - face->format_tag != TTAG_0xA5kbd && /* Keyboard.dfont for legacy Mac OS X */ - face->format_tag != TTAG_0xA5lst ) /* LastResort.dfont for legacy Mac OS X */ + if ( face->format_tag != 0x00010000L && /* MS fonts */ + face->format_tag != 0x00020000L && /* CJK fonts for Win 3.1 */ + face->format_tag != TTAG_true && /* Mac fonts */ + face->format_tag != TTAG_0xA5kbd && /* `Keyboard.dfont' (legacy Mac OS X) */ + face->format_tag != TTAG_0xA5lst ) /* `LastResort.dfont' (legacy Mac OS X) */ { FT_TRACE2(( " not a TTF font\n" )); goto Bad_Format; From 8b0d2e9e02b6b69c1f97496035c48a51951f2edc Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Mon, 18 Sep 2017 22:54:49 -0400 Subject: [PATCH 223/470] [build] Declutter Visual C++ 2010-2017 project. * build/windows/vc2010/freetype.vcxproj: Use MaxSpeed (/02) optimization for Release configuration throughout the project. --- ChangeLog | 7 + builds/windows/vc2010/freetype.vcxproj | 1106 +----------------------- 2 files changed, 39 insertions(+), 1074 deletions(-) diff --git a/ChangeLog b/ChangeLog index f6de03c78..a4e8e67e6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2017-09-18 Alexei Podtelezhnikov + + [build] Declutter Visual C++ 2010-2017 project. + + * build/windows/vc2010/freetype.vcxproj: Use MaxSpeed (/02) + optimization for Release configuration throughout the project. + 2017-09-16 Werner Lemberg * Version 2.8.1 released. diff --git a/builds/windows/vc2010/freetype.vcxproj b/builds/windows/vc2010/freetype.vcxproj index 5d8182e79..4f212e16e 100644 --- a/builds/windows/vc2010/freetype.vcxproj +++ b/builds/windows/vc2010/freetype.vcxproj @@ -393,7 +393,7 @@ - Full + MaxSpeed AnySuitable $(UserOptionDirectory);..\..\..\include;$(UserIncludeDirectories);%(AdditionalIncludeDirectories) NDEBUG;WIN32;_LIB;_CRT_SECURE_NO_WARNINGS;FT2_BUILD_LIBRARY;$(UserDefines);%(PreprocessorDefinitions) @@ -433,7 +433,7 @@ - Full + MaxSpeed AnySuitable $(UserOptionDirectory);..\..\..\include;$(UserIncludeDirectories);%(AdditionalIncludeDirectories) NDEBUG;WIN32;_LIB;_CRT_SECURE_NO_WARNINGS;FT2_BUILD_LIBRARY;$(UserDefines);%(PreprocessorDefinitions) @@ -473,7 +473,7 @@ - Full + MaxSpeed AnySuitable $(UserOptionDirectory);..\..\..\include;$(UserIncludeDirectories);%(AdditionalIncludeDirectories) NDEBUG;WIN32;_LIB;_CRT_SECURE_NO_WARNINGS;FT2_BUILD_LIBRARY;$(UserDefines);%(PreprocessorDefinitions) @@ -514,7 +514,7 @@ - Full + MaxSpeed AnySuitable $(UserOptionDirectory);..\..\..\include;$(UserIncludeDirectories);%(AdditionalIncludeDirectories) NDEBUG;WIN32;_LIB;_CRT_SECURE_NO_WARNINGS;FT2_BUILD_LIBRARY;$(UserDefines);%(PreprocessorDefinitions) @@ -555,7 +555,7 @@ - Full + MaxSpeed AnySuitable $(UserOptionDirectory);..\..\..\include;$(UserIncludeDirectories);%(AdditionalIncludeDirectories) NDEBUG;WIN32;_LIB;_CRT_SECURE_NO_WARNINGS;FT2_BUILD_LIBRARY;$(UserDefines);%(PreprocessorDefinitions) @@ -595,7 +595,7 @@ - Full + MaxSpeed AnySuitable $(UserOptionDirectory);..\..\..\include;$(UserIncludeDirectories);%(AdditionalIncludeDirectories) NDEBUG;WIN32;_LIB;_CRT_SECURE_NO_WARNINGS;FT2_BUILD_LIBRARY;$(UserDefines);%(PreprocessorDefinitions) @@ -635,552 +635,23 @@ - - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - + + + - - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - false - false - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - false - false - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - false - false - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - false - false - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - false - false - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - false - false - + - - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - + + + + - - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - + + - - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - + @@ -1189,533 +660,20 @@ - - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) + + + + + + + + + + + + + + false @@ -1729,4 +687,4 @@ - \ No newline at end of file + From b00be9f609d8b4e8e45c1d53c1be303779a13d44 Mon Sep 17 00:00:00 2001 From: John Tytgat Date: Tue, 19 Sep 2017 07:12:03 +0200 Subject: [PATCH 224/470] [cff] Fix family name logic of pure CFF fontdata (#52056). 1. If `FamilyName' is present in the CFF font, use this for FT_Face's `family_name'. 2. Otherwise, use the face name and chop off any subset prefix. 3. If at this point FT_Face's `family_name' is set, use this together with the full name to determine the style. 4. Otherwise, use `CIDFontName' as FT_Face's `family_name'. 5. If we don't have a valid style, use "Regular". Previously, FT_Face's `family_name' entry for pure CFF fontdata nearly always was the fontname itself, instead of the `FamilyName' entry in the CFF font (assuming there is one). * src/cff/cffobjs.c (cff_face_init) [pure_cff]: Implement it. --- ChangeLog | 18 ++++++++++++++++++ src/cff/cffobjs.c | 36 +++++++++++++++++++++--------------- 2 files changed, 39 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index a4e8e67e6..64c39ddde 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,21 @@ +2017-09-19 John Tytgat + + [cff] Fix family name logic of pure CFF fontdata (#52056). + + 1. If `FamilyName' is present in the CFF font, use this for + FT_Face's `family_name'. + 2. Otherwise, use the face name and chop off any subset prefix. + 3. If at this point FT_Face's `family_name' is set, use this + together with the full name to determine the style. + 4. Otherwise, use `CIDFontName' as FT_Face's `family_name'. + 5. If we don't have a valid style, use "Regular". + + Previously, FT_Face's `family_name' entry for pure CFF fontdata + nearly always was the fontname itself, instead of the `FamilyName' + entry in the CFF font (assuming there is one). + + * src/cff/cffobjs.c (cff_face_init) [pure_cff]: Implement it. + 2017-09-18 Alexei Podtelezhnikov [build] Declutter Visual C++ 2010-2017 project. diff --git a/src/cff/cffobjs.c b/src/cff/cffobjs.c index 61613933f..2899a4cc5 100644 --- a/src/cff/cffobjs.c +++ b/src/cff/cffobjs.c @@ -876,7 +876,8 @@ cffface->height = (FT_Short)( ( cffface->units_per_EM * 12 ) / 10 ); if ( cffface->height < cffface->ascender - cffface->descender ) - cffface->height = (FT_Short)( cffface->ascender - cffface->descender ); + cffface->height = (FT_Short)( cffface->ascender - + cffface->descender ); cffface->underline_position = (FT_Short)( dict->underline_position >> 16 ); @@ -884,27 +885,32 @@ (FT_Short)( dict->underline_thickness >> 16 ); /* retrieve font family & style name */ - cffface->family_name = cff_index_get_name( - cff, - (FT_UInt)( face_index & 0xFFFF ) ); + if ( dict->family_name ) + { + char* family_name; + + + family_name = cff_index_get_sid_string( cff, dict->family_name ); + if ( family_name ) + cffface->family_name = cff_strcpy( memory, family_name ); + } + + if ( !cffface->family_name ) + { + cffface->family_name = cff_index_get_name( + cff, + (FT_UInt)( face_index & 0xFFFF ) ); + if ( cffface->family_name ) + remove_subset_prefix( cffface->family_name ); + } + if ( cffface->family_name ) { char* full = cff_index_get_sid_string( cff, dict->full_name ); char* fullp = full; char* family = cffface->family_name; - char* family_name = NULL; - - remove_subset_prefix( cffface->family_name ); - - if ( dict->family_name ) - { - family_name = cff_index_get_sid_string( cff, - dict->family_name ); - if ( family_name ) - family = family_name; - } /* We try to extract the style name from the full name. */ /* We need to ignore spaces and dashes during the search. */ From 74f442394f4cafccf31ea47f8708a77772cf179a Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Tue, 19 Sep 2017 23:41:27 -0400 Subject: [PATCH 225/470] [build] Fix DLL builds in Visual C++ project. * build/windows/vc2010/freetype.vcxproj: Use DynamicLibrary in Debug and Release configurations. * include/freetype/config/ftconfig.h (FT_EXPORT, FT_EXPORT_DEF) [_DLL]: Use Visual C++ extensions. --- ChangeLog | 9 ++++++ builds/windows/vc2010/freetype.vcxproj | 8 ++--- devel/ftoption.h | 42 -------------------------- include/freetype/config/ftconfig.h | 8 +++-- include/freetype/config/ftoption.h | 42 -------------------------- 5 files changed, 19 insertions(+), 90 deletions(-) diff --git a/ChangeLog b/ChangeLog index 64c39ddde..0aff98ff5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2017-09-19 Alexei Podtelezhnikov + + [build] Fix DLL builds in Visual C++ project. + + * build/windows/vc2010/freetype.vcxproj: Use DynamicLibrary in Debug + and Release configurations. + * include/freetype/config/ftconfig.h (FT_EXPORT, FT_EXPORT_DEF) + [_DLL]: Use Visual C++ extensions. + 2017-09-19 John Tytgat [cff] Fix family name logic of pure CFF fontdata (#52056). diff --git a/builds/windows/vc2010/freetype.vcxproj b/builds/windows/vc2010/freetype.vcxproj index 4f212e16e..f357c754b 100644 --- a/builds/windows/vc2010/freetype.vcxproj +++ b/builds/windows/vc2010/freetype.vcxproj @@ -81,12 +81,12 @@ - StaticLibrary + DynamicLibrary false MultiByte - StaticLibrary + DynamicLibrary false MultiByte @@ -111,12 +111,12 @@ MultiByte - StaticLibrary + DynamicLibrary false MultiByte - StaticLibrary + DynamicLibrary false MultiByte diff --git a/devel/ftoption.h b/devel/ftoption.h index 9f9cac129..11a2d1f49 100644 --- a/devel/ftoption.h +++ b/devel/ftoption.h @@ -268,48 +268,6 @@ FT_BEGIN_HEADER #define FT_CONFIG_OPTION_USE_HARFBUZZ - /*************************************************************************/ - /* */ - /* DLL export compilation */ - /* */ - /* When compiling FreeType as a DLL, some systems/compilers need a */ - /* special keyword in front OR after the return type of function */ - /* declarations. */ - /* */ - /* Two macros are used within the FreeType source code to define */ - /* exported library functions: FT_EXPORT and FT_EXPORT_DEF. */ - /* */ - /* FT_EXPORT( return_type ) */ - /* */ - /* is used in a function declaration, as in */ - /* */ - /* FT_EXPORT( FT_Error ) */ - /* FT_Init_FreeType( FT_Library* alibrary ); */ - /* */ - /* */ - /* FT_EXPORT_DEF( return_type ) */ - /* */ - /* is used in a function definition, as in */ - /* */ - /* FT_EXPORT_DEF( FT_Error ) */ - /* FT_Init_FreeType( FT_Library* alibrary ) */ - /* { */ - /* ... some code ... */ - /* return FT_Err_Ok; */ - /* } */ - /* */ - /* You can provide your own implementation of FT_EXPORT and */ - /* FT_EXPORT_DEF here if you want. If you leave them undefined, they */ - /* will be later automatically defined as `extern return_type' to */ - /* allow normal compilation. */ - /* */ - /* Do not #undef these macros here since the build system might define */ - /* them for certain configurations only. */ - /* */ -/* #define FT_EXPORT(x) extern x */ -/* #define FT_EXPORT_DEF(x) x */ - - /*************************************************************************/ /* */ /* Glyph Postscript Names handling */ diff --git a/include/freetype/config/ftconfig.h b/include/freetype/config/ftconfig.h index 889aebf5a..fa4ac159e 100644 --- a/include/freetype/config/ftconfig.h +++ b/include/freetype/config/ftconfig.h @@ -410,7 +410,9 @@ FT_BEGIN_HEADER #ifndef FT_EXPORT -#ifdef __cplusplus +#if defined( _DLL ) +#define FT_EXPORT( x ) __declspec(dllexport) x +#elif defined( __cplusplus ) #define FT_EXPORT( x ) extern "C" x #else #define FT_EXPORT( x ) extern x @@ -421,7 +423,9 @@ FT_BEGIN_HEADER #ifndef FT_EXPORT_DEF -#ifdef __cplusplus +#if defined( _DLL ) +#define FT_EXPORT_DEF( x ) __declspec(dllexport) x +#elif defined( __cplusplus ) #define FT_EXPORT_DEF( x ) extern "C" x #else #define FT_EXPORT_DEF( x ) extern x diff --git a/include/freetype/config/ftoption.h b/include/freetype/config/ftoption.h index 2fbe80b9b..cb10b1dc6 100644 --- a/include/freetype/config/ftoption.h +++ b/include/freetype/config/ftoption.h @@ -268,48 +268,6 @@ FT_BEGIN_HEADER /* #define FT_CONFIG_OPTION_USE_HARFBUZZ */ - /*************************************************************************/ - /* */ - /* DLL export compilation */ - /* */ - /* When compiling FreeType as a DLL, some systems/compilers need a */ - /* special keyword in front OR after the return type of function */ - /* declarations. */ - /* */ - /* Two macros are used within the FreeType source code to define */ - /* exported library functions: FT_EXPORT and FT_EXPORT_DEF. */ - /* */ - /* FT_EXPORT( return_type ) */ - /* */ - /* is used in a function declaration, as in */ - /* */ - /* FT_EXPORT( FT_Error ) */ - /* FT_Init_FreeType( FT_Library* alibrary ); */ - /* */ - /* */ - /* FT_EXPORT_DEF( return_type ) */ - /* */ - /* is used in a function definition, as in */ - /* */ - /* FT_EXPORT_DEF( FT_Error ) */ - /* FT_Init_FreeType( FT_Library* alibrary ) */ - /* { */ - /* ... some code ... */ - /* return FT_Err_Ok; */ - /* } */ - /* */ - /* You can provide your own implementation of FT_EXPORT and */ - /* FT_EXPORT_DEF here if you want. If you leave them undefined, they */ - /* will be later automatically defined as `extern return_type' to */ - /* allow normal compilation. */ - /* */ - /* Do not #undef these macros here since the build system might define */ - /* them for certain configurations only. */ - /* */ -/* #define FT_EXPORT(x) extern x */ -/* #define FT_EXPORT_DEF(x) x */ - - /*************************************************************************/ /* */ /* Glyph Postscript Names handling */ From eaa9adf325e1612bdc7134648205597d055cb99c Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Wed, 20 Sep 2017 08:00:05 +0200 Subject: [PATCH 226/470] [truetype] Integer overflows. Changes triggered by https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3429 * src/truetype/ttinterp.c (Ins_SHPIX, Ins_DELTAP): Use NEG_LONG. (Ins_MIAP): Use SUB_LONG. --- ChangeLog | 11 +++++++++++ src/truetype/ttinterp.c | 12 ++++++++---- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0aff98ff5..f08b56a28 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2017-09-20 Werner Lemberg + + [truetype] Integer overflows. + + Changes triggered by + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3429 + + * src/truetype/ttinterp.c (Ins_SHPIX, Ins_DELTAP): Use NEG_LONG. + (Ins_MIAP): Use SUB_LONG. + 2017-09-19 Alexei Podtelezhnikov [build] Fix DLL builds in Visual C++ project. diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c index ddcc839bb..c3d710359 100644 --- a/src/truetype/ttinterp.c +++ b/src/truetype/ttinterp.c @@ -5690,7 +5690,11 @@ ( B1 & 63 ) != 0 && ( B2 & 63 ) != 0 && B1 != B2 ) - Move_Zp2_Point( exc, point, -dx, -dy, TRUE ); + Move_Zp2_Point( exc, + point, + NEG_LONG( dx ), + NEG_LONG( dy ), + TRUE ); } } else if ( exc->face->sph_compatibility_mode ) @@ -5722,7 +5726,7 @@ if ( ( B1 & 63 ) == 0 && ( B2 & 63 ) != 0 && B1 != B2 ) - Move_Zp2_Point( exc, point, 0, -dy, TRUE ); + Move_Zp2_Point( exc, point, 0, NEG_LONG( dy ), TRUE ); } } else if ( exc->sph_in_func_flags & SPH_FDEF_TYPEMAN_DIAGENDCTRL ) @@ -5991,7 +5995,7 @@ exc->tt_metrics.compensations[0] ); } - exc->func_move( exc, &exc->zp0, point, distance - org_dist ); + exc->func_move( exc, &exc->zp0, point, SUB_LONG( distance, org_dist ) ); Fail: exc->GS.rp0 = point; @@ -7153,7 +7157,7 @@ SPH_TWEAK_SKIP_NONPIXEL_Y_MOVES_DELTAP ) && ( B1 & 63 ) != 0 && ( B2 & 63 ) != 0 ) ) ) - exc->func_move( exc, &exc->zp0, A, -B ); + exc->func_move( exc, &exc->zp0, A, NEG_LONG( B ) ); } } else From 843e0dc92bb920fa1d639ecb0e3fd34d0106d228 Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Wed, 20 Sep 2017 22:19:01 -0400 Subject: [PATCH 227/470] Restore FT_EXPORT documentation. --- include/freetype/config/ftconfig.h | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/include/freetype/config/ftconfig.h b/include/freetype/config/ftconfig.h index fa4ac159e..6c7a3b792 100644 --- a/include/freetype/config/ftconfig.h +++ b/include/freetype/config/ftconfig.h @@ -408,6 +408,35 @@ FT_BEGIN_HEADER #endif /* !FT_BASE_DEF */ + /* When compiling FreeType as a DLL, some systems/compilers need a */ + /* special attribute in front OR after the return type of function */ + /* declarations. */ + /* */ + /* Two macros are used within the FreeType source code to define */ + /* exported library functions: FT_EXPORT and FT_EXPORT_DEF. */ + /* */ + /* FT_EXPORT( return_type ) */ + /* */ + /* is used in a function declaration, as in */ + /* */ + /* FT_EXPORT( FT_Error ) */ + /* FT_Init_FreeType( FT_Library* alibrary ); */ + /* */ + /* */ + /* FT_EXPORT_DEF( return_type ) */ + /* */ + /* is used in a function definition, as in */ + /* */ + /* FT_EXPORT_DEF( FT_Error ) */ + /* FT_Init_FreeType( FT_Library* alibrary ) */ + /* { */ + /* ... some code ... */ + /* return FT_Err_Ok; */ + /* } */ + /* */ + /* You can provide your own implementation of FT_EXPORT and */ + /* FT_EXPORT_DEF here if you want. */ + /* */ #ifndef FT_EXPORT #if defined( _DLL ) From 3b3cb32dd2340d86d3165961a4bb3dbd44353075 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Thu, 21 Sep 2017 09:03:20 +0200 Subject: [PATCH 228/470] [truetype] Fix `mmvar' array pointers. Without this change, clang's AddressSanitizer reports many runtime errors due to misaligned addresses. * src/truetype/ttgxvar.c (TT_Get_MM_Var): Use multiples of pointer size for sub-array offsets into `mmvar'. --- ChangeLog | 10 ++++++++ src/truetype/ttgxvar.c | 56 ++++++++++++++++++++++++++++++++---------- 2 files changed, 53 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index f08b56a28..ab5530f8e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2017-09-21 Werner Lemberg + + [truetype] Fix `mmvar' array pointers. + + Without this change, clang's AddressSanitizer reports many runtime + errors due to misaligned addresses. + + * src/truetype/ttgxvar.c (TT_Get_MM_Var): Use multiples of pointer + size for sub-array offsets into `mmvar'. + 2017-09-20 Werner Lemberg [truetype] Integer overflows. diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c index 49aa53a68..8c56c56b6 100644 --- a/src/truetype/ttgxvar.c +++ b/src/truetype/ttgxvar.c @@ -1997,6 +1997,14 @@ if ( !face->blend ) { + FT_Offset mmvar_size; + FT_Offset axis_flags_size; + FT_Offset axis_size; + FT_Offset namedstyle_size; + FT_Offset next_coords_size; + FT_Offset next_name_size; + + FT_TRACE2(( "FVAR " )); /* both `fvar' and `gvar' must be present */ @@ -2045,13 +2053,34 @@ /* prepare storage area for MM data; this cannot overflow */ /* 32-bit arithmetic because of the size limits used in the */ /* `fvar' table validity check in `sfnt_init_face' */ - face->blend->mmvar_len = - sizeof ( FT_MM_Var ) + - fvar_head.axisCount * sizeof ( FT_UShort ) + - fvar_head.axisCount * sizeof ( FT_Var_Axis ) + - num_instances * sizeof ( FT_Var_Named_Style ) + - num_instances * fvar_head.axisCount * sizeof ( FT_Fixed ) + - fvar_head.axisCount * 5; + + /* the various `*_size' variables, which we also use as */ + /* offsets into the `mmlen' array, must be multiples of the */ + /* pointer size (except the last one); without such an */ + /* alignment there might be runtime errors due to */ + /* misaligned addresses */ +#undef ALIGN_SIZE +#define ALIGN_SIZE( n ) \ + ( ( (n) + sizeof (void*) - 1 ) & ~( sizeof (void*) - 1 ) ) + + mmvar_size = ALIGN_SIZE( sizeof ( FT_MM_Var ) ); + axis_flags_size = ALIGN_SIZE( fvar_head.axisCount * + sizeof ( FT_UShort ) ); + axis_size = ALIGN_SIZE( fvar_head.axisCount * + sizeof ( FT_Var_Axis ) ); + namedstyle_size = ALIGN_SIZE( num_instances * + sizeof ( FT_Var_Named_Style ) ); + next_coords_size = ALIGN_SIZE( num_instances * + fvar_head.axisCount * + sizeof ( FT_Fixed ) ); + next_name_size = fvar_head.axisCount * 5; + + face->blend->mmvar_len = mmvar_size + + axis_flags_size + + axis_size + + namedstyle_size + + next_coords_size + + next_name_size; if ( FT_ALLOC( mmvar, face->blend->mmvar_len ) ) goto Exit; @@ -2071,21 +2100,22 @@ /* alas, no public field in `FT_Var_Axis' for axis flags */ axis_flags = - (FT_UShort*)&( mmvar[1] ); + (FT_UShort*)( (char*)mmvar + mmvar_size ); mmvar->axis = - (FT_Var_Axis*)&( axis_flags[fvar_head.axisCount] ); + (FT_Var_Axis*)( (char*)axis_flags + axis_flags_size ); mmvar->namedstyle = - (FT_Var_Named_Style*)&( mmvar->axis[fvar_head.axisCount] ); + (FT_Var_Named_Style*)( (char*)mmvar->axis + axis_size ); - next_coords = - (FT_Fixed*)&( mmvar->namedstyle[num_instances] ); + next_coords = (FT_Fixed*)( (char*)mmvar->namedstyle + + namedstyle_size ); for ( i = 0; i < num_instances; i++ ) { mmvar->namedstyle[i].coords = next_coords; next_coords += fvar_head.axisCount; } - next_name = (FT_String*)next_coords; + next_name = (FT_String*)( (char*)mmvar->namedstyle + + namedstyle_size + next_coords_size ); for ( i = 0; i < fvar_head.axisCount; i++ ) { mmvar->axis[i].name = next_name; From b19cdc9c8164cd81801024b024ce132bcb4a29f1 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Thu, 21 Sep 2017 11:02:35 +0200 Subject: [PATCH 229/470] [truetype] Fix `mmvar' array pointers, part 2. The previous commit was incomplete. * src/truetype/ttgxvar.c: Properly initialize sub-array offsets for `master' also. --- ChangeLog | 9 +++ src/truetype/ttgxvar.c | 129 ++++++++++++++++++++++------------------- 2 files changed, 78 insertions(+), 60 deletions(-) diff --git a/ChangeLog b/ChangeLog index ab5530f8e..e4ec61658 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2017-09-21 Werner Lemberg + + [truetype] Fix `mmvar' array pointers, part 2. + + The previous commit was incomplete. + + * src/truetype/ttgxvar.c: Properly initialize sub-array offsets for + `master' also. + 2017-09-21 Werner Lemberg [truetype] Fix `mmvar' array pointers. diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c index 8c56c56b6..461b230a0 100644 --- a/src/truetype/ttgxvar.c +++ b/src/truetype/ttgxvar.c @@ -1940,11 +1940,11 @@ TT_Get_MM_Var( TT_Face face, FT_MM_Var* *master ) { - FT_Stream stream = face->root.stream; - FT_Memory memory = face->root.memory; + FT_Stream stream = face->root.stream; + FT_Memory memory = face->root.memory; FT_ULong table_len; - FT_Error error = FT_Err_Ok; - FT_ULong fvar_start; + FT_Error error = FT_Err_Ok; + FT_ULong fvar_start = 0; FT_UInt i, j; FT_MM_Var* mmvar = NULL; FT_Fixed* next_coords; @@ -1954,10 +1954,20 @@ FT_Fixed* c; FT_Var_Named_Style* ns; GX_FVar_Head fvar_head; - FT_Bool usePsName; + FT_Bool usePsName = 0; FT_UInt num_instances; + FT_UInt num_axes; FT_UShort* axis_flags; + FT_Offset mmvar_size; + FT_Offset axis_flags_size; + FT_Offset axis_size; + FT_Offset namedstyle_size; + FT_Offset next_coords_size; + FT_Offset next_name_size; + + FT_Bool need_init; + static const FT_Frame_Field fvar_fields[] = { @@ -1995,16 +2005,10 @@ /* read the font data and set up the internal representation */ /* if not already done */ - if ( !face->blend ) - { - FT_Offset mmvar_size; - FT_Offset axis_flags_size; - FT_Offset axis_size; - FT_Offset namedstyle_size; - FT_Offset next_coords_size; - FT_Offset next_name_size; - + need_init = !face->blend; + if ( need_init ) + { FT_TRACE2(( "FVAR " )); /* both `fvar' and `gvar' must be present */ @@ -2045,36 +2049,43 @@ if ( FT_NEW( face->blend ) ) goto Exit; - /* `num_instances' holds the number of all named instances, */ - /* including the default instance which might be missing */ - /* in fvar's table of named instances */ - num_instances = face->root.style_flags >> 16; - - /* prepare storage area for MM data; this cannot overflow */ - /* 32-bit arithmetic because of the size limits used in the */ - /* `fvar' table validity check in `sfnt_init_face' */ - - /* the various `*_size' variables, which we also use as */ - /* offsets into the `mmlen' array, must be multiples of the */ - /* pointer size (except the last one); without such an */ - /* alignment there might be runtime errors due to */ - /* misaligned addresses */ + num_axes = fvar_head.axisCount; + } + else + num_axes = face->blend->num_axis; + + /* `num_instances' holds the number of all named instances, */ + /* including the default instance which might be missing */ + /* in fvar's table of named instances */ + num_instances = face->root.style_flags >> 16; + + /* prepare storage area for MM data; this cannot overflow */ + /* 32-bit arithmetic because of the size limits used in the */ + /* `fvar' table validity check in `sfnt_init_face' */ + + /* the various `*_size' variables, which we also use as */ + /* offsets into the `mmlen' array, must be multiples of the */ + /* pointer size (except the last one); without such an */ + /* alignment there might be runtime errors due to */ + /* misaligned addresses */ #undef ALIGN_SIZE #define ALIGN_SIZE( n ) \ ( ( (n) + sizeof (void*) - 1 ) & ~( sizeof (void*) - 1 ) ) - mmvar_size = ALIGN_SIZE( sizeof ( FT_MM_Var ) ); - axis_flags_size = ALIGN_SIZE( fvar_head.axisCount * - sizeof ( FT_UShort ) ); - axis_size = ALIGN_SIZE( fvar_head.axisCount * - sizeof ( FT_Var_Axis ) ); - namedstyle_size = ALIGN_SIZE( num_instances * - sizeof ( FT_Var_Named_Style ) ); - next_coords_size = ALIGN_SIZE( num_instances * - fvar_head.axisCount * - sizeof ( FT_Fixed ) ); - next_name_size = fvar_head.axisCount * 5; + mmvar_size = ALIGN_SIZE( sizeof ( FT_MM_Var ) ); + axis_flags_size = ALIGN_SIZE( num_axes * + sizeof ( FT_UShort ) ); + axis_size = ALIGN_SIZE( num_axes * + sizeof ( FT_Var_Axis ) ); + namedstyle_size = ALIGN_SIZE( num_instances * + sizeof ( FT_Var_Named_Style ) ); + next_coords_size = ALIGN_SIZE( num_instances * + num_axes * + sizeof ( FT_Fixed ) ); + next_name_size = num_axes * 5; + if ( need_init ) + { face->blend->mmvar_len = mmvar_size + axis_flags_size + axis_size + @@ -2090,7 +2101,7 @@ /* the data gets filled in later on */ mmvar->num_axis = - fvar_head.axisCount; + num_axes; mmvar->num_designs = ~0U; /* meaningless in this context; each glyph */ /* may have a different number of designs */ @@ -2111,12 +2122,12 @@ for ( i = 0; i < num_instances; i++ ) { mmvar->namedstyle[i].coords = next_coords; - next_coords += fvar_head.axisCount; + next_coords += num_axes; } next_name = (FT_String*)( (char*)mmvar->namedstyle + namedstyle_size + next_coords_size ); - for ( i = 0; i < fvar_head.axisCount; i++ ) + for ( i = 0; i < num_axes; i++ ) { mmvar->axis[i].name = next_name; next_name += 5; @@ -2128,7 +2139,7 @@ goto Exit; a = mmvar->axis; - for ( i = 0; i < fvar_head.axisCount; i++ ) + for ( i = 0; i < num_axes; i++ ) { GX_FVar_Axis axis_rec; @@ -2178,7 +2189,7 @@ /* named instance coordinates are stored as design coordinates; */ /* we have to convert them to normalized coordinates also */ if ( FT_NEW_ARRAY( face->blend->normalized_stylecoords, - fvar_head.axisCount * num_instances ) ) + num_axes * num_instances ) ) goto Exit; if ( fvar_head.instanceCount && !face->blend->avar_loaded ) @@ -2198,14 +2209,14 @@ { /* PostScript names add 2 bytes to the instance record size */ if ( FT_FRAME_ENTER( ( usePsName ? 6L : 4L ) + - 4L * fvar_head.axisCount ) ) + 4L * num_axes ) ) goto Exit; ns->strid = FT_GET_USHORT(); (void) /* flags = */ FT_GET_USHORT(); c = ns->coords; - for ( j = 0; j < fvar_head.axisCount; j++, c++ ) + for ( j = 0; j < num_axes; j++, c++ ) *c = FT_GET_LONG(); /* valid psid values are 6, [256;32767], and 0xFFFF */ @@ -2214,11 +2225,8 @@ else ns->psid = 0xFFFF; - ft_var_to_normalized( face, - fvar_head.axisCount, - ns->coords, - nsc ); - nsc += fvar_head.axisCount; + ft_var_to_normalized( face, num_axes, ns->coords, nsc ); + nsc += num_axes; FT_FRAME_EXIT(); } @@ -2267,7 +2275,7 @@ a = mmvar->axis; c = ns->coords; - for ( j = 0; j < fvar_head.axisCount; j++, a++, c++ ) + for ( j = 0; j < num_axes; j++, a++, c++ ) *c = a->def; } } @@ -2288,23 +2296,24 @@ FT_MEM_COPY( mmvar, face->blend->mmvar, face->blend->mmvar_len ); axis_flags = - (FT_UShort*)&( mmvar[1] ); + (FT_UShort*)( (char*)mmvar + mmvar_size ); mmvar->axis = - (FT_Var_Axis*)&( axis_flags[mmvar->num_axis] ); + (FT_Var_Axis*)( (char*)axis_flags + axis_flags_size ); mmvar->namedstyle = - (FT_Var_Named_Style*)&( mmvar->axis[mmvar->num_axis] ); + (FT_Var_Named_Style*)( (char*)mmvar->axis+ axis_size ); - next_coords = - (FT_Fixed*)&( mmvar->namedstyle[mmvar->num_namedstyles] ); + next_coords = (FT_Fixed*)( (char*)mmvar->namedstyle + + namedstyle_size ); for ( n = 0; n < mmvar->num_namedstyles; n++ ) { mmvar->namedstyle[n].coords = next_coords; - next_coords += mmvar->num_axis; + next_coords += num_axes; } a = mmvar->axis; - next_name = (FT_String*)next_coords; - for ( n = 0; n < mmvar->num_axis; n++ ) + next_name = (FT_String*)( (char*)mmvar->namedstyle + + namedstyle_size + next_coords_size ); + for ( n = 0; n < num_axes; n++ ) { a->name = next_name; From cf64e338dd798039b1ed00554044ea2207d766f2 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Thu, 21 Sep 2017 11:42:48 +0200 Subject: [PATCH 230/470] [sfnt] Fix postscript name for default instance of variation fonts. Problem reported by Behdad. * src/sfnt/sfdriver.c (sfnt_get_ps_name): Test `is_default_instance'. --- ChangeLog | 9 +++++++++ src/sfnt/sfdriver.c | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index e4ec61658..f7897215c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2017-09-21 Werner Lemberg + + [sfnt] Fix postscript name for default instance of variation fonts. + + Problem reported by Behdad. + + * src/sfnt/sfdriver.c (sfnt_get_ps_name): Test + `is_default_instance'. + 2017-09-21 Werner Lemberg [truetype] Fix `mmvar' array pointers, part 2. diff --git a/src/sfnt/sfdriver.c b/src/sfnt/sfdriver.c index 991433ee4..b4f084247 100644 --- a/src/sfnt/sfdriver.c +++ b/src/sfnt/sfdriver.c @@ -1029,7 +1029,7 @@ return face->postscript_name; #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT - if ( face->blend ) + if ( face->blend && !face->is_default_instance ) { face->postscript_name = sfnt_get_var_ps_name( face ); return face->postscript_name; From 1ad07c1c79841e54ff3d5c37e28bfb91f402ee84 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Thu, 21 Sep 2017 14:56:58 +0200 Subject: [PATCH 231/470] Add some `since' fields (back to version 2.4.8). --- include/freetype/freetype.h | 92 ++++++++++++++++++++----------------- include/freetype/ftautoh.h | 25 ++++++++++ include/freetype/ftcffdrv.h | 19 ++++++++ include/freetype/ftgzip.h | 3 ++ include/freetype/ftimage.h | 14 +++--- include/freetype/ftlcdfil.h | 6 +++ include/freetype/ftmm.h | 12 +++++ include/freetype/ftmodapi.h | 3 ++ include/freetype/ftpcfdrv.h | 2 + include/freetype/ftsnames.h | 12 +++++ include/freetype/ftttdrv.h | 3 ++ include/freetype/t1tables.h | 9 ++++ 12 files changed, 152 insertions(+), 48 deletions(-) diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h index b0c261799..de4dc3982 100644 --- a/include/freetype/freetype.h +++ b/include/freetype/freetype.h @@ -888,15 +888,15 @@ FT_BEGIN_HEADER /* are set to~0 if there is only one face in */ /* the font file. */ /* */ - /* Bits 16-30 are relevant to GX and OpenType */ - /* variation fonts only, holding the named */ - /* instance index for the current face index */ - /* (starting with value~1; value~0 indicates */ - /* font access without a named instance). For */ - /* non-variation fonts, bits 16-30 are */ - /* ignored. If we have the third named */ - /* instance of face~4, say, `face_index' is */ - /* set to 0x00030004. */ + /* [Since 2.6.1] Bits 16-30 are relevant to GX */ + /* and OpenType variation fonts only, holding */ + /* the named instance index for the current */ + /* face index (starting with value~1; value~0 */ + /* indicates font access without a named */ + /* instance). For non-variation fonts, bits */ + /* 16-30 are ignored. If we have the third */ + /* named instance of face~4, say, `face_index' */ + /* is set to 0x00030004. */ /* */ /* Bit 31 is always zero (this is, */ /* `face_index' is always a positive value). */ @@ -907,15 +907,16 @@ FT_BEGIN_HEADER /* */ /* style_flags :: The lower 16~bits contain a set of bit */ /* flags indicating the style of the face; see */ - /* @FT_STYLE_FLAG_XXX for the details. Bits */ - /* 16-30 hold the number of named instances */ - /* available for the current face if we have a */ - /* GX or OpenType variation (sub)font. Bit 31 */ - /* is always zero (this is, `style_flags' is */ - /* always a positive value). Note that a */ - /* variation font has always at least one */ - /* named instance, namely the default */ - /* instance. */ + /* @FT_STYLE_FLAG_XXX for the details. */ + /* */ + /* [Since 2.6.1] Bits 16-30 hold the number */ + /* of named instances available for the */ + /* current face if we have a GX or OpenType */ + /* variation (sub)font. Bit 31 is always zero */ + /* (this is, `style_flags' is always a */ + /* positive value). Note that a variation */ + /* font has always at least one named */ + /* instance, namely the default instance. */ /* */ /* num_glyphs :: The number of glyphs in the face. If the */ /* face is scalable and has sbits (see */ @@ -1212,8 +1213,8 @@ FT_BEGIN_HEADER /* tricky fonts; they are hard-coded in file `ttobjs.c'. */ /* */ /* FT_FACE_FLAG_COLOR :: */ - /* The face has color glyph tables. To access color glyphs use */ - /* @FT_LOAD_COLOR. */ + /* [Since 2.5.1] The face has color glyph tables. To access color */ + /* glyphs use @FT_LOAD_COLOR. */ /* */ #define FT_FACE_FLAG_SCALABLE ( 1L << 0 ) #define FT_FACE_FLAG_FIXED_SIZES ( 1L << 1 ) @@ -1391,6 +1392,9 @@ FT_BEGIN_HEADER * A macro that returns true whenever a face object is a named instance * of a GX or OpenType variation font. * + * @since: + * 2.7 + * */ #define FT_IS_NAMED_INSTANCE( face ) \ ( (face)->face_index & 0x7FFF0000L ) @@ -1437,6 +1441,9 @@ FT_BEGIN_HEADER * A macro that returns true whenever a face object contains * tables for color glyphs. * + * @since: + * 2.5.1 + * */ #define FT_HAS_COLOR( face ) \ ( (face)->face_flags & FT_FACE_FLAG_COLOR ) @@ -2155,14 +2162,14 @@ FT_BEGIN_HEADER /* with value~0). Set it to~0 if there is only one */ /* face in the font file. */ /* */ - /* Bits 16-30 are relevant to GX and OpenType variation */ - /* fonts only, specifying the named instance index for */ - /* the current face index (starting with value~1; */ - /* value~0 makes FreeType ignore named instances). For */ - /* non-variation fonts, bits 16-30 are ignored. */ - /* Assuming that you want to access the third named */ - /* instance in face~4, `face_index' should be set to */ - /* 0x00030004. If you want to access face~4 without */ + /* [Since 2.6.1] Bits 16-30 are relevant to GX and */ + /* OpenType variation fonts only, specifying the named */ + /* instance index for the current face index (starting */ + /* with value~1; value~0 makes FreeType ignore named */ + /* instances). For non-variation fonts, bits 16-30 are */ + /* ignored. Assuming that you want to access the third */ + /* named instance in face~4, `face_index' should be set */ + /* to 0x00030004. If you want to access face~4 without */ /* variation handling, simply set `face_index' to */ /* value~4. */ /* */ @@ -2869,26 +2876,26 @@ FT_BEGIN_HEADER * Disable the auto-hinter. See also the note below. * * FT_LOAD_COLOR :: - * Load embedded color bitmap images. The resulting color bitmaps, - * if available, will have the @FT_PIXEL_MODE_BGRA format. If the - * flag is not set and color bitmaps are found, they are converted - * to 256-level gray bitmaps transparently, using the + * [Since 2.5] Load embedded color bitmap images. The resulting color + * bitmaps, if available, will have the @FT_PIXEL_MODE_BGRA format. + * If the flag is not set and color bitmaps are found, they are + * converted to 256-level gray bitmaps transparently, using the * @FT_PIXEL_MODE_GRAY format. * * FT_LOAD_COMPUTE_METRICS :: - * Compute glyph metrics from the glyph data, without the use of - * bundled metrics tables (for example, the `hdmx' table in TrueType - * fonts). This flag is mainly used by font validating or font - * editing applications, which need to ignore, verify, or edit those - * tables. + * [Since 2.6.1] Compute glyph metrics from the glyph data, without + * the use of bundled metrics tables (for example, the `hdmx' table in + * TrueType fonts). This flag is mainly used by font validating or + * font editing applications, which need to ignore, verify, or edit + * those tables. * * Currently, this flag is only implemented for TrueType fonts. * * FT_LOAD_BITMAP_METRICS_ONLY :: - * Request loading of the metrics and bitmap image information of a - * (possibly embedded) bitmap glyph without allocating or copying - * the bitmap image data itself. No effect if the target glyph is - * not a bitmap image. + * [Since 2.7.1] Request loading of the metrics and bitmap image + * information of a (possibly embedded) bitmap glyph without + * allocating or copying the bitmap image data itself. No effect if + * the target glyph is not a bitmap image. * * This flag unsets @FT_LOAD_RENDER. * @@ -3775,6 +3782,9 @@ FT_BEGIN_HEADER * FT_Face_Properties( face, 1, &property ); * } * + * @since: + * 2.8 + * */ FT_EXPORT( FT_Error ) FT_Face_Properties( FT_Face face, diff --git a/include/freetype/ftautoh.h b/include/freetype/ftautoh.h index 2bb675ae4..60fadea4b 100644 --- a/include/freetype/ftautoh.h +++ b/include/freetype/ftautoh.h @@ -106,6 +106,9 @@ FT_BEGIN_HEADER * FT_Load_Glyph( face, ..., FT_LOAD_FORCE_AUTOHINT ); * } * + * @since: + * 2.4.11 + * */ @@ -227,6 +230,9 @@ FT_BEGIN_HEADER * Note that currently Indic support is rudimentary only, missing blue * zone support. * + * @since: + * 2.4.11 + * */ #define FT_AUTOHINTER_SCRIPT_NONE 0 #define FT_AUTOHINTER_SCRIPT_LATIN 1 @@ -244,6 +250,9 @@ FT_BEGIN_HEADER * * The data exchange structure for the @glyph-to-script-map property. * + * @since: + * 2.4.11 + * */ typedef struct FT_Prop_GlyphToScriptMap_ { @@ -289,6 +298,9 @@ FT_BEGIN_HEADER * an @FT_Face structure but not loaded any glyph (using the * auto-hinter), a change of the fallback script will affect this face. * + * @since: + * 2.4.11 + * */ @@ -372,6 +384,9 @@ FT_BEGIN_HEADER * Set this value right after calling @FT_Set_Char_Size, but before * loading any glyph (using the auto-hinter). * + * @since: + * 2.4.11 + * */ @@ -480,6 +495,9 @@ FT_BEGIN_HEADER * variable similar to the CFF driver. It can also be set per face * using @FT_Face_Properties with @FT_PARAM_TAG_STEM_DARKENING. * + * @since: + * 2.6.2 + * */ @@ -499,6 +517,9 @@ FT_BEGIN_HEADER * or autohinter honors it, which the CFF driver always does, but the * autohinter only in `light' hinting mode (as of version 2.7.0). * + * @since: + * 2.8 + * */ #define FT_PARAM_TAG_STEM_DARKENING \ FT_MAKE_TAG( 'd', 'a', 'r', 'k' ) @@ -519,6 +540,10 @@ FT_BEGIN_HEADER * * This property can be set via the `FREETYPE_PROPERTIES' environment * variable similar to the CFF driver. + * + * @since: + * 2.6.2 + * */ diff --git a/include/freetype/ftcffdrv.h b/include/freetype/ftcffdrv.h index 477b6ddb1..f1e9452bf 100644 --- a/include/freetype/ftcffdrv.h +++ b/include/freetype/ftcffdrv.h @@ -151,6 +151,9 @@ FT_BEGIN_HEADER * * This property can be set via the `FREETYPE_PROPERTIES' environment * variable (using values `adobe' or `freetype'). + * + * @since: + * 2.4.12 */ @@ -170,6 +173,9 @@ FT_BEGIN_HEADER * FT_CFF_HINTING_ADOBE :: * Use the hinting engine contributed by Adobe. * + * @since: + * 2.4.12 + * */ #define FT_CFF_HINTING_FREETYPE 0 #define FT_CFF_HINTING_ADOBE 1 @@ -207,6 +213,9 @@ FT_BEGIN_HEADER * It can also be set per face using @FT_Face_Properties with * @FT_PARAM_TAG_STEM_DARKENING. * + * @since: + * 2.4.12 + * */ @@ -264,6 +273,10 @@ FT_BEGIN_HEADER * FREETYPE_PROPERTIES=\ * cff:darkening-parameters=500,300,1000,200,1500,100,2000,0 * } + * + * @since: + * 2.5.1 + * */ @@ -290,6 +303,9 @@ FT_BEGIN_HEADER * variable. It can also be set per face using @FT_Face_Properties with * @FT_PARAM_TAG_RANDOM_SEED. * + * @since: + * 2.8 + * */ @@ -304,6 +320,9 @@ FT_BEGIN_HEADER * module's random seed value with a face-specific one; see * @random-seed. * + * @since: + * 2.8 + * */ #define FT_PARAM_TAG_RANDOM_SEED \ FT_MAKE_TAG( 's', 'e', 'e', 'd' ) diff --git a/include/freetype/ftgzip.h b/include/freetype/ftgzip.h index bd5ceaab9..ba5482768 100644 --- a/include/freetype/ftgzip.h +++ b/include/freetype/ftgzip.h @@ -129,6 +129,9 @@ FT_BEGIN_HEADER * @note: * This function may return `FT_Err_Unimplemented_Feature' if your build * of FreeType was not compiled with zlib support. + * + * @since: + * 2.5.1 */ FT_EXPORT( FT_Error ) FT_Gzip_Uncompress( FT_Memory memory, diff --git a/include/freetype/ftimage.h b/include/freetype/ftimage.h index 1c789e5a4..968460895 100644 --- a/include/freetype/ftimage.h +++ b/include/freetype/ftimage.h @@ -169,13 +169,13 @@ FT_BEGIN_HEADER /* @FT_RENDER_MODE_LCD_V. */ /* */ /* FT_PIXEL_MODE_BGRA :: */ - /* An image with four 8-bit channels per pixel, representing a */ - /* color image (such as emoticons) with alpha channel. For each */ - /* pixel, the format is BGRA, which means, the blue channel comes */ - /* first in memory. The color channels are pre-multiplied and in */ - /* the sRGB colorspace. For example, full red at half-translucent */ - /* opacity will be represented as `00,00,80,80', not `00,00,FF,80'. */ - /* See also @FT_LOAD_COLOR. */ + /* [Since 2.5] An image with four 8-bit channels per pixel, */ + /* representing a color image (such as emoticons) with alpha */ + /* channel. For each pixel, the format is BGRA, which means, the */ + /* blue channel comes first in memory. The color channels are */ + /* pre-multiplied and in the sRGB colorspace. For example, full */ + /* red at half-translucent opacity will be represented as */ + /* `00,00,80,80', not `00,00,FF,80'. See also @FT_LOAD_COLOR. */ /* */ typedef enum FT_Pixel_Mode_ { diff --git a/include/freetype/ftlcdfil.h b/include/freetype/ftlcdfil.h index bdaf9af90..ea4a66e69 100644 --- a/include/freetype/ftlcdfil.h +++ b/include/freetype/ftlcdfil.h @@ -292,6 +292,9 @@ FT_BEGIN_HEADER * the global default values or the values set up with * @FT_Library_SetLcdFilterWeights. * + * @since: + * 2.8 + * */ #define FT_PARAM_TAG_LCD_FILTER_WEIGHTS \ FT_MAKE_TAG( 'l', 'c', 'd', 'f' ) @@ -305,6 +308,9 @@ FT_BEGIN_HEADER * A typedef for passing the five LCD filter weights to * @FT_Face_Properties within an @FT_Parameter structure. * + * @since: + * 2.8 + * */ #define FT_LCD_FILTER_FIVE_TAPS 5 diff --git a/include/freetype/ftmm.h b/include/freetype/ftmm.h index 80ac98d61..c08119933 100644 --- a/include/freetype/ftmm.h +++ b/include/freetype/ftmm.h @@ -392,6 +392,9 @@ FT_BEGIN_HEADER /* */ /* FreeType error code. 0~means success. */ /* */ + /* */ + /* 2.7.1 */ + /* */ FT_EXPORT( FT_Error ) FT_Get_Var_Design_Coordinates( FT_Face face, FT_UInt num_coords, @@ -462,6 +465,9 @@ FT_BEGIN_HEADER /* */ /* FreeType error code. 0~means success. */ /* */ + /* */ + /* 2.7.1 */ + /* */ FT_EXPORT( FT_Error ) FT_Get_MM_Blend_Coordinates( FT_Face face, FT_UInt num_coords, @@ -490,6 +496,9 @@ FT_BEGIN_HEADER /* */ /* This is another name of @FT_Get_MM_Blend_Coordinates. */ /* */ + /* */ + /* 2.7.1 */ + /* */ FT_EXPORT( FT_Error ) FT_Get_Var_Blend_Coordinates( FT_Face face, FT_UInt num_coords, @@ -534,6 +543,9 @@ FT_BEGIN_HEADER /* */ /* FreeType error code. 0~means success. */ /* */ + /* */ + /* 2.8.1 */ + /* */ FT_EXPORT( FT_Error ) FT_Get_Var_Axis_Flags( FT_MM_Var* master, FT_UInt axis_index, diff --git a/include/freetype/ftmodapi.h b/include/freetype/ftmodapi.h index 4147aadf8..9c901329a 100644 --- a/include/freetype/ftmodapi.h +++ b/include/freetype/ftmodapi.h @@ -475,6 +475,9 @@ FT_BEGIN_HEADER /* */ /* library :: A handle to a new library object. */ /* */ + /* */ + /* 2.8 */ + /* */ FT_EXPORT( void ) FT_Set_Default_Properties( FT_Library library ); diff --git a/include/freetype/ftpcfdrv.h b/include/freetype/ftpcfdrv.h index 6622c936f..c9d5cedec 100644 --- a/include/freetype/ftpcfdrv.h +++ b/include/freetype/ftpcfdrv.h @@ -93,6 +93,8 @@ FT_BEGIN_HEADER * This property can be set via the `FREETYPE_PROPERTIES' environment * variable (using values 1 and 0 for `on' and `off', respectively). * + * @since: + * 2.8 */ diff --git a/include/freetype/ftsnames.h b/include/freetype/ftsnames.h index a31654057..d524ad74c 100644 --- a/include/freetype/ftsnames.h +++ b/include/freetype/ftsnames.h @@ -189,6 +189,9 @@ FT_BEGIN_HEADER /* Please refer to the TrueType or OpenType specification for more */ /* details. */ /* */ + /* */ + /* 2.8 */ + /* */ typedef struct FT_SfntLangTag_ { FT_Byte* string; /* this string is *not* null-terminated! */ @@ -229,6 +232,9 @@ FT_BEGIN_HEADER /* invalid format~1 language ID values, FT_Err_Invalid_Argument is */ /* returned. */ /* */ + /* */ + /* 2.8 */ + /* */ FT_EXPORT( FT_Error ) FT_Get_Sfnt_LangTag( FT_Face face, FT_UInt langID, @@ -246,6 +252,9 @@ FT_BEGIN_HEADER * 1.4). Use this for backward compatibility with legacy systems that * have a four-faces-per-family restriction. * + * @since: + * 2.8 + * */ #define FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_FAMILY \ FT_MAKE_TAG( 'i', 'g', 'p', 'f' ) @@ -267,6 +276,9 @@ FT_BEGIN_HEADER * 1.4). Use this for backward compatibility with legacy systems that * have a four-faces-per-family restriction. * + * @since: + * 2.8 + * */ #define FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_SUBFAMILY \ FT_MAKE_TAG( 'i', 'g', 'p', 's' ) diff --git a/include/freetype/ftttdrv.h b/include/freetype/ftttdrv.h index 26bc5e966..381eee7e6 100644 --- a/include/freetype/ftttdrv.h +++ b/include/freetype/ftttdrv.h @@ -182,6 +182,9 @@ FT_BEGIN_HEADER * * This property can be set via the `FREETYPE_PROPERTIES' environment * variable (using values `35', `38', or `40'). + * + * @since: + * 2.5 */ diff --git a/include/freetype/t1tables.h b/include/freetype/t1tables.h index 3f6b36e10..940b4a06b 100644 --- a/include/freetype/t1tables.h +++ b/include/freetype/t1tables.h @@ -554,6 +554,9 @@ FT_BEGIN_HEADER /* T1_ENCODING_TYPE_ISOLATIN1 :: */ /* T1_ENCODING_TYPE_EXPERT :: */ /* */ + /* */ + /* 2.4.8 */ + /* */ typedef enum T1_EncodingType_ { T1_ENCODING_TYPE_NONE = 0, @@ -622,6 +625,9 @@ FT_BEGIN_HEADER /* PS_DICT_FS_TYPE :: */ /* PS_DICT_ITALIC_ANGLE :: */ /* */ + /* */ + /* 2.4.8 */ + /* */ typedef enum PS_Dict_Keys_ { /* conventionally in the font dictionary */ @@ -743,6 +749,9 @@ FT_BEGIN_HEADER * If the font's format is not PostScript-based, this function returns * the `FT_Err_Invalid_Argument' error code. * + * @since: + * 2.4.8 + * */ FT_EXPORT( FT_Long ) FT_Get_PS_Font_Value( FT_Face face, From 6d04bd991bf4ab1c77f0cffe2f317920d00b6c46 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Thu, 21 Sep 2017 21:22:51 +0200 Subject: [PATCH 232/470] [truetype] Integer overflow (#52082). * src/truetype/ttinterp.c (Ins_MDRP): Avoid FT_ABS. --- ChangeLog | 6 ++++++ src/truetype/ttinterp.c | 5 +++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index f7897215c..69e627502 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2017-09-21 Werner Lemberg + + [truetype] Integer overflow (#52082). + + * src/truetype/ttinterp.c (Ins_MDRP): Avoid FT_ABS. + 2017-09-21 Werner Lemberg [sfnt] Fix postscript name for default instance of variation fonts. diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c index c3d710359..e3c8f1289 100644 --- a/src/truetype/ttinterp.c +++ b/src/truetype/ttinterp.c @@ -6078,8 +6078,9 @@ /* single width cut-in test */ - if ( FT_ABS( org_dist - exc->GS.single_width_value ) < - exc->GS.single_width_cutin ) + /* |org_dist - single_width_value| < single_width_cutin */ + if ( org_dist < exc->GS.single_width_value + exc->GS.single_width_cutin || + org_dist > exc->GS.single_width_value - exc->GS.single_width_cutin ) { if ( org_dist >= 0 ) org_dist = exc->GS.single_width_value; From 3be8e347148d4de1d2a5bd7b18f1c3f33761eb5c Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Thu, 21 Sep 2017 23:12:59 -0400 Subject: [PATCH 233/470] [build] Simplify Visual C++ 2010 project. * build/windows/vc2010/freetype.vcxproj: Remove fake singlethreaded configurations and tweak. --- ChangeLog | 7 + builds/windows/vc2010/freetype.vcxproj | 254 +------------------------ 2 files changed, 12 insertions(+), 249 deletions(-) diff --git a/ChangeLog b/ChangeLog index 69e627502..87af87c9e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2017-09-21 Alexei Podtelezhnikov + + [build] Simplify Visual C++ 2010 project. + + * build/windows/vc2010/freetype.vcxproj: Remove fake singlethreaded + configurations and tweak. + 2017-09-21 Werner Lemberg [truetype] Integer overflow (#52082). diff --git a/builds/windows/vc2010/freetype.vcxproj b/builds/windows/vc2010/freetype.vcxproj index f357c754b..072271835 100644 --- a/builds/windows/vc2010/freetype.vcxproj +++ b/builds/windows/vc2010/freetype.vcxproj @@ -17,14 +17,6 @@ Debug Multithreaded x64 - - Debug Singlethreaded - Win32 - - - Debug Singlethreaded - x64 - Release Win32 @@ -41,14 +33,6 @@ Release Multithreaded x64 - - Release Singlethreaded - Win32 - - - Release Singlethreaded - x64 - - {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B} + {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B} + FreeType DynamicLibrary false - MultiByte + Unicode DynamicLibrary false - MultiByte + Unicode - + StaticLibrary false - MultiByte + Unicode - + StaticLibrary false - MultiByte + Unicode DynamicLibrary false - MultiByte + Unicode DynamicLibrary false - MultiByte + Unicode - + StaticLibrary false - MultiByte + Unicode - + StaticLibrary false - MultiByte + Unicode - .\..\..\..\objs\vc2010\$(Platform)\ - .\..\..\..\objs\vc2010\$(Platform)\$(Configuration)\ + ..\..\..\objs\$(Platform)\ + ..\..\..\objs\$(Platform)\$(Configuration)\ AllRules.ruleset - freetype281d - freetype281d - freetype281MTd - freetype281MTd - freetype281 - freetype281 - freetype281MT - freetype281MT + freetype Disabled $(UserOptionDirectory);..\..\..\include;$(UserIncludeDirectories);%(AdditionalIncludeDirectories) - _DEBUG;WIN32;_LIB;_CRT_SECURE_NO_WARNINGS;FT_DEBUG_LEVEL_ERROR;FT_DEBUG_LEVEL_TRACE;FT2_BUILD_LIBRARY;$(UserDefines);%(PreprocessorDefinitions) + WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;FT_DEBUG_LEVEL_ERROR;FT_DEBUG_LEVEL_TRACE;FT2_BUILD_LIBRARY;$(UserDefines);%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebugDLL true @@ -141,7 +135,7 @@ Disabled - _DEBUG;$(UserDefines);%(PreprocessorDefinitions) + _DEBUG;_DLL;$(UserDefines);%(PreprocessorDefinitions) 0x0409 @@ -155,7 +149,7 @@ Disabled $(UserOptionDirectory);..\..\..\include;$(UserIncludeDirectories);%(AdditionalIncludeDirectories) - _DEBUG;WIN32;_LIB;_CRT_SECURE_NO_WARNINGS;FT_DEBUG_LEVEL_ERROR;FT_DEBUG_LEVEL_TRACE;FT2_BUILD_LIBRARY;$(UserDefines);%(PreprocessorDefinitions) + WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;FT_DEBUG_LEVEL_ERROR;FT_DEBUG_LEVEL_TRACE;FT2_BUILD_LIBRARY;$(UserDefines);%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebugDLL true @@ -169,7 +163,7 @@ Disabled - _DEBUG;$(UserDefines);%(PreprocessorDefinitions) + _DEBUG;_DLL;$(UserDefines);%(PreprocessorDefinitions) 0x0409 @@ -179,11 +173,11 @@ $(UserDependencies);%(AdditionalDependencies) - + Disabled $(UserOptionDirectory);..\..\..\include;$(UserIncludeDirectories);%(AdditionalIncludeDirectories) - _DEBUG;WIN32;_LIB;_CRT_SECURE_NO_WARNINGS;FT_DEBUG_LEVEL_ERROR;FT_DEBUG_LEVEL_TRACE;FT2_BUILD_LIBRARY;_CRT_SECURE_NO_DEPRECATE;$(UserDefines);%(PreprocessorDefinitions) + WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;FT_DEBUG_LEVEL_ERROR;FT_DEBUG_LEVEL_TRACE;FT2_BUILD_LIBRARY;$(UserDefines);%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebug true @@ -207,11 +201,11 @@ $(UserDependencies);%(AdditionalDependencies) - + Disabled $(UserOptionDirectory);..\..\..\include;$(UserIncludeDirectories);%(AdditionalIncludeDirectories) - _DEBUG;WIN32;_LIB;_CRT_SECURE_NO_WARNINGS;FT_DEBUG_LEVEL_ERROR;FT_DEBUG_LEVEL_TRACE;FT2_BUILD_LIBRARY;_CRT_SECURE_NO_DEPRECATE;$(UserDefines);%(PreprocessorDefinitions) + WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;FT_DEBUG_LEVEL_ERROR;FT_DEBUG_LEVEL_TRACE;FT2_BUILD_LIBRARY;$(UserDefines);%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebug true @@ -240,7 +234,7 @@ MaxSpeed AnySuitable $(UserOptionDirectory);..\..\..\include;$(UserIncludeDirectories);%(AdditionalIncludeDirectories) - NDEBUG;WIN32;_LIB;_CRT_SECURE_NO_WARNINGS;FT2_BUILD_LIBRARY;$(UserDefines);%(PreprocessorDefinitions) + WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;FT2_BUILD_LIBRARY;$(UserDefines);%(PreprocessorDefinitions) true MultiThreadedDLL true @@ -264,7 +258,7 @@ true - NDEBUG;$(UserDefines);%(PreprocessorDefinitions) + NDEBUG;_DLL;$(UserDefines);%(PreprocessorDefinitions) 0x0409 @@ -280,7 +274,7 @@ MaxSpeed AnySuitable $(UserOptionDirectory);..\..\..\include;$(UserIncludeDirectories);%(AdditionalIncludeDirectories) - NDEBUG;WIN32;_LIB;_CRT_SECURE_NO_WARNINGS;FT2_BUILD_LIBRARY;$(UserDefines);%(PreprocessorDefinitions) + WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;FT2_BUILD_LIBRARY;$(UserDefines);%(PreprocessorDefinitions) true MultiThreadedDLL true @@ -304,7 +298,7 @@ true - NDEBUG;$(UserDefines);%(PreprocessorDefinitions) + NDEBUG;_DLL;$(UserDefines);%(PreprocessorDefinitions) 0x0409 @@ -315,12 +309,12 @@ $(UserDependencies);%(AdditionalDependencies) - + MaxSpeed AnySuitable $(UserOptionDirectory);..\..\..\include;$(UserIncludeDirectories);%(AdditionalIncludeDirectories) - NDEBUG;WIN32;_LIB;_CRT_SECURE_NO_WARNINGS;FT2_BUILD_LIBRARY;$(UserDefines);%(PreprocessorDefinitions) + WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;FT2_BUILD_LIBRARY;$(UserDefines);%(PreprocessorDefinitions) true MultiThreaded true @@ -356,12 +350,12 @@ $(UserDependencies);%(AdditionalDependencies) - + MaxSpeed AnySuitable $(UserOptionDirectory);..\..\..\include;$(UserIncludeDirectories);%(AdditionalIncludeDirectories) - NDEBUG;WIN32;_LIB;_CRT_SECURE_NO_WARNINGS;FT2_BUILD_LIBRARY;$(UserDefines);%(PreprocessorDefinitions) + WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;FT2_BUILD_LIBRARY;$(UserDefines);%(PreprocessorDefinitions) true MultiThreaded true @@ -439,6 +433,7 @@ false + From 2b79d25f2213aef0e3dc66f0e7f973fccede9c12 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sat, 23 Sep 2017 10:29:26 +0200 Subject: [PATCH 240/470] [otvalid] Update common table handling to OpenType 1.8.2. * src/otvalid/otvcommn.c (otv_Device_validate): Handle VariationIndex subtable. (otv_Lookup_validate): Handle MarkFilteringSet. --- ChangeLog | 8 ++++++++ src/otvalid/otvcommn.c | 28 +++++++++++++++++++--------- 2 files changed, 27 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4a04e8b07..cf57a7059 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,14 @@ * build/windows/ftver.rc: New VERSIONINFO resource. * build/windows/vc2010/freetype.vcxproj: Further improvements. +2017-09-23 Werner Lemberg + + [otvalid] Update common table handling to OpenType 1.8.2. + + * src/otvalid/otvcommn.c (otv_Device_validate): Handle + VariationIndex subtable. + (otv_Lookup_validate): Handle MarkFilteringSet. + 2017-09-23 Ben Wagner [truetype] Really fix #52082. diff --git a/src/otvalid/otvcommn.c b/src/otvalid/otvcommn.c index 3407d2ad4..0583620d3 100644 --- a/src/otvalid/otvcommn.c +++ b/src/otvalid/otvcommn.c @@ -313,19 +313,26 @@ OTV_NAME_ENTER( "Device" ); - OTV_LIMIT_CHECK( 8 ); + OTV_LIMIT_CHECK( 6 ); StartSize = FT_NEXT_USHORT( p ); EndSize = FT_NEXT_USHORT( p ); DeltaFormat = FT_NEXT_USHORT( p ); - if ( DeltaFormat < 1 || DeltaFormat > 3 ) - FT_INVALID_FORMAT; + if ( DeltaFormat == 0x8000U ) + { + /* VariationIndex, nothing to do */ + } + else + { + if ( DeltaFormat < 1 || DeltaFormat > 3 ) + FT_INVALID_FORMAT; - if ( EndSize < StartSize ) - FT_INVALID_DATA; + if ( EndSize < StartSize ) + FT_INVALID_DATA; - count = EndSize - StartSize + 1; - OTV_LIMIT_CHECK( ( 1 << DeltaFormat ) * count / 8 ); /* DeltaValue */ + count = EndSize - StartSize + 1; + OTV_LIMIT_CHECK( ( 1 << DeltaFormat ) * count / 8 ); /* DeltaValue */ + } OTV_EXIT; } @@ -347,7 +354,7 @@ OTV_Validator otvalid ) { FT_Bytes p = table; - FT_UInt LookupType, SubTableCount; + FT_UInt LookupType, LookupFlag, SubTableCount; OTV_Validate_Func validate; @@ -355,7 +362,7 @@ OTV_LIMIT_CHECK( 6 ); LookupType = FT_NEXT_USHORT( p ); - p += 2; /* skip LookupFlag */ + LookupFlag = FT_NEXT_USHORT( p ); SubTableCount = FT_NEXT_USHORT( p ); OTV_TRACE(( " (type %d)\n", LookupType )); @@ -373,6 +380,9 @@ for ( ; SubTableCount > 0; SubTableCount-- ) validate( table + FT_NEXT_USHORT( p ), otvalid ); + if ( LookupFlag & 0x10 ) + OTV_LIMIT_CHECK( 2 ); /* MarkFilteringSet */ + OTV_EXIT; } From 0da0faf0fb14eda88cd0a14e41c6727f32e89ce9 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sun, 24 Sep 2017 09:13:41 +0200 Subject: [PATCH 241/470] [otvalid] Handle `GSUB' and `GPOS' v1.1 tables. * src/otvalid/otvgsub.c (otv_GSUB_validate), src/otvalid/otvgpos.c (otv_GPOS_validate): Implement it. --- ChangeLog | 7 +++++++ src/otvalid/otvgpos.c | 42 ++++++++++++++++++++++++++++++++++++------ src/otvalid/otvgsub.c | 34 ++++++++++++++++++++++++++++++++-- 3 files changed, 75 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index cf57a7059..58b2fb4fd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,13 @@ * build/windows/ftver.rc: New VERSIONINFO resource. * build/windows/vc2010/freetype.vcxproj: Further improvements. +2017-09-23 Werner Lemberg + + [otvalid] Handle `GSUB' and `GPOS' v1.1 tables. + + * src/otvalid/otvgsub.c (otv_GSUB_validate), src/otvalid/otvgpos.c + (otv_GPOS_validate): Implement it. + 2017-09-23 Werner Lemberg [otvalid] Update common table handling to OpenType 1.8.2. diff --git a/src/otvalid/otvgpos.c b/src/otvalid/otvgpos.c index 0fbcc2077..8aede407d 100644 --- a/src/otvalid/otvgpos.c +++ b/src/otvalid/otvgpos.c @@ -130,7 +130,7 @@ otv_MarkArray_validate( table + Array1, otvalid ); otvalid->nesting_level++; - func = otvalid->func[otvalid->nesting_level]; + func = otvalid->func[otvalid->nesting_level]; otvalid->extra1 = ClassCount; func( table + Array2, otvalid ); @@ -271,7 +271,7 @@ case 3: { - FT_UInt table_size; + FT_UInt table_size; OTV_OPTIONAL_TABLE( XDeviceTable ); OTV_OPTIONAL_TABLE( YDeviceTable ); @@ -537,7 +537,7 @@ otv_ClassDef_validate( table + ClassDef2, otvalid ); OTV_LIMIT_CHECK( ClassCount1 * ClassCount2 * - ( len_value1 + len_value2 ) ); + ( len_value1 + len_value2 ) ); /* Class1Record */ for ( ; ClassCount1 > 0; ClassCount1-- ) @@ -985,20 +985,42 @@ { OTV_ValidatorRec validrec; OTV_Validator otvalid = &validrec; - FT_Bytes p = table; + FT_Bytes p = table; + FT_UInt table_size; + FT_UShort version; FT_UInt ScriptList, FeatureList, LookupList; + OTV_OPTIONAL_TABLE32( featureVariations ); + otvalid->root = ftvalid; FT_TRACE3(( "validating GPOS table\n" )); OTV_INIT; - OTV_LIMIT_CHECK( 10 ); + OTV_LIMIT_CHECK( 4 ); - if ( FT_NEXT_ULONG( p ) != 0x10000UL ) /* Version */ + if ( FT_NEXT_USHORT( p ) != 1 ) /* majorVersion */ FT_INVALID_FORMAT; + version = FT_NEXT_USHORT( p ); /* minorVersion */ + + table_size = 10; + switch ( version ) + { + case 0: + OTV_LIMIT_CHECK( 6 ); + break; + + case 1: + OTV_LIMIT_CHECK( 10 ); + table_size += 4; + break; + + default: + FT_INVALID_FORMAT; + } + ScriptList = FT_NEXT_USHORT( p ); FeatureList = FT_NEXT_USHORT( p ); LookupList = FT_NEXT_USHORT( p ); @@ -1014,6 +1036,14 @@ otv_ScriptList_validate( table + ScriptList, table + FeatureList, otvalid ); + if ( version > 0 ) + { + OTV_OPTIONAL_OFFSET32( featureVariations ); + OTV_SIZE_CHECK32( featureVariations ); + if ( featureVariations ) + OTV_TRACE(( " [omitting featureVariations validation]\n" )); /* XXX */ + } + FT_TRACE4(( "\n" )); } diff --git a/src/otvalid/otvgsub.c b/src/otvalid/otvgsub.c index f9bd8dc5d..3b58b6dec 100644 --- a/src/otvalid/otvgsub.c +++ b/src/otvalid/otvgsub.c @@ -552,18 +552,40 @@ OTV_ValidatorRec otvalidrec; OTV_Validator otvalid = &otvalidrec; FT_Bytes p = table; + FT_UInt table_size; + FT_UShort version; FT_UInt ScriptList, FeatureList, LookupList; + OTV_OPTIONAL_TABLE32( featureVariations ); + otvalid->root = ftvalid; FT_TRACE3(( "validating GSUB table\n" )); OTV_INIT; - OTV_LIMIT_CHECK( 10 ); + OTV_LIMIT_CHECK( 4 ); + + if ( FT_NEXT_USHORT( p ) != 1 ) /* majorVersion */ + FT_INVALID_FORMAT; + + version = FT_NEXT_USHORT( p ); /* minorVersion */ + + table_size = 10; + switch ( version ) + { + case 0: + OTV_LIMIT_CHECK( 6 ); + break; + + case 1: + OTV_LIMIT_CHECK( 10 ); + table_size += 4; + break; - if ( FT_NEXT_ULONG( p ) != 0x10000UL ) /* Version */ + default: FT_INVALID_FORMAT; + } ScriptList = FT_NEXT_USHORT( p ); FeatureList = FT_NEXT_USHORT( p ); @@ -580,6 +602,14 @@ otv_ScriptList_validate( table + ScriptList, table + FeatureList, otvalid ); + if ( version > 0 ) + { + OTV_OPTIONAL_OFFSET32( featureVariations ); + OTV_SIZE_CHECK32( featureVariations ); + if ( featureVariations ) + OTV_TRACE(( " [omitting featureVariations validation]\n" )); /* XXX */ + } + FT_TRACE4(( "\n" )); } From 6d403d089d438f3a3f9a13c47e2c93528819f265 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sun, 24 Sep 2017 09:06:01 +0200 Subject: [PATCH 242/470] Fix handling of ValueRecords. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For GPOS pair positioning format 1 the description of ValueRecords in the OpenType specification (1.8.2, from today) is wrong – the offset has to be taken from the parent structure; in this case the `PairSet' table. * src/otvalid/otvgpos.c (otv_PairSet_validate): Set `extra3'. (otv_PairPos_validate): Adjust. --- ChangeLog | 12 ++++++++++++ src/otvalid/otvgpos.c | 12 ++++++------ 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 58b2fb4fd..901e1c638 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,18 @@ * build/windows/ftver.rc: New VERSIONINFO resource. * build/windows/vc2010/freetype.vcxproj: Further improvements. +2017-09-24 Werner Lemberg + + [otvalid] Fix handling of ValueRecords. + + For GPOS pair positioning format 1 the description of ValueRecords + in the OpenType specification (1.8.2, from today) is wrong – the + offset has to be taken from the parent structure; in this case the + `PairSet' table. + + * src/otvalid/otvgpos.c (otv_PairSet_validate): Set `extra3'. + (otv_PairPos_validate): Adjust. + 2017-09-23 Werner Lemberg [otvalid] Handle `GSUB' and `GPOS' v1.1 tables. diff --git a/src/otvalid/otvgpos.c b/src/otvalid/otvgpos.c index 8aede407d..f185b4a0b 100644 --- a/src/otvalid/otvgpos.c +++ b/src/otvalid/otvgpos.c @@ -218,10 +218,6 @@ OTV_LIMIT_CHECK( 2 ); OTV_OPTIONAL_OFFSET( device ); - /* XXX: this value is usually too small, especially if the current */ - /* ValueRecord is part of an array -- getting the correct table */ - /* size is probably not worth the trouble */ - table_size = p - otvalid->extra3; OTV_SIZE_CHECK( device ); @@ -426,6 +422,8 @@ /*************************************************************************/ /*************************************************************************/ + /* sets otvalid->extra3 (pointer to base table) */ + static void otv_PairSet_validate( FT_Bytes table, FT_UInt format1, @@ -438,6 +436,8 @@ OTV_NAME_ENTER( "PairSet" ); + otvalid->extra3 = table; + OTV_LIMIT_CHECK( 2 ); PairValueCount = FT_NEXT_USHORT( p ); @@ -483,8 +483,6 @@ OTV_TRACE(( " (format %d)\n", PosFormat )); - otvalid->extra3 = table; - switch ( PosFormat ) { case 1: /* PairPosFormat1 */ @@ -539,6 +537,8 @@ OTV_LIMIT_CHECK( ClassCount1 * ClassCount2 * ( len_value1 + len_value2 ) ); + otvalid->extra3 = table; + /* Class1Record */ for ( ; ClassCount1 > 0; ClassCount1-- ) { From e720206925a22fc0e715976fa28d4d0388c3e136 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sun, 24 Sep 2017 09:16:39 +0200 Subject: [PATCH 243/470] Minor. --- ChangeLog | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 901e1c638..d8bd67511 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,10 +1,3 @@ -2017-09-21 Alexei Podtelezhnikov - - [build] Windows-style DLL versioning. - - * build/windows/ftver.rc: New VERSIONINFO resource. - * build/windows/vc2010/freetype.vcxproj: Further improvements. - 2017-09-24 Werner Lemberg [otvalid] Fix handling of ValueRecords. @@ -32,6 +25,13 @@ VariationIndex subtable. (otv_Lookup_validate): Handle MarkFilteringSet. +2017-09-21 Alexei Podtelezhnikov + + [build] Windows-style DLL versioning. + + * build/windows/ftver.rc: New VERSIONINFO resource. + * build/windows/vc2010/freetype.vcxproj: Further improvements. + 2017-09-23 Ben Wagner [truetype] Really fix #52082. From 0d1262a41e019e4511071e339bb8aa018596a1fd Mon Sep 17 00:00:00 2001 From: Jonathan Kew Date: Sun, 24 Sep 2017 17:36:47 +0200 Subject: [PATCH 244/470] [sfnt] Fix `premultiply_data' (#52092). * src/sfnt/pngshim.c (premultiply_data): Don't use vector extension if we have less than 16 bytes of data. --- ChangeLog | 7 ++++++ src/sfnt/pngshim.c | 57 ++++++++++++++++++++++++---------------------- 2 files changed, 37 insertions(+), 27 deletions(-) diff --git a/ChangeLog b/ChangeLog index d8bd67511..169cf05bd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2017-09-24 Jonathan Kew + + [sfnt] Fix `premultiply_data' (#52092). + + * src/sfnt/pngshim.c (premultiply_data): Don't use vector extension + if we have less than 16 bytes of data. + 2017-09-24 Werner Lemberg [otvalid] Fix handling of ValueRecords. diff --git a/src/sfnt/pngshim.c b/src/sfnt/pngshim.c index 560db4835..4c0d00705 100644 --- a/src/sfnt/pngshim.c +++ b/src/sfnt/pngshim.c @@ -82,42 +82,45 @@ typedef unsigned short v82 __attribute__(( vector_size( 16 ) )); - /* process blocks of 16 bytes in one rush, which gives a nice speed-up */ - limit = row_info->rowbytes - 16 + 1; - for ( ; i < limit; i += 16 ) + if ( row_info->rowbytes > 15 ) { - unsigned char* base = &data[i]; + /* process blocks of 16 bytes in one rush, which gives a nice speed-up */ + limit = row_info->rowbytes - 16 + 1; + for ( ; i < limit; i += 16 ) + { + unsigned char* base = &data[i]; - v82 s, s0, s1, a; + v82 s, s0, s1, a; - /* clang <= 3.9 can't apply scalar values to vectors */ - /* (or rather, it needs a different syntax) */ - v82 n0x80 = { 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80 }; - v82 n0xFF = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; - v82 n8 = { 8, 8, 8, 8, 8, 8, 8, 8 }; + /* clang <= 3.9 can't apply scalar values to vectors */ + /* (or rather, it needs a different syntax) */ + v82 n0x80 = { 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80 }; + v82 n0xFF = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; + v82 n8 = { 8, 8, 8, 8, 8, 8, 8, 8 }; - v82 ma = { 1, 1, 3, 3, 5, 5, 7, 7 }; - v82 o1 = { 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF }; - v82 m0 = { 1, 0, 3, 2, 5, 4, 7, 6 }; + v82 ma = { 1, 1, 3, 3, 5, 5, 7, 7 }; + v82 o1 = { 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF }; + v82 m0 = { 1, 0, 3, 2, 5, 4, 7, 6 }; - memcpy( &s, base, 16 ); /* RGBA RGBA RGBA RGBA */ - s0 = s & n0xFF; /* R B R B R B R B */ - s1 = s >> n8; /* G A G A G A G A */ + memcpy( &s, base, 16 ); /* RGBA RGBA RGBA RGBA */ + s0 = s & n0xFF; /* R B R B R B R B */ + s1 = s >> n8; /* G A G A G A G A */ - a = vector_shuffle( s1, ma ); /* A A A A A A A A */ - s1 |= o1; /* G 1 G 1 G 1 G 1 */ - s0 = vector_shuffle( s0, m0 ); /* B R B R B R B R */ + a = vector_shuffle( s1, ma ); /* A A A A A A A A */ + s1 |= o1; /* G 1 G 1 G 1 G 1 */ + s0 = vector_shuffle( s0, m0 ); /* B R B R B R B R */ - s0 *= a; - s1 *= a; - s0 += n0x80; - s1 += n0x80; - s0 = ( s0 + ( s0 >> n8 ) ) >> n8; - s1 = ( s1 + ( s1 >> n8 ) ) >> n8; + s0 *= a; + s1 *= a; + s0 += n0x80; + s1 += n0x80; + s0 = ( s0 + ( s0 >> n8 ) ) >> n8; + s1 = ( s1 + ( s1 >> n8 ) ) >> n8; - s = s0 | ( s1 << n8 ); - memcpy( base, &s, 16 ); + s = s0 | ( s1 << n8 ); + memcpy( base, &s, 16 ); + } } #endif /* use `vector_size' */ From 6f2b6f8f72ffb5017ab00fca83185b21f1a9f56d Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sun, 24 Sep 2017 17:42:38 +0200 Subject: [PATCH 245/470] Split off ChangeLog.27. --- ChangeLog | 2089 ------------------------------------------------- ChangeLog.27 | 2106 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 2106 insertions(+), 2089 deletions(-) create mode 100644 ChangeLog.27 diff --git a/ChangeLog b/ChangeLog index 169cf05bd..47811d18c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3274,2095 +3274,6 @@ * src/truetype/ttgxvar.c (ft_var_load_hvar): Check axis count. (ft_var_load_avar): Fix tracing message. -2016-12-30 Werner Lemberg - - * Version 2.7.1 released. - ========================= - - - Tag sources with `VER-2-7-1'. - - * docs/VERSION.TXT: Add entry for version 2.7.1. - - * README, Jamfile (RefDoc), builds/windows/vc2005/freetype.vcproj, - builds/windows/vc2005/index.html, - builds/windows/vc2008/freetype.vcproj, - builds/windows/vc2008/index.html, - builds/windows/vc2010/freetype.vcxproj, - builds/windows/vc2010/index.html, - builds/windows/visualc/freetype.dsp, - builds/windows/visualc/freetype.vcproj, - builds/windows/visualc/index.html, - builds/windows/visualce/freetype.dsp, - builds/windows/visualce/freetype.vcproj, - builds/windows/visualce/index.html, - builds/wince/vc2005-ce/freetype.vcproj, - builds/wince/vc2005-ce/index.html, - builds/wince/vc2008-ce/freetype.vcproj, - builds/wince/vc2008-ce/index.html: s/2.7/2.7.1/, s/27/271/. - - * include/freetype/freetype.h (FREETYPE_PATCH): Set to 1. - - * builds/unix/configure.raw (version_info): Set to 19:0:13. - * CMakeLists.txt (VERSION_PATCH): Set to 1. - -2016-12-30 Werner Lemberg - - [ftfuzzer] Replace `rand' with an xorshift algorithm. - - * src/tools/ftfuzzer/ftfuzzer.cc: Don't include `stdlib.h'. - (Random): Implement and use a 32bit `xorshift' algorithm. - -2016-12-30 Werner Lemberg - - [ftfuzzer] Restrict number of tested bitmap strikes. - - Malformed fonts often have large values for the number of bitmap - strikes, and FreeType doesn't check the validity of all bitmap - strikes in advance. - - Reported as - - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=353 - - * src/tools/ftfuzzer/ftfuzzer.cc: Include `stdlib.h' for `rand'. - (Random): Small class to provide n randomly selected numbers - (without repetition) out of the value set [1,N]. - (LLVMFuzzerTestOneInput): Use it to test only up to 10 bitmap - strikes. - -2016-12-29 Werner Lemberg - - [truetype] Variation font API stability issues. - - Make some functions work before a call to `TT_Set_MM_Blend'. - - * src/truetype/ttgxvar.c (tt_hadvance_adjust): Exit immediately if - we don't blend. - (TT_Get_MM_Blend, TT_Get_Var_Design): Return default values if we - don't blend. - -2016-12-29 Werner Lemberg - - * src/truetype/ttgxvar.c (TT_Get_MM_Var): Check axis data. - - Reported as - - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=348 - -2016-12-29 Werner Lemberg - - [truetype] Tracing fixes. - - * src/truetype/ttgxvar.c (tt_hadvance_adjust): Emit correct - information. - (TT_Set_Var_Design): Fix typo. - (TT_Get_Var_Design): Fix typos. - -2016-12-29 Werner Lemberg - - */*: Use `0.5f' for tracing 16.16 numbers. - -2016-12-29 Werner Lemberg - - [pcf] Protect against gzip bombs. - - Fix suggested by Kostya; reported as - - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=345 - - * src/pcf/pcfread.c (pcf_read_TOC): Limit number of TOC entries to - 1024. - -2016-12-28 Werner Lemberg - - [psnames] Only declare, not define, data in `pstables.h' (#49949). - - Pdfium includes `pstables.h' a second time; moving the definition - from `pstables.h' to `psmodule.c' saves more than 60kByte data - segment space for this case. - - * src/tools/glnames.py (StringTable::dump, - StringTable::dump_sublist, dump_encoding, dump_array): Emit - additional code to only define tables if `DEFINE_PS_TABLES' is set. - - * src/psnames/pstables.h: Regenerated. - * src/psnames/psmodule.c (DEFINE_PS_TABLES): Define. - -2016-12-28 Werner Lemberg - - [cff] Catch `blend' op in non-variant fonts. - - Reported as - - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=334 - - * src/cff/cf2intrp.c (cf2_interpT2CharString) : Don't - allow `blend' op for non-variant fonts. - -2016-12-28 Werner Lemberg - - [cff] Better check of number of blends. - - * src/cff/cf2intrp.c (cf2_interpT2CharString) , - src/cff/cffparse.c (cff_parse_blend): Compare number of blends with - stack size. - -2016-12-27 Werner Lemberg - - Documentation updates. - - * docs/CHANGES: Add missing information. - - * docs/formats.txt: Rewritten and updated. - -2016-12-27 Werner Lemberg - - [truetype, type1] Implement `FT_Get_Var_Design_Coordinates'. - - * src/truetype/ttgxvar.c (TT_Get_Var_Design): Implement. - (TT_Set_Var_Design): Fix tracing. - - * src/type1/t1load.c (T1_Get_Var_Design): Implement. - -2016-12-24 Werner Lemberg - - * src/truetype/ttpload.c (tt_face_load_hdmx): Ignore `version'. - - Problem reported by 張俊芝 <418092625@qq.com>. - -2016-12-24 Werner Lemberg - - * src/sfnt/ttsbit.c (tt_face_load_sbit): Allow more version values. - - Some fonts seem to have the `version' field in the wrong byte order. - - Problem reported by 張俊芝 <418092625@qq.com>. - -2016-12-24 Werner Lemberg - - * src/truetype/ttpload.c (tt_face_load_loca): Sanitize table length. - - This trivial fix allows us to accept more fonts. - - Problem reported by 張俊芝 <418092625@qq.com>. - -2016-12-24 Werner Lemberg - - * src/sfnt/sfobjs.c (sfnt_init_face): Fix tracing. - -2016-12-22 Werner Lemberg - - * CMakeLists.txt: Make it work with cmake 2.8.11.2 (#49909). - -2016-12-22 Werner Lemberg - - Ensure used preprocessor symbols are defined (#49790). - - * builds/unix/ftconfig.in, builds/vms/ftconfig.h, - include/freetype/config/ftconfig.h: Check `__GNUC__', `__IBMC__', - and `__SUNPRO_C' correctly. - -2016-12-22 Werner Lemberg - - * src/base/ftrfork.c (FT_Raccess_Get_DataOffsets): Check `count'. - - Reported as - - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=308 - -2016-12-22 Werner Lemberg - - [cff] Protect against invalid `vsindex' and `blend' values. - - Reported as - - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=305 - - * src/cff/cf2intrp.c (cf2_interpT2CharString) : Implement it. - -2016-12-22 Werner Lemberg - - [ftfuzzer] Always use Adobe CFF engine. - - * src/tools/ftfuzzer/ftfuzzer.cc (FT_Global::FT_Global): Implement - it. - -2016-12-21 Werner Lemberg - - * src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Thinko. - - I should really stop coding late in the evening... - - Thanks again to Ben for checking. - -2016-12-21 Werner Lemberg - - [autofit] Support variation fonts. - - (This ChangeLog entry was added later on.) - - * src/autofit/afglobal.c (af_face_globals_free): Remove useless - code. - - * src/base/ftmm.c (FT_Set_MM_Design_Coordinates, - * FT_Set_Var_Design_Coordinates, FT_Set_MM_Blend_Coordinates, - FT_Set_Var_Blend_Coordinates): Finalize - auto-hinter data to enforce recomputation. Note that this is a - brute-force method which should be improved. - -2016-12-21 Werner Lemberg - - * src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Thinko. - - Don't apply deltas twice for non-phantom points. - - Spotted by Ben Wagner. - -2016-12-21 Werner Lemberg - - [cff, truetype] Another try for #49829. - - * src/cff/cffdrivr.c: Don't include - `FT_SERVICE_METRICS_VARIATIONS_H'. - (cff_get_advances): Use `ttface->variation_support'. - - * src/truetype/ttdriver.c (tt_get_advances): Use - `ttface->variation_support'. - - * src/truetype/ttgload.c (TT_Process_Simple_Glyph, - load_truetype_glyph): Use `ttface->variation_support'. - -2016-12-21 Werner Lemberg - - [truetype, sfnt] Introduce font variation flags to `TT_Face'. - - * include/freetype/internal/tttypes.h (TT_FACE_FLAG_VAR_XXX): - New macros describing available functionality of various OpenType - tables related to font variation. - (TT_Face): New fields `variation_support' and `mvar_support', - replacing and extending `use_fvar'. - - * src/sfnt/sfobjs.c (sfnt_init_face, sfnt_load_face): Use - `variation_support'. - - * src/truetype/ttgxvar.c (ft_var_load_hvar): Set `variation_support' - field. - (TT_Vary_Apply_Glyph_Deltas): Updated. - -2016-12-21 Werner Lemberg - - [base] Improve sanity check for Mac resources (#49888). - - * src/base/ftobjs.c (Mac_Read_sfnt_Resource): Abort if `rlen' is not - positive. - -2016-12-20 Werner Lemberg - - [base] More sanity checks for Mac resources. - - We use - - https://github.com/kreativekorp/ksfl/wiki/Macintosh-Resource-File-Format - - and - - https://developer.apple.com/legacy/library/documentation/mac/pdf/MoreMacintoshToolbox.pdf#page=151 - - as references. - - * include/freetype/internal/ftrfork.h (FT_RFork_Ref): Use FT_Short - for `res_id'. - - * src/base/ftrfork.c (FT_Raccess_Get_HeaderInfo): Extract map length - and use it to improve sanity checks. - Follow the specification more closely;in particular, all data types - are signed, not unsigned. - (FT_Raccess_Get_DataOffsets): Follow the specification more closely; - in particular, all data types are signed, not unsigned. - Add some sanity checks. - -2016-12-20 Werner Lemberg - - [truetype] Improve logic for getting fast advance widths. - - * src/cff/cffdrivr.c (cff_get_advances), src/truetype/ttdriver.c - (tt_get_advances): Use `is_default_instance' for test; this gets - recomputed after changing blend coordinates. - -2016-12-20 Ben Wagner - Werner Lemberg - - [truetype] Fix linear metrics of GX variation fonts (#49829). - - When asking for an unhinted non-default variations, - `linearVertAdvance' is currently the value from the `hmtx' table - instead of the actual value after applying the variation. `HVAR' - support fixes this, but fonts will exist without that table and will - need sane fallback. - - Problem also reported as - - https://bugs.chromium.org/p/skia/issues/detail?id=5917 - - * src/truetype/ttgload.c (TT_Process_Simple_Glyph, - load_truetype_glyph): Implement linear advance adjustments if `HVAR' - or `VVAR' tables are missing. - -2016-12-20 Werner Lemberg - - [cff, truetype] Fast advance width retrieval for fonts with HVAR. - - Everything is guarded with TT_CONFIG_OPTION_GX_VAR_SUPPORT. - - * src/base/ftadvanc.c (LOAD_ADVANCE_FAST_CHECK): Don't handle MM. - - * src/cff/cffdrivr.c: Include FT_SERVICE_METRICS_VARIATIONS_H. - (cff_get_advances): Test for HVAR and VVAR. - - * src/truetype/ttdriver.c (tt_get_advances): Test for HVAR and VVAR. - -2016-12-18 Werner Lemberg - - [base] Fix invalid mac font recursion. - - Reported as - - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=304 - - * src/base/ftobjs.c (FT_Open_Face): Code moved to... - (ft_open_face_internal): ... this function. - Add a parameter to control whether we try special Mac font handling - in case of failure. - (FT_Open_Face, FT_New_Face, FT_New_Memory_Face, - open_face_from_buffer): Use `ft_open_face_internal'. - -2016-12-18 Werner Lemberg - - * src/cff/cffobjs.c (cff_face_init): Make named instances work. - -2016-12-18 Werner Lemberg - - [truetype, cff] Extend `get_var_blend' function of MM service. - - In particular, we need access to named instance data. - - * include/freetype/internal/services/svmm.h (FT_Get_Var_Blend_Func): - Add argument for `FT_MM_Var'. - - * src/cff/cffload.c (cff_get_var_blend): Updated. - * src/cff/cffload.h: Updated. - - * src/cff/cf2ft.c (cf2_getNormalizedVector): Updated. - - * src/truetype/ttgxvar.c (tt_get_var_blend): Updated. - Accept value `NULL' for arguments. - * src/truetype/ttgxvar.h: Updated. - -2016-12-18 Werner Lemberg - - [sfnt] Handle `fvar' with zero axes as a non-MM font. - - This is better behaviour than exiting with an error. - - * include/freetype/internal/tttypes.h (TT_Face): Add `use_fvar' - field. - - * src/sfnt/sfobjs.c (sfnt_init_face): Compute `use_fvar', also - updating the validation code. - Use `use_fvar' to compute FT_FACE_FLAG_MULTIPLE_MASTERS. - - * src/truetype/ttgxvar.c (TT_Get_MM_Var): Remove `fvar' validation - code. - -2016-12-18 Werner Lemberg - - Minor GX code shuffling. - - * include/freetype/internal/tttypes.h (TT_Face): Move - `is_default_instance' into TT_CONFIG_OPTION_GX_VAR_SUPPORT - block. - - * src/sfnt/sfobjs.c (sfnt_init_face): Updated. - * src/truetype/ttgload.c (IS_DEFAULT_INSTANCE): New macro. - (TT_Load_Glyph): Use it. - -2016-12-18 Werner Lemberg - - [cff] Better handling of non-CFF font formats. - - * src/cff/cffload.c (cff_font_load): Pure CFFs don't have a - signature, so return `FT_Err_Unknown_File_Format' more often. - -2016-12-17 Werner Lemberg - - * src/cff/cffload.c (cff_build_blend_vector): Remove redundant code. - -2016-12-17 Werner Lemberg - - * src/truetype/ttobjs.c (tt_face_init): Simplify conditional code. - -2016-12-17 Werner Lemberg - - [sfnt, truetype] Various sanitizing fixes. - - * src/sfnt/sfobjs.c (sfnt_init_face): If the axis count in `fvar' is - zero, set `num_instances' to zero. - - * src/truetype/ttgxvar.c (TT_Get_MM_Var): Handle `fvar' table with - zero axes as invalid. - - * src/truetype/ttobjs.c (tt_face_init): Improve logic of loading - `loca', `cvt', `fpgm', and `prep' table. - -2016-12-17 Werner Lemberg - - Improve tracing of `FT_Open_Face'. - - * src/base/ftobjs.c (FT_Open_Face): Return info on number of - available faces and numbered instances, or the indices of the - requested face and numbered instance. - - * src/sfnt/sfobjs. (sfnt_open_font): Trace number of subfonts. - -2016-12-17 Werner Lemberg - - * src/cff/cffload.c (cff_load_private_dict): Always init `blend'. - - Reported as - - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=295 - -2016-12-16 Werner Lemberg - - [truetype] Fix `cvar' sanity test. - - Reported by Dave Arnold. - - * src/truetype/ttgxvar.c (tt_face_vary_cvt): Use tuple count mask. - -2016-12-16 Werner Lemberg - - [cff, truetype] Remove compiler warnings; fix `make multi'. - - * src/cff/cf2font.h: Include `cffload.h'. - - * src/cff/cffload.c: Include FT_MULTIPLE_MASTERS_H and - FT_SERVICE_MULTIPLE_MASTERS_H. - (cff_vstore_load): Eliminate `vsSize'. - (cff_load_private_dict): Tag as `FT_LOCAL_DEF'. - - * src/cff/cffload.h: Include `cffobjs.h'. - Provide declaration for `cff_load_private_dict'. - - * src/truetype/ttgxvar.c (ft_var_load_hvar): Eliminate - `minorVersion' and `map_offset'. - -2016-12-16 Werner Lemberg - - [cff] Fix heap buffer overflow (#49858). - - * src/cff/cffparse.c (cff_parser_run): Add one more stack size - check. - -2016-12-15 Werner Lemberg - - Fix clang warnings. - - * src/cff/cffload.c (cff_blend_doBlend): Add cast. - (cff_subfont_load): Set `error' correctly. - - * src/sfnt/ttmtx.c (tt_face_get_metrics): Typo. - -2016-12-15 Dave Arnold - Werner Lemberg - - [cff] Implement CFF2 support (2/2). - - The font variation code. All parts dependent on the GX code in the - `truetype' module are guarded with TT_CONFIG_OPTION_GX_VAR_SUPPORT. - In other words, you can still compile the `cff' module without - defining TT_CONFIG_OPTION_GX_VAR_SUPPORT (which brings you CFF2 - support without font variation). - - * src/cff/cf2font.c (cf2_font_setup): Add support for font - variation. - * src/cff/cf2font.h (CF2_Font): Add fields for variation data. - - * src/cff/cf2ft.c (cf2_free_instance): Free blend data. - (cf2_getVStore, cf2_getNormalizedVector): New functions. - * src/cff/cf2ft.h: Updated. - - * src/cff/cf2intrp.c: Include `cffload.h'. - (cf2_cmdRESERVED_15, cf2_cmdRESERVED_16): Replace with... - (cf2_cmdVSINDEX, cf2_cmdBLEND): ... this new enum values. - (cf2_doBlend): New function. - (cf2_interpT2CharString): Handle `vsindex' and `blend' opcodes. - - * src/cff/cffload.c (FT_fdot14ToFixed): New macro. - (cff_vstore_done, cff_vstore_load): New functions. - (cff_blend_clear, cff_blend_doBlend, cff_blend_build_vector, - cff_blend_check_vector): New functions. - (cff_load_private_dict): Add arguments for blend vector. - Handle blend data. - (cff_subfont_load, cff_subfont_done): Updated. - (cff_font_load): Handle CFF2 variation store data. - (cff_font_done): Updated. - * src/cff/cffload.h: Include `cffparse.h'. - Updated. - - * src/cff/cffobjs.c (cff_face_done): Updated. - - * src/cff/cffparse.c: Include `cffload.h'. - (cff_parse_num): Handle internal value 255. - (cff_parse_vsindex, cff_parse_blend): New functions. - (CFF_FIELD_BLEND): New macro. - (cff_parser_run): Updated. - * src/cff/cffparse.h (cff_kind_blend): New enum value. - - * src/cff/cfftoken.h: Handle `vstore', `vsindex', and `blend' - dictionary values. - - * src/cff/cfftypes.h (CFF_VarData, CFF_AxisCoords, CFF_VarRegion, - CFF_VStore, CFF_Blend): New structures. - (CFF_FontRecDict): Add `vstore_offset' field. - (CFF_Private): Add `vsindex' field. - (CFF_SubFont): Add fields for blend data. - (CFF_Font): Add `vstore' field. - - * src/truetype/ttgxvar.c (TT_Get_MM_Var): `CFF2' is equal to `gvar', - since glyph variation data is directly embedded. - (TT_Set_MM_Blend): Don't load `gvar' table for CFF2 fonts. - -2016-12-15 Dave Arnold - Werner Lemberg - - [cff] Implement CFF2 support (1/2). - - This commit does not contain the blend code for font variation - support, which follows in another commit. - - You should ignore whitespace while inspecting this commit. - - * include/freetype/internal/tttypes.h (TT_Face): Add `isCFF2' - member. - - * src/cff/cf2font.h (CF2_Font): Add `isCFF2' member. - - * src/cff/cf2ft.c (cf2_decoder_parse_charstrings): Handle `isCFF2' - flag. - (cf2_getMaxstack): New function. - * src/cff/cf2ft.h: Updated. - - * src/cff/cf2intrp.c (cf2_escRESERVED_38): New enum. - (cf2_interpT2CharString): Handle CFF2 differences. - Add tracing message for errors. - - * src/cff/cffdrivr.c (cff_get_glyph_name, cff_get_name_index): - Update for CFF2. - - * src/cff/cffload.c (FT_FIXED_ONE): New macro. - (cff_index_init, cff_index_load_offsets, cff_index_access_element, - cff_index_get_name, cff_ft_select_get, cff_load_private_dict, - cff_subfont_load, cff_font_load): Handle CFF2. - * src/cff/cffload.h: Updated. - - * src/cff/cffobjs.c (cff_face_init): Handle CFF2. - - * src/cff/cffparse.c (cff_parse_maxstack): New function. - (CFFCODE_TOPDICT, CFFCODE_PRIVATE): Removed - * src/cff/cffparse.h (CFF2_MAX_STACK, CFF2_DEFAULT_STACK): New - macros. - (CFF2_CODE_TOPDICT, CFF2_CODE_FONTDICT, CFF2_CODE_PRIVATE): New - macros. - - * src/cff/cfftoken.h: Add fields for CFF2 dictionaries (but no blend - stuff). - - * src/cff/cfftypes.h (CFF_Index): Add `hdr_size' field. - (CFF_FontRecDict): Add `maxstack' field. - (CFF_Private): Add `subfont' field. - (CFF_Font): Add `top_dict_length' and `cff2' fields. - - * src/sfnt/sfobjs.c (sfnt_load_face): Handle `CFF2' table. - -2016-12-15 Werner Lemberg - Dave Arnold - - [truetype] Provide HVAR advance width variation as a service. - - Everything is guarded with TT_CONFIG_OPTION_GX_VAR_SUPPORT. - - * src/truetype/ttdriver.c (tt_service_metrics_variations): Updated. - - * src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Prevent - double adjustment of advance width. - - * src/sfnt/ttmtx.c: Include FT_SERVICE_METRICS_VARIATIONS_H. - (tt_face_get_metrics): Apply metrics variations. - -2016-12-15 Dave Arnold - Werner Lemberg - - [truetype] Provide function to apply `HVAR' advance width variation. - - Everything is guarded with TT_CONFIG_OPTION_GX_VAR_SUPPORT. - - * src/truetype/ttgxvar.c (tt_hadvance_adjust): New function. - * src/truetype/ttgxvar.h: Updated. - -2016-12-15 Dave Arnold - Werner Lemberg - - [truetype] Add `HVAR' table parsing. - - Note that this is not complete yet; it only handles advance width - variation. - - Activation of the code follows in another commit. - - Everything is guarded with TT_CONFIG_OPTION_GX_VAR_SUPPORT. - - * include/freetype/ftmm.h (FT_Var_Named_Style): Add `psid' member. - - * src/truetype/ttgxvar.h (GX_HVarData, GX_AxisCoords, GX_HVarRegion, - GX_HVStore, GX_WidthMap): New auxiliary structures for... - (GX_HVarTable): ... HVAR main structure. - (GX_BlendRec): Add data for HVAR loading. - - * src/truetype/ttgxvar.c (FT_FIXED_ONE, FT_fdot14ToFixed, - FT_intToFixed, FT_fixedToInt): New macros. - (ft_var_load_hvar): New function. - (TT_Get_MM_Var): Updated. - (tt_done_blend): Deallocate HVAR data. - -2016-12-15 Dave Arnold - - [cff] Extend number parsing. - - The forthcoming CFF2 support needs a dynamic parsing limit. - - * src/cff/cffparse.c (cff_parse_num, do_fixed, cff_parse_fixed, - cff_parse_fixed_scaled, cff_parse_fixed_dynamic): Add argument for - parser. - (cff_parse_font_matrix, cff_parse_font_bbox, cff_parse_private_dict, - cff_parse_multiple_master, cff_parse_cid_ros, cff_parser_run): Updated. - - * src/cff/cffparse.h (cff_parse_num): Export locally. - -2016-12-15 Dave Arnold - - [cff] Implement dynamic stack size for Adobe engine. - - This also adds `cf2_stack_setReal' and `cf2_stack_pop', needed for - the forthcoming CFF2 support. - - * src/cff/cf2stack.c (cf2_stack_init): Add argument for stack size. - (cf2_stack_free): Deallocate stack. - (cf2_stack_count, cf2_stack_pushInt, cf2_stack_pushFixed, - cf2_stack_popInt, cf2_stack_popFixed, cf2_stack_getReal, - cf2_stack_clear): Updated. - (cf2_stack_setReal, cf2_stack_pop): New functions. - - * src/cff/cf2stack.h (CF2_Stack): Add `stackSize' member. - Update function declarations. - - * src/cff/cf2intrp.c (cf2_interpT2CharString): Updated. - - * src/cff/cffparse.c (cff_parser_init): Add parameter for stack - size; return error code. - (cff_parser_done): New function. - (cff_parser_run): Updated. - - * src/cff/cffparse.h (CFF_Parser): Add `stackSize' member and make - `stack' a pointer. - Update function declarations. - - * src/cff/cffload.c (cff_load_private_dict, cff_subfont_load): - Updated. - -2016-12-15 Dave Arnold - Werner Lemberg - - [cff] Code shuffling. - - * src/cff/cfftypes.h (CFF_Font): Add `library' and `base_offset' - fields. - - * src/cff/cffload.c (cff_subfont_load): Change last argument to - `CFF_Font' - Split off parsing of private dictionary into... - (cff_load_private_dict): ...this new function. - (cff_font_load): Updated. - -2016-12-14 Werner Lemberg - - [sfnt, truetype] Add framework for Metrics Variations service. - - No effect yet; service functions will be implemented later on. - - Everything is guarded with TT_CONFIG_OPTION_GX_VAR_SUPPORT. - - * include/freetype/internal/services/svmetric.h: New file. - - * include/freetype/internal/ftserv.h - (FT_SERVICE_METRICS_VARIATIONS_H): New macro. - - * include/freetype/internal/tttypes.h (TT_Face): New field `var'. - - * src/sfnt/sfobjs.c: Include FT_SERVICE_METRICS_VARIATIONS_H. - (sfnt_init_face): Initialize `face->var'. - - * src/truetype/ttdriver.c: Include FT_SERVICE_METRICS_VARIATIONS_H. - (tt_service_metrics_variations): New service. - (tt_services): Updated. - - * src/truetype/ttpic.h: Updated. - -2016-12-14 Werner Lemberg - - [cff] Add Multiple Masters service. - - The code simply uses the MM functions from the `truetype' module. - - Everything is guarded with TT_CONFIG_OPTION_GX_VAR_SUPPORT. - - * include/freetype/internal/tttypes.h (TT_Face): New field `mm'. - - * src/cff/cffdrivr.c: Include FT_SERVICE_MULTIPLE_MASTERS_H. - (cff_set_mm_blend, cff_get_mm_blend, cff_get_mm_var, - cff_set_var_design, cff_get_var_design): New functions. - (cff_service_multi_masters): New service. - (cff_services): Updated. - - * src/cff/cffload.c (cff_get_var_blend, cff_done_blend): New - functions. - * src/cff/cffload.h: Updated. - - * src/cff/cffpic.h (CFF_SERVICE_MULTI_MASTERS_GET): New macro. - - * src/sfnt/sfobjs.c: Include FT_SERVICE_MULTIPLE_MASTERS_H. - (sfnt_init_face): Initialize `face->mm'. - -2016-12-14 Werner Lemberg - - Extend functionality of `ft_module_get_service'. - - It can now differentiate between local and global searches. - - * src/base/ftobjs.c (ft_module_get_service): Add `global' argument. - (FT_Get_TrueType_Engine_Type): Updated. - - * src/cff/cffdrivr.c (cff_get_ps_name, cff_get_cmap_info): Updated. - - * include/freetype/internal/ftobjs.h: Updated. - * include/freetype/internal/ftserv.h (FT_FACE_FIND_GLOBAL_SERVICE): - Updated. - -2016-12-14 Werner Lemberg - - * src/truetype/ttgxvar.c (tt_get_var_blend): Fix compiler warning. - -2016-12-14 Dave Arnold - Werner Lemberg - - [sfnt, cff] Minor preparations. - - * include/freetype/tttags.h (TTAG_CFF2, TTAG_HVAR, TTAG_MVAR, - TTAG_VVAR): New SFNT table tags. - - * src/cff/cf2fixed.h (CF2_FIXED_ONE, CF2_FIXED_EPSILON): Add cast. - -2016-12-10 Werner Lemberg - - [truetype, type1] Add `get_var_blend' to MM service. - - For internal use; we want to share code between the forthcoming CFF2 - support and TrueType. - - * include/freetype/internal/services/svmm.h (FT_Get_Var_Blend_Func): - New typedef. - (MultiMasters): Add `get_var_blend'. - (FT_Service_MultiMasters): Updated. - - * src/truetype/ttgxvar.c (tt_get_var_blend): New function. - * src/truetype/ttgxvar.h: Updated. - - * src/truetype/ttdriver.c (tt_service_gx_multi_masters): Updated. - * src/type1/t1driver.c (t1_service_multi_masters): Updated. - -2016-12-10 Werner Lemberg - - [truetype, type1] Add `done_blend' to MM service. - - For internal use; we want to share code between the forthcoming CFF2 - support and TrueType. - - * include/freetype/internal/services/svmm.h (FT_Done_Blend_Func): - New typedef. - (MultiMasters): Add `done_blend'. - (FT_Service_MultiMasters): Updated. - - * src/truetype/ttgxvar.c (tt_done_blend): Use `TT_Face' as argument. - * src/truetype/ttgxvar.h: Updated. - - * src/truetype/ttobjs.c (TT_Face_Done): Updated. - - * src/truetype/ttdriver.c (tt_service_gx_multi_masters): Updated. - * src/type1/t1driver.c (t1_service_multi_masters): Updated. - -2016-12-09 Werner Lemberg - - [sfnt] Revert change from 2016-12-08. - - I missed the functionality of `ft_module_get_service', which makes - the change unnecessary. - -2016-12-08 Werner Lemberg - - Add framework to support services with 8 functions. - - We will need this for CFF variation font support. - - * include/freetype/internal/ftserv.h (FT_DEFINE_SERVICEDESCREC8): - New macro. - -2016-12-08 Werner Lemberg - - [sfnt] Add `get_glyph_name' and `get_name_index' to SFNT interface. - - CFF2 fonts will need access to those two functions. - - * include/freetype/internal/sfnt.h: Include FT_SERVICE_GLYPH_DICT_H. - (SFNT_Interface): Add `get_glyph_name' and `get_name_index' members. - (FT_DEFINE_SFNT_INTERFACE): Updated. - - * src/sfnt/sfdriver.c (sfnt_get_glyph_name, sfnt_get_name_index): - Fix signatures to exactly correspond to the glyph dict service - function typedefs. - (sfnt_interface): Updated. - -2016-12-06 Dave Arnold - - Add `FT_Get_Var_Design_Coordinates' function. - - Note that the low-level functions aren't implemented yet. - - * include/freetype/ftmm.h: Declare. - - * include/freetype/internal/services/svmm.h - (FT_Get_Var_Design_Func): New typedef. - (MultiMasters): New MM service function `get_var_design'. - (FT_DEFINE_SERVICE_MULTIMASTERSREC): Updated. - Update all callers. - - * src/base/ftmm.c (FT_Get_Var_Design_Coordinates): Implement. - - * src/truetype/ttdriver.c: Updated. - - * src/truetype/ttgxvar.c (TT_Get_Var_Design): New dummy function to - handle `get_var_design' service. - * src/truetype/ttgxvar.h: Updated. - - * src/type1/t1driver.c: Updated. - - * src/type1/t1load.c (T1_Get_Var_Design): New dump function to - handle `get_var_design' service. - * src/type1/t1load.h: Updated. - -2016-12-06 Werner Lemberg - - * src/type1/t1load.c (parse_subrs): Fix memory leak. - - The `subrs' keyword might erroneously occur multiple times. - - Reported as - - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=231 - -2016-12-01 Werner Lemberg - - [gzip] Improve building with external zlib (#49673). - - Building FreeType with external zlib 1.2.8 makes msvc 14 stop with - the following error. - - ftgzip.c - zlib-1.2.8\zlib.h(86): error C2061: - syntax error: identifier 'z_const' - zlib-1.2.8\zlib.h(94): error C2054: - expected '(' to follow 'z_const' - zlib-1.2.8\zlib.h(94): error C2085: - 'msg': not in formal parameter list - ... - zlib-1.2.8\zlib.h(877): fatal error C1003: - error count exceeds 100; stopping compilation - - The error happens because FreeType keeps an own copy of zlib-1.1.4 - under `src/gzip'. When building `src/gzip/ftgzip.c' with - FT_CONFIG_OPTION_SYSTEM_ZLIB defined, it uses - - #include - - which correctly finds an external `zlib.h', but `zlib.h' itself has - a line - - #include "zconf.h" - - which makes Visual Studio 2015 find `src/gzip/zconf.h' while - compiling the files in `src/gzip'. - - * src/gzip/zconf.h: Rename to... - * src/gzip/ftzconf.h: ... this. - * src/gzip/zlib.h, src/gzip/rules.mk (GZIP_DRV_SRCS): Updated. - -2016-12-01 Oleksandr Chekhovskyi - - [autofit] Fix Emscripten crash (patch #9180). - - Function calls through pointers must use a matching signature to - work on Emscripten, since such calls are dispatched through lookup - tables grouped by signature. - - * src/autofit/aftypes.h (AF_WritingSystem_ApplyHintsFunc): Fix - typedef. - -2016-11-29 Werner Lemberg - - [smooth] Revert previous commit. Already fixed with 6ca54c64. - -2016-11-29 Werner Lemberg - - [smooth] Avoid conditional jump on uninitialized value (#49711). - - * src/smooth/ftgrays.c (gray_raster_render): Initialize `worker'. - -2016-11-27 Nikolaus Waxweiler - - [autofit] Code shuffling. - - Also improve some comments and remove unused code. - - No functional change. - - * src/autofit/afloader.c (af_loader_load_g): Merged with... - (af_loader_load_glyph): ...this function. - Split off emboldening code into... - (af_loader_embolden_glyph_in_slot): ... this function. - -2016-11-17 Werner Lemberg - - Better support of LLP64 systems with gcc (and clang). - - * builds/unix/configure.raw: Call `AC_TYPE_LONG_LONG_INT'. - - * builds/unix/ftconfig.in (FT_LONG64): Enable for LLP64 systems (and - suppress warnings) even without `FT_CONFIG_OPTION_FORCE_INT64'. - -2016-11-10 Werner Lemberg - - Fix `lcd_weights' array size. - - * include/freetype/internal/ftobjs.h (FT_LibraryRec): Do it. - - Reported by Nikolaus. - -2016-11-06 Werner Lemberg - - * src/base/ftobjs.c (FT_Render_Glyph_Internal): Fix tracing. - -2016-11-06 Werner Lemberg - - [sfnt] Improve FT_LOAD_BITMAP_METRICS_ONLY for `sbix' format. - - It's unavoidable to call the PNG engine, but to get the metrics it - is sufficient to read the PNG image's header only. - - * src/sfnt/pngshim.c (Load_SBit_Png): Add argument to control the - allocation of the glyph slot. - * src/sfnt/pngshim.h: Updated. - * src/sfnt/ttsbit.c (tt_sbit_decoder_load_png, - tt_face_load_sbix_image, tt_face_load_sbit_image): Updated. - -2016-11-06 Werner Lemberg - - [sfnt] Speed up `sbix' lookup. - - This also fixes a bug introduced in 2016-10-01 which prevents - display of embedded bitmap fonts that use the `sbix' format. - - * src/sfnt/ttsbit.c (tt_face_load_sbit): Store `sbix' size and - offset also in `ebdt_size' and `ebdt_start', respectively. This - makes the test for an embedded bitmap data table succeed for this - format. - - (tt_face_load_strike_metrics) : Use - `ebdt_size' and `ebdt_start' - (tt_face_load_sbix_image): Ditto. - -2016-11-06 Seigo Nonaka - Werner Lemberg - - Introduce a way of quickly retrieving (embedded) bitmap metrics. - - `FT_Load_Glyph' doesn't generate a bitmap for a non-bitmap glyph - until the user calls `FT_Render_Glyph'. However, it always - allocates memory for bitmaps and copies or decodes the contents of a - bitmap glyph, which can be quite slow for PNG data. - - * include/freetype/freetype.h (FT_LOAD_BITMAP_METRICS_ONLY): New - macro. - - * src/base/ftobjs.c (FT_Load_Glyph): Unset FT_LOAD_RENDER if - FT_LOAD_BITMAP_METRICS_ONLY is used. - - * src/sfnt/ttsbit.c (tt_sbit_decoder_alloc_bitmap, - tt_sbit_decoder_load_bitmap): Add argument to control allocation of - the glyph slot. - (tt_sbit_decoder_load_image, tt_sbit_decoder_load_compound, - tt_face_load_sbit_image): Updated. - - * src/pcf/pcfdrivr.c (PCF_Glyph_Load): Quickly exit if - `FT_LOAD_BITMAP_METRICS_ONLY' is set. - - * src/pfr/pfrsbit.c, src/pfr/pfrsbit.h (pfr_slot_load_bitmap): Add - argument to control allocation of the glyph slot. - * src/pfr/pfrobjs (pfr_slot_load): Updated. - - * src/winfonts/winfnt.c (FNT_Load_Glyph): Ditto. - - * docs/CHANGES: Updated. - -2016-11-06 Werner Lemberg - - Synchronize with gnulib (#49448). - - * include/freetype/config/ftconfig.h, builds/unix/ftconfig.in, - builds/vms/ftconfig.h (FT_TYPEOF): Update code to use definition in - current version of `intprops.h'. - Other minor synchronization to reduce code differences between the - three files. - -2016-11-03 Behdad Esfahbod - - [truetype] Clamp variation requests to valid range. - - This is required by OpenType 1.8; it also avoids rounding surprises. - - * src/truetype/ttgxvar.c (TT_Set_Var_Design): Clamp design coordinates - outside of the allowed range to always stay within the range instead - of producing an error. - -2016-10-29 Werner Lemberg - - [truetype] Remove clang warnings. - - * src/truetype/ttinterp.h (TT_ExecContextRec): Using `FT_ULong' for - loop counter handling. - - * src/truetype/ttinterp.c: Updated. - (Ins_SCANTYPE): Use signed constant. - (TT_RunIns): Ensure `num_twilight_points' is 16bit. - -2016-10-27 Werner Lemberg - - [truetype] Fix commit from 2014-11-24. - - Problem reported by Hin-Tak Leung . - - * src/truetype/ttpload.c (tt_face_load_hdmx): Fix file checking - logic. - -2016-10-26 Werner Lemberg - - Add `FT_Get_{MM,Var}_Blend_Coordinates' functions. - - * include/freetype/ftmm.h: Declare. - - * include/freetype/internal/services/svmm.h (FT_Get_MM_Blend_Func): - New typedef. - (MultiMasters): New MM service function `get_mm_blend'. - (FT_DEFINE_SERVICE_MULTIMASTERSREC): Updated. - Update all callers. - - * src/base/ftmm.c (FT_Get_MM_Blend_Coordinates, - FT_Get_Var_Blend_Coordinates): Implement. - - * src/truetype/ttdriver.c: Updated. - - * src/truetype/ttgxvar.c (TT_Get_MM_Blend): New function to handle - `get_mm_blend' service. - * src/truetype/ttgxvar.h: Updated. - - * src/type1/t1driver.c: Updated. - - * src/type1/t1load.c (T1_Get_MM_Blend): New function to handle - `get_mm_blend' service. - * src/type1/t1load.h: Updated. - - * docs/CHANGES: Document. - -2016-10-26 Werner Lemberg - - * src/type1/t1load.c (parse_subrs): Fix limit check. - - Reported as - - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=81 - -2016-10-25 Alexei Podtelezhnikov - - [cff] Correct cmap format reporting (#24819). - - * src/cff/cffdrivr.c (cff_get_cmap_info): Throw an error on synthetic - charmap instead of guessing its format and language. - -2016-10-22 Werner Lemberg - - [truetype] Fix SCANTYPE instruction (#49394). - - * src/truetype/ttinterp.c (Ins_SCANTYPE): Only use lower 16bits. - -2016-10-22 Werner Lemberg - - [sfnt] Improve handling of invalid post 2.5 tables [#49393]. - - * src/sfnt/ttpost.c (load_format_25): We need at least a single - table entry. - -2016-10-14 Werner Lemberg - - [truetype] Fix handling of `cvar' table data. - - Reported as - - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=53 - - * src/truetype/ttgxvar.c (tt_face_vary_cvt): Ignore invalid CVT - indices. - -2016-10-11 Werner Lemberg - - [psaux] Fix handling of invalid flex subrs. - - Problem reported as - - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=52 - - * src/psaux/t1decode.c (t1_decoder_parse_charstrings) - : Set `flex_state' after error checking. - -2016-10-11 Werner Lemberg - - * src/truetype/ttgxvar.c (tt_done_blend): Fix deallocation. - -2016-10-08 Werner Lemberg - - * src/cid/cidload.c (cid_face_open): Properly propagate `error'. - -2016-10-08 Werner Lemberg - - [cid] Fix parsing of subr offsets. - - Bug introduced 2016-05-16. - - * src/cid/cidparse.c (cid_parser_new): Fix off-by-one error. - -2016-10-01 Werner Lemberg - - [sfnt] Disable bitmap strikes if we don't have a bitmap data table. - - * src/sfnt/ttsbit.c (tt_face_load_sbit): Check whether we have - a bitmap data table. - -2016-10-01 Alexei Podtelezhnikov - - [smooth] Remove impossibility. - - * src/smooth/ftgrays.c (TWorker): Rearrange fields. - (gray_convert_glyph): Remove impossible condition and clean up. - -2016-09-29 Werner Lemberg - - [pcf] Enrich family name with foundry name and glyph width info. - - This is a very old patch from openSuSE (from 2006, submitted to - FreeType in 2011) that I forgot to apply. - - https://build.opensuse.org/package/view_file/openSUSE:Factory/freetype2/freetype2-bitmap-foundry.patch - - Prepend the foundry name plus a space to the family name. There are - many fonts just called `Fixed' which look completely different, and - which have nothing to do with each other. When selecting `Fixed' in - KDE or Gnome one gets results that appear rather random, the style - changes often if one changes the size and one cannot select some - fonts at all. - - We also check whether we have `wide' characters; all put together, - we get family names like `Sony Fixed' or `Misc Fixed Wide'. - - * src/pcf/pcfread.c (pcf_load_font): Implement it. - - * docs/CHANGES: Document it. - -2016-09-29 Werner Lemberg - - [ftfuzzer] Speed up. - - * src/tools/ftfuzzer/ftfuzzer.cc (LLVMFuzzerTestOneInput): Don't - check for embedded bitmaps if we have a non-default instance. - -2016-09-29 Werner Lemberg - - [truetype] Disallow bitmap strikes for non-default instances. - - Also speed up access of default instances if GX variations are - active. - - * include/freetype/internal/tttypes.h (TT_FaceRec): Add - `is_default_instance' member. - - * src/sfnt/sfobjs.c (sfnt_init_face): Initialize - `is_default_instance'. - - * src/truetype/ttgload.c (TT_Process_Simple_Glyph, - load_truetype_glyph): Add test for default instance. - (TT_Load_Glyph): Load embedded bitmaps for default instance only. - - * src/truetype/ttgxvar.c (TT_Set_MM_Blend): Compute - `is_default_instance'. - -2016-09-29 Werner Lemberg - - [truetype] Clean up `TT_Face' structure. - - * include/freetype/internal/tttypes.h (TT_FaceRec): Remove unused - fields `horz_metrics' and `vert_metrics'. - Update documentation. - - * src/sfnt/sfobjs.c (sfnt_done_face): Updated. - -2016-09-28 Werner Lemberg - - More FT_ZERO usage. - - * src/gxvalid/gxvcommn.c (gxv_ClassTable_validate): - s/ft_memset/FT_MEM_ZERO/. - - * src/psaux/t1decode.c (t1_decoder_parse_charstrings): - s/ft_memset/FT_ARRAY_ZERO/. - - * src/raster/ftraster.c (FT_ZERO): Define. - (ft_black_new): Use it. - * src/raster/ftrend1.c (ft_raster1_get_cbox): - s/FT_MEM_ZERO/FT_ZERO/. - - * src/smooth/ftgrays.c (FT_ZERO): Define. - (gray_raster_new): Use it. - * src/smooth/ftsmooth.c (ft_smooth_get_cbox): - s/FT_MEM_ZERO/FT_ZERO/. - -2016-09-28 Werner Lemberg - - */*: s/FT_MEM_ZERO/FT_ZERO/ where appropriate. - -2016-09-27 Werner Lemberg - - [truetype] Trace number of executed opcodes. - - * src/truetype/ttinterp.c (TT_RunIns): Implement it. - -2016-09-27 Werner Lemberg - - [truetype] Speed up `TT_Load_Glyph'. - - This avoids additional calls to `tt_face_lookup_table' for the - `glyf' table, which can be expensive. - - * include/freetype/internal/tttypes.h (TT_LoaderRec): Move - `glyf_offset' field to ... - (TT_FaceRec): ... this structure. - * src/truetype/ttgload.c (load_truetype_glyph): Updated. - (tt_loader_init): Move initialization of `glyf_offset' to ... - * src/truetype/ttpload.c (tt_face_load_loca): ... this function. - -2016-09-27 Werner Lemberg - - [truetype] Introduce dynamic limits for some bytecode opcodes. - - This speeds up FreeType's handling of malformed fonts. - - * src/truetype/ttinterp.c (TT_RunIns): Set up limits for the number - of twilight points, the total number of negative jumps, and the - total number of loops in LOOPCALL opcodes. The values are based on - the number of points and entries in the CVT table. - (Ins_JMPR): Test negative jump counter. - (Ins_LOOPCALL): Test loopcall counter. - - * src/truetype/ttinterp.h (TT_ExecContext): Updated. - - * docs/CHANGES: Updated. - -2016-09-25 Werner Lemberg - - [truetype] Sanitize only last entry of `loca' table. - - Without this patch, a loca sequence like `0 100000 0 100000 ...', - where value 100000 is larger than the `glyf' table size, makes - FreeType handle the whole `glyf' table as a single glyph again and - again, which is certainly invalid (and can be very slow, too). - - * src/truetype/ttpload.c (tt_face_get_location): Implement. - Improve tracing messages. - -2016-09-25 Werner Lemberg - - * src/tools/ftfuzzer/ftfuzzer.cc (LLVMFuzzerTestOneInput): Fix typo. - -2016-09-24 Werner Lemberg - - [autofit] Tracing fixes. - - * src/autofit/afmodule.c (af_autofitter_load_glyph): Call dumping - functions only if we actually do tracing. - -2016-09-22 Alexei Podtelezhnikov - - [smooth] Reduce divisions in the line renderer. - - We don't need some divisions if a line segments stays within a single - row or a single column of pixels. - - * src/smooth/ftgrays.c (gray_render_line) [FT_LONG64]: Make divisions - conditional. - -2016-09-15 Alexei Podtelezhnikov - - * src/smooth/ftgrays.c (gray_sweep): Remove check for empty table. - -2016-09-14 Alexei Podtelezhnikov - - [smooth] Another tiny speed-up. - - * src/smooth/ftgrays.c (gray_find_cell): Merge into... - (gray_record_cell): ... this function. - -2016-09-11 Alexei Podtelezhnikov - - * src/smooth/ftgrays.c (gray_{find,set}_cell): Remove dubious code. - -2016-09-11 Alexei Podtelezhnikov - - [smooth] Fix valgrind warning and reoptimize. - - The algorithm calls `gray_set_cell' at the start of each new contour - or when the contours cross the cell boundaries. Double-checking for - that is wasteful. - - * src/smooth/ftgrays.c (gray_set_cell): Remove check for a new cell. - (gray_convert_glyph): Remove initialization introduced by 44b172e88. - -2016-09-10 Werner Lemberg - - [sfnt] Fix previous commit. - - Problems reported as - - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=40 - - We now map the strike index right before accessing the physical - data, not earlier. - - * src/sfnt/sfobjs.c (sfnt_load_face): Set `face->sbit_strike_map' - after creating the map so that... - - * src/sfnt/ttsbit.c (tt_face_load_strike_metrics): ... this function - can be used before and after setting up `sbit_strike_map'. - (tt_face_set_sbit_strike): Revert change. - (tt_sbit_decoder_init, tt_face_load_sbix_image): Map strike index. - - * src/truetype/ttdriver.c (tt_size_select): Revert change. - -2016-09-09 Werner Lemberg - - [ftfuzzer] Minor improvements. - - * src/tools/ftfuzzer/ftfuzzer.cc (LLVMFuzzerTestOneInput): Ignore - invalid strikes. - Use better values for call to `FT_Set_Char_Size'. - -2016-09-09 Werner Lemberg - - [sfnt] Don't provide (completely) broken strike data. - - FreeType tries to sanitize strike header data; we now reject - completely broken ones. - - * include/freetype/internal/tttypes.h (TT_FaceRec): New - `sbit_strike_map' array pointer. - - * src/base/ftobjs.c (FT_Match_Size): Reject matches where either - width or height would be zero. - Add tracing message in case of error. - - * src/sfnt/sfobjs.c (sfnt_load_face): Populate `sbit_strike_map', - only using (more or less) valid strike header data for - FT_Face's `available_sizes' array. - (sfnt_done_face): Updated. - - * src/sfnt/ttsbit.c (tt_face_set_sbit_strike): Use - `sbit_strike_map'. - (tt_face_load_strike_metrics): Improve tracing. - - * src/truetype/ttdriver.c (tt_size_select): Use `sbit_strike_map'. - -2016-09-08 Werner Lemberg - - * Version 2.7 released. - ======================= - - - Tag sources with `VER-2-7'. - - * docs/VERSION.TXT: Add entry for version 2.7. - - * README, Jamfile (RefDoc), builds/windows/vc2005/freetype.vcproj, - builds/windows/vc2005/index.html, - builds/windows/vc2008/freetype.vcproj, - builds/windows/vc2008/index.html, - builds/windows/vc2010/freetype.vcxproj, - builds/windows/vc2010/index.html, - builds/windows/visualc/freetype.dsp, - builds/windows/visualc/freetype.vcproj, - builds/windows/visualc/index.html, - builds/windows/visualce/freetype.dsp, - builds/windows/visualce/freetype.vcproj, - builds/windows/visualce/index.html, - builds/wince/vc2005-ce/freetype.vcproj, - builds/wince/vc2005-ce/index.html, - builds/wince/vc2008-ce/freetype.vcproj, - builds/wince/vc2008-ce/index.html: s/2.6.5/2.7/, s/265/27/. - - * include/freetype/freetype.h (FREETYPE_MINOR): Set to 7. - (FREETYPE_PATCH): Set to 0. - - * builds/unix/configure.raw (version_info): Set to 18:6:12. - * CMakeLists.txt (VERSION_MINOR): Set to 7. - (VERSION_PATCH): Set to 0. - - * docs/CHANGES: Updated. - -2016-09-08 Werner Lemberg - - * src/truetype/ttinterp.c: Include `ttgxvar.h'. - - This fixes the `multi' build. - -2016-09-08 Werner Lemberg - - [autofit] Another improvement to Armenian support. - - Suggested by Hrant H Papazian . - - * src/autofit/afscript.h: Use better suited characters to derive - default stem widths. - -2016-09-07 Alexei Podtelezhnikov - - * src/smooth/ftgrays.c (gray_hline): Micro-optimize. - -2016-09-06 Alexei Podtelezhnikov - - [smooth] Operate in absolute bitmap coordinates. - - Simpler bitmap addressing improves performance by 1.5%. - - * src/smooth/ftgrays.c (gray_TWorker): Remove count fields. - (gray_dump_cells, gray_find_cell, gray_set_cell, gray_hline, - gray_sweep, gray_convert_glyph, gray_raster_render): Updated. - -2016-09-06 Alexei Podtelezhnikov - - [smooth] Improve contour start (take 2). - - * src/smooth/ftgrays.c (gray_move_to): Call `gray_set_cell' directly - instead of... - (gray_start_cell): ... this function, which is removed. - (gray_convert_glyph): Make initial y-coordinate invalid. - -2016-09-06 Werner Lemberg - - [type1] MM fonts support exactly zero named instances (#48748). - - * src/type1/t1load.c (T1_Get_MM_Var): Set `num_namedstyles' to zero. - -2016-09-06 Jonathan Kew - - [cff] Fix uninitialized memory. - - Problem reported as - - https://bugzilla.mozilla.org/show_bug.cgi?id=1270288 - - * src/cff/cf2intrp.c (cf2_interpT2CharString): Initialize `storage' - array to handle a `get' opcode without a previous `put'. - -2016-09-05 Alexei Podtelezhnikov - - * src/smooth/ftgrays.c (gray_move_to, gray_start_cell): Revert. - -2016-09-05 Alexei Podtelezhnikov - - [smooth] Improve contour start. - - * src/smooth/ftgrays.c (gray_move_to): Call `gray_set_cell' directly - instead of... - (gray_start_cell): ... this function, which is removed. - -2016-09-05 Werner Lemberg - - [cff] Fix memory initialization. - - * src/cff/cf2stack.c (cf2_stack_init): Use `FT_NEW'. The `Q' - variants of FreeType's memory allocation macros don't do zeroing. - -2016-09-05 Werner Lemberg - - [ftrandom] Minor improvements. - - * src/tools/ftrandom/ftrandom.c (_XOPEN_SOURCE): New macro, set to - 500. - - * src/tools/ftrandom/Makefile (CFLAGS): Split off include - directories to ... - (INCLUDES): ... this new variable. - (LDFLAGS): New variable. - (ftrandom.o, ftrandom): Updated. - -2016-09-05 Werner Lemberg - - [autofit] Improve Armenian support. - - Thanks to Hrant H Papazian for help. - - * src/autofit/afblue.dat (AF_BLUE_STRING_ARMENIAN_*): Improve - selection of characters. - - * src/autofit/afblue.c, src/autofit/afblue.h: Regenerated. - -2016-09-04 Werner Lemberg - - [ftrandom] Improve Makefile. - - It now supports both a normal build (`./configure && make') and a - development build (`make devel'). - - * src/tools/ftrandom/Makefile (VPATH): Set it so that - `libfreetype.a' gets searched in both `objs' (for the development - build) and `objs/.libs' (for a normal build which uses libtool). - (LIBS): Add missing libraries. - (ftrandom.o): New rule. - (ftrandom): Use automatic variables. - -2016-09-03 Werner Lemberg - - [truetype] More fixes for handling of GX deltas. - - Problems reported by Bob Taylor . - - * src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Fix rough - sanity test for glyph variation array header size. - Always set stream position before reading packed x and y deltas. - Fix thinko w.r.t. `localpoints' array. - -2016-09-03 Werner Lemberg - - [ftrandom] Various fixes. - - * src/tools/ftrandom/ftrandom.c (GOOD_FONTS_DIR): Provide better - default. - (error_fraction): Make it of type `double' to work as advertized – - this was completely broken. - Update all related code. - (error_count, fcnt): Make it unsigned to fix compiler warnings. - Update all related code. - (fontlist): Change `len' member to `long' to fix compiler warnings. - (FT_MoveTo, FT_LineTo, FT_ConicTo, FT_CubicTo, abort_test): Tag - unused variables. - (TestFace, FindFonts, copyfont, do_test): Fix compiler warnings. - (ExecuteTest): Ditto. - Call `FT_Done_FreeType'. - (getErrorCnt): Replace `ceil' with an ordinary cast to `unsigned - int'. - (usage): Improve output. - (main): Fix compiler warnings. - - * src/tools/ftrandom/README: Updated. - -2016-09-03 Werner Lemberg - - [base] Avoid negative bitmap strike dimensions (#48985). - - * src/base/ftobjs.c (FT_Open_Face): Check whether negation was - actually successful. For example, this can fail for value - -32768 if the type is `signed short'. If there are problems, - disable the strike. - -2016-09-03 Werner Lemberg - - [cff] Avoid null pointer passed to FT_MEM_COPY (#48984). - - * src/cff/cffload.c (cff_index_get_name): Check `byte_len'. - -2016-09-02 Werner Lemberg - - [unix] Enable 64bit support in file system access (#48962). - - * builds/unix/configure.raw: Call `AC_SYS_LARGEFILE'. - -2016-09-02 Werner Lemberg - - [sfnt] Avoid left shift of negative value (#48980). - - * src/sfnt/ttsbit.c (tt_sbit_decoder_load_bit_aligned): Use unsigned - constant. - -2016-09-02 Werner Lemberg - - * src/smooth/ftgrays.c (gray_hline): Fix clang compiler warnings. - -2016-09-02 Werner Lemberg - - Some preparations for the next release. - - * include/freetype/config/ftoption.h - (TT_CONFIG_OPTION_SUBPIXEL_HINTING): Enable. - - * docs/CHANGES: Updated. - -2016-09-01 Alexei Podtelezhnikov - - [smooth] Simplify span rendering more. - - It turns out that there is significant cost associated with `FT_Span' - creation and calls to `gray_render_span' because it happens so - frequently. This removes these steps from our internal use but leaves - it alone for `FT_RASTER_FLAG_DIRECT" to preserve API. The speed gain - is about 5%. - - * src/smooth/ftgrays.c (gray_render_span): Removed. The code is - migrated to... - (gray_hline): ... here. - -2016-08-30 Alexei Podtelezhnikov - - [smooth] Streamline pixmap drawing a bit more. - - Zero coverage is unlikely (1 out of 256) to warrant checking. This - gives 0.5% speed improvement in rendering simple glyphs. - - * src/smooth/ftgrays.c (gray_hline, gray_render_span): Remove checks. - -2016-08-29 Alexei Podtelezhnikov - - [smooth] Streamline pixmap drawing. - - This gives 2% speed improvement in rendering simple glyphs. - - * src/smooth/ftgrays.c (TPixmap): Reduced pixmap descriptor with a - pointer to its bottom-left and pitch to be used in... - (gray_TWorker): ... here. - (gray_render_span): Move pixmap flow check from here... - (gray_raster_render): .. to here. - -2016-08-27 Alexei Podtelezhnikov - - [smooth] Reduce stack of band boundaries. - - * src/smooth/ftgrays.c (gray_TBand): Removed. - (gray_convert_glyph): Updated to stack band boundaries concisely. - -2016-08-26 Werner Lemberg - - * src/cid/cidload.c (cid_face_open): Improve handling of `SDBytes'. - -2016-08-26 Werner Lemberg - - [cid] Fix commit from 2016-05-16. - - * src/cid/cidparse.c (cid_parser_new): Fix off-by-one errors. - -2016-08-26 Werner Lemberg - - [sfnt] Cache offset and size to bitmap data table. - - This commit avoids `EBDT' and friends being looked up again and - again while loading a single embedded bitmap. - - * include/freetype/internal/tttypes.h (TT_FaceRec) - [TT_CONFIG_OPTION_EMBEDDED_BITMAPS]: New fields `ebdt_start' and - `ebdt_size'. - - * src/sfnt/ttsbit.c (tt_sbit_decoder_init): Move table lookup to ... - (tt_face_load_sbit): ... this function; also store the table size - and offset. - -2016-08-26 Alexei Podtelezhnikov - - * src/smooth/ftgrays.c (gray_raster_render): Minor tweaks. - -2016-08-26 Werner Lemberg - - [type1] Fix heap buffer overflow. - - Reported as - - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=36 - - * src/type1/t1load.c (parse_charstrings): Reject fonts that don't - contain glyph names. - -2016-08-25 Werner Lemberg - - [sfnt] Fix previous commit (#48901). - - * src/sfnt/ttcmap.c (tt_cmap4_char_map_binary): Thinkos. - -2016-08-25 Werner Lemberg - - [sfnt] Speed up handling of invalid format 4 cmaps. - - * src/sfnt/ttcmap.c (tt_cmap4_next, tt_cmap4_char_map_binary): Add - tests for `num_glyph' from `tt_cmap4_char_map_linear'. - -2016-08-25 Werner Lemberg - - * include/freetype/internal/ftdriver.h: Remove unused typedefs. - -2016-08-22 Alexei Podtelezhnikov - - [smooth] Simplify span rendering. - - This removes unnecessary complexity of span merging and buffering. - Instead, the spans are rendered as they come, speeding up the - rendering by about 5% as a result. - - * src/smooth/ftgrays.c [FT_MAX_GRAY_SPANS]: Macro removed. - (gray_TWorker): Remove span buffer and related fields. - (gray_sweep, gray_hline): Updated. - - * include/freetype/ftimage.h: Remove documentation note about - `FT_MAX_GRAY_SPANS', which was never in `ftoption.h' and is now gone. - -2016-08-16 Werner Lemberg - - [truetype] Fix `MPS' instruction. - - According to Greg Hitchcock, MPS in DWrite really returns the point - size. - - * src/truetype/ttobjs.h (TT_SizeRec): Add `point_size' member. - - * src/truetype/ttdriver.c (tt_size_request): Set `point_size'. - - * src/truetype/ttinterp.h (TT_ExecContextRec): Add `pointSize' - member. - - * src/truetype/ttinterp.c (TT_Load_Context): Updated. - (Ins_MPS): Fix instruction. - -2016-08-16 Werner Lemberg - - [lzw] Optimize last commit. - - * src/lzw/ftzopen.c (ft_lzwstate_get_code): Move check into - conditional clause. - -2016-08-16 Werner Lemberg - - [lzw] Avoid invalid left shift. - - Reported as - - https://bugzilla.mozilla.org/show_bug.cgi?id=1295366 - - * src/lzw/ftzopen.c (ft_lzwstate_get_code): Limit `num_bits'. - -2016-08-16 Werner Lemberg - - [lzw] Avoid buffer overrun. - - Reported as - - https://bugzilla.mozilla.org/show_bug.cgi?id=1273283 - - * src/lzw/ftzopen.c (ft_lzwstate_refill): Ensure `buf_size' doesn't - underflow. - -2016-08-16 Werner Lemberg - - [truetype] Fix compiler warning. - - * src/truetype/ttgload.c (load_truetype_glyph): Add cast. - -2016-08-13 Werner Lemberg - - [winfonts] Avoid zero bitmap width and height. - - Reported as - - https://bugzilla.mozilla.org/show_bug.cgi?id=1272173 - - * src/winfonts/winfnt.c (FNT_Face_Init): Check zero pixel height. - (FNT_Load_Glyph): Check for zero pitch. - -2016-08-11 Alexei Podtelezhnikov - - * src/truetype/ttinterp.c (Pop_Push_Count): Revert changes. - -2016-08-11 Alexei Podtelezhnikov - - * src/truetype/ttinterp.c (TT_RunIns): Minor and formatting. - -2016-08-11 Alexei Podtelezhnikov - - * src/truetype/ttinterp.c (Pop_Push_Count): Fix some entries. - -2016-08-10 Peter Klotz - - * src/smooth/ftgrays.c (gray_hline): Fix uninitialized access. - -2016-08-10 Werner Lemberg - - [sfnt] Use correct type for `italicAngle' field (#48732). - - * src/sfnt/ttload.c (tt_face_load_post): Fix types. - -2016-08-06 Jon Spencer - - [sfnt] Fix `FT_Get_Advance' for bitmap strikes. - - `FT_Get_Advance' returns 0 for bitmap fonts. It first gets the - advance value from the font table and then scales it by the - `font->size->metrics->x_scale' field. But `FT_Select_Size' doesn't - set that value for bitmap fonts and the advance gets scaled to zero. - - Taken from - - https://github.com/behdad/harfbuzz/issues/252 - - * src/sfnt/ttsbit.c (tt_face_load_strike_metrics) - : Set scale values. - -2016-08-06 Behdad Esfahbod - - [truetype] Fix GX variation handling of composites. - - * src/truetype/ttgload.c (load_truetype_glyph) - [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Check `ARGS_ARE_XY_VALUES' flag. - -2016-08-05 Alexei Podtelezhnikov - - [smooth] Minor refactoring. - - * src/smooth/ftgrays.c (gray_render_scanline, gray_render_line): - Updated. - -2016-07-29 Werner Lemberg - - [sfnt, truetype] Don't abort on invalid `maxComponentDepth'. - - Since 2016-05-16 we detect infinite recursion directly. - - * src/sfnt/ttload.c (tt_face_load_maxp): Don't adjust - `maxComponentDepth'. - * src/truetype/ttgload.c (load_truetype_glyph): Don't abort if - `maxComponentDepth' is not valid. Instead, simply adjust its value - and emit a tracing message. - -2016-07-26 Werner Lemberg - - * src/autofit/aflatin.c (af_latin_metrics_scale_dim): Minor. - - No functional change. - -2016-07-22 Hin-Tak Leung - - [truetype] Record the end of IDEFs. - - To match the logic in FDEF. The value of the end is only used for - bound-checking in `Ins_JMPR', so it may not have been obvious that - it was not recorded. Tested (as part of Font Validator 2.0) all the - fonts on Fedora and did not see any change. - - * src/truetype/ttinterp.c (Ins_IDEF): Updated. - -2016-07-19 Werner Lemberg - - [truetype] Sanitizer fix, second try. - - * src/truetype/ttgxvar.c (ft_var_readpackedpoints): Fix boundary - tests and use only one slot more. - -2016-07-19 Werner Lemberg - - [truetype] Sanitizer fix. - - * src/truetype/ttgxvar.c (ft_var_readpackedpoints): Increase array - to fix nested loops. - -2016-07-18 Werner Lemberg - - [truetype] Make GETDATA work only for GX fonts. - - * src/truetype/ttinterp.c (opcode_name): Updated. - (Ins_GETDATA): Only define for `TT_CONFIG_OPTION_GX_VAR_SUPPORT'. - (TT_RunIns): Updated. - -2016-07-17 Werner Lemberg - - [truetype] Add support for Apple's - - GETDATA[], opcode 0x92 - - bytecode instruction. It always returns 17, and we have absolutely - no idea what it is good for... - - * src/truetype/ttinterp.c (Pop_Push_Count, opcode_name): Updated. - (Ins_GETDATA): New function. - (TT_RunIns): Add it. - -2016-07-16 Werner Lemberg - - [truetype] Add bytecode support for GX variation fonts. - - This commit implements undocumented (but confirmed) stuff from - Apple's old bytecode engine. - - GETVARIATION[], opcode 0x91 - This opcode pushes normalized variation coordinates for all axes - onto the stack (in 2.14 format). Coordinate of first axis gets - pushed first. - - GETINFO[], selector bit 3 - If GX variation support is enabled, bit 10 of the result is set - to 1. - - * src/truetype/ttinterp.c: Include FT_MULTIPLE_MASTERS_H. - (opcode_name) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Updated. - (Ins_GETINFO) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Handle selector - bit 3, checking support for variation glyph hinting. - (Ins_GETVARIATION) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: New function - to implement opcode 0x91. - (TT_RunIns) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Handle opcode 0x91. - -2016-07-16 Werner Lemberg - - [truetype] Fix GETINFO bytecode instruction. - - * src/truetype/ttinterp.c (Ins_GETINFO): Fix return value for - stretching information. - -2016-07-16 Behdad Esfahbod - - [truetype] Make all glyphs in `Zycon' GX font work. - - * src/truetype/ttgxvar.c (ft_var_readpackedpoints): Fix boundary - tests. - -2016-07-16 Werner Lemberg - - [truetype] Fix GX delta tracing. - - * src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Trace - relative point movements. - -2016-07-16 Behdad Esfahbod - - [truetype] More fixes for GX. - - This finally fixes the rendering of the cyclist and the lizard in - the `Zycon' font. - - * src/truetype/ttgxvar.c (ft_var_readpackedpoints): `first' point - index is always cumulative. - - (tt_handle_deltas): Rename to... - (tt_interpolate_deltas): ... This. - Add new parameter for output point array. - Update caller. - - (TT_Vary_Apply_Glyph_Deltas): Add `points_out' array; it now holds - the intermediate results of `tt_interpolate_deltas' that are to be - added to `outline->points'. - -2016-07-15 Werner Lemberg - - * src/autofit/aflatin.c (af_latin_hints_compute_segments): Thinko. - - `max_pos' is always larger than `min_pos' so `FT_ABS' is not needed. - - Reported by Alexei. - -2016-07-16 Nikolaus Waxweiler - - * src/truetype/ttinterp.c (Ins_MIRP): Fix copy-and-paste error. - - Problem reported by Hin-Tak Leung. - -2016-07-15 Werner Lemberg - - [autofit] Update and improve segment and edge tracing. - - * src/autofit/afhints.c (af_glyph_hints_dump_segments): Trace - `delta' also. - Don't show first point of segment as a replacement for `pos'; this - is (a) misleading, since the difference to `pos' can be almost - arbitrarily large in corner cases, and (b) it is better to have all - segment data in font units instead of a single value given in output - space coordinates. - Improve layout. - (af_glyph_hints_dump_edges): Show px->units and units->px conversion - values for convenience. - Improve layout. - -2016-07-15 Werner Lemberg - - [autofit] For edges, reject segments wider than 1px (#41334). - - * src/autofit/afhints.h (AF_SegmentRec): New member `delta'. - - * src/autofit/aflatin.c (af_latin_hints_compute_segments): Compute - `delta'. - (af_latin_hints_compute_edges): Reject segments with a delta larger - than 0.5px. - -2016-07-14 Werner Lemberg - - * include/freetype/freetype.h (FT_IS_NAMED_INSTANCE): New macro. - -2016-07-14 Werner Lemberg - - [sfnt] Fix `face_index' value in `FT_Face' for named instances. - - * src/sfnt/sfobjs.c (sfnt_init_face): Don't strip off higher 16bits. - -2016-07-14 Werner Lemberg - - * src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Fix tracing. - -2016-07-14 Behdad Esfahbod - - [truetype] Fix gxvar delta interpolation. - - The coordinates of the base font should be used for interpolation - purposes, NOT the current points (i.e., the result of accumulation - of previous deltas). - - * src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Initialize - `points_org' before looping over all tuples. - ---------------------------------------------------------------------------- diff --git a/ChangeLog.27 b/ChangeLog.27 new file mode 100644 index 000000000..e61d55135 --- /dev/null +++ b/ChangeLog.27 @@ -0,0 +1,2106 @@ +2016-12-30 Werner Lemberg + + * Version 2.7.1 released. + ========================= + + + Tag sources with `VER-2-7-1'. + + * docs/VERSION.TXT: Add entry for version 2.7.1. + + * README, Jamfile (RefDoc), builds/windows/vc2005/freetype.vcproj, + builds/windows/vc2005/index.html, + builds/windows/vc2008/freetype.vcproj, + builds/windows/vc2008/index.html, + builds/windows/vc2010/freetype.vcxproj, + builds/windows/vc2010/index.html, + builds/windows/visualc/freetype.dsp, + builds/windows/visualc/freetype.vcproj, + builds/windows/visualc/index.html, + builds/windows/visualce/freetype.dsp, + builds/windows/visualce/freetype.vcproj, + builds/windows/visualce/index.html, + builds/wince/vc2005-ce/freetype.vcproj, + builds/wince/vc2005-ce/index.html, + builds/wince/vc2008-ce/freetype.vcproj, + builds/wince/vc2008-ce/index.html: s/2.7/2.7.1/, s/27/271/. + + * include/freetype/freetype.h (FREETYPE_PATCH): Set to 1. + + * builds/unix/configure.raw (version_info): Set to 19:0:13. + * CMakeLists.txt (VERSION_PATCH): Set to 1. + +2016-12-30 Werner Lemberg + + [ftfuzzer] Replace `rand' with an xorshift algorithm. + + * src/tools/ftfuzzer/ftfuzzer.cc: Don't include `stdlib.h'. + (Random): Implement and use a 32bit `xorshift' algorithm. + +2016-12-30 Werner Lemberg + + [ftfuzzer] Restrict number of tested bitmap strikes. + + Malformed fonts often have large values for the number of bitmap + strikes, and FreeType doesn't check the validity of all bitmap + strikes in advance. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=353 + + * src/tools/ftfuzzer/ftfuzzer.cc: Include `stdlib.h' for `rand'. + (Random): Small class to provide n randomly selected numbers + (without repetition) out of the value set [1,N]. + (LLVMFuzzerTestOneInput): Use it to test only up to 10 bitmap + strikes. + +2016-12-29 Werner Lemberg + + [truetype] Variation font API stability issues. + + Make some functions work before a call to `TT_Set_MM_Blend'. + + * src/truetype/ttgxvar.c (tt_hadvance_adjust): Exit immediately if + we don't blend. + (TT_Get_MM_Blend, TT_Get_Var_Design): Return default values if we + don't blend. + +2016-12-29 Werner Lemberg + + * src/truetype/ttgxvar.c (TT_Get_MM_Var): Check axis data. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=348 + +2016-12-29 Werner Lemberg + + [truetype] Tracing fixes. + + * src/truetype/ttgxvar.c (tt_hadvance_adjust): Emit correct + information. + (TT_Set_Var_Design): Fix typo. + (TT_Get_Var_Design): Fix typos. + +2016-12-29 Werner Lemberg + + */*: Use `0.5f' for tracing 16.16 numbers. + +2016-12-29 Werner Lemberg + + [pcf] Protect against gzip bombs. + + Fix suggested by Kostya; reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=345 + + * src/pcf/pcfread.c (pcf_read_TOC): Limit number of TOC entries to + 1024. + +2016-12-28 Werner Lemberg + + [psnames] Only declare, not define, data in `pstables.h' (#49949). + + Pdfium includes `pstables.h' a second time; moving the definition + from `pstables.h' to `psmodule.c' saves more than 60kByte data + segment space for this case. + + * src/tools/glnames.py (StringTable::dump, + StringTable::dump_sublist, dump_encoding, dump_array): Emit + additional code to only define tables if `DEFINE_PS_TABLES' is set. + + * src/psnames/pstables.h: Regenerated. + * src/psnames/psmodule.c (DEFINE_PS_TABLES): Define. + +2016-12-28 Werner Lemberg + + [cff] Catch `blend' op in non-variant fonts. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=334 + + * src/cff/cf2intrp.c (cf2_interpT2CharString) : Don't + allow `blend' op for non-variant fonts. + +2016-12-28 Werner Lemberg + + [cff] Better check of number of blends. + + * src/cff/cf2intrp.c (cf2_interpT2CharString) , + src/cff/cffparse.c (cff_parse_blend): Compare number of blends with + stack size. + +2016-12-27 Werner Lemberg + + Documentation updates. + + * docs/CHANGES: Add missing information. + + * docs/formats.txt: Rewritten and updated. + +2016-12-27 Werner Lemberg + + [truetype, type1] Implement `FT_Get_Var_Design_Coordinates'. + + * src/truetype/ttgxvar.c (TT_Get_Var_Design): Implement. + (TT_Set_Var_Design): Fix tracing. + + * src/type1/t1load.c (T1_Get_Var_Design): Implement. + +2016-12-24 Werner Lemberg + + * src/truetype/ttpload.c (tt_face_load_hdmx): Ignore `version'. + + Problem reported by 張俊芝 <418092625@qq.com>. + +2016-12-24 Werner Lemberg + + * src/sfnt/ttsbit.c (tt_face_load_sbit): Allow more version values. + + Some fonts seem to have the `version' field in the wrong byte order. + + Problem reported by 張俊芝 <418092625@qq.com>. + +2016-12-24 Werner Lemberg + + * src/truetype/ttpload.c (tt_face_load_loca): Sanitize table length. + + This trivial fix allows us to accept more fonts. + + Problem reported by 張俊芝 <418092625@qq.com>. + +2016-12-24 Werner Lemberg + + * src/sfnt/sfobjs.c (sfnt_init_face): Fix tracing. + +2016-12-22 Werner Lemberg + + * CMakeLists.txt: Make it work with cmake 2.8.11.2 (#49909). + +2016-12-22 Werner Lemberg + + Ensure used preprocessor symbols are defined (#49790). + + * builds/unix/ftconfig.in, builds/vms/ftconfig.h, + include/freetype/config/ftconfig.h: Check `__GNUC__', `__IBMC__', + and `__SUNPRO_C' correctly. + +2016-12-22 Werner Lemberg + + * src/base/ftrfork.c (FT_Raccess_Get_DataOffsets): Check `count'. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=308 + +2016-12-22 Werner Lemberg + + [cff] Protect against invalid `vsindex' and `blend' values. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=305 + + * src/cff/cf2intrp.c (cf2_interpT2CharString) : Implement it. + +2016-12-22 Werner Lemberg + + [ftfuzzer] Always use Adobe CFF engine. + + * src/tools/ftfuzzer/ftfuzzer.cc (FT_Global::FT_Global): Implement + it. + +2016-12-21 Werner Lemberg + + * src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Thinko. + + I should really stop coding late in the evening... + + Thanks again to Ben for checking. + +2016-12-21 Werner Lemberg + + [autofit] Support variation fonts. + + (This ChangeLog entry was added later on.) + + * src/autofit/afglobal.c (af_face_globals_free): Remove useless + code. + + * src/base/ftmm.c (FT_Set_MM_Design_Coordinates, + * FT_Set_Var_Design_Coordinates, FT_Set_MM_Blend_Coordinates, + FT_Set_Var_Blend_Coordinates): Finalize + auto-hinter data to enforce recomputation. Note that this is a + brute-force method which should be improved. + +2016-12-21 Werner Lemberg + + * src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Thinko. + + Don't apply deltas twice for non-phantom points. + + Spotted by Ben Wagner. + +2016-12-21 Werner Lemberg + + [cff, truetype] Another try for #49829. + + * src/cff/cffdrivr.c: Don't include + `FT_SERVICE_METRICS_VARIATIONS_H'. + (cff_get_advances): Use `ttface->variation_support'. + + * src/truetype/ttdriver.c (tt_get_advances): Use + `ttface->variation_support'. + + * src/truetype/ttgload.c (TT_Process_Simple_Glyph, + load_truetype_glyph): Use `ttface->variation_support'. + +2016-12-21 Werner Lemberg + + [truetype, sfnt] Introduce font variation flags to `TT_Face'. + + * include/freetype/internal/tttypes.h (TT_FACE_FLAG_VAR_XXX): + New macros describing available functionality of various OpenType + tables related to font variation. + (TT_Face): New fields `variation_support' and `mvar_support', + replacing and extending `use_fvar'. + + * src/sfnt/sfobjs.c (sfnt_init_face, sfnt_load_face): Use + `variation_support'. + + * src/truetype/ttgxvar.c (ft_var_load_hvar): Set `variation_support' + field. + (TT_Vary_Apply_Glyph_Deltas): Updated. + +2016-12-21 Werner Lemberg + + [base] Improve sanity check for Mac resources (#49888). + + * src/base/ftobjs.c (Mac_Read_sfnt_Resource): Abort if `rlen' is not + positive. + +2016-12-20 Werner Lemberg + + [base] More sanity checks for Mac resources. + + We use + + https://github.com/kreativekorp/ksfl/wiki/Macintosh-Resource-File-Format + + and + + https://developer.apple.com/legacy/library/documentation/mac/pdf/MoreMacintoshToolbox.pdf#page=151 + + as references. + + * include/freetype/internal/ftrfork.h (FT_RFork_Ref): Use FT_Short + for `res_id'. + + * src/base/ftrfork.c (FT_Raccess_Get_HeaderInfo): Extract map length + and use it to improve sanity checks. + Follow the specification more closely;in particular, all data types + are signed, not unsigned. + (FT_Raccess_Get_DataOffsets): Follow the specification more closely; + in particular, all data types are signed, not unsigned. + Add some sanity checks. + +2016-12-20 Werner Lemberg + + [truetype] Improve logic for getting fast advance widths. + + * src/cff/cffdrivr.c (cff_get_advances), src/truetype/ttdriver.c + (tt_get_advances): Use `is_default_instance' for test; this gets + recomputed after changing blend coordinates. + +2016-12-20 Ben Wagner + Werner Lemberg + + [truetype] Fix linear metrics of GX variation fonts (#49829). + + When asking for an unhinted non-default variations, + `linearVertAdvance' is currently the value from the `hmtx' table + instead of the actual value after applying the variation. `HVAR' + support fixes this, but fonts will exist without that table and will + need sane fallback. + + Problem also reported as + + https://bugs.chromium.org/p/skia/issues/detail?id=5917 + + * src/truetype/ttgload.c (TT_Process_Simple_Glyph, + load_truetype_glyph): Implement linear advance adjustments if `HVAR' + or `VVAR' tables are missing. + +2016-12-20 Werner Lemberg + + [cff, truetype] Fast advance width retrieval for fonts with HVAR. + + Everything is guarded with TT_CONFIG_OPTION_GX_VAR_SUPPORT. + + * src/base/ftadvanc.c (LOAD_ADVANCE_FAST_CHECK): Don't handle MM. + + * src/cff/cffdrivr.c: Include FT_SERVICE_METRICS_VARIATIONS_H. + (cff_get_advances): Test for HVAR and VVAR. + + * src/truetype/ttdriver.c (tt_get_advances): Test for HVAR and VVAR. + +2016-12-18 Werner Lemberg + + [base] Fix invalid mac font recursion. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=304 + + * src/base/ftobjs.c (FT_Open_Face): Code moved to... + (ft_open_face_internal): ... this function. + Add a parameter to control whether we try special Mac font handling + in case of failure. + (FT_Open_Face, FT_New_Face, FT_New_Memory_Face, + open_face_from_buffer): Use `ft_open_face_internal'. + +2016-12-18 Werner Lemberg + + * src/cff/cffobjs.c (cff_face_init): Make named instances work. + +2016-12-18 Werner Lemberg + + [truetype, cff] Extend `get_var_blend' function of MM service. + + In particular, we need access to named instance data. + + * include/freetype/internal/services/svmm.h (FT_Get_Var_Blend_Func): + Add argument for `FT_MM_Var'. + + * src/cff/cffload.c (cff_get_var_blend): Updated. + * src/cff/cffload.h: Updated. + + * src/cff/cf2ft.c (cf2_getNormalizedVector): Updated. + + * src/truetype/ttgxvar.c (tt_get_var_blend): Updated. + Accept value `NULL' for arguments. + * src/truetype/ttgxvar.h: Updated. + +2016-12-18 Werner Lemberg + + [sfnt] Handle `fvar' with zero axes as a non-MM font. + + This is better behaviour than exiting with an error. + + * include/freetype/internal/tttypes.h (TT_Face): Add `use_fvar' + field. + + * src/sfnt/sfobjs.c (sfnt_init_face): Compute `use_fvar', also + updating the validation code. + Use `use_fvar' to compute FT_FACE_FLAG_MULTIPLE_MASTERS. + + * src/truetype/ttgxvar.c (TT_Get_MM_Var): Remove `fvar' validation + code. + +2016-12-18 Werner Lemberg + + Minor GX code shuffling. + + * include/freetype/internal/tttypes.h (TT_Face): Move + `is_default_instance' into TT_CONFIG_OPTION_GX_VAR_SUPPORT + block. + + * src/sfnt/sfobjs.c (sfnt_init_face): Updated. + * src/truetype/ttgload.c (IS_DEFAULT_INSTANCE): New macro. + (TT_Load_Glyph): Use it. + +2016-12-18 Werner Lemberg + + [cff] Better handling of non-CFF font formats. + + * src/cff/cffload.c (cff_font_load): Pure CFFs don't have a + signature, so return `FT_Err_Unknown_File_Format' more often. + +2016-12-17 Werner Lemberg + + * src/cff/cffload.c (cff_build_blend_vector): Remove redundant code. + +2016-12-17 Werner Lemberg + + * src/truetype/ttobjs.c (tt_face_init): Simplify conditional code. + +2016-12-17 Werner Lemberg + + [sfnt, truetype] Various sanitizing fixes. + + * src/sfnt/sfobjs.c (sfnt_init_face): If the axis count in `fvar' is + zero, set `num_instances' to zero. + + * src/truetype/ttgxvar.c (TT_Get_MM_Var): Handle `fvar' table with + zero axes as invalid. + + * src/truetype/ttobjs.c (tt_face_init): Improve logic of loading + `loca', `cvt', `fpgm', and `prep' table. + +2016-12-17 Werner Lemberg + + Improve tracing of `FT_Open_Face'. + + * src/base/ftobjs.c (FT_Open_Face): Return info on number of + available faces and numbered instances, or the indices of the + requested face and numbered instance. + + * src/sfnt/sfobjs. (sfnt_open_font): Trace number of subfonts. + +2016-12-17 Werner Lemberg + + * src/cff/cffload.c (cff_load_private_dict): Always init `blend'. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=295 + +2016-12-16 Werner Lemberg + + [truetype] Fix `cvar' sanity test. + + Reported by Dave Arnold. + + * src/truetype/ttgxvar.c (tt_face_vary_cvt): Use tuple count mask. + +2016-12-16 Werner Lemberg + + [cff, truetype] Remove compiler warnings; fix `make multi'. + + * src/cff/cf2font.h: Include `cffload.h'. + + * src/cff/cffload.c: Include FT_MULTIPLE_MASTERS_H and + FT_SERVICE_MULTIPLE_MASTERS_H. + (cff_vstore_load): Eliminate `vsSize'. + (cff_load_private_dict): Tag as `FT_LOCAL_DEF'. + + * src/cff/cffload.h: Include `cffobjs.h'. + Provide declaration for `cff_load_private_dict'. + + * src/truetype/ttgxvar.c (ft_var_load_hvar): Eliminate + `minorVersion' and `map_offset'. + +2016-12-16 Werner Lemberg + + [cff] Fix heap buffer overflow (#49858). + + * src/cff/cffparse.c (cff_parser_run): Add one more stack size + check. + +2016-12-15 Werner Lemberg + + Fix clang warnings. + + * src/cff/cffload.c (cff_blend_doBlend): Add cast. + (cff_subfont_load): Set `error' correctly. + + * src/sfnt/ttmtx.c (tt_face_get_metrics): Typo. + +2016-12-15 Dave Arnold + Werner Lemberg + + [cff] Implement CFF2 support (2/2). + + The font variation code. All parts dependent on the GX code in the + `truetype' module are guarded with TT_CONFIG_OPTION_GX_VAR_SUPPORT. + In other words, you can still compile the `cff' module without + defining TT_CONFIG_OPTION_GX_VAR_SUPPORT (which brings you CFF2 + support without font variation). + + * src/cff/cf2font.c (cf2_font_setup): Add support for font + variation. + * src/cff/cf2font.h (CF2_Font): Add fields for variation data. + + * src/cff/cf2ft.c (cf2_free_instance): Free blend data. + (cf2_getVStore, cf2_getNormalizedVector): New functions. + * src/cff/cf2ft.h: Updated. + + * src/cff/cf2intrp.c: Include `cffload.h'. + (cf2_cmdRESERVED_15, cf2_cmdRESERVED_16): Replace with... + (cf2_cmdVSINDEX, cf2_cmdBLEND): ... this new enum values. + (cf2_doBlend): New function. + (cf2_interpT2CharString): Handle `vsindex' and `blend' opcodes. + + * src/cff/cffload.c (FT_fdot14ToFixed): New macro. + (cff_vstore_done, cff_vstore_load): New functions. + (cff_blend_clear, cff_blend_doBlend, cff_blend_build_vector, + cff_blend_check_vector): New functions. + (cff_load_private_dict): Add arguments for blend vector. + Handle blend data. + (cff_subfont_load, cff_subfont_done): Updated. + (cff_font_load): Handle CFF2 variation store data. + (cff_font_done): Updated. + * src/cff/cffload.h: Include `cffparse.h'. + Updated. + + * src/cff/cffobjs.c (cff_face_done): Updated. + + * src/cff/cffparse.c: Include `cffload.h'. + (cff_parse_num): Handle internal value 255. + (cff_parse_vsindex, cff_parse_blend): New functions. + (CFF_FIELD_BLEND): New macro. + (cff_parser_run): Updated. + * src/cff/cffparse.h (cff_kind_blend): New enum value. + + * src/cff/cfftoken.h: Handle `vstore', `vsindex', and `blend' + dictionary values. + + * src/cff/cfftypes.h (CFF_VarData, CFF_AxisCoords, CFF_VarRegion, + CFF_VStore, CFF_Blend): New structures. + (CFF_FontRecDict): Add `vstore_offset' field. + (CFF_Private): Add `vsindex' field. + (CFF_SubFont): Add fields for blend data. + (CFF_Font): Add `vstore' field. + + * src/truetype/ttgxvar.c (TT_Get_MM_Var): `CFF2' is equal to `gvar', + since glyph variation data is directly embedded. + (TT_Set_MM_Blend): Don't load `gvar' table for CFF2 fonts. + +2016-12-15 Dave Arnold + Werner Lemberg + + [cff] Implement CFF2 support (1/2). + + This commit does not contain the blend code for font variation + support, which follows in another commit. + + You should ignore whitespace while inspecting this commit. + + * include/freetype/internal/tttypes.h (TT_Face): Add `isCFF2' + member. + + * src/cff/cf2font.h (CF2_Font): Add `isCFF2' member. + + * src/cff/cf2ft.c (cf2_decoder_parse_charstrings): Handle `isCFF2' + flag. + (cf2_getMaxstack): New function. + * src/cff/cf2ft.h: Updated. + + * src/cff/cf2intrp.c (cf2_escRESERVED_38): New enum. + (cf2_interpT2CharString): Handle CFF2 differences. + Add tracing message for errors. + + * src/cff/cffdrivr.c (cff_get_glyph_name, cff_get_name_index): + Update for CFF2. + + * src/cff/cffload.c (FT_FIXED_ONE): New macro. + (cff_index_init, cff_index_load_offsets, cff_index_access_element, + cff_index_get_name, cff_ft_select_get, cff_load_private_dict, + cff_subfont_load, cff_font_load): Handle CFF2. + * src/cff/cffload.h: Updated. + + * src/cff/cffobjs.c (cff_face_init): Handle CFF2. + + * src/cff/cffparse.c (cff_parse_maxstack): New function. + (CFFCODE_TOPDICT, CFFCODE_PRIVATE): Removed + * src/cff/cffparse.h (CFF2_MAX_STACK, CFF2_DEFAULT_STACK): New + macros. + (CFF2_CODE_TOPDICT, CFF2_CODE_FONTDICT, CFF2_CODE_PRIVATE): New + macros. + + * src/cff/cfftoken.h: Add fields for CFF2 dictionaries (but no blend + stuff). + + * src/cff/cfftypes.h (CFF_Index): Add `hdr_size' field. + (CFF_FontRecDict): Add `maxstack' field. + (CFF_Private): Add `subfont' field. + (CFF_Font): Add `top_dict_length' and `cff2' fields. + + * src/sfnt/sfobjs.c (sfnt_load_face): Handle `CFF2' table. + +2016-12-15 Werner Lemberg + Dave Arnold + + [truetype] Provide HVAR advance width variation as a service. + + Everything is guarded with TT_CONFIG_OPTION_GX_VAR_SUPPORT. + + * src/truetype/ttdriver.c (tt_service_metrics_variations): Updated. + + * src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Prevent + double adjustment of advance width. + + * src/sfnt/ttmtx.c: Include FT_SERVICE_METRICS_VARIATIONS_H. + (tt_face_get_metrics): Apply metrics variations. + +2016-12-15 Dave Arnold + Werner Lemberg + + [truetype] Provide function to apply `HVAR' advance width variation. + + Everything is guarded with TT_CONFIG_OPTION_GX_VAR_SUPPORT. + + * src/truetype/ttgxvar.c (tt_hadvance_adjust): New function. + * src/truetype/ttgxvar.h: Updated. + +2016-12-15 Dave Arnold + Werner Lemberg + + [truetype] Add `HVAR' table parsing. + + Note that this is not complete yet; it only handles advance width + variation. + + Activation of the code follows in another commit. + + Everything is guarded with TT_CONFIG_OPTION_GX_VAR_SUPPORT. + + * include/freetype/ftmm.h (FT_Var_Named_Style): Add `psid' member. + + * src/truetype/ttgxvar.h (GX_HVarData, GX_AxisCoords, GX_HVarRegion, + GX_HVStore, GX_WidthMap): New auxiliary structures for... + (GX_HVarTable): ... HVAR main structure. + (GX_BlendRec): Add data for HVAR loading. + + * src/truetype/ttgxvar.c (FT_FIXED_ONE, FT_fdot14ToFixed, + FT_intToFixed, FT_fixedToInt): New macros. + (ft_var_load_hvar): New function. + (TT_Get_MM_Var): Updated. + (tt_done_blend): Deallocate HVAR data. + +2016-12-15 Dave Arnold + + [cff] Extend number parsing. + + The forthcoming CFF2 support needs a dynamic parsing limit. + + * src/cff/cffparse.c (cff_parse_num, do_fixed, cff_parse_fixed, + cff_parse_fixed_scaled, cff_parse_fixed_dynamic): Add argument for + parser. + (cff_parse_font_matrix, cff_parse_font_bbox, cff_parse_private_dict, + cff_parse_multiple_master, cff_parse_cid_ros, cff_parser_run): Updated. + + * src/cff/cffparse.h (cff_parse_num): Export locally. + +2016-12-15 Dave Arnold + + [cff] Implement dynamic stack size for Adobe engine. + + This also adds `cf2_stack_setReal' and `cf2_stack_pop', needed for + the forthcoming CFF2 support. + + * src/cff/cf2stack.c (cf2_stack_init): Add argument for stack size. + (cf2_stack_free): Deallocate stack. + (cf2_stack_count, cf2_stack_pushInt, cf2_stack_pushFixed, + cf2_stack_popInt, cf2_stack_popFixed, cf2_stack_getReal, + cf2_stack_clear): Updated. + (cf2_stack_setReal, cf2_stack_pop): New functions. + + * src/cff/cf2stack.h (CF2_Stack): Add `stackSize' member. + Update function declarations. + + * src/cff/cf2intrp.c (cf2_interpT2CharString): Updated. + + * src/cff/cffparse.c (cff_parser_init): Add parameter for stack + size; return error code. + (cff_parser_done): New function. + (cff_parser_run): Updated. + + * src/cff/cffparse.h (CFF_Parser): Add `stackSize' member and make + `stack' a pointer. + Update function declarations. + + * src/cff/cffload.c (cff_load_private_dict, cff_subfont_load): + Updated. + +2016-12-15 Dave Arnold + Werner Lemberg + + [cff] Code shuffling. + + * src/cff/cfftypes.h (CFF_Font): Add `library' and `base_offset' + fields. + + * src/cff/cffload.c (cff_subfont_load): Change last argument to + `CFF_Font' + Split off parsing of private dictionary into... + (cff_load_private_dict): ...this new function. + (cff_font_load): Updated. + +2016-12-14 Werner Lemberg + + [sfnt, truetype] Add framework for Metrics Variations service. + + No effect yet; service functions will be implemented later on. + + Everything is guarded with TT_CONFIG_OPTION_GX_VAR_SUPPORT. + + * include/freetype/internal/services/svmetric.h: New file. + + * include/freetype/internal/ftserv.h + (FT_SERVICE_METRICS_VARIATIONS_H): New macro. + + * include/freetype/internal/tttypes.h (TT_Face): New field `var'. + + * src/sfnt/sfobjs.c: Include FT_SERVICE_METRICS_VARIATIONS_H. + (sfnt_init_face): Initialize `face->var'. + + * src/truetype/ttdriver.c: Include FT_SERVICE_METRICS_VARIATIONS_H. + (tt_service_metrics_variations): New service. + (tt_services): Updated. + + * src/truetype/ttpic.h: Updated. + +2016-12-14 Werner Lemberg + + [cff] Add Multiple Masters service. + + The code simply uses the MM functions from the `truetype' module. + + Everything is guarded with TT_CONFIG_OPTION_GX_VAR_SUPPORT. + + * include/freetype/internal/tttypes.h (TT_Face): New field `mm'. + + * src/cff/cffdrivr.c: Include FT_SERVICE_MULTIPLE_MASTERS_H. + (cff_set_mm_blend, cff_get_mm_blend, cff_get_mm_var, + cff_set_var_design, cff_get_var_design): New functions. + (cff_service_multi_masters): New service. + (cff_services): Updated. + + * src/cff/cffload.c (cff_get_var_blend, cff_done_blend): New + functions. + * src/cff/cffload.h: Updated. + + * src/cff/cffpic.h (CFF_SERVICE_MULTI_MASTERS_GET): New macro. + + * src/sfnt/sfobjs.c: Include FT_SERVICE_MULTIPLE_MASTERS_H. + (sfnt_init_face): Initialize `face->mm'. + +2016-12-14 Werner Lemberg + + Extend functionality of `ft_module_get_service'. + + It can now differentiate between local and global searches. + + * src/base/ftobjs.c (ft_module_get_service): Add `global' argument. + (FT_Get_TrueType_Engine_Type): Updated. + + * src/cff/cffdrivr.c (cff_get_ps_name, cff_get_cmap_info): Updated. + + * include/freetype/internal/ftobjs.h: Updated. + * include/freetype/internal/ftserv.h (FT_FACE_FIND_GLOBAL_SERVICE): + Updated. + +2016-12-14 Werner Lemberg + + * src/truetype/ttgxvar.c (tt_get_var_blend): Fix compiler warning. + +2016-12-14 Dave Arnold + Werner Lemberg + + [sfnt, cff] Minor preparations. + + * include/freetype/tttags.h (TTAG_CFF2, TTAG_HVAR, TTAG_MVAR, + TTAG_VVAR): New SFNT table tags. + + * src/cff/cf2fixed.h (CF2_FIXED_ONE, CF2_FIXED_EPSILON): Add cast. + +2016-12-10 Werner Lemberg + + [truetype, type1] Add `get_var_blend' to MM service. + + For internal use; we want to share code between the forthcoming CFF2 + support and TrueType. + + * include/freetype/internal/services/svmm.h (FT_Get_Var_Blend_Func): + New typedef. + (MultiMasters): Add `get_var_blend'. + (FT_Service_MultiMasters): Updated. + + * src/truetype/ttgxvar.c (tt_get_var_blend): New function. + * src/truetype/ttgxvar.h: Updated. + + * src/truetype/ttdriver.c (tt_service_gx_multi_masters): Updated. + * src/type1/t1driver.c (t1_service_multi_masters): Updated. + +2016-12-10 Werner Lemberg + + [truetype, type1] Add `done_blend' to MM service. + + For internal use; we want to share code between the forthcoming CFF2 + support and TrueType. + + * include/freetype/internal/services/svmm.h (FT_Done_Blend_Func): + New typedef. + (MultiMasters): Add `done_blend'. + (FT_Service_MultiMasters): Updated. + + * src/truetype/ttgxvar.c (tt_done_blend): Use `TT_Face' as argument. + * src/truetype/ttgxvar.h: Updated. + + * src/truetype/ttobjs.c (TT_Face_Done): Updated. + + * src/truetype/ttdriver.c (tt_service_gx_multi_masters): Updated. + * src/type1/t1driver.c (t1_service_multi_masters): Updated. + +2016-12-09 Werner Lemberg + + [sfnt] Revert change from 2016-12-08. + + I missed the functionality of `ft_module_get_service', which makes + the change unnecessary. + +2016-12-08 Werner Lemberg + + Add framework to support services with 8 functions. + + We will need this for CFF variation font support. + + * include/freetype/internal/ftserv.h (FT_DEFINE_SERVICEDESCREC8): + New macro. + +2016-12-08 Werner Lemberg + + [sfnt] Add `get_glyph_name' and `get_name_index' to SFNT interface. + + CFF2 fonts will need access to those two functions. + + * include/freetype/internal/sfnt.h: Include FT_SERVICE_GLYPH_DICT_H. + (SFNT_Interface): Add `get_glyph_name' and `get_name_index' members. + (FT_DEFINE_SFNT_INTERFACE): Updated. + + * src/sfnt/sfdriver.c (sfnt_get_glyph_name, sfnt_get_name_index): + Fix signatures to exactly correspond to the glyph dict service + function typedefs. + (sfnt_interface): Updated. + +2016-12-06 Dave Arnold + + Add `FT_Get_Var_Design_Coordinates' function. + + Note that the low-level functions aren't implemented yet. + + * include/freetype/ftmm.h: Declare. + + * include/freetype/internal/services/svmm.h + (FT_Get_Var_Design_Func): New typedef. + (MultiMasters): New MM service function `get_var_design'. + (FT_DEFINE_SERVICE_MULTIMASTERSREC): Updated. + Update all callers. + + * src/base/ftmm.c (FT_Get_Var_Design_Coordinates): Implement. + + * src/truetype/ttdriver.c: Updated. + + * src/truetype/ttgxvar.c (TT_Get_Var_Design): New dummy function to + handle `get_var_design' service. + * src/truetype/ttgxvar.h: Updated. + + * src/type1/t1driver.c: Updated. + + * src/type1/t1load.c (T1_Get_Var_Design): New dump function to + handle `get_var_design' service. + * src/type1/t1load.h: Updated. + +2016-12-06 Werner Lemberg + + * src/type1/t1load.c (parse_subrs): Fix memory leak. + + The `subrs' keyword might erroneously occur multiple times. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=231 + +2016-12-01 Werner Lemberg + + [gzip] Improve building with external zlib (#49673). + + Building FreeType with external zlib 1.2.8 makes msvc 14 stop with + the following error. + + ftgzip.c + zlib-1.2.8\zlib.h(86): error C2061: + syntax error: identifier 'z_const' + zlib-1.2.8\zlib.h(94): error C2054: + expected '(' to follow 'z_const' + zlib-1.2.8\zlib.h(94): error C2085: + 'msg': not in formal parameter list + ... + zlib-1.2.8\zlib.h(877): fatal error C1003: + error count exceeds 100; stopping compilation + + The error happens because FreeType keeps an own copy of zlib-1.1.4 + under `src/gzip'. When building `src/gzip/ftgzip.c' with + FT_CONFIG_OPTION_SYSTEM_ZLIB defined, it uses + + #include + + which correctly finds an external `zlib.h', but `zlib.h' itself has + a line + + #include "zconf.h" + + which makes Visual Studio 2015 find `src/gzip/zconf.h' while + compiling the files in `src/gzip'. + + * src/gzip/zconf.h: Rename to... + * src/gzip/ftzconf.h: ... this. + * src/gzip/zlib.h, src/gzip/rules.mk (GZIP_DRV_SRCS): Updated. + +2016-12-01 Oleksandr Chekhovskyi + + [autofit] Fix Emscripten crash (patch #9180). + + Function calls through pointers must use a matching signature to + work on Emscripten, since such calls are dispatched through lookup + tables grouped by signature. + + * src/autofit/aftypes.h (AF_WritingSystem_ApplyHintsFunc): Fix + typedef. + +2016-11-29 Werner Lemberg + + [smooth] Revert previous commit. Already fixed with 6ca54c64. + +2016-11-29 Werner Lemberg + + [smooth] Avoid conditional jump on uninitialized value (#49711). + + * src/smooth/ftgrays.c (gray_raster_render): Initialize `worker'. + +2016-11-27 Nikolaus Waxweiler + + [autofit] Code shuffling. + + Also improve some comments and remove unused code. + + No functional change. + + * src/autofit/afloader.c (af_loader_load_g): Merged with... + (af_loader_load_glyph): ...this function. + Split off emboldening code into... + (af_loader_embolden_glyph_in_slot): ... this function. + +2016-11-17 Werner Lemberg + + Better support of LLP64 systems with gcc (and clang). + + * builds/unix/configure.raw: Call `AC_TYPE_LONG_LONG_INT'. + + * builds/unix/ftconfig.in (FT_LONG64): Enable for LLP64 systems (and + suppress warnings) even without `FT_CONFIG_OPTION_FORCE_INT64'. + +2016-11-10 Werner Lemberg + + Fix `lcd_weights' array size. + + * include/freetype/internal/ftobjs.h (FT_LibraryRec): Do it. + + Reported by Nikolaus. + +2016-11-06 Werner Lemberg + + * src/base/ftobjs.c (FT_Render_Glyph_Internal): Fix tracing. + +2016-11-06 Werner Lemberg + + [sfnt] Improve FT_LOAD_BITMAP_METRICS_ONLY for `sbix' format. + + It's unavoidable to call the PNG engine, but to get the metrics it + is sufficient to read the PNG image's header only. + + * src/sfnt/pngshim.c (Load_SBit_Png): Add argument to control the + allocation of the glyph slot. + * src/sfnt/pngshim.h: Updated. + * src/sfnt/ttsbit.c (tt_sbit_decoder_load_png, + tt_face_load_sbix_image, tt_face_load_sbit_image): Updated. + +2016-11-06 Werner Lemberg + + [sfnt] Speed up `sbix' lookup. + + This also fixes a bug introduced in 2016-10-01 which prevents + display of embedded bitmap fonts that use the `sbix' format. + + * src/sfnt/ttsbit.c (tt_face_load_sbit): Store `sbix' size and + offset also in `ebdt_size' and `ebdt_start', respectively. This + makes the test for an embedded bitmap data table succeed for this + format. + + (tt_face_load_strike_metrics) : Use + `ebdt_size' and `ebdt_start' + (tt_face_load_sbix_image): Ditto. + +2016-11-06 Seigo Nonaka + Werner Lemberg + + Introduce a way of quickly retrieving (embedded) bitmap metrics. + + `FT_Load_Glyph' doesn't generate a bitmap for a non-bitmap glyph + until the user calls `FT_Render_Glyph'. However, it always + allocates memory for bitmaps and copies or decodes the contents of a + bitmap glyph, which can be quite slow for PNG data. + + * include/freetype/freetype.h (FT_LOAD_BITMAP_METRICS_ONLY): New + macro. + + * src/base/ftobjs.c (FT_Load_Glyph): Unset FT_LOAD_RENDER if + FT_LOAD_BITMAP_METRICS_ONLY is used. + + * src/sfnt/ttsbit.c (tt_sbit_decoder_alloc_bitmap, + tt_sbit_decoder_load_bitmap): Add argument to control allocation of + the glyph slot. + (tt_sbit_decoder_load_image, tt_sbit_decoder_load_compound, + tt_face_load_sbit_image): Updated. + + * src/pcf/pcfdrivr.c (PCF_Glyph_Load): Quickly exit if + `FT_LOAD_BITMAP_METRICS_ONLY' is set. + + * src/pfr/pfrsbit.c, src/pfr/pfrsbit.h (pfr_slot_load_bitmap): Add + argument to control allocation of the glyph slot. + * src/pfr/pfrobjs (pfr_slot_load): Updated. + + * src/winfonts/winfnt.c (FNT_Load_Glyph): Ditto. + + * docs/CHANGES: Updated. + +2016-11-06 Werner Lemberg + + Synchronize with gnulib (#49448). + + * include/freetype/config/ftconfig.h, builds/unix/ftconfig.in, + builds/vms/ftconfig.h (FT_TYPEOF): Update code to use definition in + current version of `intprops.h'. + Other minor synchronization to reduce code differences between the + three files. + +2016-11-03 Behdad Esfahbod + + [truetype] Clamp variation requests to valid range. + + This is required by OpenType 1.8; it also avoids rounding surprises. + + * src/truetype/ttgxvar.c (TT_Set_Var_Design): Clamp design coordinates + outside of the allowed range to always stay within the range instead + of producing an error. + +2016-10-29 Werner Lemberg + + [truetype] Remove clang warnings. + + * src/truetype/ttinterp.h (TT_ExecContextRec): Using `FT_ULong' for + loop counter handling. + + * src/truetype/ttinterp.c: Updated. + (Ins_SCANTYPE): Use signed constant. + (TT_RunIns): Ensure `num_twilight_points' is 16bit. + +2016-10-27 Werner Lemberg + + [truetype] Fix commit from 2014-11-24. + + Problem reported by Hin-Tak Leung . + + * src/truetype/ttpload.c (tt_face_load_hdmx): Fix file checking + logic. + +2016-10-26 Werner Lemberg + + Add `FT_Get_{MM,Var}_Blend_Coordinates' functions. + + * include/freetype/ftmm.h: Declare. + + * include/freetype/internal/services/svmm.h (FT_Get_MM_Blend_Func): + New typedef. + (MultiMasters): New MM service function `get_mm_blend'. + (FT_DEFINE_SERVICE_MULTIMASTERSREC): Updated. + Update all callers. + + * src/base/ftmm.c (FT_Get_MM_Blend_Coordinates, + FT_Get_Var_Blend_Coordinates): Implement. + + * src/truetype/ttdriver.c: Updated. + + * src/truetype/ttgxvar.c (TT_Get_MM_Blend): New function to handle + `get_mm_blend' service. + * src/truetype/ttgxvar.h: Updated. + + * src/type1/t1driver.c: Updated. + + * src/type1/t1load.c (T1_Get_MM_Blend): New function to handle + `get_mm_blend' service. + * src/type1/t1load.h: Updated. + + * docs/CHANGES: Document. + +2016-10-26 Werner Lemberg + + * src/type1/t1load.c (parse_subrs): Fix limit check. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=81 + +2016-10-25 Alexei Podtelezhnikov + + [cff] Correct cmap format reporting (#24819). + + * src/cff/cffdrivr.c (cff_get_cmap_info): Throw an error on synthetic + charmap instead of guessing its format and language. + +2016-10-22 Werner Lemberg + + [truetype] Fix SCANTYPE instruction (#49394). + + * src/truetype/ttinterp.c (Ins_SCANTYPE): Only use lower 16bits. + +2016-10-22 Werner Lemberg + + [sfnt] Improve handling of invalid post 2.5 tables [#49393]. + + * src/sfnt/ttpost.c (load_format_25): We need at least a single + table entry. + +2016-10-14 Werner Lemberg + + [truetype] Fix handling of `cvar' table data. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=53 + + * src/truetype/ttgxvar.c (tt_face_vary_cvt): Ignore invalid CVT + indices. + +2016-10-11 Werner Lemberg + + [psaux] Fix handling of invalid flex subrs. + + Problem reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=52 + + * src/psaux/t1decode.c (t1_decoder_parse_charstrings) + : Set `flex_state' after error checking. + +2016-10-11 Werner Lemberg + + * src/truetype/ttgxvar.c (tt_done_blend): Fix deallocation. + +2016-10-08 Werner Lemberg + + * src/cid/cidload.c (cid_face_open): Properly propagate `error'. + +2016-10-08 Werner Lemberg + + [cid] Fix parsing of subr offsets. + + Bug introduced 2016-05-16. + + * src/cid/cidparse.c (cid_parser_new): Fix off-by-one error. + +2016-10-01 Werner Lemberg + + [sfnt] Disable bitmap strikes if we don't have a bitmap data table. + + * src/sfnt/ttsbit.c (tt_face_load_sbit): Check whether we have + a bitmap data table. + +2016-10-01 Alexei Podtelezhnikov + + [smooth] Remove impossibility. + + * src/smooth/ftgrays.c (TWorker): Rearrange fields. + (gray_convert_glyph): Remove impossible condition and clean up. + +2016-09-29 Werner Lemberg + + [pcf] Enrich family name with foundry name and glyph width info. + + This is a very old patch from openSuSE (from 2006, submitted to + FreeType in 2011) that I forgot to apply. + + https://build.opensuse.org/package/view_file/openSUSE:Factory/freetype2/freetype2-bitmap-foundry.patch + + Prepend the foundry name plus a space to the family name. There are + many fonts just called `Fixed' which look completely different, and + which have nothing to do with each other. When selecting `Fixed' in + KDE or Gnome one gets results that appear rather random, the style + changes often if one changes the size and one cannot select some + fonts at all. + + We also check whether we have `wide' characters; all put together, + we get family names like `Sony Fixed' or `Misc Fixed Wide'. + + * src/pcf/pcfread.c (pcf_load_font): Implement it. + + * docs/CHANGES: Document it. + +2016-09-29 Werner Lemberg + + [ftfuzzer] Speed up. + + * src/tools/ftfuzzer/ftfuzzer.cc (LLVMFuzzerTestOneInput): Don't + check for embedded bitmaps if we have a non-default instance. + +2016-09-29 Werner Lemberg + + [truetype] Disallow bitmap strikes for non-default instances. + + Also speed up access of default instances if GX variations are + active. + + * include/freetype/internal/tttypes.h (TT_FaceRec): Add + `is_default_instance' member. + + * src/sfnt/sfobjs.c (sfnt_init_face): Initialize + `is_default_instance'. + + * src/truetype/ttgload.c (TT_Process_Simple_Glyph, + load_truetype_glyph): Add test for default instance. + (TT_Load_Glyph): Load embedded bitmaps for default instance only. + + * src/truetype/ttgxvar.c (TT_Set_MM_Blend): Compute + `is_default_instance'. + +2016-09-29 Werner Lemberg + + [truetype] Clean up `TT_Face' structure. + + * include/freetype/internal/tttypes.h (TT_FaceRec): Remove unused + fields `horz_metrics' and `vert_metrics'. + Update documentation. + + * src/sfnt/sfobjs.c (sfnt_done_face): Updated. + +2016-09-28 Werner Lemberg + + More FT_ZERO usage. + + * src/gxvalid/gxvcommn.c (gxv_ClassTable_validate): + s/ft_memset/FT_MEM_ZERO/. + + * src/psaux/t1decode.c (t1_decoder_parse_charstrings): + s/ft_memset/FT_ARRAY_ZERO/. + + * src/raster/ftraster.c (FT_ZERO): Define. + (ft_black_new): Use it. + * src/raster/ftrend1.c (ft_raster1_get_cbox): + s/FT_MEM_ZERO/FT_ZERO/. + + * src/smooth/ftgrays.c (FT_ZERO): Define. + (gray_raster_new): Use it. + * src/smooth/ftsmooth.c (ft_smooth_get_cbox): + s/FT_MEM_ZERO/FT_ZERO/. + +2016-09-28 Werner Lemberg + + */*: s/FT_MEM_ZERO/FT_ZERO/ where appropriate. + +2016-09-27 Werner Lemberg + + [truetype] Trace number of executed opcodes. + + * src/truetype/ttinterp.c (TT_RunIns): Implement it. + +2016-09-27 Werner Lemberg + + [truetype] Speed up `TT_Load_Glyph'. + + This avoids additional calls to `tt_face_lookup_table' for the + `glyf' table, which can be expensive. + + * include/freetype/internal/tttypes.h (TT_LoaderRec): Move + `glyf_offset' field to ... + (TT_FaceRec): ... this structure. + * src/truetype/ttgload.c (load_truetype_glyph): Updated. + (tt_loader_init): Move initialization of `glyf_offset' to ... + * src/truetype/ttpload.c (tt_face_load_loca): ... this function. + +2016-09-27 Werner Lemberg + + [truetype] Introduce dynamic limits for some bytecode opcodes. + + This speeds up FreeType's handling of malformed fonts. + + * src/truetype/ttinterp.c (TT_RunIns): Set up limits for the number + of twilight points, the total number of negative jumps, and the + total number of loops in LOOPCALL opcodes. The values are based on + the number of points and entries in the CVT table. + (Ins_JMPR): Test negative jump counter. + (Ins_LOOPCALL): Test loopcall counter. + + * src/truetype/ttinterp.h (TT_ExecContext): Updated. + + * docs/CHANGES: Updated. + +2016-09-25 Werner Lemberg + + [truetype] Sanitize only last entry of `loca' table. + + Without this patch, a loca sequence like `0 100000 0 100000 ...', + where value 100000 is larger than the `glyf' table size, makes + FreeType handle the whole `glyf' table as a single glyph again and + again, which is certainly invalid (and can be very slow, too). + + * src/truetype/ttpload.c (tt_face_get_location): Implement. + Improve tracing messages. + +2016-09-25 Werner Lemberg + + * src/tools/ftfuzzer/ftfuzzer.cc (LLVMFuzzerTestOneInput): Fix typo. + +2016-09-24 Werner Lemberg + + [autofit] Tracing fixes. + + * src/autofit/afmodule.c (af_autofitter_load_glyph): Call dumping + functions only if we actually do tracing. + +2016-09-22 Alexei Podtelezhnikov + + [smooth] Reduce divisions in the line renderer. + + We don't need some divisions if a line segments stays within a single + row or a single column of pixels. + + * src/smooth/ftgrays.c (gray_render_line) [FT_LONG64]: Make divisions + conditional. + +2016-09-15 Alexei Podtelezhnikov + + * src/smooth/ftgrays.c (gray_sweep): Remove check for empty table. + +2016-09-14 Alexei Podtelezhnikov + + [smooth] Another tiny speed-up. + + * src/smooth/ftgrays.c (gray_find_cell): Merge into... + (gray_record_cell): ... this function. + +2016-09-11 Alexei Podtelezhnikov + + * src/smooth/ftgrays.c (gray_{find,set}_cell): Remove dubious code. + +2016-09-11 Alexei Podtelezhnikov + + [smooth] Fix valgrind warning and reoptimize. + + The algorithm calls `gray_set_cell' at the start of each new contour + or when the contours cross the cell boundaries. Double-checking for + that is wasteful. + + * src/smooth/ftgrays.c (gray_set_cell): Remove check for a new cell. + (gray_convert_glyph): Remove initialization introduced by 44b172e88. + +2016-09-10 Werner Lemberg + + [sfnt] Fix previous commit. + + Problems reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=40 + + We now map the strike index right before accessing the physical + data, not earlier. + + * src/sfnt/sfobjs.c (sfnt_load_face): Set `face->sbit_strike_map' + after creating the map so that... + + * src/sfnt/ttsbit.c (tt_face_load_strike_metrics): ... this function + can be used before and after setting up `sbit_strike_map'. + (tt_face_set_sbit_strike): Revert change. + (tt_sbit_decoder_init, tt_face_load_sbix_image): Map strike index. + + * src/truetype/ttdriver.c (tt_size_select): Revert change. + +2016-09-09 Werner Lemberg + + [ftfuzzer] Minor improvements. + + * src/tools/ftfuzzer/ftfuzzer.cc (LLVMFuzzerTestOneInput): Ignore + invalid strikes. + Use better values for call to `FT_Set_Char_Size'. + +2016-09-09 Werner Lemberg + + [sfnt] Don't provide (completely) broken strike data. + + FreeType tries to sanitize strike header data; we now reject + completely broken ones. + + * include/freetype/internal/tttypes.h (TT_FaceRec): New + `sbit_strike_map' array pointer. + + * src/base/ftobjs.c (FT_Match_Size): Reject matches where either + width or height would be zero. + Add tracing message in case of error. + + * src/sfnt/sfobjs.c (sfnt_load_face): Populate `sbit_strike_map', + only using (more or less) valid strike header data for + FT_Face's `available_sizes' array. + (sfnt_done_face): Updated. + + * src/sfnt/ttsbit.c (tt_face_set_sbit_strike): Use + `sbit_strike_map'. + (tt_face_load_strike_metrics): Improve tracing. + + * src/truetype/ttdriver.c (tt_size_select): Use `sbit_strike_map'. + +2016-09-08 Werner Lemberg + + * Version 2.7 released. + ======================= + + + Tag sources with `VER-2-7'. + + * docs/VERSION.TXT: Add entry for version 2.7. + + * README, Jamfile (RefDoc), builds/windows/vc2005/freetype.vcproj, + builds/windows/vc2005/index.html, + builds/windows/vc2008/freetype.vcproj, + builds/windows/vc2008/index.html, + builds/windows/vc2010/freetype.vcxproj, + builds/windows/vc2010/index.html, + builds/windows/visualc/freetype.dsp, + builds/windows/visualc/freetype.vcproj, + builds/windows/visualc/index.html, + builds/windows/visualce/freetype.dsp, + builds/windows/visualce/freetype.vcproj, + builds/windows/visualce/index.html, + builds/wince/vc2005-ce/freetype.vcproj, + builds/wince/vc2005-ce/index.html, + builds/wince/vc2008-ce/freetype.vcproj, + builds/wince/vc2008-ce/index.html: s/2.6.5/2.7/, s/265/27/. + + * include/freetype/freetype.h (FREETYPE_MINOR): Set to 7. + (FREETYPE_PATCH): Set to 0. + + * builds/unix/configure.raw (version_info): Set to 18:6:12. + * CMakeLists.txt (VERSION_MINOR): Set to 7. + (VERSION_PATCH): Set to 0. + + * docs/CHANGES: Updated. + +2016-09-08 Werner Lemberg + + * src/truetype/ttinterp.c: Include `ttgxvar.h'. + + This fixes the `multi' build. + +2016-09-08 Werner Lemberg + + [autofit] Another improvement to Armenian support. + + Suggested by Hrant H Papazian . + + * src/autofit/afscript.h: Use better suited characters to derive + default stem widths. + +2016-09-07 Alexei Podtelezhnikov + + * src/smooth/ftgrays.c (gray_hline): Micro-optimize. + +2016-09-06 Alexei Podtelezhnikov + + [smooth] Operate in absolute bitmap coordinates. + + Simpler bitmap addressing improves performance by 1.5%. + + * src/smooth/ftgrays.c (gray_TWorker): Remove count fields. + (gray_dump_cells, gray_find_cell, gray_set_cell, gray_hline, + gray_sweep, gray_convert_glyph, gray_raster_render): Updated. + +2016-09-06 Alexei Podtelezhnikov + + [smooth] Improve contour start (take 2). + + * src/smooth/ftgrays.c (gray_move_to): Call `gray_set_cell' directly + instead of... + (gray_start_cell): ... this function, which is removed. + (gray_convert_glyph): Make initial y-coordinate invalid. + +2016-09-06 Werner Lemberg + + [type1] MM fonts support exactly zero named instances (#48748). + + * src/type1/t1load.c (T1_Get_MM_Var): Set `num_namedstyles' to zero. + +2016-09-06 Jonathan Kew + + [cff] Fix uninitialized memory. + + Problem reported as + + https://bugzilla.mozilla.org/show_bug.cgi?id=1270288 + + * src/cff/cf2intrp.c (cf2_interpT2CharString): Initialize `storage' + array to handle a `get' opcode without a previous `put'. + +2016-09-05 Alexei Podtelezhnikov + + * src/smooth/ftgrays.c (gray_move_to, gray_start_cell): Revert. + +2016-09-05 Alexei Podtelezhnikov + + [smooth] Improve contour start. + + * src/smooth/ftgrays.c (gray_move_to): Call `gray_set_cell' directly + instead of... + (gray_start_cell): ... this function, which is removed. + +2016-09-05 Werner Lemberg + + [cff] Fix memory initialization. + + * src/cff/cf2stack.c (cf2_stack_init): Use `FT_NEW'. The `Q' + variants of FreeType's memory allocation macros don't do zeroing. + +2016-09-05 Werner Lemberg + + [ftrandom] Minor improvements. + + * src/tools/ftrandom/ftrandom.c (_XOPEN_SOURCE): New macro, set to + 500. + + * src/tools/ftrandom/Makefile (CFLAGS): Split off include + directories to ... + (INCLUDES): ... this new variable. + (LDFLAGS): New variable. + (ftrandom.o, ftrandom): Updated. + +2016-09-05 Werner Lemberg + + [autofit] Improve Armenian support. + + Thanks to Hrant H Papazian for help. + + * src/autofit/afblue.dat (AF_BLUE_STRING_ARMENIAN_*): Improve + selection of characters. + + * src/autofit/afblue.c, src/autofit/afblue.h: Regenerated. + +2016-09-04 Werner Lemberg + + [ftrandom] Improve Makefile. + + It now supports both a normal build (`./configure && make') and a + development build (`make devel'). + + * src/tools/ftrandom/Makefile (VPATH): Set it so that + `libfreetype.a' gets searched in both `objs' (for the development + build) and `objs/.libs' (for a normal build which uses libtool). + (LIBS): Add missing libraries. + (ftrandom.o): New rule. + (ftrandom): Use automatic variables. + +2016-09-03 Werner Lemberg + + [truetype] More fixes for handling of GX deltas. + + Problems reported by Bob Taylor . + + * src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Fix rough + sanity test for glyph variation array header size. + Always set stream position before reading packed x and y deltas. + Fix thinko w.r.t. `localpoints' array. + +2016-09-03 Werner Lemberg + + [ftrandom] Various fixes. + + * src/tools/ftrandom/ftrandom.c (GOOD_FONTS_DIR): Provide better + default. + (error_fraction): Make it of type `double' to work as advertized – + this was completely broken. + Update all related code. + (error_count, fcnt): Make it unsigned to fix compiler warnings. + Update all related code. + (fontlist): Change `len' member to `long' to fix compiler warnings. + (FT_MoveTo, FT_LineTo, FT_ConicTo, FT_CubicTo, abort_test): Tag + unused variables. + (TestFace, FindFonts, copyfont, do_test): Fix compiler warnings. + (ExecuteTest): Ditto. + Call `FT_Done_FreeType'. + (getErrorCnt): Replace `ceil' with an ordinary cast to `unsigned + int'. + (usage): Improve output. + (main): Fix compiler warnings. + + * src/tools/ftrandom/README: Updated. + +2016-09-03 Werner Lemberg + + [base] Avoid negative bitmap strike dimensions (#48985). + + * src/base/ftobjs.c (FT_Open_Face): Check whether negation was + actually successful. For example, this can fail for value + -32768 if the type is `signed short'. If there are problems, + disable the strike. + +2016-09-03 Werner Lemberg + + [cff] Avoid null pointer passed to FT_MEM_COPY (#48984). + + * src/cff/cffload.c (cff_index_get_name): Check `byte_len'. + +2016-09-02 Werner Lemberg + + [unix] Enable 64bit support in file system access (#48962). + + * builds/unix/configure.raw: Call `AC_SYS_LARGEFILE'. + +2016-09-02 Werner Lemberg + + [sfnt] Avoid left shift of negative value (#48980). + + * src/sfnt/ttsbit.c (tt_sbit_decoder_load_bit_aligned): Use unsigned + constant. + +2016-09-02 Werner Lemberg + + * src/smooth/ftgrays.c (gray_hline): Fix clang compiler warnings. + +2016-09-02 Werner Lemberg + + Some preparations for the next release. + + * include/freetype/config/ftoption.h + (TT_CONFIG_OPTION_SUBPIXEL_HINTING): Enable. + + * docs/CHANGES: Updated. + +2016-09-01 Alexei Podtelezhnikov + + [smooth] Simplify span rendering more. + + It turns out that there is significant cost associated with `FT_Span' + creation and calls to `gray_render_span' because it happens so + frequently. This removes these steps from our internal use but leaves + it alone for `FT_RASTER_FLAG_DIRECT" to preserve API. The speed gain + is about 5%. + + * src/smooth/ftgrays.c (gray_render_span): Removed. The code is + migrated to... + (gray_hline): ... here. + +2016-08-30 Alexei Podtelezhnikov + + [smooth] Streamline pixmap drawing a bit more. + + Zero coverage is unlikely (1 out of 256) to warrant checking. This + gives 0.5% speed improvement in rendering simple glyphs. + + * src/smooth/ftgrays.c (gray_hline, gray_render_span): Remove checks. + +2016-08-29 Alexei Podtelezhnikov + + [smooth] Streamline pixmap drawing. + + This gives 2% speed improvement in rendering simple glyphs. + + * src/smooth/ftgrays.c (TPixmap): Reduced pixmap descriptor with a + pointer to its bottom-left and pitch to be used in... + (gray_TWorker): ... here. + (gray_render_span): Move pixmap flow check from here... + (gray_raster_render): .. to here. + +2016-08-27 Alexei Podtelezhnikov + + [smooth] Reduce stack of band boundaries. + + * src/smooth/ftgrays.c (gray_TBand): Removed. + (gray_convert_glyph): Updated to stack band boundaries concisely. + +2016-08-26 Werner Lemberg + + * src/cid/cidload.c (cid_face_open): Improve handling of `SDBytes'. + +2016-08-26 Werner Lemberg + + [cid] Fix commit from 2016-05-16. + + * src/cid/cidparse.c (cid_parser_new): Fix off-by-one errors. + +2016-08-26 Werner Lemberg + + [sfnt] Cache offset and size to bitmap data table. + + This commit avoids `EBDT' and friends being looked up again and + again while loading a single embedded bitmap. + + * include/freetype/internal/tttypes.h (TT_FaceRec) + [TT_CONFIG_OPTION_EMBEDDED_BITMAPS]: New fields `ebdt_start' and + `ebdt_size'. + + * src/sfnt/ttsbit.c (tt_sbit_decoder_init): Move table lookup to ... + (tt_face_load_sbit): ... this function; also store the table size + and offset. + +2016-08-26 Alexei Podtelezhnikov + + * src/smooth/ftgrays.c (gray_raster_render): Minor tweaks. + +2016-08-26 Werner Lemberg + + [type1] Fix heap buffer overflow. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=36 + + * src/type1/t1load.c (parse_charstrings): Reject fonts that don't + contain glyph names. + +2016-08-25 Werner Lemberg + + [sfnt] Fix previous commit (#48901). + + * src/sfnt/ttcmap.c (tt_cmap4_char_map_binary): Thinkos. + +2016-08-25 Werner Lemberg + + [sfnt] Speed up handling of invalid format 4 cmaps. + + * src/sfnt/ttcmap.c (tt_cmap4_next, tt_cmap4_char_map_binary): Add + tests for `num_glyph' from `tt_cmap4_char_map_linear'. + +2016-08-25 Werner Lemberg + + * include/freetype/internal/ftdriver.h: Remove unused typedefs. + +2016-08-22 Alexei Podtelezhnikov + + [smooth] Simplify span rendering. + + This removes unnecessary complexity of span merging and buffering. + Instead, the spans are rendered as they come, speeding up the + rendering by about 5% as a result. + + * src/smooth/ftgrays.c [FT_MAX_GRAY_SPANS]: Macro removed. + (gray_TWorker): Remove span buffer and related fields. + (gray_sweep, gray_hline): Updated. + + * include/freetype/ftimage.h: Remove documentation note about + `FT_MAX_GRAY_SPANS', which was never in `ftoption.h' and is now gone. + +2016-08-16 Werner Lemberg + + [truetype] Fix `MPS' instruction. + + According to Greg Hitchcock, MPS in DWrite really returns the point + size. + + * src/truetype/ttobjs.h (TT_SizeRec): Add `point_size' member. + + * src/truetype/ttdriver.c (tt_size_request): Set `point_size'. + + * src/truetype/ttinterp.h (TT_ExecContextRec): Add `pointSize' + member. + + * src/truetype/ttinterp.c (TT_Load_Context): Updated. + (Ins_MPS): Fix instruction. + +2016-08-16 Werner Lemberg + + [lzw] Optimize last commit. + + * src/lzw/ftzopen.c (ft_lzwstate_get_code): Move check into + conditional clause. + +2016-08-16 Werner Lemberg + + [lzw] Avoid invalid left shift. + + Reported as + + https://bugzilla.mozilla.org/show_bug.cgi?id=1295366 + + * src/lzw/ftzopen.c (ft_lzwstate_get_code): Limit `num_bits'. + +2016-08-16 Werner Lemberg + + [lzw] Avoid buffer overrun. + + Reported as + + https://bugzilla.mozilla.org/show_bug.cgi?id=1273283 + + * src/lzw/ftzopen.c (ft_lzwstate_refill): Ensure `buf_size' doesn't + underflow. + +2016-08-16 Werner Lemberg + + [truetype] Fix compiler warning. + + * src/truetype/ttgload.c (load_truetype_glyph): Add cast. + +2016-08-13 Werner Lemberg + + [winfonts] Avoid zero bitmap width and height. + + Reported as + + https://bugzilla.mozilla.org/show_bug.cgi?id=1272173 + + * src/winfonts/winfnt.c (FNT_Face_Init): Check zero pixel height. + (FNT_Load_Glyph): Check for zero pitch. + +2016-08-11 Alexei Podtelezhnikov + + * src/truetype/ttinterp.c (Pop_Push_Count): Revert changes. + +2016-08-11 Alexei Podtelezhnikov + + * src/truetype/ttinterp.c (TT_RunIns): Minor and formatting. + +2016-08-11 Alexei Podtelezhnikov + + * src/truetype/ttinterp.c (Pop_Push_Count): Fix some entries. + +2016-08-10 Peter Klotz + + * src/smooth/ftgrays.c (gray_hline): Fix uninitialized access. + +2016-08-10 Werner Lemberg + + [sfnt] Use correct type for `italicAngle' field (#48732). + + * src/sfnt/ttload.c (tt_face_load_post): Fix types. + +2016-08-06 Jon Spencer + + [sfnt] Fix `FT_Get_Advance' for bitmap strikes. + + `FT_Get_Advance' returns 0 for bitmap fonts. It first gets the + advance value from the font table and then scales it by the + `font->size->metrics->x_scale' field. But `FT_Select_Size' doesn't + set that value for bitmap fonts and the advance gets scaled to zero. + + Taken from + + https://github.com/behdad/harfbuzz/issues/252 + + * src/sfnt/ttsbit.c (tt_face_load_strike_metrics) + : Set scale values. + +2016-08-06 Behdad Esfahbod + + [truetype] Fix GX variation handling of composites. + + * src/truetype/ttgload.c (load_truetype_glyph) + [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Check `ARGS_ARE_XY_VALUES' flag. + +2016-08-05 Alexei Podtelezhnikov + + [smooth] Minor refactoring. + + * src/smooth/ftgrays.c (gray_render_scanline, gray_render_line): + Updated. + +2016-07-29 Werner Lemberg + + [sfnt, truetype] Don't abort on invalid `maxComponentDepth'. + + Since 2016-05-16 we detect infinite recursion directly. + + * src/sfnt/ttload.c (tt_face_load_maxp): Don't adjust + `maxComponentDepth'. + * src/truetype/ttgload.c (load_truetype_glyph): Don't abort if + `maxComponentDepth' is not valid. Instead, simply adjust its value + and emit a tracing message. + +2016-07-26 Werner Lemberg + + * src/autofit/aflatin.c (af_latin_metrics_scale_dim): Minor. + + No functional change. + +2016-07-22 Hin-Tak Leung + + [truetype] Record the end of IDEFs. + + To match the logic in FDEF. The value of the end is only used for + bound-checking in `Ins_JMPR', so it may not have been obvious that + it was not recorded. Tested (as part of Font Validator 2.0) all the + fonts on Fedora and did not see any change. + + * src/truetype/ttinterp.c (Ins_IDEF): Updated. + +2016-07-19 Werner Lemberg + + [truetype] Sanitizer fix, second try. + + * src/truetype/ttgxvar.c (ft_var_readpackedpoints): Fix boundary + tests and use only one slot more. + +2016-07-19 Werner Lemberg + + [truetype] Sanitizer fix. + + * src/truetype/ttgxvar.c (ft_var_readpackedpoints): Increase array + to fix nested loops. + +2016-07-18 Werner Lemberg + + [truetype] Make GETDATA work only for GX fonts. + + * src/truetype/ttinterp.c (opcode_name): Updated. + (Ins_GETDATA): Only define for `TT_CONFIG_OPTION_GX_VAR_SUPPORT'. + (TT_RunIns): Updated. + +2016-07-17 Werner Lemberg + + [truetype] Add support for Apple's + + GETDATA[], opcode 0x92 + + bytecode instruction. It always returns 17, and we have absolutely + no idea what it is good for... + + * src/truetype/ttinterp.c (Pop_Push_Count, opcode_name): Updated. + (Ins_GETDATA): New function. + (TT_RunIns): Add it. + +2016-07-16 Werner Lemberg + + [truetype] Add bytecode support for GX variation fonts. + + This commit implements undocumented (but confirmed) stuff from + Apple's old bytecode engine. + + GETVARIATION[], opcode 0x91 + This opcode pushes normalized variation coordinates for all axes + onto the stack (in 2.14 format). Coordinate of first axis gets + pushed first. + + GETINFO[], selector bit 3 + If GX variation support is enabled, bit 10 of the result is set + to 1. + + * src/truetype/ttinterp.c: Include FT_MULTIPLE_MASTERS_H. + (opcode_name) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Updated. + (Ins_GETINFO) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Handle selector + bit 3, checking support for variation glyph hinting. + (Ins_GETVARIATION) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: New function + to implement opcode 0x91. + (TT_RunIns) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Handle opcode 0x91. + +2016-07-16 Werner Lemberg + + [truetype] Fix GETINFO bytecode instruction. + + * src/truetype/ttinterp.c (Ins_GETINFO): Fix return value for + stretching information. + +2016-07-16 Behdad Esfahbod + + [truetype] Make all glyphs in `Zycon' GX font work. + + * src/truetype/ttgxvar.c (ft_var_readpackedpoints): Fix boundary + tests. + +2016-07-16 Werner Lemberg + + [truetype] Fix GX delta tracing. + + * src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Trace + relative point movements. + +2016-07-16 Behdad Esfahbod + + [truetype] More fixes for GX. + + This finally fixes the rendering of the cyclist and the lizard in + the `Zycon' font. + + * src/truetype/ttgxvar.c (ft_var_readpackedpoints): `first' point + index is always cumulative. + + (tt_handle_deltas): Rename to... + (tt_interpolate_deltas): ... This. + Add new parameter for output point array. + Update caller. + + (TT_Vary_Apply_Glyph_Deltas): Add `points_out' array; it now holds + the intermediate results of `tt_interpolate_deltas' that are to be + added to `outline->points'. + +2016-07-15 Werner Lemberg + + * src/autofit/aflatin.c (af_latin_hints_compute_segments): Thinko. + + `max_pos' is always larger than `min_pos' so `FT_ABS' is not needed. + + Reported by Alexei. + +2016-07-16 Nikolaus Waxweiler + + * src/truetype/ttinterp.c (Ins_MIRP): Fix copy-and-paste error. + + Problem reported by Hin-Tak Leung. + +2016-07-15 Werner Lemberg + + [autofit] Update and improve segment and edge tracing. + + * src/autofit/afhints.c (af_glyph_hints_dump_segments): Trace + `delta' also. + Don't show first point of segment as a replacement for `pos'; this + is (a) misleading, since the difference to `pos' can be almost + arbitrarily large in corner cases, and (b) it is better to have all + segment data in font units instead of a single value given in output + space coordinates. + Improve layout. + (af_glyph_hints_dump_edges): Show px->units and units->px conversion + values for convenience. + Improve layout. + +2016-07-15 Werner Lemberg + + [autofit] For edges, reject segments wider than 1px (#41334). + + * src/autofit/afhints.h (AF_SegmentRec): New member `delta'. + + * src/autofit/aflatin.c (af_latin_hints_compute_segments): Compute + `delta'. + (af_latin_hints_compute_edges): Reject segments with a delta larger + than 0.5px. + +2016-07-14 Werner Lemberg + + * include/freetype/freetype.h (FT_IS_NAMED_INSTANCE): New macro. + +2016-07-14 Werner Lemberg + + [sfnt] Fix `face_index' value in `FT_Face' for named instances. + + * src/sfnt/sfobjs.c (sfnt_init_face): Don't strip off higher 16bits. + +2016-07-14 Werner Lemberg + + * src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Fix tracing. + +2016-07-14 Behdad Esfahbod + + [truetype] Fix gxvar delta interpolation. + + The coordinates of the base font should be used for interpolation + purposes, NOT the current points (i.e., the result of accumulation + of previous deltas). + + * src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Initialize + `points_org' before looping over all tuples. + + +---------------------------------------------------------------------------- + +Copyright 2016-2017 by +David Turner, Robert Wilhelm, and Werner Lemberg. + +This file is part of the FreeType project, and may only be used, modified, +and distributed under the terms of the FreeType project license, +LICENSE.TXT. By continuing to use, modify, or distribute this file you +indicate that you have read the license and understand and accept it +fully. + + +Local Variables: +version-control: never +coding: utf-8 +End: From 02e80da6090c21d6e59ac955b7f56e1ad4a9850b Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Sun, 24 Sep 2017 22:18:34 -0400 Subject: [PATCH 246/470] Tweak per-face LCD filtering controls. Thing are simpler with a NULL-function pointer. * include/freetype/internal/ftobjs.h (FT_Face_InternalRec): New pointer to the filter function. (FT_LibraryRec): Remove unused `lcd_filter'. (FT_Bitmap_LcdFilterFunc, ft_lcd_filter_fir): Move from here... * include/freetype/ftlcdfil.h (FT_Bitmap_LcdFilterFunc, ft_lcd_filter_fir): ... to here. * src/base/ftobjs.c (ft_open_face_internal): NULL-initialize the per-face filter. (FT_Face_Properties): Set it. * src/smooth/ftsmooth.c (ft_smooth_render_generic): Simplify. * src/base/ftlcdfil.c (ft_lcd_filter_fir, FT_Libary_SetLcdFilter): Minor. --- ChangeLog | 23 ++++++++++++- include/freetype/ftlcdfil.h | 11 +++++++ include/freetype/internal/ftobjs.h | 27 ++++------------ src/base/ftlcdfil.c | 4 +-- src/base/ftobjs.c | 12 +++---- src/smooth/ftsmooth.c | 52 ++++++------------------------ 6 files changed, 54 insertions(+), 75 deletions(-) diff --git a/ChangeLog b/ChangeLog index 47811d18c..d42f98685 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,24 @@ +2017-09-24 Alexei Podtelezhnikov + + Tweak per-face LCD filtering controls. + + Thing are simpler with a NULL-function pointer. + + * include/freetype/internal/ftobjs.h (FT_Face_InternalRec): New + pointer to the filter function. + (FT_LibraryRec): Remove unused `lcd_filter'. + (FT_Bitmap_LcdFilterFunc, ft_lcd_filter_fir): Move from here... + * include/freetype/ftlcdfil.h (FT_Bitmap_LcdFilterFunc, + ft_lcd_filter_fir): ... to here. + + * src/base/ftobjs.c (ft_open_face_internal): NULL-initialize the + per-face filter. + (FT_Face_Properties): Set it. + * src/smooth/ftsmooth.c (ft_smooth_render_generic): Simplify. + + * src/base/ftlcdfil.c (ft_lcd_filter_fir, FT_Libary_SetLcdFilter): + Minor. + 2017-09-24 Jonathan Kew [sfnt] Fix `premultiply_data' (#52092). @@ -32,7 +53,7 @@ VariationIndex subtable. (otv_Lookup_validate): Handle MarkFilteringSet. -2017-09-21 Alexei Podtelezhnikov +2017-09-23 Alexei Podtelezhnikov [build] Windows-style DLL versioning. diff --git a/include/freetype/ftlcdfil.h b/include/freetype/ftlcdfil.h index ea4a66e69..8c751418f 100644 --- a/include/freetype/ftlcdfil.h +++ b/include/freetype/ftlcdfil.h @@ -316,6 +316,17 @@ FT_BEGIN_HEADER typedef FT_Byte FT_LcdFiveTapFilter[FT_LCD_FILTER_FIVE_TAPS]; + typedef void (*FT_Bitmap_LcdFilterFunc)( FT_Bitmap* bitmap, + FT_Render_Mode render_mode, + FT_Byte* weights ); + + + /* This is the default LCD filter, an in-place, 5-tap FIR filter. */ + FT_BASE( void ) + ft_lcd_filter_fir( FT_Bitmap* bitmap, + FT_Render_Mode mode, + FT_LcdFiveTapFilter weights ); + /* */ diff --git a/include/freetype/internal/ftobjs.h b/include/freetype/internal/ftobjs.h index 4231be238..25c328f4f 100644 --- a/include/freetype/internal/ftobjs.h +++ b/include/freetype/internal/ftobjs.h @@ -369,9 +369,10 @@ FT_BEGIN_HEADER /* operator. Value~0 means to use the font's value. Value~-1 */ /* means to use the CFF driver's default. */ /* */ - /* lcd_weights :: */ - /* Overrides the library default with custom weights for the 5-tap */ - /* FIR filter. `{0, 0, 0, 0, 0}' means to use the library default. */ + /* lcd_weights :: */ + /* lcd_filter_func :: */ + /* If subpixel rendering is activated, the LCD filtering weights */ + /* and callback function. */ /* */ /* refcount :: */ /* A counter initialized to~1 at the time an @FT_Face structure is */ @@ -393,8 +394,10 @@ FT_BEGIN_HEADER FT_Char no_stem_darkening; FT_Int32 random_seed; + #ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING - FT_LcdFiveTapFilter lcd_weights; /* preset or custom filter weights */ + FT_LcdFiveTapFilter lcd_weights; /* filter weights, if any */ + FT_Bitmap_LcdFilterFunc lcd_filter_func; /* filtering callback */ #endif FT_Int refcount; @@ -821,18 +824,6 @@ FT_BEGIN_HEADER #define FT_DEBUG_HOOK_TRUETYPE 0 - typedef void (*FT_Bitmap_LcdFilterFunc)( FT_Bitmap* bitmap, - FT_Render_Mode render_mode, - FT_Byte* weights ); - - - /* This is the default LCD filter, an in-place, 5-tap FIR filter. */ - FT_BASE( void ) - ft_lcd_filter_fir( FT_Bitmap* bitmap, - FT_Render_Mode mode, - FT_LcdFiveTapFilter weights ); - - /*************************************************************************/ /* */ /* */ @@ -878,9 +869,6 @@ FT_BEGIN_HEADER /* interpreter. Currently, only the TrueType */ /* bytecode debugger uses this. */ /* */ - /* lcd_filter :: If subpixel rendering is activated, the */ - /* selected LCD filter mode. */ - /* */ /* lcd_weights :: If subpixel rendering is activated, the LCD */ /* filter weights, if any. */ /* */ @@ -915,7 +903,6 @@ FT_BEGIN_HEADER FT_DebugHook_Func debug_hooks[4]; #ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING - FT_LcdFilter lcd_filter; FT_LcdFiveTapFilter lcd_weights; /* filter weights, if any */ FT_Bitmap_LcdFilterFunc lcd_filter_func; /* filtering callback */ #endif diff --git a/src/base/ftlcdfil.c b/src/base/ftlcdfil.c index 60c813fd9..ca781f324 100644 --- a/src/base/ftlcdfil.c +++ b/src/base/ftlcdfil.c @@ -32,7 +32,7 @@ #define FT_SHIFTCLAMP( x ) ( x >>= 8, (FT_Byte)( x > 255 ? 255 : x ) ) /* FIR filter used by the default and light filters */ - FT_BASE( void ) + FT_BASE_DEF( void ) ft_lcd_filter_fir( FT_Bitmap* bitmap, FT_Render_Mode mode, FT_LcdFiveTapFilter weights ) @@ -305,8 +305,6 @@ return FT_THROW( Invalid_Argument ); } - library->lcd_filter = filter; - return FT_Err_Ok; } diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c index 6db8136cf..aedb1f33d 100644 --- a/src/base/ftobjs.c +++ b/src/base/ftobjs.c @@ -2441,7 +2441,8 @@ internal->no_stem_darkening = -1; #ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING - ft_memset( internal->lcd_weights, 0, FT_LCD_FILTER_FIVE_TAPS ); + /* Per-face filtering can only be set up by FT_Face_Properties */ + internal->lcd_filter_func = NULL; #endif } @@ -3653,16 +3654,11 @@ { #ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING if ( properties->data ) + { ft_memcpy( face->internal->lcd_weights, properties->data, FT_LCD_FILTER_FIVE_TAPS ); - else - { - /* Value NULL indicates `no custom weights, use library */ - /* defaults', signaled by filling the weight field with zeros. */ - ft_memset( face->internal->lcd_weights, - 0, - FT_LCD_FILTER_FIVE_TAPS ); + face->internal->lcd_filter_func = ft_lcd_filter_fir; } #else error = FT_THROW( Unimplemented_Feature ); diff --git a/src/smooth/ftsmooth.c b/src/smooth/ftsmooth.c index 963435de1..99a9883d2 100644 --- a/src/smooth/ftsmooth.c +++ b/src/smooth/ftsmooth.c @@ -115,56 +115,22 @@ FT_Bool have_buffer = FALSE; #ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING + FT_Byte* lcd_weights; + FT_Bitmap_LcdFilterFunc lcd_filter_func; - FT_LcdFiveTapFilter lcd_weights = { 0 }; - FT_Bool have_custom_weight = FALSE; - FT_Bitmap_LcdFilterFunc lcd_filter_func = NULL; - - if ( slot->face ) + /* Per-face LCD filtering takes priority if set up. */ + if ( slot->face && slot->face->internal->lcd_filter_func ) { - FT_Char i; - - - for ( i = 0; i < FT_LCD_FILTER_FIVE_TAPS; i++ ) - if ( slot->face->internal->lcd_weights[i] != 0 ) - { - have_custom_weight = TRUE; - break; - } - } - - /* - * The LCD filter can be set library-wide and per-face. Face overrides - * library. If the face filter weights are all zero (the default), it - * means that the library default should be used. - */ - if ( have_custom_weight ) - { - /* - * A per-font filter is set. It always uses the default 5-tap - * in-place FIR filter. - */ - ft_memcpy( lcd_weights, - slot->face->internal->lcd_weights, - FT_LCD_FILTER_FIVE_TAPS ); - lcd_filter_func = ft_lcd_filter_fir; + lcd_weights = slot->face->internal->lcd_weights; + lcd_filter_func = slot->face->internal->lcd_filter_func; } else { - /* - * The face's lcd_weights is {0, 0, 0, 0, 0}, meaning `use library - * default'. If the library is set to use no LCD filtering - * (lcd_filter_func == NULL), `lcd_filter_func' here is also set to - * NULL and the tests further below pass over the filtering process. - */ - ft_memcpy( lcd_weights, - slot->library->lcd_weights, - FT_LCD_FILTER_FIVE_TAPS ); + lcd_weights = slot->library->lcd_weights; lcd_filter_func = slot->library->lcd_filter_func; } - -#endif /*FT_CONFIG_OPTION_SUBPIXEL_RENDERING */ +#endif /* FT_CONFIG_OPTION_SUBPIXEL_RENDERING */ /* check glyph image format */ if ( slot->format != render->glyph_format ) @@ -208,7 +174,7 @@ #else /* FT_CONFIG_OPTION_SUBPIXEL_RENDERING */ /* add minimal padding for LCD filter depending on specific weights */ - if ( lcd_filter_func ) + if ( lcd_filter_func == ft_lcd_filter_fir ) { if ( hmul ) { From 62f095f046f809f924b15c86c055c4b20f406541 Mon Sep 17 00:00:00 2001 From: Ewald Hew Date: Mon, 25 Sep 2017 09:25:55 +0200 Subject: [PATCH 247/470] [psaux, cff] Move Adobe's engine components into `psaux' module. This is the first patch of a sequence to move the Type 2 charstring processing capability from the `cff' module to the `psaux' module. NOTE: Does not compile! * src/cff/cf2*: Move these files to... * src/psaux/cf2*: Here. * src/cff/Jamfile (_sources), src/cff/rules.mk (CFF_DRV_SRC, CFF_DRV_H), src/cff/cff.c, src/cff/cffgload.c: Remove file references. * src/psaux/Jamfile (_sources), src/psaux/rules.mk, src/psaux/psaux.c (PSAUX_DRV_SRC, PSAUX_DRV_H): Add file references. --- ChangeLog | 19 +++++++++++++++++++ src/cff/Jamfile | 9 --------- src/cff/cff.c | 11 ----------- src/cff/cffgload.c | 1 - src/cff/rules.mk | 16 ++-------------- src/psaux/Jamfile | 9 +++++++++ src/{cff => psaux}/cf2arrst.c | 0 src/{cff => psaux}/cf2arrst.h | 0 src/{cff => psaux}/cf2blues.c | 0 src/{cff => psaux}/cf2blues.h | 0 src/{cff => psaux}/cf2error.c | 0 src/{cff => psaux}/cf2error.h | 0 src/{cff => psaux}/cf2fixed.h | 0 src/{cff => psaux}/cf2font.c | 0 src/{cff => psaux}/cf2font.h | 0 src/{cff => psaux}/cf2ft.c | 0 src/{cff => psaux}/cf2ft.h | 0 src/{cff => psaux}/cf2glue.h | 0 src/{cff => psaux}/cf2hints.c | 0 src/{cff => psaux}/cf2hints.h | 0 src/{cff => psaux}/cf2intrp.c | 0 src/{cff => psaux}/cf2intrp.h | 0 src/{cff => psaux}/cf2read.c | 0 src/{cff => psaux}/cf2read.h | 0 src/{cff => psaux}/cf2stack.c | 0 src/{cff => psaux}/cf2stack.h | 0 src/{cff => psaux}/cf2types.h | 0 src/psaux/psaux.c | 10 ++++++++++ src/psaux/rules.mk | 16 ++++++++++++++-- 29 files changed, 54 insertions(+), 37 deletions(-) rename src/{cff => psaux}/cf2arrst.c (100%) rename src/{cff => psaux}/cf2arrst.h (100%) rename src/{cff => psaux}/cf2blues.c (100%) rename src/{cff => psaux}/cf2blues.h (100%) rename src/{cff => psaux}/cf2error.c (100%) rename src/{cff => psaux}/cf2error.h (100%) rename src/{cff => psaux}/cf2fixed.h (100%) rename src/{cff => psaux}/cf2font.c (100%) rename src/{cff => psaux}/cf2font.h (100%) rename src/{cff => psaux}/cf2ft.c (100%) rename src/{cff => psaux}/cf2ft.h (100%) rename src/{cff => psaux}/cf2glue.h (100%) rename src/{cff => psaux}/cf2hints.c (100%) rename src/{cff => psaux}/cf2hints.h (100%) rename src/{cff => psaux}/cf2intrp.c (100%) rename src/{cff => psaux}/cf2intrp.h (100%) rename src/{cff => psaux}/cf2read.c (100%) rename src/{cff => psaux}/cf2read.h (100%) rename src/{cff => psaux}/cf2stack.c (100%) rename src/{cff => psaux}/cf2stack.h (100%) rename src/{cff => psaux}/cf2types.h (100%) diff --git a/ChangeLog b/ChangeLog index d42f98685..a87949680 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,22 @@ +2017-09-24 Ewald Hew + + [psaux, cff] Move Adobe's engine components into `psaux' module. + + This is the first patch of a sequence to move the Type 2 charstring + processing capability from the `cff' module to the `psaux' module. + + NOTE: Does not compile! + + * src/cff/cf2*: Move these files to... + * src/psaux/cf2*: Here. + + * src/cff/Jamfile (_sources), src/cff/rules.mk (CFF_DRV_SRC, + CFF_DRV_H), src/cff/cff.c, src/cff/cffgload.c: Remove file + references. + + * src/psaux/Jamfile (_sources), src/psaux/rules.mk, src/psaux/psaux.c + (PSAUX_DRV_SRC, PSAUX_DRV_H): Add file references. + 2017-09-24 Alexei Podtelezhnikov Tweak per-face LCD filtering controls. diff --git a/src/cff/Jamfile b/src/cff/Jamfile index e6dd05fc1..f665a0b25 100644 --- a/src/cff/Jamfile +++ b/src/cff/Jamfile @@ -23,15 +23,6 @@ SubDir FT2_TOP $(FT2_SRC_DIR) cff ; cffobjs cffparse cffpic - cf2arrst - cf2blues - cf2error - cf2font - cf2ft - cf2hints - cf2intrp - cf2read - cf2stack ; } else diff --git a/src/cff/cff.c b/src/cff/cff.c index 397f6dfaf..e9b3264b8 100644 --- a/src/cff/cff.c +++ b/src/cff/cff.c @@ -27,15 +27,4 @@ #include "cffload.c" #include "cffobjs.c" -#include "cf2arrst.c" -#include "cf2blues.c" -#include "cf2error.c" -#include "cf2font.c" -#include "cf2ft.c" -#include "cf2hints.c" -#include "cf2intrp.c" -#include "cf2read.c" -#include "cf2stack.c" - - /* END */ diff --git a/src/cff/cffgload.c b/src/cff/cffgload.c index 20f3a2c28..9200d20cf 100644 --- a/src/cff/cffgload.c +++ b/src/cff/cffgload.c @@ -27,7 +27,6 @@ #include "cffobjs.h" #include "cffload.h" #include "cffgload.h" -#include "cf2ft.h" /* for cf2_decoder_parse_charstrings */ #include "cfferrs.h" diff --git a/src/cff/rules.mk b/src/cff/rules.mk index 86840bfe3..feecf4611 100644 --- a/src/cff/rules.mk +++ b/src/cff/rules.mk @@ -32,16 +32,7 @@ CFF_DRV_SRC := $(CFF_DIR)/cffcmap.c \ $(CFF_DIR)/cffload.c \ $(CFF_DIR)/cffobjs.c \ $(CFF_DIR)/cffparse.c \ - $(CFF_DIR)/cffpic.c \ - $(CFF_DIR)/cf2arrst.c \ - $(CFF_DIR)/cf2blues.c \ - $(CFF_DIR)/cf2error.c \ - $(CFF_DIR)/cf2font.c \ - $(CFF_DIR)/cf2ft.c \ - $(CFF_DIR)/cf2hints.c \ - $(CFF_DIR)/cf2intrp.c \ - $(CFF_DIR)/cf2read.c \ - $(CFF_DIR)/cf2stack.c + $(CFF_DIR)/cffpic.c # CFF driver headers @@ -49,10 +40,7 @@ CFF_DRV_SRC := $(CFF_DIR)/cffcmap.c \ CFF_DRV_H := $(CFF_DRV_SRC:%.c=%.h) \ $(CFF_DIR)/cfferrs.h \ $(CFF_DIR)/cfftoken.h \ - $(CFF_DIR)/cfftypes.h \ - $(CFF_DIR)/cf2fixed.h \ - $(CFF_DIR)/cf2glue.h \ - $(CFF_DIR)/cf2types.h + $(CFF_DIR)/cfftypes.h # CFF driver object(s) diff --git a/src/psaux/Jamfile b/src/psaux/Jamfile index 798b73d1c..8ca518959 100644 --- a/src/psaux/Jamfile +++ b/src/psaux/Jamfile @@ -22,6 +22,15 @@ SubDir FT2_TOP $(FT2_SRC_DIR) psaux ; psobjs t1cmap t1decode + cf2arrst + cf2blues + cf2error + cf2font + cf2ft + cf2hints + cf2intrp + cf2read + cf2stack ; } else diff --git a/src/cff/cf2arrst.c b/src/psaux/cf2arrst.c similarity index 100% rename from src/cff/cf2arrst.c rename to src/psaux/cf2arrst.c diff --git a/src/cff/cf2arrst.h b/src/psaux/cf2arrst.h similarity index 100% rename from src/cff/cf2arrst.h rename to src/psaux/cf2arrst.h diff --git a/src/cff/cf2blues.c b/src/psaux/cf2blues.c similarity index 100% rename from src/cff/cf2blues.c rename to src/psaux/cf2blues.c diff --git a/src/cff/cf2blues.h b/src/psaux/cf2blues.h similarity index 100% rename from src/cff/cf2blues.h rename to src/psaux/cf2blues.h diff --git a/src/cff/cf2error.c b/src/psaux/cf2error.c similarity index 100% rename from src/cff/cf2error.c rename to src/psaux/cf2error.c diff --git a/src/cff/cf2error.h b/src/psaux/cf2error.h similarity index 100% rename from src/cff/cf2error.h rename to src/psaux/cf2error.h diff --git a/src/cff/cf2fixed.h b/src/psaux/cf2fixed.h similarity index 100% rename from src/cff/cf2fixed.h rename to src/psaux/cf2fixed.h diff --git a/src/cff/cf2font.c b/src/psaux/cf2font.c similarity index 100% rename from src/cff/cf2font.c rename to src/psaux/cf2font.c diff --git a/src/cff/cf2font.h b/src/psaux/cf2font.h similarity index 100% rename from src/cff/cf2font.h rename to src/psaux/cf2font.h diff --git a/src/cff/cf2ft.c b/src/psaux/cf2ft.c similarity index 100% rename from src/cff/cf2ft.c rename to src/psaux/cf2ft.c diff --git a/src/cff/cf2ft.h b/src/psaux/cf2ft.h similarity index 100% rename from src/cff/cf2ft.h rename to src/psaux/cf2ft.h diff --git a/src/cff/cf2glue.h b/src/psaux/cf2glue.h similarity index 100% rename from src/cff/cf2glue.h rename to src/psaux/cf2glue.h diff --git a/src/cff/cf2hints.c b/src/psaux/cf2hints.c similarity index 100% rename from src/cff/cf2hints.c rename to src/psaux/cf2hints.c diff --git a/src/cff/cf2hints.h b/src/psaux/cf2hints.h similarity index 100% rename from src/cff/cf2hints.h rename to src/psaux/cf2hints.h diff --git a/src/cff/cf2intrp.c b/src/psaux/cf2intrp.c similarity index 100% rename from src/cff/cf2intrp.c rename to src/psaux/cf2intrp.c diff --git a/src/cff/cf2intrp.h b/src/psaux/cf2intrp.h similarity index 100% rename from src/cff/cf2intrp.h rename to src/psaux/cf2intrp.h diff --git a/src/cff/cf2read.c b/src/psaux/cf2read.c similarity index 100% rename from src/cff/cf2read.c rename to src/psaux/cf2read.c diff --git a/src/cff/cf2read.h b/src/psaux/cf2read.h similarity index 100% rename from src/cff/cf2read.h rename to src/psaux/cf2read.h diff --git a/src/cff/cf2stack.c b/src/psaux/cf2stack.c similarity index 100% rename from src/cff/cf2stack.c rename to src/psaux/cf2stack.c diff --git a/src/cff/cf2stack.h b/src/psaux/cf2stack.h similarity index 100% rename from src/cff/cf2stack.h rename to src/psaux/cf2stack.h diff --git a/src/cff/cf2types.h b/src/psaux/cf2types.h similarity index 100% rename from src/cff/cf2types.h rename to src/psaux/cf2types.h diff --git a/src/psaux/psaux.c b/src/psaux/psaux.c index c373aa7d5..2d301252f 100644 --- a/src/psaux/psaux.c +++ b/src/psaux/psaux.c @@ -26,5 +26,15 @@ #include "t1cmap.c" #include "t1decode.c" +#include "cf2arrst.c" +#include "cf2blues.c" +#include "cf2error.c" +#include "cf2font.c" +#include "cf2ft.c" +#include "cf2hints.c" +#include "cf2intrp.c" +#include "cf2read.c" +#include "cf2stack.c" + /* END */ diff --git a/src/psaux/rules.mk b/src/psaux/rules.mk index 542ae12d2..5658811db 100644 --- a/src/psaux/rules.mk +++ b/src/psaux/rules.mk @@ -33,12 +33,24 @@ PSAUX_DRV_SRC := $(PSAUX_DIR)/psobjs.c \ $(PSAUX_DIR)/t1cmap.c \ $(PSAUX_DIR)/afmparse.c \ $(PSAUX_DIR)/psconv.c \ - $(PSAUX_DIR)/psauxmod.c + $(PSAUX_DIR)/psauxmod.c \ + $(PSAUX_DIR)/cf2arrst.c \ + $(PSAUX_DIR)/cf2blues.c \ + $(PSAUX_DIR)/cf2error.c \ + $(PSAUX_DIR)/cf2font.c \ + $(PSAUX_DIR)/cf2ft.c \ + $(PSAUX_DIR)/cf2hints.c \ + $(PSAUX_DIR)/cf2intrp.c \ + $(PSAUX_DIR)/cf2read.c \ + $(PSAUX_DIR)/cf2stack.c # PSAUX driver headers # PSAUX_DRV_H := $(PSAUX_DRV_SRC:%c=%h) \ - $(PSAUX_DIR)/psauxerr.h + $(PSAUX_DIR)/psauxerr.h \ + $(PSAUX_DIR)/cf2fixed.h \ + $(PSAUX_DIR)/cf2glue.h \ + $(PSAUX_DIR)/cf2types.h # PSAUX driver object(s) From 705bbe7c7b894a3f3077ea6489943b772fb0f65c Mon Sep 17 00:00:00 2001 From: Ewald Hew Date: Sun, 24 Sep 2017 21:39:20 +0200 Subject: [PATCH 248/470] Move CFF decoder components into `psaux' module. NOTE: Does not compile! * src/cff/cffgload.c (CFF_Operator, CFF_COUNT_{CHECK_WIDTH,EXACT,CLEAR_STACK}, cff_argument_counts, cff_operator_seac, cff_compute_bias, cff_lookup_glyph_by_stdcharcode, cff_decoder_{parse_charstrings,init,prepare}): Move to... * src/psaux/cffdecode.c: This new file. * src/cff/cffgload.h: Move corresponding declarations to... * src/psaux/cffdecode.h: This new file. * src/cff/cffgload.h (CFF_MAX_{OPERANDS,SUBRS_CALLS,TRANS_ELEMENTS}, CFF_Decoder_Zone, CFF_Decoder): Move declarations to... * include/freetype/internal/psaux.h: Here. * src/psaux/cf2ft.h: Update include. * src/psaux/psaux.c, src/psaux/rules.mk (PSAUX_DRV_SRC): Update with the new file. --- ChangeLog | 25 + include/freetype/internal/psaux.h | 70 + src/cff/cffgload.c | 2285 ---------------------------- src/cff/cffgload.h | 87 -- src/psaux/cf2ft.h | 2 +- src/psaux/cffdecode.c | 2311 +++++++++++++++++++++++++++++ src/psaux/cffdecode.h | 44 + src/psaux/psaux.c | 1 + src/psaux/rules.mk | 3 +- 9 files changed, 2454 insertions(+), 2374 deletions(-) create mode 100644 src/psaux/cffdecode.c create mode 100644 src/psaux/cffdecode.h diff --git a/ChangeLog b/ChangeLog index a87949680..a8df01134 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,28 @@ +2017-09-24 Ewald Hew + + [psaux, cff] Move CFF decoder components into `psaux' module. + + NOTE: Does not compile! + + * src/cff/cffgload.c (CFF_Operator, + CFF_COUNT_{CHECK_WIDTH,EXACT,CLEAR_STACK}, cff_argument_counts, + cff_operator_seac, cff_compute_bias, + cff_lookup_glyph_by_stdcharcode, + cff_decoder_{parse_charstrings,init,prepare}): Move to... + * src/psaux/cffdecode.c: This new file. + + * src/cff/cffgload.h: Move corresponding declarations to... + * src/psaux/cffdecode.h: This new file. + + * src/cff/cffgload.h (CFF_MAX_{OPERANDS,SUBRS_CALLS,TRANS_ELEMENTS}, + CFF_Decoder_Zone, CFF_Decoder): Move declarations to... + * include/freetype/internal/psaux.h: Here. + + * src/psaux/cf2ft.h: Update include. + + * src/psaux/psaux.c, src/psaux/rules.mk (PSAUX_DRV_SRC): Update with + the new file. + 2017-09-24 Ewald Hew [psaux, cff] Move Adobe's engine components into `psaux' module. diff --git a/include/freetype/internal/psaux.h b/include/freetype/internal/psaux.h index 935eb1a9c..b1effeed8 100644 --- a/include/freetype/internal/psaux.h +++ b/include/freetype/internal/psaux.h @@ -702,6 +702,76 @@ FT_BEGIN_HEADER } T1_DecoderRec; + /*************************************************************************/ + /***** *****/ + /***** CFF DECODER *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + +#define CFF_MAX_OPERANDS 48 +#define CFF_MAX_SUBRS_CALLS 16 /* maximum subroutine nesting; */ + /* only 10 are allowed but there exist */ + /* fonts like `HiraKakuProN-W3.ttf' */ + /* (Hiragino Kaku Gothic ProN W3; */ + /* 8.2d6e1; 2014-12-19) that exceed */ + /* this limit */ +#define CFF_MAX_TRANS_ELEMENTS 32 + + /* execution context charstring zone */ + + typedef struct CFF_Decoder_Zone_ + { + FT_Byte* base; + FT_Byte* limit; + FT_Byte* cursor; + + } CFF_Decoder_Zone; + + + typedef struct CFF_Decoder_ + { + CFF_Builder builder; + CFF_Font cff; + + FT_Fixed stack[CFF_MAX_OPERANDS + 1]; + FT_Fixed* top; + + CFF_Decoder_Zone zones[CFF_MAX_SUBRS_CALLS + 1]; + CFF_Decoder_Zone* zone; + + FT_Int flex_state; + FT_Int num_flex_vectors; + FT_Vector flex_vectors[7]; + + FT_Pos glyph_width; + FT_Pos nominal_width; + + FT_Bool read_width; + FT_Bool width_only; + FT_Int num_hints; + FT_Fixed buildchar[CFF_MAX_TRANS_ELEMENTS]; + + FT_UInt num_locals; + FT_UInt num_globals; + + FT_Int locals_bias; + FT_Int globals_bias; + + FT_Byte** locals; + FT_Byte** globals; + + FT_Byte** glyph_names; /* for pure CFF fonts only */ + FT_UInt num_glyphs; /* number of glyphs in font */ + + FT_Render_Mode hint_mode; + + FT_Bool seac; + + CFF_SubFont current_subfont; /* for current glyph_index */ + + } CFF_Decoder; + /*************************************************************************/ /*************************************************************************/ diff --git a/src/cff/cffgload.c b/src/cff/cffgload.c index 9200d20cf..de8c83774 100644 --- a/src/cff/cffgload.c +++ b/src/cff/cffgload.c @@ -41,179 +41,6 @@ #define FT_COMPONENT trace_cffgload -#ifdef CFF_CONFIG_OPTION_OLD_ENGINE - - typedef enum CFF_Operator_ - { - cff_op_unknown = 0, - - cff_op_rmoveto, - cff_op_hmoveto, - cff_op_vmoveto, - - cff_op_rlineto, - cff_op_hlineto, - cff_op_vlineto, - - cff_op_rrcurveto, - cff_op_hhcurveto, - cff_op_hvcurveto, - cff_op_rcurveline, - cff_op_rlinecurve, - cff_op_vhcurveto, - cff_op_vvcurveto, - - cff_op_flex, - cff_op_hflex, - cff_op_hflex1, - cff_op_flex1, - - cff_op_endchar, - - cff_op_hstem, - cff_op_vstem, - cff_op_hstemhm, - cff_op_vstemhm, - - cff_op_hintmask, - cff_op_cntrmask, - cff_op_dotsection, /* deprecated, acts as no-op */ - - cff_op_abs, - cff_op_add, - cff_op_sub, - cff_op_div, - cff_op_neg, - cff_op_random, - cff_op_mul, - cff_op_sqrt, - - cff_op_blend, - - cff_op_drop, - cff_op_exch, - cff_op_index, - cff_op_roll, - cff_op_dup, - - cff_op_put, - cff_op_get, - cff_op_store, - cff_op_load, - - cff_op_and, - cff_op_or, - cff_op_not, - cff_op_eq, - cff_op_ifelse, - - cff_op_callsubr, - cff_op_callgsubr, - cff_op_return, - - /* Type 1 opcodes: invalid but seen in real life */ - cff_op_hsbw, - cff_op_closepath, - cff_op_callothersubr, - cff_op_pop, - cff_op_seac, - cff_op_sbw, - cff_op_setcurrentpoint, - - /* do not remove */ - cff_op_max - - } CFF_Operator; - - -#define CFF_COUNT_CHECK_WIDTH 0x80 -#define CFF_COUNT_EXACT 0x40 -#define CFF_COUNT_CLEAR_STACK 0x20 - - /* count values which have the `CFF_COUNT_CHECK_WIDTH' flag set are */ - /* used for checking the width and requested numbers of arguments */ - /* only; they are set to zero afterwards */ - - /* the other two flags are informative only and unused currently */ - - static const FT_Byte cff_argument_counts[] = - { - 0, /* unknown */ - - 2 | CFF_COUNT_CHECK_WIDTH | CFF_COUNT_EXACT, /* rmoveto */ - 1 | CFF_COUNT_CHECK_WIDTH | CFF_COUNT_EXACT, - 1 | CFF_COUNT_CHECK_WIDTH | CFF_COUNT_EXACT, - - 0 | CFF_COUNT_CLEAR_STACK, /* rlineto */ - 0 | CFF_COUNT_CLEAR_STACK, - 0 | CFF_COUNT_CLEAR_STACK, - - 0 | CFF_COUNT_CLEAR_STACK, /* rrcurveto */ - 0 | CFF_COUNT_CLEAR_STACK, - 0 | CFF_COUNT_CLEAR_STACK, - 0 | CFF_COUNT_CLEAR_STACK, - 0 | CFF_COUNT_CLEAR_STACK, - 0 | CFF_COUNT_CLEAR_STACK, - 0 | CFF_COUNT_CLEAR_STACK, - - 13, /* flex */ - 7, - 9, - 11, - - 0 | CFF_COUNT_CHECK_WIDTH, /* endchar */ - - 2 | CFF_COUNT_CHECK_WIDTH, /* hstem */ - 2 | CFF_COUNT_CHECK_WIDTH, - 2 | CFF_COUNT_CHECK_WIDTH, - 2 | CFF_COUNT_CHECK_WIDTH, - - 0 | CFF_COUNT_CHECK_WIDTH, /* hintmask */ - 0 | CFF_COUNT_CHECK_WIDTH, /* cntrmask */ - 0, /* dotsection */ - - 1, /* abs */ - 2, - 2, - 2, - 1, - 0, - 2, - 1, - - 1, /* blend */ - - 1, /* drop */ - 2, - 1, - 2, - 1, - - 2, /* put */ - 1, - 4, - 3, - - 2, /* and */ - 2, - 1, - 2, - 4, - - 1, /* callsubr */ - 1, - 0, - - 2, /* hsbw */ - 0, - 0, - 0, - 5, /* seac */ - 4, /* sbw */ - 2 /* setcurrentpoint */ - }; - -#endif /* CFF_CONFIG_OPTION_OLD_ENGINE */ /*************************************************************************/ @@ -324,150 +151,6 @@ } - /*************************************************************************/ - /* */ - /* */ - /* cff_compute_bias */ - /* */ - /* */ - /* Computes the bias value in dependence of the number of glyph */ - /* subroutines. */ - /* */ - /* */ - /* in_charstring_type :: The `CharstringType' value of the top DICT */ - /* dictionary. */ - /* */ - /* num_subrs :: The number of glyph subroutines. */ - /* */ - /* */ - /* The bias value. */ - static FT_Int - cff_compute_bias( FT_Int in_charstring_type, - FT_UInt num_subrs ) - { - FT_Int result; - - - if ( in_charstring_type == 1 ) - result = 0; - else if ( num_subrs < 1240 ) - result = 107; - else if ( num_subrs < 33900U ) - result = 1131; - else - result = 32768U; - - return result; - } - - - /*************************************************************************/ - /* */ - /* */ - /* cff_decoder_init */ - /* */ - /* */ - /* Initializes a given glyph decoder. */ - /* */ - /* */ - /* decoder :: A pointer to the glyph builder to initialize. */ - /* */ - /* */ - /* face :: The current face object. */ - /* */ - /* size :: The current size object. */ - /* */ - /* slot :: The current glyph object. */ - /* */ - /* hinting :: Whether hinting is active. */ - /* */ - /* hint_mode :: The hinting mode. */ - /* */ - FT_LOCAL_DEF( void ) - cff_decoder_init( CFF_Decoder* decoder, - TT_Face face, - CFF_Size size, - CFF_GlyphSlot slot, - FT_Bool hinting, - FT_Render_Mode hint_mode ) - { - CFF_Font cff = (CFF_Font)face->extra.data; - - - /* clear everything */ - FT_ZERO( decoder ); - - /* initialize builder */ - cff_builder_init( &decoder->builder, face, size, slot, hinting ); - - /* initialize Type2 decoder */ - decoder->cff = cff; - decoder->num_globals = cff->global_subrs_index.count; - decoder->globals = cff->global_subrs; - decoder->globals_bias = cff_compute_bias( - cff->top_font.font_dict.charstring_type, - decoder->num_globals ); - - decoder->hint_mode = hint_mode; - } - - - /* this function is used to select the subfont */ - /* and the locals subrs array */ - FT_LOCAL_DEF( FT_Error ) - cff_decoder_prepare( CFF_Decoder* decoder, - CFF_Size size, - FT_UInt glyph_index ) - { - CFF_Builder *builder = &decoder->builder; - CFF_Font cff = (CFF_Font)builder->face->extra.data; - CFF_SubFont sub = &cff->top_font; - FT_Error error = FT_Err_Ok; - - - /* manage CID fonts */ - if ( cff->num_subfonts ) - { - FT_Byte fd_index = cff_fd_select_get( &cff->fd_select, glyph_index ); - - - if ( fd_index >= cff->num_subfonts ) - { - FT_TRACE4(( "cff_decoder_prepare: invalid CID subfont index\n" )); - error = FT_THROW( Invalid_File_Format ); - goto Exit; - } - - FT_TRACE3(( " in subfont %d:\n", fd_index )); - - sub = cff->subfonts[fd_index]; - - if ( builder->hints_funcs && size ) - { - FT_Size ftsize = FT_SIZE( size ); - CFF_Internal internal = (CFF_Internal)ftsize->internal->module_data; - - - /* for CFFs without subfonts, this value has already been set */ - builder->hints_globals = (void *)internal->subfonts[fd_index]; - } - } - - decoder->num_locals = sub->local_subrs_index.count; - decoder->locals = sub->local_subrs; - 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; - - decoder->current_subfont = sub; - - Exit: - return error; - } - /* check that there is enough space for `count' more points */ FT_LOCAL_DEF( FT_Error ) @@ -629,33 +312,6 @@ } - FT_LOCAL_DEF( FT_Int ) - cff_lookup_glyph_by_stdcharcode( CFF_Font cff, - FT_Int charcode ) - { - FT_UInt n; - FT_UShort glyph_sid; - - - /* CID-keyed fonts don't have glyph names */ - if ( !cff->charset.sids ) - return -1; - - /* check range of standard char code */ - if ( charcode < 0 || charcode > 255 ) - return -1; - - /* Get code to SID mapping from `cff_standard_encoding'. */ - glyph_sid = cff_get_standard_encoding( (FT_UInt)charcode ); - - for ( n = 0; n < cff->num_glyphs; n++ ) - { - if ( cff->charset.sids[n] == glyph_sid ) - return (FT_Int)n; - } - - return -1; - } FT_LOCAL_DEF( FT_Error ) @@ -729,1948 +385,7 @@ } -#ifdef CFF_CONFIG_OPTION_OLD_ENGINE - - static FT_Error - cff_operator_seac( CFF_Decoder* decoder, - FT_Pos asb, - FT_Pos adx, - FT_Pos ady, - FT_Int bchar, - FT_Int achar ) - { - FT_Error error; - CFF_Builder* builder = &decoder->builder; - FT_Int bchar_index, achar_index; - TT_Face face = decoder->builder.face; - FT_Vector left_bearing, advance; - FT_Byte* charstring; - FT_ULong charstring_len; - FT_Pos glyph_width; - - - if ( decoder->seac ) - { - FT_ERROR(( "cff_operator_seac: invalid nested seac\n" )); - return FT_THROW( 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. */ - if ( face->root.internal->incremental_interface ) - { - bchar_index = bchar; - achar_index = achar; - } - else -#endif /* FT_CONFIG_OPTION_INCREMENTAL */ - { - CFF_Font cff = (CFF_Font)(face->extra.data); - - - bchar_index = cff_lookup_glyph_by_stdcharcode( cff, bchar ); - achar_index = cff_lookup_glyph_by_stdcharcode( cff, achar ); - } - - if ( bchar_index < 0 || achar_index < 0 ) - { - FT_ERROR(( "cff_operator_seac:" - " invalid seac character code arguments\n" )); - return FT_THROW( Syntax_Error ); - } - - /* If we are trying to load a composite glyph, do not load the */ - /* accent character and return the array of subglyphs. */ - if ( builder->no_recurse ) - { - FT_GlyphSlot glyph = (FT_GlyphSlot)builder->glyph; - FT_GlyphLoader loader = glyph->internal->loader; - FT_SubGlyph subg; - - - /* reallocate subglyph array if necessary */ - error = FT_GlyphLoader_CheckSubGlyphs( loader, 2 ); - if ( error ) - goto Exit; - - subg = loader->current.subglyphs; - - /* subglyph 0 = base character */ - subg->index = bchar_index; - subg->flags = FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES | - FT_SUBGLYPH_FLAG_USE_MY_METRICS; - subg->arg1 = 0; - subg->arg2 = 0; - subg++; - - /* subglyph 1 = accent character */ - subg->index = achar_index; - subg->flags = FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES; - subg->arg1 = (FT_Int)( adx >> 16 ); - subg->arg2 = (FT_Int)( ady >> 16 ); - - /* set up remaining glyph fields */ - glyph->num_subglyphs = 2; - glyph->subglyphs = loader->base.subglyphs; - glyph->format = FT_GLYPH_FORMAT_COMPOSITE; - - loader->current.num_subglyphs = 2; - } - - FT_GlyphLoader_Prepare( builder->loader ); - - /* First load `bchar' in builder */ - error = cff_get_glyph_data( face, (FT_UInt)bchar_index, - &charstring, &charstring_len ); - if ( !error ) - { - /* the seac operator must not be nested */ - decoder->seac = TRUE; - error = cff_decoder_parse_charstrings( decoder, charstring, - charstring_len, 0 ); - decoder->seac = FALSE; - - cff_free_glyph_data( face, &charstring, charstring_len ); - - if ( error ) - goto Exit; - } - - /* 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 - asb; - builder->pos_y = ady; - - /* Now load `achar' on top of the base outline. */ - error = cff_get_glyph_data( face, (FT_UInt)achar_index, - &charstring, &charstring_len ); - if ( !error ) - { - /* the seac operator must not be nested */ - decoder->seac = TRUE; - error = cff_decoder_parse_charstrings( decoder, charstring, - charstring_len, 0 ); - decoder->seac = FALSE; - - cff_free_glyph_data( face, &charstring, charstring_len ); - - if ( error ) - goto Exit; - } - - /* 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; - - Exit: - return error; - } - - - /*************************************************************************/ - /* */ - /* */ - /* cff_decoder_parse_charstrings */ - /* */ - /* */ - /* Parses a given Type 2 charstrings program. */ - /* */ - /* */ - /* decoder :: The current Type 1 decoder. */ - /* */ - /* */ - /* charstring_base :: The base of the charstring stream. */ - /* */ - /* charstring_len :: The length in bytes of the charstring stream. */ - /* */ - /* in_dict :: Set to 1 if function is called from top or */ - /* private DICT (needed for Multiple Master CFFs). */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ - FT_LOCAL_DEF( FT_Error ) - cff_decoder_parse_charstrings( CFF_Decoder* decoder, - FT_Byte* charstring_base, - FT_ULong charstring_len, - FT_Bool in_dict ) - { - FT_Error error; - CFF_Decoder_Zone* zone; - FT_Byte* ip; - FT_Byte* limit; - CFF_Builder* builder = &decoder->builder; - FT_Pos x, y; - FT_Fixed* stack; - FT_Int charstring_type = - decoder->cff->top_font.font_dict.charstring_type; - FT_UShort num_designs = - decoder->cff->top_font.font_dict.num_designs; - FT_UShort num_axes = - decoder->cff->top_font.font_dict.num_axes; - - T2_Hints_Funcs hinter; - - - /* set default width */ - decoder->num_hints = 0; - decoder->read_width = 1; - - /* initialize the decoder */ - decoder->top = decoder->stack; - decoder->zone = decoder->zones; - zone = decoder->zones; - stack = decoder->top; - - hinter = (T2_Hints_Funcs)builder->hints_funcs; - - builder->path_begun = 0; - - zone->base = charstring_base; - limit = zone->limit = charstring_base + charstring_len; - ip = zone->cursor = zone->base; - - error = FT_Err_Ok; - - x = builder->pos_x; - y = builder->pos_y; - - /* begin hints recording session, if any */ - if ( hinter ) - hinter->open( hinter->hints ); - - /* now execute loop */ - while ( ip < limit ) - { - CFF_Operator op; - FT_Byte v; - - - /********************************************************************/ - /* */ - /* Decode operator or operand */ - /* */ - v = *ip++; - if ( v >= 32 || v == 28 ) - { - FT_Int shift = 16; - FT_Int32 val; - - - /* this is an operand, push it on the stack */ - - /* if we use shifts, all computations are done with unsigned */ - /* values; the conversion to a signed value is the last step */ - if ( v == 28 ) - { - if ( ip + 1 >= limit ) - goto Syntax_Error; - val = (FT_Short)( ( (FT_UShort)ip[0] << 8 ) | ip[1] ); - ip += 2; - } - else if ( v < 247 ) - val = (FT_Int32)v - 139; - else if ( v < 251 ) - { - if ( ip >= limit ) - goto Syntax_Error; - val = ( (FT_Int32)v - 247 ) * 256 + *ip++ + 108; - } - else if ( v < 255 ) - { - if ( ip >= limit ) - goto Syntax_Error; - val = -( (FT_Int32)v - 251 ) * 256 - *ip++ - 108; - } - else - { - if ( ip + 3 >= limit ) - goto Syntax_Error; - val = (FT_Int32)( ( (FT_UInt32)ip[0] << 24 ) | - ( (FT_UInt32)ip[1] << 16 ) | - ( (FT_UInt32)ip[2] << 8 ) | - (FT_UInt32)ip[3] ); - ip += 4; - if ( charstring_type == 2 ) - shift = 0; - } - if ( decoder->top - stack >= CFF_MAX_OPERANDS ) - goto Stack_Overflow; - - val = (FT_Int32)( (FT_UInt32)val << shift ); - *decoder->top++ = val; - -#ifdef FT_DEBUG_LEVEL_TRACE - if ( !( val & 0xFFFFL ) ) - FT_TRACE4(( " %hd", (FT_Short)( (FT_UInt32)val >> 16 ) )); - else - FT_TRACE4(( " %.5f", val / 65536.0 )); -#endif - - } - else - { - /* The specification says that normally arguments are to be taken */ - /* from the bottom of the stack. However, this seems not to be */ - /* correct, at least for Acroread 7.0.8 on GNU/Linux: It pops the */ - /* arguments similar to a PS interpreter. */ - - FT_Fixed* args = decoder->top; - FT_Int num_args = (FT_Int)( args - decoder->stack ); - FT_Int req_args; - - - /* find operator */ - op = cff_op_unknown; - - switch ( v ) - { - case 1: - op = cff_op_hstem; - break; - case 3: - op = cff_op_vstem; - break; - case 4: - op = cff_op_vmoveto; - break; - case 5: - op = cff_op_rlineto; - break; - case 6: - op = cff_op_hlineto; - break; - case 7: - op = cff_op_vlineto; - break; - case 8: - op = cff_op_rrcurveto; - break; - case 9: - op = cff_op_closepath; - break; - case 10: - op = cff_op_callsubr; - break; - case 11: - op = cff_op_return; - break; - case 12: - { - if ( ip >= limit ) - goto Syntax_Error; - v = *ip++; - - switch ( v ) - { - 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; - case 4: - op = cff_op_or; - break; - 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; - case 9: - op = cff_op_abs; - break; - case 10: - op = cff_op_add; - break; - case 11: - op = cff_op_sub; - break; - case 12: - op = cff_op_div; - break; - case 13: - op = cff_op_load; - break; - case 14: - op = cff_op_neg; - break; - case 15: - op = cff_op_eq; - break; - case 16: - op = cff_op_callothersubr; - break; - case 17: - op = cff_op_pop; - break; - case 18: - op = cff_op_drop; - break; - case 20: - op = cff_op_put; - break; - case 21: - op = cff_op_get; - break; - case 22: - op = cff_op_ifelse; - break; - case 23: - op = cff_op_random; - break; - case 24: - op = cff_op_mul; - break; - case 26: - op = cff_op_sqrt; - break; - case 27: - op = cff_op_dup; - break; - case 28: - op = cff_op_exch; - break; - case 29: - op = cff_op_index; - break; - case 30: - op = cff_op_roll; - break; - case 33: - op = cff_op_setcurrentpoint; - break; - case 34: - op = cff_op_hflex; - break; - case 35: - op = cff_op_flex; - break; - case 36: - op = cff_op_hflex1; - break; - case 37: - op = cff_op_flex1; - break; - default: - FT_TRACE4(( " unknown op (12, %d)\n", v )); - break; - } - } - break; - case 13: - op = cff_op_hsbw; - break; - case 14: - op = cff_op_endchar; - break; - case 16: - op = cff_op_blend; - break; - case 18: - op = cff_op_hstemhm; - break; - case 19: - op = cff_op_hintmask; - break; - case 20: - op = cff_op_cntrmask; - break; - case 21: - op = cff_op_rmoveto; - break; - case 22: - op = cff_op_hmoveto; - break; - case 23: - op = cff_op_vstemhm; - break; - case 24: - op = cff_op_rcurveline; - break; - case 25: - op = cff_op_rlinecurve; - break; - case 26: - op = cff_op_vvcurveto; - break; - case 27: - op = cff_op_hhcurveto; - break; - case 29: - op = cff_op_callgsubr; - break; - case 30: - op = cff_op_vhcurveto; - break; - case 31: - op = cff_op_hvcurveto; - break; - default: - FT_TRACE4(( " unknown op (%d)\n", v )); - break; - } - - if ( op == cff_op_unknown ) - continue; - - /* in Multiple Master CFFs, T2 charstrings can appear in */ - /* dictionaries, but some operators are prohibited */ - if ( in_dict ) - { - switch ( op ) - { - case cff_op_hstem: - case cff_op_vstem: - case cff_op_vmoveto: - case cff_op_rlineto: - case cff_op_hlineto: - case cff_op_vlineto: - case cff_op_rrcurveto: - case cff_op_hstemhm: - case cff_op_hintmask: - case cff_op_cntrmask: - case cff_op_rmoveto: - case cff_op_hmoveto: - case cff_op_vstemhm: - case cff_op_rcurveline: - case cff_op_rlinecurve: - case cff_op_vvcurveto: - case cff_op_hhcurveto: - case cff_op_vhcurveto: - case cff_op_hvcurveto: - case cff_op_hflex: - case cff_op_flex: - case cff_op_hflex1: - case cff_op_flex1: - case cff_op_callsubr: - case cff_op_callgsubr: - goto MM_Error; - - default: - break; - } - } - - /* check arguments */ - req_args = cff_argument_counts[op]; - if ( req_args & CFF_COUNT_CHECK_WIDTH ) - { - if ( num_args > 0 && decoder->read_width ) - { - /* If `nominal_width' is non-zero, the number is really a */ - /* difference against `nominal_width'. Else, the number here */ - /* is truly a width, not a difference against `nominal_width'. */ - /* If the font does not set `nominal_width', then */ - /* `nominal_width' defaults to zero, and so we can set */ - /* `glyph_width' to `nominal_width' plus number on the stack */ - /* -- for either case. */ - - FT_Int set_width_ok; - - - switch ( op ) - { - case cff_op_hmoveto: - case cff_op_vmoveto: - set_width_ok = num_args & 2; - break; - - case cff_op_hstem: - case cff_op_vstem: - case cff_op_hstemhm: - case cff_op_vstemhm: - case cff_op_rmoveto: - case cff_op_hintmask: - case cff_op_cntrmask: - set_width_ok = num_args & 1; - break; - - case cff_op_endchar: - /* If there is a width specified for endchar, we either have */ - /* 1 argument or 5 arguments. We like to argue. */ - set_width_ok = in_dict - ? 0 - : ( ( num_args == 5 ) || ( num_args == 1 ) ); - break; - - default: - set_width_ok = 0; - break; - } - - if ( set_width_ok ) - { - decoder->glyph_width = decoder->nominal_width + - ( stack[0] >> 16 ); - - if ( decoder->width_only ) - { - /* we only want the advance width; stop here */ - break; - } - - /* Consumed an argument. */ - num_args--; - } - } - - decoder->read_width = 0; - req_args = 0; - } - - req_args &= 0x000F; - if ( num_args < req_args ) - goto Stack_Underflow; - args -= req_args; - num_args -= req_args; - - /* At this point, `args' points to the first argument of the */ - /* operand in case `req_args' isn't zero. Otherwise, we have */ - /* to adjust `args' manually. */ - - /* Note that we only pop arguments from the stack which we */ - /* really need and can digest so that we can continue in case */ - /* of superfluous stack elements. */ - - switch ( op ) - { - case cff_op_hstem: - case cff_op_vstem: - case cff_op_hstemhm: - case cff_op_vstemhm: - /* the number of arguments is always even here */ - FT_TRACE4(( - op == cff_op_hstem ? " hstem\n" : - ( op == cff_op_vstem ? " vstem\n" : - ( op == cff_op_hstemhm ? " hstemhm\n" : " vstemhm\n" ) ) )); - - if ( hinter ) - hinter->stems( hinter->hints, - ( op == cff_op_hstem || op == cff_op_hstemhm ), - num_args / 2, - args - ( num_args & ~1 ) ); - - decoder->num_hints += num_args / 2; - args = stack; - break; - - case cff_op_hintmask: - case cff_op_cntrmask: - FT_TRACE4(( op == cff_op_hintmask ? " hintmask" : " cntrmask" )); - - /* implement vstem when needed -- */ - /* the specification doesn't say it, but this also works */ - /* with the 'cntrmask' operator */ - /* */ - if ( num_args > 0 ) - { - if ( hinter ) - hinter->stems( hinter->hints, - 0, - num_args / 2, - args - ( num_args & ~1 ) ); - - decoder->num_hints += num_args / 2; - } - - /* In a valid charstring there must be at least one byte */ - /* after `hintmask' or `cntrmask' (e.g., for a `return' */ - /* instruction). Additionally, there must be space for */ - /* `num_hints' bits. */ - - if ( ( ip + ( ( decoder->num_hints + 7 ) >> 3 ) ) >= limit ) - goto Syntax_Error; - - if ( hinter ) - { - if ( op == cff_op_hintmask ) - hinter->hintmask( hinter->hints, - (FT_UInt)builder->current->n_points, - (FT_UInt)decoder->num_hints, - ip ); - else - hinter->counter( hinter->hints, - (FT_UInt)decoder->num_hints, - ip ); - } - -#ifdef FT_DEBUG_LEVEL_TRACE - { - FT_UInt maskbyte; - - - FT_TRACE4(( " (maskbytes:" )); - - for ( maskbyte = 0; - maskbyte < (FT_UInt)( ( decoder->num_hints + 7 ) >> 3 ); - maskbyte++, ip++ ) - FT_TRACE4(( " 0x%02X", *ip )); - - FT_TRACE4(( ")\n" )); - } -#else - ip += ( decoder->num_hints + 7 ) >> 3; -#endif - args = stack; - break; - - case cff_op_rmoveto: - FT_TRACE4(( " rmoveto\n" )); - - cff_builder_close_contour( builder ); - builder->path_begun = 0; - x = ADD_LONG( x, args[-2] ); - y = ADD_LONG( y, args[-1] ); - args = stack; - break; - - case cff_op_vmoveto: - FT_TRACE4(( " vmoveto\n" )); - - cff_builder_close_contour( builder ); - builder->path_begun = 0; - y = ADD_LONG( y, args[-1] ); - args = stack; - break; - - case cff_op_hmoveto: - FT_TRACE4(( " hmoveto\n" )); - - cff_builder_close_contour( builder ); - builder->path_begun = 0; - x = ADD_LONG( x, args[-1] ); - args = stack; - break; - - case cff_op_rlineto: - FT_TRACE4(( " rlineto\n" )); - - if ( cff_builder_start_point( builder, x, y ) || - cff_check_points( builder, num_args / 2 ) ) - goto Fail; - - if ( num_args < 2 ) - goto Stack_Underflow; - - args -= num_args & ~1; - while ( args < decoder->top ) - { - x = ADD_LONG( x, args[0] ); - y = ADD_LONG( y, args[1] ); - cff_builder_add_point( builder, x, y, 1 ); - args += 2; - } - args = stack; - break; - - case cff_op_hlineto: - case cff_op_vlineto: - { - FT_Int phase = ( op == cff_op_hlineto ); - - - FT_TRACE4(( op == cff_op_hlineto ? " hlineto\n" - : " vlineto\n" )); - - if ( num_args < 0 ) - goto Stack_Underflow; - - /* there exist subsetted fonts (found in PDFs) */ - /* which call `hlineto' without arguments */ - if ( num_args == 0 ) - break; - - if ( cff_builder_start_point( builder, x, y ) || - cff_check_points( builder, num_args ) ) - goto Fail; - - args = stack; - while ( args < decoder->top ) - { - if ( phase ) - x = ADD_LONG( x, args[0] ); - else - y = ADD_LONG( y, args[0] ); - - if ( cff_builder_add_point1( builder, x, y ) ) - goto Fail; - - args++; - phase ^= 1; - } - args = stack; - } - break; - - case cff_op_rrcurveto: - { - FT_Int nargs; - - - FT_TRACE4(( " rrcurveto\n" )); - - if ( num_args < 6 ) - goto Stack_Underflow; - - nargs = num_args - num_args % 6; - - if ( cff_builder_start_point( builder, x, y ) || - cff_check_points( builder, nargs / 2 ) ) - goto Fail; - - args -= nargs; - while ( args < decoder->top ) - { - x = ADD_LONG( x, args[0] ); - y = ADD_LONG( y, args[1] ); - cff_builder_add_point( builder, x, y, 0 ); - - x = ADD_LONG( x, args[2] ); - y = ADD_LONG( y, args[3] ); - cff_builder_add_point( builder, x, y, 0 ); - - x = ADD_LONG( x, args[4] ); - y = ADD_LONG( y, args[5] ); - cff_builder_add_point( builder, x, y, 1 ); - - args += 6; - } - args = stack; - } - break; - - case cff_op_vvcurveto: - { - FT_Int nargs; - - - FT_TRACE4(( " vvcurveto\n" )); - - if ( num_args < 4 ) - goto Stack_Underflow; - - /* if num_args isn't of the form 4n or 4n+1, */ - /* we enforce it by clearing the second bit */ - - nargs = num_args & ~2; - - if ( cff_builder_start_point( builder, x, y ) ) - goto Fail; - - args -= nargs; - - if ( nargs & 1 ) - { - x = ADD_LONG( x, args[0] ); - args++; - nargs--; - } - - if ( cff_check_points( builder, 3 * ( nargs / 4 ) ) ) - goto Fail; - - while ( args < decoder->top ) - { - y = ADD_LONG( y, args[0] ); - cff_builder_add_point( builder, x, y, 0 ); - - x = ADD_LONG( x, args[1] ); - y = ADD_LONG( y, args[2] ); - cff_builder_add_point( builder, x, y, 0 ); - - y = ADD_LONG( y, args[3] ); - cff_builder_add_point( builder, x, y, 1 ); - - args += 4; - } - args = stack; - } - break; - - case cff_op_hhcurveto: - { - FT_Int nargs; - - - FT_TRACE4(( " hhcurveto\n" )); - - if ( num_args < 4 ) - goto Stack_Underflow; - - /* if num_args isn't of the form 4n or 4n+1, */ - /* we enforce it by clearing the second bit */ - - nargs = num_args & ~2; - - if ( cff_builder_start_point( builder, x, y ) ) - goto Fail; - - args -= nargs; - if ( nargs & 1 ) - { - y = ADD_LONG( y, args[0] ); - args++; - nargs--; - } - - if ( cff_check_points( builder, 3 * ( nargs / 4 ) ) ) - goto Fail; - - while ( args < decoder->top ) - { - x = ADD_LONG( x, args[0] ); - cff_builder_add_point( builder, x, y, 0 ); - - x = ADD_LONG( x, args[1] ); - y = ADD_LONG( y, args[2] ); - cff_builder_add_point( builder, x, y, 0 ); - - x = ADD_LONG( x, args[3] ); - cff_builder_add_point( builder, x, y, 1 ); - - args += 4; - } - args = stack; - } - break; - - case cff_op_vhcurveto: - case cff_op_hvcurveto: - { - FT_Int phase; - FT_Int nargs; - - - FT_TRACE4(( op == cff_op_vhcurveto ? " vhcurveto\n" - : " hvcurveto\n" )); - - if ( cff_builder_start_point( builder, x, y ) ) - goto Fail; - - if ( num_args < 4 ) - goto Stack_Underflow; - - /* if num_args isn't of the form 8n, 8n+1, 8n+4, or 8n+5, */ - /* we enforce it by clearing the second bit */ - - nargs = num_args & ~2; - - args -= nargs; - if ( cff_check_points( builder, ( nargs / 4 ) * 3 ) ) - goto Stack_Underflow; - - phase = ( op == cff_op_hvcurveto ); - - while ( nargs >= 4 ) - { - nargs -= 4; - if ( phase ) - { - x = ADD_LONG( x, args[0] ); - cff_builder_add_point( builder, x, y, 0 ); - - x = ADD_LONG( x, args[1] ); - y = ADD_LONG( y, args[2] ); - cff_builder_add_point( builder, x, y, 0 ); - - y = ADD_LONG( y, args[3] ); - if ( nargs == 1 ) - x = ADD_LONG( x, args[4] ); - cff_builder_add_point( builder, x, y, 1 ); - } - else - { - y = ADD_LONG( y, args[0] ); - cff_builder_add_point( builder, x, y, 0 ); - - x = ADD_LONG( x, args[1] ); - y = ADD_LONG( y, args[2] ); - cff_builder_add_point( builder, x, y, 0 ); - - x = ADD_LONG( x, args[3] ); - if ( nargs == 1 ) - y = ADD_LONG( y, args[4] ); - cff_builder_add_point( builder, x, y, 1 ); - } - args += 4; - phase ^= 1; - } - args = stack; - } - break; - - case cff_op_rlinecurve: - { - FT_Int num_lines; - FT_Int nargs; - - - FT_TRACE4(( " rlinecurve\n" )); - - if ( num_args < 8 ) - goto Stack_Underflow; - - nargs = num_args & ~1; - num_lines = ( nargs - 6 ) / 2; - - if ( cff_builder_start_point( builder, x, y ) || - cff_check_points( builder, num_lines + 3 ) ) - goto Fail; - - args -= nargs; - - /* first, add the line segments */ - while ( num_lines > 0 ) - { - x = ADD_LONG( x, args[0] ); - y = ADD_LONG( y, args[1] ); - cff_builder_add_point( builder, x, y, 1 ); - - args += 2; - num_lines--; - } - - /* then the curve */ - x = ADD_LONG( x, args[0] ); - y = ADD_LONG( y, args[1] ); - cff_builder_add_point( builder, x, y, 0 ); - - x = ADD_LONG( x, args[2] ); - y = ADD_LONG( y, args[3] ); - cff_builder_add_point( builder, x, y, 0 ); - - x = ADD_LONG( x, args[4] ); - y = ADD_LONG( y, args[5] ); - cff_builder_add_point( builder, x, y, 1 ); - - args = stack; - } - break; - - case cff_op_rcurveline: - { - FT_Int num_curves; - FT_Int nargs; - - - FT_TRACE4(( " rcurveline\n" )); - - if ( num_args < 8 ) - goto Stack_Underflow; - - nargs = num_args - 2; - nargs = nargs - nargs % 6 + 2; - num_curves = ( nargs - 2 ) / 6; - - if ( cff_builder_start_point( builder, x, y ) || - cff_check_points( builder, num_curves * 3 + 2 ) ) - goto Fail; - - args -= nargs; - - /* first, add the curves */ - while ( num_curves > 0 ) - { - x = ADD_LONG( x, args[0] ); - y = ADD_LONG( y, args[1] ); - cff_builder_add_point( builder, x, y, 0 ); - - x = ADD_LONG( x, args[2] ); - y = ADD_LONG( y, args[3] ); - cff_builder_add_point( builder, x, y, 0 ); - - x = ADD_LONG( x, args[4] ); - y = ADD_LONG( y, args[5] ); - cff_builder_add_point( builder, x, y, 1 ); - - args += 6; - num_curves--; - } - - /* then the final line */ - x = ADD_LONG( x, args[0] ); - y = ADD_LONG( y, args[1] ); - cff_builder_add_point( builder, x, y, 1 ); - - args = stack; - } - break; - - case cff_op_hflex1: - { - FT_Pos start_y; - - - FT_TRACE4(( " hflex1\n" )); - - /* adding five more points: 4 control points, 1 on-curve point */ - /* -- make sure we have enough space for the start point if it */ - /* needs to be added */ - if ( cff_builder_start_point( builder, x, y ) || - cff_check_points( builder, 6 ) ) - goto Fail; - - /* record the starting point's y position for later use */ - start_y = y; - - /* first control point */ - x = ADD_LONG( x, args[0] ); - y = ADD_LONG( y, args[1] ); - cff_builder_add_point( builder, x, y, 0 ); - - /* second control point */ - x = ADD_LONG( x, args[2] ); - y = ADD_LONG( y, args[3] ); - cff_builder_add_point( builder, x, y, 0 ); - - /* join point; on curve, with y-value the same as the last */ - /* control point's y-value */ - x = ADD_LONG( x, args[4] ); - cff_builder_add_point( builder, x, y, 1 ); - - /* third control point, with y-value the same as the join */ - /* point's y-value */ - x = ADD_LONG( x, args[5] ); - cff_builder_add_point( builder, x, y, 0 ); - - /* fourth control point */ - x = ADD_LONG( x, args[6] ); - y = ADD_LONG( y, args[7] ); - cff_builder_add_point( builder, x, y, 0 ); - - /* ending point, with y-value the same as the start */ - x = ADD_LONG( x, args[8] ); - y = start_y; - cff_builder_add_point( builder, x, y, 1 ); - - args = stack; - break; - } - - case cff_op_hflex: - { - FT_Pos start_y; - - - FT_TRACE4(( " hflex\n" )); - - /* adding six more points; 4 control points, 2 on-curve points */ - if ( cff_builder_start_point( builder, x, y ) || - cff_check_points( builder, 6 ) ) - goto Fail; - - /* record the starting point's y-position for later use */ - start_y = y; - - /* first control point */ - x = ADD_LONG( x, args[0] ); - cff_builder_add_point( builder, x, y, 0 ); - - /* second control point */ - x = ADD_LONG( x, args[1] ); - y = ADD_LONG( y, args[2] ); - cff_builder_add_point( builder, x, y, 0 ); - - /* join point; on curve, with y-value the same as the last */ - /* control point's y-value */ - x = ADD_LONG( x, args[3] ); - cff_builder_add_point( builder, x, y, 1 ); - - /* third control point, with y-value the same as the join */ - /* point's y-value */ - x = ADD_LONG( x, args[4] ); - cff_builder_add_point( builder, x, y, 0 ); - - /* fourth control point */ - x = ADD_LONG( x, args[5] ); - y = start_y; - cff_builder_add_point( builder, x, y, 0 ); - - /* ending point, with y-value the same as the start point's */ - /* y-value -- we don't add this point, though */ - x = ADD_LONG( x, args[6] ); - cff_builder_add_point( builder, x, y, 1 ); - - args = stack; - break; - } - - case cff_op_flex1: - { - FT_Pos start_x, start_y; /* record start x, y values for */ - /* alter use */ - FT_Fixed dx = 0, dy = 0; /* used in horizontal/vertical */ - /* algorithm below */ - FT_Int horizontal, count; - FT_Fixed* temp; - - - FT_TRACE4(( " flex1\n" )); - - /* adding six more points; 4 control points, 2 on-curve points */ - if ( cff_builder_start_point( builder, x, y ) || - cff_check_points( builder, 6 ) ) - goto Fail; - - /* record the starting point's x, y position for later use */ - start_x = x; - start_y = y; - - /* XXX: figure out whether this is supposed to be a horizontal */ - /* or vertical flex; the Type 2 specification is vague... */ - - temp = args; - - /* grab up to the last argument */ - for ( count = 5; count > 0; count-- ) - { - dx = ADD_LONG( dx, temp[0] ); - dy = ADD_LONG( dy, temp[1] ); - temp += 2; - } - - if ( dx < 0 ) - dx = -dx; - if ( dy < 0 ) - dy = -dy; - - /* strange test, but here it is... */ - horizontal = ( dx > dy ); - - for ( count = 5; count > 0; count-- ) - { - x = ADD_LONG( x, args[0] ); - y = ADD_LONG( y, args[1] ); - cff_builder_add_point( builder, x, y, - (FT_Bool)( count == 3 ) ); - args += 2; - } - - /* is last operand an x- or y-delta? */ - if ( horizontal ) - { - x = ADD_LONG( x, args[0] ); - y = start_y; - } - else - { - x = start_x; - y = ADD_LONG( y, args[0] ); - } - - cff_builder_add_point( builder, x, y, 1 ); - - args = stack; - break; - } - - case cff_op_flex: - { - FT_UInt count; - - - FT_TRACE4(( " flex\n" )); - - if ( cff_builder_start_point( builder, x, y ) || - cff_check_points( builder, 6 ) ) - goto Fail; - - for ( count = 6; count > 0; count-- ) - { - x = ADD_LONG( x, args[0] ); - y = ADD_LONG( y, args[1] ); - cff_builder_add_point( builder, x, y, - (FT_Bool)( count == 4 || count == 1 ) ); - args += 2; - } - - args = stack; - } - 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: - /* in dictionaries, `endchar' simply indicates end of data */ - if ( in_dict ) - return error; - - FT_TRACE4(( " endchar\n" )); - - /* We are going to emulate the seac operator. */ - if ( num_args >= 4 ) - { - /* Save glyph width so that the subglyphs don't overwrite it. */ - FT_Pos glyph_width = decoder->glyph_width; - - - error = cff_operator_seac( decoder, - 0L, args[-4], args[-3], - (FT_Int)( args[-2] >> 16 ), - (FT_Int)( args[-1] >> 16 ) ); - - decoder->glyph_width = glyph_width; - } - else - { - cff_builder_close_contour( builder ); - - /* close hints recording session */ - if ( hinter ) - { - if ( hinter->close( hinter->hints, - (FT_UInt)builder->current->n_points ) ) - goto Syntax_Error; - - /* apply hints to the loaded glyph outline now */ - error = hinter->apply( hinter->hints, - builder->current, - (PSH_Globals)builder->hints_globals, - decoder->hint_mode ); - if ( error ) - goto Fail; - } - - /* add current outline to the glyph slot */ - FT_GlyphLoader_Add( builder->loader ); - } - - /* return now! */ - FT_TRACE4(( "\n" )); - return error; - - case cff_op_abs: - FT_TRACE4(( " abs\n" )); - - if ( args[0] < 0 ) - { - if ( args[0] == FT_LONG_MIN ) - args[0] = FT_LONG_MAX; - else - args[0] = -args[0]; - } - args++; - break; - - case cff_op_add: - FT_TRACE4(( " add\n" )); - - args[0] = ADD_LONG( args[0], args[1] ); - args++; - break; - - case cff_op_sub: - FT_TRACE4(( " sub\n" )); - - args[0] = SUB_LONG( args[0], args[1] ); - args++; - break; - - case cff_op_div: - FT_TRACE4(( " div\n" )); - - args[0] = FT_DivFix( args[0], args[1] ); - args++; - break; - - case cff_op_neg: - FT_TRACE4(( " neg\n" )); - - if ( args[0] == FT_LONG_MIN ) - args[0] = FT_LONG_MAX; - args[0] = -args[0]; - args++; - break; - - case cff_op_random: - FT_TRACE4(( " random\n" )); - - /* only use the lower 16 bits of `random' */ - /* to generate a number in the range (0;1] */ - args[0] = (FT_Fixed) - ( ( decoder->current_subfont->random & 0xFFFF ) + 1 ); - args++; - - decoder->current_subfont->random = - cff_random( decoder->current_subfont->random ); - break; - - case cff_op_mul: - FT_TRACE4(( " mul\n" )); - - args[0] = FT_MulFix( args[0], args[1] ); - args++; - break; - - case cff_op_sqrt: - FT_TRACE4(( " sqrt\n" )); - - if ( args[0] > 0 ) - { - FT_Fixed root = args[0]; - FT_Fixed new_root; - - - for (;;) - { - new_root = ( root + FT_DivFix( args[0], root ) + 1 ) >> 1; - if ( new_root == root ) - break; - root = new_root; - } - args[0] = new_root; - } - else - args[0] = 0; - args++; - break; - - case cff_op_drop: - /* nothing */ - FT_TRACE4(( " drop\n" )); - - break; - - case cff_op_exch: - { - FT_Fixed tmp; - - - FT_TRACE4(( " exch\n" )); - - tmp = args[0]; - args[0] = args[1]; - args[1] = tmp; - args += 2; - } - break; - - case cff_op_index: - { - FT_Int idx = (FT_Int)( args[0] >> 16 ); - - - FT_TRACE4(( " index\n" )); - - if ( idx < 0 ) - idx = 0; - else if ( idx > num_args - 2 ) - idx = num_args - 2; - args[0] = args[-( idx + 1 )]; - args++; - } - break; - - case cff_op_roll: - { - FT_Int count = (FT_Int)( args[0] >> 16 ); - FT_Int idx = (FT_Int)( args[1] >> 16 ); - - - FT_TRACE4(( " roll\n" )); - - if ( count <= 0 ) - count = 1; - - args -= count; - if ( args < stack ) - goto Stack_Underflow; - - if ( idx >= 0 ) - { - while ( idx > 0 ) - { - FT_Fixed tmp = args[count - 1]; - FT_Int i; - - - for ( i = count - 2; i >= 0; i-- ) - args[i + 1] = args[i]; - args[0] = tmp; - idx--; - } - } - else - { - while ( idx < 0 ) - { - FT_Fixed tmp = args[0]; - FT_Int i; - - - for ( i = 0; i < count - 1; i++ ) - args[i] = args[i + 1]; - args[count - 1] = tmp; - idx++; - } - } - args += count; - } - break; - - case cff_op_dup: - FT_TRACE4(( " dup\n" )); - - args[1] = args[0]; - args += 2; - break; - - case cff_op_put: - { - FT_Fixed val = args[0]; - FT_Int idx = (FT_Int)( args[1] >> 16 ); - - - FT_TRACE4(( " put\n" )); - - /* the Type2 specification before version 16-March-2000 */ - /* didn't give a hard-coded size limit of the temporary */ - /* storage array; instead, an argument of the */ - /* `MultipleMaster' operator set the size */ - if ( idx >= 0 && idx < CFF_MAX_TRANS_ELEMENTS ) - decoder->buildchar[idx] = val; - } - break; - - case cff_op_get: - { - FT_Int idx = (FT_Int)( args[0] >> 16 ); - FT_Fixed val = 0; - - - FT_TRACE4(( " get\n" )); - - if ( idx >= 0 && idx < CFF_MAX_TRANS_ELEMENTS ) - val = decoder->buildchar[idx]; - - args[0] = val; - args++; - } - break; - - case cff_op_store: - /* this operator was removed from the Type2 specification */ - /* in version 16-March-2000 */ - - /* since we currently don't handle interpolation of multiple */ - /* master fonts, this is a no-op */ - FT_TRACE4(( " store\n")); - break; - - case cff_op_load: - /* this operator was removed from the Type2 specification */ - /* in version 16-March-2000 */ - { - FT_Int reg_idx = (FT_Int)args[0]; - FT_Int idx = (FT_Int)args[1]; - FT_Int count = (FT_Int)args[2]; - - - FT_TRACE4(( " load\n" )); - - /* since we currently don't handle interpolation of multiple */ - /* master fonts, we store a vector [1 0 0 ...] in the */ - /* temporary storage array regardless of the Registry index */ - if ( reg_idx >= 0 && reg_idx <= 2 && - idx >= 0 && idx < CFF_MAX_TRANS_ELEMENTS && - count >= 0 && count <= num_axes ) - { - FT_Int end, i; - - - end = FT_MIN( idx + count, CFF_MAX_TRANS_ELEMENTS ); - - if ( idx < end ) - decoder->buildchar[idx] = 1 << 16; - - for ( i = idx + 1; i < end; i++ ) - decoder->buildchar[i] = 0; - } - } - break; - - case cff_op_blend: - /* this operator was removed from the Type2 specification */ - /* in version 16-March-2000 */ - { - FT_Int num_results = (FT_Int)( args[0] >> 16 ); - - - FT_TRACE4(( " blend\n" )); - - if ( num_results < 0 ) - goto Syntax_Error; - - if ( num_results * (FT_Int)num_designs > num_args ) - goto Stack_Underflow; - - /* since we currently don't handle interpolation of multiple */ - /* master fonts, return the `num_results' values of the */ - /* first master */ - args -= num_results * ( num_designs - 1 ); - num_args -= num_results * ( num_designs - 1 ); - } - break; - - case cff_op_dotsection: - /* this operator is deprecated and ignored by the parser */ - FT_TRACE4(( " dotsection\n" )); - break; - - case cff_op_closepath: - /* 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(( " closepath (invalid op)\n" )); - - args = stack; - break; - - case cff_op_hsbw: - /* 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(( " hsbw (invalid op)\n" )); - - decoder->glyph_width = - ADD_LONG( decoder->nominal_width, ( args[1] >> 16 ) ); - - decoder->builder.left_bearing.x = args[0]; - decoder->builder.left_bearing.y = 0; - - x = ADD_LONG( 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 = - ADD_LONG( decoder->nominal_width, ( args[2] >> 16 ) ); - - decoder->builder.left_bearing.x = args[0]; - decoder->builder.left_bearing.y = args[1]; - - x = ADD_LONG( decoder->builder.pos_x, args[0] ); - y = ADD_LONG( 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 = ADD_LONG( decoder->builder.pos_x, args[0] ); - y = ADD_LONG( decoder->builder.pos_y, args[1] ); - args = stack; - break; - - case cff_op_callothersubr: - /* this is an invalid Type 2 operator; however, there */ - /* exist fonts which are incorrectly converted from probably */ - /* Type 1 to CFF, and some parsers seem to accept it */ - - FT_TRACE4(( " callothersubr (invalid op)\n" )); - - /* subsequent `pop' operands should add the arguments, */ - /* this is the implementation described for `unknown' other */ - /* subroutines in the Type1 spec. */ - /* */ - /* XXX Fix return arguments (see discussion below). */ - args -= 2 + ( args[-2] >> 16 ); - if ( args < stack ) - goto Stack_Underflow; - break; - - case cff_op_pop: - /* this is an invalid Type 2 operator; however, there */ - /* exist fonts which are incorrectly converted from probably */ - /* Type 1 to CFF, and some parsers seem to accept it */ - - FT_TRACE4(( " pop (invalid op)\n" )); - - /* XXX Increasing `args' is wrong: After a certain number of */ - /* `pop's we get a stack overflow. Reason for doing it is */ - /* code like this (actually found in a CFF font): */ - /* */ - /* 17 1 3 callothersubr */ - /* pop */ - /* callsubr */ - /* */ - /* Since we handle `callothersubr' as a no-op, and */ - /* `callsubr' needs at least one argument, `pop' can't be a */ - /* no-op too as it basically should be. */ - /* */ - /* The right solution would be to provide real support for */ - /* `callothersubr' as done in `t1decode.c', however, given */ - /* the fact that CFF fonts with `pop' are invalid, it is */ - /* questionable whether it is worth the time. */ - args++; - break; - - case cff_op_and: - { - FT_Fixed cond = ( args[0] && args[1] ); - - - FT_TRACE4(( " and\n" )); - - args[0] = cond ? 0x10000L : 0; - args++; - } - break; - - case cff_op_or: - { - FT_Fixed cond = ( args[0] || args[1] ); - - - FT_TRACE4(( " or\n" )); - - args[0] = cond ? 0x10000L : 0; - args++; - } - break; - - case cff_op_not: - { - FT_Fixed cond = !args[0]; - - - FT_TRACE4(( " not\n" )); - - args[0] = cond ? 0x10000L : 0; - args++; - } - break; - - case cff_op_eq: - { - FT_Fixed cond = ( args[0] == args[1] ); - - - FT_TRACE4(( " eq\n" )); - - args[0] = cond ? 0x10000L : 0; - args++; - } - break; - - case cff_op_ifelse: - { - FT_Fixed cond = ( args[2] <= args[3] ); - - - FT_TRACE4(( " ifelse\n" )); - - if ( !cond ) - args[0] = args[1]; - args++; - } - break; - - case cff_op_callsubr: - { - FT_UInt idx = (FT_UInt)( ( args[0] >> 16 ) + - decoder->locals_bias ); - - - FT_TRACE4(( " callsubr (idx %d, entering level %d)\n", - idx, - zone - decoder->zones + 1 )); - - if ( idx >= decoder->num_locals ) - { - FT_ERROR(( "cff_decoder_parse_charstrings:" - " invalid local subr index\n" )); - goto Syntax_Error; - } - - if ( zone - decoder->zones >= CFF_MAX_SUBRS_CALLS ) - { - FT_ERROR(( "cff_decoder_parse_charstrings:" - " too many nested subrs\n" )); - goto Syntax_Error; - } - - zone->cursor = ip; /* save current instruction pointer */ - - zone++; - zone->base = decoder->locals[idx]; - zone->limit = decoder->locals[idx + 1]; - zone->cursor = zone->base; - - if ( !zone->base || zone->limit == zone->base ) - { - FT_ERROR(( "cff_decoder_parse_charstrings:" - " invoking empty subrs\n" )); - goto Syntax_Error; - } - - decoder->zone = zone; - ip = zone->base; - limit = zone->limit; - } - break; - - case cff_op_callgsubr: - { - FT_UInt idx = (FT_UInt)( ( args[0] >> 16 ) + - decoder->globals_bias ); - - - FT_TRACE4(( " callgsubr (idx %d, entering level %d)\n", - idx, - zone - decoder->zones + 1 )); - - if ( idx >= decoder->num_globals ) - { - FT_ERROR(( "cff_decoder_parse_charstrings:" - " invalid global subr index\n" )); - goto Syntax_Error; - } - - if ( zone - decoder->zones >= CFF_MAX_SUBRS_CALLS ) - { - FT_ERROR(( "cff_decoder_parse_charstrings:" - " too many nested subrs\n" )); - goto Syntax_Error; - } - - zone->cursor = ip; /* save current instruction pointer */ - - zone++; - zone->base = decoder->globals[idx]; - zone->limit = decoder->globals[idx + 1]; - zone->cursor = zone->base; - - if ( !zone->base || zone->limit == zone->base ) - { - FT_ERROR(( "cff_decoder_parse_charstrings:" - " invoking empty subrs\n" )); - goto Syntax_Error; - } - - decoder->zone = zone; - ip = zone->base; - limit = zone->limit; - } - break; - - case cff_op_return: - FT_TRACE4(( " return (leaving level %d)\n", - decoder->zone - decoder->zones )); - - if ( decoder->zone <= decoder->zones ) - { - FT_ERROR(( "cff_decoder_parse_charstrings:" - " unexpected return\n" )); - goto Syntax_Error; - } - - decoder->zone--; - zone = decoder->zone; - ip = zone->cursor; - limit = zone->limit; - break; - - default: - FT_ERROR(( "Unimplemented opcode: %d", ip[-1] )); - - if ( ip[-1] == 12 ) - FT_ERROR(( " %d", ip[0] )); - FT_ERROR(( "\n" )); - - return FT_THROW( Unimplemented_Feature ); - } - - decoder->top = args; - - if ( decoder->top - stack >= CFF_MAX_OPERANDS ) - goto Stack_Overflow; - - } /* general operator processing */ - - } /* while ip < limit */ - - FT_TRACE4(( "..end..\n\n" )); - - Fail: - return error; - - MM_Error: - FT_TRACE4(( "cff_decoder_parse_charstrings:" - " invalid opcode found in top DICT charstring\n")); - return FT_THROW( Invalid_File_Format ); - - Syntax_Error: - FT_TRACE4(( "cff_decoder_parse_charstrings: syntax error\n" )); - return FT_THROW( Invalid_File_Format ); - - Stack_Underflow: - FT_TRACE4(( "cff_decoder_parse_charstrings: stack underflow\n" )); - return FT_THROW( Too_Few_Arguments ); - - Stack_Overflow: - FT_TRACE4(( "cff_decoder_parse_charstrings: stack overflow\n" )); - return FT_THROW( Stack_Overflow ); - } -#endif /* CFF_CONFIG_OPTION_OLD_ENGINE */ /*************************************************************************/ diff --git a/src/cff/cffgload.h b/src/cff/cffgload.h index 0fa93b439..8c8d39704 100644 --- a/src/cff/cffgload.h +++ b/src/cff/cffgload.h @@ -28,14 +28,6 @@ FT_BEGIN_HEADER -#define CFF_MAX_OPERANDS 48 -#define CFF_MAX_SUBRS_CALLS 16 /* maximum subroutine nesting; */ - /* only 10 are allowed but there exist */ - /* fonts like `HiraKakuProN-W3.ttf' */ - /* (Hiragino Kaku Gothic ProN W3; */ - /* 8.2d6e1; 2014-12-19) that exceed */ - /* this limit */ -#define CFF_MAX_TRANS_ELEMENTS 32 /*************************************************************************/ @@ -131,10 +123,6 @@ FT_BEGIN_HEADER FT_LOCAL( void ) cff_builder_close_contour( CFF_Builder* builder ); - - FT_LOCAL( FT_Int ) - cff_lookup_glyph_by_stdcharcode( CFF_Font cff, - FT_Int charcode ); FT_LOCAL( FT_Error ) cff_get_glyph_data( TT_Face face, FT_UInt glyph_index, @@ -146,74 +134,6 @@ FT_BEGIN_HEADER FT_ULong length ); - /* execution context charstring zone */ - - typedef struct CFF_Decoder_Zone_ - { - FT_Byte* base; - FT_Byte* limit; - FT_Byte* cursor; - - } CFF_Decoder_Zone; - - - typedef struct CFF_Decoder_ - { - CFF_Builder builder; - CFF_Font cff; - - FT_Fixed stack[CFF_MAX_OPERANDS + 1]; - FT_Fixed* top; - - CFF_Decoder_Zone zones[CFF_MAX_SUBRS_CALLS + 1]; - CFF_Decoder_Zone* zone; - - FT_Int flex_state; - FT_Int num_flex_vectors; - FT_Vector flex_vectors[7]; - - FT_Pos glyph_width; - FT_Pos nominal_width; - - FT_Bool read_width; - FT_Bool width_only; - FT_Int num_hints; - FT_Fixed buildchar[CFF_MAX_TRANS_ELEMENTS]; - - FT_UInt num_locals; - FT_UInt num_globals; - - FT_Int locals_bias; - FT_Int globals_bias; - - FT_Byte** locals; - FT_Byte** globals; - - FT_Byte** glyph_names; /* for pure CFF fonts only */ - FT_UInt num_glyphs; /* number of glyphs in font */ - - FT_Render_Mode hint_mode; - - FT_Bool seac; - - CFF_SubFont current_subfont; /* for current glyph_index */ - - } CFF_Decoder; - - - FT_LOCAL( void ) - cff_decoder_init( CFF_Decoder* decoder, - TT_Face face, - CFF_Size size, - CFF_GlyphSlot slot, - FT_Bool hinting, - FT_Render_Mode hint_mode ); - - FT_LOCAL( FT_Error ) - cff_decoder_prepare( CFF_Decoder* decoder, - CFF_Size size, - FT_UInt glyph_index ); - #if 0 /* unused until we support pure CFF fonts */ /* Compute the maximum advance width of a font through quick parsing */ @@ -223,13 +143,6 @@ FT_BEGIN_HEADER #endif /* 0 */ -#ifdef CFF_CONFIG_OPTION_OLD_ENGINE - FT_LOCAL( FT_Error ) - cff_decoder_parse_charstrings( CFF_Decoder* decoder, - FT_Byte* charstring_base, - FT_ULong charstring_len, - FT_Bool in_dict ); -#endif FT_LOCAL( FT_Error ) cff_slot_load( CFF_GlyphSlot glyph, diff --git a/src/psaux/cf2ft.h b/src/psaux/cf2ft.h index b054a6e95..772fb0710 100644 --- a/src/psaux/cf2ft.h +++ b/src/psaux/cf2ft.h @@ -50,7 +50,7 @@ #include FT_SYSTEM_H #include "cf2glue.h" -#include "cffgload.h" /* for CFF_Decoder */ +#include FT_INTERNAL_POSTSCRIPT_AUX_H /* for CFF_Decoder */ FT_BEGIN_HEADER diff --git a/src/psaux/cffdecode.c b/src/psaux/cffdecode.c new file mode 100644 index 000000000..e1af544f0 --- /dev/null +++ b/src/psaux/cffdecode.c @@ -0,0 +1,2311 @@ + + +#include + +#include "cffdecode.h" +#include "psobjs.h" + +#include "psauxerr.h" + +#ifdef CFF_CONFIG_OPTION_OLD_ENGINE + + typedef enum CFF_Operator_ + { + cff_op_unknown = 0, + + cff_op_rmoveto, + cff_op_hmoveto, + cff_op_vmoveto, + + cff_op_rlineto, + cff_op_hlineto, + cff_op_vlineto, + + cff_op_rrcurveto, + cff_op_hhcurveto, + cff_op_hvcurveto, + cff_op_rcurveline, + cff_op_rlinecurve, + cff_op_vhcurveto, + cff_op_vvcurveto, + + cff_op_flex, + cff_op_hflex, + cff_op_hflex1, + cff_op_flex1, + + cff_op_endchar, + + cff_op_hstem, + cff_op_vstem, + cff_op_hstemhm, + cff_op_vstemhm, + + cff_op_hintmask, + cff_op_cntrmask, + cff_op_dotsection, /* deprecated, acts as no-op */ + + cff_op_abs, + cff_op_add, + cff_op_sub, + cff_op_div, + cff_op_neg, + cff_op_random, + cff_op_mul, + cff_op_sqrt, + + cff_op_blend, + + cff_op_drop, + cff_op_exch, + cff_op_index, + cff_op_roll, + cff_op_dup, + + cff_op_put, + cff_op_get, + cff_op_store, + cff_op_load, + + cff_op_and, + cff_op_or, + cff_op_not, + cff_op_eq, + cff_op_ifelse, + + cff_op_callsubr, + cff_op_callgsubr, + cff_op_return, + + /* Type 1 opcodes: invalid but seen in real life */ + cff_op_hsbw, + cff_op_closepath, + cff_op_callothersubr, + cff_op_pop, + cff_op_seac, + cff_op_sbw, + cff_op_setcurrentpoint, + + /* do not remove */ + cff_op_max + + } CFF_Operator; + + +#define CFF_COUNT_CHECK_WIDTH 0x80 +#define CFF_COUNT_EXACT 0x40 +#define CFF_COUNT_CLEAR_STACK 0x20 + + /* count values which have the `CFF_COUNT_CHECK_WIDTH' flag set are */ + /* used for checking the width and requested numbers of arguments */ + /* only; they are set to zero afterwards */ + + /* the other two flags are informative only and unused currently */ + + static const FT_Byte cff_argument_counts[] = + { + 0, /* unknown */ + + 2 | CFF_COUNT_CHECK_WIDTH | CFF_COUNT_EXACT, /* rmoveto */ + 1 | CFF_COUNT_CHECK_WIDTH | CFF_COUNT_EXACT, + 1 | CFF_COUNT_CHECK_WIDTH | CFF_COUNT_EXACT, + + 0 | CFF_COUNT_CLEAR_STACK, /* rlineto */ + 0 | CFF_COUNT_CLEAR_STACK, + 0 | CFF_COUNT_CLEAR_STACK, + + 0 | CFF_COUNT_CLEAR_STACK, /* rrcurveto */ + 0 | CFF_COUNT_CLEAR_STACK, + 0 | CFF_COUNT_CLEAR_STACK, + 0 | CFF_COUNT_CLEAR_STACK, + 0 | CFF_COUNT_CLEAR_STACK, + 0 | CFF_COUNT_CLEAR_STACK, + 0 | CFF_COUNT_CLEAR_STACK, + + 13, /* flex */ + 7, + 9, + 11, + + 0 | CFF_COUNT_CHECK_WIDTH, /* endchar */ + + 2 | CFF_COUNT_CHECK_WIDTH, /* hstem */ + 2 | CFF_COUNT_CHECK_WIDTH, + 2 | CFF_COUNT_CHECK_WIDTH, + 2 | CFF_COUNT_CHECK_WIDTH, + + 0 | CFF_COUNT_CHECK_WIDTH, /* hintmask */ + 0 | CFF_COUNT_CHECK_WIDTH, /* cntrmask */ + 0, /* dotsection */ + + 1, /* abs */ + 2, + 2, + 2, + 1, + 0, + 2, + 1, + + 1, /* blend */ + + 1, /* drop */ + 2, + 1, + 2, + 1, + + 2, /* put */ + 1, + 4, + 3, + + 2, /* and */ + 2, + 1, + 2, + 4, + + 1, /* callsubr */ + 1, + 0, + + 2, /* hsbw */ + 0, + 0, + 0, + 5, /* seac */ + 4, /* sbw */ + 2 /* setcurrentpoint */ + }; + + static FT_Error + cff_operator_seac( CFF_Decoder* decoder, + FT_Pos asb, + FT_Pos adx, + FT_Pos ady, + FT_Int bchar, + FT_Int achar ) + { + FT_Error error; + CFF_Builder* builder = &decoder->builder; + FT_Int bchar_index, achar_index; + TT_Face face = decoder->builder.face; + FT_Vector left_bearing, advance; + FT_Byte* charstring; + FT_ULong charstring_len; + FT_Pos glyph_width; + + + if ( decoder->seac ) + { + FT_ERROR(( "cff_operator_seac: invalid nested seac\n" )); + return FT_THROW( 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. */ + if ( face->root.internal->incremental_interface ) + { + bchar_index = bchar; + achar_index = achar; + } + else +#endif /* FT_CONFIG_OPTION_INCREMENTAL */ + { + CFF_Font cff = (CFF_Font)(face->extra.data); + + + bchar_index = cff_lookup_glyph_by_stdcharcode( cff, bchar ); + achar_index = cff_lookup_glyph_by_stdcharcode( cff, achar ); + } + + if ( bchar_index < 0 || achar_index < 0 ) + { + FT_ERROR(( "cff_operator_seac:" + " invalid seac character code arguments\n" )); + return FT_THROW( Syntax_Error ); + } + + /* If we are trying to load a composite glyph, do not load the */ + /* accent character and return the array of subglyphs. */ + if ( builder->no_recurse ) + { + FT_GlyphSlot glyph = (FT_GlyphSlot)builder->glyph; + FT_GlyphLoader loader = glyph->internal->loader; + FT_SubGlyph subg; + + + /* reallocate subglyph array if necessary */ + error = FT_GlyphLoader_CheckSubGlyphs( loader, 2 ); + if ( error ) + goto Exit; + + subg = loader->current.subglyphs; + + /* subglyph 0 = base character */ + subg->index = bchar_index; + subg->flags = FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES | + FT_SUBGLYPH_FLAG_USE_MY_METRICS; + subg->arg1 = 0; + subg->arg2 = 0; + subg++; + + /* subglyph 1 = accent character */ + subg->index = achar_index; + subg->flags = FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES; + subg->arg1 = (FT_Int)( adx >> 16 ); + subg->arg2 = (FT_Int)( ady >> 16 ); + + /* set up remaining glyph fields */ + glyph->num_subglyphs = 2; + glyph->subglyphs = loader->base.subglyphs; + glyph->format = FT_GLYPH_FORMAT_COMPOSITE; + + loader->current.num_subglyphs = 2; + } + + FT_GlyphLoader_Prepare( builder->loader ); + + /* First load `bchar' in builder */ + error = cff_get_glyph_data( face, (FT_UInt)bchar_index, + &charstring, &charstring_len ); + if ( !error ) + { + /* the seac operator must not be nested */ + decoder->seac = TRUE; + error = cff_decoder_parse_charstrings( decoder, charstring, + charstring_len, 0 ); + decoder->seac = FALSE; + + cff_free_glyph_data( face, &charstring, charstring_len ); + + if ( error ) + goto Exit; + } + + /* 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 - asb; + builder->pos_y = ady; + + /* Now load `achar' on top of the base outline. */ + error = cff_get_glyph_data( face, (FT_UInt)achar_index, + &charstring, &charstring_len ); + if ( !error ) + { + /* the seac operator must not be nested */ + decoder->seac = TRUE; + error = cff_decoder_parse_charstrings( decoder, charstring, + charstring_len, 0 ); + decoder->seac = FALSE; + + cff_free_glyph_data( face, &charstring, charstring_len ); + + if ( error ) + goto Exit; + } + + /* 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; + + Exit: + return error; + } + + +#endif /* CFF_CONFIG_OPTION_OLD_ENGINE */ + + + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + /********** *********/ + /********** *********/ + /********** GENERIC CHARSTRING PARSING *********/ + /********** *********/ + /********** *********/ + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + + /*************************************************************************/ + /* */ + /* */ + /* cff_compute_bias */ + /* */ + /* */ + /* Computes the bias value in dependence of the number of glyph */ + /* subroutines. */ + /* */ + /* */ + /* in_charstring_type :: The `CharstringType' value of the top DICT */ + /* dictionary. */ + /* */ + /* num_subrs :: The number of glyph subroutines. */ + /* */ + /* */ + /* The bias value. */ + static FT_Int + cff_compute_bias( FT_Int in_charstring_type, + FT_UInt num_subrs ) + { + FT_Int result; + + + if ( in_charstring_type == 1 ) + result = 0; + else if ( num_subrs < 1240 ) + result = 107; + else if ( num_subrs < 33900U ) + result = 1131; + else + result = 32768U; + + return result; + } + + + FT_LOCAL_DEF( FT_Int ) + cff_lookup_glyph_by_stdcharcode( CFF_Font cff, + FT_Int charcode ) + { + FT_UInt n; + FT_UShort glyph_sid; + + + /* CID-keyed fonts don't have glyph names */ + if ( !cff->charset.sids ) + return -1; + + /* check range of standard char code */ + if ( charcode < 0 || charcode > 255 ) + return -1; + + /* Get code to SID mapping from `cff_standard_encoding'. */ + glyph_sid = cff_get_standard_encoding( (FT_UInt)charcode ); + + for ( n = 0; n < cff->num_glyphs; n++ ) + { + if ( cff->charset.sids[n] == glyph_sid ) + return (FT_Int)n; + } + + return -1; + } + +#ifdef CFF_CONFIG_OPTION_OLD_ENGINE + + /*************************************************************************/ + /* */ + /* */ + /* cff_decoder_parse_charstrings */ + /* */ + /* */ + /* Parses a given Type 2 charstrings program. */ + /* */ + /* */ + /* decoder :: The current Type 1 decoder. */ + /* */ + /* */ + /* charstring_base :: The base of the charstring stream. */ + /* */ + /* charstring_len :: The length in bytes of the charstring stream. */ + /* */ + /* in_dict :: Set to 1 if function is called from top or */ + /* private DICT (needed for Multiple Master CFFs). */ + /* */ + /* */ + /* FreeType error code. 0 means success. */ + /* */ + FT_LOCAL_DEF( FT_Error ) + cff_decoder_parse_charstrings( CFF_Decoder* decoder, + FT_Byte* charstring_base, + FT_ULong charstring_len, + FT_Bool in_dict ) + { + FT_Error error; + CFF_Decoder_Zone* zone; + FT_Byte* ip; + FT_Byte* limit; + CFF_Builder* builder = &decoder->builder; + FT_Pos x, y; + FT_Fixed* stack; + FT_Int charstring_type = + decoder->cff->top_font.font_dict.charstring_type; + FT_UShort num_designs = + decoder->cff->top_font.font_dict.num_designs; + FT_UShort num_axes = + decoder->cff->top_font.font_dict.num_axes; + + T2_Hints_Funcs hinter; + + + /* set default width */ + decoder->num_hints = 0; + decoder->read_width = 1; + + /* initialize the decoder */ + decoder->top = decoder->stack; + decoder->zone = decoder->zones; + zone = decoder->zones; + stack = decoder->top; + + hinter = (T2_Hints_Funcs)builder->hints_funcs; + + builder->path_begun = 0; + + zone->base = charstring_base; + limit = zone->limit = charstring_base + charstring_len; + ip = zone->cursor = zone->base; + + error = FT_Err_Ok; + + x = builder->pos_x; + y = builder->pos_y; + + /* begin hints recording session, if any */ + if ( hinter ) + hinter->open( hinter->hints ); + + /* now execute loop */ + while ( ip < limit ) + { + CFF_Operator op; + FT_Byte v; + + + /********************************************************************/ + /* */ + /* Decode operator or operand */ + /* */ + v = *ip++; + if ( v >= 32 || v == 28 ) + { + FT_Int shift = 16; + FT_Int32 val; + + + /* this is an operand, push it on the stack */ + + /* if we use shifts, all computations are done with unsigned */ + /* values; the conversion to a signed value is the last step */ + if ( v == 28 ) + { + if ( ip + 1 >= limit ) + goto Syntax_Error; + val = (FT_Short)( ( (FT_UShort)ip[0] << 8 ) | ip[1] ); + ip += 2; + } + else if ( v < 247 ) + val = (FT_Int32)v - 139; + else if ( v < 251 ) + { + if ( ip >= limit ) + goto Syntax_Error; + val = ( (FT_Int32)v - 247 ) * 256 + *ip++ + 108; + } + else if ( v < 255 ) + { + if ( ip >= limit ) + goto Syntax_Error; + val = -( (FT_Int32)v - 251 ) * 256 - *ip++ - 108; + } + else + { + if ( ip + 3 >= limit ) + goto Syntax_Error; + val = (FT_Int32)( ( (FT_UInt32)ip[0] << 24 ) | + ( (FT_UInt32)ip[1] << 16 ) | + ( (FT_UInt32)ip[2] << 8 ) | + (FT_UInt32)ip[3] ); + ip += 4; + if ( charstring_type == 2 ) + shift = 0; + } + if ( decoder->top - stack >= CFF_MAX_OPERANDS ) + goto Stack_Overflow; + + val = (FT_Int32)( (FT_UInt32)val << shift ); + *decoder->top++ = val; + +#ifdef FT_DEBUG_LEVEL_TRACE + if ( !( val & 0xFFFFL ) ) + FT_TRACE4(( " %hd", (FT_Short)( (FT_UInt32)val >> 16 ) )); + else + FT_TRACE4(( " %.5f", val / 65536.0 )); +#endif + + } + else + { + /* The specification says that normally arguments are to be taken */ + /* from the bottom of the stack. However, this seems not to be */ + /* correct, at least for Acroread 7.0.8 on GNU/Linux: It pops the */ + /* arguments similar to a PS interpreter. */ + + FT_Fixed* args = decoder->top; + FT_Int num_args = (FT_Int)( args - decoder->stack ); + FT_Int req_args; + + + /* find operator */ + op = cff_op_unknown; + + switch ( v ) + { + case 1: + op = cff_op_hstem; + break; + case 3: + op = cff_op_vstem; + break; + case 4: + op = cff_op_vmoveto; + break; + case 5: + op = cff_op_rlineto; + break; + case 6: + op = cff_op_hlineto; + break; + case 7: + op = cff_op_vlineto; + break; + case 8: + op = cff_op_rrcurveto; + break; + case 9: + op = cff_op_closepath; + break; + case 10: + op = cff_op_callsubr; + break; + case 11: + op = cff_op_return; + break; + case 12: + { + if ( ip >= limit ) + goto Syntax_Error; + v = *ip++; + + switch ( v ) + { + 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; + case 4: + op = cff_op_or; + break; + 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; + case 9: + op = cff_op_abs; + break; + case 10: + op = cff_op_add; + break; + case 11: + op = cff_op_sub; + break; + case 12: + op = cff_op_div; + break; + case 13: + op = cff_op_load; + break; + case 14: + op = cff_op_neg; + break; + case 15: + op = cff_op_eq; + break; + case 16: + op = cff_op_callothersubr; + break; + case 17: + op = cff_op_pop; + break; + case 18: + op = cff_op_drop; + break; + case 20: + op = cff_op_put; + break; + case 21: + op = cff_op_get; + break; + case 22: + op = cff_op_ifelse; + break; + case 23: + op = cff_op_random; + break; + case 24: + op = cff_op_mul; + break; + case 26: + op = cff_op_sqrt; + break; + case 27: + op = cff_op_dup; + break; + case 28: + op = cff_op_exch; + break; + case 29: + op = cff_op_index; + break; + case 30: + op = cff_op_roll; + break; + case 33: + op = cff_op_setcurrentpoint; + break; + case 34: + op = cff_op_hflex; + break; + case 35: + op = cff_op_flex; + break; + case 36: + op = cff_op_hflex1; + break; + case 37: + op = cff_op_flex1; + break; + default: + FT_TRACE4(( " unknown op (12, %d)\n", v )); + break; + } + } + break; + case 13: + op = cff_op_hsbw; + break; + case 14: + op = cff_op_endchar; + break; + case 16: + op = cff_op_blend; + break; + case 18: + op = cff_op_hstemhm; + break; + case 19: + op = cff_op_hintmask; + break; + case 20: + op = cff_op_cntrmask; + break; + case 21: + op = cff_op_rmoveto; + break; + case 22: + op = cff_op_hmoveto; + break; + case 23: + op = cff_op_vstemhm; + break; + case 24: + op = cff_op_rcurveline; + break; + case 25: + op = cff_op_rlinecurve; + break; + case 26: + op = cff_op_vvcurveto; + break; + case 27: + op = cff_op_hhcurveto; + break; + case 29: + op = cff_op_callgsubr; + break; + case 30: + op = cff_op_vhcurveto; + break; + case 31: + op = cff_op_hvcurveto; + break; + default: + FT_TRACE4(( " unknown op (%d)\n", v )); + break; + } + + if ( op == cff_op_unknown ) + continue; + + /* in Multiple Master CFFs, T2 charstrings can appear in */ + /* dictionaries, but some operators are prohibited */ + if ( in_dict ) + { + switch ( op ) + { + case cff_op_hstem: + case cff_op_vstem: + case cff_op_vmoveto: + case cff_op_rlineto: + case cff_op_hlineto: + case cff_op_vlineto: + case cff_op_rrcurveto: + case cff_op_hstemhm: + case cff_op_hintmask: + case cff_op_cntrmask: + case cff_op_rmoveto: + case cff_op_hmoveto: + case cff_op_vstemhm: + case cff_op_rcurveline: + case cff_op_rlinecurve: + case cff_op_vvcurveto: + case cff_op_hhcurveto: + case cff_op_vhcurveto: + case cff_op_hvcurveto: + case cff_op_hflex: + case cff_op_flex: + case cff_op_hflex1: + case cff_op_flex1: + case cff_op_callsubr: + case cff_op_callgsubr: + goto MM_Error; + + default: + break; + } + } + + /* check arguments */ + req_args = cff_argument_counts[op]; + if ( req_args & CFF_COUNT_CHECK_WIDTH ) + { + if ( num_args > 0 && decoder->read_width ) + { + /* If `nominal_width' is non-zero, the number is really a */ + /* difference against `nominal_width'. Else, the number here */ + /* is truly a width, not a difference against `nominal_width'. */ + /* If the font does not set `nominal_width', then */ + /* `nominal_width' defaults to zero, and so we can set */ + /* `glyph_width' to `nominal_width' plus number on the stack */ + /* -- for either case. */ + + FT_Int set_width_ok; + + + switch ( op ) + { + case cff_op_hmoveto: + case cff_op_vmoveto: + set_width_ok = num_args & 2; + break; + + case cff_op_hstem: + case cff_op_vstem: + case cff_op_hstemhm: + case cff_op_vstemhm: + case cff_op_rmoveto: + case cff_op_hintmask: + case cff_op_cntrmask: + set_width_ok = num_args & 1; + break; + + case cff_op_endchar: + /* If there is a width specified for endchar, we either have */ + /* 1 argument or 5 arguments. We like to argue. */ + set_width_ok = in_dict + ? 0 + : ( ( num_args == 5 ) || ( num_args == 1 ) ); + break; + + default: + set_width_ok = 0; + break; + } + + if ( set_width_ok ) + { + decoder->glyph_width = decoder->nominal_width + + ( stack[0] >> 16 ); + + if ( decoder->width_only ) + { + /* we only want the advance width; stop here */ + break; + } + + /* Consumed an argument. */ + num_args--; + } + } + + decoder->read_width = 0; + req_args = 0; + } + + req_args &= 0x000F; + if ( num_args < req_args ) + goto Stack_Underflow; + args -= req_args; + num_args -= req_args; + + /* At this point, `args' points to the first argument of the */ + /* operand in case `req_args' isn't zero. Otherwise, we have */ + /* to adjust `args' manually. */ + + /* Note that we only pop arguments from the stack which we */ + /* really need and can digest so that we can continue in case */ + /* of superfluous stack elements. */ + + switch ( op ) + { + case cff_op_hstem: + case cff_op_vstem: + case cff_op_hstemhm: + case cff_op_vstemhm: + /* the number of arguments is always even here */ + FT_TRACE4(( + op == cff_op_hstem ? " hstem\n" : + ( op == cff_op_vstem ? " vstem\n" : + ( op == cff_op_hstemhm ? " hstemhm\n" : " vstemhm\n" ) ) )); + + if ( hinter ) + hinter->stems( hinter->hints, + ( op == cff_op_hstem || op == cff_op_hstemhm ), + num_args / 2, + args - ( num_args & ~1 ) ); + + decoder->num_hints += num_args / 2; + args = stack; + break; + + case cff_op_hintmask: + case cff_op_cntrmask: + FT_TRACE4(( op == cff_op_hintmask ? " hintmask" : " cntrmask" )); + + /* implement vstem when needed -- */ + /* the specification doesn't say it, but this also works */ + /* with the 'cntrmask' operator */ + /* */ + if ( num_args > 0 ) + { + if ( hinter ) + hinter->stems( hinter->hints, + 0, + num_args / 2, + args - ( num_args & ~1 ) ); + + decoder->num_hints += num_args / 2; + } + + /* In a valid charstring there must be at least one byte */ + /* after `hintmask' or `cntrmask' (e.g., for a `return' */ + /* instruction). Additionally, there must be space for */ + /* `num_hints' bits. */ + + if ( ( ip + ( ( decoder->num_hints + 7 ) >> 3 ) ) >= limit ) + goto Syntax_Error; + + if ( hinter ) + { + if ( op == cff_op_hintmask ) + hinter->hintmask( hinter->hints, + (FT_UInt)builder->current->n_points, + (FT_UInt)decoder->num_hints, + ip ); + else + hinter->counter( hinter->hints, + (FT_UInt)decoder->num_hints, + ip ); + } + +#ifdef FT_DEBUG_LEVEL_TRACE + { + FT_UInt maskbyte; + + + FT_TRACE4(( " (maskbytes:" )); + + for ( maskbyte = 0; + maskbyte < (FT_UInt)( ( decoder->num_hints + 7 ) >> 3 ); + maskbyte++, ip++ ) + FT_TRACE4(( " 0x%02X", *ip )); + + FT_TRACE4(( ")\n" )); + } +#else + ip += ( decoder->num_hints + 7 ) >> 3; +#endif + args = stack; + break; + + case cff_op_rmoveto: + FT_TRACE4(( " rmoveto\n" )); + + cff_builder_close_contour( builder ); + builder->path_begun = 0; + x = ADD_LONG( x, args[-2] ); + y = ADD_LONG( y, args[-1] ); + args = stack; + break; + + case cff_op_vmoveto: + FT_TRACE4(( " vmoveto\n" )); + + cff_builder_close_contour( builder ); + builder->path_begun = 0; + y = ADD_LONG( y, args[-1] ); + args = stack; + break; + + case cff_op_hmoveto: + FT_TRACE4(( " hmoveto\n" )); + + cff_builder_close_contour( builder ); + builder->path_begun = 0; + x = ADD_LONG( x, args[-1] ); + args = stack; + break; + + case cff_op_rlineto: + FT_TRACE4(( " rlineto\n" )); + + if ( cff_builder_start_point( builder, x, y ) || + cff_check_points( builder, num_args / 2 ) ) + goto Fail; + + if ( num_args < 2 ) + goto Stack_Underflow; + + args -= num_args & ~1; + while ( args < decoder->top ) + { + x = ADD_LONG( x, args[0] ); + y = ADD_LONG( y, args[1] ); + cff_builder_add_point( builder, x, y, 1 ); + args += 2; + } + args = stack; + break; + + case cff_op_hlineto: + case cff_op_vlineto: + { + FT_Int phase = ( op == cff_op_hlineto ); + + + FT_TRACE4(( op == cff_op_hlineto ? " hlineto\n" + : " vlineto\n" )); + + if ( num_args < 0 ) + goto Stack_Underflow; + + /* there exist subsetted fonts (found in PDFs) */ + /* which call `hlineto' without arguments */ + if ( num_args == 0 ) + break; + + if ( cff_builder_start_point( builder, x, y ) || + cff_check_points( builder, num_args ) ) + goto Fail; + + args = stack; + while ( args < decoder->top ) + { + if ( phase ) + x = ADD_LONG( x, args[0] ); + else + y = ADD_LONG( y, args[0] ); + + if ( cff_builder_add_point1( builder, x, y ) ) + goto Fail; + + args++; + phase ^= 1; + } + args = stack; + } + break; + + case cff_op_rrcurveto: + { + FT_Int nargs; + + + FT_TRACE4(( " rrcurveto\n" )); + + if ( num_args < 6 ) + goto Stack_Underflow; + + nargs = num_args - num_args % 6; + + if ( cff_builder_start_point( builder, x, y ) || + cff_check_points( builder, nargs / 2 ) ) + goto Fail; + + args -= nargs; + while ( args < decoder->top ) + { + x = ADD_LONG( x, args[0] ); + y = ADD_LONG( y, args[1] ); + cff_builder_add_point( builder, x, y, 0 ); + + x = ADD_LONG( x, args[2] ); + y = ADD_LONG( y, args[3] ); + cff_builder_add_point( builder, x, y, 0 ); + + x = ADD_LONG( x, args[4] ); + y = ADD_LONG( y, args[5] ); + cff_builder_add_point( builder, x, y, 1 ); + + args += 6; + } + args = stack; + } + break; + + case cff_op_vvcurveto: + { + FT_Int nargs; + + + FT_TRACE4(( " vvcurveto\n" )); + + if ( num_args < 4 ) + goto Stack_Underflow; + + /* if num_args isn't of the form 4n or 4n+1, */ + /* we enforce it by clearing the second bit */ + + nargs = num_args & ~2; + + if ( cff_builder_start_point( builder, x, y ) ) + goto Fail; + + args -= nargs; + + if ( nargs & 1 ) + { + x = ADD_LONG( x, args[0] ); + args++; + nargs--; + } + + if ( cff_check_points( builder, 3 * ( nargs / 4 ) ) ) + goto Fail; + + while ( args < decoder->top ) + { + y = ADD_LONG( y, args[0] ); + cff_builder_add_point( builder, x, y, 0 ); + + x = ADD_LONG( x, args[1] ); + y = ADD_LONG( y, args[2] ); + cff_builder_add_point( builder, x, y, 0 ); + + y = ADD_LONG( y, args[3] ); + cff_builder_add_point( builder, x, y, 1 ); + + args += 4; + } + args = stack; + } + break; + + case cff_op_hhcurveto: + { + FT_Int nargs; + + + FT_TRACE4(( " hhcurveto\n" )); + + if ( num_args < 4 ) + goto Stack_Underflow; + + /* if num_args isn't of the form 4n or 4n+1, */ + /* we enforce it by clearing the second bit */ + + nargs = num_args & ~2; + + if ( cff_builder_start_point( builder, x, y ) ) + goto Fail; + + args -= nargs; + if ( nargs & 1 ) + { + y = ADD_LONG( y, args[0] ); + args++; + nargs--; + } + + if ( cff_check_points( builder, 3 * ( nargs / 4 ) ) ) + goto Fail; + + while ( args < decoder->top ) + { + x = ADD_LONG( x, args[0] ); + cff_builder_add_point( builder, x, y, 0 ); + + x = ADD_LONG( x, args[1] ); + y = ADD_LONG( y, args[2] ); + cff_builder_add_point( builder, x, y, 0 ); + + x = ADD_LONG( x, args[3] ); + cff_builder_add_point( builder, x, y, 1 ); + + args += 4; + } + args = stack; + } + break; + + case cff_op_vhcurveto: + case cff_op_hvcurveto: + { + FT_Int phase; + FT_Int nargs; + + + FT_TRACE4(( op == cff_op_vhcurveto ? " vhcurveto\n" + : " hvcurveto\n" )); + + if ( cff_builder_start_point( builder, x, y ) ) + goto Fail; + + if ( num_args < 4 ) + goto Stack_Underflow; + + /* if num_args isn't of the form 8n, 8n+1, 8n+4, or 8n+5, */ + /* we enforce it by clearing the second bit */ + + nargs = num_args & ~2; + + args -= nargs; + if ( cff_check_points( builder, ( nargs / 4 ) * 3 ) ) + goto Stack_Underflow; + + phase = ( op == cff_op_hvcurveto ); + + while ( nargs >= 4 ) + { + nargs -= 4; + if ( phase ) + { + x = ADD_LONG( x, args[0] ); + cff_builder_add_point( builder, x, y, 0 ); + + x = ADD_LONG( x, args[1] ); + y = ADD_LONG( y, args[2] ); + cff_builder_add_point( builder, x, y, 0 ); + + y = ADD_LONG( y, args[3] ); + if ( nargs == 1 ) + x = ADD_LONG( x, args[4] ); + cff_builder_add_point( builder, x, y, 1 ); + } + else + { + y = ADD_LONG( y, args[0] ); + cff_builder_add_point( builder, x, y, 0 ); + + x = ADD_LONG( x, args[1] ); + y = ADD_LONG( y, args[2] ); + cff_builder_add_point( builder, x, y, 0 ); + + x = ADD_LONG( x, args[3] ); + if ( nargs == 1 ) + y = ADD_LONG( y, args[4] ); + cff_builder_add_point( builder, x, y, 1 ); + } + args += 4; + phase ^= 1; + } + args = stack; + } + break; + + case cff_op_rlinecurve: + { + FT_Int num_lines; + FT_Int nargs; + + + FT_TRACE4(( " rlinecurve\n" )); + + if ( num_args < 8 ) + goto Stack_Underflow; + + nargs = num_args & ~1; + num_lines = ( nargs - 6 ) / 2; + + if ( cff_builder_start_point( builder, x, y ) || + cff_check_points( builder, num_lines + 3 ) ) + goto Fail; + + args -= nargs; + + /* first, add the line segments */ + while ( num_lines > 0 ) + { + x = ADD_LONG( x, args[0] ); + y = ADD_LONG( y, args[1] ); + cff_builder_add_point( builder, x, y, 1 ); + + args += 2; + num_lines--; + } + + /* then the curve */ + x = ADD_LONG( x, args[0] ); + y = ADD_LONG( y, args[1] ); + cff_builder_add_point( builder, x, y, 0 ); + + x = ADD_LONG( x, args[2] ); + y = ADD_LONG( y, args[3] ); + cff_builder_add_point( builder, x, y, 0 ); + + x = ADD_LONG( x, args[4] ); + y = ADD_LONG( y, args[5] ); + cff_builder_add_point( builder, x, y, 1 ); + + args = stack; + } + break; + + case cff_op_rcurveline: + { + FT_Int num_curves; + FT_Int nargs; + + + FT_TRACE4(( " rcurveline\n" )); + + if ( num_args < 8 ) + goto Stack_Underflow; + + nargs = num_args - 2; + nargs = nargs - nargs % 6 + 2; + num_curves = ( nargs - 2 ) / 6; + + if ( cff_builder_start_point( builder, x, y ) || + cff_check_points( builder, num_curves * 3 + 2 ) ) + goto Fail; + + args -= nargs; + + /* first, add the curves */ + while ( num_curves > 0 ) + { + x = ADD_LONG( x, args[0] ); + y = ADD_LONG( y, args[1] ); + cff_builder_add_point( builder, x, y, 0 ); + + x = ADD_LONG( x, args[2] ); + y = ADD_LONG( y, args[3] ); + cff_builder_add_point( builder, x, y, 0 ); + + x = ADD_LONG( x, args[4] ); + y = ADD_LONG( y, args[5] ); + cff_builder_add_point( builder, x, y, 1 ); + + args += 6; + num_curves--; + } + + /* then the final line */ + x = ADD_LONG( x, args[0] ); + y = ADD_LONG( y, args[1] ); + cff_builder_add_point( builder, x, y, 1 ); + + args = stack; + } + break; + + case cff_op_hflex1: + { + FT_Pos start_y; + + + FT_TRACE4(( " hflex1\n" )); + + /* adding five more points: 4 control points, 1 on-curve point */ + /* -- make sure we have enough space for the start point if it */ + /* needs to be added */ + if ( cff_builder_start_point( builder, x, y ) || + cff_check_points( builder, 6 ) ) + goto Fail; + + /* record the starting point's y position for later use */ + start_y = y; + + /* first control point */ + x = ADD_LONG( x, args[0] ); + y = ADD_LONG( y, args[1] ); + cff_builder_add_point( builder, x, y, 0 ); + + /* second control point */ + x = ADD_LONG( x, args[2] ); + y = ADD_LONG( y, args[3] ); + cff_builder_add_point( builder, x, y, 0 ); + + /* join point; on curve, with y-value the same as the last */ + /* control point's y-value */ + x = ADD_LONG( x, args[4] ); + cff_builder_add_point( builder, x, y, 1 ); + + /* third control point, with y-value the same as the join */ + /* point's y-value */ + x = ADD_LONG( x, args[5] ); + cff_builder_add_point( builder, x, y, 0 ); + + /* fourth control point */ + x = ADD_LONG( x, args[6] ); + y = ADD_LONG( y, args[7] ); + cff_builder_add_point( builder, x, y, 0 ); + + /* ending point, with y-value the same as the start */ + x = ADD_LONG( x, args[8] ); + y = start_y; + cff_builder_add_point( builder, x, y, 1 ); + + args = stack; + break; + } + + case cff_op_hflex: + { + FT_Pos start_y; + + + FT_TRACE4(( " hflex\n" )); + + /* adding six more points; 4 control points, 2 on-curve points */ + if ( cff_builder_start_point( builder, x, y ) || + cff_check_points( builder, 6 ) ) + goto Fail; + + /* record the starting point's y-position for later use */ + start_y = y; + + /* first control point */ + x = ADD_LONG( x, args[0] ); + cff_builder_add_point( builder, x, y, 0 ); + + /* second control point */ + x = ADD_LONG( x, args[1] ); + y = ADD_LONG( y, args[2] ); + cff_builder_add_point( builder, x, y, 0 ); + + /* join point; on curve, with y-value the same as the last */ + /* control point's y-value */ + x = ADD_LONG( x, args[3] ); + cff_builder_add_point( builder, x, y, 1 ); + + /* third control point, with y-value the same as the join */ + /* point's y-value */ + x = ADD_LONG( x, args[4] ); + cff_builder_add_point( builder, x, y, 0 ); + + /* fourth control point */ + x = ADD_LONG( x, args[5] ); + y = start_y; + cff_builder_add_point( builder, x, y, 0 ); + + /* ending point, with y-value the same as the start point's */ + /* y-value -- we don't add this point, though */ + x = ADD_LONG( x, args[6] ); + cff_builder_add_point( builder, x, y, 1 ); + + args = stack; + break; + } + + case cff_op_flex1: + { + FT_Pos start_x, start_y; /* record start x, y values for */ + /* alter use */ + FT_Fixed dx = 0, dy = 0; /* used in horizontal/vertical */ + /* algorithm below */ + FT_Int horizontal, count; + FT_Fixed* temp; + + + FT_TRACE4(( " flex1\n" )); + + /* adding six more points; 4 control points, 2 on-curve points */ + if ( cff_builder_start_point( builder, x, y ) || + cff_check_points( builder, 6 ) ) + goto Fail; + + /* record the starting point's x, y position for later use */ + start_x = x; + start_y = y; + + /* XXX: figure out whether this is supposed to be a horizontal */ + /* or vertical flex; the Type 2 specification is vague... */ + + temp = args; + + /* grab up to the last argument */ + for ( count = 5; count > 0; count-- ) + { + dx = ADD_LONG( dx, temp[0] ); + dy = ADD_LONG( dy, temp[1] ); + temp += 2; + } + + if ( dx < 0 ) + dx = -dx; + if ( dy < 0 ) + dy = -dy; + + /* strange test, but here it is... */ + horizontal = ( dx > dy ); + + for ( count = 5; count > 0; count-- ) + { + x = ADD_LONG( x, args[0] ); + y = ADD_LONG( y, args[1] ); + cff_builder_add_point( builder, x, y, + (FT_Bool)( count == 3 ) ); + args += 2; + } + + /* is last operand an x- or y-delta? */ + if ( horizontal ) + { + x = ADD_LONG( x, args[0] ); + y = start_y; + } + else + { + x = start_x; + y = ADD_LONG( y, args[0] ); + } + + cff_builder_add_point( builder, x, y, 1 ); + + args = stack; + break; + } + + case cff_op_flex: + { + FT_UInt count; + + + FT_TRACE4(( " flex\n" )); + + if ( cff_builder_start_point( builder, x, y ) || + cff_check_points( builder, 6 ) ) + goto Fail; + + for ( count = 6; count > 0; count-- ) + { + x = ADD_LONG( x, args[0] ); + y = ADD_LONG( y, args[1] ); + cff_builder_add_point( builder, x, y, + (FT_Bool)( count == 4 || count == 1 ) ); + args += 2; + } + + args = stack; + } + 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: + /* in dictionaries, `endchar' simply indicates end of data */ + if ( in_dict ) + return error; + + FT_TRACE4(( " endchar\n" )); + + /* We are going to emulate the seac operator. */ + if ( num_args >= 4 ) + { + /* Save glyph width so that the subglyphs don't overwrite it. */ + FT_Pos glyph_width = decoder->glyph_width; + + + error = cff_operator_seac( decoder, + 0L, args[-4], args[-3], + (FT_Int)( args[-2] >> 16 ), + (FT_Int)( args[-1] >> 16 ) ); + + decoder->glyph_width = glyph_width; + } + else + { + cff_builder_close_contour( builder ); + + /* close hints recording session */ + if ( hinter ) + { + if ( hinter->close( hinter->hints, + (FT_UInt)builder->current->n_points ) ) + goto Syntax_Error; + + /* apply hints to the loaded glyph outline now */ + error = hinter->apply( hinter->hints, + builder->current, + (PSH_Globals)builder->hints_globals, + decoder->hint_mode ); + if ( error ) + goto Fail; + } + + /* add current outline to the glyph slot */ + FT_GlyphLoader_Add( builder->loader ); + } + + /* return now! */ + FT_TRACE4(( "\n" )); + return error; + + case cff_op_abs: + FT_TRACE4(( " abs\n" )); + + if ( args[0] < 0 ) + { + if ( args[0] == FT_LONG_MIN ) + args[0] = FT_LONG_MAX; + else + args[0] = -args[0]; + } + args++; + break; + + case cff_op_add: + FT_TRACE4(( " add\n" )); + + args[0] = ADD_LONG( args[0], args[1] ); + args++; + break; + + case cff_op_sub: + FT_TRACE4(( " sub\n" )); + + args[0] = SUB_LONG( args[0], args[1] ); + args++; + break; + + case cff_op_div: + FT_TRACE4(( " div\n" )); + + args[0] = FT_DivFix( args[0], args[1] ); + args++; + break; + + case cff_op_neg: + FT_TRACE4(( " neg\n" )); + + if ( args[0] == FT_LONG_MIN ) + args[0] = FT_LONG_MAX; + args[0] = -args[0]; + args++; + break; + + case cff_op_random: + FT_TRACE4(( " random\n" )); + + /* only use the lower 16 bits of `random' */ + /* to generate a number in the range (0;1] */ + args[0] = (FT_Fixed) + ( ( decoder->current_subfont->random & 0xFFFF ) + 1 ); + args++; + + decoder->current_subfont->random = + cff_random( decoder->current_subfont->random ); + break; + + case cff_op_mul: + FT_TRACE4(( " mul\n" )); + + args[0] = FT_MulFix( args[0], args[1] ); + args++; + break; + + case cff_op_sqrt: + FT_TRACE4(( " sqrt\n" )); + + if ( args[0] > 0 ) + { + FT_Fixed root = args[0]; + FT_Fixed new_root; + + + for (;;) + { + new_root = ( root + FT_DivFix( args[0], root ) + 1 ) >> 1; + if ( new_root == root ) + break; + root = new_root; + } + args[0] = new_root; + } + else + args[0] = 0; + args++; + break; + + case cff_op_drop: + /* nothing */ + FT_TRACE4(( " drop\n" )); + + break; + + case cff_op_exch: + { + FT_Fixed tmp; + + + FT_TRACE4(( " exch\n" )); + + tmp = args[0]; + args[0] = args[1]; + args[1] = tmp; + args += 2; + } + break; + + case cff_op_index: + { + FT_Int idx = (FT_Int)( args[0] >> 16 ); + + + FT_TRACE4(( " index\n" )); + + if ( idx < 0 ) + idx = 0; + else if ( idx > num_args - 2 ) + idx = num_args - 2; + args[0] = args[-( idx + 1 )]; + args++; + } + break; + + case cff_op_roll: + { + FT_Int count = (FT_Int)( args[0] >> 16 ); + FT_Int idx = (FT_Int)( args[1] >> 16 ); + + + FT_TRACE4(( " roll\n" )); + + if ( count <= 0 ) + count = 1; + + args -= count; + if ( args < stack ) + goto Stack_Underflow; + + if ( idx >= 0 ) + { + while ( idx > 0 ) + { + FT_Fixed tmp = args[count - 1]; + FT_Int i; + + + for ( i = count - 2; i >= 0; i-- ) + args[i + 1] = args[i]; + args[0] = tmp; + idx--; + } + } + else + { + while ( idx < 0 ) + { + FT_Fixed tmp = args[0]; + FT_Int i; + + + for ( i = 0; i < count - 1; i++ ) + args[i] = args[i + 1]; + args[count - 1] = tmp; + idx++; + } + } + args += count; + } + break; + + case cff_op_dup: + FT_TRACE4(( " dup\n" )); + + args[1] = args[0]; + args += 2; + break; + + case cff_op_put: + { + FT_Fixed val = args[0]; + FT_Int idx = (FT_Int)( args[1] >> 16 ); + + + FT_TRACE4(( " put\n" )); + + /* the Type2 specification before version 16-March-2000 */ + /* didn't give a hard-coded size limit of the temporary */ + /* storage array; instead, an argument of the */ + /* `MultipleMaster' operator set the size */ + if ( idx >= 0 && idx < CFF_MAX_TRANS_ELEMENTS ) + decoder->buildchar[idx] = val; + } + break; + + case cff_op_get: + { + FT_Int idx = (FT_Int)( args[0] >> 16 ); + FT_Fixed val = 0; + + + FT_TRACE4(( " get\n" )); + + if ( idx >= 0 && idx < CFF_MAX_TRANS_ELEMENTS ) + val = decoder->buildchar[idx]; + + args[0] = val; + args++; + } + break; + + case cff_op_store: + /* this operator was removed from the Type2 specification */ + /* in version 16-March-2000 */ + + /* since we currently don't handle interpolation of multiple */ + /* master fonts, this is a no-op */ + FT_TRACE4(( " store\n")); + break; + + case cff_op_load: + /* this operator was removed from the Type2 specification */ + /* in version 16-March-2000 */ + { + FT_Int reg_idx = (FT_Int)args[0]; + FT_Int idx = (FT_Int)args[1]; + FT_Int count = (FT_Int)args[2]; + + + FT_TRACE4(( " load\n" )); + + /* since we currently don't handle interpolation of multiple */ + /* master fonts, we store a vector [1 0 0 ...] in the */ + /* temporary storage array regardless of the Registry index */ + if ( reg_idx >= 0 && reg_idx <= 2 && + idx >= 0 && idx < CFF_MAX_TRANS_ELEMENTS && + count >= 0 && count <= num_axes ) + { + FT_Int end, i; + + + end = FT_MIN( idx + count, CFF_MAX_TRANS_ELEMENTS ); + + if ( idx < end ) + decoder->buildchar[idx] = 1 << 16; + + for ( i = idx + 1; i < end; i++ ) + decoder->buildchar[i] = 0; + } + } + break; + + case cff_op_blend: + /* this operator was removed from the Type2 specification */ + /* in version 16-March-2000 */ + { + FT_Int num_results = (FT_Int)( args[0] >> 16 ); + + + FT_TRACE4(( " blend\n" )); + + if ( num_results < 0 ) + goto Syntax_Error; + + if ( num_results * (FT_Int)num_designs > num_args ) + goto Stack_Underflow; + + /* since we currently don't handle interpolation of multiple */ + /* master fonts, return the `num_results' values of the */ + /* first master */ + args -= num_results * ( num_designs - 1 ); + num_args -= num_results * ( num_designs - 1 ); + } + break; + + case cff_op_dotsection: + /* this operator is deprecated and ignored by the parser */ + FT_TRACE4(( " dotsection\n" )); + break; + + case cff_op_closepath: + /* 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(( " closepath (invalid op)\n" )); + + args = stack; + break; + + case cff_op_hsbw: + /* 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(( " hsbw (invalid op)\n" )); + + decoder->glyph_width = + ADD_LONG( decoder->nominal_width, ( args[1] >> 16 ) ); + + decoder->builder.left_bearing.x = args[0]; + decoder->builder.left_bearing.y = 0; + + x = ADD_LONG( 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 = + ADD_LONG( decoder->nominal_width, ( args[2] >> 16 ) ); + + decoder->builder.left_bearing.x = args[0]; + decoder->builder.left_bearing.y = args[1]; + + x = ADD_LONG( decoder->builder.pos_x, args[0] ); + y = ADD_LONG( 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 = ADD_LONG( decoder->builder.pos_x, args[0] ); + y = ADD_LONG( decoder->builder.pos_y, args[1] ); + args = stack; + break; + + case cff_op_callothersubr: + /* this is an invalid Type 2 operator; however, there */ + /* exist fonts which are incorrectly converted from probably */ + /* Type 1 to CFF, and some parsers seem to accept it */ + + FT_TRACE4(( " callothersubr (invalid op)\n" )); + + /* subsequent `pop' operands should add the arguments, */ + /* this is the implementation described for `unknown' other */ + /* subroutines in the Type1 spec. */ + /* */ + /* XXX Fix return arguments (see discussion below). */ + args -= 2 + ( args[-2] >> 16 ); + if ( args < stack ) + goto Stack_Underflow; + break; + + case cff_op_pop: + /* this is an invalid Type 2 operator; however, there */ + /* exist fonts which are incorrectly converted from probably */ + /* Type 1 to CFF, and some parsers seem to accept it */ + + FT_TRACE4(( " pop (invalid op)\n" )); + + /* XXX Increasing `args' is wrong: After a certain number of */ + /* `pop's we get a stack overflow. Reason for doing it is */ + /* code like this (actually found in a CFF font): */ + /* */ + /* 17 1 3 callothersubr */ + /* pop */ + /* callsubr */ + /* */ + /* Since we handle `callothersubr' as a no-op, and */ + /* `callsubr' needs at least one argument, `pop' can't be a */ + /* no-op too as it basically should be. */ + /* */ + /* The right solution would be to provide real support for */ + /* `callothersubr' as done in `t1decode.c', however, given */ + /* the fact that CFF fonts with `pop' are invalid, it is */ + /* questionable whether it is worth the time. */ + args++; + break; + + case cff_op_and: + { + FT_Fixed cond = ( args[0] && args[1] ); + + + FT_TRACE4(( " and\n" )); + + args[0] = cond ? 0x10000L : 0; + args++; + } + break; + + case cff_op_or: + { + FT_Fixed cond = ( args[0] || args[1] ); + + + FT_TRACE4(( " or\n" )); + + args[0] = cond ? 0x10000L : 0; + args++; + } + break; + + case cff_op_not: + { + FT_Fixed cond = !args[0]; + + + FT_TRACE4(( " not\n" )); + + args[0] = cond ? 0x10000L : 0; + args++; + } + break; + + case cff_op_eq: + { + FT_Fixed cond = ( args[0] == args[1] ); + + + FT_TRACE4(( " eq\n" )); + + args[0] = cond ? 0x10000L : 0; + args++; + } + break; + + case cff_op_ifelse: + { + FT_Fixed cond = ( args[2] <= args[3] ); + + + FT_TRACE4(( " ifelse\n" )); + + if ( !cond ) + args[0] = args[1]; + args++; + } + break; + + case cff_op_callsubr: + { + FT_UInt idx = (FT_UInt)( ( args[0] >> 16 ) + + decoder->locals_bias ); + + + FT_TRACE4(( " callsubr (idx %d, entering level %d)\n", + idx, + zone - decoder->zones + 1 )); + + if ( idx >= decoder->num_locals ) + { + FT_ERROR(( "cff_decoder_parse_charstrings:" + " invalid local subr index\n" )); + goto Syntax_Error; + } + + if ( zone - decoder->zones >= CFF_MAX_SUBRS_CALLS ) + { + FT_ERROR(( "cff_decoder_parse_charstrings:" + " too many nested subrs\n" )); + goto Syntax_Error; + } + + zone->cursor = ip; /* save current instruction pointer */ + + zone++; + zone->base = decoder->locals[idx]; + zone->limit = decoder->locals[idx + 1]; + zone->cursor = zone->base; + + if ( !zone->base || zone->limit == zone->base ) + { + FT_ERROR(( "cff_decoder_parse_charstrings:" + " invoking empty subrs\n" )); + goto Syntax_Error; + } + + decoder->zone = zone; + ip = zone->base; + limit = zone->limit; + } + break; + + case cff_op_callgsubr: + { + FT_UInt idx = (FT_UInt)( ( args[0] >> 16 ) + + decoder->globals_bias ); + + + FT_TRACE4(( " callgsubr (idx %d, entering level %d)\n", + idx, + zone - decoder->zones + 1 )); + + if ( idx >= decoder->num_globals ) + { + FT_ERROR(( "cff_decoder_parse_charstrings:" + " invalid global subr index\n" )); + goto Syntax_Error; + } + + if ( zone - decoder->zones >= CFF_MAX_SUBRS_CALLS ) + { + FT_ERROR(( "cff_decoder_parse_charstrings:" + " too many nested subrs\n" )); + goto Syntax_Error; + } + + zone->cursor = ip; /* save current instruction pointer */ + + zone++; + zone->base = decoder->globals[idx]; + zone->limit = decoder->globals[idx + 1]; + zone->cursor = zone->base; + + if ( !zone->base || zone->limit == zone->base ) + { + FT_ERROR(( "cff_decoder_parse_charstrings:" + " invoking empty subrs\n" )); + goto Syntax_Error; + } + + decoder->zone = zone; + ip = zone->base; + limit = zone->limit; + } + break; + + case cff_op_return: + FT_TRACE4(( " return (leaving level %d)\n", + decoder->zone - decoder->zones )); + + if ( decoder->zone <= decoder->zones ) + { + FT_ERROR(( "cff_decoder_parse_charstrings:" + " unexpected return\n" )); + goto Syntax_Error; + } + + decoder->zone--; + zone = decoder->zone; + ip = zone->cursor; + limit = zone->limit; + break; + + default: + FT_ERROR(( "Unimplemented opcode: %d", ip[-1] )); + + if ( ip[-1] == 12 ) + FT_ERROR(( " %d", ip[0] )); + FT_ERROR(( "\n" )); + + return FT_THROW( Unimplemented_Feature ); + } + + decoder->top = args; + + if ( decoder->top - stack >= CFF_MAX_OPERANDS ) + goto Stack_Overflow; + + } /* general operator processing */ + + } /* while ip < limit */ + + FT_TRACE4(( "..end..\n\n" )); + + Fail: + return error; + + MM_Error: + FT_TRACE4(( "cff_decoder_parse_charstrings:" + " invalid opcode found in top DICT charstring\n")); + return FT_THROW( Invalid_File_Format ); + + Syntax_Error: + FT_TRACE4(( "cff_decoder_parse_charstrings: syntax error\n" )); + return FT_THROW( Invalid_File_Format ); + + Stack_Underflow: + FT_TRACE4(( "cff_decoder_parse_charstrings: stack underflow\n" )); + return FT_THROW( Too_Few_Arguments ); + + Stack_Overflow: + FT_TRACE4(( "cff_decoder_parse_charstrings: stack overflow\n" )); + return FT_THROW( Stack_Overflow ); + } + +#endif /* CFF_CONFIG_OPTION_OLD_ENGINE */ + + + /*************************************************************************/ + /* */ + /* */ + /* cff_decoder_init */ + /* */ + /* */ + /* Initializes a given glyph decoder. */ + /* */ + /* */ + /* decoder :: A pointer to the glyph builder to initialize. */ + /* */ + /* */ + /* face :: The current face object. */ + /* */ + /* size :: The current size object. */ + /* */ + /* slot :: The current glyph object. */ + /* */ + /* hinting :: Whether hinting is active. */ + /* */ + /* hint_mode :: The hinting mode. */ + /* */ + FT_LOCAL_DEF( void ) + cff_decoder_init( CFF_Decoder* decoder, + TT_Face face, + CFF_Size size, + CFF_GlyphSlot slot, + FT_Bool hinting, + FT_Render_Mode hint_mode ) + { + CFF_Font cff = (CFF_Font)face->extra.data; + + + /* clear everything */ + FT_ZERO( decoder ); + + /* initialize builder */ + cff_builder_init( &decoder->builder, face, size, slot, hinting ); + + /* initialize Type2 decoder */ + decoder->cff = cff; + decoder->num_globals = cff->global_subrs_index.count; + decoder->globals = cff->global_subrs; + decoder->globals_bias = cff_compute_bias( + cff->top_font.font_dict.charstring_type, + decoder->num_globals ); + + decoder->hint_mode = hint_mode; + } + + + /* this function is used to select the subfont */ + /* and the locals subrs array */ + FT_LOCAL_DEF( FT_Error ) + cff_decoder_prepare( CFF_Decoder* decoder, + CFF_Size size, + FT_UInt glyph_index ) + { + CFF_Builder *builder = &decoder->builder; + CFF_Font cff = (CFF_Font)builder->face->extra.data; + CFF_SubFont sub = &cff->top_font; + FT_Error error = FT_Err_Ok; + + + /* manage CID fonts */ + if ( cff->num_subfonts ) + { + FT_Byte fd_index = cff_fd_select_get( &cff->fd_select, glyph_index ); + + + if ( fd_index >= cff->num_subfonts ) + { + FT_TRACE4(( "cff_decoder_prepare: invalid CID subfont index\n" )); + error = FT_THROW( Invalid_File_Format ); + goto Exit; + } + + FT_TRACE3(( " in subfont %d:\n", fd_index )); + + sub = cff->subfonts[fd_index]; + + if ( builder->hints_funcs && size ) + { + FT_Size ftsize = FT_SIZE( size ); + CFF_Internal internal = (CFF_Internal)ftsize->internal->module_data; + + + /* for CFFs without subfonts, this value has already been set */ + builder->hints_globals = (void *)internal->subfonts[fd_index]; + } + } + + decoder->num_locals = sub->local_subrs_index.count; + decoder->locals = sub->local_subrs; + 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; + + decoder->current_subfont = sub; + + Exit: + return error; + } diff --git a/src/psaux/cffdecode.h b/src/psaux/cffdecode.h new file mode 100644 index 000000000..a890a505c --- /dev/null +++ b/src/psaux/cffdecode.h @@ -0,0 +1,44 @@ + +#ifndef CFFDECODE_H_ +#define CFFDECODE_H_ + + +#include + + +FT_BEGIN_HEADER + + FT_LOCAL( void ) + cff_decoder_init( CFF_Decoder* decoder, + TT_Face face, + CFF_Size size, + CFF_GlyphSlot slot, + FT_Bool hinting, + FT_Render_Mode hint_mode); + + FT_LOCAL( FT_Error ) + cff_decoder_prepare( CFF_Decoder* decoder, + CFF_Size size, + FT_UInt glyph_index ); + + + FT_LOCAL( FT_Int ) + cff_lookup_glyph_by_stdcharcode( CFF_Font cff, + FT_Int charcode ); + + + #ifdef CFF_CONFIG_OPTION_OLD_ENGINE + FT_LOCAL( FT_Error ) + cff_decoder_parse_charstrings( CFF_Decoder* decoder, + FT_Byte* charstring_base, + FT_ULong charstring_len, + FT_Bool in_dict ); + #endif + + +FT_END_HEADER + +#endif + + +/* END */ diff --git a/src/psaux/psaux.c b/src/psaux/psaux.c index 2d301252f..f99884afc 100644 --- a/src/psaux/psaux.c +++ b/src/psaux/psaux.c @@ -25,6 +25,7 @@ #include "psobjs.c" #include "t1cmap.c" #include "t1decode.c" +#include "cffdecode.c" #include "cf2arrst.c" #include "cf2blues.c" diff --git a/src/psaux/rules.mk b/src/psaux/rules.mk index 5658811db..50dd688df 100644 --- a/src/psaux/rules.mk +++ b/src/psaux/rules.mk @@ -42,7 +42,8 @@ PSAUX_DRV_SRC := $(PSAUX_DIR)/psobjs.c \ $(PSAUX_DIR)/cf2hints.c \ $(PSAUX_DIR)/cf2intrp.c \ $(PSAUX_DIR)/cf2read.c \ - $(PSAUX_DIR)/cf2stack.c + $(PSAUX_DIR)/cf2stack.c \ + $(PSAUX_DIR)/cffdecode.c # PSAUX driver headers # From 816c9c1f8372311cbd6721f682931ceed7692692 Mon Sep 17 00:00:00 2001 From: Ewald Hew Date: Sun, 24 Sep 2017 21:43:05 +0200 Subject: [PATCH 249/470] Move CFF builder components into `psaux' module. NOTE: Does not compile! * src/cff/cffgload.c (cff_builder_{init,done,add_point,add_point1,add_contour,start_point,close_contour}, cff_check_points): Move to... * src/psaux/psobjs.c: Here. * src/cff/cffgload.h: Move corresponding declarations to `src/psaux/psobjs.h'. * src/cff/cffgload.h (CFF_Builder): Move struct declaration to... * include/freetype/internal/psaux.h: Here. --- ChangeLog | 17 ++ include/freetype/internal/psaux.h | 74 ++++++++ src/cff/cffgload.c | 274 ------------------------------ src/cff/cffgload.h | 96 ----------- src/psaux/psobjs.c | 265 +++++++++++++++++++++++++++++ src/psaux/psobjs.h | 42 +++++ 6 files changed, 398 insertions(+), 370 deletions(-) diff --git a/ChangeLog b/ChangeLog index a8df01134..5c4a82141 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +2017-09-24 Ewald Hew + + [psaux, cff] Move CFF builder components into `psaux' module. + + NOTE: Does not compile! + + * src/cff/cffgload.c + (cff_builder_{init,done,add_point,add_point1,add_contour,start_point,close_contour}, + cff_check_points): Move to... + * src/psaux/psobjs.c: Here. + + * src/cff/cffgload.h: Move corresponding declarations to + `src/psaux/psobjs.h'. + + * src/cff/cffgload.h (CFF_Builder): Move struct declaration to... + * include/freetype/internal/psaux.h: Here. + 2017-09-24 Ewald Hew [psaux, cff] Move CFF decoder components into `psaux' module. diff --git a/include/freetype/internal/psaux.h b/include/freetype/internal/psaux.h index b1effeed8..933d052e7 100644 --- a/include/freetype/internal/psaux.h +++ b/include/freetype/internal/psaux.h @@ -702,6 +702,80 @@ FT_BEGIN_HEADER } T1_DecoderRec; + /*************************************************************************/ + /*************************************************************************/ + /* */ + /* */ + /* CFF_Builder */ + /* */ + /* */ + /* A structure used during glyph loading to store its outline. */ + /* */ + /* */ + /* memory :: The current memory object. */ + /* */ + /* face :: The current face object. */ + /* */ + /* glyph :: The current glyph slot. */ + /* */ + /* loader :: The current glyph loader. */ + /* */ + /* base :: The base glyph outline. */ + /* */ + /* current :: The current glyph outline. */ + /* */ + /* pos_x :: The horizontal translation (if composite glyph). */ + /* */ + /* pos_y :: The vertical translation (if composite glyph). */ + /* */ + /* left_bearing :: The left side bearing point. */ + /* */ + /* advance :: The horizontal advance vector. */ + /* */ + /* bbox :: Unused. */ + /* */ + /* path_begun :: A flag which indicates that a new path has begun. */ + /* */ + /* load_points :: If this flag is not set, no points are loaded. */ + /* */ + /* no_recurse :: Set but not used. */ + /* */ + /* metrics_only :: A boolean indicating that we only want to compute */ + /* the metrics of a given glyph, not load all of its */ + /* points. */ + /* */ + /* hints_funcs :: Auxiliary pointer for hinting. */ + /* */ + /* hints_globals :: Auxiliary pointer for hinting. */ + /* */ + typedef struct CFF_Builder_ + { + FT_Memory memory; + TT_Face face; + CFF_GlyphSlot glyph; + FT_GlyphLoader loader; + FT_Outline* base; + FT_Outline* current; + + FT_Pos pos_x; + FT_Pos pos_y; + + FT_Vector left_bearing; + FT_Vector advance; + + FT_BBox bbox; /* bounding box */ + FT_Bool path_begun; + FT_Bool load_points; + FT_Bool no_recurse; + + FT_Bool metrics_only; + + void* hints_funcs; /* hinter-specific */ + void* hints_globals; /* hinter-specific */ + } CFF_Builder; + + + /*************************************************************************/ /*************************************************************************/ /***** *****/ /***** CFF DECODER *****/ diff --git a/src/cff/cffgload.c b/src/cff/cffgload.c index de8c83774..79a5d815c 100644 --- a/src/cff/cffgload.c +++ b/src/cff/cffgload.c @@ -43,277 +43,6 @@ - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - /********** *********/ - /********** *********/ - /********** GENERIC CHARSTRING PARSING *********/ - /********** *********/ - /********** *********/ - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - - - /*************************************************************************/ - /* */ - /* */ - /* cff_builder_init */ - /* */ - /* */ - /* Initializes a given glyph builder. */ - /* */ - /* */ - /* builder :: A pointer to the glyph builder to initialize. */ - /* */ - /* */ - /* face :: The current face object. */ - /* */ - /* size :: The current size object. */ - /* */ - /* glyph :: The current glyph object. */ - /* */ - /* hinting :: Whether hinting is active. */ - /* */ - static void - cff_builder_init( CFF_Builder* builder, - TT_Face face, - CFF_Size size, - CFF_GlyphSlot glyph, - FT_Bool hinting ) - { - builder->path_begun = 0; - builder->load_points = 1; - - builder->face = face; - builder->glyph = glyph; - builder->memory = face->root.memory; - - if ( glyph ) - { - FT_GlyphLoader loader = glyph->root.internal->loader; - - - builder->loader = loader; - builder->base = &loader->base.outline; - builder->current = &loader->current.outline; - FT_GlyphLoader_Rewind( loader ); - - builder->hints_globals = NULL; - builder->hints_funcs = NULL; - - if ( hinting && size ) - { - FT_Size ftsize = FT_SIZE( size ); - CFF_Internal internal = (CFF_Internal)ftsize->internal->module_data; - - - if ( internal ) - { - builder->hints_globals = (void *)internal->topfont; - builder->hints_funcs = glyph->root.internal->glyph_hints; - } - } - } - - builder->pos_x = 0; - builder->pos_y = 0; - - builder->left_bearing.x = 0; - builder->left_bearing.y = 0; - builder->advance.x = 0; - builder->advance.y = 0; - } - - - /*************************************************************************/ - /* */ - /* */ - /* cff_builder_done */ - /* */ - /* */ - /* Finalizes a given glyph builder. Its contents can still be used */ - /* after the call, but the function saves important information */ - /* within the corresponding glyph slot. */ - /* */ - /* */ - /* builder :: A pointer to the glyph builder to finalize. */ - /* */ - static void - cff_builder_done( CFF_Builder* builder ) - { - CFF_GlyphSlot glyph = builder->glyph; - - - if ( glyph ) - glyph->root.outline = *builder->base; - } - - - - /* check that there is enough space for `count' more points */ - FT_LOCAL_DEF( FT_Error ) - cff_check_points( CFF_Builder* builder, - FT_Int count ) - { - return FT_GLYPHLOADER_CHECK_POINTS( builder->loader, count, 0 ); - } - - - /* add a new point, do not check space */ - FT_LOCAL_DEF( void ) - cff_builder_add_point( CFF_Builder* builder, - FT_Pos x, - FT_Pos y, - FT_Byte flag ) - { - FT_Outline* outline = builder->current; - - - if ( builder->load_points ) - { - FT_Vector* point = outline->points + outline->n_points; - FT_Byte* control = (FT_Byte*)outline->tags + outline->n_points; - -#ifdef CFF_CONFIG_OPTION_OLD_ENGINE - CFF_Driver driver = (CFF_Driver)FT_FACE_DRIVER( builder->face ); - - - if ( driver->hinting_engine == FT_CFF_HINTING_FREETYPE ) - { - point->x = x >> 16; - point->y = y >> 16; - } - else -#endif - { - /* cf2_decoder_parse_charstrings uses 16.16 coordinates */ - point->x = x >> 10; - point->y = y >> 10; - } - *control = (FT_Byte)( flag ? FT_CURVE_TAG_ON : FT_CURVE_TAG_CUBIC ); - } - - outline->n_points++; - } - - - /* check space for a new on-curve point, then add it */ - FT_LOCAL_DEF( FT_Error ) - cff_builder_add_point1( CFF_Builder* builder, - FT_Pos x, - FT_Pos y ) - { - FT_Error error; - - - error = cff_check_points( builder, 1 ); - if ( !error ) - cff_builder_add_point( builder, x, y, 1 ); - - return error; - } - - - /* check space for a new contour, then add it */ - static FT_Error - cff_builder_add_contour( CFF_Builder* builder ) - { - FT_Outline* outline = builder->current; - FT_Error error; - - - if ( !builder->load_points ) - { - outline->n_contours++; - return FT_Err_Ok; - } - - error = FT_GLYPHLOADER_CHECK_POINTS( builder->loader, 0, 1 ); - if ( !error ) - { - if ( outline->n_contours > 0 ) - outline->contours[outline->n_contours - 1] = - (short)( outline->n_points - 1 ); - - outline->n_contours++; - } - - return error; - } - - - /* if a path was begun, add its first on-curve point */ - FT_LOCAL_DEF( FT_Error ) - cff_builder_start_point( CFF_Builder* builder, - FT_Pos x, - FT_Pos y ) - { - FT_Error error = FT_Err_Ok; - - - /* test whether we are building a new contour */ - if ( !builder->path_begun ) - { - builder->path_begun = 1; - error = cff_builder_add_contour( builder ); - if ( !error ) - error = cff_builder_add_point1( builder, x, y ); - } - - return error; - } - - - /* close the current contour */ - FT_LOCAL_DEF( void ) - cff_builder_close_contour( CFF_Builder* builder ) - { - FT_Outline* outline = builder->current; - FT_Int first; - - - if ( !outline ) - return; - - first = outline->n_contours <= 1 - ? 0 : outline->contours[outline->n_contours - 2] + 1; - - /* We must not include the last point in the path if it */ - /* is located on the first point. */ - if ( outline->n_points > 1 ) - { - FT_Vector* p1 = outline->points + first; - FT_Vector* p2 = outline->points + outline->n_points - 1; - FT_Byte* control = (FT_Byte*)outline->tags + outline->n_points - 1; - - - /* `delete' last point only if it coincides with the first */ - /* point and if it is not a control point (which can happen). */ - if ( p1->x == p2->x && p1->y == p2->y ) - if ( *control == FT_CURVE_TAG_ON ) - outline->n_points--; - } - - if ( outline->n_contours > 0 ) - { - /* Don't add contours only consisting of one point, i.e., */ - /* check whether begin point and last point are the same. */ - if ( first == outline->n_points - 1 ) - { - outline->n_contours--; - outline->n_points--; - } - else - outline->contours[outline->n_contours - 1] = - (short)( outline->n_points - 1 ); - } - } - - - - FT_LOCAL_DEF( FT_Error ) cff_get_glyph_data( TT_Face face, FT_UInt glyph_index, @@ -385,9 +114,6 @@ } - - - /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ diff --git a/src/cff/cffgload.h b/src/cff/cffgload.h index 8c8d39704..b2e945d03 100644 --- a/src/cff/cffgload.h +++ b/src/cff/cffgload.h @@ -27,102 +27,6 @@ FT_BEGIN_HEADER - - - - /*************************************************************************/ - /* */ - /* */ - /* CFF_Builder */ - /* */ - /* */ - /* A structure used during glyph loading to store its outline. */ - /* */ - /* */ - /* memory :: The current memory object. */ - /* */ - /* face :: The current face object. */ - /* */ - /* glyph :: The current glyph slot. */ - /* */ - /* loader :: The current glyph loader. */ - /* */ - /* base :: The base glyph outline. */ - /* */ - /* current :: The current glyph outline. */ - /* */ - /* pos_x :: The horizontal translation (if composite glyph). */ - /* */ - /* pos_y :: The vertical translation (if composite glyph). */ - /* */ - /* left_bearing :: The left side bearing point. */ - /* */ - /* advance :: The horizontal advance vector. */ - /* */ - /* bbox :: Unused. */ - /* */ - /* path_begun :: A flag which indicates that a new path has begun. */ - /* */ - /* load_points :: If this flag is not set, no points are loaded. */ - /* */ - /* no_recurse :: Set but not used. */ - /* */ - /* metrics_only :: A boolean indicating that we only want to compute */ - /* the metrics of a given glyph, not load all of its */ - /* points. */ - /* */ - /* hints_funcs :: Auxiliary pointer for hinting. */ - /* */ - /* hints_globals :: Auxiliary pointer for hinting. */ - /* */ - typedef struct CFF_Builder_ - { - FT_Memory memory; - TT_Face face; - CFF_GlyphSlot glyph; - FT_GlyphLoader loader; - FT_Outline* base; - FT_Outline* current; - - FT_Pos pos_x; - FT_Pos pos_y; - - FT_Vector left_bearing; - FT_Vector advance; - - FT_BBox bbox; /* bounding box */ - FT_Bool path_begun; - FT_Bool load_points; - FT_Bool no_recurse; - - FT_Bool metrics_only; - - void* hints_funcs; /* hinter-specific */ - void* hints_globals; /* hinter-specific */ - - } CFF_Builder; - - - FT_LOCAL( FT_Error ) - cff_check_points( CFF_Builder* builder, - FT_Int count ); - - FT_LOCAL( void ) - cff_builder_add_point( CFF_Builder* builder, - FT_Pos x, - FT_Pos y, - FT_Byte flag ); - FT_LOCAL( FT_Error ) - cff_builder_add_point1( CFF_Builder* builder, - FT_Pos x, - FT_Pos y ); - FT_LOCAL( FT_Error ) - cff_builder_start_point( CFF_Builder* builder, - FT_Pos x, - FT_Pos y ); - FT_LOCAL( void ) - cff_builder_close_contour( CFF_Builder* builder ); - FT_LOCAL( FT_Error ) cff_get_glyph_data( TT_Face face, FT_UInt glyph_index, diff --git a/src/psaux/psobjs.c b/src/psaux/psobjs.c index f04edea41..db268fc42 100644 --- a/src/psaux/psobjs.c +++ b/src/psaux/psobjs.c @@ -1758,6 +1758,271 @@ } + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** CFF BUILDER *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + + /*************************************************************************/ + /* */ + /* */ + /* cff_builder_init */ + /* */ + /* */ + /* Initializes a given glyph builder. */ + /* */ + /* */ + /* builder :: A pointer to the glyph builder to initialize. */ + /* */ + /* */ + /* face :: The current face object. */ + /* */ + /* size :: The current size object. */ + /* */ + /* glyph :: The current glyph object. */ + /* */ + /* hinting :: Whether hinting is active. */ + /* */ + FT_LOCAL_DEF( void ) + cff_builder_init( CFF_Builder* builder, + TT_Face face, + CFF_Size size, + CFF_GlyphSlot glyph, + FT_Bool hinting ) + { + builder->path_begun = 0; + builder->load_points = 1; + + builder->face = face; + builder->glyph = glyph; + builder->memory = face->root.memory; + + if ( glyph ) + { + FT_GlyphLoader loader = glyph->root.internal->loader; + + + builder->loader = loader; + builder->base = &loader->base.outline; + builder->current = &loader->current.outline; + FT_GlyphLoader_Rewind( loader ); + + builder->hints_globals = NULL; + builder->hints_funcs = NULL; + + if ( hinting && size ) + { + FT_Size ftsize = FT_SIZE( size ); + CFF_Internal internal = (CFF_Internal)ftsize->internal->module_data; + + if ( internal ) + { + builder->hints_globals = (void *)internal->topfont; + builder->hints_funcs = glyph->root.internal->glyph_hints; + } + } + } + + builder->pos_x = 0; + builder->pos_y = 0; + + builder->left_bearing.x = 0; + builder->left_bearing.y = 0; + builder->advance.x = 0; + builder->advance.y = 0; + + builder->funcs = cff_builder_funcs; + } + + + /*************************************************************************/ + /* */ + /* */ + /* cff_builder_done */ + /* */ + /* */ + /* Finalizes a given glyph builder. Its contents can still be used */ + /* after the call, but the function saves important information */ + /* within the corresponding glyph slot. */ + /* */ + /* */ + /* builder :: A pointer to the glyph builder to finalize. */ + /* */ + FT_LOCAL_DEF( void ) + cff_builder_done( CFF_Builder* builder ) + { + CFF_GlyphSlot glyph = builder->glyph; + + + if ( glyph ) + glyph->root.outline = *builder->base; + } + + + /* check that there is enough space for `count' more points */ + FT_LOCAL_DEF( FT_Error ) + cff_check_points( CFF_Builder* builder, + FT_Int count ) + { + return FT_GLYPHLOADER_CHECK_POINTS( builder->loader, count, 0 ); + } + + + /* add a new point, do not check space */ + FT_LOCAL_DEF( void ) + cff_builder_add_point( CFF_Builder* builder, + FT_Pos x, + FT_Pos y, + FT_Byte flag ) + { + FT_Outline* outline = builder->current; + + + if ( builder->load_points ) + { + FT_Vector* point = outline->points + outline->n_points; + FT_Byte* control = (FT_Byte*)outline->tags + outline->n_points; + +#ifdef CFF_CONFIG_OPTION_OLD_ENGINE + CFF_Driver driver = (CFF_Driver)FT_FACE_DRIVER( builder->face ); + + + if ( driver->hinting_engine == FT_CFF_HINTING_FREETYPE ) + { + point->x = x >> 16; + point->y = y >> 16; + } + else +#endif + { + /* cf2_decoder_parse_charstrings uses 16.16 coordinates */ + point->x = x >> 10; + point->y = y >> 10; + } + *control = (FT_Byte)( flag ? FT_CURVE_TAG_ON : FT_CURVE_TAG_CUBIC ); + } + + outline->n_points++; + } + + + /* check space for a new on-curve point, then add it */ + FT_LOCAL_DEF( FT_Error ) + cff_builder_add_point1( CFF_Builder* builder, + FT_Pos x, + FT_Pos y ) + { + FT_Error error; + + + error = cff_check_points( builder, 1 ); + if ( !error ) + cff_builder_add_point( builder, x, y, 1 ); + + return error; + } + + + /* check space for a new contour, then add it */ + FT_LOCAL_DEF( FT_Error ) + cff_builder_add_contour( CFF_Builder* builder ) + { + FT_Outline* outline = builder->current; + FT_Error error; + + + if ( !builder->load_points ) + { + outline->n_contours++; + return FT_Err_Ok; + } + + error = FT_GLYPHLOADER_CHECK_POINTS( builder->loader, 0, 1 ); + if ( !error ) + { + if ( outline->n_contours > 0 ) + outline->contours[outline->n_contours - 1] = + (short)( outline->n_points - 1 ); + + outline->n_contours++; + } + + return error; + } + + + /* if a path was begun, add its first on-curve point */ + FT_LOCAL_DEF( FT_Error ) + cff_builder_start_point( CFF_Builder* builder, + FT_Pos x, + FT_Pos y ) + { + FT_Error error = FT_Err_Ok; + + + /* test whether we are building a new contour */ + if ( !builder->path_begun ) + { + builder->path_begun = 1; + error = cff_builder_add_contour( builder ); + if ( !error ) + error = cff_builder_add_point1( builder, x, y ); + } + + return error; + } + + + /* close the current contour */ + FT_LOCAL_DEF( void ) + cff_builder_close_contour( CFF_Builder* builder ) + { + FT_Outline* outline = builder->current; + FT_Int first; + + + if ( !outline ) + return; + + first = outline->n_contours <= 1 + ? 0 : outline->contours[outline->n_contours - 2] + 1; + + /* We must not include the last point in the path if it */ + /* is located on the first point. */ + if ( outline->n_points > 1 ) + { + FT_Vector* p1 = outline->points + first; + FT_Vector* p2 = outline->points + outline->n_points - 1; + FT_Byte* control = (FT_Byte*)outline->tags + outline->n_points - 1; + + + /* `delete' last point only if it coincides with the first */ + /* point and if it is not a control point (which can happen). */ + if ( p1->x == p2->x && p1->y == p2->y ) + if ( *control == FT_CURVE_TAG_ON ) + outline->n_points--; + } + + if ( outline->n_contours > 0 ) + { + /* Don't add contours only consisting of one point, i.e., */ + /* check whether begin point and last point are the same. */ + if ( first == outline->n_points - 1 ) + { + outline->n_contours--; + outline->n_points--; + } + else + outline->contours[outline->n_contours - 1] = + (short)( outline->n_points - 1 ); + } + } + + /*************************************************************************/ /*************************************************************************/ /***** *****/ diff --git a/src/psaux/psobjs.h b/src/psaux/psobjs.h index 202e5b241..73cd9054e 100644 --- a/src/psaux/psobjs.h +++ b/src/psaux/psobjs.h @@ -190,6 +190,48 @@ FT_BEGIN_HEADER t1_builder_close_contour( T1_Builder builder ); + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** CFF BUILDER *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + FT_LOCAL( void ) + cff_builder_init( CFF_Builder* builder, + TT_Face face, + CFF_Size size, + CFF_GlyphSlot glyph, + FT_Bool hinting ); + + FT_LOCAL( void ) + cff_builder_done( CFF_Builder* builder ); + + FT_LOCAL( FT_Error ) + cff_check_points( CFF_Builder* builder, + FT_Int count ); + + FT_LOCAL( void ) + cff_builder_add_point( CFF_Builder* builder, + FT_Pos x, + FT_Pos y, + FT_Byte flag ); + FT_LOCAL( FT_Error ) + cff_builder_add_point1( CFF_Builder* builder, + FT_Pos x, + FT_Pos y ); + FT_LOCAL( FT_Error ) + cff_builder_start_point( CFF_Builder* builder, + FT_Pos x, + FT_Pos y ); + FT_LOCAL( void ) + cff_builder_close_contour( CFF_Builder* builder ); + + FT_LOCAL( FT_Error ) + cff_builder_add_contour( CFF_Builder* builder ); + + /*************************************************************************/ /*************************************************************************/ /***** *****/ From 1487be586e86cf3b0102a82fd4761416d96cc083 Mon Sep 17 00:00:00 2001 From: Ewald Hew Date: Sun, 24 Sep 2017 21:56:54 +0200 Subject: [PATCH 250/470] Create new `PSAux' service interface entries. NOTE: Does not compile! * include/freetype/internal/psaux.h: Include FT_INTERNAL_TRUETYPE_TYPES_H. (CFF_Builder_FuncsRec, CFF_Decocer_FuncsRec): New function tables. (CFF_Builder): Updated. Fix for forward declaration. (PSAux_ServiceRec): New field `cff_decoder_funcs'. * src/psaux/psauxmod.c (cff_builder_funcs, cff_decoder_funcs): New function tables. (PSAux_Interface): Updated. * include/freetype/internal/tttypes.h (TT_FaceRec): Add `psaux' service interface. * src/cff/cffgload.c, src/cff/cffobjs.c, src/cff/cffparse.c: Update function calls to use psaux service. --- ChangeLog | 23 +++++++ include/freetype/internal/psaux.h | 99 ++++++++++++++++++++++++++++- include/freetype/internal/tttypes.h | 3 + src/cff/cffgload.c | 48 +++++++------- src/cff/cffobjs.c | 13 ++++ src/cff/cffparse.c | 20 ++++-- src/psaux/psauxmod.c | 33 ++++++++++ 7 files changed, 210 insertions(+), 29 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5c4a82141..02e0611d1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,26 @@ +2017-09-24 Ewald Hew + + [psaux, cff] Create new `PSAux' service interface entries. + + NOTE: Does not compile! + + * include/freetype/internal/psaux.h: Include + FT_INTERNAL_TRUETYPE_TYPES_H. + (CFF_Builder_FuncsRec, CFF_Decocer_FuncsRec): New function tables. + (CFF_Builder): Updated. + Fix for forward declaration. + (PSAux_ServiceRec): New field `cff_decoder_funcs'. + + * src/psaux/psauxmod.c (cff_builder_funcs, cff_decoder_funcs): New + function tables. + (PSAux_Interface): Updated. + + * include/freetype/internal/tttypes.h (TT_FaceRec): Add `psaux' + service interface. + + * src/cff/cffgload.c, src/cff/cffobjs.c, src/cff/cffparse.c: Update + function calls to use psaux service. + 2017-09-24 Ewald Hew [psaux, cff] Move CFF builder components into `psaux' module. diff --git a/include/freetype/internal/psaux.h b/include/freetype/internal/psaux.h index 933d052e7..e29d45246 100644 --- a/include/freetype/internal/psaux.h +++ b/include/freetype/internal/psaux.h @@ -25,6 +25,7 @@ #include FT_INTERNAL_OBJECTS_H #include FT_INTERNAL_TYPE1_TYPES_H #include FT_INTERNAL_HASH_H +#include FT_INTERNAL_TRUETYPE_TYPES_H #include FT_SERVICE_POSTSCRIPT_CMAPS_H @@ -703,6 +704,67 @@ FT_BEGIN_HEADER } T1_DecoderRec; /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** CFF BUILDER *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + + typedef struct CFF_Builder_ CFF_Builder; + + + typedef FT_Error + (*CFF_Builder_Check_Points_Func)( CFF_Builder* builder, + FT_Int count ); + + typedef void + (*CFF_Builder_Add_Point_Func)( CFF_Builder* builder, + FT_Pos x, + FT_Pos y, + FT_Byte flag ); + typedef FT_Error + (*CFF_Builder_Add_Point1_Func)( CFF_Builder* builder, + FT_Pos x, + FT_Pos y ); + typedef FT_Error + (*CFF_Builder_Start_Point_Func)( CFF_Builder* builder, + FT_Pos x, + FT_Pos y ); + typedef void + (*CFF_Builder_Close_Contour_Func)( CFF_Builder* builder ); + + /* static */ + typedef FT_Error + (*CFF_Builder_Add_Contour_Func)( CFF_Builder* builder ); + + typedef const struct CFF_Builder_FuncsRec_* CFF_Builder_Funcs; + + typedef struct CFF_Builder_FuncsRec_ + { + /* static */ + void + (*init)( CFF_Builder* builder, + TT_Face face, + CFF_Size size, + CFF_GlyphSlot glyph, + FT_Bool hinting ); + + /* static */ + void + (*done)( CFF_Builder* builder ); + + CFF_Builder_Check_Points_Func check_points; + CFF_Builder_Add_Point_Func add_point; + CFF_Builder_Add_Point1_Func add_point1; + CFF_Builder_Add_Contour_Func add_contour; + CFF_Builder_Start_Point_Func start_point; + CFF_Builder_Close_Contour_Func close_contour; + + } CFF_Builder_FuncsRec; + + /*************************************************************************/ /* */ /* */ @@ -748,7 +810,7 @@ FT_BEGIN_HEADER /* */ /* hints_globals :: Auxiliary pointer for hinting. */ /* */ - typedef struct CFF_Builder_ + struct CFF_Builder_ { FT_Memory memory; TT_Face face; @@ -772,7 +834,10 @@ FT_BEGIN_HEADER void* hints_funcs; /* hinter-specific */ void* hints_globals; /* hinter-specific */ - } CFF_Builder; + + CFF_Builder_FuncsRec funcs; + + }; /*************************************************************************/ @@ -846,6 +911,34 @@ FT_BEGIN_HEADER } CFF_Decoder; + typedef const struct CFF_Decoder_FuncsRec_* CFF_Decoder_Funcs; + + typedef struct CFF_Decoder_FuncsRec_ + { + void + (*init)( CFF_Decoder* decoder, + TT_Face face, + CFF_Size size, + CFF_GlyphSlot slot, + FT_Bool hinting, + FT_Render_Mode hint_mode ); + + FT_Error + (*prepare)( CFF_Decoder* decoder, + CFF_Size size, + FT_UInt glyph_index ); + + FT_Error + (*parse_charstrings)( CFF_Decoder* decoder, + FT_Byte* charstring_base, + FT_ULong charstring_len +#ifdef CFF_CONFIG_OPTION_OLD_ENGINE +/*TODO(ewaldhew): seems hacky, is there a better way to do this?*/ + ,FT_Bool in_dict +#endif + ); + + } CFF_Decoder_FuncsRec; /*************************************************************************/ /*************************************************************************/ @@ -959,6 +1052,8 @@ FT_BEGIN_HEADER /* fields after this comment line were added after version 2.1.10 */ const AFM_Parser_FuncsRec* afm_parser_funcs; + const CFF_Decoder_FuncsRec* cff_decoder_funcs; + } PSAux_ServiceRec, *PSAux_Service; /* backward compatible type definition */ diff --git a/include/freetype/internal/tttypes.h b/include/freetype/internal/tttypes.h index c0758e25f..0fcc6b04d 100644 --- a/include/freetype/internal/tttypes.h +++ b/include/freetype/internal/tttypes.h @@ -1445,6 +1445,9 @@ FT_BEGIN_HEADER void* var; #endif + /* a typeless pointer to the PostScript Aux service */ + void* psaux; + /***********************************************************************/ /* */ diff --git a/src/cff/cffgload.c b/src/cff/cffgload.c index 79a5d815c..a5fde87b5 100644 --- a/src/cff/cffgload.c +++ b/src/cff/cffgload.c @@ -21,6 +21,7 @@ #include FT_INTERNAL_STREAM_H #include FT_INTERNAL_SFNT_H #include FT_INTERNAL_CALC_H +#include FT_INTERNAL_POSTSCRIPT_AUX_H #include FT_OUTLINE_H #include FT_CFF_DRIVER_H @@ -41,8 +42,6 @@ #define FT_COMPONENT trace_cffgload - - FT_LOCAL_DEF( FT_Error ) cff_get_glyph_data( TT_Face face, FT_UInt glyph_index, @@ -144,11 +143,13 @@ FT_Int glyph_index; CFF_Font cff = (CFF_Font)face->other; + PSAux_Service psaux = (PSAux_Service)face->psaux; + const CFF_Decoder_Funcs decoder_funcs = psaux->cff_decoder_funcs; *max_advance = 0; /* Initialize load decoder */ - cff_decoder_init( &decoder, face, 0, 0, 0, 0 ); + decoder_funcs->init( &decoder, face, 0, 0, 0, 0 ); decoder.builder.metrics_only = 1; decoder.builder.load_points = 0; @@ -167,12 +168,12 @@ &charstring, &charstring_len ); if ( !error ) { - error = cff_decoder_prepare( &decoder, size, glyph_index ); + error = decoder_funcs->prepare( &decoder, size, glyph_index ); if ( !error ) - error = cff_decoder_parse_charstrings( &decoder, - charstring, - charstring_len, - 0 ); + error = decoder_funcs->parse_charstrings( &decoder, + charstring, + charstring_len, + 0 ); cff_free_glyph_data( face, &charstring, &charstring_len ); } @@ -202,6 +203,9 @@ FT_Bool hinting, scaled, force_scaling; CFF_Font cff = (CFF_Font)face->extra.data; + PSAux_Service psaux = (PSAux_Service)face->psaux; + const CFF_Decoder_Funcs decoder_funcs = psaux->cff_decoder_funcs; + FT_Matrix font_matrix; FT_Vector font_offset; @@ -399,8 +403,8 @@ FT_ULong charstring_len; - cff_decoder_init( &decoder, face, size, glyph, hinting, - FT_LOAD_TARGET_MODE( load_flags ) ); + decoder_funcs->init( &decoder, face, size, glyph, hinting, + FT_LOAD_TARGET_MODE( load_flags ) ); /* this is for pure CFFs */ if ( load_flags & FT_LOAD_ADVANCE_ONLY ) @@ -415,23 +419,23 @@ if ( error ) goto Glyph_Build_Finished; - error = cff_decoder_prepare( &decoder, size, glyph_index ); + error = decoder_funcs->prepare( &decoder, size, glyph_index ); if ( error ) goto Glyph_Build_Finished; #ifdef CFF_CONFIG_OPTION_OLD_ENGINE /* choose which CFF renderer to use */ if ( driver->hinting_engine == FT_CFF_HINTING_FREETYPE ) - error = cff_decoder_parse_charstrings( &decoder, - charstring, - charstring_len, - 0 ); + error = decoder_funcs->parse_charstrings( &decoder, + charstring, + charstring_len, + 0 ); else #endif { - error = cf2_decoder_parse_charstrings( &decoder, - charstring, - charstring_len ); + error = decoder_funcs->parse_charstrings( &decoder, + charstring, + charstring_len ); /* Adobe's engine uses 16.16 numbers everywhere; */ /* as a consequence, glyphs larger than 2000ppem get rejected */ @@ -444,9 +448,9 @@ force_scaling = TRUE; glyph->hint = hinting; - error = cf2_decoder_parse_charstrings( &decoder, - charstring, - charstring_len ); + error = decoder_funcs->parse_charstrings( &decoder, + charstring, + charstring_len ); } } @@ -484,7 +488,7 @@ Glyph_Build_Finished: /* save new glyph tables, if no error */ if ( !error ) - cff_builder_done( &decoder.builder ); + decoder.builder.funcs.done( &decoder.builder ); /* XXX: anything to do for broken glyph entry? */ } diff --git a/src/cff/cffobjs.c b/src/cff/cffobjs.c index 2899a4cc5..b0d275c73 100644 --- a/src/cff/cffobjs.c +++ b/src/cff/cffobjs.c @@ -39,6 +39,8 @@ #include "cfferrs.h" +#include FT_INTERNAL_POSTSCRIPT_AUX_H + /*************************************************************************/ /* */ @@ -493,6 +495,7 @@ SFNT_Service sfnt; FT_Service_PsCMaps psnames; PSHinter_Service pshinter; + PSAux_Service psaux; FT_Bool pure_cff = 1; FT_Bool cff2 = 0; FT_Bool sfnt_format = 0; @@ -513,6 +516,16 @@ pshinter = (PSHinter_Service)FT_Get_Module_Interface( library, "pshinter" ); + psaux = (PSAux_Service)FT_Get_Module_Interface( + library, "psaux" ); + if ( !psaux ) + { + FT_ERROR(( "cff_face_init: cannot access `psaux' module\n" )); + error = FT_THROW( Missing_Module ); + goto Exit; + } + face->psaux = psaux; + FT_TRACE2(( "CFF driver\n" )); /* create input stream from resource */ diff --git a/src/cff/cffparse.c b/src/cff/cffparse.c index 9d7bf6d22..63f20a194 100644 --- a/src/cff/cffparse.c +++ b/src/cff/cffparse.c @@ -21,10 +21,10 @@ #include FT_INTERNAL_STREAM_H #include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_CALC_H +#include FT_INTERNAL_POSTSCRIPT_AUX_H #include "cfferrs.h" #include "cffpic.h" -#include "cffgload.h" #include "cffload.h" @@ -1305,6 +1305,7 @@ FT_UNUSED( library ); + parser->top = parser->stack; parser->start = start; parser->limit = limit; @@ -1388,10 +1389,19 @@ cff_rec.top_font.font_dict.num_axes = parser->num_axes; decoder.cff = &cff_rec; - error = cff_decoder_parse_charstrings( &decoder, - charstring_base, - charstring_len, - 1 ); + psaux = (PSAux_Service)FT_Get_Module_Interface( + library, "psaux" ); + if ( !psaux ) + { + FT_ERROR(( "cff_parser_run: cannot access `psaux' module\n" )); + error = FT_THROW( Missing_Module ); + goto Exit; + } + + error = psaux->cff_decoder_funcs->parse_charstrings( &decoder, + charstring_base, + charstring_len, + 1 ); /* Now copy the stack data in the temporary decoder object, */ /* converting it back to charstring number representations */ diff --git a/src/psaux/psauxmod.c b/src/psaux/psauxmod.c index 1f589cefc..cd9f52529 100644 --- a/src/psaux/psauxmod.c +++ b/src/psaux/psauxmod.c @@ -21,6 +21,8 @@ #include "psobjs.h" #include "t1decode.h" #include "t1cmap.h" +#include "cf2ft.h" +#include "cffdecode.h" #ifndef T1_CONFIG_OPTION_NO_AFM #include "afmparse.h" @@ -104,6 +106,35 @@ }; + FT_CALLBACK_TABLE_DEF + const CFF_Builder_FuncsRec cff_builder_funcs = + { + cff_builder_init, /* init */ + cff_builder_done, /* done */ + + cff_check_points, /* check_points */ + cff_builder_add_point, /* add_point */ + cff_builder_add_point1, /* add_point1 */ + cff_builder_add_contour, /* add_contour */ + cff_builder_start_point, /* start_point */ + cff_builder_close_contour /* close_contour */ + }; + + + FT_CALLBACK_TABLE_DEF + const CFF_Decoder_FuncsRec cff_decoder_funcs = + { + cff_decoder_init, /* init */ + cff_decoder_prepare, /* prepare */ + +#ifdef CFF_CONFIG_OPTION_OLD_ENGINE + cff_decoder_parse_charstrings /* parse_charstrings */ +#else + cf2_decoder_parse_charstrings +#endif + }; + + static const PSAux_Interface psaux_interface = { @@ -120,6 +151,8 @@ #else 0, #endif + + &cff_decoder_funcs, }; From 9578e07a83a8cb12fba360948b264796ec607f83 Mon Sep 17 00:00:00 2001 From: Ewald Hew Date: Sun, 24 Sep 2017 22:05:32 +0200 Subject: [PATCH 251/470] Add callbacks for inter-module calls. NOTE: Does not compile! * include/freetype/internal/psaux.h: Add function pointer declarations. * src/psaux/cffdecode.c (cff_decoder_init): Update to take in callbacks. * src/psaux/cffdecode.h: Ditto. * src/cff/cffgload.c (cff_compute_max_advance, cff_slot_load): Update calls to pass in callbacks. * src/psaux/cf2ft.c, src/psaux/cffdecode.c: Use them. --- ChangeLog | 17 +++++++++++++++++ include/freetype/internal/psaux.h | 19 ++++++++++++++++++- src/cff/cffgload.c | 6 ++++-- src/psaux/cf2ft.c | 14 +++++++------- src/psaux/cffdecode.c | 19 ++++++++++++------- src/psaux/cffdecode.h | 4 +++- 6 files changed, 61 insertions(+), 18 deletions(-) diff --git a/ChangeLog b/ChangeLog index 02e0611d1..0114f4843 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +2017-09-24 Ewald Hew + + [psaux, cff] Add callbacks for inter-module calls. + + NOTE: Does not compile! + + * include/freetype/internal/psaux.h: Add function pointer + declarations. + + * src/psaux/cffdecode.c (cff_decoder_init): Update to take in + callbacks. + * src/psaux/cffdecode.h: Ditto. + + * src/cff/cffgload.c (cff_compute_max_advance, cff_slot_load): + Update calls to pass in callbacks. + * src/psaux/cf2ft.c, src/psaux/cffdecode.c: Use them. + 2017-09-24 Ewald Hew [psaux, cff] Create new `PSAux' service interface entries. diff --git a/include/freetype/internal/psaux.h b/include/freetype/internal/psaux.h index e29d45246..bcc84e38d 100644 --- a/include/freetype/internal/psaux.h +++ b/include/freetype/internal/psaux.h @@ -868,6 +868,18 @@ FT_BEGIN_HEADER } CFF_Decoder_Zone; + typedef FT_Error + (*CFF_Decoder_Get_Glyph_Callback)( TT_Face face, + FT_UInt glyph_index, + FT_Byte** pointer, + FT_ULong* length ); + + typedef void + (*CFF_Decoder_Free_Glyph_Callback)( TT_Face face, + FT_Byte** pointer, + FT_ULong length ); + + typedef struct CFF_Decoder_ { CFF_Builder builder; @@ -909,6 +921,9 @@ FT_BEGIN_HEADER CFF_SubFont current_subfont; /* for current glyph_index */ + CFF_Decoder_Get_Glyph_Callback get_glyph_callback; + CFF_Decoder_Free_Glyph_Callback free_glyph_callback; + } CFF_Decoder; typedef const struct CFF_Decoder_FuncsRec_* CFF_Decoder_Funcs; @@ -921,7 +936,9 @@ FT_BEGIN_HEADER CFF_Size size, CFF_GlyphSlot slot, FT_Bool hinting, - FT_Render_Mode hint_mode ); + FT_Render_Mode hint_mode, + CFF_Decoder_Get_Glyph_Callback get_callback, + CFF_Decoder_Free_Glyph_Callback free_callback ); FT_Error (*prepare)( CFF_Decoder* decoder, diff --git a/src/cff/cffgload.c b/src/cff/cffgload.c index a5fde87b5..18dbf6542 100644 --- a/src/cff/cffgload.c +++ b/src/cff/cffgload.c @@ -149,7 +149,7 @@ *max_advance = 0; /* Initialize load decoder */ - decoder_funcs->init( &decoder, face, 0, 0, 0, 0 ); + decoder_funcs->init( &decoder, face, 0, 0, 0, 0, 0, 0 ); decoder.builder.metrics_only = 1; decoder.builder.load_points = 0; @@ -404,7 +404,9 @@ decoder_funcs->init( &decoder, face, size, glyph, hinting, - FT_LOAD_TARGET_MODE( load_flags ) ); + FT_LOAD_TARGET_MODE( load_flags ), + cff_get_glyph_data, + cff_free_glyph_data ); /* this is for pure CFFs */ if ( load_flags & FT_LOAD_ADVANCE_ONLY ) diff --git a/src/psaux/cf2ft.c b/src/psaux/cf2ft.c index c6c00d162..169e1160b 100644 --- a/src/psaux/cf2ft.c +++ b/src/psaux/cf2ft.c @@ -647,10 +647,10 @@ return FT_THROW( Invalid_Glyph_Format ); } - error = cff_get_glyph_data( decoder->builder.face, - (CF2_UInt)gid, - &charstring, - &len ); + error = decoder->get_glyph_callback( decoder->builder.face, + (CF2_UInt)gid, + &charstring, + &len ); /* TODO: for now, just pass the FreeType error through */ if ( error ) return error; @@ -672,9 +672,9 @@ { FT_ASSERT( decoder ); - cff_free_glyph_data( decoder->builder.face, - (FT_Byte**)&buf->start, - (FT_ULong)( buf->end - buf->start ) ); + decoder->free_glyph_callback( decoder->builder.face, + (FT_Byte**)&buf->start, + (FT_ULong)( buf->end - buf->start ) ); } diff --git a/src/psaux/cffdecode.c b/src/psaux/cffdecode.c index e1af544f0..baa318bbe 100644 --- a/src/psaux/cffdecode.c +++ b/src/psaux/cffdecode.c @@ -272,8 +272,8 @@ FT_GlyphLoader_Prepare( builder->loader ); /* First load `bchar' in builder */ - error = cff_get_glyph_data( face, (FT_UInt)bchar_index, - &charstring, &charstring_len ); + error = decoder->get_glyph_callback( face, (FT_UInt)bchar_index, + &charstring, &charstring_len ); if ( !error ) { /* the seac operator must not be nested */ @@ -282,7 +282,7 @@ charstring_len, 0 ); decoder->seac = FALSE; - cff_free_glyph_data( face, &charstring, charstring_len ); + decoder->free_glyph_callback( face, &charstring, charstring_len ); if ( error ) goto Exit; @@ -302,8 +302,8 @@ builder->pos_y = ady; /* Now load `achar' on top of the base outline. */ - error = cff_get_glyph_data( face, (FT_UInt)achar_index, - &charstring, &charstring_len ); + error = decoder->get_glyph_callback( face, (FT_UInt)achar_index, + &charstring, &charstring_len ); if ( !error ) { /* the seac operator must not be nested */ @@ -312,7 +312,7 @@ charstring_len, 0 ); decoder->seac = FALSE; - cff_free_glyph_data( face, &charstring, charstring_len ); + decoder->free_glyph_callback( face, &charstring, charstring_len ); if ( error ) goto Exit; @@ -2231,7 +2231,9 @@ CFF_Size size, CFF_GlyphSlot slot, FT_Bool hinting, - FT_Render_Mode hint_mode ) + FT_Render_Mode hint_mode, + CFF_Decoder_Get_Glyph_Callback get_callback, + CFF_Decoder_Free_Glyph_Callback free_callback ) { CFF_Font cff = (CFF_Font)face->extra.data; @@ -2251,6 +2253,9 @@ decoder->num_globals ); decoder->hint_mode = hint_mode; + + decoder->get_glyph_callback = get_callback; + decoder->free_glyph_callback = free_callback; } diff --git a/src/psaux/cffdecode.h b/src/psaux/cffdecode.h index a890a505c..1b021b720 100644 --- a/src/psaux/cffdecode.h +++ b/src/psaux/cffdecode.h @@ -14,7 +14,9 @@ FT_BEGIN_HEADER CFF_Size size, CFF_GlyphSlot slot, FT_Bool hinting, - FT_Render_Mode hint_mode); + FT_Render_Mode hint_mode, + CFF_Decoder_Get_Glyph_Callback get_callback, + CFF_Decoder_Free_Glyph_Callback free_callback); FT_LOCAL( FT_Error ) cff_decoder_prepare( CFF_Decoder* decoder, From edacde60e3974371dbab156c2d2b06b3f000e4b2 Mon Sep 17 00:00:00 2001 From: Ewald Hew Date: Sun, 24 Sep 2017 22:20:38 +0200 Subject: [PATCH 252/470] Add new service for inter-module calls. NOTE: Does not compile! This is to allow CFF functions moved to `psaux' to call functions declared in `src/cff/cffload.h'. * include/freetype/internal/services/svcfftl.h: New file, setting up a `CFFLoad' service. * include/freetype/internal/ftserv.h (FT_DEFINE_SERVICEDESCREC10, FT_DEFINE_SERVICEDESCREC): New macros. (FT_SERVICE_CFF_TABLE_LOAD_H): New macro. * src/cff/cffdrivr.c, src/cff/cffpic.h: Register the new service. * src/cff/cfftypes.h (CFF_FontRec), src/psaux/cf2font.h (CF2_FontRec): Add service interface. * src/cff/cffobjs.c, src/psaux/cf2font.c, src/psaux/cf2ft.c, src/psaux/cf2intrp.c, src/psaux/cffdecode.c: Use the new service. --- ChangeLog | 24 +++++ include/freetype/internal/ftserv.h | 90 ++++++++++++++++++- include/freetype/internal/services/svcfftl.h | 94 ++++++++++++++++++++ src/cff/cffdrivr.c | 36 ++++++-- src/cff/cffobjs.c | 4 + src/cff/cffpic.h | 5 +- src/cff/cfftypes.h | 3 + src/psaux/cf2font.c | 17 ++-- src/psaux/cf2font.h | 5 +- src/psaux/cf2ft.c | 2 + src/psaux/cf2intrp.c | 19 ++-- src/psaux/cffdecode.c | 25 +++++- 12 files changed, 292 insertions(+), 32 deletions(-) create mode 100644 include/freetype/internal/services/svcfftl.h diff --git a/ChangeLog b/ChangeLog index 0114f4843..a92581018 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,27 @@ +2017-09-24 Ewald Hew + + [psaux, cff] Add new service for inter-module calls. + + NOTE: Does not compile! + + This is to allow CFF functions moved to `psaux' to call functions + declared in `src/cff/cffload.h'. + + * include/freetype/internal/services/svcfftl.h: New file, setting up + a `CFFLoad' service. + + * include/freetype/internal/ftserv.h (FT_DEFINE_SERVICEDESCREC10, + FT_DEFINE_SERVICEDESCREC): New macros. + (FT_SERVICE_CFF_TABLE_LOAD_H): New macro. + + * src/cff/cffdrivr.c, src/cff/cffpic.h: Register the new service. + + * src/cff/cfftypes.h (CFF_FontRec), src/psaux/cf2font.h + (CF2_FontRec): Add service interface. + + * src/cff/cffobjs.c, src/psaux/cf2font.c, src/psaux/cf2ft.c, + src/psaux/cf2intrp.c, src/psaux/cffdecode.c: Use the new service. + 2017-09-24 Ewald Hew [psaux, cff] Add callbacks for inter-module calls. diff --git a/include/freetype/internal/ftserv.h b/include/freetype/internal/ftserv.h index 71ef9cac3..23f2878cc 100644 --- a/include/freetype/internal/ftserv.h +++ b/include/freetype/internal/ftserv.h @@ -330,6 +330,32 @@ FT_BEGIN_HEADER { NULL, NULL } \ }; +#define FT_DEFINE_SERVICEDESCREC10( class_, \ + serv_id_1, serv_data_1, \ + serv_id_2, serv_data_2, \ + serv_id_3, serv_data_3, \ + serv_id_4, serv_data_4, \ + serv_id_5, serv_data_5, \ + serv_id_6, serv_data_6, \ + serv_id_7, serv_data_7, \ + serv_id_8, serv_data_8, \ + serv_id_9, serv_data_9, \ + serv_id_10, serv_data_10) \ + static const FT_ServiceDescRec class_[] = \ + { \ + { serv_id_1, serv_data_1 }, \ + { serv_id_2, serv_data_2 }, \ + { serv_id_3, serv_data_3 }, \ + { serv_id_4, serv_data_4 }, \ + { serv_id_5, serv_data_5 }, \ + { serv_id_6, serv_data_6 }, \ + { serv_id_7, serv_data_7 }, \ + { serv_id_8, serv_data_8 }, \ + { serv_id_9, serv_data_9 }, \ + { serv_id_10, serv_data_10 }, \ + { NULL, NULL } \ + }; + #else /* FT_CONFIG_OPTION_PIC */ #define FT_DEFINE_SERVICEDESCREC1( class_, \ @@ -755,6 +781,68 @@ FT_BEGIN_HEADER return FT_Err_Ok; \ } +#define FT_DEFINE_SERVICEDESCREC10( class_, \ + serv_id_1, serv_data_1, \ + serv_id_2, serv_data_2, \ + serv_id_3, serv_data_3, \ + serv_id_4, serv_data_4, \ + serv_id_5, serv_data_5, \ + serv_id_6, serv_data_6, \ + serv_id_7, serv_data_7, \ + serv_id_8, serv_data_8, \ + serv_id_9, serv_data_9, \ + serv_id_10, serv_data_10 ) \ + void \ + FT_Destroy_Class_ ## class_( FT_Library library, \ + FT_ServiceDescRec* clazz ) \ + { \ + FT_Memory memory = library->memory; \ + \ + \ + if ( clazz ) \ + FT_FREE( clazz ); \ + } \ + \ + FT_Error \ + FT_Create_Class_ ## class_( FT_Library library, \ + FT_ServiceDescRec** output_class) \ + { \ + FT_ServiceDescRec* clazz = NULL; \ + FT_Error error; \ + FT_Memory memory = library->memory; \ + \ + \ + if ( FT_ALLOC( clazz, sizeof ( *clazz ) * 11 ) ) \ + return error; \ + \ + clazz[0].serv_id = serv_id_1; \ + clazz[0].serv_data = serv_data_1; \ + clazz[1].serv_id = serv_id_2; \ + clazz[1].serv_data = serv_data_2; \ + clazz[2].serv_id = serv_id_3; \ + clazz[2].serv_data = serv_data_3; \ + clazz[3].serv_id = serv_id_4; \ + clazz[3].serv_data = serv_data_4; \ + clazz[4].serv_id = serv_id_5; \ + clazz[4].serv_data = serv_data_5; \ + clazz[5].serv_id = serv_id_6; \ + clazz[5].serv_data = serv_data_6; \ + clazz[6].serv_id = serv_id_7; \ + clazz[6].serv_data = serv_data_7; \ + clazz[7].serv_id = serv_id_8; \ + clazz[7].serv_data = serv_data_8; \ + clazz[8].serv_id = serv_id_9; \ + clazz[8].serv_data = serv_data_9; \ + clazz[9].serv_id = serv_id_10; \ + clazz[9].serv_data = serv_data_10; \ + clazz[10].serv_id = NULL; \ + clazz[10].serv_data = NULL; \ + \ + *output_class = clazz; \ + \ + return FT_Err_Ok; \ + } + #endif /* FT_CONFIG_OPTION_PIC */ @@ -916,7 +1004,7 @@ FT_BEGIN_HEADER #define FT_SERVICE_WINFNT_H #define FT_SERVICE_FONT_FORMAT_H #define FT_SERVICE_TRUETYPE_GLYF_H - +#define FT_SERVICE_CFF_TABLE_LOAD_H /* */ FT_END_HEADER diff --git a/include/freetype/internal/services/svcfftl.h b/include/freetype/internal/services/svcfftl.h new file mode 100644 index 000000000..18e2276a9 --- /dev/null +++ b/include/freetype/internal/services/svcfftl.h @@ -0,0 +1,94 @@ +#ifndef SVCFFTL_H_ +#define SVCFFTL_H_ + +#include FT_INTERNAL_SERVICE_H + + +FT_BEGIN_HEADER + + +#define FT_SERVICE_ID_CFF_LOAD "cff-load" + + + typedef FT_UShort + (*FT_Get_Standard_Encoding_Func)( FT_UInt charcode ); + + typedef FT_Error + (*FT_Load_Private_Dict_Func)( CFF_Font font, + CFF_SubFont subfont, + FT_UInt lenNDV, + FT_Fixed* NDV ); + + typedef FT_Byte + (*FT_FD_Select_Get_Func)( CFF_FDSelect fdselect, + FT_UInt glyph_index ); + + typedef FT_Bool + (*FT_Blend_Check_Vector_Func)( CFF_Blend blend, + FT_UInt vsindex, + FT_UInt lenNDV, + FT_Fixed* NDV ); + + typedef FT_Error + (*FT_Blend_Build_Vector_Func)( CFF_Blend blend, + FT_UInt vsindex, + FT_UInt lenNDV, + FT_Fixed* NDV ); + + + FT_DEFINE_SERVICE( CFFLoad ) + { + FT_Get_Standard_Encoding_Func get_standard_encoding; + FT_Load_Private_Dict_Func load_private_dict; + FT_FD_Select_Get_Func fd_select_get; + FT_Blend_Check_Vector_Func blend_check_vector; + FT_Blend_Build_Vector_Func blend_build_vector; + }; + + +#ifndef FT_CONFIG_OPTION_PIC + +#define FT_DEFINE_SERVICE_CFFLOADREC( class_, \ + get_standard_encoding_, \ + load_private_dict_, \ + fd_select_get_, \ + blend_check_vector_, \ + blend_build_vector_ ) \ + static const FT_Service_CFFLoadRec class_ = \ + { \ + get_standard_encoding_, \ + load_private_dict_, \ + fd_select_get_, \ + blend_check_vector_, \ + blend_build_vector_ \ + }; + +#else /* FT_CONFIG_OPTION_PIC */ + +#define FT_DEFINE_SERVICE_CFFLOADREC( class_, \ + get_standard_encoding_, \ + load_private_dict_, \ + fd_select_get_, \ + blend_check_vector_, \ + blend_build_vector_ ) \ + void \ + FT_Init_Class_ ## class_( FT_Service_CFFLoadRec* clazz ) \ + { \ + clazz->get_standard_encoding = get_standard_encoding_; \ + clazz->load_private_dict = load_private_dict_; \ + clazz->fd_select_get = fd_select_get_; \ + clazz->blend_check_vector = blend_check_vector_; \ + clazz->blend_build_vector = blend_build_vector_; \ + } + +#endif /* FT_CONFIG_OPTION_PIC */ + + + + +FT_END_HEADER + +#endif + + +/* END */ diff --git a/src/cff/cffdrivr.c b/src/cff/cffdrivr.c index 38bfc2ca3..689f22979 100644 --- a/src/cff/cffdrivr.c +++ b/src/cff/cffdrivr.c @@ -25,6 +25,7 @@ #include FT_SERVICE_POSTSCRIPT_INFO_H #include FT_SERVICE_POSTSCRIPT_NAME_H #include FT_SERVICE_TT_CMAP_H +#include FT_SERVICE_CFF_TABLE_LOAD_H #include "cffdrivr.h" #include "cffgload.h" @@ -1088,6 +1089,21 @@ #endif + /* + * CFFLOAD SERVICE + * + */ + + FT_DEFINE_SERVICE_CFFLOADREC( + cff_service_cff_load, + + (FT_Get_Standard_Encoding_Func) cff_get_standard_encoding, + (FT_Load_Private_Dict_Func) cff_load_private_dict, + (FT_FD_Select_Get_Func) cff_fd_select_get, + (FT_Blend_Check_Vector_Func) cff_blend_check_vector, + (FT_Blend_Build_Vector_Func) cff_blend_build_vector + ) + /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ @@ -1102,7 +1118,7 @@ #if !defined FT_CONFIG_OPTION_NO_GLYPH_NAMES && \ defined TT_CONFIG_OPTION_GX_VAR_SUPPORT - FT_DEFINE_SERVICEDESCREC9( + FT_DEFINE_SERVICEDESCREC10( cff_services, FT_SERVICE_ID_FONT_FORMAT, FT_FONT_FORMAT_CFF, @@ -1113,10 +1129,11 @@ FT_SERVICE_ID_GLYPH_DICT, &CFF_SERVICE_GLYPH_DICT_GET, FT_SERVICE_ID_TT_CMAP, &CFF_SERVICE_GET_CMAP_INFO_GET, FT_SERVICE_ID_CID, &CFF_SERVICE_CID_INFO_GET, - FT_SERVICE_ID_PROPERTIES, &CFF_SERVICE_PROPERTIES_GET + FT_SERVICE_ID_PROPERTIES, &CFF_SERVICE_PROPERTIES_GET, + FT_SERVICE_ID_CFF_LOAD, &CFF_SERVICE_CFF_LOAD_GET ) #elif !defined FT_CONFIG_OPTION_NO_GLYPH_NAMES - FT_DEFINE_SERVICEDESCREC7( + FT_DEFINE_SERVICEDESCREC8( cff_services, FT_SERVICE_ID_FONT_FORMAT, FT_FONT_FORMAT_CFF, @@ -1125,10 +1142,11 @@ FT_SERVICE_ID_GLYPH_DICT, &CFF_SERVICE_GLYPH_DICT_GET, FT_SERVICE_ID_TT_CMAP, &CFF_SERVICE_GET_CMAP_INFO_GET, FT_SERVICE_ID_CID, &CFF_SERVICE_CID_INFO_GET, - FT_SERVICE_ID_PROPERTIES, &CFF_SERVICE_PROPERTIES_GET + FT_SERVICE_ID_PROPERTIES, &CFF_SERVICE_PROPERTIES_GET, + FT_SERVICE_ID_CFF_LOAD, &CFF_SERVICE_CFF_LOAD_GET ) #elif defined TT_CONFIG_OPTION_GX_VAR_SUPPORT - FT_DEFINE_SERVICEDESCREC8( + FT_DEFINE_SERVICEDESCREC9( cff_services, FT_SERVICE_ID_FONT_FORMAT, FT_FONT_FORMAT_CFF, @@ -1138,10 +1156,11 @@ FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &CFF_SERVICE_PS_NAME_GET, FT_SERVICE_ID_TT_CMAP, &CFF_SERVICE_GET_CMAP_INFO_GET, FT_SERVICE_ID_CID, &CFF_SERVICE_CID_INFO_GET, - FT_SERVICE_ID_PROPERTIES, &CFF_SERVICE_PROPERTIES_GET + FT_SERVICE_ID_PROPERTIES, &CFF_SERVICE_PROPERTIES_GET, + FT_SERVICE_ID_CFF_LOAD, &CFF_SERVICE_CFF_LOAD_GET ) #else - FT_DEFINE_SERVICEDESCREC6( + FT_DEFINE_SERVICEDESCREC7( cff_services, FT_SERVICE_ID_FONT_FORMAT, FT_FONT_FORMAT_CFF, @@ -1149,7 +1168,8 @@ FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &CFF_SERVICE_PS_NAME_GET, FT_SERVICE_ID_TT_CMAP, &CFF_SERVICE_GET_CMAP_INFO_GET, FT_SERVICE_ID_CID, &CFF_SERVICE_CID_INFO_GET, - FT_SERVICE_ID_PROPERTIES, &CFF_SERVICE_PROPERTIES_GET + FT_SERVICE_ID_PROPERTIES, &CFF_SERVICE_PROPERTIES_GET, + FT_SERVICE_ID_CFF_LOAD, &CFF_SERVICE_CFF_LOAD_GET ) #endif diff --git a/src/cff/cffobjs.c b/src/cff/cffobjs.c index b0d275c73..ed154664f 100644 --- a/src/cff/cffobjs.c +++ b/src/cff/cffobjs.c @@ -496,6 +496,7 @@ FT_Service_PsCMaps psnames; PSHinter_Service pshinter; PSAux_Service psaux; + FT_Service_CFFLoad cffload; FT_Bool pure_cff = 1; FT_Bool cff2 = 0; FT_Bool sfnt_format = 0; @@ -526,6 +527,8 @@ } face->psaux = psaux; + FT_FACE_FIND_GLOBAL_SERVICE( face, cffload, CFF_LOAD ); + FT_TRACE2(( "CFF driver\n" )); /* create input stream from resource */ @@ -627,6 +630,7 @@ cff->pshinter = pshinter; cff->psnames = psnames; + cff->cffload = cffload; cffface->face_index = face_index & 0xFFFF; diff --git a/src/cff/cffpic.h b/src/cff/cffpic.h index 5db39cd62..a7e01973e 100644 --- a/src/cff/cffpic.h +++ b/src/cff/cffpic.h @@ -22,7 +22,6 @@ #include FT_INTERNAL_PIC_H - #ifndef FT_CONFIG_OPTION_PIC #define CFF_SERVICE_PS_INFO_GET cff_service_ps_info @@ -34,6 +33,7 @@ #define CFF_SERVICES_GET cff_services #define CFF_SERVICE_MULTI_MASTERS_GET cff_service_multi_masters #define CFF_SERVICE_METRICS_VAR_GET cff_service_metrics_variations +#define CFF_SERVICE_CFF_LOAD_GET cff_service_cff_load #define CFF_CMAP_ENCODING_CLASS_REC_GET cff_cmap_encoding_class_rec #define CFF_CMAP_UNICODE_CLASS_REC_GET cff_cmap_unicode_class_rec #define CFF_FIELD_HANDLERS_GET cff_field_handlers @@ -65,6 +65,7 @@ FT_BEGIN_HEADER FT_Service_PropertiesRec cff_service_properties; FT_Service_MultiMastersRec cff_service_multi_masters; FT_Service_MetricsVariationsRec cff_service_metrics_variations; + FT_Service_CFFLoadRec cff_service_cff_load; FT_CMap_ClassRec cff_cmap_encoding_class_rec; FT_CMap_ClassRec cff_cmap_unicode_class_rec; @@ -92,6 +93,8 @@ FT_BEGIN_HEADER ( GET_PIC( library )->cff_service_multi_masters ) #define CFF_SERVICE_METRICS_VAR_GET \ ( GET_PIC( library )->cff_service_metrics_variations ) +#define CFF_SERVICE_CFF_LOAD_GET \ + ( GET_PIC( library )->cff_service_cff_load ) #define CFF_CMAP_ENCODING_CLASS_REC_GET \ ( GET_PIC( library )->cff_cmap_encoding_class_rec ) #define CFF_CMAP_UNICODE_CLASS_REC_GET \ diff --git a/src/cff/cfftypes.h b/src/cff/cfftypes.h index 74f569f08..d6de1f33c 100644 --- a/src/cff/cfftypes.h +++ b/src/cff/cfftypes.h @@ -381,6 +381,9 @@ FT_BEGIN_HEADER /* interface to Postscript Names service */ FT_Service_PsCMaps psnames; + /* interface to CFFLoad service */ + const void* cffload; + /* since version 2.3.0 */ PS_FontInfoRec* font_info; /* font info dictionary */ diff --git a/src/psaux/cf2font.c b/src/psaux/cf2font.c index 4ac71a8d7..8d0dfc601 100644 --- a/src/psaux/cf2font.c +++ b/src/psaux/cf2font.c @@ -260,6 +260,7 @@ CF2_UInt lenNormalizedV = 0; FT_Fixed* normalizedV = NULL; + FT_Service_CFFLoad cffload = (FT_Service_CFFLoad)font->cffload; /* clear previous error */ font->error = FT_Err_Ok; @@ -287,16 +288,16 @@ if ( font->error ) return; - if ( cff_blend_check_vector( &subFont->blend, - subFont->private_dict.vsindex, - lenNormalizedV, - normalizedV ) ) + if ( cffload->blend_check_vector( &subFont->blend, + subFont->private_dict.vsindex, + lenNormalizedV, + normalizedV ) ) { /* blend has changed, reparse */ - cff_load_private_dict( decoder->cff, - subFont, - lenNormalizedV, - normalizedV ); + cffload->load_private_dict( decoder->cff, + subFont, + lenNormalizedV, + normalizedV ); needExtraSetup = TRUE; } #endif diff --git a/src/psaux/cf2font.h b/src/psaux/cf2font.h index 17ecd17bb..94a31ca72 100644 --- a/src/psaux/cf2font.h +++ b/src/psaux/cf2font.h @@ -40,9 +40,10 @@ #define CF2FONT_H_ +#include FT_SERVICE_CFF_TABLE_LOAD_H + #include "cf2ft.h" #include "cf2blues.h" -#include "cffload.h" FT_BEGIN_HEADER @@ -111,6 +112,8 @@ FT_BEGIN_HEADER /* counterclockwise winding */ CF2_BluesRec blues; /* computed zone data */ + + FT_Service_CFFLoad cffload; /* Pointer to cff functions */ }; diff --git a/src/psaux/cf2ft.c b/src/psaux/cf2ft.c index 169e1160b..ee8133c58 100644 --- a/src/psaux/cf2ft.c +++ b/src/psaux/cf2ft.c @@ -42,6 +42,7 @@ #include "cf2font.h" #include "cf2error.h" +#include FT_SERVICE_CFF_TABLE_LOAD_H #define CF2_MAX_SIZE cf2_intToFixed( 2000 ) /* max ppem */ @@ -324,6 +325,7 @@ font = (CF2_Font)decoder->cff->cf2_instance.data; font->memory = memory; + font->cffload = (FT_Service_CFFLoad)decoder->cff->cffload; /* initialize a client outline, to be shared by each glyph rendered */ cf2_outline_init( &font->outline, font->memory, &font->error ); diff --git a/src/psaux/cf2intrp.c b/src/psaux/cf2intrp.c index a81628074..3e7ad5763 100644 --- a/src/psaux/cf2intrp.c +++ b/src/psaux/cf2intrp.c @@ -38,6 +38,7 @@ #include "cf2ft.h" #include FT_INTERNAL_DEBUG_H +#include FT_SERVICE_CFF_TABLE_LOAD_H #include "cf2glue.h" #include "cf2font.h" @@ -47,8 +48,6 @@ #include "cf2error.h" -#include "cffload.h" - /*************************************************************************/ /* */ @@ -689,15 +688,15 @@ } /* check cached blend vector */ - if ( cff_blend_check_vector( &font->blend, - font->vsindex, - font->lenNDV, - font->NDV ) ) + if ( font->cffload->blend_check_vector( &font->blend, + font->vsindex, + font->lenNDV, + font->NDV ) ) { - lastError = cff_blend_build_vector( &font->blend, - font->vsindex, - font->lenNDV, - font->NDV ); + lastError = font->cffload->blend_build_vector( &font->blend, + font->vsindex, + font->lenNDV, + font->NDV ); if ( lastError ) goto exit; } diff --git a/src/psaux/cffdecode.c b/src/psaux/cffdecode.c index baa318bbe..dceb91652 100644 --- a/src/psaux/cffdecode.c +++ b/src/psaux/cffdecode.c @@ -1,6 +1,8 @@ #include +#include FT_INTERNAL_SERVICE_H +#include FT_SERVICE_CFF_TABLE_LOAD_H #include "cffdecode.h" #include "psobjs.h" @@ -390,7 +392,7 @@ { FT_UInt n; FT_UShort glyph_sid; - + FT_Service_CFFLoad cffload; /* CID-keyed fonts don't have glyph names */ if ( !cff->charset.sids ) @@ -400,8 +402,24 @@ if ( charcode < 0 || charcode > 255 ) return -1; +#if 0 + /* retrieve cffload from list of current modules */ + FT_Service_CFFLoad cffload; + { + FT_FACE_FIND_GLOBAL_SERVICE( face, cffload, CFF_LOAD ); + if ( !cffload ) + { + FT_ERROR(( "cff_lookup_glyph_by_stdcharcode:" + " the `cffload' module is not available\n" )); + return FT_THROW( Unimplemented_Feature ); + } + } +#endif + + cffload = (FT_Service_CFFLoad)cff->cffload; + /* Get code to SID mapping from `cff_standard_encoding'. */ - glyph_sid = cff_get_standard_encoding( (FT_UInt)charcode ); + glyph_sid = cffload->get_standard_encoding( (FT_UInt)charcode ); for ( n = 0; n < cff->num_glyphs; n++ ) { @@ -2271,11 +2289,12 @@ CFF_SubFont sub = &cff->top_font; FT_Error error = FT_Err_Ok; + FT_Service_CFFLoad cffload = (FT_Service_CFFLoad)cff->cffload; /* manage CID fonts */ if ( cff->num_subfonts ) { - FT_Byte fd_index = cff_fd_select_get( &cff->fd_select, glyph_index ); + FT_Byte fd_index = cffload->fd_select_get( &cff->fd_select, glyph_index ); if ( fd_index >= cff->num_subfonts ) From df11628b76513490ffd14669a9791b7236bcf924 Mon Sep 17 00:00:00 2001 From: Ewald Hew Date: Sun, 24 Sep 2017 22:28:07 +0200 Subject: [PATCH 253/470] Move struct declarations to `freetype/internal'. NOTE: Does not compile! This is so that the CFF functions moved to `psaux' can access the same structs that they need. * src/cff/cfftypes.h: Moved to... * include/freetype/internal/cfftypes.h: ...Here. * src/cff/cffobjs.h: Moved the struct declarations to... * include/freetype/internal/cffotypes.h: ... this new file. * include/freetype/internal/internal.h (FT_INTERNAL_CFF_TYPES_H, FT_INTERNAL_CFF_OBJECT_TYPES_H): New macros. * src/cff/cffcmap.h, src/cff/cffdrivr.c, src/cff/cffgload.c, src/cff/cffgload.h, src/cff/cffload.h, src/cff/cffobjs.c, src/cff/cffobjs.h, src/cff/cffparse.h, src/psaux/psobjs.h, include/freetype/internal/psaux.h, include/freetype/internal/services/svcfftl.h: Update includes. * src/cff/rules.mk (CFF_DRV_H): Updated. --- ChangeLog | 26 ++++ include/freetype/internal/cffotypes.h | 113 ++++++++++++++++++ .../freetype/internal}/cfftypes.h | 0 include/freetype/internal/internal.h | 3 + include/freetype/internal/psaux.h | 3 + include/freetype/internal/services/svcfftl.h | 1 + src/cff/cffcmap.h | 2 +- src/cff/cffdrivr.c | 1 + src/cff/cffgload.c | 1 - src/cff/cffgload.h | 2 +- src/cff/cffload.h | 4 +- src/cff/cffobjs.c | 1 + src/cff/cffobjs.h | 100 ---------------- src/cff/cffparse.h | 2 +- src/cff/rules.mk | 3 +- src/psaux/psobjs.h | 1 + 16 files changed, 155 insertions(+), 108 deletions(-) create mode 100644 include/freetype/internal/cffotypes.h rename {src/cff => include/freetype/internal}/cfftypes.h (100%) diff --git a/ChangeLog b/ChangeLog index a92581018..386b6c9c2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,29 @@ +2017-09-24 Ewald Hew + + [cff] Move struct declarations to `freetype/internal'. + + NOTE: Does not compile! + + This is so that the CFF functions moved to `psaux' can access the + same structs that they need. + + * src/cff/cfftypes.h: Moved to... + * include/freetype/internal/cfftypes.h: ...Here. + + * src/cff/cffobjs.h: Moved the struct declarations to... + * include/freetype/internal/cffotypes.h: ... this new file. + + * include/freetype/internal/internal.h (FT_INTERNAL_CFF_TYPES_H, + FT_INTERNAL_CFF_OBJECT_TYPES_H): New macros. + + * src/cff/cffcmap.h, src/cff/cffdrivr.c, src/cff/cffgload.c, + src/cff/cffgload.h, src/cff/cffload.h, src/cff/cffobjs.c, + src/cff/cffobjs.h, src/cff/cffparse.h, src/psaux/psobjs.h, + include/freetype/internal/psaux.h, + include/freetype/internal/services/svcfftl.h: Update includes. + + * src/cff/rules.mk (CFF_DRV_H): Updated. + 2017-09-24 Ewald Hew [psaux, cff] Add new service for inter-module calls. diff --git a/include/freetype/internal/cffotypes.h b/include/freetype/internal/cffotypes.h new file mode 100644 index 000000000..6cabaff17 --- /dev/null +++ b/include/freetype/internal/cffotypes.h @@ -0,0 +1,113 @@ +#ifndef CFFOTYPES_H_ +#define CFFOTYPES_H_ + +#include +#include FT_INTERNAL_OBJECTS_H +#include FT_INTERNAL_CFF_TYPES_H +#include FT_INTERNAL_TRUETYPE_TYPES_H +#include FT_SERVICE_POSTSCRIPT_CMAPS_H +#include FT_INTERNAL_POSTSCRIPT_HINTS_H + + +FT_BEGIN_HEADER + + + /*************************************************************************/ + /* */ + /* */ + /* CFF_Driver */ + /* */ + /* */ + /* A handle to an OpenType driver object. */ + /* */ + typedef struct CFF_DriverRec_* CFF_Driver; + + typedef TT_Face CFF_Face; + + + /*************************************************************************/ + /* */ + /* */ + /* CFF_Size */ + /* */ + /* */ + /* A handle to an OpenType size object. */ + /* */ + typedef struct CFF_SizeRec_ + { + FT_SizeRec root; + FT_ULong strike_index; /* 0xFFFFFFFF to indicate invalid */ + + } CFF_SizeRec, *CFF_Size; + + + /*************************************************************************/ + /* */ + /* */ + /* CFF_GlyphSlot */ + /* */ + /* */ + /* A handle to an OpenType glyph slot object. */ + /* */ + typedef struct CFF_GlyphSlotRec_ + { + FT_GlyphSlotRec root; + + FT_Bool hint; + FT_Bool scaled; + + FT_Fixed x_scale; + FT_Fixed y_scale; + + } CFF_GlyphSlotRec, *CFF_GlyphSlot; + + + /*************************************************************************/ + /* */ + /* */ + /* CFF_Internal */ + /* */ + /* */ + /* The interface to the `internal' field of `FT_Size'. */ + /* */ + typedef struct CFF_InternalRec_ + { + PSH_Globals topfont; + PSH_Globals subfonts[CFF_MAX_CID_FONTS]; + + } CFF_InternalRec, *CFF_Internal; + + + /*************************************************************************/ + /* */ + /* Subglyph transformation record. */ + /* */ + typedef struct CFF_Transform_ + { + FT_Fixed xx, xy; /* transformation matrix coefficients */ + FT_Fixed yx, yy; + FT_F26Dot6 ox, oy; /* offsets */ + + } CFF_Transform; + + + /***********************************************************************/ + /* */ + /* CFF driver class. */ + /* */ + typedef struct CFF_DriverRec_ + { + FT_DriverRec root; + + FT_UInt hinting_engine; + FT_Bool no_stem_darkening; + FT_Int darken_params[8]; + FT_Int32 random_seed; + + } CFF_DriverRec; + + +FT_END_HEADER + + +#endif diff --git a/src/cff/cfftypes.h b/include/freetype/internal/cfftypes.h similarity index 100% rename from src/cff/cfftypes.h rename to include/freetype/internal/cfftypes.h diff --git a/include/freetype/internal/internal.h b/include/freetype/internal/internal.h index 02046813a..23f84b435 100644 --- a/include/freetype/internal/internal.h +++ b/include/freetype/internal/internal.h @@ -47,6 +47,9 @@ #define FT_INTERNAL_AUTOHINT_H +#define FT_INTERNAL_CFF_TYPES_H +#define FT_INTERNAL_CFF_OBJECTS_TYPES_H + #if defined( _MSC_VER ) /* Visual C++ (and Intel C++) */ diff --git a/include/freetype/internal/psaux.h b/include/freetype/internal/psaux.h index bcc84e38d..f127a44cc 100644 --- a/include/freetype/internal/psaux.h +++ b/include/freetype/internal/psaux.h @@ -27,6 +27,9 @@ #include FT_INTERNAL_HASH_H #include FT_INTERNAL_TRUETYPE_TYPES_H #include FT_SERVICE_POSTSCRIPT_CMAPS_H +#include FT_INTERNAL_CFF_TYPES_H +#include FT_INTERNAL_CFF_OBJECTS_TYPES_H + FT_BEGIN_HEADER diff --git a/include/freetype/internal/services/svcfftl.h b/include/freetype/internal/services/svcfftl.h index 18e2276a9..46630415a 100644 --- a/include/freetype/internal/services/svcfftl.h +++ b/include/freetype/internal/services/svcfftl.h @@ -2,6 +2,7 @@ #define SVCFFTL_H_ #include FT_INTERNAL_SERVICE_H +#include FT_INTERNAL_CFF_TYPES_H FT_BEGIN_HEADER diff --git a/src/cff/cffcmap.h b/src/cff/cffcmap.h index 7792e0424..227c91afb 100644 --- a/src/cff/cffcmap.h +++ b/src/cff/cffcmap.h @@ -19,7 +19,7 @@ #ifndef CFFCMAP_H_ #define CFFCMAP_H_ -#include "cffobjs.h" +#include FT_INTERNAL_CFF_OBJECTS_TYPES_H FT_BEGIN_HEADER diff --git a/src/cff/cffdrivr.c b/src/cff/cffdrivr.c index 689f22979..4c9b1cd99 100644 --- a/src/cff/cffdrivr.c +++ b/src/cff/cffdrivr.c @@ -32,6 +32,7 @@ #include "cffload.h" #include "cffcmap.h" #include "cffparse.h" +#include "cffobjs.h" #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT #include FT_SERVICE_MULTIPLE_MASTERS_H diff --git a/src/cff/cffgload.c b/src/cff/cffgload.c index 18dbf6542..92ca08bd8 100644 --- a/src/cff/cffgload.c +++ b/src/cff/cffgload.c @@ -25,7 +25,6 @@ #include FT_OUTLINE_H #include FT_CFF_DRIVER_H -#include "cffobjs.h" #include "cffload.h" #include "cffgload.h" diff --git a/src/cff/cffgload.h b/src/cff/cffgload.h index b2e945d03..ed291b87d 100644 --- a/src/cff/cffgload.h +++ b/src/cff/cffgload.h @@ -22,7 +22,7 @@ #include #include FT_FREETYPE_H -#include "cffobjs.h" +#include FT_INTERNAL_CFF_OBJECTS_TYPES_H FT_BEGIN_HEADER diff --git a/src/cff/cffload.h b/src/cff/cffload.h index c745e8127..82a041705 100644 --- a/src/cff/cffload.h +++ b/src/cff/cffload.h @@ -21,9 +21,9 @@ #include -#include "cfftypes.h" +#include FT_INTERNAL_CFF_TYPES_H #include "cffparse.h" -#include "cffobjs.h" /* for CFF_Face */ +#include FT_INTERNAL_CFF_OBJECTS_TYPES_H /* for CFF_Face */ FT_BEGIN_HEADER diff --git a/src/cff/cffobjs.c b/src/cff/cffobjs.c index ed154664f..f9013e772 100644 --- a/src/cff/cffobjs.c +++ b/src/cff/cffobjs.c @@ -32,6 +32,7 @@ #include FT_SERVICE_MULTIPLE_MASTERS_H #endif +#include FT_INTERNAL_CFF_OBJECTS_TYPES_H #include "cffobjs.h" #include "cffload.h" #include "cffcmap.h" diff --git a/src/cff/cffobjs.h b/src/cff/cffobjs.h index 1dba694c5..839a61c44 100644 --- a/src/cff/cffobjs.h +++ b/src/cff/cffobjs.h @@ -21,111 +21,11 @@ #include -#include FT_INTERNAL_OBJECTS_H -#include "cfftypes.h" -#include FT_INTERNAL_TRUETYPE_TYPES_H -#include FT_SERVICE_POSTSCRIPT_CMAPS_H -#include FT_INTERNAL_POSTSCRIPT_HINTS_H FT_BEGIN_HEADER - /*************************************************************************/ - /* */ - /* */ - /* CFF_Driver */ - /* */ - /* */ - /* A handle to an OpenType driver object. */ - /* */ - typedef struct CFF_DriverRec_* CFF_Driver; - - typedef TT_Face CFF_Face; - - - /*************************************************************************/ - /* */ - /* */ - /* CFF_Size */ - /* */ - /* */ - /* A handle to an OpenType size object. */ - /* */ - typedef struct CFF_SizeRec_ - { - FT_SizeRec root; - FT_ULong strike_index; /* 0xFFFFFFFF to indicate invalid */ - - } CFF_SizeRec, *CFF_Size; - - - /*************************************************************************/ - /* */ - /* */ - /* CFF_GlyphSlot */ - /* */ - /* */ - /* A handle to an OpenType glyph slot object. */ - /* */ - typedef struct CFF_GlyphSlotRec_ - { - FT_GlyphSlotRec root; - - FT_Bool hint; - FT_Bool scaled; - - FT_Fixed x_scale; - FT_Fixed y_scale; - - } CFF_GlyphSlotRec, *CFF_GlyphSlot; - - - /*************************************************************************/ - /* */ - /* */ - /* CFF_Internal */ - /* */ - /* */ - /* The interface to the `internal' field of `FT_Size'. */ - /* */ - typedef struct CFF_InternalRec_ - { - PSH_Globals topfont; - PSH_Globals subfonts[CFF_MAX_CID_FONTS]; - - } CFF_InternalRec, *CFF_Internal; - - - /*************************************************************************/ - /* */ - /* Subglyph transformation record. */ - /* */ - typedef struct CFF_Transform_ - { - FT_Fixed xx, xy; /* transformation matrix coefficients */ - FT_Fixed yx, yy; - FT_F26Dot6 ox, oy; /* offsets */ - - } CFF_Transform; - - - /***********************************************************************/ - /* */ - /* CFF driver class. */ - /* */ - typedef struct CFF_DriverRec_ - { - FT_DriverRec root; - - FT_UInt hinting_engine; - FT_Bool no_stem_darkening; - FT_Int darken_params[8]; - FT_Int32 random_seed; - - } CFF_DriverRec; - - FT_LOCAL( FT_Error ) cff_size_init( FT_Size size ); /* CFF_Size */ diff --git a/src/cff/cffparse.h b/src/cff/cffparse.h index 83d1bba45..961c26501 100644 --- a/src/cff/cffparse.h +++ b/src/cff/cffparse.h @@ -21,7 +21,7 @@ #include -#include "cfftypes.h" +#include FT_INTERNAL_CFF_TYPES_H #include FT_INTERNAL_OBJECTS_H diff --git a/src/cff/rules.mk b/src/cff/rules.mk index feecf4611..473b25c1d 100644 --- a/src/cff/rules.mk +++ b/src/cff/rules.mk @@ -39,8 +39,7 @@ CFF_DRV_SRC := $(CFF_DIR)/cffcmap.c \ # CFF_DRV_H := $(CFF_DRV_SRC:%.c=%.h) \ $(CFF_DIR)/cfferrs.h \ - $(CFF_DIR)/cfftoken.h \ - $(CFF_DIR)/cfftypes.h + $(CFF_DIR)/cfftoken.h # CFF driver object(s) diff --git a/src/psaux/psobjs.h b/src/psaux/psobjs.h index 73cd9054e..c06bb281c 100644 --- a/src/psaux/psobjs.h +++ b/src/psaux/psobjs.h @@ -22,6 +22,7 @@ #include #include FT_INTERNAL_POSTSCRIPT_AUX_H +#include FT_INTERNAL_CFF_OBJECTS_TYPES_H FT_BEGIN_HEADER From b624868b8e9355ad5a4ff07d67aa6188499e3334 Mon Sep 17 00:00:00 2001 From: Ewald Hew Date: Sun, 24 Sep 2017 22:32:40 +0200 Subject: [PATCH 254/470] Move `cff_random' into `psaux' service. NOTE: Does not compile! Minor fix to allow both `cff' and `psaux' to use `cff_random'. * src/cff/cffload.c (cff_random): Move to... * src/psaux/psobjs.c: Here. * src/cff/cffload.h: Move corresponding declaration to `src/psaux/psobjs.h'. * include/freetype/internal/psaux.h (PSAux_ServiceRec): Register the function here... * src/psaux/psauxmod.c: And here. * src/cff/cffload.c, src/psaux/cf2intrp.c: Update code. --- ChangeLog | 19 +++++++++++++++++++ include/freetype/internal/psaux.h | 4 ++++ src/cff/cffload.c | 18 ++++-------------- src/cff/cffload.h | 3 --- src/psaux/cf2intrp.c | 1 + src/psaux/psauxmod.c | 1 + src/psaux/psobjs.c | 12 ++++++++++++ src/psaux/psobjs.h | 4 ++++ 8 files changed, 45 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index 386b6c9c2..45fba7d5c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,22 @@ +2017-09-24 Ewald Hew + + [psaux, cff] Move `cff_random' into `psaux' service. + + NOTE: Does not compile! + + Minor fix to allow both `cff' and `psaux' to use `cff_random'. + + * src/cff/cffload.c (cff_random): Move to... + * src/psaux/psobjs.c: Here. + * src/cff/cffload.h: Move corresponding declaration to + `src/psaux/psobjs.h'. + + * include/freetype/internal/psaux.h (PSAux_ServiceRec): Register the + function here... + * src/psaux/psauxmod.c: And here. + + * src/cff/cffload.c, src/psaux/cf2intrp.c: Update code. + 2017-09-24 Ewald Hew [cff] Move struct declarations to `freetype/internal'. diff --git a/include/freetype/internal/psaux.h b/include/freetype/internal/psaux.h index f127a44cc..258009be5 100644 --- a/include/freetype/internal/psaux.h +++ b/include/freetype/internal/psaux.h @@ -1067,6 +1067,10 @@ FT_BEGIN_HEADER FT_Offset length, FT_UShort seed ); + FT_UInt32 + (*cff_random)( FT_UInt32 r ); + + T1_CMap_Classes t1_cmap_classes; /* fields after this comment line were added after version 2.1.10 */ diff --git a/src/cff/cffload.c b/src/cff/cffload.c index 12420384a..5e6839d6c 100644 --- a/src/cff/cffload.c +++ b/src/cff/cffload.c @@ -1945,18 +1945,6 @@ } - FT_LOCAL_DEF( FT_UInt32 ) - cff_random( FT_UInt32 r ) - { - /* a 32bit version of the `xorshift' algorithm */ - r ^= r << 13; - r ^= r >> 17; - r ^= r << 5; - - return r; - } - - /* There are 3 ways to call this function, distinguished by code. */ /* */ /* . CFF_CODE_TOPDICT for either a CFF Top DICT or a CFF Font DICT */ @@ -1980,6 +1968,8 @@ CFF_FontRecDict top = &subfont->font_dict; CFF_Private priv = &subfont->private_dict; + PSAux_Service psaux = (PSAux_Service)face->psaux; + FT_Bool cff2 = FT_BOOL( code == CFF2_CODE_TOPDICT || code == CFF2_CODE_FONTDICT ); FT_UInt stackSize = cff2 ? CFF2_DEFAULT_STACK @@ -2094,7 +2084,7 @@ do { driver->random_seed = - (FT_Int32)cff_random( (FT_UInt32)driver->random_seed ); + (FT_Int32)psaux->cff_random( (FT_UInt32)driver->random_seed ); } while ( driver->random_seed < 0 ); } @@ -2107,7 +2097,7 @@ do { face->root.internal->random_seed = - (FT_Int32)cff_random( (FT_UInt32)face->root.internal->random_seed ); + (FT_Int32)psaux->cff_random( (FT_UInt32)face->root.internal->random_seed ); } while ( face->root.internal->random_seed < 0 ); } diff --git a/src/cff/cffload.h b/src/cff/cffload.h index 82a041705..ef3c1bd86 100644 --- a/src/cff/cffload.h +++ b/src/cff/cffload.h @@ -61,9 +61,6 @@ FT_BEGIN_HEADER FT_UInt cid ); - FT_LOCAL( FT_UInt32 ) - cff_random( FT_UInt32 r ); - FT_LOCAL( FT_Error ) cff_font_load( FT_Library library, FT_Stream stream, diff --git a/src/psaux/cf2intrp.c b/src/psaux/cf2intrp.c index 3e7ad5763..605b46838 100644 --- a/src/psaux/cf2intrp.c +++ b/src/psaux/cf2intrp.c @@ -47,6 +47,7 @@ #include "cf2intrp.h" #include "cf2error.h" +#include "psobjs.h" /* for cff_random */ /*************************************************************************/ diff --git a/src/psaux/psauxmod.c b/src/psaux/psauxmod.c index cd9f52529..a8808810b 100644 --- a/src/psaux/psauxmod.c +++ b/src/psaux/psauxmod.c @@ -143,6 +143,7 @@ &t1_builder_funcs, &t1_decoder_funcs, t1_decrypt, + cff_random, (const T1_CMap_ClassesRec*) &t1_cmap_classes, diff --git a/src/psaux/psobjs.c b/src/psaux/psobjs.c index db268fc42..92691db6c 100644 --- a/src/psaux/psobjs.c +++ b/src/psaux/psobjs.c @@ -2044,4 +2044,16 @@ } + FT_LOCAL_DEF( FT_UInt32 ) + cff_random( FT_UInt32 r ) + { + /* a 32bit version of the `xorshift' algorithm */ + r ^= r << 13; + r ^= r >> 17; + r ^= r << 5; + + return r; + } + + /* END */ diff --git a/src/psaux/psobjs.h b/src/psaux/psobjs.h index c06bb281c..c16379462 100644 --- a/src/psaux/psobjs.h +++ b/src/psaux/psobjs.h @@ -247,6 +247,10 @@ FT_BEGIN_HEADER FT_UShort seed ); + FT_LOCAL( FT_UInt32 ) + cff_random( FT_UInt32 r ); + + FT_END_HEADER #endif /* PSOBJS_H_ */ From 8a1b5c0c6da164a1a021eb24e996d2adf26f98bb Mon Sep 17 00:00:00 2001 From: Ewald Hew Date: Sun, 24 Sep 2017 22:35:47 +0200 Subject: [PATCH 255/470] Minor fix. Use `MultiMasters' service in `psaux' instead of a call to `cff'. The project builds if CFF_CONFIG_OPTION_OLD_ENGINE is not defined. * src/psaux/cf2ft.c: Update includes. (cf2_getNormalizedVector): Use `mm->get_var_blend' instead of `cff_get_var_blend'. --- ChangeLog | 11 +++++++++++ src/psaux/cf2ft.c | 15 +++++++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 45fba7d5c..d277cf337 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2017-09-24 Ewald Hew + + [psaux] Minor fix. + + Use `MultiMasters' service in `psaux' instead of a call to `cff'. + The project builds if CFF_CONFIG_OPTION_OLD_ENGINE is not defined. + + * src/psaux/cf2ft.c: Update includes. + (cf2_getNormalizedVector): Use `mm->get_var_blend' instead of + `cff_get_var_blend'. + 2017-09-24 Ewald Hew [psaux, cff] Move `cff_random' into `psaux' service. diff --git a/src/psaux/cf2ft.c b/src/psaux/cf2ft.c index ee8133c58..6bffce98b 100644 --- a/src/psaux/cf2ft.c +++ b/src/psaux/cf2ft.c @@ -42,6 +42,11 @@ #include "cf2font.h" #include "cf2error.h" +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT +#include FT_MULTIPLE_MASTERS_H +#include FT_SERVICE_MULTIPLE_MASTERS_H +#endif + #include FT_SERVICE_CFF_TABLE_LOAD_H #define CF2_MAX_SIZE cf2_intToFixed( 2000 ) /* max ppem */ @@ -456,10 +461,16 @@ CF2_UInt *len, FT_Fixed* *vec ) { + TT_Face face; + FT_Service_MultiMasters mm; + FT_ASSERT( decoder && decoder->builder.face ); FT_ASSERT( vec && len ); - - return cff_get_var_blend( decoder->builder.face, len, NULL, vec, NULL ); + + face = decoder->builder.face; + mm = (FT_Service_MultiMasters)face->mm; + + return mm->get_var_blend( FT_FACE( face ), len, NULL, vec, NULL ); } #endif From 766f529a3109870f5921ff812e9b7832263c0fbc Mon Sep 17 00:00:00 2001 From: Ewald Hew Date: Sun, 24 Sep 2017 22:40:07 +0200 Subject: [PATCH 256/470] Rename files. Replace the `cf2' file name prefix with `ps' as the Adobe engine will be used for both PostScript Types 1 and 2 (CFF) instead of just CFF. s/cf2/ps/ for all following. * src/psaux/cf2*: Rename files. * src/psaux/*: Update includes. * src/psaux/Jamfile (_sources), src/psaux/rules.mk (PSAUX_DRC_SRC, PSAUX_DRV_H): Update file references. --- ChangeLog | 16 ++++++++++++++++ src/psaux/Jamfile | 18 +++++++++--------- src/psaux/{cf2arrst.c => psarrst.c} | 8 ++++---- src/psaux/{cf2arrst.h => psarrst.h} | 2 +- src/psaux/psaux.c | 18 +++++++++--------- src/psaux/psauxmod.c | 2 +- src/psaux/{cf2blues.c => psblues.c} | 8 ++++---- src/psaux/{cf2blues.h => psblues.h} | 2 +- src/psaux/{cf2error.c => pserror.c} | 4 ++-- src/psaux/{cf2error.h => pserror.h} | 2 +- src/psaux/{cf2fixed.h => psfixed.h} | 0 src/psaux/{cf2font.c => psfont.c} | 10 +++++----- src/psaux/{cf2font.h => psfont.h} | 4 ++-- src/psaux/{cf2ft.c => psft.c} | 6 +++--- src/psaux/{cf2ft.h => psft.h} | 4 ++-- src/psaux/{cf2glue.h => psglue.h} | 8 ++++---- src/psaux/{cf2hints.c => pshints.c} | 10 +++++----- src/psaux/{cf2hints.h => pshints.h} | 0 src/psaux/{cf2intrp.c => psintrp.c} | 14 +++++++------- src/psaux/{cf2intrp.h => psintrp.h} | 4 ++-- src/psaux/{cf2read.c => psread.c} | 6 +++--- src/psaux/{cf2read.h => psread.h} | 0 src/psaux/{cf2stack.c => psstack.c} | 10 +++++----- src/psaux/{cf2stack.h => psstack.h} | 0 src/psaux/{cf2types.h => pstypes.h} | 0 src/psaux/rules.mk | 26 +++++++++++++------------- 26 files changed, 99 insertions(+), 83 deletions(-) rename src/psaux/{cf2arrst.c => psarrst.c} (98%) rename src/psaux/{cf2arrst.h => psarrst.h} (99%) rename src/psaux/{cf2blues.c => psblues.c} (99%) rename src/psaux/{cf2blues.h => psblues.h} (99%) rename src/psaux/{cf2error.c => pserror.c} (98%) rename src/psaux/{cf2error.h => pserror.h} (99%) rename src/psaux/{cf2fixed.h => psfixed.h} (100%) rename src/psaux/{cf2font.c => psfont.c} (99%) rename src/psaux/{cf2font.h => psfont.h} (99%) rename src/psaux/{cf2ft.c => psft.c} (99%) rename src/psaux/{cf2ft.h => psft.h} (99%) rename src/psaux/{cf2glue.h => psglue.h} (98%) rename src/psaux/{cf2hints.c => pshints.c} (99%) rename src/psaux/{cf2hints.h => pshints.h} (100%) rename src/psaux/{cf2intrp.c => psintrp.c} (99%) rename src/psaux/{cf2intrp.h => psintrp.h} (98%) rename src/psaux/{cf2read.c => psread.c} (98%) rename src/psaux/{cf2read.h => psread.h} (100%) rename src/psaux/{cf2stack.c => psstack.c} (98%) rename src/psaux/{cf2stack.h => psstack.h} (100%) rename src/psaux/{cf2types.h => pstypes.h} (100%) diff --git a/ChangeLog b/ChangeLog index d277cf337..6a94c5577 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2017-09-24 Ewald Hew + + [psaux] Rename files. + + Replace the `cf2' file name prefix with `ps' as the Adobe engine + will be used for both PostScript Types 1 and 2 (CFF) instead of just + CFF. + + s/cf2/ps/ for all following. + + * src/psaux/cf2*: Rename files. + * src/psaux/*: Update includes. + + * src/psaux/Jamfile (_sources), src/psaux/rules.mk (PSAUX_DRC_SRC, + PSAUX_DRV_H): Update file references. + 2017-09-24 Ewald Hew [psaux] Minor fix. diff --git a/src/psaux/Jamfile b/src/psaux/Jamfile index 8ca518959..392acabfd 100644 --- a/src/psaux/Jamfile +++ b/src/psaux/Jamfile @@ -22,15 +22,15 @@ SubDir FT2_TOP $(FT2_SRC_DIR) psaux ; psobjs t1cmap t1decode - cf2arrst - cf2blues - cf2error - cf2font - cf2ft - cf2hints - cf2intrp - cf2read - cf2stack + psarrst + psblues + pserror + psfont + psft + pshints + psintrp + psread + psstack ; } else diff --git a/src/psaux/cf2arrst.c b/src/psaux/psarrst.c similarity index 98% rename from src/psaux/cf2arrst.c rename to src/psaux/psarrst.c index 6796450fe..9bd09972e 100644 --- a/src/psaux/cf2arrst.c +++ b/src/psaux/psarrst.c @@ -36,13 +36,13 @@ /***************************************************************************/ -#include "cf2ft.h" +#include "psft.h" #include FT_INTERNAL_DEBUG_H -#include "cf2glue.h" -#include "cf2arrst.h" +#include "psglue.h" +#include "psarrst.h" -#include "cf2error.h" +#include "pserror.h" /* diff --git a/src/psaux/cf2arrst.h b/src/psaux/psarrst.h similarity index 99% rename from src/psaux/cf2arrst.h rename to src/psaux/psarrst.h index 3c21a3b67..095938db0 100644 --- a/src/psaux/cf2arrst.h +++ b/src/psaux/psarrst.h @@ -40,7 +40,7 @@ #define CF2ARRST_H_ -#include "cf2error.h" +#include "pserror.h" FT_BEGIN_HEADER diff --git a/src/psaux/psaux.c b/src/psaux/psaux.c index f99884afc..e30c9b084 100644 --- a/src/psaux/psaux.c +++ b/src/psaux/psaux.c @@ -27,15 +27,15 @@ #include "t1decode.c" #include "cffdecode.c" -#include "cf2arrst.c" -#include "cf2blues.c" -#include "cf2error.c" -#include "cf2font.c" -#include "cf2ft.c" -#include "cf2hints.c" -#include "cf2intrp.c" -#include "cf2read.c" -#include "cf2stack.c" +#include "psarrst.c" +#include "psblues.c" +#include "pserror.c" +#include "psfont.c" +#include "psft.c" +#include "pshints.c" +#include "psintrp.c" +#include "psread.c" +#include "psstack.c" /* END */ diff --git a/src/psaux/psauxmod.c b/src/psaux/psauxmod.c index a8808810b..eb94d54d4 100644 --- a/src/psaux/psauxmod.c +++ b/src/psaux/psauxmod.c @@ -21,7 +21,7 @@ #include "psobjs.h" #include "t1decode.h" #include "t1cmap.h" -#include "cf2ft.h" +#include "psft.h" #include "cffdecode.h" #ifndef T1_CONFIG_OPTION_NO_AFM diff --git a/src/psaux/cf2blues.c b/src/psaux/psblues.c similarity index 99% rename from src/psaux/cf2blues.c rename to src/psaux/psblues.c index c491f2f9e..b102b37a8 100644 --- a/src/psaux/cf2blues.c +++ b/src/psaux/psblues.c @@ -36,12 +36,12 @@ /***************************************************************************/ -#include "cf2ft.h" +#include "psft.h" #include FT_INTERNAL_DEBUG_H -#include "cf2blues.h" -#include "cf2hints.h" -#include "cf2font.h" +#include "psblues.h" +#include "pshints.h" +#include "psfont.h" /*************************************************************************/ diff --git a/src/psaux/cf2blues.h b/src/psaux/psblues.h similarity index 99% rename from src/psaux/cf2blues.h rename to src/psaux/psblues.h index a6bcd9de5..48e8be83c 100644 --- a/src/psaux/cf2blues.h +++ b/src/psaux/psblues.h @@ -69,7 +69,7 @@ #define CF2BLUES_H_ -#include "cf2glue.h" +#include "psglue.h" FT_BEGIN_HEADER diff --git a/src/psaux/cf2error.c b/src/psaux/pserror.c similarity index 98% rename from src/psaux/cf2error.c rename to src/psaux/pserror.c index e3dd69f50..7b1d4b555 100644 --- a/src/psaux/cf2error.c +++ b/src/psaux/pserror.c @@ -36,8 +36,8 @@ /***************************************************************************/ -#include "cf2ft.h" -#include "cf2error.h" +#include "psft.h" +#include "pserror.h" FT_LOCAL_DEF( void ) diff --git a/src/psaux/cf2error.h b/src/psaux/pserror.h similarity index 99% rename from src/psaux/cf2error.h rename to src/psaux/pserror.h index d2c770d29..e2a44b902 100644 --- a/src/psaux/cf2error.h +++ b/src/psaux/pserror.h @@ -50,7 +50,7 @@ #include FT_ERRORS_H -#include "cf2ft.h" +#include "psft.h" FT_BEGIN_HEADER diff --git a/src/psaux/cf2fixed.h b/src/psaux/psfixed.h similarity index 100% rename from src/psaux/cf2fixed.h rename to src/psaux/psfixed.h diff --git a/src/psaux/cf2font.c b/src/psaux/psfont.c similarity index 99% rename from src/psaux/cf2font.c rename to src/psaux/psfont.c index 8d0dfc601..13cff7329 100644 --- a/src/psaux/cf2font.c +++ b/src/psaux/psfont.c @@ -39,12 +39,12 @@ #include #include FT_INTERNAL_CALC_H -#include "cf2ft.h" +#include "psft.h" -#include "cf2glue.h" -#include "cf2font.h" -#include "cf2error.h" -#include "cf2intrp.h" +#include "psglue.h" +#include "psfont.h" +#include "pserror.h" +#include "psintrp.h" /* Compute a stem darkening amount in character space. */ diff --git a/src/psaux/cf2font.h b/src/psaux/psfont.h similarity index 99% rename from src/psaux/cf2font.h rename to src/psaux/psfont.h index 94a31ca72..f7ce1492c 100644 --- a/src/psaux/cf2font.h +++ b/src/psaux/psfont.h @@ -42,8 +42,8 @@ #include FT_SERVICE_CFF_TABLE_LOAD_H -#include "cf2ft.h" -#include "cf2blues.h" +#include "psft.h" +#include "psblues.h" FT_BEGIN_HEADER diff --git a/src/psaux/cf2ft.c b/src/psaux/psft.c similarity index 99% rename from src/psaux/cf2ft.c rename to src/psaux/psft.c index 6bffce98b..210710076 100644 --- a/src/psaux/cf2ft.c +++ b/src/psaux/psft.c @@ -36,11 +36,11 @@ /***************************************************************************/ -#include "cf2ft.h" +#include "psft.h" #include FT_INTERNAL_DEBUG_H -#include "cf2font.h" -#include "cf2error.h" +#include "psfont.h" +#include "pserror.h" #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT #include FT_MULTIPLE_MASTERS_H diff --git a/src/psaux/cf2ft.h b/src/psaux/psft.h similarity index 99% rename from src/psaux/cf2ft.h rename to src/psaux/psft.h index 772fb0710..bbb2cf7bb 100644 --- a/src/psaux/cf2ft.h +++ b/src/psaux/psft.h @@ -40,7 +40,7 @@ #define CF2FT_H_ -#include "cf2types.h" +#include "pstypes.h" /* TODO: disable asserts for now */ @@ -49,7 +49,7 @@ #include FT_SYSTEM_H -#include "cf2glue.h" +#include "psglue.h" #include FT_INTERNAL_POSTSCRIPT_AUX_H /* for CFF_Decoder */ diff --git a/src/psaux/cf2glue.h b/src/psaux/psglue.h similarity index 98% rename from src/psaux/cf2glue.h rename to src/psaux/psglue.h index 56a7c248f..fba67377b 100644 --- a/src/psaux/cf2glue.h +++ b/src/psaux/psglue.h @@ -41,10 +41,10 @@ /* common includes for other modules */ -#include "cf2error.h" -#include "cf2fixed.h" -#include "cf2arrst.h" -#include "cf2read.h" +#include "pserror.h" +#include "psfixed.h" +#include "psarrst.h" +#include "psread.h" FT_BEGIN_HEADER diff --git a/src/psaux/cf2hints.c b/src/psaux/pshints.c similarity index 99% rename from src/psaux/cf2hints.c rename to src/psaux/pshints.c index 656eb2cff..dab6b2b55 100644 --- a/src/psaux/cf2hints.c +++ b/src/psaux/pshints.c @@ -36,13 +36,13 @@ /***************************************************************************/ -#include "cf2ft.h" +#include "psft.h" #include FT_INTERNAL_DEBUG_H -#include "cf2glue.h" -#include "cf2font.h" -#include "cf2hints.h" -#include "cf2intrp.h" +#include "psglue.h" +#include "psfont.h" +#include "pshints.h" +#include "psintrp.h" /*************************************************************************/ diff --git a/src/psaux/cf2hints.h b/src/psaux/pshints.h similarity index 100% rename from src/psaux/cf2hints.h rename to src/psaux/pshints.h diff --git a/src/psaux/cf2intrp.c b/src/psaux/psintrp.c similarity index 99% rename from src/psaux/cf2intrp.c rename to src/psaux/psintrp.c index 605b46838..1629d7bc8 100644 --- a/src/psaux/cf2intrp.c +++ b/src/psaux/psintrp.c @@ -36,17 +36,17 @@ /***************************************************************************/ -#include "cf2ft.h" +#include "psft.h" #include FT_INTERNAL_DEBUG_H #include FT_SERVICE_CFF_TABLE_LOAD_H -#include "cf2glue.h" -#include "cf2font.h" -#include "cf2stack.h" -#include "cf2hints.h" -#include "cf2intrp.h" +#include "psglue.h" +#include "psfont.h" +#include "psstack.h" +#include "pshints.h" +#include "psintrp.h" -#include "cf2error.h" +#include "pserror.h" #include "psobjs.h" /* for cff_random */ diff --git a/src/psaux/cf2intrp.h b/src/psaux/psintrp.h similarity index 98% rename from src/psaux/cf2intrp.h rename to src/psaux/psintrp.h index ec030e894..01809a92a 100644 --- a/src/psaux/cf2intrp.h +++ b/src/psaux/psintrp.h @@ -40,8 +40,8 @@ #define CF2INTRP_H_ -#include "cf2ft.h" -#include "cf2hints.h" +#include "psft.h" +#include "pshints.h" FT_BEGIN_HEADER diff --git a/src/psaux/cf2read.c b/src/psaux/psread.c similarity index 98% rename from src/psaux/cf2read.c rename to src/psaux/psread.c index 2b429e3ee..237ab7b34 100644 --- a/src/psaux/cf2read.c +++ b/src/psaux/psread.c @@ -36,12 +36,12 @@ /***************************************************************************/ -#include "cf2ft.h" +#include "psft.h" #include FT_INTERNAL_DEBUG_H -#include "cf2glue.h" +#include "psglue.h" -#include "cf2error.h" +#include "pserror.h" /* Define CF2_IO_FAIL as 1 to enable random errors and random */ diff --git a/src/psaux/cf2read.h b/src/psaux/psread.h similarity index 100% rename from src/psaux/cf2read.h rename to src/psaux/psread.h diff --git a/src/psaux/cf2stack.c b/src/psaux/psstack.c similarity index 98% rename from src/psaux/cf2stack.c rename to src/psaux/psstack.c index 12a026d21..e97ec0097 100644 --- a/src/psaux/cf2stack.c +++ b/src/psaux/psstack.c @@ -36,14 +36,14 @@ /***************************************************************************/ -#include "cf2ft.h" +#include "psft.h" #include FT_INTERNAL_DEBUG_H -#include "cf2glue.h" -#include "cf2font.h" -#include "cf2stack.h" +#include "psglue.h" +#include "psfont.h" +#include "psstack.h" -#include "cf2error.h" +#include "pserror.h" /* Allocate and initialize an instance of CF2_Stack. */ diff --git a/src/psaux/cf2stack.h b/src/psaux/psstack.h similarity index 100% rename from src/psaux/cf2stack.h rename to src/psaux/psstack.h diff --git a/src/psaux/cf2types.h b/src/psaux/pstypes.h similarity index 100% rename from src/psaux/cf2types.h rename to src/psaux/pstypes.h diff --git a/src/psaux/rules.mk b/src/psaux/rules.mk index 50dd688df..266d446f8 100644 --- a/src/psaux/rules.mk +++ b/src/psaux/rules.mk @@ -34,24 +34,24 @@ PSAUX_DRV_SRC := $(PSAUX_DIR)/psobjs.c \ $(PSAUX_DIR)/afmparse.c \ $(PSAUX_DIR)/psconv.c \ $(PSAUX_DIR)/psauxmod.c \ - $(PSAUX_DIR)/cf2arrst.c \ - $(PSAUX_DIR)/cf2blues.c \ - $(PSAUX_DIR)/cf2error.c \ - $(PSAUX_DIR)/cf2font.c \ - $(PSAUX_DIR)/cf2ft.c \ - $(PSAUX_DIR)/cf2hints.c \ - $(PSAUX_DIR)/cf2intrp.c \ - $(PSAUX_DIR)/cf2read.c \ - $(PSAUX_DIR)/cf2stack.c \ - $(PSAUX_DIR)/cffdecode.c + $(PSAUX_DIR)/psarrst.c \ + $(PSAUX_DIR)/psblues.c \ + $(PSAUX_DIR)/pserror.c \ + $(PSAUX_DIR)/psfont.c \ + $(PSAUX_DIR)/psft.c \ + $(PSAUX_DIR)/pshints.c \ + $(PSAUX_DIR)/psintrp.c \ + $(PSAUX_DIR)/psread.c \ + $(PSAUX_DIR)/psstack.c \ + $(PSAUX_DIR)/cffdecode.c # PSAUX driver headers # PSAUX_DRV_H := $(PSAUX_DRV_SRC:%c=%h) \ $(PSAUX_DIR)/psauxerr.h \ - $(PSAUX_DIR)/cf2fixed.h \ - $(PSAUX_DIR)/cf2glue.h \ - $(PSAUX_DIR)/cf2types.h + $(PSAUX_DIR)/psfixed.h \ + $(PSAUX_DIR)/psglue.h \ + $(PSAUX_DIR)/pstypes.h # PSAUX driver object(s) From eba54c28dc97ebcfeb51078025c3c7d996410aa4 Mon Sep 17 00:00:00 2001 From: Ewald Hew Date: Sun, 24 Sep 2017 22:49:56 +0200 Subject: [PATCH 257/470] Add objects for new interpreter. Introduce `PS_Decoder' and `PS_Builder' which include all fields from either Type 1 or CFF decoders/builders. * include/freetype/internal/psaux.h (PS_Builder, PS_Decoder): New structs. * src/psaux/psobjs.c, src/psaux/psobjs.h: Add `PS_Builder' functions. * src/psaux/psdecode.c, src/psaux/psdecode.h: New files to hold `PS_Decoder' initialization functions. * src/psaux/psaux.c, src/psaux/Jamfile (_sources), src/psaux/rules.mk (PSAUX_DRV_SRC): Updated. --- ChangeLog | 19 +++ include/freetype/internal/psaux.h | 198 ++++++++++++++++++++++++ src/psaux/Jamfile | 2 + src/psaux/psaux.c | 1 + src/psaux/psdecode.c | 57 +++++++ src/psaux/psdecode.h | 13 ++ src/psaux/psobjs.c | 244 ++++++++++++++++++++++++++++++ src/psaux/psobjs.h | 45 ++++++ src/psaux/rules.mk | 1 + 9 files changed, 580 insertions(+) create mode 100644 src/psaux/psdecode.c create mode 100644 src/psaux/psdecode.h diff --git a/ChangeLog b/ChangeLog index 6a94c5577..e8ba1e12c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,22 @@ +2017-09-24 Ewald Hew + + [psaux] Add objects for new interpreter. + + Introduce `PS_Decoder' and `PS_Builder' which include all fields + from either Type 1 or CFF decoders/builders. + + * include/freetype/internal/psaux.h (PS_Builder, PS_Decoder): New + structs. + + * src/psaux/psobjs.c, src/psaux/psobjs.h: Add `PS_Builder' + functions. + + * src/psaux/psdecode.c, src/psaux/psdecode.h: New files to hold + `PS_Decoder' initialization functions. + + * src/psaux/psaux.c, src/psaux/Jamfile (_sources), + src/psaux/rules.mk (PSAUX_DRV_SRC): Updated. + 2017-09-24 Ewald Hew [psaux] Rename files. diff --git a/include/freetype/internal/psaux.h b/include/freetype/internal/psaux.h index 258009be5..43ea776fa 100644 --- a/include/freetype/internal/psaux.h +++ b/include/freetype/internal/psaux.h @@ -443,6 +443,204 @@ FT_BEGIN_HEADER } PS_ParserRec; + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** PS BUILDER *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + typedef struct PS_Builder_ PS_Builder; + typedef const struct PS_Builder_FuncsRec_* PS_Builder_Funcs; + + typedef struct PS_Builder_FuncsRec_ + { + void + (*init)( PS_Builder builder, + FT_Face face, + FT_Size size, + FT_GlyphSlot slot, + FT_Bool hinting ); + + void + (*done)( PS_Builder builder ); + + } PS_Builder_FuncsRec; + + + /*************************************************************************/ + /* */ + /* */ + /* PS_Builder */ + /* */ + /* */ + /* A structure used during glyph loading to store its outline. */ + /* */ + /* */ + /* memory :: The current memory object. */ + /* */ + /* face :: The current face object. */ + /* */ + /* glyph :: The current glyph slot. */ + /* */ + /* loader :: XXX */ + /* */ + /* base :: The base glyph outline. */ + /* */ + /* current :: The current glyph outline. */ + /* */ + /* pos_x :: The horizontal translation (if composite glyph). */ + /* */ + /* pos_y :: The vertical translation (if composite glyph). */ + /* */ + /* left_bearing :: The left side bearing point. */ + /* */ + /* advance :: The horizontal advance vector. */ + /* */ + /* bbox :: Unused. */ + /* */ + /* path_begun :: A flag which indicates that a new path has begun. */ + /* */ + /* load_points :: If this flag is not set, no points are loaded. */ + /* */ + /* no_recurse :: Set but not used. */ + /* */ + /* metrics_only :: A boolean indicating that we only want to compute */ + /* the metrics of a given glyph, not load all of its */ + /* points. */ + /* */ + /* funcs :: An array of function pointers for the builder. */ + /* */ + struct PS_Builder_ + { + FT_Memory memory; + TT_Face face; + CFF_GlyphSlot glyph; + FT_GlyphLoader loader; + FT_Outline* base; + FT_Outline* current; + + FT_Pos pos_x; + FT_Pos pos_y; + + FT_Vector left_bearing; + FT_Vector advance; + + FT_BBox bbox; /* bounding box */ + FT_Bool path_begun; + FT_Bool load_points; + FT_Bool no_recurse; + + FT_Bool metrics_only; + + void* hints_funcs; /* hinter-specific */ + void* hints_globals; /* hinter-specific */ + + PS_Builder_FuncsRec funcs; + + }; + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** PS DECODER *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + +#define PS_MAX_OPERANDS 48 +#define PS_MAX_SUBRS_CALLS 16 /* maximum subroutine nesting; */ + /* only 10 are allowed but there exist */ + /* fonts like `HiraKakuProN-W3.ttf' */ + /* (Hiragino Kaku Gothic ProN W3; */ + /* 8.2d6e1; 2014-12-19) that exceed */ + /* this limit */ + + /* execution context charstring zone */ + + typedef struct PS_Decoder_Zone_ + { + FT_Byte* base; + FT_Byte* limit; + FT_Byte* cursor; + + } PS_Decoder_Zone; + + + typedef FT_Error + (*PS_Decoder_Get_Glyph_Callback)( TT_Face face, + FT_UInt glyph_index, + FT_Byte** pointer, + FT_ULong* length ); + + typedef void + (*PS_Decoder_Free_Glyph_Callback)( TT_Face face, + FT_Byte** pointer, + FT_ULong length ); + + typedef struct PS_Decoder_ + { + PS_Builder builder; + + FT_Fixed stack[PS_MAX_OPERANDS + 1]; + FT_Fixed* top; + + PS_Decoder_Zone zones[PS_MAX_SUBRS_CALLS + 1]; + PS_Decoder_Zone* zone; + + FT_Int flex_state; + FT_Int num_flex_vectors; + FT_Vector flex_vectors[7]; + + CFF_Font cff; + CFF_SubFont current_subfont; /* for current glyph_index */ + + FT_Pos glyph_width; + FT_Pos nominal_width; + + FT_Bool read_width; + FT_Bool width_only; + FT_Int num_hints; + + FT_UInt num_locals; + FT_UInt num_globals; + + FT_Int locals_bias; + FT_Int globals_bias; + + FT_Byte** locals; + FT_Byte** globals; + + FT_Byte** glyph_names; /* for pure CFF fonts only */ + FT_UInt num_glyphs; /* number of glyphs in font */ + + FT_Render_Mode hint_mode; + + FT_Bool seac; + + PS_Decoder_Get_Glyph_Callback get_glyph_callback; + PS_Decoder_Free_Glyph_Callback free_glyph_callback; + + /* Type 1 stuff */ + FT_Service_PsCMaps psnames; /* for seac */ + + FT_Int lenIV; /* internal for sub routine calls */ + FT_UInt* locals_len; /* array of subrs length (optional) */ + FT_Hash locals_hash; /* used if `num_subrs' was massaged */ + + FT_Matrix font_matrix; + FT_Vector font_offset; + + PS_Blend blend; /* for multiple master support */ + + FT_Long* buildchar; + FT_UInt len_buildchar; + + } PS_Decoder; + + /*************************************************************************/ /*************************************************************************/ /***** *****/ diff --git a/src/psaux/Jamfile b/src/psaux/Jamfile index 392acabfd..ab861e656 100644 --- a/src/psaux/Jamfile +++ b/src/psaux/Jamfile @@ -22,6 +22,8 @@ SubDir FT2_TOP $(FT2_SRC_DIR) psaux ; psobjs t1cmap t1decode + cffdecode + psdecode psarrst psblues pserror diff --git a/src/psaux/psaux.c b/src/psaux/psaux.c index e30c9b084..8c9e63316 100644 --- a/src/psaux/psaux.c +++ b/src/psaux/psaux.c @@ -26,6 +26,7 @@ #include "t1cmap.c" #include "t1decode.c" #include "cffdecode.c" +#include "psdecode.c" #include "psarrst.c" #include "psblues.c" diff --git a/src/psaux/psdecode.c b/src/psaux/psdecode.c new file mode 100644 index 000000000..700342582 --- /dev/null +++ b/src/psaux/psdecode.c @@ -0,0 +1,57 @@ + + +#include +#include FT_INTERNAL_SERVICE_H +#include FT_SERVICE_CFF_TABLE_LOAD_H + +#include "psdecode.h" +#include "psobjs.h" + +#include "psauxerr.h" + + + /*************************************************************************/ + /* */ + /* */ + /* ps_decoder_init */ + /* */ + /* */ + /* Initializes a given glyph decoder. */ + /* */ + /* */ + /* decoder :: A pointer to the glyph builder to initialize. */ + /* */ + /* */ + /* face :: The current face object. */ + /* */ + /* size :: The current size object. */ + /* */ + /* slot :: The current glyph object. */ + /* */ + /* hinting :: Whether hinting is active. */ + /* */ + /* hint_mode :: The hinting mode. */ + /* */ + FT_LOCAL_DEF( void ) + ps_decoder_init( PS_Decoder* decoder, + TT_Face face, + FT_Size size, + CFF_GlyphSlot slot, + FT_Byte** glyph_names, + PS_Blend blend, + FT_Bool hinting, + FT_Render_Mode hint_mode, + PS_Decoder_Get_Glyph_Callback get_callback, + PS_Decoder_Free_Glyph_Callback free_callback ) + { + } + + + /* this function is used to select the subfont */ + /* and the locals subrs array */ + FT_LOCAL_DEF( FT_Error ) + ps_decoder_prepare( PS_Decoder* decoder, + FT_Size size, + FT_UInt glyph_index ) + { + } diff --git a/src/psaux/psdecode.h b/src/psaux/psdecode.h new file mode 100644 index 000000000..2a530656e --- /dev/null +++ b/src/psaux/psdecode.h @@ -0,0 +1,13 @@ +#ifndef PSDECODE_H_ +#define PSDECODE_H_ + + +#include +#include FT_INTERNAL_POSTSCRIPT_AUX_H + +#include "cffdecode.h" +#include "t1decode.h" + + + +#endif diff --git a/src/psaux/psobjs.c b/src/psaux/psobjs.c index 92691db6c..815bca3c2 100644 --- a/src/psaux/psobjs.c +++ b/src/psaux/psobjs.c @@ -2023,6 +2023,250 @@ } + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** PS BUILDER *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + /*************************************************************************/ + /* */ + /* */ + /* ps_builder_init */ + /* */ + /* */ + /* Initializes a given glyph builder. */ + /* */ + /* */ + /* builder :: A pointer to the glyph builder to initialize. */ + /* */ + /* */ + /* face :: The current face object. */ + /* */ + /* size :: The current size object. */ + /* */ + /* glyph :: The current glyph object. */ + /* */ + /* hinting :: Whether hinting should be applied. */ + /* */ + FT_LOCAL_DEF( void ) + ps_builder_init( PS_Builder* builder, + TT_Face face, + FT_Size size, + CFF_GlyphSlot glyph, + FT_Bool hinting ) + { + } + + + /*************************************************************************/ + /* */ + /* */ + /* ps_builder_done */ + /* */ + /* */ + /* Finalizes a given glyph builder. Its contents can still be used */ + /* after the call, but the function saves important information */ + /* within the corresponding glyph slot. */ + /* */ + /* */ + /* builder :: A pointer to the glyph builder to finalize. */ + /* */ + FT_LOCAL_DEF( void ) + ps_builder_done( PS_Builder* builder ) + { + CFF_GlyphSlot glyph = builder->glyph; + + + if ( glyph ) + glyph->root.outline = *builder->base; + } + + + /* check that there is enough space for `count' more points */ + FT_LOCAL_DEF( FT_Error ) + ps_builder_check_points( PS_Builder* builder, + FT_Int count ) + { + return FT_GLYPHLOADER_CHECK_POINTS( builder->loader, count, 0 ); + } + + + /* add a new point, do not check space */ + FT_LOCAL_DEF( void ) + ps_builder_add_point( PS_Builder* builder, + FT_Pos x, + FT_Pos y, + FT_Byte flag ) + { + FT_Outline* outline = builder->current; + + + if ( builder->load_points ) + { + FT_Vector* point = outline->points + outline->n_points; + FT_Byte* control = (FT_Byte*)outline->tags + outline->n_points; + +#ifdef CFF_CONFIG_OPTION_OLD_ENGINE + CFF_Driver driver = (CFF_Driver)FT_FACE_DRIVER( builder->face ); + + + if ( driver->hinting_engine == FT_CFF_HINTING_FREETYPE ) + { + point->x = x >> 16; + point->y = y >> 16; + } + else +#endif +#ifdef T1_CONFIG_OPTION_OLD_ENGINE + if ( builder->face->is_t1 ) + { + point->x = FIXED_TO_INT( x ); + point->y = FIXED_TO_INT( y ); + } + else +#endif + { + /* cf2_decoder_parse_charstrings uses 16.16 coordinates */ + point->x = x >> 10; + point->y = y >> 10; + } + *control = (FT_Byte)( flag ? FT_CURVE_TAG_ON : FT_CURVE_TAG_CUBIC ); + } + outline->n_points++; + } + + + /* check space for a new on-curve point, then add it */ + FT_LOCAL_DEF( FT_Error ) + ps_builder_add_point1( PS_Builder* builder, + FT_Pos x, + FT_Pos y ) + { + FT_Error error; + + + error = ps_builder_check_points( builder, 1 ); + if ( !error ) + ps_builder_add_point( builder, x, y, 1 ); + + return error; + } + + + /* check space for a new contour, then add it */ + FT_LOCAL_DEF( FT_Error ) + ps_builder_add_contour( PS_Builder* builder ) + { + FT_Outline* outline = builder->current; + FT_Error error; + + + /* this might happen in invalid fonts */ + if ( !outline ) + { + FT_ERROR(( "t1_builder_add_contour: no outline to add points to\n" )); + return FT_THROW( Invalid_File_Format ); + } + + if ( !builder->load_points ) + { + outline->n_contours++; + return FT_Err_Ok; + } + + error = FT_GLYPHLOADER_CHECK_POINTS( builder->loader, 0, 1 ); + if ( !error ) + { + if ( outline->n_contours > 0 ) + outline->contours[outline->n_contours - 1] = + (short)( outline->n_points - 1 ); + + outline->n_contours++; + } + + return error; + } + + + /* if a path was begun, add its first on-curve point */ + FT_LOCAL_DEF( FT_Error ) + ps_builder_start_point( PS_Builder* builder, + FT_Pos x, + FT_Pos y ) + { + FT_Error error = FT_Err_Ok; + + + /* test whether we are building a new contour */ + if ( !builder->path_begun ) + { + builder->path_begun = 1; + error = ps_builder_add_contour( builder ); + if ( !error ) + error = ps_builder_add_point1( builder, x, y ); + } + + return error; + } + + + /* close the current contour */ + FT_LOCAL_DEF( void ) + ps_builder_close_contour( PS_Builder* builder ) + { + FT_Outline* outline = builder->current; + FT_Int first; + + + if ( !outline ) + return; + + first = outline->n_contours <= 1 + ? 0 : outline->contours[outline->n_contours - 2] + 1; + + /* in malformed fonts it can happen that a contour was started */ + /* but no points were added */ + if ( outline->n_contours && first == outline->n_points ) + { + outline->n_contours--; + return; + } + + /* We must not include the last point in the path if it */ + /* is located on the first point. */ + if ( outline->n_points > 1 ) + { + FT_Vector* p1 = outline->points + first; + FT_Vector* p2 = outline->points + outline->n_points - 1; + FT_Byte* control = (FT_Byte*)outline->tags + outline->n_points - 1; + + + /* `delete' last point only if it coincides with the first */ + /* point and it is not a control point (which can happen). */ + if ( p1->x == p2->x && p1->y == p2->y ) + if ( *control == FT_CURVE_TAG_ON ) + outline->n_points--; + } + + if ( outline->n_contours > 0 ) + { + /* Don't add contours only consisting of one point, i.e., */ + /* check whether the first and the last point is the same. */ + if ( first == outline->n_points - 1 ) + { + outline->n_contours--; + outline->n_points--; + } + else + outline->contours[outline->n_contours - 1] = + (short)( outline->n_points - 1 ); + } + } + + /*************************************************************************/ /*************************************************************************/ /***** *****/ diff --git a/src/psaux/psobjs.h b/src/psaux/psobjs.h index c16379462..64e85c580 100644 --- a/src/psaux/psobjs.h +++ b/src/psaux/psobjs.h @@ -233,6 +233,51 @@ FT_BEGIN_HEADER cff_builder_add_contour( CFF_Builder* builder ); + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** PS BUILDER *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + FT_LOCAL( void ) + ps_builder_init( PS_Builder* builder, + TT_Face face, + FT_Size size, + CFF_GlyphSlot glyph, + FT_Bool hinting ); + + FT_LOCAL( void ) + ps_builder_done( PS_Builder* builder ); + + FT_LOCAL( FT_Error ) + ps_builder_check_points( PS_Builder* builder, + FT_Int count ); + + FT_LOCAL( void ) + ps_builder_add_point( PS_Builder* builder, + FT_Pos x, + FT_Pos y, + FT_Byte flag ); + + FT_LOCAL( FT_Error ) + ps_builder_add_point1( PS_Builder* builder, + FT_Pos x, + FT_Pos y ); + + FT_LOCAL( FT_Error ) + ps_builder_add_contour( PS_Builder* builder ); + + FT_LOCAL( FT_Error ) + ps_builder_start_point( PS_Builder* builder, + FT_Pos x, + FT_Pos y ); + + FT_LOCAL( void ) + ps_builder_close_contour( PS_Builder* builder ); + + /*************************************************************************/ /*************************************************************************/ /***** *****/ diff --git a/src/psaux/rules.mk b/src/psaux/rules.mk index 266d446f8..55a835f6a 100644 --- a/src/psaux/rules.mk +++ b/src/psaux/rules.mk @@ -36,6 +36,7 @@ PSAUX_DRV_SRC := $(PSAUX_DIR)/psobjs.c \ $(PSAUX_DIR)/psauxmod.c \ $(PSAUX_DIR)/psarrst.c \ $(PSAUX_DIR)/psblues.c \ + $(PSAUX_DIR)/psdecode.c \ $(PSAUX_DIR)/pserror.c \ $(PSAUX_DIR)/psfont.c \ $(PSAUX_DIR)/psft.c \ From 43c015823f7c8a708205b3501a862b8f50809363 Mon Sep 17 00:00:00 2001 From: Ewald Hew Date: Sun, 24 Sep 2017 23:00:36 +0200 Subject: [PATCH 258/470] Objects for new interpreter (part 2). Make the new objects copy over values. They are essentially wrapper types for the different decoders/builders. * include/freetype/internal/psaux.h: Update declarations. (PS_Builder): Add `is_t1' flag. (PS_Decoder_{Get,Free}_Glyph_Callback): Renamed to... (CFF_Decoder_{Get,Free}_Glyph_Callback: ... this. (PS_Decoder): Updated. Add `t1_parse_callback' member. (PSAux_ServiceRec): Add `ps_decoder_init' member. * src/psaux/psdecode.h, src/psaux/psobjs.h: Update declarations. * src/psaux/psdecode.c, src/psaux/psobjs.c: Implement copy with two modes. * src/psaux/psauxmod.c: Add builder and decoder functions to `PSAux' service. --- ChangeLog | 23 +++++++++ include/freetype/internal/psaux.h | 60 +++++++++++----------- src/psaux/psauxmod.c | 10 ++++ src/psaux/psdecode.c | 83 +++++++++++++++++++++---------- src/psaux/psdecode.h | 11 +++- src/psaux/psobjs.c | 61 +++++++++++++++++++++-- src/psaux/psobjs.h | 8 ++- 7 files changed, 187 insertions(+), 69 deletions(-) diff --git a/ChangeLog b/ChangeLog index e8ba1e12c..4de920beb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,26 @@ +2017-09-24 Ewald Hew + + [psaux] Objects for new interpreter (part 2). + + Make the new objects copy over values. They are essentially wrapper + types for the different decoders/builders. + + * include/freetype/internal/psaux.h: Update declarations. + (PS_Builder): Add `is_t1' flag. + (PS_Decoder_{Get,Free}_Glyph_Callback): Renamed to... + (CFF_Decoder_{Get,Free}_Glyph_Callback: ... this. + (PS_Decoder): Updated. + Add `t1_parse_callback' member. + (PSAux_ServiceRec): Add `ps_decoder_init' member. + + * src/psaux/psdecode.h, src/psaux/psobjs.h: Update declarations. + + * src/psaux/psdecode.c, src/psaux/psobjs.c: Implement copy with two + modes. + + * src/psaux/psauxmod.c: Add builder and decoder functions to `PSAux' + service. + 2017-09-24 Ewald Hew [psaux] Add objects for new interpreter. diff --git a/include/freetype/internal/psaux.h b/include/freetype/internal/psaux.h index 43ea776fa..3361b9794 100644 --- a/include/freetype/internal/psaux.h +++ b/include/freetype/internal/psaux.h @@ -457,14 +457,12 @@ FT_BEGIN_HEADER typedef struct PS_Builder_FuncsRec_ { void - (*init)( PS_Builder builder, - FT_Face face, - FT_Size size, - FT_GlyphSlot slot, - FT_Bool hinting ); + (*init)( void* builder, + FT_Bool is_t1, + PS_Builder* ps_builder ); void - (*done)( PS_Builder builder ); + (*done)( PS_Builder* builder ); } PS_Builder_FuncsRec; @@ -521,13 +519,13 @@ FT_BEGIN_HEADER FT_Outline* base; FT_Outline* current; - FT_Pos pos_x; - FT_Pos pos_y; + FT_Pos* pos_x; + FT_Pos* pos_y; - FT_Vector left_bearing; - FT_Vector advance; + FT_Vector* left_bearing; + FT_Vector* advance; - FT_BBox bbox; /* bounding box */ + FT_BBox* bbox; /* bounding box */ FT_Bool path_begun; FT_Bool load_points; FT_Bool no_recurse; @@ -537,6 +535,8 @@ FT_BEGIN_HEADER void* hints_funcs; /* hinter-specific */ void* hints_globals; /* hinter-specific */ + FT_Bool is_t1; + PS_Builder_FuncsRec funcs; }; @@ -570,15 +570,16 @@ FT_BEGIN_HEADER typedef FT_Error - (*PS_Decoder_Get_Glyph_Callback)( TT_Face face, - FT_UInt glyph_index, - FT_Byte** pointer, - FT_ULong* length ); + (*CFF_Decoder_Get_Glyph_Callback)( TT_Face face, + FT_UInt glyph_index, + FT_Byte** pointer, + FT_ULong* length ); typedef void - (*PS_Decoder_Free_Glyph_Callback)( TT_Face face, - FT_Byte** pointer, - FT_ULong length ); + (*CFF_Decoder_Free_Glyph_Callback)( TT_Face face, + FT_Byte** pointer, + FT_ULong length ); + typedef struct PS_Decoder_ { @@ -620,8 +621,8 @@ FT_BEGIN_HEADER FT_Bool seac; - PS_Decoder_Get_Glyph_Callback get_glyph_callback; - PS_Decoder_Free_Glyph_Callback free_glyph_callback; + CFF_Decoder_Get_Glyph_Callback get_glyph_callback; + CFF_Decoder_Free_Glyph_Callback free_glyph_callback; /* Type 1 stuff */ FT_Service_PsCMaps psnames; /* for seac */ @@ -638,6 +639,8 @@ FT_BEGIN_HEADER FT_Long* buildchar; FT_UInt len_buildchar; + void* t1_parse_callback; + } PS_Decoder; @@ -1069,18 +1072,6 @@ FT_BEGIN_HEADER } CFF_Decoder_Zone; - typedef FT_Error - (*CFF_Decoder_Get_Glyph_Callback)( TT_Face face, - FT_UInt glyph_index, - FT_Byte** pointer, - FT_ULong* length ); - - typedef void - (*CFF_Decoder_Free_Glyph_Callback)( TT_Face face, - FT_Byte** pointer, - FT_ULong length ); - - typedef struct CFF_Decoder_ { CFF_Builder builder; @@ -1268,6 +1259,11 @@ FT_BEGIN_HEADER FT_UInt32 (*cff_random)( FT_UInt32 r ); + void + (*ps_decoder_init)( void* decoder, + FT_Bool is_t1, + PS_Decoder* ps_decoder ); + T1_CMap_Classes t1_cmap_classes; diff --git a/src/psaux/psauxmod.c b/src/psaux/psauxmod.c index eb94d54d4..d7223e233 100644 --- a/src/psaux/psauxmod.c +++ b/src/psaux/psauxmod.c @@ -23,6 +23,7 @@ #include "t1cmap.h" #include "psft.h" #include "cffdecode.h" +#include "psdecode.h" #ifndef T1_CONFIG_OPTION_NO_AFM #include "afmparse.h" @@ -61,6 +62,14 @@ }; + FT_CALLBACK_TABLE_DEF + const PS_Builder_FuncsRec ps_builder_funcs = + { + ps_builder_init, /* init */ + ps_builder_done /* done */ + }; + + FT_CALLBACK_TABLE_DEF const T1_Builder_FuncsRec t1_builder_funcs = { @@ -144,6 +153,7 @@ &t1_decoder_funcs, t1_decrypt, cff_random, + ps_decoder_init, (const T1_CMap_ClassesRec*) &t1_cmap_classes, diff --git a/src/psaux/psdecode.c b/src/psaux/psdecode.c index 700342582..86b42863f 100644 --- a/src/psaux/psdecode.c +++ b/src/psaux/psdecode.c @@ -2,7 +2,6 @@ #include #include FT_INTERNAL_SERVICE_H -#include FT_SERVICE_CFF_TABLE_LOAD_H #include "psdecode.h" #include "psobjs.h" @@ -16,42 +15,76 @@ /* ps_decoder_init */ /* */ /* */ - /* Initializes a given glyph decoder. */ + /* Creates a decoder for the combined Type 1 / CFF interpreter. */ /* */ /* */ /* decoder :: A pointer to the glyph builder to initialize. */ /* */ /* */ - /* face :: The current face object. */ /* */ - /* size :: The current size object. */ /* */ - /* slot :: The current glyph object. */ /* */ - /* hinting :: Whether hinting is active. */ /* */ - /* hint_mode :: The hinting mode. */ /* */ FT_LOCAL_DEF( void ) - ps_decoder_init( PS_Decoder* decoder, - TT_Face face, - FT_Size size, - CFF_GlyphSlot slot, - FT_Byte** glyph_names, - PS_Blend blend, - FT_Bool hinting, - FT_Render_Mode hint_mode, - PS_Decoder_Get_Glyph_Callback get_callback, - PS_Decoder_Free_Glyph_Callback free_callback ) + ps_decoder_init( void* decoder, + FT_Bool is_t1, + PS_Decoder* ps_decoder ) { - } + FT_ZERO( ps_decoder ); + if ( is_t1 ) + { + T1_Decoder t1_decoder = (T1_Decoder)decoder; - /* this function is used to select the subfont */ - /* and the locals subrs array */ - FT_LOCAL_DEF( FT_Error ) - ps_decoder_prepare( PS_Decoder* decoder, - FT_Size size, - FT_UInt glyph_index ) - { + ps_builder_init( &t1_decoder->builder, + is_t1, + &ps_decoder->builder ); + + ps_decoder->psnames = t1_decoder->psnames; + + ps_decoder->num_glyphs = t1_decoder->num_glyphs; + ps_decoder->glyph_names = t1_decoder->glyph_names; + ps_decoder->hint_mode = t1_decoder->hint_mode; + ps_decoder->blend = t1_decoder->blend; + /* ps_decoder->t1_parse_callback = t1_decoder->parse_callback; */ + + ps_decoder->num_locals = t1_decoder->num_subrs; + ps_decoder->locals = t1_decoder->subrs; + ps_decoder->locals_len = t1_decoder->subrs_len; + ps_decoder->locals_hash = t1_decoder->subrs_hash; + + ps_decoder->buildchar = t1_decoder->buildchar; + ps_decoder->len_buildchar = t1_decoder->len_buildchar; + + ps_decoder->lenIV = t1_decoder->lenIV; + } + else + { + CFF_Decoder* cff_decoder = (CFF_Decoder*)decoder; + + ps_builder_init( &cff_decoder->builder, + is_t1, + &ps_decoder->builder ); + + ps_decoder->cff = cff_decoder->cff; + ps_decoder->current_subfont = cff_decoder->current_subfont; + + ps_decoder->num_globals = cff_decoder->num_globals; + ps_decoder->globals = cff_decoder->globals; + ps_decoder->globals_bias = cff_decoder->globals_bias; + ps_decoder->num_locals = cff_decoder->num_locals; + ps_decoder->locals = cff_decoder->locals; + ps_decoder->locals_bias = cff_decoder->locals_bias; + + ps_decoder->glyph_width = cff_decoder->glyph_width; + ps_decoder->nominal_width = cff_decoder->nominal_width; + ps_decoder->width_only = cff_decoder->width_only; + + ps_decoder->hint_mode = cff_decoder->hint_mode; + + ps_decoder->get_glyph_callback = cff_decoder->get_glyph_callback; + ps_decoder->free_glyph_callback = cff_decoder->free_glyph_callback; + } } + diff --git a/src/psaux/psdecode.h b/src/psaux/psdecode.h index 2a530656e..dd7e6f285 100644 --- a/src/psaux/psdecode.h +++ b/src/psaux/psdecode.h @@ -5,9 +5,16 @@ #include #include FT_INTERNAL_POSTSCRIPT_AUX_H -#include "cffdecode.h" -#include "t1decode.h" +FT_BEGIN_HEADER + FT_LOCAL( void ) + ps_decoder_init( void* decoder, + FT_Bool is_t1, + PS_Decoder* ps_decoder ); + + +FT_END_HEADER #endif + diff --git a/src/psaux/psobjs.c b/src/psaux/psobjs.c index 815bca3c2..a4dd44865 100644 --- a/src/psaux/psobjs.c +++ b/src/psaux/psobjs.c @@ -2052,12 +2052,63 @@ /* hinting :: Whether hinting should be applied. */ /* */ FT_LOCAL_DEF( void ) - ps_builder_init( PS_Builder* builder, - TT_Face face, - FT_Size size, - CFF_GlyphSlot glyph, - FT_Bool hinting ) + ps_builder_init( void* builder, + FT_Bool is_t1, + PS_Builder* ps_builder ) { + FT_ZERO( ps_builder ); + + if ( is_t1 ) + { + T1_Builder t1builder = (T1_Builder)builder; + + ps_builder->face = (TT_Face)t1builder->face; + ps_builder->glyph = t1builder->glyph; + ps_builder->memory = t1builder->memory; + ps_builder->loader = t1builder->loader; + ps_builder->base = t1builder->base; + ps_builder->current = t1builder->current; + + ps_builder->pos_x = &t1builder->pos_x; + ps_builder->pos_y = &t1builder->pos_y; + + ps_builder->left_bearing = &t1builder->left_bearing; + ps_builder->advance = &t1builder->advance; + + ps_builder->bbox = &t1builder->bbox; + ps_builder->path_begun = 0; + ps_builder->load_points = t1builder->load_points; + ps_builder->no_recurse = t1builder->no_recurse; + + ps_builder->metrics_only = t1builder->metrics_only; + } + else + { + CFF_Builder* cffbuilder = (CFF_Builder*)builder; + + ps_builder->face = cffbuilder->face; + ps_builder->memory = cffbuilder->memory; + ps_builder->glyph = cffbuilder->glyph; + ps_builder->loader = cffbuilder->loader; + ps_builder->base = cffbuilder->base; + ps_builder->current = cffbuilder->current; + + ps_builder->pos_x = &cffbuilder->pos_x; + ps_builder->pos_y = &cffbuilder->pos_y; + + ps_builder->left_bearing = &cffbuilder->left_bearing; + ps_builder->advance = &cffbuilder->advance; + + ps_builder->bbox = &cffbuilder->bbox; + ps_builder->path_begun = cffbuilder->path_begun; + ps_builder->load_points = cffbuilder->load_points; + ps_builder->no_recurse = cffbuilder->no_recurse; + + ps_builder->metrics_only = cffbuilder->metrics_only; + } + + ps_builder->is_t1 = is_t1; + ps_builder->funcs = ps_builder_funcs; } diff --git a/src/psaux/psobjs.h b/src/psaux/psobjs.h index 64e85c580..1f6841919 100644 --- a/src/psaux/psobjs.h +++ b/src/psaux/psobjs.h @@ -242,11 +242,9 @@ FT_BEGIN_HEADER /*************************************************************************/ FT_LOCAL( void ) - ps_builder_init( PS_Builder* builder, - TT_Face face, - FT_Size size, - CFF_GlyphSlot glyph, - FT_Bool hinting ); + ps_builder_init( void* builder, + FT_Bool is_t1, + PS_Builder* ps_builder ); FT_LOCAL( void ) ps_builder_done( PS_Builder* builder ); From 0589e3c01212fc77470ddde13d379a16170af151 Mon Sep 17 00:00:00 2001 From: Ewald Hew Date: Mon, 25 Sep 2017 06:10:20 +0200 Subject: [PATCH 259/470] Use the new objects. * include/freetype/internal/psaux.h, src/psaux/psauxmod.c: Fix switching between new and old engines. * src/cff/cffgload.c, src/cff/cffparse.c: Update calls. * src/psaux/psblues.c, src/psaux/psfont.c, src/psaux/psfont.h, src/psaux/psft.c, src/psaux/psft.h, src/psaux/psintrp.c: Update all to use new objects. --- ChangeLog | 13 +++ include/freetype/internal/psaux.h | 18 ++-- src/cff/cffgload.c | 23 +++-- src/cff/cffparse.c | 15 ++- src/psaux/psauxmod.c | 5 +- src/psaux/psblues.c | 2 +- src/psaux/psfont.c | 2 +- src/psaux/psfont.h | 2 +- src/psaux/psft.c | 158 +++++++++++++++--------------- src/psaux/psft.h | 88 ++++++++--------- src/psaux/psintrp.c | 2 +- 11 files changed, 176 insertions(+), 152 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4de920beb..a215fa461 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2017-09-25 Ewald Hew + + [psaux, cff] Use the new objects. + + * include/freetype/internal/psaux.h, src/psaux/psauxmod.c: Fix + switching between new and old engines. + + * src/cff/cffgload.c, src/cff/cffparse.c: Update calls. + + * src/psaux/psblues.c, src/psaux/psfont.c, src/psaux/psfont.h, + src/psaux/psft.c, src/psaux/psft.h, src/psaux/psintrp.c: Update all + to use new objects. + 2017-09-24 Ewald Hew [psaux] Objects for new interpreter (part 2). diff --git a/include/freetype/internal/psaux.h b/include/freetype/internal/psaux.h index 3361b9794..45013e482 100644 --- a/include/freetype/internal/psaux.h +++ b/include/freetype/internal/psaux.h @@ -1137,18 +1137,22 @@ FT_BEGIN_HEADER CFF_Size size, FT_UInt glyph_index ); - FT_Error - (*parse_charstrings)( CFF_Decoder* decoder, - FT_Byte* charstring_base, - FT_ULong charstring_len #ifdef CFF_CONFIG_OPTION_OLD_ENGINE -/*TODO(ewaldhew): seems hacky, is there a better way to do this?*/ - ,FT_Bool in_dict + FT_Error + (*parse_charstrings_old)( CFF_Decoder* decoder, + FT_Byte* charstring_base, + FT_ULong charstring_len, + FT_Bool in_dict ); #endif - ); + + FT_Error + (*parse_charstrings)( PS_Decoder* decoder, + FT_Byte* charstring_base, + FT_ULong charstring_len ); } CFF_Decoder_FuncsRec; + /*************************************************************************/ /*************************************************************************/ /***** *****/ diff --git a/src/cff/cffgload.c b/src/cff/cffgload.c index 92ca08bd8..12c8097d1 100644 --- a/src/cff/cffgload.c +++ b/src/cff/cffgload.c @@ -169,10 +169,10 @@ { error = decoder_funcs->prepare( &decoder, size, glyph_index ); if ( !error ) - error = decoder_funcs->parse_charstrings( &decoder, - charstring, - charstring_len, - 0 ); + error = decoder_funcs->parse_charstrings_old( &decoder, + charstring, + charstring_len, + 0 ); cff_free_glyph_data( face, &charstring, &charstring_len ); } @@ -198,6 +198,7 @@ { FT_Error error; CFF_Decoder decoder; + PS_Decoder psdecoder; TT_Face face = (TT_Face)glyph->root.face; FT_Bool hinting, scaled, force_scaling; CFF_Font cff = (CFF_Font)face->extra.data; @@ -427,14 +428,16 @@ #ifdef CFF_CONFIG_OPTION_OLD_ENGINE /* choose which CFF renderer to use */ if ( driver->hinting_engine == FT_CFF_HINTING_FREETYPE ) - error = decoder_funcs->parse_charstrings( &decoder, - charstring, - charstring_len, - 0 ); + error = decoder_funcs->parse_charstrings_old( &decoder, + charstring, + charstring_len, + 0 ); else #endif { - error = decoder_funcs->parse_charstrings( &decoder, + psaux->ps_decoder_init( &decoder, FALSE, &psdecoder ); + + error = decoder_funcs->parse_charstrings( &psdecoder, charstring, charstring_len ); @@ -449,7 +452,7 @@ force_scaling = TRUE; glyph->hint = hinting; - error = decoder_funcs->parse_charstrings( &decoder, + error = decoder_funcs->parse_charstrings( &psdecoder, charstring, charstring_len ); } diff --git a/src/cff/cffparse.c b/src/cff/cffparse.c index 63f20a194..888b2d5d9 100644 --- a/src/cff/cffparse.c +++ b/src/cff/cffparse.c @@ -1299,6 +1299,11 @@ FT_Byte* start, FT_Byte* limit ) { +#ifdef CFF_CONFIG_OPTION_OLD_ENGINE + PSAux_Service psaux; +#endif + + FT_Byte* p = start; FT_Error error = FT_Err_Ok; FT_Library library = parser->library; @@ -1397,11 +1402,11 @@ error = FT_THROW( Missing_Module ); goto Exit; } - - error = psaux->cff_decoder_funcs->parse_charstrings( &decoder, - charstring_base, - charstring_len, - 1 ); + + error = psaux->cff_decoder_funcs->parse_charstrings_old( &decoder, + charstring_base, + charstring_len, + 1 ); /* Now copy the stack data in the temporary decoder object, */ /* converting it back to charstring number representations */ diff --git a/src/psaux/psauxmod.c b/src/psaux/psauxmod.c index d7223e233..bc7002a78 100644 --- a/src/psaux/psauxmod.c +++ b/src/psaux/psauxmod.c @@ -137,10 +137,9 @@ cff_decoder_prepare, /* prepare */ #ifdef CFF_CONFIG_OPTION_OLD_ENGINE - cff_decoder_parse_charstrings /* parse_charstrings */ -#else - cf2_decoder_parse_charstrings + cff_decoder_parse_charstrings, /* parse_charstrings_old */ #endif + cf2_decoder_parse_charstrings /* parse_charstrings */ }; diff --git a/src/psaux/psblues.c b/src/psaux/psblues.c index b102b37a8..9c8b025e4 100644 --- a/src/psaux/psblues.c +++ b/src/psaux/psblues.c @@ -67,7 +67,7 @@ CF2_Font font ) { /* pointer to parsed font object */ - CFF_Decoder* decoder = font->decoder; + PS_Decoder* decoder = font->decoder; CF2_Fixed zoneHeight; CF2_Fixed maxZoneHeight = 0; diff --git a/src/psaux/psfont.c b/src/psaux/psfont.c index 13cff7329..bdcc3568f 100644 --- a/src/psaux/psfont.c +++ b/src/psaux/psfont.c @@ -243,7 +243,7 @@ const CF2_Matrix* transform ) { /* pointer to parsed font object */ - CFF_Decoder* decoder = font->decoder; + PS_Decoder* decoder = font->decoder; FT_Bool needExtraSetup = FALSE; diff --git a/src/psaux/psfont.h b/src/psaux/psfont.h index f7ce1492c..f88b1316f 100644 --- a/src/psaux/psfont.h +++ b/src/psaux/psfont.h @@ -90,7 +90,7 @@ FT_BEGIN_HEADER /* FreeType related members */ CF2_OutlineRec outline; /* freetype glyph outline functions */ - CFF_Decoder* decoder; + PS_Decoder* decoder; CFF_SubFont lastSubfont; /* FreeType parsed data; */ /* top font or subfont */ diff --git a/src/psaux/psft.c b/src/psaux/psft.c index 210710076..a05f1f28f 100644 --- a/src/psaux/psft.c +++ b/src/psaux/psft.c @@ -89,7 +89,7 @@ cf2_setGlyphWidth( CF2_Outline outline, CF2_Fixed width ) { - CFF_Decoder* decoder = outline->decoder; + PS_Decoder* decoder = outline->decoder; FT_ASSERT( decoder ); @@ -128,8 +128,8 @@ const CF2_CallbackParams params ) { /* downcast the object pointer */ - CF2_Outline outline = (CF2_Outline)callbacks; - CFF_Builder* builder; + CF2_Outline outline = (CF2_Outline)callbacks; + PS_Builder* builder; (void)params; /* only used in debug mode */ @@ -140,7 +140,7 @@ builder = &outline->decoder->builder; /* note: two successive moves simply close the contour twice */ - cff_builder_close_contour( builder ); + ps_builder_close_contour( builder ); builder->path_begun = 0; } @@ -152,8 +152,8 @@ FT_Error error; /* downcast the object pointer */ - CF2_Outline outline = (CF2_Outline)callbacks; - CFF_Builder* builder; + CF2_Outline outline = (CF2_Outline)callbacks; + PS_Builder* builder; FT_ASSERT( outline && outline->decoder ); @@ -165,9 +165,9 @@ { /* record the move before the line; also check points and set */ /* `path_begun' */ - error = cff_builder_start_point( builder, - params->pt0.x, - params->pt0.y ); + error = ps_builder_start_point( builder, + params->pt0.x, + params->pt0.y ); if ( error ) { if ( !*callbacks->error ) @@ -176,10 +176,10 @@ } } - /* `cff_builder_add_point1' includes a check_points call for one point */ - error = cff_builder_add_point1( builder, - params->pt1.x, - params->pt1.y ); + /* `ps_builder_add_point1' includes a check_points call for one point */ + error = ps_builder_add_point1( builder, + params->pt1.x, + params->pt1.y ); if ( error ) { if ( !*callbacks->error ) @@ -196,8 +196,8 @@ FT_Error error; /* downcast the object pointer */ - CF2_Outline outline = (CF2_Outline)callbacks; - CFF_Builder* builder; + CF2_Outline outline = (CF2_Outline)callbacks; + PS_Builder* builder; FT_ASSERT( outline && outline->decoder ); @@ -209,9 +209,9 @@ { /* record the move before the line; also check points and set */ /* `path_begun' */ - error = cff_builder_start_point( builder, - params->pt0.x, - params->pt0.y ); + error = ps_builder_start_point( builder, + params->pt0.x, + params->pt0.y ); if ( error ) { if ( !*callbacks->error ) @@ -221,7 +221,7 @@ } /* prepare room for 3 points: 2 off-curve, 1 on-curve */ - error = cff_check_points( builder, 3 ); + error = ps_builder_check_points( builder, 3 ); if ( error ) { if ( !*callbacks->error ) @@ -229,15 +229,15 @@ return; } - cff_builder_add_point( builder, - params->pt1.x, - params->pt1.y, 0 ); - cff_builder_add_point( builder, - params->pt2.x, - params->pt2.y, 0 ); - cff_builder_add_point( builder, - params->pt3.x, - params->pt3.y, 1 ); + ps_builder_add_point( builder, + params->pt1.x, + params->pt1.y, 0 ); + ps_builder_add_point( builder, + params->pt2.x, + params->pt2.y, 0 ); + ps_builder_add_point( builder, + params->pt3.x, + params->pt3.y, 1 ); } @@ -259,11 +259,11 @@ /* get scaling and hint flag from GlyphSlot */ static void - cf2_getScaleAndHintFlag( CFF_Decoder* decoder, - CF2_Fixed* x_scale, - CF2_Fixed* y_scale, - FT_Bool* hinted, - FT_Bool* scaled ) + cf2_getScaleAndHintFlag( PS_Decoder* decoder, + CF2_Fixed* x_scale, + CF2_Fixed* y_scale, + FT_Bool* hinted, + FT_Bool* scaled ) { FT_ASSERT( decoder && decoder->builder.glyph ); @@ -290,7 +290,7 @@ /* get units per em from `FT_Face' */ /* TODO: should handle font matrix concatenation? */ static FT_UShort - cf2_getUnitsPerEm( CFF_Decoder* decoder ) + cf2_getUnitsPerEm( PS_Decoder* decoder ) { FT_ASSERT( decoder && decoder->builder.face ); FT_ASSERT( decoder->builder.face->root.units_per_EM ); @@ -301,9 +301,9 @@ /* Main entry point: Render one glyph. */ FT_LOCAL_DEF( FT_Error ) - cf2_decoder_parse_charstrings( CFF_Decoder* decoder, - FT_Byte* charstring_base, - FT_ULong charstring_len ) + cf2_decoder_parse_charstrings( PS_Decoder* decoder, + FT_Byte* charstring_base, + FT_ULong charstring_len ) { FT_Memory memory; FT_Error error = FT_Err_Ok; @@ -344,8 +344,8 @@ { /* build parameters for Adobe engine */ - CFF_Builder* builder = &decoder->builder; - CFF_Driver driver = (CFF_Driver)FT_FACE_DRIVER( builder->face ); + PS_Builder* builder = &decoder->builder; + CFF_Driver driver = (CFF_Driver)FT_FACE_DRIVER( builder->face ); FT_Bool no_stem_darkening_driver = driver->no_stem_darkening; @@ -423,7 +423,7 @@ /* get pointer to current FreeType subfont (based on current glyphID) */ FT_LOCAL_DEF( CFF_SubFont ) - cf2_getSubfont( CFF_Decoder* decoder ) + cf2_getSubfont( PS_Decoder* decoder ) { FT_ASSERT( decoder && decoder->current_subfont ); @@ -433,7 +433,7 @@ /* get pointer to VStore structure */ FT_LOCAL_DEF( CFF_VStore ) - cf2_getVStore( CFF_Decoder* decoder ) + cf2_getVStore( PS_Decoder* decoder ) { FT_ASSERT( decoder && decoder->cff ); @@ -443,7 +443,7 @@ /* get maxstack value from CFF2 Top DICT */ FT_LOCAL_DEF( FT_UInt ) - cf2_getMaxstack( CFF_Decoder* decoder ) + cf2_getMaxstack( PS_Decoder* decoder ) { FT_ASSERT( decoder && decoder->cff ); @@ -457,7 +457,7 @@ /* */ /* Note: Uses FT_Fixed not CF2_Fixed for the vector. */ FT_LOCAL_DEF( FT_Error ) - cf2_getNormalizedVector( CFF_Decoder* decoder, + cf2_getNormalizedVector( PS_Decoder* decoder, CF2_UInt *len, FT_Fixed* *vec ) { @@ -477,7 +477,7 @@ /* get `y_ppem' from `CFF_Size' */ FT_LOCAL_DEF( CF2_Fixed ) - cf2_getPpemY( CFF_Decoder* decoder ) + cf2_getPpemY( PS_Decoder* decoder ) { FT_ASSERT( decoder && decoder->builder.face && @@ -501,7 +501,7 @@ /* FreeType stores these as integer font units */ /* (note: variable names seem swapped) */ FT_LOCAL_DEF( CF2_Fixed ) - cf2_getStdVW( CFF_Decoder* decoder ) + cf2_getStdVW( PS_Decoder* decoder ) { FT_ASSERT( decoder && decoder->current_subfont ); @@ -511,7 +511,7 @@ FT_LOCAL_DEF( CF2_Fixed ) - cf2_getStdHW( CFF_Decoder* decoder ) + cf2_getStdHW( PS_Decoder* decoder ) { FT_ASSERT( decoder && decoder->current_subfont ); @@ -522,10 +522,10 @@ /* note: FreeType stores 1000 times the actual value for `BlueScale' */ FT_LOCAL_DEF( void ) - cf2_getBlueMetrics( CFF_Decoder* decoder, - CF2_Fixed* blueScale, - CF2_Fixed* blueShift, - CF2_Fixed* blueFuzz ) + cf2_getBlueMetrics( PS_Decoder* decoder, + CF2_Fixed* blueScale, + CF2_Fixed* blueShift, + CF2_Fixed* blueFuzz ) { FT_ASSERT( decoder && decoder->current_subfont ); @@ -542,9 +542,9 @@ /* get blue values counts and arrays; the FreeType parser has validated */ /* the counts and verified that each is an even number */ FT_LOCAL_DEF( void ) - cf2_getBlueValues( CFF_Decoder* decoder, - size_t* count, - FT_Pos* *data ) + cf2_getBlueValues( PS_Decoder* decoder, + size_t* count, + FT_Pos* *data ) { FT_ASSERT( decoder && decoder->current_subfont ); @@ -555,9 +555,9 @@ FT_LOCAL_DEF( void ) - cf2_getOtherBlues( CFF_Decoder* decoder, - size_t* count, - FT_Pos* *data ) + cf2_getOtherBlues( PS_Decoder* decoder, + size_t* count, + FT_Pos* *data ) { FT_ASSERT( decoder && decoder->current_subfont ); @@ -568,9 +568,9 @@ FT_LOCAL_DEF( void ) - cf2_getFamilyBlues( CFF_Decoder* decoder, - size_t* count, - FT_Pos* *data ) + cf2_getFamilyBlues( PS_Decoder* decoder, + size_t* count, + FT_Pos* *data ) { FT_ASSERT( decoder && decoder->current_subfont ); @@ -581,9 +581,9 @@ FT_LOCAL_DEF( void ) - cf2_getFamilyOtherBlues( CFF_Decoder* decoder, - size_t* count, - FT_Pos* *data ) + cf2_getFamilyOtherBlues( PS_Decoder* decoder, + size_t* count, + FT_Pos* *data ) { FT_ASSERT( decoder && decoder->current_subfont ); @@ -594,7 +594,7 @@ FT_LOCAL_DEF( CF2_Int ) - cf2_getLanguageGroup( CFF_Decoder* decoder ) + cf2_getLanguageGroup( PS_Decoder* decoder ) { FT_ASSERT( decoder && decoder->current_subfont ); @@ -605,9 +605,9 @@ /* convert unbiased subroutine index to `CF2_Buffer' and */ /* return 0 on success */ FT_LOCAL_DEF( CF2_Int ) - cf2_initGlobalRegionBuffer( CFF_Decoder* decoder, - CF2_Int subrNum, - CF2_Buffer buf ) + cf2_initGlobalRegionBuffer( PS_Decoder* decoder, + CF2_Int subrNum, + CF2_Buffer buf ) { CF2_UInt idx; @@ -633,9 +633,9 @@ /* convert AdobeStandardEncoding code to CF2_Buffer; */ /* used for seac component */ FT_LOCAL_DEF( FT_Error ) - cf2_getSeacComponent( CFF_Decoder* decoder, - CF2_Int code, - CF2_Buffer buf ) + cf2_getSeacComponent( PS_Decoder* decoder, + CF2_Int code, + CF2_Buffer buf ) { CF2_Int gid; FT_Byte* charstring; @@ -680,8 +680,8 @@ FT_LOCAL_DEF( void ) - cf2_freeSeacComponent( CFF_Decoder* decoder, - CF2_Buffer buf ) + cf2_freeSeacComponent( PS_Decoder* decoder, + CF2_Buffer buf ) { FT_ASSERT( decoder ); @@ -692,9 +692,9 @@ FT_LOCAL_DEF( CF2_Int ) - cf2_initLocalRegionBuffer( CFF_Decoder* decoder, - CF2_Int subrNum, - CF2_Buffer buf ) + cf2_initLocalRegionBuffer( PS_Decoder* decoder, + CF2_Int subrNum, + CF2_Buffer buf ) { CF2_UInt idx; @@ -718,7 +718,7 @@ FT_LOCAL_DEF( CF2_Fixed ) - cf2_getDefaultWidthX( CFF_Decoder* decoder ) + cf2_getDefaultWidthX( PS_Decoder* decoder ) { FT_ASSERT( decoder && decoder->current_subfont ); @@ -728,7 +728,7 @@ FT_LOCAL_DEF( CF2_Fixed ) - cf2_getNominalWidthX( CFF_Decoder* decoder ) + cf2_getNominalWidthX( PS_Decoder* decoder ) { FT_ASSERT( decoder && decoder->current_subfont ); @@ -740,7 +740,7 @@ FT_LOCAL_DEF( void ) cf2_outline_reset( CF2_Outline outline ) { - CFF_Decoder* decoder = outline->decoder; + PS_Decoder* decoder = outline->decoder; FT_ASSERT( decoder ); @@ -754,12 +754,12 @@ FT_LOCAL_DEF( void ) cf2_outline_close( CF2_Outline outline ) { - CFF_Decoder* decoder = outline->decoder; + PS_Decoder* decoder = outline->decoder; FT_ASSERT( decoder ); - cff_builder_close_contour( &decoder->builder ); + ps_builder_close_contour( &decoder->builder ); FT_GlyphLoader_Add( decoder->builder.loader ); } diff --git a/src/psaux/psft.h b/src/psaux/psft.h index bbb2cf7bb..1628970cc 100644 --- a/src/psaux/psft.h +++ b/src/psaux/psft.h @@ -50,85 +50,85 @@ #include FT_SYSTEM_H #include "psglue.h" -#include FT_INTERNAL_POSTSCRIPT_AUX_H /* for CFF_Decoder */ +#include FT_INTERNAL_POSTSCRIPT_AUX_H /* for PS_Decoder */ FT_BEGIN_HEADER FT_LOCAL( FT_Error ) - cf2_decoder_parse_charstrings( CFF_Decoder* decoder, - FT_Byte* charstring_base, - FT_ULong charstring_len ); + cf2_decoder_parse_charstrings( PS_Decoder* decoder, + FT_Byte* charstring_base, + FT_ULong charstring_len ); FT_LOCAL( CFF_SubFont ) - cf2_getSubfont( CFF_Decoder* decoder ); + cf2_getSubfont( PS_Decoder* decoder ); FT_LOCAL( CFF_VStore ) - cf2_getVStore( CFF_Decoder* decoder ); + cf2_getVStore( PS_Decoder* decoder ); FT_LOCAL( FT_UInt ) - cf2_getMaxstack( CFF_Decoder* decoder ); + cf2_getMaxstack( PS_Decoder* decoder ); #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT FT_LOCAL( FT_Error ) - cf2_getNormalizedVector( CFF_Decoder* decoder, - CF2_UInt *len, - FT_Fixed* *vec ); + cf2_getNormalizedVector( PS_Decoder* decoder, + CF2_UInt *len, + FT_Fixed* *vec ); #endif FT_LOCAL( CF2_Fixed ) - cf2_getPpemY( CFF_Decoder* decoder ); + cf2_getPpemY( PS_Decoder* decoder ); FT_LOCAL( CF2_Fixed ) - cf2_getStdVW( CFF_Decoder* decoder ); + cf2_getStdVW( PS_Decoder* decoder ); FT_LOCAL( CF2_Fixed ) - cf2_getStdHW( CFF_Decoder* decoder ); + cf2_getStdHW( PS_Decoder* decoder ); FT_LOCAL( void ) - cf2_getBlueMetrics( CFF_Decoder* decoder, - CF2_Fixed* blueScale, - CF2_Fixed* blueShift, - CF2_Fixed* blueFuzz ); + cf2_getBlueMetrics( PS_Decoder* decoder, + CF2_Fixed* blueScale, + CF2_Fixed* blueShift, + CF2_Fixed* blueFuzz ); FT_LOCAL( void ) - cf2_getBlueValues( CFF_Decoder* decoder, - size_t* count, - FT_Pos* *data ); + cf2_getBlueValues( PS_Decoder* decoder, + size_t* count, + FT_Pos* *data ); FT_LOCAL( void ) - cf2_getOtherBlues( CFF_Decoder* decoder, - size_t* count, - FT_Pos* *data ); + cf2_getOtherBlues( PS_Decoder* decoder, + size_t* count, + FT_Pos* *data ); FT_LOCAL( void ) - cf2_getFamilyBlues( CFF_Decoder* decoder, - size_t* count, - FT_Pos* *data ); + cf2_getFamilyBlues( PS_Decoder* decoder, + size_t* count, + FT_Pos* *data ); FT_LOCAL( void ) - cf2_getFamilyOtherBlues( CFF_Decoder* decoder, - size_t* count, - FT_Pos* *data ); + cf2_getFamilyOtherBlues( PS_Decoder* decoder, + size_t* count, + FT_Pos* *data ); FT_LOCAL( CF2_Int ) - cf2_getLanguageGroup( CFF_Decoder* decoder ); + cf2_getLanguageGroup( PS_Decoder* decoder ); FT_LOCAL( CF2_Int ) - cf2_initGlobalRegionBuffer( CFF_Decoder* decoder, - CF2_Int subrNum, - CF2_Buffer buf ); + cf2_initGlobalRegionBuffer( PS_Decoder* decoder, + CF2_Int subrNum, + CF2_Buffer buf ); FT_LOCAL( FT_Error ) - cf2_getSeacComponent( CFF_Decoder* decoder, - CF2_Int code, - CF2_Buffer buf ); + cf2_getSeacComponent( PS_Decoder* decoder, + CF2_Int code, + CF2_Buffer buf ); FT_LOCAL( void ) - cf2_freeSeacComponent( CFF_Decoder* decoder, - CF2_Buffer buf ); + cf2_freeSeacComponent( PS_Decoder* decoder, + CF2_Buffer buf ); FT_LOCAL( CF2_Int ) - cf2_initLocalRegionBuffer( CFF_Decoder* decoder, - CF2_Int subrNum, - CF2_Buffer buf ); + cf2_initLocalRegionBuffer( PS_Decoder* decoder, + CF2_Int subrNum, + CF2_Buffer buf ); FT_LOCAL( CF2_Fixed ) - cf2_getDefaultWidthX( CFF_Decoder* decoder ); + cf2_getDefaultWidthX( PS_Decoder* decoder ); FT_LOCAL( CF2_Fixed ) - cf2_getNominalWidthX( CFF_Decoder* decoder ); + cf2_getNominalWidthX( PS_Decoder* decoder ); /* @@ -139,7 +139,7 @@ FT_BEGIN_HEADER typedef struct CF2_OutlineRec_ { CF2_OutlineCallbacksRec root; /* base class must be first */ - CFF_Decoder* decoder; + PS_Decoder* decoder; } CF2_OutlineRec, *CF2_Outline; diff --git a/src/psaux/psintrp.c b/src/psaux/psintrp.c index 1629d7bc8..d342d6ae4 100644 --- a/src/psaux/psintrp.c +++ b/src/psaux/psintrp.c @@ -476,7 +476,7 @@ FT_Error lastError = FT_Err_Ok; /* pointer to parsed font object */ - CFF_Decoder* decoder = font->decoder; + PS_Decoder* decoder = font->decoder; FT_Error* error = &font->error; FT_Memory memory = font->memory; From 9428ee42c0100381a60c57544773ae58c4d1028c Mon Sep 17 00:00:00 2001 From: Ewald Hew Date: Mon, 25 Sep 2017 06:15:46 +0200 Subject: [PATCH 260/470] Prepare for Type 1 mode. Add some checks for Type 1 data passing through. * src/psaux/psfont.h (CF2_Font): Add `isT1' flag. * src/psaux/psfont.c (cf2_font_setup): Skip the variations and blend code which is not applicable for Type 1. * src/psaux/psft.c (cf2_decoder_parse_charstrings): Avoid accessing `decoder->cff' in Type 1 mode. Copy `is_t1' flag to `CF2_Font'. --- ChangeLog | 14 ++++++++++ src/psaux/psfont.c | 70 ++++++++++++++++++++++++---------------------- src/psaux/psfont.h | 1 + src/psaux/psft.c | 10 +++++-- 4 files changed, 59 insertions(+), 36 deletions(-) diff --git a/ChangeLog b/ChangeLog index a215fa461..1264e38c2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2017-09-25 Ewald Hew + + [psaux] Prepare for Type 1 mode. + + Add some checks for Type 1 data passing through. + + * src/psaux/psfont.h (CF2_Font): Add `isT1' flag. + * src/psaux/psfont.c (cf2_font_setup): Skip the variations and blend + code which is not applicable for Type 1. + + * src/psaux/psft.c (cf2_decoder_parse_charstrings): Avoid accessing + `decoder->cff' in Type 1 mode. + Copy `is_t1' flag to `CF2_Font'. + 2017-09-25 Ewald Hew [psaux, cff] Use the new objects. diff --git a/src/psaux/psfont.c b/src/psaux/psfont.c index bdcc3568f..093e66ea8 100644 --- a/src/psaux/psfont.c +++ b/src/psaux/psfont.c @@ -260,8 +260,6 @@ CF2_UInt lenNormalizedV = 0; FT_Fixed* normalizedV = NULL; - FT_Service_CFFLoad cffload = (FT_Service_CFFLoad)font->cffload; - /* clear previous error */ font->error = FT_Err_Ok; @@ -274,46 +272,50 @@ needExtraSetup = TRUE; } - /* check for variation vectors */ - vstore = cf2_getVStore( decoder ); - hasVariations = ( vstore->dataCount != 0 ); - - if ( hasVariations ) + if ( !font->isT1 ) { -#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT - /* check whether Private DICT in this subfont needs to be reparsed */ - font->error = cf2_getNormalizedVector( decoder, - &lenNormalizedV, - &normalizedV ); - if ( font->error ) - return; + FT_Service_CFFLoad cffload = (FT_Service_CFFLoad)font->cffload; + /* check for variation vectors */ + vstore = cf2_getVStore( decoder ); + hasVariations = ( vstore->dataCount != 0 ); - if ( cffload->blend_check_vector( &subFont->blend, - subFont->private_dict.vsindex, - lenNormalizedV, - normalizedV ) ) + if ( hasVariations ) { - /* blend has changed, reparse */ - cffload->load_private_dict( decoder->cff, - subFont, - lenNormalizedV, - normalizedV ); - needExtraSetup = TRUE; - } +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT + /* check whether Private DICT in this subfont needs to be reparsed */ + font->error = cf2_getNormalizedVector( decoder, + &lenNormalizedV, + &normalizedV ); + if ( font->error ) + return; + + if ( cffload->blend_check_vector( &subFont->blend, + subFont->private_dict.vsindex, + lenNormalizedV, + normalizedV ) ) + { + /* blend has changed, reparse */ + cffload->load_private_dict( decoder->cff, + subFont, + lenNormalizedV, + normalizedV ); + needExtraSetup = TRUE; + } #endif - /* copy from subfont */ - font->blend.font = subFont->blend.font; + /* copy from subfont */ + font->blend.font = subFont->blend.font; - /* clear state of charstring blend */ - font->blend.usedBV = FALSE; + /* clear state of charstring blend */ + font->blend.usedBV = FALSE; - /* initialize value for charstring */ - font->vsindex = subFont->private_dict.vsindex; + /* initialize value for charstring */ + font->vsindex = subFont->private_dict.vsindex; - /* store vector inputs for blends in charstring */ - font->lenNDV = lenNormalizedV; - font->NDV = normalizedV; + /* store vector inputs for blends in charstring */ + font->lenNDV = lenNormalizedV; + font->NDV = normalizedV; + } } /* if ppem has changed, we need to recompute some cached data */ diff --git a/src/psaux/psfont.h b/src/psaux/psfont.h index f88b1316f..fc86f80ef 100644 --- a/src/psaux/psfont.h +++ b/src/psaux/psfont.h @@ -65,6 +65,7 @@ FT_BEGIN_HEADER FT_Memory memory; FT_Error error; /* shared error for this instance */ + FT_Bool isT1; FT_Bool isCFF2; CF2_RenderingFlags renderingFlags; diff --git a/src/psaux/psft.c b/src/psaux/psft.c index a05f1f28f..34ac0b691 100644 --- a/src/psaux/psft.c +++ b/src/psaux/psft.c @@ -309,8 +309,11 @@ FT_Error error = FT_Err_Ok; CF2_Font font; + FT_Bool is_t1 = decoder->builder.is_t1; - FT_ASSERT( decoder && decoder->cff ); + + FT_ASSERT( decoder && + ( is_t1 || decoder->cff ) ); memory = decoder->builder.memory; @@ -330,7 +333,9 @@ font = (CF2_Font)decoder->cff->cf2_instance.data; font->memory = memory; - font->cffload = (FT_Service_CFFLoad)decoder->cff->cffload; + + if ( !is_t1 ) + font->cffload = (FT_Service_CFFLoad)decoder->cff->cffload; /* initialize a client outline, to be shared by each glyph rendered */ cf2_outline_init( &font->outline, font->memory, &font->error ); @@ -381,6 +386,7 @@ /* copy isCFF2 boolean from TT_Face to CF2_Font */ font->isCFF2 = builder->face->is_cff2; + font->isT1 = is_t1; font->renderingFlags = 0; if ( hinted ) From d23affe1ef8646ce51aa8d94fddccb7c89ba9a13 Mon Sep 17 00:00:00 2001 From: Ewald Hew Date: Mon, 25 Sep 2017 06:22:52 +0200 Subject: [PATCH 261/470] Reorganize object fields. Make some fields more generic, so that we can access them the same way regardless of Type 1 or CFF. * include/freetype/internal/psaux.h (PS_Builder): Change `TT_Face' to `FT_Face'. Remove unused fields. * src/psaux/psft.c: Update all accesses of `PS_Builder.face'. Add some asserts to guard against casting `T1_Face' as `TT_Face'. * src/type1/t1objs.h (T1_GlyphSlot): Reorder fields to follow `CFF_GlyphSlot', so that we can pretend they are the same in the interpreter. * src/psaux/psobjs.c (ps_builder_init, ps_builder_add_point): Updated with above changes. --- ChangeLog | 21 ++++++++++++++++++ include/freetype/internal/psaux.h | 5 +---- src/psaux/psft.c | 36 +++++++++++++++++++------------ src/psaux/psobjs.c | 8 +++---- src/type1/t1objs.h | 6 +++--- 5 files changed, 51 insertions(+), 25 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1264e38c2..c75a316e0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,24 @@ +2017-09-25 Ewald Hew + + [psaux, type1] Reorganize object fields. + + Make some fields more generic, so that we can access them the same + way regardless of Type 1 or CFF. + + * include/freetype/internal/psaux.h (PS_Builder): Change `TT_Face' + to `FT_Face'. + Remove unused fields. + + * src/psaux/psft.c: Update all accesses of `PS_Builder.face'. + Add some asserts to guard against casting `T1_Face' as `TT_Face'. + + * src/type1/t1objs.h (T1_GlyphSlot): Reorder fields to follow + `CFF_GlyphSlot', so that we can pretend they are the same in the + interpreter. + + * src/psaux/psobjs.c (ps_builder_init, ps_builder_add_point): + Updated with above changes. + 2017-09-25 Ewald Hew [psaux] Prepare for Type 1 mode. diff --git a/include/freetype/internal/psaux.h b/include/freetype/internal/psaux.h index 45013e482..bde0bfac2 100644 --- a/include/freetype/internal/psaux.h +++ b/include/freetype/internal/psaux.h @@ -513,7 +513,7 @@ FT_BEGIN_HEADER struct PS_Builder_ { FT_Memory memory; - TT_Face face; + FT_Face face; CFF_GlyphSlot glyph; FT_GlyphLoader loader; FT_Outline* base; @@ -532,9 +532,6 @@ FT_BEGIN_HEADER FT_Bool metrics_only; - void* hints_funcs; /* hinter-specific */ - void* hints_globals; /* hinter-specific */ - FT_Bool is_t1; PS_Builder_FuncsRec funcs; diff --git a/src/psaux/psft.c b/src/psaux/psft.c index 34ac0b691..25d4a4018 100644 --- a/src/psaux/psft.c +++ b/src/psaux/psft.c @@ -293,9 +293,9 @@ cf2_getUnitsPerEm( PS_Decoder* decoder ) { FT_ASSERT( decoder && decoder->builder.face ); - FT_ASSERT( decoder->builder.face->root.units_per_EM ); + FT_ASSERT( decoder->builder.face->units_per_EM ); - return decoder->builder.face->root.units_per_EM; + return decoder->builder.face->units_per_EM; } @@ -355,7 +355,7 @@ FT_Bool no_stem_darkening_driver = driver->no_stem_darkening; FT_Char no_stem_darkening_font = - builder->face->root.internal->no_stem_darkening; + builder->face->internal->no_stem_darkening; /* local error */ FT_Error error2 = FT_Err_Ok; @@ -384,9 +384,14 @@ &hinted, &scaled ); - /* copy isCFF2 boolean from TT_Face to CF2_Font */ - font->isCFF2 = builder->face->is_cff2; - font->isT1 = is_t1; + if ( is_t1 ) + font->isCFF2 = FALSE; + else + { + /* copy isCFF2 boolean from TT_Face to CF2_Font */ + font->isCFF2 = ((TT_Face)builder->face)->is_cff2; + } + font->isT1 = is_t1; font->renderingFlags = 0; if ( hinted ) @@ -472,10 +477,11 @@ FT_ASSERT( decoder && decoder->builder.face ); FT_ASSERT( vec && len ); - - face = decoder->builder.face; + FT_ASSERT( !decoder->builder.is_t1 ); + + face = (TT_Face)decoder->builder.face; mm = (FT_Service_MultiMasters)face->mm; - + return mm->get_var_blend( FT_FACE( face ), len, NULL, vec, NULL ); } #endif @@ -487,7 +493,7 @@ { FT_ASSERT( decoder && decoder->builder.face && - decoder->builder.face->root.size ); + decoder->builder.face->size ); /* * Note that `y_ppem' can be zero if there wasn't a call to @@ -499,7 +505,7 @@ * */ return cf2_intToFixed( - decoder->builder.face->root.size->metrics.y_ppem ); + decoder->builder.face->size->metrics.y_ppem ); } @@ -650,13 +656,14 @@ FT_ASSERT( decoder ); + FT_ASSERT( !decoder->builder.is_t1 ); FT_ZERO( buf ); #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. */ - if ( decoder->builder.face->root.internal->incremental_interface ) + if ( decoder->builder.face->internal->incremental_interface ) gid = code; else #endif /* FT_CONFIG_OPTION_INCREMENTAL */ @@ -666,7 +673,7 @@ return FT_THROW( Invalid_Glyph_Format ); } - error = decoder->get_glyph_callback( decoder->builder.face, + error = decoder->get_glyph_callback( (TT_Face)decoder->builder.face, (CF2_UInt)gid, &charstring, &len ); @@ -690,8 +697,9 @@ CF2_Buffer buf ) { FT_ASSERT( decoder ); + FT_ASSERT( !decoder->builder.is_t1 ); - decoder->free_glyph_callback( decoder->builder.face, + decoder->free_glyph_callback( (TT_Face)decoder->builder.face, (FT_Byte**)&buf->start, (FT_ULong)( buf->end - buf->start ) ); } diff --git a/src/psaux/psobjs.c b/src/psaux/psobjs.c index a4dd44865..dcb34747a 100644 --- a/src/psaux/psobjs.c +++ b/src/psaux/psobjs.c @@ -2062,9 +2062,9 @@ { T1_Builder t1builder = (T1_Builder)builder; - ps_builder->face = (TT_Face)t1builder->face; - ps_builder->glyph = t1builder->glyph; ps_builder->memory = t1builder->memory; + ps_builder->face = (FT_Face)t1builder->face; + ps_builder->glyph = (CFF_GlyphSlot)t1builder->glyph; ps_builder->loader = t1builder->loader; ps_builder->base = t1builder->base; ps_builder->current = t1builder->current; @@ -2086,8 +2086,8 @@ { CFF_Builder* cffbuilder = (CFF_Builder*)builder; - ps_builder->face = cffbuilder->face; ps_builder->memory = cffbuilder->memory; + ps_builder->face = (FT_Face)cffbuilder->face; ps_builder->glyph = cffbuilder->glyph; ps_builder->loader = cffbuilder->loader; ps_builder->base = cffbuilder->base; @@ -2172,7 +2172,7 @@ else #endif #ifdef T1_CONFIG_OPTION_OLD_ENGINE - if ( builder->face->is_t1 ) + if ( builder->is_t1 ) { point->x = FIXED_TO_INT( x ); point->y = FIXED_TO_INT( y ); diff --git a/src/type1/t1objs.h b/src/type1/t1objs.h index 39d26bf8b..d009b394b 100644 --- a/src/type1/t1objs.h +++ b/src/type1/t1objs.h @@ -120,12 +120,12 @@ FT_BEGIN_HEADER FT_Bool hint; FT_Bool scaled; - FT_Int max_points; - FT_Int max_contours; - FT_Fixed x_scale; FT_Fixed y_scale; + FT_Int max_points; + FT_Int max_contours; + } T1_GlyphSlotRec; From 645d1b86ade211d1323f6050ec5092b684736b4e Mon Sep 17 00:00:00 2001 From: Ewald Hew Date: Mon, 25 Sep 2017 06:28:25 +0200 Subject: [PATCH 262/470] Move and rename `CFF_Driver'. This is so that we can use the same hinting engine parameters for Type 1. * include/freetype/internal/cffotypes.h (CFF_Driver): Rename and move to... * include/freetype/internal/psaux.h (PS_Driver): ...here. * src/cff/cffdrivr.c, src/cff/cffgload.c, src/cff/cffload.c, src/cff/cffobjs.c, src/cff/cffobjs.h, src/psaux/psft.c, src/psaux/psobjs.c: Update references. --- ChangeLog | 15 +++++++++++++++ include/freetype/internal/cffotypes.h | 26 -------------------------- include/freetype/internal/psaux.h | 16 ++++++++++++++++ src/cff/cffdrivr.c | 7 ++++--- src/cff/cffgload.c | 2 +- src/cff/cffload.c | 2 +- src/cff/cffobjs.c | 2 +- src/cff/cffobjs.h | 4 ++-- src/psaux/psft.c | 2 +- src/psaux/psobjs.c | 4 ++-- 10 files changed, 43 insertions(+), 37 deletions(-) diff --git a/ChangeLog b/ChangeLog index c75a316e0..d6d0be11f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2017-09-25 Ewald Hew + + [cff] Move and rename `CFF_Driver'. + + This is so that we can use the same hinting engine parameters for + Type 1. + + * include/freetype/internal/cffotypes.h (CFF_Driver): Rename and + move to... + * include/freetype/internal/psaux.h (PS_Driver): ...here. + + * src/cff/cffdrivr.c, src/cff/cffgload.c, src/cff/cffload.c, + src/cff/cffobjs.c, src/cff/cffobjs.h, src/psaux/psft.c, + src/psaux/psobjs.c: Update references. + 2017-09-25 Ewald Hew [psaux, type1] Reorganize object fields. diff --git a/include/freetype/internal/cffotypes.h b/include/freetype/internal/cffotypes.h index 6cabaff17..32f7d32ad 100644 --- a/include/freetype/internal/cffotypes.h +++ b/include/freetype/internal/cffotypes.h @@ -12,16 +12,6 @@ FT_BEGIN_HEADER - /*************************************************************************/ - /* */ - /* */ - /* CFF_Driver */ - /* */ - /* */ - /* A handle to an OpenType driver object. */ - /* */ - typedef struct CFF_DriverRec_* CFF_Driver; - typedef TT_Face CFF_Face; @@ -91,22 +81,6 @@ FT_BEGIN_HEADER } CFF_Transform; - /***********************************************************************/ - /* */ - /* CFF driver class. */ - /* */ - typedef struct CFF_DriverRec_ - { - FT_DriverRec root; - - FT_UInt hinting_engine; - FT_Bool no_stem_darkening; - FT_Int darken_params[8]; - FT_Int32 random_seed; - - } CFF_DriverRec; - - FT_END_HEADER diff --git a/include/freetype/internal/psaux.h b/include/freetype/internal/psaux.h index bde0bfac2..24c02e779 100644 --- a/include/freetype/internal/psaux.h +++ b/include/freetype/internal/psaux.h @@ -35,6 +35,22 @@ FT_BEGIN_HEADER + /***********************************************************************/ + /* */ + /* PostScript modules driver class. */ + /* */ + typedef struct PS_DriverRec_ + { + FT_DriverRec root; + + FT_UInt hinting_engine; + FT_Bool no_stem_darkening; + FT_Int darken_params[8]; + FT_Int32 random_seed; + + } PS_DriverRec, *PS_Driver; + + /*************************************************************************/ /*************************************************************************/ /***** *****/ diff --git a/src/cff/cffdrivr.c b/src/cff/cffdrivr.c index 4c9b1cd99..419cdfdcb 100644 --- a/src/cff/cffdrivr.c +++ b/src/cff/cffdrivr.c @@ -21,6 +21,7 @@ #include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_STREAM_H #include FT_INTERNAL_SFNT_H +#include FT_INTERNAL_POSTSCRIPT_AUX_H #include FT_SERVICE_CID_H #include FT_SERVICE_POSTSCRIPT_INFO_H #include FT_SERVICE_POSTSCRIPT_NAME_H @@ -744,7 +745,7 @@ FT_Bool value_is_string ) { FT_Error error = FT_Err_Ok; - CFF_Driver driver = (CFF_Driver)module; + PS_Driver driver = (PS_Driver)module; #ifndef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES FT_UNUSED( value_is_string ); @@ -910,7 +911,7 @@ const void* value ) { FT_Error error = FT_Err_Ok; - CFF_Driver driver = (CFF_Driver)module; + PS_Driver driver = (PS_Driver)module; if ( !ft_strcmp( property_name, "darkening-parameters" ) ) @@ -1229,7 +1230,7 @@ FT_MODULE_DRIVER_HAS_HINTER | FT_MODULE_DRIVER_HINTS_LIGHTLY, - sizeof ( CFF_DriverRec ), + sizeof ( PS_DriverRec ), "cff", 0x10000L, 0x20000L, diff --git a/src/cff/cffgload.c b/src/cff/cffgload.c index 12c8097d1..917fb3ad8 100644 --- a/src/cff/cffgload.c +++ b/src/cff/cffgload.c @@ -395,7 +395,7 @@ { #ifdef CFF_CONFIG_OPTION_OLD_ENGINE - CFF_Driver driver = (CFF_Driver)FT_FACE_DRIVER( face ); + PS_Driver driver = (PS_Driver)FT_FACE_DRIVER( face ); #endif diff --git a/src/cff/cffload.c b/src/cff/cffload.c index 5e6839d6c..21dd42366 100644 --- a/src/cff/cffload.c +++ b/src/cff/cffload.c @@ -2075,7 +2075,7 @@ */ if ( face->root.internal->random_seed == -1 ) { - CFF_Driver driver = (CFF_Driver)FT_FACE_DRIVER( face ); + PS_Driver driver = (PS_Driver)FT_FACE_DRIVER( face ); subfont->random = (FT_UInt32)driver->random_seed; diff --git a/src/cff/cffobjs.c b/src/cff/cffobjs.c index f9013e772..29a14f954 100644 --- a/src/cff/cffobjs.c +++ b/src/cff/cffobjs.c @@ -1183,7 +1183,7 @@ FT_LOCAL_DEF( FT_Error ) cff_driver_init( FT_Module module ) /* CFF_Driver */ { - CFF_Driver driver = (CFF_Driver)module; + PS_Driver driver = (PS_Driver)module; FT_UInt32 seed; diff --git a/src/cff/cffobjs.h b/src/cff/cffobjs.h index 839a61c44..9f3dff3e5 100644 --- a/src/cff/cffobjs.h +++ b/src/cff/cffobjs.h @@ -71,10 +71,10 @@ FT_BEGIN_HEADER /* Driver functions */ /* */ FT_LOCAL( FT_Error ) - cff_driver_init( FT_Module module ); /* CFF_Driver */ + cff_driver_init( FT_Module module ); /* PS_Driver */ FT_LOCAL( void ) - cff_driver_done( FT_Module module ); /* CFF_Driver */ + cff_driver_done( FT_Module module ); /* PS_Driver */ FT_END_HEADER diff --git a/src/psaux/psft.c b/src/psaux/psft.c index 25d4a4018..c91fedd28 100644 --- a/src/psaux/psft.c +++ b/src/psaux/psft.c @@ -350,7 +350,7 @@ /* build parameters for Adobe engine */ PS_Builder* builder = &decoder->builder; - CFF_Driver driver = (CFF_Driver)FT_FACE_DRIVER( builder->face ); + PS_Driver driver = (PS_Driver)FT_FACE_DRIVER( builder->face ); FT_Bool no_stem_darkening_driver = driver->no_stem_darkening; diff --git a/src/psaux/psobjs.c b/src/psaux/psobjs.c index dcb34747a..eecbda65e 100644 --- a/src/psaux/psobjs.c +++ b/src/psaux/psobjs.c @@ -1888,7 +1888,7 @@ FT_Byte* control = (FT_Byte*)outline->tags + outline->n_points; #ifdef CFF_CONFIG_OPTION_OLD_ENGINE - CFF_Driver driver = (CFF_Driver)FT_FACE_DRIVER( builder->face ); + PS_Driver driver = (PS_Driver)FT_FACE_DRIVER( builder->face ); if ( driver->hinting_engine == FT_CFF_HINTING_FREETYPE ) @@ -2161,7 +2161,7 @@ FT_Byte* control = (FT_Byte*)outline->tags + outline->n_points; #ifdef CFF_CONFIG_OPTION_OLD_ENGINE - CFF_Driver driver = (CFF_Driver)FT_FACE_DRIVER( builder->face ); + PS_Driver driver = (PS_Driver)FT_FACE_DRIVER( builder->face ); if ( driver->hinting_engine == FT_CFF_HINTING_FREETYPE ) From 97704b158ed7eafde7eac8794e1c7df55a58fff7 Mon Sep 17 00:00:00 2001 From: Ewald Hew Date: Mon, 25 Sep 2017 06:33:28 +0200 Subject: [PATCH 263/470] Add Adobe engine configuration. Use the previously changed PS_Driver in type1 module to store hinting engine configuration. * include/freetype/ftt1drv.h: New file. Duplicate and rename config options from CFF. * include/freetype/config/ftheader.h (FT_TYPE1_DRIVER_H): New macro. * src/type1/t1driver.c (t1_driver_class): Update declaration. * src/type1/t1objs.c: Include FT_TYPE1_DRIVER_H. (T1_Driver_Init): Update code. --- ChangeLog | 15 ++++ include/freetype/config/ftheader.h | 13 ++++ include/freetype/ftt1drv.h | 116 +++++++++++++++++++++++++++++ src/type1/t1driver.c | 2 +- src/type1/t1objs.c | 34 ++++++++- 5 files changed, 177 insertions(+), 3 deletions(-) create mode 100644 include/freetype/ftt1drv.h diff --git a/ChangeLog b/ChangeLog index d6d0be11f..bfe22376e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2017-09-25 Ewald Hew + + [type1] Add Adobe engine configuration. + + Use the previously changed PS_Driver in type1 module to store + hinting engine configuration. + + * include/freetype/ftt1drv.h: New file. + Duplicate and rename config options from CFF. + * include/freetype/config/ftheader.h (FT_TYPE1_DRIVER_H): New macro. + + * src/type1/t1driver.c (t1_driver_class): Update declaration. + * src/type1/t1objs.c: Include FT_TYPE1_DRIVER_H. + (T1_Driver_Init): Update code. + 2017-09-25 Ewald Hew [cff] Move and rename `CFF_Driver'. diff --git a/include/freetype/config/ftheader.h b/include/freetype/config/ftheader.h index d491af57c..ce3b7eeb6 100644 --- a/include/freetype/config/ftheader.h +++ b/include/freetype/config/ftheader.h @@ -367,6 +367,19 @@ #define FT_PCF_DRIVER_H + /************************************************************************* + * + * @macro: + * FT_TYPE1_DRIVER_H + * + * @description: + * A macro used in #include statements to name the file containing + * structures and macros related to the Type~1 driver module. + * + */ +#define FT_TYPE1_DRIVER_H + + /************************************************************************* * * @macro: diff --git a/include/freetype/ftt1drv.h b/include/freetype/ftt1drv.h new file mode 100644 index 000000000..116b33b05 --- /dev/null +++ b/include/freetype/ftt1drv.h @@ -0,0 +1,116 @@ +/***************************************************************************/ +/* */ +/* ftt1drv.h */ +/* */ +/* FreeType API for controlling the Type 1 driver (specification only). */ +/* */ +/* Copyright 2013-2017 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef FTT1DRV_H_ +#define FTT1DRV_H_ + +#include +#include FT_FREETYPE_H + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + + + /************************************************************************** + * + * @property: + * hinting-engine[type1] + * + * @description: + * Thanks to Adobe, which contributed a new hinting (and parsing) + * engine, an application can select between `freetype' and `adobe' if + * compiled with T1_CONFIG_OPTION_OLD_ENGINE. If this configuration + * macro isn't defined, `hinting-engine' does nothing. + * + * The default engine is `freetype' if T1_CONFIG_OPTION_OLD_ENGINE is + * defined, and `adobe' otherwise. + * + * The following example code demonstrates how to select Adobe's hinting + * engine (omitting the error handling). + * + * { + * FT_Library library; + * FT_UInt hinting_engine = FT_T1_HINTING_ADOBE; + * + * + * FT_Init_FreeType( &library ); + * + * FT_Property_Set( library, "type1", + * "hinting-engine", &hinting_engine ); + * } + * + * @note: + * This property can be used with @FT_Property_Get also. + * + * This property can be set via the `FREETYPE_PROPERTIES' environment + * variable (using values `adobe' or `freetype'). + */ + + + /************************************************************************** + * + * @enum: + * FT_T1_HINTING_XXX + * + * @description: + * A list of constants used for the @hinting-engine[type1] property to + * select the hinting engine for Type 1 fonts. + * + * @values: + * FT_T1_HINTING_FREETYPE :: + * Use the old FreeType hinting engine. + * + * FT_T1_HINTING_ADOBE :: + * Use the hinting engine contributed by Adobe. + * + */ +#define FT_T1_HINTING_FREETYPE 0 +#define FT_T1_HINTING_ADOBE 1 + + /************************************************************************** + * + * @constant: + * FT_PARAM_TAG_RANDOM_SEED + * + * @description: + * An @FT_Parameter tag to be used with @FT_Face_Properties. The + * corresponding 32bit signed integer argument overrides the CFF + * module's random seed value with a face-specific one; see + * @random-seed. + * + */ +#define FT_PARAM_TAG_RANDOM_SEED \ + FT_MAKE_TAG( 's', 'e', 'e', 'd' ) + + /* */ + + +FT_END_HEADER + + +#endif /* FTT1DRV_H_ */ + + +/* END */ diff --git a/src/type1/t1driver.c b/src/type1/t1driver.c index c2089947f..866a8244d 100644 --- a/src/type1/t1driver.c +++ b/src/type1/t1driver.c @@ -713,7 +713,7 @@ FT_MODULE_DRIVER_SCALABLE | FT_MODULE_DRIVER_HAS_HINTER, - sizeof ( FT_DriverRec ), + sizeof ( PS_DriverRec ), "type1", 0x10000L, diff --git a/src/type1/t1objs.c b/src/type1/t1objs.c index 5ac1292ae..dab556f0a 100644 --- a/src/type1/t1objs.c +++ b/src/type1/t1objs.c @@ -21,6 +21,7 @@ #include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_STREAM_H #include FT_TRUETYPE_IDS_H +#include FT_TYPE1_DRIVER_H #include "t1gload.h" #include "t1load.h" @@ -578,9 +579,38 @@ /* FreeType error code. 0 means success. */ /* */ FT_LOCAL_DEF( FT_Error ) - T1_Driver_Init( FT_Module driver ) + T1_Driver_Init( FT_Module module ) { - FT_UNUSED( driver ); + PS_Driver driver = (PS_Driver)module; + + FT_UInt32 seed; + + + /* set default property values, cf. `ftt1drv.h' */ + driver->hinting_engine = FT_T1_HINTING_FREETYPE; + + driver->no_stem_darkening = TRUE; + + driver->darken_params[0] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_X1; + driver->darken_params[1] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y1; + driver->darken_params[2] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_X2; + driver->darken_params[3] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y2; + driver->darken_params[4] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_X3; + driver->darken_params[5] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y3; + driver->darken_params[6] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_X4; + driver->darken_params[7] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y4; + + /* compute random seed from some memory addresses */ + seed = (FT_UInt32)( (FT_Offset)(char*)&seed ^ + (FT_Offset)(char*)&module ^ + (FT_Offset)(char*)module->memory ); + seed = seed ^ ( seed >> 10 ) ^ ( seed >> 20 ); + + driver->random_seed = (FT_Int32)seed; + if ( driver->random_seed < 0 ) + driver->random_seed = -driver->random_seed; + else if ( driver->random_seed == 0 ) + driver->random_seed = 123456789; return FT_Err_Ok; } From 7e185dcd7928c0f8730dc18af152db7f83ebca4c Mon Sep 17 00:00:00 2001 From: Ewald Hew Date: Mon, 25 Sep 2017 06:40:32 +0200 Subject: [PATCH 264/470] Allow `type1' module to use the Adobe engine. Add the callback and some conditionals to switch between the two engines. * include/freetype/internal/psaux.h (T1_Decoder_FuncsRec): Change function declarations. * src/psaux/psauxmod.c (T1_Decoder_FuncsRec): Register the callbacks. * src/psaux/psobjs.c (ps_builder_add_point): Add conditionals for number conversion. * src/type1/t1gload.c (T1_Parse_Glyph_And_Get_Char_String): Add code to choose which renderer to use. * src/cid/cidgload.c (cid_load_glyph): Update call. * src/base/ftobjs.c, src/psaux/psobjs.c, src/type1/t1gload.c: Update includes. --- ChangeLog | 22 ++++++++++++++++ include/freetype/internal/psaux.h | 12 ++++++--- src/cid/cidgload.c | 2 +- src/psaux/psauxmod.c | 3 ++- src/psaux/psobjs.c | 13 +++++----- src/type1/t1gload.c | 43 ++++++++++++++++++++++++++++--- 6 files changed, 81 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index bfe22376e..ef1290ecc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,25 @@ +2017-09-25 Ewald Hew + + Allow `type1' module to use the Adobe engine. + + Add the callback and some conditionals to switch between the two + engines. + + * include/freetype/internal/psaux.h (T1_Decoder_FuncsRec): Change + function declarations. + * src/psaux/psauxmod.c (T1_Decoder_FuncsRec): Register the + callbacks. + + * src/psaux/psobjs.c (ps_builder_add_point): Add conditionals for + number conversion. + + * src/type1/t1gload.c (T1_Parse_Glyph_And_Get_Char_String): Add code + to choose which renderer to use. + + * src/cid/cidgload.c (cid_load_glyph): Update call. + * src/base/ftobjs.c, src/psaux/psobjs.c, src/type1/t1gload.c: Update + includes. + 2017-09-25 Ewald Hew [type1] Add Adobe engine configuration. diff --git a/include/freetype/internal/psaux.h b/include/freetype/internal/psaux.h index 24c02e779..a8469f722 100644 --- a/include/freetype/internal/psaux.h +++ b/include/freetype/internal/psaux.h @@ -872,9 +872,15 @@ FT_BEGIN_HEADER (*done)( T1_Decoder decoder ); FT_Error - (*parse_charstrings)( T1_Decoder decoder, - FT_Byte* base, - FT_UInt len ); + (*parse_charstrings_old)( T1_Decoder decoder, + FT_Byte* base, + FT_UInt len ); + + FT_Error + (*parse_charstrings)( PS_Decoder* decoder, + FT_Byte* charstring_base, + FT_ULong charstring_len ); + } T1_Decoder_FuncsRec; diff --git a/src/cid/cidgload.c b/src/cid/cidgload.c index b96c33334..4672a763d 100644 --- a/src/cid/cidgload.c +++ b/src/cid/cidgload.c @@ -169,7 +169,7 @@ if ( decoder->lenIV >= 0 ) psaux->t1_decrypt( charstring, glyph_length, 4330 ); - error = decoder->funcs.parse_charstrings( + error = decoder->funcs.parse_charstrings_old( decoder, charstring + cs_offset, glyph_length - cs_offset ); } diff --git a/src/psaux/psauxmod.c b/src/psaux/psauxmod.c index bc7002a78..9c0730902 100644 --- a/src/psaux/psauxmod.c +++ b/src/psaux/psauxmod.c @@ -90,7 +90,8 @@ { t1_decoder_init, /* init */ t1_decoder_done, /* done */ - t1_decoder_parse_charstrings /* parse_charstrings */ + t1_decoder_parse_charstrings, /* parse_charstrings_old */ + cf2_decoder_parse_charstrings /* parse_charstrings */ }; diff --git a/src/psaux/psobjs.c b/src/psaux/psobjs.c index eecbda65e..8d0f0fe9b 100644 --- a/src/psaux/psobjs.c +++ b/src/psaux/psobjs.c @@ -20,6 +20,8 @@ #include FT_INTERNAL_POSTSCRIPT_AUX_H #include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_CALC_H +#include FT_CFF_DRIVER_H +#include FT_TYPE1_DRIVER_H #include "psobjs.h" #include "psconv.h" @@ -2160,25 +2162,24 @@ FT_Vector* point = outline->points + outline->n_points; FT_Byte* control = (FT_Byte*)outline->tags + outline->n_points; -#ifdef CFF_CONFIG_OPTION_OLD_ENGINE PS_Driver driver = (PS_Driver)FT_FACE_DRIVER( builder->face ); - - if ( driver->hinting_engine == FT_CFF_HINTING_FREETYPE ) +#ifdef CFF_CONFIG_OPTION_OLD_ENGINE + if ( !builder->is_t1 && + driver->hinting_engine == FT_CFF_HINTING_FREETYPE ) { point->x = x >> 16; point->y = y >> 16; } else #endif -#ifdef T1_CONFIG_OPTION_OLD_ENGINE - if ( builder->is_t1 ) + if ( builder->is_t1 && + driver->hinting_engine == FT_T1_HINTING_FREETYPE ) { point->x = FIXED_TO_INT( x ); point->y = FIXED_TO_INT( y ); } else -#endif { /* cf2_decoder_parse_charstrings uses 16.16 coordinates */ point->x = x >> 10; diff --git a/src/type1/t1gload.c b/src/type1/t1gload.c index aaf19b6dc..22b14e480 100644 --- a/src/type1/t1gload.c +++ b/src/type1/t1gload.c @@ -23,6 +23,7 @@ #include FT_INTERNAL_STREAM_H #include FT_OUTLINE_H #include FT_INTERNAL_POSTSCRIPT_AUX_H +#include FT_TYPE1_DRIVER_H #include "t1errors.h" @@ -63,11 +64,16 @@ T1_Font type1 = &face->type1; FT_Error error = FT_Err_Ok; + PSAux_Service psaux = (PSAux_Service)face->psaux; + const T1_Decoder_Funcs decoder_funcs = psaux->t1_decoder_funcs; + PS_Decoder psdecoder; + #ifdef FT_CONFIG_OPTION_INCREMENTAL FT_Incremental_InterfaceRec *inc = face->root.internal->incremental_interface; #endif + PS_Driver driver = (PS_Driver)FT_FACE_DRIVER( face ); decoder->font_matrix = type1->font_matrix; decoder->font_offset = type1->font_offset; @@ -90,9 +96,40 @@ } if ( !error ) - error = decoder->funcs.parse_charstrings( - decoder, (FT_Byte*)char_string->pointer, - (FT_UInt)char_string->length ); + { + /* choose which renderer to use */ + if ( driver->hinting_engine == FT_T1_HINTING_FREETYPE ) + error = decoder_funcs->parse_charstrings_old( decoder, + (FT_Byte*)char_string->pointer, + (FT_UInt)char_string->length ); + else + { + psaux->ps_decoder_init( decoder, TRUE, &psdecoder ); + + error = decoder_funcs->parse_charstrings( &psdecoder, + (FT_Byte*)char_string->pointer, + (FT_ULong)char_string->length ); + +#if 0 /* TODO(ewaldhew) */ + /* Adobe's engine uses 16.16 numbers everywhere; */ + /* as a consequence, glyphs larger than 2000ppem get rejected */ + if ( FT_ERR_EQ( error, Glyph_Too_Big ) ) + { + /* this time, we retry unhinted and scale up the glyph later on */ + /* (the engine uses and sets the hardcoded value 0x10000 / 64 = */ + /* 0x400 for both `x_scale' and `y_scale' in this case) */ + hinting = FALSE; + force_scaling = TRUE; + glyph->hint = hinting; + + error = decoder_funcs->parse_charstrings( &psdecoder, + (FT_Byte*)char_string->pointer, + (FT_ULong)char_string->length ); + } +#endif + } + + } #ifdef FT_CONFIG_OPTION_INCREMENTAL From cb3f4c610d7f724731466eac78e667865f13d178 Mon Sep 17 00:00:00 2001 From: Ewald Hew Date: Mon, 25 Sep 2017 06:44:51 +0200 Subject: [PATCH 265/470] Add missing objects for Type 1 (1/2). Move `CF2_Font' instance to `PS_Decoder'. This is the context for the interpreter and since it is currently stored in `CFF_Font', is unavailable in Type 1 mode. * include/freetype/internal/psaux.h (T1_Decoder, PS_Decoder): New `cf2_instance' field. * src/psaux/psdecode.c (ps_decoder_init): Copy `cf2_instance' to `PS_Decoder'. * src/psaux/t1decode.c (t1_decoder_done): Add finalization code. * src/psaux/psft.c (cf2_decoder_parse_charstrings): Update accesses. --- ChangeLog | 18 ++++++++++++++++++ include/freetype/internal/psaux.h | 7 +++++-- src/psaux/psdecode.c | 3 ++- src/psaux/psft.c | 10 +++++----- src/psaux/t1decode.c | 8 ++++++++ 5 files changed, 38 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index ef1290ecc..620f84c7f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,21 @@ +2017-09-25 Ewald Hew + + [psaux] Add missing objects for Type 1 (1/2). + + Move `CF2_Font' instance to `PS_Decoder'. This is the context for + the interpreter and since it is currently stored in `CFF_Font', is + unavailable in Type 1 mode. + + * include/freetype/internal/psaux.h (T1_Decoder, PS_Decoder): New + `cf2_instance' field. + + * src/psaux/psdecode.c (ps_decoder_init): Copy `cf2_instance' to + `PS_Decoder'. + + * src/psaux/t1decode.c (t1_decoder_done): Add finalization code. + + * src/psaux/psft.c (cf2_decoder_parse_charstrings): Update accesses. + 2017-09-25 Ewald Hew Allow `type1' module to use the Adobe engine. diff --git a/include/freetype/internal/psaux.h b/include/freetype/internal/psaux.h index a8469f722..b28392bed 100644 --- a/include/freetype/internal/psaux.h +++ b/include/freetype/internal/psaux.h @@ -610,7 +610,8 @@ FT_BEGIN_HEADER CFF_Font cff; CFF_SubFont current_subfont; /* for current glyph_index */ - + FT_Generic* cf2_instance; + FT_Pos glyph_width; FT_Pos nominal_width; @@ -636,7 +637,7 @@ FT_BEGIN_HEADER CFF_Decoder_Get_Glyph_Callback get_glyph_callback; CFF_Decoder_Free_Glyph_Callback free_glyph_callback; - + /* Type 1 stuff */ FT_Service_PsCMaps psnames; /* for seac */ @@ -924,6 +925,8 @@ FT_BEGIN_HEADER FT_Bool seac; + FT_Generic cf2_instance; + } T1_DecoderRec; /*************************************************************************/ diff --git a/src/psaux/psdecode.c b/src/psaux/psdecode.c index 86b42863f..c8a5d01c2 100644 --- a/src/psaux/psdecode.c +++ b/src/psaux/psdecode.c @@ -41,13 +41,13 @@ is_t1, &ps_decoder->builder ); + ps_decoder->cf2_instance = &t1_decoder->cf2_instance; ps_decoder->psnames = t1_decoder->psnames; ps_decoder->num_glyphs = t1_decoder->num_glyphs; ps_decoder->glyph_names = t1_decoder->glyph_names; ps_decoder->hint_mode = t1_decoder->hint_mode; ps_decoder->blend = t1_decoder->blend; - /* ps_decoder->t1_parse_callback = t1_decoder->parse_callback; */ ps_decoder->num_locals = t1_decoder->num_subrs; ps_decoder->locals = t1_decoder->subrs; @@ -68,6 +68,7 @@ &ps_decoder->builder ); ps_decoder->cff = cff_decoder->cff; + ps_decoder->cf2_instance = &cff_decoder->cff->cf2_instance; ps_decoder->current_subfont = cff_decoder->current_subfont; ps_decoder->num_globals = cff_decoder->num_globals; diff --git a/src/psaux/psft.c b/src/psaux/psft.c index c91fedd28..ab1982663 100644 --- a/src/psaux/psft.c +++ b/src/psaux/psft.c @@ -318,19 +318,19 @@ memory = decoder->builder.memory; /* CF2 data is saved here across glyphs */ - font = (CF2_Font)decoder->cff->cf2_instance.data; + font = (CF2_Font)decoder->cf2_instance->data; /* on first glyph, allocate instance structure */ - if ( !decoder->cff->cf2_instance.data ) + if ( !decoder->cf2_instance->data ) { - decoder->cff->cf2_instance.finalizer = + decoder->cf2_instance->finalizer = (FT_Generic_Finalizer)cf2_free_instance; - if ( FT_ALLOC( decoder->cff->cf2_instance.data, + if ( FT_ALLOC( decoder->cf2_instance->data, sizeof ( CF2_FontRec ) ) ) return FT_THROW( Out_Of_Memory ); - font = (CF2_Font)decoder->cff->cf2_instance.data; + font = (CF2_Font)decoder->cf2_instance->data; font->memory = memory; diff --git a/src/psaux/t1decode.c b/src/psaux/t1decode.c index 1250b53f5..81f579744 100644 --- a/src/psaux/t1decode.c +++ b/src/psaux/t1decode.c @@ -1641,7 +1641,15 @@ FT_LOCAL_DEF( void ) t1_decoder_done( T1_Decoder decoder ) { + FT_Memory memory = decoder->builder.memory; + t1_builder_done( &decoder->builder ); + + if ( decoder->cf2_instance.finalizer ) + { + decoder->cf2_instance.finalizer( decoder->cf2_instance.data ); + FT_FREE( decoder->cf2_instance.data ); + } } From 6eb03f8f5a126c3716f557bd2e8e7ae0d6f93837 Mon Sep 17 00:00:00 2001 From: Ewald Hew Date: Mon, 25 Sep 2017 06:49:41 +0200 Subject: [PATCH 266/470] Add missing objects (2/2). Synthesize a `SubFont' object for Type 1 fonts. This is used in the interpreter to access Private dict data, which are stored in different places for Type 1 and CFF. This allows the same data to be used in either mode. * src/psaux/psobjs.c (t1_make_subfont): New procedure to copy required values to a dummy `CFF_SubFont' object. This is similar to `cff_make_private_dict'. * src/psaux/psobjs.h: Add the new declaration. * include/freetype/internal/psaux.h, src/psaux/psauxmod.c: Ditto. Add this to the PSAux Service for future use with CID fonts. * src/type1/t1gload.c: Include FT_INTERNAL_CFF_TYPES_H. (T1_Parse_Glyph_And_Get_Char_String): Add the call. --- ChangeLog | 20 ++++++++ include/freetype/internal/psaux.h | 4 ++ src/psaux/psauxmod.c | 1 + src/psaux/psobjs.c | 85 +++++++++++++++++++++++++++++++ src/psaux/psobjs.h | 4 ++ src/type1/t1gload.c | 7 +++ 6 files changed, 121 insertions(+) diff --git a/ChangeLog b/ChangeLog index 620f84c7f..c41b9f2e8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,23 @@ +2017-09-25 Ewald Hew + + [psaux] Add missing objects (2/2). + + Synthesize a `SubFont' object for Type 1 fonts. This is used in the + interpreter to access Private dict data, which are stored in + different places for Type 1 and CFF. This allows the same data to + be used in either mode. + + * src/psaux/psobjs.c (t1_make_subfont): New procedure to copy + required values to a dummy `CFF_SubFont' object. This is similar to + `cff_make_private_dict'. + * src/psaux/psobjs.h: Add the new declaration. + + * include/freetype/internal/psaux.h, src/psaux/psauxmod.c: Ditto. + Add this to the PSAux Service for future use with CID fonts. + + * src/type1/t1gload.c: Include FT_INTERNAL_CFF_TYPES_H. + (T1_Parse_Glyph_And_Get_Char_String): Add the call. + 2017-09-25 Ewald Hew [psaux] Add missing objects for Type 1 (1/2). diff --git a/include/freetype/internal/psaux.h b/include/freetype/internal/psaux.h index b28392bed..9748368db 100644 --- a/include/freetype/internal/psaux.h +++ b/include/freetype/internal/psaux.h @@ -1290,6 +1290,10 @@ FT_BEGIN_HEADER FT_Bool is_t1, PS_Decoder* ps_decoder ); + void + (*t1_make_subfont)( T1_Face face, + CFF_SubFont subfont ); + T1_CMap_Classes t1_cmap_classes; diff --git a/src/psaux/psauxmod.c b/src/psaux/psauxmod.c index 9c0730902..b07192909 100644 --- a/src/psaux/psauxmod.c +++ b/src/psaux/psauxmod.c @@ -154,6 +154,7 @@ t1_decrypt, cff_random, ps_decoder_init, + t1_make_subfont, (const T1_CMap_ClassesRec*) &t1_cmap_classes, diff --git a/src/psaux/psobjs.c b/src/psaux/psobjs.c index 8d0f0fe9b..3fd2fda04 100644 --- a/src/psaux/psobjs.c +++ b/src/psaux/psobjs.c @@ -2327,6 +2327,91 @@ /*************************************************************************/ /*************************************************************************/ + + FT_LOCAL_DEF( void ) + t1_make_subfont( T1_Face face, + CFF_SubFont subfont ) + { + PS_Private priv = &face->type1.private_dict; + CFF_Private cpriv = &subfont->private_dict; + FT_UInt n, count; + + FT_ZERO( subfont ); + FT_ZERO( cpriv ); + + count = cpriv->num_blue_values = priv->num_blue_values; + for ( n = 0; n < count; n++ ) + cpriv->blue_values[n] = (FT_Pos)priv->blue_values[n]; + + count = cpriv->num_other_blues = priv->num_other_blues; + for ( n = 0; n < count; n++ ) + cpriv->other_blues[n] = (FT_Pos)priv->other_blues[n]; + + count = cpriv->num_family_blues = priv->num_family_blues; + for ( n = 0; n < count; n++ ) + cpriv->family_blues[n] = (FT_Pos)priv->family_blues[n]; + + count = cpriv->num_family_other_blues = priv->num_family_other_blues; + for ( n = 0; n < count; n++ ) + cpriv->family_other_blues[n] = (FT_Pos)priv->family_other_blues[n]; + + cpriv->blue_scale = priv->blue_scale; + cpriv->blue_shift = (FT_Pos)priv->blue_shift; + cpriv->blue_fuzz = (FT_Pos)priv->blue_fuzz; + + cpriv->standard_width = (FT_Pos)priv->standard_width[0]; + cpriv->standard_height = (FT_Pos)priv->standard_height[0]; + + count = cpriv->num_snap_widths = priv->num_snap_widths; + for ( n = 0; n < count; n++ ) + cpriv->snap_widths[n] = (FT_Pos)priv->snap_widths[n]; + + count = cpriv->num_snap_heights = priv->num_snap_heights; + for ( n = 0; n < count; n++ ) + cpriv->snap_heights[n] = (FT_Pos)priv->snap_heights[n]; + + cpriv->force_bold = priv->force_bold; + cpriv->lenIV = priv->lenIV; + cpriv->language_group = priv->language_group; + cpriv->expansion_factor = priv->expansion_factor; + + cpriv->subfont = subfont; + + + /* Initialize the random number generator. */ + if ( face->root.internal->random_seed != -1 ) + { + /* . If we have a face-specific seed, use it. */ + /* If non-zero, update it to a positive value. */ + subfont->random = (FT_UInt32)face->root.internal->random_seed; + if ( face->root.internal->random_seed ) + { + do + { + face->root.internal->random_seed = + (FT_Int32)((PSAux_Service)face->psaux)->cff_random( + (FT_UInt32)face->root.internal->random_seed ); + + } while ( face->root.internal->random_seed < 0 ); + } + } + if ( !subfont->random ) + { + FT_UInt32 seed; + + /* compute random seed from some memory addresses */ + seed = (FT_UInt32)( (FT_Offset)(char*)&seed ^ + (FT_Offset)(char*)&face ^ + (FT_Offset)(char*)&subfont ); + seed = seed ^ ( seed >> 10 ) ^ ( seed >> 20 ); + if ( seed == 0 ) + seed = 0x7384; + + subfont->random = seed; + } + } + + FT_LOCAL_DEF( void ) t1_decrypt( FT_Byte* buffer, FT_Offset length, diff --git a/src/psaux/psobjs.h b/src/psaux/psobjs.h index 1f6841919..2fed988b4 100644 --- a/src/psaux/psobjs.h +++ b/src/psaux/psobjs.h @@ -284,6 +284,10 @@ FT_BEGIN_HEADER /*************************************************************************/ /*************************************************************************/ + FT_LOCAL( void ) + t1_make_subfont( T1_Face face, + CFF_SubFont subfont ); + FT_LOCAL( void ) t1_decrypt( FT_Byte* buffer, FT_Offset length, diff --git a/src/type1/t1gload.c b/src/type1/t1gload.c index 22b14e480..56689de4a 100644 --- a/src/type1/t1gload.c +++ b/src/type1/t1gload.c @@ -23,6 +23,7 @@ #include FT_INTERNAL_STREAM_H #include FT_OUTLINE_H #include FT_INTERNAL_POSTSCRIPT_AUX_H +#include FT_INTERNAL_CFF_TYPES_H #include FT_TYPE1_DRIVER_H #include "t1errors.h" @@ -104,8 +105,14 @@ (FT_UInt)char_string->length ); else { + CFF_SubFontRec subfont; + + psaux->ps_decoder_init( decoder, TRUE, &psdecoder ); + psaux->t1_make_subfont( face, &subfont ); + psdecoder.current_subfont = &subfont; + error = decoder_funcs->parse_charstrings( &psdecoder, (FT_Byte*)char_string->pointer, (FT_ULong)char_string->length ); From 283ef28505cffa4396dc27429dfff850f4964625 Mon Sep 17 00:00:00 2001 From: Ewald Hew Date: Mon, 25 Sep 2017 06:54:16 +0200 Subject: [PATCH 267/470] Fixes for rendering. The Type 1 advance width calculation passes null for glyph slot, etc, which can cause null pointer access in the new interpreter. Fall back to the old one for now. Fix the large glyph retry code and ensure hinting and scaling flags are set properly. * src/type1/t1gload.c (T1_Parse_Glyph_And_Get_Char_String): Add a check for metrics_only. Set the `force_scaling' flag. (T1_Parse_Glyph): Updated. (T1_Load_Glyph): Add `hinting' and `scaled' flags. --- ChangeLog | 19 ++++++++++++++++++- src/type1/t1gload.c | 29 +++++++++++++++++++---------- 2 files changed, 37 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index c41b9f2e8..5615f6248 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +2017-09-25 Ewald Hew + + [type1] Fixes for rendering. + + The Type 1 advance width calculation passes null for glyph slot, + etc, which can cause null pointer access in the new interpreter. + Fall back to the old one for now. + + Fix the large glyph retry code and ensure hinting and scaling flags + are set properly. + + * src/type1/t1gload.c (T1_Parse_Glyph_And_Get_Char_String): Add a + check for metrics_only. + Set the `force_scaling' flag. + (T1_Parse_Glyph): Updated. + (T1_Load_Glyph): Add `hinting' and `scaled' flags. + 2017-09-25 Ewald Hew [psaux] Add missing objects (2/2). @@ -198,7 +215,7 @@ [psaux] Minor fix. - Use `MultiMasters' service in `psaux' instead of a call to `cff'. + Use `MultiMasters' service in `psaux' instead of a call to `cff'. The project builds if CFF_CONFIG_OPTION_OLD_ENGINE is not defined. * src/psaux/cf2ft.c: Update includes. diff --git a/src/type1/t1gload.c b/src/type1/t1gload.c index 56689de4a..b1020e9db 100644 --- a/src/type1/t1gload.c +++ b/src/type1/t1gload.c @@ -59,7 +59,8 @@ static FT_Error T1_Parse_Glyph_And_Get_Char_String( T1_Decoder decoder, FT_UInt glyph_index, - FT_Data* char_string ) + FT_Data* char_string, + FT_Bool* force_scaling ) { T1_Face face = (T1_Face)decoder->builder.face; T1_Font type1 = &face->type1; @@ -99,7 +100,8 @@ if ( !error ) { /* choose which renderer to use */ - if ( driver->hinting_engine == FT_T1_HINTING_FREETYPE ) + if ( driver->hinting_engine == FT_T1_HINTING_FREETYPE || + decoder->builder.metrics_only ) error = decoder_funcs->parse_charstrings_old( decoder, (FT_Byte*)char_string->pointer, (FT_UInt)char_string->length ); @@ -117,7 +119,6 @@ (FT_Byte*)char_string->pointer, (FT_ULong)char_string->length ); -#if 0 /* TODO(ewaldhew) */ /* Adobe's engine uses 16.16 numbers everywhere; */ /* as a consequence, glyphs larger than 2000ppem get rejected */ if ( FT_ERR_EQ( error, Glyph_Too_Big ) ) @@ -125,15 +126,14 @@ /* this time, we retry unhinted and scale up the glyph later on */ /* (the engine uses and sets the hardcoded value 0x10000 / 64 = */ /* 0x400 for both `x_scale' and `y_scale' in this case) */ - hinting = FALSE; - force_scaling = TRUE; - glyph->hint = hinting; + ((T1_GlyphSlot)decoder->builder.glyph)->hint = FALSE; + + *force_scaling = TRUE; error = decoder_funcs->parse_charstrings( &psdecoder, (FT_Byte*)char_string->pointer, (FT_ULong)char_string->length ); } -#endif } } @@ -170,8 +170,10 @@ FT_UInt glyph_index ) { FT_Data glyph_data; + FT_Bool force_scaling = FALSE; FT_Error error = T1_Parse_Glyph_And_Get_Char_String( - decoder, glyph_index, &glyph_data ); + decoder, glyph_index, &glyph_data, + &force_scaling ); #ifdef FT_CONFIG_OPTION_INCREMENTAL @@ -322,6 +324,8 @@ T1_DecoderRec decoder; T1_Face face = (T1_Face)t1glyph->face; FT_Bool hinting; + FT_Bool scaled; + FT_Bool force_scaling = FALSE; T1_Font type1 = &face->type1; PSAux_Service psaux = (PSAux_Service)face->psaux; const T1_Decoder_Funcs decoder_funcs = psaux->t1_decoder_funcs; @@ -369,7 +373,10 @@ hinting = FT_BOOL( ( load_flags & FT_LOAD_NO_SCALE ) == 0 && ( load_flags & FT_LOAD_NO_HINTING ) == 0 ); + scaled = FT_BOOL( ( load_flags & FT_LOAD_NO_SCALE ) == 0 ); + glyph->hint = hinting; + glyph->scaled = scaled; t1glyph->format = FT_GLYPH_FORMAT_OUTLINE; error = decoder_funcs->init( &decoder, @@ -399,13 +406,15 @@ /* now load the unscaled outline */ error = T1_Parse_Glyph_And_Get_Char_String( &decoder, glyph_index, - &glyph_data ); + &glyph_data, + &force_scaling ); if ( error ) goto Exit; #ifdef FT_CONFIG_OPTION_INCREMENTAL glyph_data_loaded = 1; #endif + hinting = glyph->hint; font_matrix = decoder.font_matrix; font_offset = decoder.font_offset; @@ -495,7 +504,7 @@ } #endif - if ( ( load_flags & FT_LOAD_NO_SCALE ) == 0 ) + if ( ( load_flags & FT_LOAD_NO_SCALE ) == 0 || force_scaling ) { /* scale the outline and the metrics */ FT_Int n; From 37ed70f628c2e5a934e8347c7bfaf730a2a51c81 Mon Sep 17 00:00:00 2001 From: Ewald Hew Date: Mon, 25 Sep 2017 06:59:26 +0200 Subject: [PATCH 268/470] Add Type 1 operations to Adobe CFF interpreter. The following Type 1 specific ops have been added (copied from `t1decode'): closepath vstem3 hstem3 seac sbw callothersubr pop setcurrentpoint hsbw The following require a Type 1 mode, because of differences in specification: hstem vstem vmoveto callsubr div rmoveto hmoveto Numbers The subsequent commits will implement these changes and adapt accesses of data and objects to the new interpreter. NOTE: Will not compile in the meantime! * src/psaux/psintrp.c: Add opcodes to enum. (cf2_interpT2CharString): Copy relevant code over from `t1_decoder_parse_charstrings' (in `t1decode.c'). --- ChangeLog | 38 ++++++ src/psaux/psintrp.c | 284 ++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 300 insertions(+), 22 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5615f6248..df034e61f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,41 @@ +2017-09-25 Ewald Hew + + [psaux] Add Type 1 operations to Adobe CFF interpreter. + + The following Type 1 specific ops have been added (copied from + `t1decode'): + + closepath + vstem3 + hstem3 + seac + sbw + callothersubr + pop + setcurrentpoint + hsbw + + The following require a Type 1 mode, because of differences in + specification: + + hstem + vstem + vmoveto + callsubr + div + rmoveto + hmoveto + Numbers + + The subsequent commits will implement these changes and adapt + accesses of data and objects to the new interpreter. + + NOTE: Will not compile in the meantime! + + * src/psaux/psintrp.c: Add opcodes to enum. + (cf2_interpT2CharString): Copy relevant code over from + `t1_decoder_parse_charstrings' (in `t1decode.c'). + 2017-09-25 Ewald Hew [type1] Fixes for rendering. diff --git a/src/psaux/psintrp.c b/src/psaux/psintrp.c index d342d6ae4..133c3bcaa 100644 --- a/src/psaux/psintrp.c +++ b/src/psaux/psintrp.c @@ -205,11 +205,11 @@ cf2_cmdHLINETO, /* 6 */ cf2_cmdVLINETO, /* 7 */ cf2_cmdRRCURVETO, /* 8 */ - cf2_cmdRESERVED_9, /* 9 */ + cf2_cmdCLOSEPATH, /* 9 T1 only */ cf2_cmdCALLSUBR, /* 10 */ cf2_cmdRETURN, /* 11 */ cf2_cmdESC, /* 12 */ - cf2_cmdRESERVED_13, /* 13 */ + cf2_cmdHSBW, /* 13 T1 only */ cf2_cmdENDCHAR, /* 14 */ cf2_cmdVSINDEX, /* 15 */ cf2_cmdBLEND, /* 16 */ @@ -233,13 +233,13 @@ enum { cf2_escDOTSECTION, /* 0 */ - cf2_escRESERVED_1, /* 1 */ - cf2_escRESERVED_2, /* 2 */ + cf2_escVSTEM3, /* 1 T1 only */ + cf2_escHSTEM3, /* 2 T1 only */ cf2_escAND, /* 3 */ cf2_escOR, /* 4 */ cf2_escNOT, /* 5 */ - cf2_escRESERVED_6, /* 6 */ - cf2_escRESERVED_7, /* 7 */ + cf2_escSEAC, /* 6 T1 only */ + cf2_escSBW, /* 7 T1 only */ cf2_escRESERVED_8, /* 8 */ cf2_escABS, /* 9 */ cf2_escADD, /* 10 like otherADD */ @@ -248,8 +248,8 @@ cf2_escRESERVED_13, /* 13 */ cf2_escNEG, /* 14 */ cf2_escEQ, /* 15 */ - cf2_escRESERVED_16, /* 16 */ - cf2_escRESERVED_17, /* 17 */ + cf2_escCALLOTHERSUBR,/* 16 T1 only */ + cf2_escPOP, /* 17 T1 only */ cf2_escDROP, /* 18 */ cf2_escRESERVED_19, /* 19 */ cf2_escPUT, /* 20 like otherPUT */ @@ -265,7 +265,7 @@ cf2_escROLL, /* 30 */ cf2_escRESERVED_31, /* 31 */ cf2_escRESERVED_32, /* 32 */ - cf2_escRESERVED_33, /* 33 */ + cf2_escSETCURRENTPT, /* 33 T1 only */ cf2_escHFLEX, /* 34 */ cf2_escFLEX, /* 35 */ cf2_escHFLEX1, /* 36 */ @@ -484,6 +484,12 @@ CF2_Fixed scaleY = font->innerTransform.d; CF2_Fixed nominalWidthX = cf2_getNominalWidthX( decoder ); + /* Stuff for Type 1 */ + FT_Pos orig_x, orig_y; + FT_Int known_othersubr_result_cnt = 0; + FT_Int unknown_othersubr_result_cnt = 0; + FT_Bool large_int; + /* save this for hinting seac accents */ CF2_Fixed hintOriginY = curY; @@ -606,6 +612,12 @@ /* main interpreter loop */ while ( 1 ) { + if ( font->isT1 ) + { + FT_ASSERT( known_othersubr_result_cnt == 0 || + unknown_othersubr_result_cnt == 0 ); + } + if ( cf2_buf_isEnd( charstring ) ) { /* If we've reached the end of the charstring, simulate a */ @@ -627,6 +639,27 @@ op1 = cf2_cmdRESERVED_0; } + if ( font->isT1 ) + { + if ( unknown_othersubr_result_cnt > 0 && + !( op1 == cf2_cmdCALLSUBR || + op1 == cf2_cmdRETURN || + op1 == cf2_escPOP || + op1 >= 32 /* Numbers */ ) ) + { + /* all operands have been transferred by previous pops */ + unknown_othersubr_result_cnt = 0; + } + + if ( large_int && !( op1 >= 32 || op1 == cf2_escDIV ) ) + { + FT_ERROR(( "cf2_interpT2CharString (Type 1 mode):" + " no `div' after large integer\n" )); + + large_int = FALSE; + } + } + /* check for errors once per loop */ if ( *error ) goto exit; @@ -642,8 +675,6 @@ { case cf2_cmdRESERVED_0: case cf2_cmdRESERVED_2: - case cf2_cmdRESERVED_9: - case cf2_cmdRESERVED_13: case cf2_cmdRESERVED_17: /* we may get here if we have a prior error */ FT_TRACE4(( " unknown op (%d)\n", op1 )); @@ -777,6 +808,13 @@ if ( font->decoder->width_only ) goto exit; + if ( font->isT1 && !decoder->flex_state ) + { + if ( builder->parse_state == T1_Parse_Start ) + goto Syntax_Error; + builder->parse_state = T1_Parse_Have_Moveto; + } + curY = ADD_INT32( curY, cf2_stack_popFixed( opStack ) ); cf2_glyphpath_moveTo( &glyphPath, curX, curY ); @@ -878,6 +916,24 @@ } continue; /* no need to clear stack again */ + case cf2_cmdCLOSEPATH: + if ( !font->isT1 ) + { + FT_TRACE4(( " unknown op (%d)\n", op1 )); + } + else + { + FT_TRACE4(( " closepath" )); + + /* if there is no path, `closepath' is a no-op */ + if ( builder->parse_state == T1_Parse_Have_Path || + builder->parse_state == T1_Parse_Have_Moveto ) + t1_builder_close_contour( builder ); + + builder->parse_state = T1_Parse_Have_Width; + } + break; + case cf2_cmdCALLGSUBR: case cf2_cmdCALLSUBR: { @@ -903,6 +959,17 @@ /* set up the new CFF region and pointer */ subrNum = cf2_stack_popInt( opStack ); + if ( font->isT1 && decoder->subrs_hash ) + { + size_t* val = ft_hash_num_lookup( subrNum, + decoder->subrs_hash ); + + if ( val ) + subrNum = *val; + else + subrNum = -1; + } + switch ( op1 ) { case cf2_cmdCALLGSUBR: @@ -1060,20 +1127,13 @@ } continue; - /* these opcodes are reserved in both CFF & CFF2 */ - case cf2_escRESERVED_1: - case cf2_escRESERVED_2: - case cf2_escRESERVED_6: - case cf2_escRESERVED_7: + /* these opcodes are always reserved */ case cf2_escRESERVED_8: case cf2_escRESERVED_13: - case cf2_escRESERVED_16: - case cf2_escRESERVED_17: case cf2_escRESERVED_19: case cf2_escRESERVED_25: case cf2_escRESERVED_31: case cf2_escRESERVED_32: - case cf2_escRESERVED_33: FT_TRACE4(( " unknown op (12, %d)\n", op2 )); break; @@ -1083,7 +1143,7 @@ FT_TRACE4(( " unknown op (12, %d)\n", op2 )); else { - /* second switch for 2-byte operators handles just CFF */ + /* second switch for 2-byte operators handles CFF and Type 1 */ switch ( op2 ) { @@ -1093,6 +1153,22 @@ break; + case cf2_escVSTEM3: + if ( !font->isT1 ) + FT_TRACE4(( " unknown op (12, %d)\n", op2 )); + else + { + } + break; + + case cf2_escHSTEM3: + if ( !font->isT1 ) + FT_TRACE4(( " unknown op (12, %d)\n", op2 )); + else + { + } + break; + case cf2_escAND: { CF2_F16Dot16 arg1; @@ -1136,6 +1212,52 @@ } continue; /* do not clear the stack */ + case cf2_escSEAC: + { + if ( !font->isT1 ) + FT_TRACE4(( " unknown op (12, %d)\n", op2 )); + else + { + return t1operator_seac( decoder, + top[0], + top[1], + top[2], + Fix2Int( top[3] ), + Fix2Int( top[4] ) ); + } + } + break; + + case cf2_escSBW: + { + if ( !font->isT1 ) + FT_TRACE4(( " unknown op (12, %d)\n", op2 )); + else + { + FT_TRACE4(( " sbw" )); + + builder->parse_state = T1_Parse_Have_Width; + + builder->left_bearing.x = ADD_LONG( builder->left_bearing.x, + top[0] ); + builder->left_bearing.y = ADD_LONG( builder->left_bearing.y, + top[1] ); + + builder->advance.x = top[2]; + builder->advance.y = top[3]; + + x = ADD_LONG( builder->pos_x, top[0] ); + y = ADD_LONG( builder->pos_y, top[1] ); + + /* the `metrics_only' indicates that we only want to compute */ + /* the glyph's metrics (lsb + advance width), not load the */ + /* rest of it; so exit immediately */ + if ( builder->metrics_only ) + return FT_Err_Ok; + } + } + break; + case cf2_escABS: { CF2_F16Dot16 arg; @@ -1198,6 +1320,9 @@ cf2_stack_pushFixed( opStack, FT_DivFix( dividend, divisor ) ); + + if ( font->isT1 ) + large_int = FALSE; } continue; /* do not clear the stack */ @@ -1232,6 +1357,40 @@ } continue; /* do not clear the stack */ + case cf2_escCALLOTHERSUBR: + if ( !font->isT1 ) + FT_TRACE4(( " unknown op (12, %d)\n", op2 )); + else + { + } + break; + + case cf2_escPOP: + if ( !font->isT1 ) + FT_TRACE4(( " unknown op (12, %d)\n", op2 )); + else + { + FT_TRACE4(( " pop" )); + + if ( known_othersubr_result_cnt > 0 ) + { + known_othersubr_result_cnt--; + /* ignore, we pushed the operands ourselves */ + break; + } + + if ( unknown_othersubr_result_cnt == 0 ) + { + FT_ERROR(( "cf2_interpT2CharString (Type 1 mode):" + " no more operands for othersubr\n" )); + goto Syntax_Error; + } + + unknown_othersubr_result_cnt--; + top++; /* `push' the operand to callothersubr onto the stack */ + } + break; + case cf2_escDROP: FT_TRACE4(( " drop\n" )); @@ -1433,6 +1592,43 @@ } continue; /* do not clear the stack */ + case cf2_escSETCURRENTPT: + if ( !font->isT1 ) + FT_TRACE4(( " unknown op (12, %d)\n", op2 )); + else + { + FT_TRACE4(( " setcurrentpoint" )); + + /* 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. */ + + /* 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:" + " unexpected `setcurrentpoint'\n" )); + goto Syntax_Error; + } + else + ... +#endif + + x = top[0]; + y = top[1]; + decoder->flex_state = 0; + } + break; + } /* end of 2nd switch checking op2 */ } } @@ -1441,6 +1637,36 @@ break; + case cf2_cmdHSBW: + if ( !font->isT1 ) + { + FT_TRACE4(( " unknown op (%d)\n", op1 )); + } + else + { + FT_TRACE4(( " hsbw" )); + + builder->parse_state = T1_Parse_Have_Width; + + builder->left_bearing.x = ADD_LONG( builder->left_bearing.x, + top[0] ); + + builder->advance.x = top[1]; + builder->advance.y = 0; + + orig_x = x = ADD_LONG( builder->pos_x, top[0] ); + orig_y = y = builder->pos_y; + + FT_UNUSED( orig_y ); + + /* the `metrics_only' indicates that we only want to compute */ + /* the glyph's metrics (lsb + advance width), not load the */ + /* rest of it; so exit immediately */ + if ( builder->metrics_only ) + return FT_Err_Ok; + } + break; + case cf2_cmdENDCHAR: FT_TRACE4(( " endchar\n" )); @@ -1461,8 +1687,8 @@ /* close path if still open */ cf2_glyphpath_closeOpenPath( &glyphPath ); - /* disable seac for CFF2 (charstring ending with args on stack) */ - if ( !font->isCFF2 && cf2_stack_count( opStack ) > 1 ) + /* disable seac for CFF2 and Type1 (charstring ending with args on stack) */ + if ( !font->isCFF2 && !font->isT1 && cf2_stack_count( opStack ) > 1 ) { /* must be either 4 or 5 -- */ /* this is a (deprecated) implied `seac' operator */ @@ -1606,6 +1832,13 @@ if ( font->decoder->width_only ) goto exit; + if ( font->isT1 && !decoder->flex_state ) + { + if ( builder->parse_state == T1_Parse_Start ) + goto Syntax_Error; + builder->parse_state = T1_Parse_Have_Moveto; + } + curY = ADD_INT32( curY, cf2_stack_popFixed( opStack ) ); curX = ADD_INT32( curX, cf2_stack_popFixed( opStack ) ); @@ -1626,6 +1859,13 @@ if ( font->decoder->width_only ) goto exit; + if ( font->isT1 && !decoder->flex_state ) + { + if ( builder->parse_state == T1_Parse_Start ) + goto Syntax_Error; + builder->parse_state = T1_Parse_Have_Moveto; + } + curX = ADD_INT32( curX, cf2_stack_popFixed( opStack ) ); cf2_glyphpath_moveTo( &glyphPath, curX, curY ); From 4ed1b98dbd5526090d4c302a6d9b93a70469c5a1 Mon Sep 17 00:00:00 2001 From: Ewald Hew Date: Mon, 25 Sep 2017 07:02:53 +0200 Subject: [PATCH 269/470] Extend Adobe interpreter (closepath). * src/psaux/psintrp.c (cf2_interpT2CharString) : Use the right builder function. We can use the `haveWidth' boolean already present, instead of implementing `parse_state'. --- ChangeLog | 8 ++++++++ src/psaux/psintrp.c | 6 ++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index df034e61f..2d5341798 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2017-09-25 Ewald Hew + + [psaux] Extend Adobe interpreter (`closepath'). + + * src/psaux/psintrp.c (cf2_interpT2CharString) : + Use the right builder function. We can use the `haveWidth' boolean + already present, instead of implementing `parse_state'. + 2017-09-25 Ewald Hew [psaux] Add Type 1 operations to Adobe CFF interpreter. diff --git a/src/psaux/psintrp.c b/src/psaux/psintrp.c index 133c3bcaa..7132ae8be 100644 --- a/src/psaux/psintrp.c +++ b/src/psaux/psintrp.c @@ -926,11 +926,9 @@ FT_TRACE4(( " closepath" )); /* if there is no path, `closepath' is a no-op */ - if ( builder->parse_state == T1_Parse_Have_Path || - builder->parse_state == T1_Parse_Have_Moveto ) - t1_builder_close_contour( builder ); + ps_builder_close_contour( &decoder->builder ); - builder->parse_state = T1_Parse_Have_Width; + haveWidth = TRUE; } break; From 2f4abaec38c11a16c2af06597b37c94d14878eda Mon Sep 17 00:00:00 2001 From: Ewald Hew Date: Mon, 25 Sep 2017 07:04:43 +0200 Subject: [PATCH 270/470] Extend Adobe interpreter (setcurrentpoint). * src/psaux/psintrp.c (cf2_interpT2CharString) : Fix stack access. --- ChangeLog | 7 +++++++ src/psaux/psintrp.c | 5 +++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2d5341798..a4ffa0215 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2017-09-25 Ewald Hew + + [psaux] Extend Adobe interpreter (setcurrentpoint). + + * src/psaux/psintrp.c (cf2_interpT2CharString) + : Fix stack access. + 2017-09-25 Ewald Hew [psaux] Extend Adobe interpreter (`closepath'). diff --git a/src/psaux/psintrp.c b/src/psaux/psintrp.c index 7132ae8be..5e01c0cbb 100644 --- a/src/psaux/psintrp.c +++ b/src/psaux/psintrp.c @@ -1621,8 +1621,9 @@ ... #endif - x = top[0]; - y = top[1]; + curY = cf2_stack_popFixed( opStack ); + curX = cf2_stack_popFixed( opStack ); + decoder->flex_state = 0; } break; From e180afa95177a38832a1e04a06f4aa2de886c5d0 Mon Sep 17 00:00:00 2001 From: Ewald Hew Date: Mon, 25 Sep 2017 07:11:03 +0200 Subject: [PATCH 271/470] Extend Adobe interpreter (hsbw, sbw). * src/psaux/psintrp.c (cf2_doStems): `hsbw' or `sbw' must be the first operation in a Type 1 charstring. (cf2_interpT2CharString): Remove unused variables. : `hsbw' or `sbw' must be the first operation in a Type 1 charstring. : Fix data access and add correction for left sidebearing. --- ChangeLog | 12 ++++++ src/psaux/psintrp.c | 100 +++++++++++++++++++++++++------------------- 2 files changed, 69 insertions(+), 43 deletions(-) diff --git a/ChangeLog b/ChangeLog index a4ffa0215..ce036b1ef 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2017-09-25 Ewald Hew + + [psaux] Extend Adobe interpreter (hsbw, sbw). + + * src/psaux/psintrp.c (cf2_doStems): `hsbw' or `sbw' must be the + first operation in a Type 1 charstring. + (cf2_interpT2CharString): Remove unused variables. + : `hsbw' or `sbw' + must be the first operation in a Type 1 charstring. + : Fix data access and add correction for + left sidebearing. + 2017-09-25 Ewald Hew [psaux] Extend Adobe interpreter (setcurrentpoint). diff --git a/src/psaux/psintrp.c b/src/psaux/psintrp.c index 5e01c0cbb..53eca9c2f 100644 --- a/src/psaux/psintrp.c +++ b/src/psaux/psintrp.c @@ -290,8 +290,12 @@ /* variable accumulates delta values from operand stack */ CF2_Fixed position = hintOffset; - - if ( hasWidthArg && !*haveWidth ) + if ( font->isT1 && !font->decoder->flex_state && !*haveWidth ) + { + FT_ERROR(( "cf2_doStems (Type 1 mode):" + " No width. Use hsbw/sbw as first op\n" )); + } + if ( !font->isT1 && hasWidthArg && !*haveWidth ) *width = cf2_stack_getReal( opStack, 0 ) + cf2_getNominalWidthX( font->decoder ); @@ -485,7 +489,6 @@ CF2_Fixed nominalWidthX = cf2_getNominalWidthX( decoder ); /* Stuff for Type 1 */ - FT_Pos orig_x, orig_y; FT_Int known_othersubr_result_cnt = 0; FT_Int unknown_othersubr_result_cnt = 0; FT_Bool large_int; @@ -798,6 +801,12 @@ case cf2_cmdVMOVETO: FT_TRACE4(( " vmoveto\n" )); + if ( font->isT1 && !decoder->flex_state && !haveWidth ) + { + FT_ERROR(( "cf2_interpT2CharString (Type 1 mode):" + " No width. Use hsbw/sbw as first op\n" )); + } + if ( cf2_stack_count( opStack ) > 1 && !haveWidth ) *width = ADD_INT32( cf2_stack_getReal( opStack, 0 ), nominalWidthX ); @@ -808,13 +817,6 @@ if ( font->decoder->width_only ) goto exit; - if ( font->isT1 && !decoder->flex_state ) - { - if ( builder->parse_state == T1_Parse_Start ) - goto Syntax_Error; - builder->parse_state = T1_Parse_Have_Moveto; - } - curY = ADD_INT32( curY, cf2_stack_popFixed( opStack ) ); cf2_glyphpath_moveTo( &glyphPath, curX, curY ); @@ -1232,26 +1234,35 @@ FT_TRACE4(( " unknown op (12, %d)\n", op2 )); else { + CF2_Fixed lsb_x, lsb_y; + PS_Builder* builder; + + FT_TRACE4(( " sbw" )); - builder->parse_state = T1_Parse_Have_Width; + builder = &decoder->builder; - builder->left_bearing.x = ADD_LONG( builder->left_bearing.x, - top[0] ); - builder->left_bearing.y = ADD_LONG( builder->left_bearing.y, - top[1] ); + builder->advance->y = cf2_stack_popFixed( opStack ); + builder->advance->x = cf2_stack_popFixed( opStack ); - builder->advance.x = top[2]; - builder->advance.y = top[3]; + lsb_y = cf2_stack_popFixed( opStack ); + lsb_x = cf2_stack_popFixed( opStack ); - x = ADD_LONG( builder->pos_x, top[0] ); - y = ADD_LONG( builder->pos_y, top[1] ); + builder->left_bearing->x = ADD_INT32( builder->left_bearing->x, + lsb_x ); + builder->left_bearing->y = ADD_INT32( builder->left_bearing->y, + lsb_y ); + + haveWidth = TRUE; /* the `metrics_only' indicates that we only want to compute */ /* the glyph's metrics (lsb + advance width), not load the */ /* rest of it; so exit immediately */ if ( builder->metrics_only ) - return FT_Err_Ok; + goto exit; + + curX = ADD_INT32( curX, lsb_x ); + curY = ADD_INT32( curY, lsb_y ); } } break; @@ -1643,26 +1654,31 @@ } else { + CF2_Fixed lsb_x; + PS_Builder* builder; + + FT_TRACE4(( " hsbw" )); - builder->parse_state = T1_Parse_Have_Width; + builder = &decoder->builder; - builder->left_bearing.x = ADD_LONG( builder->left_bearing.x, - top[0] ); + builder->advance->x = cf2_stack_popFixed( opStack ); + builder->advance->y = 0; - builder->advance.x = top[1]; - builder->advance.y = 0; + lsb_x = cf2_stack_popFixed( opStack ); - orig_x = x = ADD_LONG( builder->pos_x, top[0] ); - orig_y = y = builder->pos_y; + builder->left_bearing->x = ADD_INT32( builder->left_bearing->x, + lsb_x ); - FT_UNUSED( orig_y ); + haveWidth = TRUE; /* the `metrics_only' indicates that we only want to compute */ /* the glyph's metrics (lsb + advance width), not load the */ /* rest of it; so exit immediately */ if ( builder->metrics_only ) - return FT_Err_Ok; + goto exit; + + curX = ADD_INT32( curX, lsb_x ); } break; @@ -1821,6 +1837,12 @@ case cf2_cmdRMOVETO: FT_TRACE4(( " rmoveto\n" )); + if ( font->isT1 && !decoder->flex_state && !haveWidth ) + { + FT_ERROR(( "cf2_interpT2CharString (Type 1 mode):" + " No width. Use hsbw/sbw as first op\n" )); + } + if ( cf2_stack_count( opStack ) > 2 && !haveWidth ) *width = ADD_INT32( cf2_stack_getReal( opStack, 0 ), nominalWidthX ); @@ -1831,13 +1853,6 @@ if ( font->decoder->width_only ) goto exit; - if ( font->isT1 && !decoder->flex_state ) - { - if ( builder->parse_state == T1_Parse_Start ) - goto Syntax_Error; - builder->parse_state = T1_Parse_Have_Moveto; - } - curY = ADD_INT32( curY, cf2_stack_popFixed( opStack ) ); curX = ADD_INT32( curX, cf2_stack_popFixed( opStack ) ); @@ -1848,6 +1863,12 @@ case cf2_cmdHMOVETO: FT_TRACE4(( " hmoveto\n" )); + if ( font->isT1 && !decoder->flex_state && !haveWidth ) + { + FT_ERROR(( "cf2_interpT2CharString (Type 1 mode):" + " No width. Use hsbw/sbw as first op\n" )); + } + if ( cf2_stack_count( opStack ) > 1 && !haveWidth ) *width = ADD_INT32( cf2_stack_getReal( opStack, 0 ), nominalWidthX ); @@ -1858,13 +1879,6 @@ if ( font->decoder->width_only ) goto exit; - if ( font->isT1 && !decoder->flex_state ) - { - if ( builder->parse_state == T1_Parse_Start ) - goto Syntax_Error; - builder->parse_state = T1_Parse_Have_Moveto; - } - curX = ADD_INT32( curX, cf2_stack_popFixed( opStack ) ); cf2_glyphpath_moveTo( &glyphPath, curX, curY ); From 81b86c459c5324bf52babd9b31af28e5e65f10e1 Mon Sep 17 00:00:00 2001 From: Ewald Hew Date: Mon, 25 Sep 2017 07:14:18 +0200 Subject: [PATCH 272/470] Extend Adobe interpreter (hstem, vstem, hstem3, vstem3). * src/psaux/psintrp.c (cf2_interpT2CharString) : Add correction for left sidebearing in Type 1 mode. Allow adding hints mid-charstring. : Translate into equivalent commands for three normal stem hints. This requires some recalculation of stem positions. Correction for left sidebearing. --- ChangeLog | 12 +++++ src/psaux/psintrp.c | 105 +++++++++++++++++++++++++++++++++++--------- 2 files changed, 97 insertions(+), 20 deletions(-) diff --git a/ChangeLog b/ChangeLog index ce036b1ef..588c13497 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2017-09-25 Ewald Hew + + Extend Adobe interpreter (hints). + + * src/psaux/psintrp.c (cf2_interpT2CharString) : Add correction for left sidebearing in Type 1 mode. + Allow adding hints mid-charstring. + : Translate into equivalent commands + for three normal stem hints. This requires some recalculation of + stem positions. + Correction for left sidebearing. + 2017-09-25 Ewald Hew [psaux] Extend Adobe interpreter (hsbw, sbw). diff --git a/src/psaux/psintrp.c b/src/psaux/psintrp.c index 53eca9c2f..4132931ff 100644 --- a/src/psaux/psintrp.c +++ b/src/psaux/psintrp.c @@ -754,12 +754,28 @@ case cf2_cmdHSTEM: FT_TRACE4(( op1 == cf2_cmdHSTEMHM ? " hstemhm\n" : " hstem\n" )); - /* never add hints after the mask is computed */ - if ( cf2_hintmask_isValid( &hintMask ) ) + if ( !font->isT1 ) { - FT_TRACE4(( "cf2_interpT2CharString:" - " invalid horizontal hint mask\n" )); - break; + /* never add hints after the mask is computed */ + /* except if in Type 1 mode (no hintmask op) */ + if ( cf2_hintmask_isValid( &hintMask ) ) + { + FT_TRACE4(( "cf2_interpT2CharString:" + " invalid horizontal hint mask\n" )); + break; + } + } + else + { + /* Do lsb correction */ + CF2_F16Dot16 hint_pos; + + FT_ASSERT( ( cf2_stack_count( opStack ) == 2 ) ); + + hint_pos = ADD_INT32( cf2_stack_getReal( opStack, 0 ), + decoder->builder.left_bearing->y ); + + cf2_stack_setReal( opStack, 0, hint_pos ); } cf2_doStems( font, @@ -778,12 +794,28 @@ case cf2_cmdVSTEM: FT_TRACE4(( op1 == cf2_cmdVSTEMHM ? " vstemhm\n" : " vstem\n" )); - /* never add hints after the mask is computed */ - if ( cf2_hintmask_isValid( &hintMask ) ) + if ( !font->isT1 ) { - FT_TRACE4(( "cf2_interpT2CharString:" - " invalid vertical hint mask\n" )); - break; + /* never add hints after the mask is computed */ + /* except if in Type 1 mode (no hintmask op) */ + if ( cf2_hintmask_isValid( &hintMask ) ) + { + FT_TRACE4(( "cf2_interpT2CharString:" + " invalid vertical hint mask\n" )); + break; + } + } + else + { + /* Do lsb correction */ + CF2_F16Dot16 hint_pos; + + FT_ASSERT( ( cf2_stack_count( opStack ) == 2 ) ); + + hint_pos = ADD_INT32( cf2_stack_getReal( opStack, 0 ), + decoder->builder.left_bearing->x ); + + cf2_stack_setReal( opStack, 0, hint_pos ); } cf2_doStems( font, @@ -1154,18 +1186,51 @@ break; case cf2_escVSTEM3: - if ( !font->isT1 ) - FT_TRACE4(( " unknown op (12, %d)\n", op2 )); - else - { - } - break; - case cf2_escHSTEM3: - if ( !font->isT1 ) - FT_TRACE4(( " unknown op (12, %d)\n", op2 )); - else + /* Type 1: */ /* Type 2: */ + /* x0 dx0 x1 dx1 x2 dx2 vstem3 */ /* x dx {dxa dxb}* vstem */ + /* y0 dy0 y1 dy1 y2 dy2 hstem3 */ /* y dy {dya dyb}* hstem */ + /* relative to lsb point */ /* relative to zero */ { + if ( !font->isT1 ) + FT_TRACE4(( " unknown op (12, %d)\n", op2 )); + else + { + CF2_F16Dot16 v0, v1, v2; + CF2_F16Dot16 lsb; + + FT_TRACE4(( op2 == cf2_escVSTEM3 ? " vstem3\n" + : " hstem3\n" )); + + FT_ASSERT( ( cf2_stack_count( opStack ) == 6 ) ); + + lsb = ( op2 == cf2_escVSTEM3 ? decoder->builder.left_bearing->x + : decoder->builder.left_bearing->y ); + + v0 = cf2_stack_getReal( opStack, 0 ); + v1 = cf2_stack_getReal( opStack, 2 ); + v2 = cf2_stack_getReal( opStack, 4 ); + + cf2_stack_setReal( opStack, 0, + ADD_INT32( v0, + lsb ) ); + cf2_stack_setReal( opStack, 2, + SUB_INT32( SUB_INT32( v1, v0 ), + cf2_stack_getReal( opStack, 1 ) ) ); + cf2_stack_setReal( opStack, 4, + SUB_INT32( SUB_INT32( v2, v1 ), + cf2_stack_getReal( opStack, 3 ) ) ); + + cf2_doStems( font, + opStack, + op2 == cf2_escVSTEM3 ? &vStemHintArray : &hStemHintArray, + width, + &haveWidth, + 0 ); + + if ( decoder->width_only ) + goto exit; + } } break; From 4b58c518c9dd16880b337e0d99456b9ae82f2012 Mon Sep 17 00:00:00 2001 From: Ewald Hew Date: Mon, 25 Sep 2017 07:44:56 +0200 Subject: [PATCH 273/470] Extend Adobe interpreter (div, four-byte numbers). * src/psaux/psintrp.c (cf2_interpT2CharString) : Add Type 1 mode. Type 1 requires large integers to be followed by `div'; cf. `Adobe Type 1 Font Format', section 6.2. : Push Type 1 four-byte numbers as `Int' always. This is to ensure `div' and `callsubr' get values they can use. --- ChangeLog | 10 +++++++++ src/psaux/psintrp.c | 53 +++++++++++++++++++++++++++++++++++++++------ 2 files changed, 56 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 588c13497..4641f1ddf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2017-09-25 Ewald Hew + + [psaux] Extend Adobe interpreter (div, four-byte numbers). + + * src/psaux/psintrp.c (cf2_interpT2CharString) : Add + Type 1 mode. Type 1 requires large integers to be followed by + `div'; cf. `Adobe Type 1 Font Format', section 6.2. + : Push Type 1 four-byte numbers as `Int' always. This is + to ensure `div' and `callsubr' get values they can use. + 2017-09-25 Ewald Hew Extend Adobe interpreter (hints). diff --git a/src/psaux/psintrp.c b/src/psaux/psintrp.c index 4132931ff..34607ca43 100644 --- a/src/psaux/psintrp.c +++ b/src/psaux/psintrp.c @@ -491,7 +491,7 @@ /* Stuff for Type 1 */ FT_Int known_othersubr_result_cnt = 0; FT_Int unknown_othersubr_result_cnt = 0; - FT_Bool large_int; + FT_Bool large_int = FALSE; /* save this for hinting seac accents */ CF2_Fixed hintOriginY = curY; @@ -1389,14 +1389,22 @@ FT_TRACE4(( " div\n" )); - divisor = cf2_stack_popFixed( opStack ); - dividend = cf2_stack_popFixed( opStack ); + if ( font->isT1 && large_int ) + { + divisor = (CF2_F16Dot16)cf2_stack_popInt( opStack ); + dividend = (CF2_F16Dot16)cf2_stack_popInt( opStack ); + + large_int = FALSE; + } + else + { + divisor = cf2_stack_popFixed( opStack ); + dividend = cf2_stack_popFixed( opStack ); + } cf2_stack_pushFixed( opStack, FT_DivFix( dividend, divisor ) ); - if ( font->isT1 ) - large_int = FALSE; } continue; /* do not clear the stack */ @@ -2237,9 +2245,40 @@ ( byte3 << 8 ) | byte4 ); - FT_TRACE4(( " %.5f", v / 65536.0 )); + /* For Type 1: */ + /* According to the specification, values > 32000 or < -32000 must */ + /* be followed by a `div' operator to make the result be in the */ + /* range [-32000;32000]. We expect that the second argument of */ + /* `div' is not a large number. Additionally, we don't handle */ + /* stuff like ` div div' or */ + /* div div'. This is probably not allowed */ + /* anyway. */ + /* + div is not checked but should not be */ + /* allowed as the large value remains untouched. */ + if ( font->isT1 ) + { + if ( v > 32000 || v < -32000 ) + { + if ( large_int ) + { + FT_ERROR(( "cf2_interpT2CharString (Type 1 mode):" + " no `div' after large integer\n" )); + } + else + large_int = TRUE; + } + + FT_TRACE4(( " %d", v )); + + cf2_stack_pushInt( opStack, (CF2_Int)v ); + } + else + { + FT_TRACE4(( " %.5fF", v / 65536.0 )); + + cf2_stack_pushFixed( opStack, v ); + } - cf2_stack_pushFixed( opStack, v ); } } continue; /* don't clear stack */ From 1e4d3dc8eaeffcc1b298304ae2dcfc05e8e44850 Mon Sep 17 00:00:00 2001 From: Ewald Hew Date: Mon, 25 Sep 2017 07:47:10 +0200 Subject: [PATCH 274/470] Extend Adobe interpreter (callsubr). * src/psaux/psintrp.c (cf2_interpT2CharString) : Type 1 mode. * src/psaux/psft.c (cf2_initLocalRegionBuffer): Add Type 1 mode. --- ChangeLog | 9 +++++++++ src/psaux/psft.c | 34 ++++++++++++++++++++++++++++++---- src/psaux/psintrp.c | 7 ++++--- 3 files changed, 43 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4641f1ddf..1e9c97220 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2017-09-25 Ewald Hew + + [psaux] Extend Adobe interpreter (callsubr). + + * src/psaux/psintrp.c (cf2_interpT2CharString) : + Type 1 mode. + + * src/psaux/psft.c (cf2_initLocalRegionBuffer): Add Type 1 mode. + 2017-09-25 Ewald Hew [psaux] Extend Adobe interpreter (div, four-byte numbers). diff --git a/src/psaux/psft.c b/src/psaux/psft.c index ab1982663..81d3fd835 100644 --- a/src/psaux/psft.c +++ b/src/psaux/psft.c @@ -718,14 +718,40 @@ FT_ZERO( buf ); idx = (CF2_UInt)( subrNum + decoder->locals_bias ); - if ( idx >= decoder->num_locals ) + if ( idx < 0 || idx >= decoder->num_locals ) return TRUE; /* error */ FT_ASSERT( decoder->locals ); - buf->start = - buf->ptr = decoder->locals[idx]; - buf->end = decoder->locals[idx + 1]; + buf->start = decoder->locals[idx]; + + if ( decoder->builder.is_t1 ) + { + /* The Type 1 driver stores subroutines without the seed bytes. */ + /* The CID driver stores subroutines with seed bytes. This */ + /* case is taken care of when decoder->subrs_len == 0. */ + if ( decoder->locals_len ) + buf->end = buf->start + decoder->locals_len[idx]; + else + { + /* We are using subroutines from a CID font. We must adjust */ + /* for the seed bytes. */ + buf->start += ( decoder->lenIV >= 0 ? decoder->lenIV : 0 ); + buf->end = decoder->locals[idx + 1]; + } + + if ( !buf->start ) + { + FT_ERROR(( "cf2_initLocalRegionBuffer (Type 1 mode):" + " invoking empty subrs\n" )); + } + } + else + { + buf->end = decoder->locals[idx + 1]; + } + + buf->ptr = buf->start; return FALSE; /* success */ } diff --git a/src/psaux/psintrp.c b/src/psaux/psintrp.c index 34607ca43..7ee3a2546 100644 --- a/src/psaux/psintrp.c +++ b/src/psaux/psintrp.c @@ -975,7 +975,8 @@ FT_TRACE4(( op1 == cf2_cmdCALLGSUBR ? " callgsubr" : " callsubr" )); - if ( charstringIndex > CF2_MAX_SUBR ) + if ( ( !font->isT1 && charstringIndex > CF2_MAX_SUBR ) || + ( font->isT1 && charstringIndex > T1_MAX_SUBRS_CALLS ) ) { /* max subr plus one for charstring */ lastError = FT_THROW( Invalid_Glyph_Format ); @@ -991,10 +992,10 @@ /* set up the new CFF region and pointer */ subrNum = cf2_stack_popInt( opStack ); - if ( font->isT1 && decoder->subrs_hash ) + if ( font->isT1 && decoder->locals_hash ) { size_t* val = ft_hash_num_lookup( subrNum, - decoder->subrs_hash ); + decoder->locals_hash ); if ( val ) subrNum = *val; From 77c1b331f6cc22a67a4563ebd17bcddc08409a49 Mon Sep 17 00:00:00 2001 From: Ewald Hew Date: Mon, 25 Sep 2017 07:50:03 +0200 Subject: [PATCH 275/470] Extend Adobe interpreter (pop). * src/psaux/psintrp.c (cf2_interpT2CharString): Change how unhandled OtherSubr results are stored. Implement the PostScript stack using an array. : Ensure that the stack is not cleared after getting `OtherSubr' results. Fix stack access. --- ChangeLog | 11 +++++++++++ src/psaux/psintrp.c | 24 ++++++++++++++---------- 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1e9c97220..55867733a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2017-09-25 Ewald Hew + + [psaux] Extend Adobe interpreter (pop). + + * src/psaux/psintrp.c (cf2_interpT2CharString): Change how unhandled + OtherSubr results are stored. Implement the PostScript stack using + an array. + : Ensure that the stack is not cleared after getting + `OtherSubr' results. + Fix stack access. + 2017-09-25 Ewald Hew [psaux] Extend Adobe interpreter (callsubr). diff --git a/src/psaux/psintrp.c b/src/psaux/psintrp.c index 7ee3a2546..12de2cb31 100644 --- a/src/psaux/psintrp.c +++ b/src/psaux/psintrp.c @@ -490,8 +490,10 @@ /* Stuff for Type 1 */ FT_Int known_othersubr_result_cnt = 0; - FT_Int unknown_othersubr_result_cnt = 0; FT_Bool large_int = FALSE; +#define PS_STORAGE_SIZE 3 + CF2_F16Dot16 results[PS_STORAGE_SIZE]; /* for othersubr results */ + FT_Int result_cnt = 0; /* save this for hinting seac accents */ CF2_Fixed hintOriginY = curY; @@ -523,6 +525,7 @@ FT_ZERO( &storage ); + FT_ZERO( &results ); /* initialize the remaining objects */ cf2_arrstack_init( &subrStack, @@ -618,7 +621,7 @@ if ( font->isT1 ) { FT_ASSERT( known_othersubr_result_cnt == 0 || - unknown_othersubr_result_cnt == 0 ); + result_cnt == 0 ); } if ( cf2_buf_isEnd( charstring ) ) @@ -644,14 +647,14 @@ if ( font->isT1 ) { - if ( unknown_othersubr_result_cnt > 0 && + if ( result_cnt > 0 && !( op1 == cf2_cmdCALLSUBR || op1 == cf2_cmdRETURN || op1 == cf2_escPOP || op1 >= 32 /* Numbers */ ) ) { /* all operands have been transferred by previous pops */ - unknown_othersubr_result_cnt = 0; + result_cnt = 0; } if ( large_int && !( op1 >= 32 || op1 == cf2_escDIV ) ) @@ -1459,20 +1462,21 @@ { known_othersubr_result_cnt--; /* ignore, we pushed the operands ourselves */ - break; + continue; } - if ( unknown_othersubr_result_cnt == 0 ) + if ( result_cnt == 0 ) { FT_ERROR(( "cf2_interpT2CharString (Type 1 mode):" " no more operands for othersubr\n" )); - goto Syntax_Error; + lastError = FT_THROW( Invalid_Glyph_Format ); + goto exit; } - unknown_othersubr_result_cnt--; - top++; /* `push' the operand to callothersubr onto the stack */ + result_cnt--; + cf2_stack_pushFixed( opStack, results[result_cnt] ); } - break; + continue; /* do not clear the stack */ case cf2_escDROP: FT_TRACE4(( " drop\n" )); From 9668255965bb61df1f217b353ff1e5ed609d15f7 Mon Sep 17 00:00:00 2001 From: Ewald Hew Date: Mon, 25 Sep 2017 07:54:02 +0200 Subject: [PATCH 276/470] Extend Adobe interpreter (callothersubr). * src/psaux/psintrp.c (cf2_interpT2CharString) : Copy code from `t1_decoder_parse_charstrings' (in `t1decode.c'). OtherSubr 3 (change hints) should reset the hintmask, so that the new hints are applied. Fix function calls and stack access. --- ChangeLog | 15 +- src/psaux/psintrp.c | 439 +++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 451 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 55867733a..dbb1b9387 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2017-09-25 Ewald Hew + + [psaux] Extend Adobe interpreter (callothersubr). + + * src/psaux/psintrp.c (cf2_interpT2CharString) + : Copy code from + `t1_decoder_parse_charstrings' (in `t1decode.c'). + OtherSubr 3 (change hints) should reset the hintmask, so that the + new hints are applied. + Fix function calls and stack access. + 2017-09-25 Ewald Hew [psaux] Extend Adobe interpreter (pop). @@ -30,7 +41,7 @@ 2017-09-25 Ewald Hew - Extend Adobe interpreter (hints). + [psaux] Extend Adobe interpreter (hints). * src/psaux/psintrp.c (cf2_interpT2CharString) : Add correction for left sidebearing in Type 1 mode. @@ -61,7 +72,7 @@ 2017-09-25 Ewald Hew - [psaux] Extend Adobe interpreter (`closepath'). + [psaux] Extend Adobe interpreter (closepath). * src/psaux/psintrp.c (cf2_interpT2CharString) : Use the right builder function. We can use the `haveWidth' boolean diff --git a/src/psaux/psintrp.c b/src/psaux/psintrp.c index 12de2cb31..b95646e52 100644 --- a/src/psaux/psintrp.c +++ b/src/psaux/psintrp.c @@ -1448,8 +1448,445 @@ FT_TRACE4(( " unknown op (12, %d)\n", op2 )); else { + CF2_Int subr_no; + CF2_Int arg_cnt; + CF2_UInt count; + CF2_UInt opIdx = 0; + + FT_TRACE4(( " callothersubr\n" )); + + subr_no = cf2_stack_popInt( opStack ); + arg_cnt = cf2_stack_popInt( opStack ); + + /***********************************************************/ + /* */ + /* remove all operands to callothersubr from the stack */ + /* */ + /* for handled othersubrs, where we know the number of */ + /* arguments, we increase the stack by the value of */ + /* known_othersubr_result_cnt */ + /* */ + /* for unhandled othersubrs the following pops adjust the */ + /* stack pointer as necessary */ + + count = cf2_stack_count( opStack ); + FT_ASSERT( arg_cnt <= count ); + + opIdx += count - arg_cnt; + + known_othersubr_result_cnt = 0; + result_cnt = 0; + + /* XXX TODO: The checks to `arg_count == ' */ + /* might not be correct; an othersubr expects a certain */ + /* number of operands on the PostScript stack (as opposed */ + /* to the T1 stack) but it doesn't have to put them there */ + /* by itself; previous othersubrs might have left the */ + /* operands there if they were not followed by an */ + /* appropriate number of pops */ + /* */ + /* On the other hand, Adobe Reader 7.0.8 for Linux doesn't */ + /* accept a font that contains charstrings like */ + /* */ + /* 100 200 2 20 callothersubr */ + /* 300 1 20 callothersubr pop */ + /* */ + /* Perhaps this is the reason why BuildCharArray exists. */ + + switch ( subr_no ) + { + case 0: /* end flex feature */ + if ( arg_cnt != 3 ) + goto Unexpected_OtherSubr; + + if ( !decoder->flex_state || + decoder->num_flex_vectors != 7 ) + { + FT_ERROR(( "cf2_interpT2CharString (Type 1 mode):" + " unexpected flex end\n" )); + lastError = FT_THROW( Invalid_Glyph_Format ); + goto exit; + } + + /* the two `results' are popped by the following setcurrentpoint */ + cf2_stack_pushFixed( opStack, curX ); + cf2_stack_pushFixed( opStack, curY ); + known_othersubr_result_cnt = 2; + break; + + case 1: /* start flex feature */ + if ( arg_cnt != 0 ) + goto Unexpected_OtherSubr; + + if ( ps_builder_start_point( &decoder->builder, curX, curY ) || + ps_builder_check_points( &decoder->builder, 6 ) ) + goto exit; + + decoder->flex_state = 1; + decoder->num_flex_vectors = 0; + break; + + case 2: /* add flex vectors */ + { + FT_Int idx; + + + if ( arg_cnt != 0 ) + goto Unexpected_OtherSubr; + + if ( !decoder->flex_state ) + { + FT_ERROR(( "cf2_interpT2CharString (Type 1 mode):" + " missing flex start\n" )); + lastError = FT_THROW( Invalid_Glyph_Format ); + goto exit; + } + + /* note that we should not add a point for index 0; */ + /* this will move our current position to the flex */ + /* point without adding any point to the outline */ + idx = decoder->num_flex_vectors++; + if ( idx > 0 && idx < 7 ) + { + /* in malformed fonts it is possible to have other */ + /* opcodes in the middle of a flex (which don't */ + /* increase `num_flex_vectors'); we thus have to */ + /* check whether we can add a point */ + if ( ps_builder_check_points( &decoder->builder, 1 ) ) + { + lastError = FT_THROW( Invalid_Glyph_Format ); + goto exit; + } + + ps_builder_add_point( &decoder->builder, + curX, + curY, + (FT_Byte)( idx == 3 || idx == 6 ) ); + } + } + break; + + case 3: /* change hints */ + if ( arg_cnt != 1 ) + goto Unexpected_OtherSubr; + + cf2_arrstack_clear( &vStemHintArray ); + cf2_arrstack_clear( &hStemHintArray ); + + cf2_hintmask_init( &hintMask, error ); + hintMask.isValid = FALSE; + hintMask.isNew = TRUE; + + known_othersubr_result_cnt = 1; + break; + + case 12: + case 13: + /* counter control hints, clear stack */ + cf2_stack_clear( opStack ); + break; + + case 14: + case 15: + case 16: + case 17: + case 18: /* multiple masters */ + { + PS_Blend blend = decoder->blend; + FT_UInt num_points, nn, mm; + CF2_UInt delta; + CF2_UInt values; + + + if ( !blend ) + { + FT_ERROR(( "t1_decoder_parse_charstrings:" + " unexpected multiple masters operator\n" )); + lastError = FT_THROW( Invalid_Glyph_Format ); + goto exit; + } + + num_points = (FT_UInt)subr_no - 13 + ( subr_no == 18 ); + if ( arg_cnt != (FT_Int)( num_points * blend->num_designs ) ) + { + FT_ERROR(( "t1_decoder_parse_charstrings:" + " incorrect number of multiple masters arguments\n" )); + lastError = FT_THROW( Invalid_Glyph_Format ); + goto exit; + } + + /* We want to compute */ + /* */ + /* a0*w0 + a1*w1 + ... + ak*wk */ + /* */ + /* but we only have a0, a1-a0, a2-a0, ..., ak-a0. */ + /* */ + /* However, given that w0 + w1 + ... + wk == 1, we can */ + /* rewrite it easily as */ + /* */ + /* a0 + (a1-a0)*w1 + (a2-a0)*w2 + ... + (ak-a0)*wk */ + /* */ + /* where k == num_designs-1. */ + /* */ + /* I guess that's why it's written in this `compact' */ + /* form. */ + /* */ + delta = opIdx + num_points; + values = opIdx; + for ( nn = 0; nn < num_points; nn++ ) + { + CF2_Fixed tmp = cf2_stack_getReal( opStack, values ); + + + for ( mm = 1; mm < blend->num_designs; mm++ ) + tmp = ADD_INT32( tmp, + FT_MulFix( cf2_stack_getReal( opStack, delta++ ), + blend->weight_vector[mm] ) ); + + cf2_stack_setReal( opStack, values++, tmp ); + } + cf2_stack_pop( opStack, + arg_cnt - num_points ); + + known_othersubr_result_cnt = (FT_Int)num_points; + break; + } + + case 19: + /* 1 19 callothersubr */ + /* => replace elements starting from index cvi( ) */ + /* of BuildCharArray with WeightVector */ + { + FT_Int idx; + PS_Blend blend = decoder->blend; + + + if ( arg_cnt != 1 || !blend ) + goto Unexpected_OtherSubr; + + idx = cf2_stack_popInt( opStack ); + + if ( idx < 0 || + (FT_UInt)idx + blend->num_designs > decoder->len_buildchar ) + goto Unexpected_OtherSubr; + + ft_memcpy( &decoder->buildchar[idx], + blend->weight_vector, + blend->num_designs * + sizeof ( blend->weight_vector[0] ) ); + } + break; + + case 20: + /* 2 20 callothersubr pop */ + /* ==> push + onto T1 stack */ + { + CF2_F16Dot16 summand1; + CF2_F16Dot16 summand2; + + if ( arg_cnt != 2 ) + goto Unexpected_OtherSubr; + + summand2 = cf2_stack_popFixed( opStack ); + summand1 = cf2_stack_popFixed( opStack ); + + cf2_stack_pushFixed( opStack, + ADD_INT32( summand1, + summand2 ) ); + known_othersubr_result_cnt = 1; + } + break; + + case 21: + /* 2 21 callothersubr pop */ + /* ==> push - onto T1 stack */ + { + CF2_F16Dot16 minuend; + CF2_F16Dot16 subtrahend; + + if ( arg_cnt != 2 ) + goto Unexpected_OtherSubr; + + subtrahend = cf2_stack_popFixed( opStack ); + minuend = cf2_stack_popFixed( opStack ); + + cf2_stack_pushFixed( opStack, + SUB_INT32( minuend, subtrahend ) ); + known_othersubr_result_cnt = 1; + } + break; + + case 22: + /* 2 22 callothersubr pop */ + /* ==> push * onto T1 stack */ + { + CF2_F16Dot16 factor1; + CF2_F16Dot16 factor2; + + if ( arg_cnt != 2 ) + goto Unexpected_OtherSubr; + + factor2 = cf2_stack_popFixed( opStack ); + factor1 = cf2_stack_popFixed( opStack ); + + cf2_stack_pushFixed( opStack, + FT_MulFix( factor1, factor2 ) ); + known_othersubr_result_cnt = 1; + } + break; + + case 23: + /* 2 23 callothersubr pop */ + /* ==> push / onto T1 stack */ + { + CF2_F16Dot16 dividend; + CF2_F16Dot16 divisor; + + if ( arg_cnt != 2 ) + goto Unexpected_OtherSubr; + + divisor = cf2_stack_popFixed( opStack ); + dividend = cf2_stack_popFixed( opStack ); + + if ( divisor == 0 ) + goto Unexpected_OtherSubr; + + cf2_stack_pushFixed( opStack, + FT_DivFix( dividend, divisor ) ); + known_othersubr_result_cnt = 1; + } + break; + + case 24: + /* 2 24 callothersubr */ + /* ==> set BuildCharArray[cvi( )] = */ + { + CF2_Int idx; + PS_Blend blend = decoder->blend; + + + if ( arg_cnt != 2 || !blend ) + goto Unexpected_OtherSubr; + + idx = cf2_stack_popInt( opStack ); + + if ( idx < 0 || (FT_UInt) idx >= decoder->len_buildchar ) + goto Unexpected_OtherSubr; + + decoder->buildchar[idx] = cf2_stack_popFixed( opStack ); + } + break; + + case 25: + /* 1 25 callothersubr pop */ + /* ==> push BuildCharArray[cvi( idx )] */ + /* onto T1 stack */ + { + CF2_Int idx; + PS_Blend blend = decoder->blend; + + + if ( arg_cnt != 1 || !blend ) + goto Unexpected_OtherSubr; + + idx = cf2_stack_popInt( opStack ); + + if ( idx < 0 || (FT_UInt) idx >= decoder->len_buildchar ) + goto Unexpected_OtherSubr; + + cf2_stack_pushFixed( opStack, + decoder->buildchar[idx] ); + known_othersubr_result_cnt = 1; + } + break; + +#if 0 + case 26: + /* mark ==> set BuildCharArray[cvi( )] = , */ + /* leave mark on T1 stack */ + /* ==> set BuildCharArray[cvi( )] = */ + XXX which routine has left its mark on the (PostScript) stack?; + break; +#endif + + case 27: + /* 4 27 callothersubr pop */ + /* ==> push onto T1 stack if <= , */ + /* otherwise push */ + { + CF2_F16Dot16 arg1; + CF2_F16Dot16 arg2; + CF2_F16Dot16 cond1; + CF2_F16Dot16 cond2; + + if ( arg_cnt != 4 ) + goto Unexpected_OtherSubr; + + cond2 = cf2_stack_popFixed( opStack ); + cond1 = cf2_stack_popFixed( opStack ); + arg2 = cf2_stack_popFixed( opStack ); + arg1 = cf2_stack_popFixed( opStack ); + + cf2_stack_pushFixed( opStack, + cond1 <= cond2 ? arg1 : arg2 ); + known_othersubr_result_cnt = 1; + } + break; + + case 28: + /* 0 28 callothersubr pop */ + /* => push random value from interval [0, 1) onto stack */ + { + CF2_F16Dot16 r; + + if ( arg_cnt != 0 ) + goto Unexpected_OtherSubr; + + /* only use the lower 16 bits of `random' */ + /* to generate a number in the range (0;1] */ + r = (CF2_F16Dot16) + ( ( decoder->current_subfont->random & 0xFFFF ) + 1 ); + + decoder->current_subfont->random = + cff_random( decoder->current_subfont->random ); + + cf2_stack_pushFixed( opStack, r ); + known_othersubr_result_cnt = 1; + } + break; + + default: + if ( arg_cnt >= 0 && subr_no >= 0 ) + { + FT_UInt i; + + FT_ERROR(( "cf2_interpT2CharString (Type 1 mode):" + " unknown othersubr [%d %d], wish me luck\n", + arg_cnt, subr_no )); + + /* Store the unused args for this unhandled OtherSubr */ + + if ( arg_cnt > PS_STORAGE_SIZE ) + arg_cnt = PS_STORAGE_SIZE; + result_cnt = arg_cnt; + + for ( i = 1; i <= arg_cnt; i++ ) + { + results[result_cnt - i] = cf2_stack_popFixed( opStack ); + } + + break; + } + /* fall through */ + + Unexpected_OtherSubr: + FT_ERROR(( "cf2_interpT2CharString (Type 1 mode):" + " invalid othersubr [%d %d]\n", arg_cnt, subr_no )); + lastError = FT_THROW( Invalid_Glyph_Format ); + goto exit; + } } - break; + continue; /* do not clear the stack */ case cf2_escPOP: if ( !font->isT1 ) From d55a701de60f559d27f5106cddb50884fed00bf7 Mon Sep 17 00:00:00 2001 From: Ewald Hew Date: Mon, 25 Sep 2017 07:59:41 +0200 Subject: [PATCH 277/470] Extend Adobe interpreter (flex in callothersubr). * src/psaux/psintrp.c (cf2_interpT2CharString) : Fix Flex feature handling (OtherSubrs 0, 1, 2). : Do not actually move the `glyphPath' while doing flex. This is to avoid closing the current contour. --- ChangeLog | 10 ++++++++++ src/psaux/psintrp.c | 27 ++++++++++++++++++++------- 2 files changed, 30 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index dbb1b9387..a44ac1a46 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2017-09-25 Ewald Hew + + [psaux] Extend Adobe interpreter (flex in callothersubr). + + * src/psaux/psintrp.c (cf2_interpT2CharString) + : Fix Flex feature handling (OtherSubrs 0, 1, + 2). + : Do not actually move the `glyphPath' while doing + flex. This is to avoid closing the current contour. + 2017-09-25 Ewald Hew [psaux] Extend Adobe interpreter (callothersubr). diff --git a/src/psaux/psintrp.c b/src/psaux/psintrp.c index b95646e52..5705af063 100644 --- a/src/psaux/psintrp.c +++ b/src/psaux/psintrp.c @@ -503,6 +503,7 @@ FT_Byte op1; /* first opcode byte */ CF2_F16Dot16 storage[CF2_STORAGE_SIZE]; /* for `put' and `get' */ + CF2_F16Dot16 flexStore[6]; /* for Type 1 flex */ /* instruction limit; 20,000,000 matches Avalon */ FT_UInt32 instructionLimit = 20000000UL; @@ -526,6 +527,7 @@ FT_ZERO( &storage ); FT_ZERO( &results ); + FT_ZERO( &flexStore ); /* initialize the remaining objects */ cf2_arrstack_init( &subrStack, @@ -1518,8 +1520,7 @@ if ( arg_cnt != 0 ) goto Unexpected_OtherSubr; - if ( ps_builder_start_point( &decoder->builder, curX, curY ) || - ps_builder_check_points( &decoder->builder, 6 ) ) + if ( ps_builder_check_points( &decoder->builder, 6 ) ) goto exit; decoder->flex_state = 1; @@ -1529,6 +1530,7 @@ case 2: /* add flex vectors */ { FT_Int idx; + FT_Int idx2; if ( arg_cnt != 0 ) @@ -1558,10 +1560,20 @@ goto exit; } - ps_builder_add_point( &decoder->builder, - curX, - curY, - (FT_Byte)( idx == 3 || idx == 6 ) ); + /* map: 1->2 2->4 3->6 4->2 5->4 6->6 */ + idx2 = ( idx > 3 ? idx - 3 : idx ) * 2; + + flexStore[idx2 - 2] = curX; + flexStore[idx2 - 1] = curY; + + if ( idx == 3 || idx == 6 ) + cf2_glyphpath_curveTo( &glyphPath, + flexStore[0], + flexStore[1], + flexStore[2], + flexStore[3], + flexStore[4], + flexStore[5] ); } } break; @@ -2371,7 +2383,8 @@ curY = ADD_INT32( curY, cf2_stack_popFixed( opStack ) ); curX = ADD_INT32( curX, cf2_stack_popFixed( opStack ) ); - cf2_glyphpath_moveTo( &glyphPath, curX, curY ); + if ( !decoder->flex_state ) + cf2_glyphpath_moveTo( &glyphPath, curX, curY ); break; From d813b5da5994807fe2357eddae95bd6642e3e7bb Mon Sep 17 00:00:00 2001 From: Ewald Hew Date: Mon, 25 Sep 2017 08:04:09 +0200 Subject: [PATCH 278/470] Extend Adobe interpreter (seac). This concludes the changes needed to add Type 1 support. * src/psaux/psintrp.c: Update includes. (cf2_interpT2CharString) : Implement this similarly to implied seac for CFF. * src/psaux/t1decode.c (t1_lookup_glyph_by_stdcharcode_ps): New function to look up the glyph index. * src/psaux/psft.c (cf2_getT1SeacComponent, cf2_freeT1SeacComponent): New functions to get the charstrings for seac components. * src/psaux/t1decode.h, src/psaux/psft.h: Update declarations. --- ChangeLog | 19 +++++ src/psaux/psft.c | 68 ++++++++++++++++ src/psaux/psft.h | 8 ++ src/psaux/psintrp.c | 182 +++++++++++++++++++++++++++++++++++++++++-- src/psaux/t1decode.c | 49 ++++++++++++ src/psaux/t1decode.h | 3 + 6 files changed, 322 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index a44ac1a46..24ad011ce 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,22 @@ +2017-09-25 Ewald Hew + + [psaux] Extend Adobe interpreter (seac). + + This concludes the changes needed to add Type 1 support. + + * src/psaux/psintrp.c: Update includes. + (cf2_interpT2CharString) : Implement this similarly to + implied seac for CFF. + + * src/psaux/t1decode.c (t1_lookup_glyph_by_stdcharcode_ps): New + function to look up the glyph index. + + * src/psaux/psft.c (cf2_getT1SeacComponent, + cf2_freeT1SeacComponent): New functions to get the charstrings for + seac components. + + * src/psaux/t1decode.h, src/psaux/psft.h: Update declarations. + 2017-09-25 Ewald Hew [psaux] Extend Adobe interpreter (flex in callothersubr). diff --git a/src/psaux/psft.c b/src/psaux/psft.c index 81d3fd835..b12d9d163 100644 --- a/src/psaux/psft.c +++ b/src/psaux/psft.c @@ -705,6 +705,74 @@ } + FT_LOCAL_DEF( FT_Error ) + cf2_getT1SeacComponent( PS_Decoder* decoder, + FT_UInt glyph_index, + CF2_Buffer buf ) + { + FT_Data glyph_data; + FT_Error error = FT_Err_Ok; + T1_Face face = (T1_Face)decoder->builder.face; + T1_Font type1 = &face->type1; + +#ifdef FT_CONFIG_OPTION_INCREMENTAL + FT_Incremental_InterfaceRec *inc = + face->root.internal->incremental_interface; + /* For incremental fonts get the character data using the */ + /* callback function. */ + if ( inc ) + error = inc->funcs->get_glyph_data( inc->object, + glyph_index, &glyph_data ); + else +#endif + /* For ordinary fonts get the character data stored in the face record. */ + { + glyph_data.pointer = type1->charstrings[glyph_index]; + glyph_data.length = (FT_Int)type1->charstrings_len[glyph_index]; + } + + if ( !error ) + { + FT_Byte* charstring_base = (FT_Byte*)glyph_data.pointer; + FT_ULong charstring_len = (FT_ULong)glyph_data.length; + + + FT_ASSERT( charstring_base + charstring_len >= charstring_base ); + + FT_ZERO( buf ); + buf->start = + buf->ptr = charstring_base; + buf->end = charstring_base + charstring_len; + } + + return error; + } + + + FT_LOCAL_DEF( void ) + cf2_freeT1SeacComponent( PS_Decoder* decoder, + CF2_Buffer buf ) + { + T1_Face face; + FT_Data data; + + + FT_ASSERT( decoder ); + +#ifdef FT_CONFIG_OPTION_INCREMENTAL + face = (T1_Face)decoder->builder.face; + + data.pointer = buf->start; + data.length = (FT_Int)( buf->end - buf->start ); + + if ( face->root.internal->incremental_interface ) + face->root.internal->incremental_interface->funcs->free_glyph_data( + face->root.internal->incremental_interface->object, + &data ); +#endif /* FT_CONFIG_OPTION_INCREMENTAL */ + } + + FT_LOCAL_DEF( CF2_Int ) cf2_initLocalRegionBuffer( PS_Decoder* decoder, CF2_Int subrNum, diff --git a/src/psaux/psft.h b/src/psaux/psft.h index 1628970cc..95e79542f 100644 --- a/src/psaux/psft.h +++ b/src/psaux/psft.h @@ -131,6 +131,14 @@ FT_BEGIN_HEADER cf2_getNominalWidthX( PS_Decoder* decoder ); + FT_LOCAL( FT_Error ) + cf2_getT1SeacComponent( PS_Decoder* decoder, + FT_UInt glyph_index, + CF2_Buffer buf ); + FT_LOCAL( void ) + cf2_freeT1SeacComponent( PS_Decoder* decoder, + CF2_Buffer buf ); + /* * FreeType client outline * diff --git a/src/psaux/psintrp.c b/src/psaux/psintrp.c index 5705af063..e4018c916 100644 --- a/src/psaux/psintrp.c +++ b/src/psaux/psintrp.c @@ -47,8 +47,9 @@ #include "psintrp.h" #include "pserror.h" -#include "psobjs.h" /* for cff_random */ +#include "psobjs.h" /* for cff_random */ +#include "t1decode.h" /* for t1 seac */ /*************************************************************************/ /* */ @@ -1289,12 +1290,179 @@ FT_TRACE4(( " unknown op (12, %d)\n", op2 )); else { - return t1operator_seac( decoder, - top[0], - top[1], - top[2], - Fix2Int( top[3] ), - Fix2Int( top[4] ) ); + FT_Error error2; + CF2_Int bchar_index, achar_index; + FT_Vector left_bearing, advance; +#ifdef FT_CONFIG_OPTION_INCREMENTAL + T1_Face face = (T1_Face)decoder->builder.face; +#endif + CF2_BufferRec component; + CF2_Fixed dummyWidth; + + CF2_Int achar = cf2_stack_popInt( opStack ); + CF2_Int bchar = cf2_stack_popInt( opStack ); + + FT_Pos ady = cf2_stack_popFixed ( opStack ); + FT_Pos adx = cf2_stack_popFixed ( opStack ); + FT_Pos asb = cf2_stack_popFixed ( opStack ); + + + FT_TRACE4(( " seac\n" )); + + if ( doingSeac ) + { + FT_ERROR(( " nested seac\n" )); + lastError = FT_THROW( Invalid_Glyph_Format ); + goto exit; /* nested seac */ + } + + if ( decoder->builder.metrics_only ) + { + FT_ERROR(( " unexpected seac\n" )); + lastError = FT_THROW( Invalid_Glyph_Format ); + goto exit; /* unexpected seac */ + } + + /* `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(( "cf2_interpT2CharString: (Type 1 seac)" + " glyph names table not available in this font\n" )); + lastError = FT_THROW( Invalid_Glyph_Format ); + goto exit; + } + + + /* seac weirdness */ + adx += decoder->builder.left_bearing->x; + +#ifdef FT_CONFIG_OPTION_INCREMENTAL + if ( face->root.internal->incremental_interface ) + { + /* the caller must handle the font encoding also */ + bchar_index = bchar; + achar_index = achar; + } + else +#endif + { + bchar_index = t1_lookup_glyph_by_stdcharcode_ps( decoder, bchar ); + achar_index = t1_lookup_glyph_by_stdcharcode_ps( decoder, achar ); + } + + if ( bchar_index < 0 || achar_index < 0 ) + { + FT_ERROR(( "cf2_interpT2CharString: (Type 1 seac)" + " invalid seac character code arguments\n" )); + lastError = FT_THROW( Invalid_Glyph_Format ); + goto exit; + } + + /* if we are trying to load a composite glyph, do not load the */ + /* accent character and return the array of subglyphs. */ + if ( decoder->builder.no_recurse ) + { + FT_GlyphSlot glyph = (FT_GlyphSlot)decoder->builder.glyph; + FT_GlyphLoader loader = glyph->internal->loader; + FT_SubGlyph subg; + + + /* reallocate subglyph array if necessary */ + error2 = FT_GlyphLoader_CheckSubGlyphs( loader, 2 ); + if ( error2 ) + { + lastError = error2; /* pass FreeType error through */ + goto exit; + } + + subg = loader->current.subglyphs; + + /* subglyph 0 = base character */ + subg->index = bchar_index; + subg->flags = FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES | + FT_SUBGLYPH_FLAG_USE_MY_METRICS; + subg->arg1 = 0; + subg->arg2 = 0; + subg++; + + /* subglyph 1 = accent character */ + subg->index = achar_index; + subg->flags = FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES; + subg->arg1 = (FT_Int)FIXED_TO_INT( adx - asb ); + subg->arg2 = (FT_Int)FIXED_TO_INT( ady ); + + /* set up remaining glyph fields */ + glyph->num_subglyphs = 2; + glyph->subglyphs = loader->base.subglyphs; + glyph->format = FT_GLYPH_FORMAT_COMPOSITE; + + loader->current.num_subglyphs = 2; + + goto exit; + } + + /* First load `bchar' in builder */ + /* now load the unscaled outline */ + + FT_GlyphLoader_Prepare( decoder->builder.loader ); /* prepare loader */ + + error2 = cf2_getT1SeacComponent( decoder, (FT_UInt)bchar_index, &component ); + if ( error2 ) + { + lastError = error2; /* pass FreeType error through */ + goto exit; + } + cf2_interpT2CharString( font, + &component, + callbacks, + translation, + TRUE, + 0, + 0, + &dummyWidth ); + cf2_freeT1SeacComponent( decoder, &component ); + + /* save the left bearing and width of the base character */ + /* as they will be erased by the next load. */ + + left_bearing = *decoder->builder.left_bearing; + advance = *decoder->builder.advance; + + decoder->builder.left_bearing->x = 0; + decoder->builder.left_bearing->y = 0; + + /* Now load `achar' on top of */ + /* the base outline */ + + error2 = cf2_getT1SeacComponent( decoder, (FT_UInt)achar_index, &component ); + if ( error2 ) + { + lastError = error2; /* pass FreeType error through */ + goto exit; + } + cf2_interpT2CharString( font, + &component, + callbacks, + translation, + TRUE, + adx - asb, + ady, + &dummyWidth ); + cf2_freeT1SeacComponent( decoder, &component ); + + /* restore the left side bearing and */ + /* advance width of the base character */ + + *decoder->builder.left_bearing = left_bearing; + *decoder->builder.advance = advance; + + goto exit; } } break; diff --git a/src/psaux/t1decode.c b/src/psaux/t1decode.c index 81f579744..37790c50b 100644 --- a/src/psaux/t1decode.c +++ b/src/psaux/t1decode.c @@ -109,6 +109,55 @@ }; + /*************************************************************************/ + /* */ + /* */ + /* t1_lookup_glyph_by_stdcharcode_ps */ + /* */ + /* */ + /* Looks up a given glyph by its StandardEncoding charcode. Used to */ + /* implement the SEAC Type 1 operator in the Adobe engine */ + /* */ + /* */ + /* face :: The current face object. */ + /* */ + /* charcode :: The character code to look for. */ + /* */ + /* */ + /* A glyph index in the font face. Returns -1 if the corresponding */ + /* glyph wasn't found. */ + /* */ + FT_LOCAL_DEF( FT_Int ) + t1_lookup_glyph_by_stdcharcode_ps( PS_Decoder* decoder, + FT_Int charcode ) + { + FT_UInt n; + const FT_String* glyph_name; + FT_Service_PsCMaps psnames = decoder->psnames; + + + /* check range of standard char code */ + if ( charcode < 0 || charcode > 255 ) + return -1; + + glyph_name = psnames->adobe_std_strings( + psnames->adobe_std_encoding[charcode]); + + for ( n = 0; n < decoder->num_glyphs; n++ ) + { + FT_String* name = (FT_String*)decoder->glyph_names[n]; + + + if ( name && + name[0] == glyph_name[0] && + ft_strcmp( name, glyph_name ) == 0 ) + return (FT_Int)n; + } + + return -1; + } + + /*************************************************************************/ /* */ /* */ diff --git a/src/psaux/t1decode.h b/src/psaux/t1decode.h index 12c27de77..1ca7e013d 100644 --- a/src/psaux/t1decode.h +++ b/src/psaux/t1decode.h @@ -31,6 +31,9 @@ FT_BEGIN_HEADER FT_CALLBACK_TABLE const T1_Decoder_FuncsRec t1_decoder_funcs; + FT_LOCAL( FT_Int ) + t1_lookup_glyph_by_stdcharcode_ps( PS_Decoder* decoder, + FT_Int charcode ); FT_LOCAL( FT_Error ) t1_decoder_parse_glyph( T1_Decoder decoder, From e28550af185eb75f8f9681dc9dda8d66c6274876 Mon Sep 17 00:00:00 2001 From: Ewald Hew Date: Mon, 25 Sep 2017 08:05:19 +0200 Subject: [PATCH 279/470] Switch to Adobe engine. * src/type1/t1objs.c (T1_Driver_Init): Set default to Adobe engine. --- ChangeLog | 6 ++++++ src/type1/t1objs.c | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 24ad011ce..c7288c329 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2017-09-25 Ewald Hew + + [type1] Switch to Adobe engine. + + * src/type1/t1objs.c (T1_Driver_Init): Set default to Adobe engine. + 2017-09-25 Ewald Hew [psaux] Extend Adobe interpreter (seac). diff --git a/src/type1/t1objs.c b/src/type1/t1objs.c index dab556f0a..8cdbb938a 100644 --- a/src/type1/t1objs.c +++ b/src/type1/t1objs.c @@ -587,7 +587,7 @@ /* set default property values, cf. `ftt1drv.h' */ - driver->hinting_engine = FT_T1_HINTING_FREETYPE; + driver->hinting_engine = FT_T1_HINTING_ADOBE; driver->no_stem_darkening = TRUE; From 93e3cffddff86e7b1eafd670b406a8bafd24c629 Mon Sep 17 00:00:00 2001 From: Ewald Hew Date: Mon, 25 Sep 2017 08:08:21 +0200 Subject: [PATCH 280/470] Change subfont synthesis for CID fonts. Change `t1_make_subfont' to take in the Private dict record as an argument. This is because Type 1 and CID font records in FreeType have this in different places. * src/psaux/psobjs.c (t1_make_subfont): Change `T1_Face' to `FT_Face' so that CID is also accepted. Take `PS_Private' as an argument and let caller figure out where the Private dict actually is. Update references. * include/freetype/internal/psaux.h, src/psaux/psobjs.h: Update declaration. * src/type1/t1gload.c (T1_Parse_Glyph_And_Get_Char_String): Update call. --- ChangeLog | 20 ++++++++++++++++++++ include/freetype/internal/psaux.h | 4 ++-- src/psaux/psobjs.c | 18 ++++++++---------- src/psaux/psobjs.h | 3 ++- src/type1/t1gload.c | 2 +- 5 files changed, 33 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index c7288c329..09cd993fc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,23 @@ +2017-09-25 Ewald Hew + + [psaux] Change subfont synthesis for CID fonts. + + Change `t1_make_subfont' to take in the Private dict record as an + argument. This is because Type 1 and CID font records in FreeType + have this in different places. + + * src/psaux/psobjs.c (t1_make_subfont): Change `T1_Face' to + `FT_Face' so that CID is also accepted. + Take `PS_Private' as an argument and let caller figure out where the + Private dict actually is. + Update references. + + * include/freetype/internal/psaux.h, src/psaux/psobjs.h: Update + declaration. + + * src/type1/t1gload.c (T1_Parse_Glyph_And_Get_Char_String): Update + call. + 2017-09-25 Ewald Hew [type1] Switch to Adobe engine. diff --git a/include/freetype/internal/psaux.h b/include/freetype/internal/psaux.h index 9748368db..7357da452 100644 --- a/include/freetype/internal/psaux.h +++ b/include/freetype/internal/psaux.h @@ -1291,10 +1291,10 @@ FT_BEGIN_HEADER PS_Decoder* ps_decoder ); void - (*t1_make_subfont)( T1_Face face, + (*t1_make_subfont)( FT_Face face, + PS_Private priv, CFF_SubFont subfont ); - T1_CMap_Classes t1_cmap_classes; /* fields after this comment line were added after version 2.1.10 */ diff --git a/src/psaux/psobjs.c b/src/psaux/psobjs.c index 3fd2fda04..b592163ce 100644 --- a/src/psaux/psobjs.c +++ b/src/psaux/psobjs.c @@ -2329,10 +2329,10 @@ FT_LOCAL_DEF( void ) - t1_make_subfont( T1_Face face, + t1_make_subfont( FT_Face face, + PS_Private priv, CFF_SubFont subfont ) { - PS_Private priv = &face->type1.private_dict; CFF_Private cpriv = &subfont->private_dict; FT_UInt n, count; @@ -2379,20 +2379,18 @@ /* Initialize the random number generator. */ - if ( face->root.internal->random_seed != -1 ) + if ( face->internal->random_seed != -1 ) { /* . If we have a face-specific seed, use it. */ /* If non-zero, update it to a positive value. */ - subfont->random = (FT_UInt32)face->root.internal->random_seed; - if ( face->root.internal->random_seed ) + subfont->random = (FT_UInt32)face->internal->random_seed; + if ( face->internal->random_seed ) { do { - face->root.internal->random_seed = - (FT_Int32)((PSAux_Service)face->psaux)->cff_random( - (FT_UInt32)face->root.internal->random_seed ); - - } while ( face->root.internal->random_seed < 0 ); + face->internal->random_seed = (FT_Int32)cff_random( + (FT_UInt32)face->internal->random_seed ); + } while ( face->internal->random_seed < 0 ); } } if ( !subfont->random ) diff --git a/src/psaux/psobjs.h b/src/psaux/psobjs.h index 2fed988b4..aed19decd 100644 --- a/src/psaux/psobjs.h +++ b/src/psaux/psobjs.h @@ -285,7 +285,8 @@ FT_BEGIN_HEADER /*************************************************************************/ FT_LOCAL( void ) - t1_make_subfont( T1_Face face, + t1_make_subfont( FT_Face face, + PS_Private priv, CFF_SubFont subfont ); FT_LOCAL( void ) diff --git a/src/type1/t1gload.c b/src/type1/t1gload.c index b1020e9db..6e5d3e819 100644 --- a/src/type1/t1gload.c +++ b/src/type1/t1gload.c @@ -112,7 +112,7 @@ psaux->ps_decoder_init( decoder, TRUE, &psdecoder ); - psaux->t1_make_subfont( face, &subfont ); + psaux->t1_make_subfont( FT_FACE( face ), &face->type1.private_dict, &subfont ); psdecoder.current_subfont = &subfont; error = decoder_funcs->parse_charstrings( &psdecoder, From a5c02f49b567d9a32da2a6cc072eedad156519d3 Mon Sep 17 00:00:00 2001 From: Ewald Hew Date: Mon, 25 Sep 2017 08:11:32 +0200 Subject: [PATCH 281/470] Add Adobe engine configuration. This is similar to what was done in the `type1' module. * src/cid/cidriver.c (t1cid_driver_class): Update declaration. * src/cid/cidobjs.c: Include FT_TYPE1_DRIVER_H. (cid_driver_init): Update code. --- ChangeLog | 10 ++++++++++ src/cid/cidobjs.c | 34 ++++++++++++++++++++++++++++++++-- src/cid/cidriver.c | 2 +- 3 files changed, 43 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 09cd993fc..668161d8f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2017-09-25 Ewald Hew + + [cid] Add Adobe engine configuration. + + This is similar to what was done in the `type1' module. + + * src/cid/cidriver.c (t1cid_driver_class): Update declaration. + * src/cid/cidobjs.c: Include FT_TYPE1_DRIVER_H. + (cid_driver_init): Update code. + 2017-09-25 Ewald Hew [psaux] Change subfont synthesis for CID fonts. diff --git a/src/cid/cidobjs.c b/src/cid/cidobjs.c index ceda8ff97..52c6438f9 100644 --- a/src/cid/cidobjs.c +++ b/src/cid/cidobjs.c @@ -26,6 +26,7 @@ #include FT_SERVICE_POSTSCRIPT_CMAPS_H #include FT_INTERNAL_POSTSCRIPT_AUX_H #include FT_INTERNAL_POSTSCRIPT_HINTS_H +#include FT_TYPE1_DRIVER_H #include "ciderrs.h" @@ -463,9 +464,38 @@ /* FreeType error code. 0 means success. */ /* */ FT_LOCAL_DEF( FT_Error ) - cid_driver_init( FT_Module driver ) + cid_driver_init( FT_Module module ) { - FT_UNUSED( driver ); + PS_Driver driver = (PS_Driver)module; + + FT_UInt32 seed; + + + /* set default property values, cf. `ftcffdrv.h' */ + driver->hinting_engine = FT_T1_HINTING_ADOBE; + + driver->no_stem_darkening = TRUE; + + driver->darken_params[0] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_X1; + driver->darken_params[1] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y1; + driver->darken_params[2] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_X2; + driver->darken_params[3] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y2; + driver->darken_params[4] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_X3; + driver->darken_params[5] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y3; + driver->darken_params[6] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_X4; + driver->darken_params[7] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y4; + + /* compute random seed from some memory addresses */ + seed = (FT_UInt32)( (FT_Offset)(char*)&seed ^ + (FT_Offset)(char*)&module ^ + (FT_Offset)(char*)module->memory ); + seed = seed ^ ( seed >> 10 ) ^ ( seed >> 20 ); + + driver->random_seed = (FT_Int32)seed; + if ( driver->random_seed < 0 ) + driver->random_seed = -driver->random_seed; + else if ( driver->random_seed == 0 ) + driver->random_seed = 123456789; return FT_Err_Ok; } diff --git a/src/cid/cidriver.c b/src/cid/cidriver.c index bb611a961..c7d42f939 100644 --- a/src/cid/cidriver.c +++ b/src/cid/cidriver.c @@ -200,7 +200,7 @@ FT_MODULE_FONT_DRIVER | FT_MODULE_DRIVER_SCALABLE | FT_MODULE_DRIVER_HAS_HINTER, - sizeof ( FT_DriverRec ), + sizeof ( PS_DriverRec ), "t1cid", /* module name */ 0x10000L, /* version 1.0 of driver */ From 0e53cf6d67d0022c2bcd62370d8ce1d90e9117b9 Mon Sep 17 00:00:00 2001 From: Ewald Hew Date: Mon, 25 Sep 2017 08:13:34 +0200 Subject: [PATCH 282/470] Use the new engine. * src/cid/cidgload.c: Update includes. (cid_load_glyph, cid_slot_load_glyph): Implement changes to glyph loading code as with `type1' module. --- ChangeLog | 8 +++++++ src/cid/cidgload.c | 57 ++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 61 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 668161d8f..26528c97c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2017-09-25 Ewald Hew + + [cid] Use the new engine. + + * src/cid/cidgload.c: Update includes. + (cid_load_glyph, cid_slot_load_glyph): Implement changes to glyph + loading code as with `type1' module. + 2017-09-25 Ewald Hew [cid] Add Adobe engine configuration. diff --git a/src/cid/cidgload.c b/src/cid/cidgload.c index 4672a763d..9f47dcdf1 100644 --- a/src/cid/cidgload.c +++ b/src/cid/cidgload.c @@ -24,6 +24,10 @@ #include FT_OUTLINE_H #include FT_INTERNAL_CALC_H +#include FT_INTERNAL_POSTSCRIPT_AUX_H +#include FT_INTERNAL_CFF_TYPES_H +#include FT_TYPE1_DRIVER_H + #include "ciderrs.h" @@ -52,6 +56,8 @@ FT_ULong glyph_length = 0; PSAux_Service psaux = (PSAux_Service)face->psaux; + FT_Bool force_scaling = FALSE; + #ifdef FT_CONFIG_OPTION_INCREMENTAL FT_Incremental_InterfaceRec *inc = face->root.internal->incremental_interface; @@ -169,9 +175,43 @@ if ( decoder->lenIV >= 0 ) psaux->t1_decrypt( charstring, glyph_length, 4330 ); - error = decoder->funcs.parse_charstrings_old( - decoder, charstring + cs_offset, - glyph_length - cs_offset ); + /* choose which renderer to use */ + if ( ((PS_Driver)FT_FACE_DRIVER( face ))->hinting_engine == FT_T1_HINTING_FREETYPE || + decoder->builder.metrics_only ) + error = psaux->t1_decoder_funcs->parse_charstrings_old( decoder, + charstring + cs_offset, + glyph_length - cs_offset ); + else + { + PS_Decoder psdecoder; + CFF_SubFontRec subfont; + + + psaux->ps_decoder_init( decoder, TRUE, &psdecoder ); + + psaux->t1_make_subfont( FT_FACE( face ), &dict->private_dict, &subfont ); + psdecoder.current_subfont = &subfont; + + error = psaux->t1_decoder_funcs->parse_charstrings( &psdecoder, + charstring + cs_offset, + glyph_length - cs_offset ); + + /* Adobe's engine uses 16.16 numbers everywhere; */ + /* as a consequence, glyphs larger than 2000ppem get rejected */ + if ( FT_ERR_EQ( error, Glyph_Too_Big ) ) + { + /* this time, we retry unhinted and scale up the glyph later on */ + /* (the engine uses and sets the hardcoded value 0x10000 / 64 = */ + /* 0x400 for both `x_scale' and `y_scale' in this case) */ + ((CID_GlyphSlot)decoder->builder.glyph)->hint = FALSE; + + force_scaling = TRUE; + + error = psaux->t1_decoder_funcs->parse_charstrings( &psdecoder, + charstring + cs_offset, + glyph_length - cs_offset ); + } + } } #ifdef FT_CONFIG_OPTION_INCREMENTAL @@ -200,6 +240,8 @@ Exit: FT_FREE( charstring ); + ((CID_GlyphSlot)decoder->builder.glyph)->scaled = force_scaling; + return error; } @@ -288,6 +330,7 @@ T1_DecoderRec decoder; CID_Face face = (CID_Face)cidglyph->face; FT_Bool hinting; + FT_Bool scaled; PSAux_Service psaux = (PSAux_Service)face->psaux; FT_Matrix font_matrix; @@ -311,7 +354,10 @@ hinting = FT_BOOL( ( load_flags & FT_LOAD_NO_SCALE ) == 0 && ( load_flags & FT_LOAD_NO_HINTING ) == 0 ); + scaled = FT_BOOL( ( load_flags & FT_LOAD_NO_SCALE ) == 0 ); + glyph->hint = hinting; + glyph->scaled = scaled; cidglyph->format = FT_GLYPH_FORMAT_OUTLINE; error = psaux->t1_decoder_funcs->init( &decoder, @@ -337,6 +383,9 @@ if ( error ) goto Exit; + hinting = glyph->hint; + scaled = glyph->scaled; + font_matrix = decoder.font_matrix; font_offset = decoder.font_offset; @@ -410,7 +459,7 @@ metrics->vertAdvance += font_offset.y; } - if ( ( load_flags & FT_LOAD_NO_SCALE ) == 0 ) + if ( ( load_flags & FT_LOAD_NO_SCALE ) == 0 || scaled ) { /* scale the outline and the metrics */ FT_Int n; From 999a75b6dbfd24349b720fe6f600c37e8406f49e Mon Sep 17 00:00:00 2001 From: Ewald Hew Date: Mon, 25 Sep 2017 08:16:59 +0200 Subject: [PATCH 283/470] Minor fixes. * src/psaux/psintrp.c (cf2_interpT2CharString): Fix check for pop results. s/font->decoder/decoder/ where necessary. : Use offset parameter in `cf2_doStems' instead of doing correction for left-sidebearing. --- ChangeLog | 11 ++++++++ src/psaux/psintrp.c | 68 +++++++++++++++------------------------------ 2 files changed, 34 insertions(+), 45 deletions(-) diff --git a/ChangeLog b/ChangeLog index 26528c97c..0649aa66a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2017-09-25 Ewald Hew + + [psaux] Minor fixes. + + * src/psaux/psintrp.c (cf2_interpT2CharString): Fix check for pop + results. + s/font->decoder/decoder/ where necessary. + : Use + offset parameter in `cf2_doStems' instead of doing correction for + left-sidebearing. + 2017-09-25 Ewald Hew [cid] Use the new engine. diff --git a/src/psaux/psintrp.c b/src/psaux/psintrp.c index e4018c916..77f2632b8 100644 --- a/src/psaux/psintrp.c +++ b/src/psaux/psintrp.c @@ -653,7 +653,7 @@ if ( result_cnt > 0 && !( op1 == cf2_cmdCALLSUBR || op1 == cf2_cmdRETURN || - op1 == cf2_escPOP || + op1 == cf2_cmdESC || op1 >= 32 /* Numbers */ ) ) { /* all operands have been transferred by previous pops */ @@ -771,27 +771,16 @@ break; } } - else - { - /* Do lsb correction */ - CF2_F16Dot16 hint_pos; - - FT_ASSERT( ( cf2_stack_count( opStack ) == 2 ) ); - - hint_pos = ADD_INT32( cf2_stack_getReal( opStack, 0 ), - decoder->builder.left_bearing->y ); - - cf2_stack_setReal( opStack, 0, hint_pos ); - } cf2_doStems( font, opStack, &hStemHintArray, width, &haveWidth, - 0 ); + font->isT1 ? decoder->builder.left_bearing->y + : 0 ); - if ( font->decoder->width_only ) + if ( decoder->width_only ) goto exit; break; @@ -811,27 +800,16 @@ break; } } - else - { - /* Do lsb correction */ - CF2_F16Dot16 hint_pos; - - FT_ASSERT( ( cf2_stack_count( opStack ) == 2 ) ); - - hint_pos = ADD_INT32( cf2_stack_getReal( opStack, 0 ), - decoder->builder.left_bearing->x ); - - cf2_stack_setReal( opStack, 0, hint_pos ); - } cf2_doStems( font, opStack, &vStemHintArray, width, &haveWidth, - 0 ); + font->isT1 ? decoder->builder.left_bearing->x + : 0 ); - if ( font->decoder->width_only ) + if ( decoder->width_only ) goto exit; break; @@ -852,7 +830,7 @@ /* width is defined or default after this */ haveWidth = TRUE; - if ( font->decoder->width_only ) + if ( decoder->width_only ) goto exit; curY = ADD_INT32( curY, cf2_stack_popFixed( opStack ) ); @@ -1180,6 +1158,9 @@ { if ( font->isCFF2 || op2 >= cf2_escRESERVED_38 ) FT_TRACE4(( " unknown op (12, %d)\n", op2 )); + else if ( font->isT1 && result_cnt > 0 && op2 != cf2_escPOP ) + /* all operands have been transferred by previous pops */ + result_cnt = 0; else { /* second switch for 2-byte operators handles CFF and Type 1 */ @@ -1204,23 +1185,19 @@ else { CF2_F16Dot16 v0, v1, v2; - CF2_F16Dot16 lsb; - FT_TRACE4(( op2 == cf2_escVSTEM3 ? " vstem3\n" - : " hstem3\n" )); + FT_Bool isV = FT_BOOL( op2 == cf2_escVSTEM3 ); - FT_ASSERT( ( cf2_stack_count( opStack ) == 6 ) ); - lsb = ( op2 == cf2_escVSTEM3 ? decoder->builder.left_bearing->x - : decoder->builder.left_bearing->y ); + FT_TRACE4(( isV ? " vstem3\n" + : " hstem3\n" )); + + FT_ASSERT( ( cf2_stack_count( opStack ) == 6 ) ); v0 = cf2_stack_getReal( opStack, 0 ); v1 = cf2_stack_getReal( opStack, 2 ); v2 = cf2_stack_getReal( opStack, 4 ); - cf2_stack_setReal( opStack, 0, - ADD_INT32( v0, - lsb ) ); cf2_stack_setReal( opStack, 2, SUB_INT32( SUB_INT32( v1, v0 ), cf2_stack_getReal( opStack, 1 ) ) ); @@ -1230,10 +1207,11 @@ cf2_doStems( font, opStack, - op2 == cf2_escVSTEM3 ? &vStemHintArray : &hStemHintArray, + isV ? &vStemHintArray : &hStemHintArray, width, &haveWidth, - 0 ); + isV ? decoder->builder.left_bearing->x + : decoder->builder.left_bearing->y ); if ( decoder->width_only ) goto exit; @@ -2391,7 +2369,7 @@ /* width is defined or default after this */ haveWidth = TRUE; - if ( font->decoder->width_only ) + if ( decoder->width_only ) goto exit; /* close path if still open */ @@ -2479,7 +2457,7 @@ &haveWidth, 0 ); - if ( font->decoder->width_only ) + if ( decoder->width_only ) goto exit; if ( op1 == cf2_cmdHINTMASK ) @@ -2545,7 +2523,7 @@ /* width is defined or default after this */ haveWidth = TRUE; - if ( font->decoder->width_only ) + if ( decoder->width_only ) goto exit; curY = ADD_INT32( curY, cf2_stack_popFixed( opStack ) ); @@ -2572,7 +2550,7 @@ /* width is defined or default after this */ haveWidth = TRUE; - if ( font->decoder->width_only ) + if ( decoder->width_only ) goto exit; curX = ADD_INT32( curX, cf2_stack_popFixed( opStack ) ); From 2f0e11406890cbd15d86f8e75ab6ab4da8898af4 Mon Sep 17 00:00:00 2001 From: Ewald Hew Date: Mon, 25 Sep 2017 08:19:33 +0200 Subject: [PATCH 284/470] Add tracing for hints. * src/psaux/pshints.c (cf2_hintmap_dump): New function. (cf2_hintmap_insertHint): Trace incoming and inserted hints. (cf2_hintmap_build): Dump hintmap before and after hint adjustment. --- ChangeLog | 8 ++++++++ src/psaux/pshints.c | 49 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+) diff --git a/ChangeLog b/ChangeLog index 0649aa66a..3ab15c51a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2017-09-25 Ewald Hew + + [psaux] Add tracing for hints. + + * src/psaux/pshints.c (cf2_hintmap_dump): New function. + (cf2_hintmap_insertHint): Trace incoming and inserted hints. + (cf2_hintmap_build): Dump hintmap before and after hint adjustment. + 2017-09-25 Ewald Hew [psaux] Minor fixes. diff --git a/src/psaux/pshints.c b/src/psaux/pshints.c index dab6b2b55..f6234e7ee 100644 --- a/src/psaux/pshints.c +++ b/src/psaux/pshints.c @@ -299,6 +299,31 @@ } + static void + cf2_hintmap_dump( CF2_HintMap hintmap ) + { + CF2_UInt i; + + + FT_TRACE6(( " index csCoord dsCoord scale flags\n" )); + + for ( i = 0; i < hintmap->count; i++ ) + { + CF2_Hint hint = &hintmap->edge[i]; + + FT_TRACE6(( " %3d %7.2f %7.2f %5d %s%s%s%s\n", + hint->index, + hint->csCoord / 65536.0, + hint->dsCoord / (hint->scale * 1.0), + hint->scale, + ( cf2_hint_isPair( hint ) ? "p" : "g" ), + ( cf2_hint_isTop( hint ) ? "t" : "b" ), + ( cf2_hint_isLocked( hint ) ? "L" : ""), + ( cf2_hint_isSynthetic( hint ) ? "S" : "" ) )); + } + } + + /* transform character space coordinate to device space using hint map */ static CF2_Fixed cf2_hintmap_map( CF2_HintMap hintmap, @@ -612,6 +637,14 @@ break; } + FT_TRACE7(( " Got hint at %.2f (%.2f)\n", + firstHintEdge->csCoord / 65536.0, + firstHintEdge->dsCoord / 65536.0 )); + if ( isPair ) + FT_TRACE7(( " Got hint at %.2f (%.2f)\n", + secondHintEdge->csCoord / 65536.0, + secondHintEdge->dsCoord / 65536.0 )); + /* * Discard any hints that overlap in character space. Most often, this * is while building the initial map, where captured hints from all @@ -730,12 +763,19 @@ /* insert first edge */ hintmap->edge[indexInsert] = *firstHintEdge; /* copy struct */ hintmap->count += 1; + FT_TRACE7(( " Inserting hint %.2f (%.2f)\n", + firstHintEdge->csCoord / 65536.0, + firstHintEdge->dsCoord / 65536.0 )); if ( isPair ) { /* insert second edge */ hintmap->edge[indexInsert + 1] = *secondHintEdge; /* copy struct */ hintmap->count += 1; + FT_TRACE7(( " Inserting hint %.2f (%.2f)\n", + secondHintEdge->csCoord / 65536.0, + secondHintEdge->dsCoord / 65536.0 )); + } } @@ -970,6 +1010,12 @@ } } + FT_TRACE6(( initialMap ? "flags: [p]air [g]host [t]op " + "[b]ottom [L]ocked [S]ynthetic\n" + "Initial hintmap\n" + : "Hints:\n" )); + cf2_hintmap_dump( hintmap ); + /* * Note: The following line is a convenient place to break when * debugging hinting. Examine `hintmap->edge' for the list of @@ -982,6 +1028,9 @@ /* adjust positions of hint edges that are not locked to blue zones */ cf2_hintmap_adjustHints( hintmap ); + FT_TRACE6(( "(adjusted)\n" )); + cf2_hintmap_dump( hintmap ); + /* save the position of all hints that were used in this hint map; */ /* if we use them again, we'll locate them in the same position */ if ( !initialMap ) From d52dd7f31d958980331fdffec70588785669a327 Mon Sep 17 00:00:00 2001 From: Ewald Hew Date: Mon, 25 Sep 2017 08:22:26 +0200 Subject: [PATCH 285/470] Fix Type 1 hinting. Type 1 hinting breaks sometimes when mid-charstring hints should have been in the initial hintmap. This fix adds a preprocessing pass that reads all hints and builds the correct initial hintmap first, before proceeding to build the glyph outline. * src/psaux/psintrp.c (cf2_interpT2CharString): New `initial_map_ready' boolean flag. Ignore outline commands and hint changes on first pass. : Add section to build hintmap and rewind. --- ChangeLog | 14 +++++++++ src/psaux/psintrp.c | 76 +++++++++++++++++++++++++++++++++++++++------ 2 files changed, 80 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3ab15c51a..7961ebe7d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2017-09-25 Ewald Hew + + [psaux] Fix Type 1 hinting. + + Type 1 hinting breaks sometimes when mid-charstring hints should + have been in the initial hintmap. This fix adds a preprocessing + pass that reads all hints and builds the correct initial hintmap + first, before proceeding to build the glyph outline. + + * src/psaux/psintrp.c (cf2_interpT2CharString): New + `initial_map_ready' boolean flag. + Ignore outline commands and hint changes on first pass. + : Add section to build hintmap and rewind. + 2017-09-25 Ewald Hew [psaux] Add tracing for hints. diff --git a/src/psaux/psintrp.c b/src/psaux/psintrp.c index 77f2632b8..3e0590f92 100644 --- a/src/psaux/psintrp.c +++ b/src/psaux/psintrp.c @@ -492,6 +492,7 @@ /* Stuff for Type 1 */ FT_Int known_othersubr_result_cnt = 0; FT_Bool large_int = FALSE; + FT_Bool initial_map_ready = FALSE; #define PS_STORAGE_SIZE 3 CF2_F16Dot16 results[PS_STORAGE_SIZE]; /* for othersubr results */ FT_Int result_cnt = 0; @@ -650,6 +651,20 @@ if ( font->isT1 ) { + if ( !initial_map_ready && + !( op1 == cf2_cmdHSTEM || + op1 == cf2_cmdVSTEM || + op1 == cf2_cmdHSBW || + op1 == cf2_cmdCALLSUBR || + op1 == cf2_cmdRETURN || + op1 == cf2_cmdESC || + op1 == cf2_cmdENDCHAR || + op1 >= 32 /* Numbers */ ) ) + { + cf2_stack_clear( opStack ); + continue; + } + if ( result_cnt > 0 && !( op1 == cf2_cmdCALLSUBR || op1 == cf2_cmdRETURN || @@ -1478,8 +1493,11 @@ if ( builder->metrics_only ) goto exit; - curX = ADD_INT32( curX, lsb_x ); - curY = ADD_INT32( curY, lsb_y ); + if ( initial_map_ready ) + { + curX = ADD_INT32( curX, lsb_x ); + curY = ADD_INT32( curY, lsb_y ); + } } } break; @@ -1647,8 +1665,9 @@ if ( arg_cnt != 3 ) goto Unexpected_OtherSubr; - if ( !decoder->flex_state || - decoder->num_flex_vectors != 7 ) + if ( initial_map_ready && + ( !decoder->flex_state || + decoder->num_flex_vectors != 7 ) ) { FT_ERROR(( "cf2_interpT2CharString (Type 1 mode):" " unexpected flex end\n" )); @@ -1666,6 +1685,9 @@ if ( arg_cnt != 0 ) goto Unexpected_OtherSubr; + if ( !initial_map_ready ) + break; + if ( ps_builder_check_points( &decoder->builder, 6 ) ) goto exit; @@ -1682,6 +1704,9 @@ if ( arg_cnt != 0 ) goto Unexpected_OtherSubr; + if ( !initial_map_ready ) + break; + if ( !decoder->flex_state ) { FT_ERROR(( "cf2_interpT2CharString (Type 1 mode):" @@ -1728,12 +1753,15 @@ if ( arg_cnt != 1 ) goto Unexpected_OtherSubr; - cf2_arrstack_clear( &vStemHintArray ); - cf2_arrstack_clear( &hStemHintArray ); + if ( initial_map_ready ) + { + cf2_arrstack_clear( &vStemHintArray ); + cf2_arrstack_clear( &hStemHintArray ); - cf2_hintmask_init( &hintMask, error ); - hintMask.isValid = FALSE; - hintMask.isNew = TRUE; + cf2_hintmask_init( &hintMask, error ); + hintMask.isValid = FALSE; + hintMask.isNew = TRUE; + } known_othersubr_result_cnt = 1; break; @@ -2281,6 +2309,9 @@ { FT_TRACE4(( " setcurrentpoint" )); + if ( !initial_map_ready ) + break; + /* From the T1 specification, section 6.4: */ /* */ /* The setcurrentpoint command is used only in */ @@ -2351,13 +2382,38 @@ if ( builder->metrics_only ) goto exit; - curX = ADD_INT32( curX, lsb_x ); + if ( initial_map_ready ) + curX = ADD_INT32( curX, lsb_x ); } break; case cf2_cmdENDCHAR: FT_TRACE4(( " endchar\n" )); + if ( font->isT1 && !initial_map_ready ) + { + FT_TRACE5(( "cf2_interpT2CharString (Type 1 mode): " + "Build initial hintmap, rewinding...\n" )); + + /* Trigger initial hintmap build */ + cf2_glyphpath_moveTo( &glyphPath, curX, curY ); + + initial_map_ready = TRUE; + + /* Change hints routine - clear for rewind */ + cf2_arrstack_clear( &vStemHintArray ); + cf2_arrstack_clear( &hStemHintArray ); + + cf2_hintmask_init( &hintMask, error ); + hintMask.isValid = FALSE; + hintMask.isNew = TRUE; + + /* Rewind charstring */ + charstring->ptr = charstring->start; + + break; + } + if ( cf2_stack_count( opStack ) == 1 || cf2_stack_count( opStack ) == 5 ) { From ebb1735aa79f71b2f0c78bc1c5586d3e034d6c11 Mon Sep 17 00:00:00 2001 From: Ewald Hew Date: Mon, 25 Sep 2017 08:26:57 +0200 Subject: [PATCH 286/470] Move `psdecode' into `psobjs'. As the former only contains a single procedure, move it into `psobjs' for simplicity. Also change the parameter order to the conventional one. * src/psaux/psdecode.c (ps_decoder_init): Moved to... * src/psaux/psobjs.c: ...Here. * src/psaux/psdecode.h, src/psaux/psobjs.h: Ditto. * include/freetype/internal/psaux.h (PSAux_ServiceRec): Update `ps_decoder_init' function signature. * src/cff/cffgload.c, src/cid/cidgload.c, src/type1/t1gload.c: Update calls. * src/psaux/psaux.c, src/psaux/psauxmod.c: Update includes. * src/psaux/Jamfile (_sources), src/psaux/rules.mk (PSAUX_DRV_SRC): Update file references. --- ChangeLog | 23 ++++++++ include/freetype/internal/psaux.h | 6 +- src/cff/cffgload.c | 2 +- src/cid/cidgload.c | 2 +- src/psaux/Jamfile | 1 - src/psaux/psaux.c | 1 - src/psaux/psauxmod.c | 1 - src/psaux/psdecode.c | 91 ------------------------------- src/psaux/psdecode.h | 20 ------- src/psaux/psobjs.c | 81 +++++++++++++++++++++++++++ src/psaux/psobjs.h | 5 ++ src/psaux/rules.mk | 1 - src/type1/t1gload.c | 2 +- 13 files changed, 115 insertions(+), 121 deletions(-) delete mode 100644 src/psaux/psdecode.c delete mode 100644 src/psaux/psdecode.h diff --git a/ChangeLog b/ChangeLog index 7961ebe7d..067ecbe6e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,26 @@ +2017-09-25 Ewald Hew + + [psaux] Move `psdecode' into `psobjs'. + + As the former only contains a single procedure, move it into + `psobjs' for simplicity. Also change the parameter order to the + conventional one. + + * src/psaux/psdecode.c (ps_decoder_init): Moved to... + * src/psaux/psobjs.c: ...Here. + * src/psaux/psdecode.h, src/psaux/psobjs.h: Ditto. + + * include/freetype/internal/psaux.h (PSAux_ServiceRec): Update + `ps_decoder_init' function signature. + + * src/cff/cffgload.c, src/cid/cidgload.c, src/type1/t1gload.c: + Update calls. + + * src/psaux/psaux.c, src/psaux/psauxmod.c: Update includes. + + * src/psaux/Jamfile (_sources), src/psaux/rules.mk (PSAUX_DRV_SRC): + Update file references. + 2017-09-25 Ewald Hew [psaux] Fix Type 1 hinting. diff --git a/include/freetype/internal/psaux.h b/include/freetype/internal/psaux.h index 7357da452..c287974a5 100644 --- a/include/freetype/internal/psaux.h +++ b/include/freetype/internal/psaux.h @@ -1286,9 +1286,9 @@ FT_BEGIN_HEADER (*cff_random)( FT_UInt32 r ); void - (*ps_decoder_init)( void* decoder, - FT_Bool is_t1, - PS_Decoder* ps_decoder ); + (*ps_decoder_init)( PS_Decoder* ps_decoder, + void* decoder, + FT_Bool is_t1 ); void (*t1_make_subfont)( FT_Face face, diff --git a/src/cff/cffgload.c b/src/cff/cffgload.c index 917fb3ad8..9a2080b21 100644 --- a/src/cff/cffgload.c +++ b/src/cff/cffgload.c @@ -435,7 +435,7 @@ else #endif { - psaux->ps_decoder_init( &decoder, FALSE, &psdecoder ); + psaux->ps_decoder_init( &psdecoder, &decoder, FALSE ); error = decoder_funcs->parse_charstrings( &psdecoder, charstring, diff --git a/src/cid/cidgload.c b/src/cid/cidgload.c index 9f47dcdf1..2194151a6 100644 --- a/src/cid/cidgload.c +++ b/src/cid/cidgload.c @@ -187,7 +187,7 @@ CFF_SubFontRec subfont; - psaux->ps_decoder_init( decoder, TRUE, &psdecoder ); + psaux->ps_decoder_init( &psdecoder, decoder, TRUE ); psaux->t1_make_subfont( FT_FACE( face ), &dict->private_dict, &subfont ); psdecoder.current_subfont = &subfont; diff --git a/src/psaux/Jamfile b/src/psaux/Jamfile index ab861e656..0e5944d69 100644 --- a/src/psaux/Jamfile +++ b/src/psaux/Jamfile @@ -23,7 +23,6 @@ SubDir FT2_TOP $(FT2_SRC_DIR) psaux ; t1cmap t1decode cffdecode - psdecode psarrst psblues pserror diff --git a/src/psaux/psaux.c b/src/psaux/psaux.c index 8c9e63316..e30c9b084 100644 --- a/src/psaux/psaux.c +++ b/src/psaux/psaux.c @@ -26,7 +26,6 @@ #include "t1cmap.c" #include "t1decode.c" #include "cffdecode.c" -#include "psdecode.c" #include "psarrst.c" #include "psblues.c" diff --git a/src/psaux/psauxmod.c b/src/psaux/psauxmod.c index b07192909..fea60ce6d 100644 --- a/src/psaux/psauxmod.c +++ b/src/psaux/psauxmod.c @@ -23,7 +23,6 @@ #include "t1cmap.h" #include "psft.h" #include "cffdecode.h" -#include "psdecode.h" #ifndef T1_CONFIG_OPTION_NO_AFM #include "afmparse.h" diff --git a/src/psaux/psdecode.c b/src/psaux/psdecode.c deleted file mode 100644 index c8a5d01c2..000000000 --- a/src/psaux/psdecode.c +++ /dev/null @@ -1,91 +0,0 @@ - - -#include -#include FT_INTERNAL_SERVICE_H - -#include "psdecode.h" -#include "psobjs.h" - -#include "psauxerr.h" - - - /*************************************************************************/ - /* */ - /* */ - /* ps_decoder_init */ - /* */ - /* */ - /* Creates a decoder for the combined Type 1 / CFF interpreter. */ - /* */ - /* */ - /* decoder :: A pointer to the glyph builder to initialize. */ - /* */ - /* */ - /* */ - /* */ - /* */ - /* */ - /* */ - FT_LOCAL_DEF( void ) - ps_decoder_init( void* decoder, - FT_Bool is_t1, - PS_Decoder* ps_decoder ) - { - FT_ZERO( ps_decoder ); - - if ( is_t1 ) - { - T1_Decoder t1_decoder = (T1_Decoder)decoder; - - ps_builder_init( &t1_decoder->builder, - is_t1, - &ps_decoder->builder ); - - ps_decoder->cf2_instance = &t1_decoder->cf2_instance; - ps_decoder->psnames = t1_decoder->psnames; - - ps_decoder->num_glyphs = t1_decoder->num_glyphs; - ps_decoder->glyph_names = t1_decoder->glyph_names; - ps_decoder->hint_mode = t1_decoder->hint_mode; - ps_decoder->blend = t1_decoder->blend; - - ps_decoder->num_locals = t1_decoder->num_subrs; - ps_decoder->locals = t1_decoder->subrs; - ps_decoder->locals_len = t1_decoder->subrs_len; - ps_decoder->locals_hash = t1_decoder->subrs_hash; - - ps_decoder->buildchar = t1_decoder->buildchar; - ps_decoder->len_buildchar = t1_decoder->len_buildchar; - - ps_decoder->lenIV = t1_decoder->lenIV; - } - else - { - CFF_Decoder* cff_decoder = (CFF_Decoder*)decoder; - - ps_builder_init( &cff_decoder->builder, - is_t1, - &ps_decoder->builder ); - - ps_decoder->cff = cff_decoder->cff; - ps_decoder->cf2_instance = &cff_decoder->cff->cf2_instance; - ps_decoder->current_subfont = cff_decoder->current_subfont; - - ps_decoder->num_globals = cff_decoder->num_globals; - ps_decoder->globals = cff_decoder->globals; - ps_decoder->globals_bias = cff_decoder->globals_bias; - ps_decoder->num_locals = cff_decoder->num_locals; - ps_decoder->locals = cff_decoder->locals; - ps_decoder->locals_bias = cff_decoder->locals_bias; - - ps_decoder->glyph_width = cff_decoder->glyph_width; - ps_decoder->nominal_width = cff_decoder->nominal_width; - ps_decoder->width_only = cff_decoder->width_only; - - ps_decoder->hint_mode = cff_decoder->hint_mode; - - ps_decoder->get_glyph_callback = cff_decoder->get_glyph_callback; - ps_decoder->free_glyph_callback = cff_decoder->free_glyph_callback; - } - } - diff --git a/src/psaux/psdecode.h b/src/psaux/psdecode.h deleted file mode 100644 index dd7e6f285..000000000 --- a/src/psaux/psdecode.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef PSDECODE_H_ -#define PSDECODE_H_ - - -#include -#include FT_INTERNAL_POSTSCRIPT_AUX_H - - -FT_BEGIN_HEADER - - FT_LOCAL( void ) - ps_decoder_init( void* decoder, - FT_Bool is_t1, - PS_Decoder* ps_decoder ); - - -FT_END_HEADER - -#endif - diff --git a/src/psaux/psobjs.c b/src/psaux/psobjs.c index b592163ce..d643afeff 100644 --- a/src/psaux/psobjs.c +++ b/src/psaux/psobjs.c @@ -2328,6 +2328,87 @@ /*************************************************************************/ + /*************************************************************************/ + /* */ + /* */ + /* ps_decoder_init */ + /* */ + /* */ + /* Creates a wrapper decoder for use in the combined */ + /* Type 1 / CFF interpreter. */ + /* */ + /* */ + /* ps_decoder :: A pointer to the decoder to initialize. */ + /* */ + /* */ + /* decoder :: A pointer to the original decoder. */ + /* */ + /* is_t1 :: Flag indicating Type 1 or CFF */ + /* */ + FT_LOCAL_DEF( void ) + ps_decoder_init( PS_Decoder* ps_decoder, + void* decoder, + FT_Bool is_t1 ) + { + FT_ZERO( ps_decoder ); + + if ( is_t1 ) + { + T1_Decoder t1_decoder = (T1_Decoder)decoder; + + ps_builder_init( &t1_decoder->builder, + is_t1, + &ps_decoder->builder ); + + ps_decoder->cf2_instance = &t1_decoder->cf2_instance; + ps_decoder->psnames = t1_decoder->psnames; + + ps_decoder->num_glyphs = t1_decoder->num_glyphs; + ps_decoder->glyph_names = t1_decoder->glyph_names; + ps_decoder->hint_mode = t1_decoder->hint_mode; + ps_decoder->blend = t1_decoder->blend; + + ps_decoder->num_locals = t1_decoder->num_subrs; + ps_decoder->locals = t1_decoder->subrs; + ps_decoder->locals_len = t1_decoder->subrs_len; + ps_decoder->locals_hash = t1_decoder->subrs_hash; + + ps_decoder->buildchar = t1_decoder->buildchar; + ps_decoder->len_buildchar = t1_decoder->len_buildchar; + + ps_decoder->lenIV = t1_decoder->lenIV; + } + else + { + CFF_Decoder* cff_decoder = (CFF_Decoder*)decoder; + + ps_builder_init( &cff_decoder->builder, + is_t1, + &ps_decoder->builder ); + + ps_decoder->cff = cff_decoder->cff; + ps_decoder->cf2_instance = &cff_decoder->cff->cf2_instance; + ps_decoder->current_subfont = cff_decoder->current_subfont; + + ps_decoder->num_globals = cff_decoder->num_globals; + ps_decoder->globals = cff_decoder->globals; + ps_decoder->globals_bias = cff_decoder->globals_bias; + ps_decoder->num_locals = cff_decoder->num_locals; + ps_decoder->locals = cff_decoder->locals; + ps_decoder->locals_bias = cff_decoder->locals_bias; + + ps_decoder->glyph_width = cff_decoder->glyph_width; + ps_decoder->nominal_width = cff_decoder->nominal_width; + ps_decoder->width_only = cff_decoder->width_only; + + ps_decoder->hint_mode = cff_decoder->hint_mode; + + ps_decoder->get_glyph_callback = cff_decoder->get_glyph_callback; + ps_decoder->free_glyph_callback = cff_decoder->free_glyph_callback; + } + } + + FT_LOCAL_DEF( void ) t1_make_subfont( FT_Face face, PS_Private priv, diff --git a/src/psaux/psobjs.h b/src/psaux/psobjs.h index aed19decd..6773eacb2 100644 --- a/src/psaux/psobjs.h +++ b/src/psaux/psobjs.h @@ -284,6 +284,11 @@ FT_BEGIN_HEADER /*************************************************************************/ /*************************************************************************/ + FT_LOCAL( void ) + ps_decoder_init( PS_Decoder* ps_decoder, + void* decoder, + FT_Bool is_t1 ); + FT_LOCAL( void ) t1_make_subfont( FT_Face face, PS_Private priv, diff --git a/src/psaux/rules.mk b/src/psaux/rules.mk index 55a835f6a..266d446f8 100644 --- a/src/psaux/rules.mk +++ b/src/psaux/rules.mk @@ -36,7 +36,6 @@ PSAUX_DRV_SRC := $(PSAUX_DIR)/psobjs.c \ $(PSAUX_DIR)/psauxmod.c \ $(PSAUX_DIR)/psarrst.c \ $(PSAUX_DIR)/psblues.c \ - $(PSAUX_DIR)/psdecode.c \ $(PSAUX_DIR)/pserror.c \ $(PSAUX_DIR)/psfont.c \ $(PSAUX_DIR)/psft.c \ diff --git a/src/type1/t1gload.c b/src/type1/t1gload.c index 6e5d3e819..e5f88d0a0 100644 --- a/src/type1/t1gload.c +++ b/src/type1/t1gload.c @@ -110,7 +110,7 @@ CFF_SubFontRec subfont; - psaux->ps_decoder_init( decoder, TRUE, &psdecoder ); + psaux->ps_decoder_init( &psdecoder, decoder, TRUE ); psaux->t1_make_subfont( FT_FACE( face ), &face->type1.private_dict, &subfont ); psdecoder.current_subfont = &subfont; From 6e7da50bc3e972f723fd2a3754e7e1ed0e312a21 Mon Sep 17 00:00:00 2001 From: Ewald Hew Date: Mon, 25 Sep 2017 08:29:38 +0200 Subject: [PATCH 287/470] Documentation fixes. --- include/freetype/internal/cffotypes.h | 16 ++++++++- include/freetype/internal/psaux.h | 3 -- include/freetype/internal/services/svcfftl.h | 11 +++++++ src/cid/cidgload.c | 1 + src/psaux/cffdecode.c | 9 ++++++ src/psaux/cffdecode.h | 10 ++++++ src/psaux/psarrst.c | 2 +- src/psaux/psarrst.h | 2 +- src/psaux/psblues.c | 2 +- src/psaux/psblues.h | 2 +- src/psaux/pserror.c | 2 +- src/psaux/pserror.h | 2 +- src/psaux/psfixed.h | 2 +- src/psaux/psfont.c | 2 +- src/psaux/psfont.h | 2 +- src/psaux/psft.c | 2 +- src/psaux/psft.h | 2 +- src/psaux/psglue.h | 2 +- src/psaux/pshints.c | 2 +- src/psaux/pshints.h | 2 +- src/psaux/psintrp.c | 10 +++++- src/psaux/psintrp.h | 2 +- src/psaux/psobjs.c | 2 ++ src/psaux/psread.c | 2 +- src/psaux/psread.h | 2 +- src/psaux/psstack.c | 2 +- src/psaux/psstack.h | 2 +- src/psaux/pstypes.h | 2 +- src/type1/t1gload.c | 34 ++++++++++---------- 29 files changed, 94 insertions(+), 42 deletions(-) diff --git a/include/freetype/internal/cffotypes.h b/include/freetype/internal/cffotypes.h index 32f7d32ad..570a92edf 100644 --- a/include/freetype/internal/cffotypes.h +++ b/include/freetype/internal/cffotypes.h @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* */ +/* cffotypes.h */ +/* */ +/* Basic OpenType/CFF object type definitions (specification). */ +/* */ +/* Copyright notice here. */ +/* */ +/***************************************************************************/ + + #ifndef CFFOTYPES_H_ #define CFFOTYPES_H_ @@ -84,4 +95,7 @@ FT_BEGIN_HEADER FT_END_HEADER -#endif +#endif /* CFFOTYPES_H_ */ + + +/* END */ diff --git a/include/freetype/internal/psaux.h b/include/freetype/internal/psaux.h index c287974a5..d37b6e5d4 100644 --- a/include/freetype/internal/psaux.h +++ b/include/freetype/internal/psaux.h @@ -961,7 +961,6 @@ FT_BEGIN_HEADER typedef void (*CFF_Builder_Close_Contour_Func)( CFF_Builder* builder ); - /* static */ typedef FT_Error (*CFF_Builder_Add_Contour_Func)( CFF_Builder* builder ); @@ -969,7 +968,6 @@ FT_BEGIN_HEADER typedef struct CFF_Builder_FuncsRec_ { - /* static */ void (*init)( CFF_Builder* builder, TT_Face face, @@ -977,7 +975,6 @@ FT_BEGIN_HEADER CFF_GlyphSlot glyph, FT_Bool hinting ); - /* static */ void (*done)( CFF_Builder* builder ); diff --git a/include/freetype/internal/services/svcfftl.h b/include/freetype/internal/services/svcfftl.h index 46630415a..a47debf1f 100644 --- a/include/freetype/internal/services/svcfftl.h +++ b/include/freetype/internal/services/svcfftl.h @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* */ +/* svcfftl.h */ +/* */ +/* The FreeType CFF tables loader service (specification). */ +/* */ +/* Copyright notice here */ +/* */ +/***************************************************************************/ + + #ifndef SVCFFTL_H_ #define SVCFFTL_H_ diff --git a/src/cid/cidgload.c b/src/cid/cidgload.c index 2194151a6..e8a2be3ea 100644 --- a/src/cid/cidgload.c +++ b/src/cid/cidgload.c @@ -383,6 +383,7 @@ if ( error ) goto Exit; + /* Copy flags back for forced scaling */ hinting = glyph->hint; scaled = glyph->scaled; diff --git a/src/psaux/cffdecode.c b/src/psaux/cffdecode.c index dceb91652..4fbb9d1e5 100644 --- a/src/psaux/cffdecode.c +++ b/src/psaux/cffdecode.c @@ -1,3 +1,12 @@ +/***************************************************************************/ +/* */ +/* cffdecode.c */ +/* */ +/* PostScript CFF (Type 2) decoding routines (body). */ +/* */ +/* Copyright notice here. */ +/* */ +/***************************************************************************/ #include diff --git a/src/psaux/cffdecode.h b/src/psaux/cffdecode.h index 1b021b720..4243ca699 100644 --- a/src/psaux/cffdecode.h +++ b/src/psaux/cffdecode.h @@ -1,3 +1,13 @@ +/***************************************************************************/ +/* */ +/* cffdecode.h */ +/* */ +/* PostScript CFF (Type 2) decoding routines (specification). */ +/* */ +/* Copyright notice here. */ +/* */ +/***************************************************************************/ + #ifndef CFFDECODE_H_ #define CFFDECODE_H_ diff --git a/src/psaux/psarrst.c b/src/psaux/psarrst.c index 9bd09972e..a8780947f 100644 --- a/src/psaux/psarrst.c +++ b/src/psaux/psarrst.c @@ -1,6 +1,6 @@ /***************************************************************************/ /* */ -/* cf2arrst.c */ +/* psarrst.c */ /* */ /* Adobe's code for Array Stacks (body). */ /* */ diff --git a/src/psaux/psarrst.h b/src/psaux/psarrst.h index 095938db0..b7d114079 100644 --- a/src/psaux/psarrst.h +++ b/src/psaux/psarrst.h @@ -1,6 +1,6 @@ /***************************************************************************/ /* */ -/* cf2arrst.h */ +/* psarrst.h */ /* */ /* Adobe's code for Array Stacks (specification). */ /* */ diff --git a/src/psaux/psblues.c b/src/psaux/psblues.c index 9c8b025e4..ae39d03c7 100644 --- a/src/psaux/psblues.c +++ b/src/psaux/psblues.c @@ -1,6 +1,6 @@ /***************************************************************************/ /* */ -/* cf2blues.c */ +/* psblues.c */ /* */ /* Adobe's code for handling Blue Zones (body). */ /* */ diff --git a/src/psaux/psblues.h b/src/psaux/psblues.h index 48e8be83c..888de9f30 100644 --- a/src/psaux/psblues.h +++ b/src/psaux/psblues.h @@ -1,6 +1,6 @@ /***************************************************************************/ /* */ -/* cf2blues.h */ +/* psblues.h */ /* */ /* Adobe's code for handling Blue Zones (specification). */ /* */ diff --git a/src/psaux/pserror.c b/src/psaux/pserror.c index 7b1d4b555..9169e5222 100644 --- a/src/psaux/pserror.c +++ b/src/psaux/pserror.c @@ -1,6 +1,6 @@ /***************************************************************************/ /* */ -/* cf2error.c */ +/* pserror.c */ /* */ /* Adobe's code for error handling (body). */ /* */ diff --git a/src/psaux/pserror.h b/src/psaux/pserror.h index e2a44b902..4a631b8df 100644 --- a/src/psaux/pserror.h +++ b/src/psaux/pserror.h @@ -1,6 +1,6 @@ /***************************************************************************/ /* */ -/* cf2error.h */ +/* pserror.h */ /* */ /* Adobe's code for error handling (specification). */ /* */ diff --git a/src/psaux/psfixed.h b/src/psaux/psfixed.h index a041184bd..b93163034 100644 --- a/src/psaux/psfixed.h +++ b/src/psaux/psfixed.h @@ -1,6 +1,6 @@ /***************************************************************************/ /* */ -/* cf2fixed.h */ +/* psfixed.h */ /* */ /* Adobe's code for Fixed Point Mathematics (specification only). */ /* */ diff --git a/src/psaux/psfont.c b/src/psaux/psfont.c index 093e66ea8..ff69b828d 100644 --- a/src/psaux/psfont.c +++ b/src/psaux/psfont.c @@ -1,6 +1,6 @@ /***************************************************************************/ /* */ -/* cf2font.c */ +/* psfont.c */ /* */ /* Adobe's code for font instances (body). */ /* */ diff --git a/src/psaux/psfont.h b/src/psaux/psfont.h index fc86f80ef..7f5341694 100644 --- a/src/psaux/psfont.h +++ b/src/psaux/psfont.h @@ -1,6 +1,6 @@ /***************************************************************************/ /* */ -/* cf2font.h */ +/* psfont.h */ /* */ /* Adobe's code for font instances (specification). */ /* */ diff --git a/src/psaux/psft.c b/src/psaux/psft.c index b12d9d163..fd09414d8 100644 --- a/src/psaux/psft.c +++ b/src/psaux/psft.c @@ -1,6 +1,6 @@ /***************************************************************************/ /* */ -/* cf2ft.c */ +/* psft.c */ /* */ /* FreeType Glue Component to Adobe's Interpreter (body). */ /* */ diff --git a/src/psaux/psft.h b/src/psaux/psft.h index 95e79542f..28bc49c19 100644 --- a/src/psaux/psft.h +++ b/src/psaux/psft.h @@ -1,6 +1,6 @@ /***************************************************************************/ /* */ -/* cf2ft.h */ +/* psft.h */ /* */ /* FreeType Glue Component to Adobe's Interpreter (specification). */ /* */ diff --git a/src/psaux/psglue.h b/src/psaux/psglue.h index fba67377b..4fa544527 100644 --- a/src/psaux/psglue.h +++ b/src/psaux/psglue.h @@ -1,6 +1,6 @@ /***************************************************************************/ /* */ -/* cf2glue.h */ +/* psglue.h */ /* */ /* Adobe's code for shared stuff (specification only). */ /* */ diff --git a/src/psaux/pshints.c b/src/psaux/pshints.c index f6234e7ee..cf40bc01a 100644 --- a/src/psaux/pshints.c +++ b/src/psaux/pshints.c @@ -1,6 +1,6 @@ /***************************************************************************/ /* */ -/* cf2hints.c */ +/* pshints.c */ /* */ /* Adobe's code for handling CFF hints (body). */ /* */ diff --git a/src/psaux/pshints.h b/src/psaux/pshints.h index a8984542a..02fdc53cb 100644 --- a/src/psaux/pshints.h +++ b/src/psaux/pshints.h @@ -1,6 +1,6 @@ /***************************************************************************/ /* */ -/* cf2hints.h */ +/* pshints.h */ /* */ /* Adobe's code for handling CFF hints (body). */ /* */ diff --git a/src/psaux/psintrp.c b/src/psaux/psintrp.c index 3e0590f92..61fc8f856 100644 --- a/src/psaux/psintrp.c +++ b/src/psaux/psintrp.c @@ -1,6 +1,6 @@ /***************************************************************************/ /* */ -/* cf2intrp.c */ +/* psintrp.c */ /* */ /* Adobe's CFF Interpreter (body). */ /* */ @@ -661,6 +661,9 @@ op1 == cf2_cmdENDCHAR || op1 >= 32 /* Numbers */ ) ) { + /* Skip outline commands first time round. */ + /* `endchar' will trigger initial hintmap build */ + /* and rewind the charstring. */ cf2_stack_clear( opStack ); continue; } @@ -787,6 +790,7 @@ } } + /* Add left-sidebearing correction in Type 1 mode */ cf2_doStems( font, opStack, &hStemHintArray, @@ -816,6 +820,7 @@ } } + /* Add left-sidebearing correction in Type 1 mode */ cf2_doStems( font, opStack, &vStemHintArray, @@ -1220,6 +1225,7 @@ SUB_INT32( SUB_INT32( v2, v1 ), cf2_stack_getReal( opStack, 3 ) ) ); + /* Add left-sidebearing correction */ cf2_doStems( font, opStack, isV ? &vStemHintArray : &hStemHintArray, @@ -1755,6 +1761,8 @@ if ( initial_map_ready ) { + /* do not clear hints if initial hintmap */ + /* is not ready - we need to collate all */ cf2_arrstack_clear( &vStemHintArray ); cf2_arrstack_clear( &hStemHintArray ); diff --git a/src/psaux/psintrp.h b/src/psaux/psintrp.h index 01809a92a..ec22ddcb7 100644 --- a/src/psaux/psintrp.h +++ b/src/psaux/psintrp.h @@ -1,6 +1,6 @@ /***************************************************************************/ /* */ -/* cf2font.h */ +/* psintrp.h */ /* */ /* Adobe's CFF Interpreter (specification). */ /* */ diff --git a/src/psaux/psobjs.c b/src/psaux/psobjs.c index d643afeff..a62ee231e 100644 --- a/src/psaux/psobjs.c +++ b/src/psaux/psobjs.c @@ -2409,6 +2409,8 @@ } + /* Synthesize a SubFont object for Type 1 fonts, for use in the */ + /* new interpreter to access Private dict data */ FT_LOCAL_DEF( void ) t1_make_subfont( FT_Face face, PS_Private priv, diff --git a/src/psaux/psread.c b/src/psaux/psread.c index 237ab7b34..719863ce1 100644 --- a/src/psaux/psread.c +++ b/src/psaux/psread.c @@ -1,6 +1,6 @@ /***************************************************************************/ /* */ -/* cf2read.c */ +/* psread.c */ /* */ /* Adobe's code for stream handling (body). */ /* */ diff --git a/src/psaux/psread.h b/src/psaux/psread.h index b0b0db803..9e2119509 100644 --- a/src/psaux/psread.h +++ b/src/psaux/psread.h @@ -1,6 +1,6 @@ /***************************************************************************/ /* */ -/* cf2read.h */ +/* psread.h */ /* */ /* Adobe's code for stream handling (specification). */ /* */ diff --git a/src/psaux/psstack.c b/src/psaux/psstack.c index e97ec0097..69d063349 100644 --- a/src/psaux/psstack.c +++ b/src/psaux/psstack.c @@ -1,6 +1,6 @@ /***************************************************************************/ /* */ -/* cf2stack.c */ +/* psstack.c */ /* */ /* Adobe's code for emulating a CFF stack (body). */ /* */ diff --git a/src/psaux/psstack.h b/src/psaux/psstack.h index ef08eefe4..1b9865dea 100644 --- a/src/psaux/psstack.h +++ b/src/psaux/psstack.h @@ -1,6 +1,6 @@ /***************************************************************************/ /* */ -/* cf2stack.h */ +/* psstack.h */ /* */ /* Adobe's code for emulating a CFF stack (specification). */ /* */ diff --git a/src/psaux/pstypes.h b/src/psaux/pstypes.h index 5b7e1239a..9f31493f2 100644 --- a/src/psaux/pstypes.h +++ b/src/psaux/pstypes.h @@ -1,6 +1,6 @@ /***************************************************************************/ /* */ -/* cf2types.h */ +/* pstypes.h */ /* */ /* Adobe's code for defining data types (specification only). */ /* */ diff --git a/src/type1/t1gload.c b/src/type1/t1gload.c index e5f88d0a0..341d71a0f 100644 --- a/src/type1/t1gload.c +++ b/src/type1/t1gload.c @@ -39,23 +39,6 @@ #define FT_COMPONENT trace_t1gload - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - /********** *********/ - /********** COMPUTE THE MAXIMUM ADVANCE WIDTH *********/ - /********** *********/ - /********** The following code is in charge of computing *********/ - /********** the maximum advance width of the font. It *********/ - /********** quickly processes each glyph charstring to *********/ - /********** extract the value from either a `sbw' or `seac' *********/ - /********** operator. *********/ - /********** *********/ - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - - static FT_Error T1_Parse_Glyph_And_Get_Char_String( T1_Decoder decoder, FT_UInt glyph_index, @@ -195,6 +178,23 @@ } + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + /********** *********/ + /********** COMPUTE THE MAXIMUM ADVANCE WIDTH *********/ + /********** *********/ + /********** The following code is in charge of computing *********/ + /********** the maximum advance width of the font. It *********/ + /********** quickly processes each glyph charstring to *********/ + /********** extract the value from either a `sbw' or `seac' *********/ + /********** operator. *********/ + /********** *********/ + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + + FT_LOCAL_DEF( FT_Error ) T1_Compute_Max_Advance( T1_Face face, FT_Pos* max_advance ) From a1a6a1f6799da772ae1b625ea2fb09d5f5bbce5d Mon Sep 17 00:00:00 2001 From: Ewald Hew Date: Mon, 25 Sep 2017 08:31:52 +0200 Subject: [PATCH 288/470] Minor fixes. * include/freetype/internal/psaux.h, src/psaux/psobjs.{c,h}: Rearrange `ps_builder_init' arguments to conventional order. * src/psaux/psft.c (cf2_decoder_parse_charstrings): Add a check and notice for `SubFont' in Type 1 mode. --- ChangeLog | 10 ++++++++++ include/freetype/internal/psaux.h | 6 +++--- src/psaux/psft.c | 7 +++++++ src/psaux/psobjs.c | 18 +++++++++--------- src/psaux/psobjs.h | 7 ++++--- 5 files changed, 33 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index 067ecbe6e..6930a8532 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2017-09-25 Ewald Hew + + [psaux] Minor fixes. + + * include/freetype/internal/psaux.h, src/psaux/psobjs.{c,h}: + Rearrange `ps_builder_init' arguments to conventional order. + + * src/psaux/psft.c (cf2_decoder_parse_charstrings): Add a check and + notice for `SubFont' in Type 1 mode. + 2017-09-25 Ewald Hew [psaux] Move `psdecode' into `psobjs'. diff --git a/include/freetype/internal/psaux.h b/include/freetype/internal/psaux.h index d37b6e5d4..25535475a 100644 --- a/include/freetype/internal/psaux.h +++ b/include/freetype/internal/psaux.h @@ -473,9 +473,9 @@ FT_BEGIN_HEADER typedef struct PS_Builder_FuncsRec_ { void - (*init)( void* builder, - FT_Bool is_t1, - PS_Builder* ps_builder ); + (*init)( PS_Builder* ps_builder, + void* builder, + FT_Bool is_t1 ); void (*done)( PS_Builder* builder ); diff --git a/src/psaux/psft.c b/src/psaux/psft.c index fd09414d8..89e168a94 100644 --- a/src/psaux/psft.c +++ b/src/psaux/psft.c @@ -315,6 +315,13 @@ FT_ASSERT( decoder && ( is_t1 || decoder->cff ) ); + if ( is_t1 && !decoder->current_subfont ) + { + FT_ERROR(( "cf2_decoder_parse_charstrings (Type 1): " + "SubFont missing. Use `t1_make_subfont' first\n" )); + return FT_THROW( Invalid_Table ); + } + memory = decoder->builder.memory; /* CF2 data is saved here across glyphs */ diff --git a/src/psaux/psobjs.c b/src/psaux/psobjs.c index a62ee231e..0baba7aa6 100644 --- a/src/psaux/psobjs.c +++ b/src/psaux/psobjs.c @@ -2054,9 +2054,9 @@ /* hinting :: Whether hinting should be applied. */ /* */ FT_LOCAL_DEF( void ) - ps_builder_init( void* builder, - FT_Bool is_t1, - PS_Builder* ps_builder ) + ps_builder_init( PS_Builder* ps_builder, + void* builder, + FT_Bool is_t1 ) { FT_ZERO( ps_builder ); @@ -2356,9 +2356,9 @@ { T1_Decoder t1_decoder = (T1_Decoder)decoder; - ps_builder_init( &t1_decoder->builder, - is_t1, - &ps_decoder->builder ); + ps_builder_init( &ps_decoder->builder, + &t1_decoder->builder, + is_t1 ); ps_decoder->cf2_instance = &t1_decoder->cf2_instance; ps_decoder->psnames = t1_decoder->psnames; @@ -2382,9 +2382,9 @@ { CFF_Decoder* cff_decoder = (CFF_Decoder*)decoder; - ps_builder_init( &cff_decoder->builder, - is_t1, - &ps_decoder->builder ); + ps_builder_init( &ps_decoder->builder, + &cff_decoder->builder, + is_t1 ); ps_decoder->cff = cff_decoder->cff; ps_decoder->cf2_instance = &cff_decoder->cff->cf2_instance; diff --git a/src/psaux/psobjs.h b/src/psaux/psobjs.h index 6773eacb2..e1f72407a 100644 --- a/src/psaux/psobjs.h +++ b/src/psaux/psobjs.h @@ -242,9 +242,10 @@ FT_BEGIN_HEADER /*************************************************************************/ FT_LOCAL( void ) - ps_builder_init( void* builder, - FT_Bool is_t1, - PS_Builder* ps_builder ); + ps_builder_init( PS_Builder* ps_builder, + void* builder, + FT_Bool is_t1 ); + FT_LOCAL( void ) ps_builder_done( PS_Builder* builder ); From 4cdbac05b9a17645cbecfcb18f7d1bcd573b67d6 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Mon, 25 Sep 2017 09:05:00 +0200 Subject: [PATCH 289/470] Fix compiler warnings. * src/psaux/psft.c (cf2_initLocalRegionBuffer): Remove redundant test. * src/psaux/psintrp.c (cf2_interpT2CharString) : Add casts. * src/psaux/psobjs.c (ps_decoder_init): Add cast. --- ChangeLog | 12 ++++++++++++ src/psaux/psft.c | 2 +- src/psaux/psintrp.c | 8 ++++---- src/psaux/psobjs.c | 2 +- 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6930a8532..459182d39 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2017-09-25 Werner Lemberg + + [psaux] Fix compiler warnings. + + * src/psaux/psft.c (cf2_initLocalRegionBuffer): Remove redundant + test. + + * src/psaux/psintrp.c (cf2_interpT2CharString) + : Add casts. + + * src/psaux/psobjs.c (ps_decoder_init): Add cast. + 2017-09-25 Ewald Hew [psaux] Minor fixes. diff --git a/src/psaux/psft.c b/src/psaux/psft.c index 89e168a94..8ddabc26d 100644 --- a/src/psaux/psft.c +++ b/src/psaux/psft.c @@ -793,7 +793,7 @@ FT_ZERO( buf ); idx = (CF2_UInt)( subrNum + decoder->locals_bias ); - if ( idx < 0 || idx >= decoder->num_locals ) + if ( idx >= decoder->num_locals ) return TRUE; /* error */ FT_ASSERT( decoder->locals ); diff --git a/src/psaux/psintrp.c b/src/psaux/psintrp.c index 61fc8f856..9e6718702 100644 --- a/src/psaux/psintrp.c +++ b/src/psaux/psintrp.c @@ -1642,9 +1642,9 @@ /* stack pointer as necessary */ count = cf2_stack_count( opStack ); - FT_ASSERT( arg_cnt <= count ); + FT_ASSERT( (CF2_UInt)arg_cnt <= count ); - opIdx += count - arg_cnt; + opIdx += count - (CF2_UInt)arg_cnt; known_othersubr_result_cnt = 0; result_cnt = 0; @@ -1840,7 +1840,7 @@ cf2_stack_setReal( opStack, values++, tmp ); } cf2_stack_pop( opStack, - arg_cnt - num_points ); + (CF2_UInt)arg_cnt - num_points ); known_othersubr_result_cnt = (FT_Int)num_points; break; @@ -2052,7 +2052,7 @@ default: if ( arg_cnt >= 0 && subr_no >= 0 ) { - FT_UInt i; + FT_Int i; FT_ERROR(( "cf2_interpT2CharString (Type 1 mode):" " unknown othersubr [%d %d], wish me luck\n", diff --git a/src/psaux/psobjs.c b/src/psaux/psobjs.c index 0baba7aa6..1b0b094c0 100644 --- a/src/psaux/psobjs.c +++ b/src/psaux/psobjs.c @@ -2368,7 +2368,7 @@ ps_decoder->hint_mode = t1_decoder->hint_mode; ps_decoder->blend = t1_decoder->blend; - ps_decoder->num_locals = t1_decoder->num_subrs; + ps_decoder->num_locals = (FT_UInt)t1_decoder->num_subrs; ps_decoder->locals = t1_decoder->subrs; ps_decoder->locals_len = t1_decoder->subrs_len; ps_decoder->locals_hash = t1_decoder->subrs_hash; From 12ae57d9929e36201fb1007721a7f8b50c7aa585 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Tue, 26 Sep 2017 12:53:41 +0200 Subject: [PATCH 290/470] Copyright notices, formatting, whitespace, minor doc fixes. --- include/freetype/ftpcfdrv.h | 2 +- include/freetype/ftt1drv.h | 11 +- include/freetype/ftttdrv.h | 4 +- include/freetype/internal/cffotypes.h | 19 +- include/freetype/internal/ftserv.h | 47 ++--- include/freetype/internal/psaux.h | 189 ++++++++++--------- include/freetype/internal/services/svcfftl.h | 12 +- src/psaux/psobjs.h | 2 +- 8 files changed, 157 insertions(+), 129 deletions(-) diff --git a/include/freetype/ftpcfdrv.h b/include/freetype/ftpcfdrv.h index c9d5cedec..7f602991c 100644 --- a/include/freetype/ftpcfdrv.h +++ b/include/freetype/ftpcfdrv.h @@ -69,7 +69,7 @@ FT_BEGIN_HEADER * selecting `Fixed' in KDE or Gnome one gets results that appear rather * random, the style changes often if one changes the size and one * cannot select some fonts at all. The improve this situation, the PCF - * module prepends the foundry name (plus a space) to the family name. + * module prepends the foundry name (plus a space) to the family name. * It also checks whether there are `wide' characters; all put together, * family names like `Sony Fixed' or `Misc Fixed Wide' are constructed. * diff --git a/include/freetype/ftt1drv.h b/include/freetype/ftt1drv.h index 116b33b05..e082f6b4a 100644 --- a/include/freetype/ftt1drv.h +++ b/include/freetype/ftt1drv.h @@ -4,7 +4,7 @@ /* */ /* FreeType API for controlling the Type 1 driver (specification only). */ /* */ -/* Copyright 2013-2017 by */ +/* Copyright 2017 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -32,7 +32,6 @@ FT_BEGIN_HEADER - /************************************************************************** * * @property: @@ -66,6 +65,10 @@ FT_BEGIN_HEADER * * This property can be set via the `FREETYPE_PROPERTIES' environment * variable (using values `adobe' or `freetype'). + * + * @since: + * 2.8.2 + * */ @@ -85,10 +88,14 @@ FT_BEGIN_HEADER * FT_T1_HINTING_ADOBE :: * Use the hinting engine contributed by Adobe. * + * @since: + * 2.8.2 + * */ #define FT_T1_HINTING_FREETYPE 0 #define FT_T1_HINTING_ADOBE 1 + /************************************************************************** * * @constant: diff --git a/include/freetype/ftttdrv.h b/include/freetype/ftttdrv.h index 381eee7e6..f97c70a2b 100644 --- a/include/freetype/ftttdrv.h +++ b/include/freetype/ftttdrv.h @@ -155,7 +155,7 @@ FT_BEGIN_HEADER * * Details on subpixel hinting and some of the necessary tweaks can be * found in Greg Hitchcock's whitepaper at - * `http://www.microsoft.com/typography/cleartype/truetypecleartype.aspx'. + * `http://www.microsoft.com/typography/cleartype/truetypecleartype.aspx'. * Note that FreeType currently doesn't really `subpixel hint' (6x1, 6x2, * or 6x5 supersampling) like discussed in the paper. Depending on the * chosen interpreter, it simply ignores instructions on vertical stems @@ -216,7 +216,7 @@ FT_BEGIN_HEADER * TT_INTERPRETER_VERSION_40 :: * Version~40 corresponds to MS rasterizer v.2.1; it is roughly * equivalent to the hinting provided by DirectWrite ClearType (as can - * be found, for example, in Microsoft's Edge Browser on Windows~10). + * be found, for example, in Microsoft's Edge Browser on Windows~10). * It is used in FreeType to select the `minimal' subpixel hinting * code, a stripped-down and higher performance version of the * `Infinality' code. diff --git a/include/freetype/internal/cffotypes.h b/include/freetype/internal/cffotypes.h index 570a92edf..6fd1e1c7a 100644 --- a/include/freetype/internal/cffotypes.h +++ b/include/freetype/internal/cffotypes.h @@ -4,7 +4,14 @@ /* */ /* Basic OpenType/CFF object type definitions (specification). */ /* */ -/* Copyright notice here. */ +/* Copyright 2017 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ /* */ /***************************************************************************/ @@ -54,11 +61,11 @@ FT_BEGIN_HEADER { FT_GlyphSlotRec root; - FT_Bool hint; - FT_Bool scaled; + FT_Bool hint; + FT_Bool scaled; - FT_Fixed x_scale; - FT_Fixed y_scale; + FT_Fixed x_scale; + FT_Fixed y_scale; } CFF_GlyphSlotRec, *CFF_GlyphSlot; @@ -87,7 +94,7 @@ FT_BEGIN_HEADER { FT_Fixed xx, xy; /* transformation matrix coefficients */ FT_Fixed yx, yy; - FT_F26Dot6 ox, oy; /* offsets */ + FT_F26Dot6 ox, oy; /* offsets */ } CFF_Transform; diff --git a/include/freetype/internal/ftserv.h b/include/freetype/internal/ftserv.h index 23f2878cc..5d95ee52c 100644 --- a/include/freetype/internal/ftserv.h +++ b/include/freetype/internal/ftserv.h @@ -815,26 +815,26 @@ FT_BEGIN_HEADER if ( FT_ALLOC( clazz, sizeof ( *clazz ) * 11 ) ) \ return error; \ \ - clazz[0].serv_id = serv_id_1; \ - clazz[0].serv_data = serv_data_1; \ - clazz[1].serv_id = serv_id_2; \ - clazz[1].serv_data = serv_data_2; \ - clazz[2].serv_id = serv_id_3; \ - clazz[2].serv_data = serv_data_3; \ - clazz[3].serv_id = serv_id_4; \ - clazz[3].serv_data = serv_data_4; \ - clazz[4].serv_id = serv_id_5; \ - clazz[4].serv_data = serv_data_5; \ - clazz[5].serv_id = serv_id_6; \ - clazz[5].serv_data = serv_data_6; \ - clazz[6].serv_id = serv_id_7; \ - clazz[6].serv_data = serv_data_7; \ - clazz[7].serv_id = serv_id_8; \ - clazz[7].serv_data = serv_data_8; \ - clazz[8].serv_id = serv_id_9; \ - clazz[8].serv_data = serv_data_9; \ - clazz[9].serv_id = serv_id_10; \ - clazz[9].serv_data = serv_data_10; \ + clazz[ 0].serv_id = serv_id_1; \ + clazz[ 0].serv_data = serv_data_1; \ + clazz[ 1].serv_id = serv_id_2; \ + clazz[ 1].serv_data = serv_data_2; \ + clazz[ 2].serv_id = serv_id_3; \ + clazz[ 2].serv_data = serv_data_3; \ + clazz[ 3].serv_id = serv_id_4; \ + clazz[ 3].serv_data = serv_data_4; \ + clazz[ 4].serv_id = serv_id_5; \ + clazz[ 4].serv_data = serv_data_5; \ + clazz[ 5].serv_id = serv_id_6; \ + clazz[ 5].serv_data = serv_data_6; \ + clazz[ 6].serv_id = serv_id_7; \ + clazz[ 6].serv_data = serv_data_7; \ + clazz[ 7].serv_id = serv_id_8; \ + clazz[ 7].serv_data = serv_data_8; \ + clazz[ 8].serv_id = serv_id_9; \ + clazz[ 8].serv_data = serv_data_9; \ + clazz[ 9].serv_id = serv_id_10; \ + clazz[ 9].serv_data = serv_data_10; \ clazz[10].serv_id = NULL; \ clazz[10].serv_data = NULL; \ \ @@ -986,7 +986,9 @@ FT_BEGIN_HEADER */ #define FT_SERVICE_BDF_H +#define FT_SERVICE_CFF_TABLE_LOAD_H #define FT_SERVICE_CID_H +#define FT_SERVICE_FONT_FORMAT_H #define FT_SERVICE_GLYPH_DICT_H #define FT_SERVICE_GX_VALIDATE_H #define FT_SERVICE_KERNING_H @@ -1000,11 +1002,10 @@ FT_BEGIN_HEADER #define FT_SERVICE_PROPERTIES_H #define FT_SERVICE_SFNT_H #define FT_SERVICE_TRUETYPE_ENGINE_H +#define FT_SERVICE_TRUETYPE_GLYF_H #define FT_SERVICE_TT_CMAP_H #define FT_SERVICE_WINFNT_H -#define FT_SERVICE_FONT_FORMAT_H -#define FT_SERVICE_TRUETYPE_GLYF_H -#define FT_SERVICE_CFF_TABLE_LOAD_H + /* */ FT_END_HEADER diff --git a/include/freetype/internal/psaux.h b/include/freetype/internal/psaux.h index 25535475a..46c238a5c 100644 --- a/include/freetype/internal/psaux.h +++ b/include/freetype/internal/psaux.h @@ -467,6 +467,7 @@ FT_BEGIN_HEADER /*************************************************************************/ /*************************************************************************/ + typedef struct PS_Builder_ PS_Builder; typedef const struct PS_Builder_FuncsRec_* PS_Builder_Funcs; @@ -478,7 +479,7 @@ FT_BEGIN_HEADER FT_Bool is_t1 ); void - (*done)( PS_Builder* builder ); + (*done)( PS_Builder* builder ); } PS_Builder_FuncsRec; @@ -524,6 +525,8 @@ FT_BEGIN_HEADER /* the metrics of a given glyph, not load all of its */ /* points. */ /* */ + /* is_t1 :: Set if current font type is Type 1. */ + /* */ /* funcs :: An array of function pointers for the builder. */ /* */ struct PS_Builder_ @@ -535,20 +538,19 @@ FT_BEGIN_HEADER FT_Outline* base; FT_Outline* current; - FT_Pos* pos_x; - FT_Pos* pos_y; + FT_Pos* pos_x; + FT_Pos* pos_y; - FT_Vector* left_bearing; - FT_Vector* advance; - - FT_BBox* bbox; /* bounding box */ - FT_Bool path_begun; - FT_Bool load_points; - FT_Bool no_recurse; + FT_Vector* left_bearing; + FT_Vector* advance; - FT_Bool metrics_only; + FT_BBox* bbox; /* bounding box */ + FT_Bool path_begun; + FT_Bool load_points; + FT_Bool no_recurse; - FT_Bool is_t1; + FT_Bool metrics_only; + FT_Bool is_t1; PS_Builder_FuncsRec funcs; @@ -596,64 +598,64 @@ FT_BEGIN_HEADER typedef struct PS_Decoder_ { - PS_Builder builder; + PS_Builder builder; - FT_Fixed stack[PS_MAX_OPERANDS + 1]; - FT_Fixed* top; + FT_Fixed stack[PS_MAX_OPERANDS + 1]; + FT_Fixed* top; - PS_Decoder_Zone zones[PS_MAX_SUBRS_CALLS + 1]; - PS_Decoder_Zone* zone; + PS_Decoder_Zone zones[PS_MAX_SUBRS_CALLS + 1]; + PS_Decoder_Zone* zone; - FT_Int flex_state; - FT_Int num_flex_vectors; - FT_Vector flex_vectors[7]; + FT_Int flex_state; + FT_Int num_flex_vectors; + FT_Vector flex_vectors[7]; - CFF_Font cff; - CFF_SubFont current_subfont; /* for current glyph_index */ - FT_Generic* cf2_instance; + CFF_Font cff; + CFF_SubFont current_subfont; /* for current glyph_index */ + FT_Generic* cf2_instance; - FT_Pos glyph_width; - FT_Pos nominal_width; + FT_Pos glyph_width; + FT_Pos nominal_width; - FT_Bool read_width; - FT_Bool width_only; - FT_Int num_hints; + FT_Bool read_width; + FT_Bool width_only; + FT_Int num_hints; - FT_UInt num_locals; - FT_UInt num_globals; + FT_UInt num_locals; + FT_UInt num_globals; - FT_Int locals_bias; - FT_Int globals_bias; + FT_Int locals_bias; + FT_Int globals_bias; - FT_Byte** locals; - FT_Byte** globals; + FT_Byte** locals; + FT_Byte** globals; - FT_Byte** glyph_names; /* for pure CFF fonts only */ - FT_UInt num_glyphs; /* number of glyphs in font */ + FT_Byte** glyph_names; /* for pure CFF fonts only */ + FT_UInt num_glyphs; /* number of glyphs in font */ - FT_Render_Mode hint_mode; + FT_Render_Mode hint_mode; - FT_Bool seac; + FT_Bool seac; CFF_Decoder_Get_Glyph_Callback get_glyph_callback; CFF_Decoder_Free_Glyph_Callback free_glyph_callback; /* Type 1 stuff */ - FT_Service_PsCMaps psnames; /* for seac */ + FT_Service_PsCMaps psnames; /* for seac */ - FT_Int lenIV; /* internal for sub routine calls */ - FT_UInt* locals_len; /* array of subrs length (optional) */ - FT_Hash locals_hash; /* used if `num_subrs' was massaged */ + FT_Int lenIV; /* internal for sub routine calls */ + FT_UInt* locals_len; /* array of subrs length (optional) */ + FT_Hash locals_hash; /* used if `num_subrs' was massaged */ - FT_Matrix font_matrix; - FT_Vector font_offset; + FT_Matrix font_matrix; + FT_Vector font_offset; - PS_Blend blend; /* for multiple master support */ + PS_Blend blend; /* for multiple master support */ - FT_Long* buildchar; - FT_UInt len_buildchar; + FT_Long* buildchar; + FT_UInt len_buildchar; - void* t1_parse_callback; + void* t1_parse_callback; } PS_Decoder; @@ -929,6 +931,7 @@ FT_BEGIN_HEADER } T1_DecoderRec; + /*************************************************************************/ /*************************************************************************/ /***** *****/ @@ -938,7 +941,7 @@ FT_BEGIN_HEADER /*************************************************************************/ - typedef struct CFF_Builder_ CFF_Builder; + typedef struct CFF_Builder_ CFF_Builder; typedef FT_Error @@ -1033,6 +1036,8 @@ FT_BEGIN_HEADER /* */ /* hints_globals :: Auxiliary pointer for hinting. */ /* */ + /* funcs :: A table of method pointers for this object. */ + /* */ struct CFF_Builder_ { FT_Memory memory; @@ -1042,24 +1047,24 @@ FT_BEGIN_HEADER FT_Outline* base; FT_Outline* current; - FT_Pos pos_x; - FT_Pos pos_y; + FT_Pos pos_x; + FT_Pos pos_y; - FT_Vector left_bearing; - FT_Vector advance; + FT_Vector left_bearing; + FT_Vector advance; - FT_BBox bbox; /* bounding box */ - FT_Bool path_begun; - FT_Bool load_points; - FT_Bool no_recurse; + FT_BBox bbox; /* bounding box */ - FT_Bool metrics_only; + FT_Bool path_begun; + FT_Bool load_points; + FT_Bool no_recurse; - void* hints_funcs; /* hinter-specific */ - void* hints_globals; /* hinter-specific */ + FT_Bool metrics_only; - CFF_Builder_FuncsRec funcs; + void* hints_funcs; /* hinter-specific */ + void* hints_globals; /* hinter-specific */ + CFF_Builder_FuncsRec funcs; }; @@ -1071,6 +1076,7 @@ FT_BEGIN_HEADER /*************************************************************************/ /*************************************************************************/ + #define CFF_MAX_OPERANDS 48 #define CFF_MAX_SUBRS_CALLS 16 /* maximum subroutine nesting; */ /* only 10 are allowed but there exist */ @@ -1093,61 +1099,62 @@ FT_BEGIN_HEADER typedef struct CFF_Decoder_ { - CFF_Builder builder; - CFF_Font cff; + CFF_Builder builder; + CFF_Font cff; - FT_Fixed stack[CFF_MAX_OPERANDS + 1]; - FT_Fixed* top; + FT_Fixed stack[CFF_MAX_OPERANDS + 1]; + FT_Fixed* top; CFF_Decoder_Zone zones[CFF_MAX_SUBRS_CALLS + 1]; CFF_Decoder_Zone* zone; - FT_Int flex_state; - FT_Int num_flex_vectors; - FT_Vector flex_vectors[7]; + FT_Int flex_state; + FT_Int num_flex_vectors; + FT_Vector flex_vectors[7]; - FT_Pos glyph_width; - FT_Pos nominal_width; + FT_Pos glyph_width; + FT_Pos nominal_width; - FT_Bool read_width; - FT_Bool width_only; - FT_Int num_hints; - FT_Fixed buildchar[CFF_MAX_TRANS_ELEMENTS]; + FT_Bool read_width; + FT_Bool width_only; + FT_Int num_hints; + FT_Fixed buildchar[CFF_MAX_TRANS_ELEMENTS]; - FT_UInt num_locals; - FT_UInt num_globals; + FT_UInt num_locals; + FT_UInt num_globals; - FT_Int locals_bias; - FT_Int globals_bias; + FT_Int locals_bias; + FT_Int globals_bias; - FT_Byte** locals; - FT_Byte** globals; + FT_Byte** locals; + FT_Byte** globals; - FT_Byte** glyph_names; /* for pure CFF fonts only */ - FT_UInt num_glyphs; /* number of glyphs in font */ + FT_Byte** glyph_names; /* for pure CFF fonts only */ + FT_UInt num_glyphs; /* number of glyphs in font */ - FT_Render_Mode hint_mode; + FT_Render_Mode hint_mode; - FT_Bool seac; + FT_Bool seac; - CFF_SubFont current_subfont; /* for current glyph_index */ + CFF_SubFont current_subfont; /* for current glyph_index */ CFF_Decoder_Get_Glyph_Callback get_glyph_callback; CFF_Decoder_Free_Glyph_Callback free_glyph_callback; } CFF_Decoder; + typedef const struct CFF_Decoder_FuncsRec_* CFF_Decoder_Funcs; typedef struct CFF_Decoder_FuncsRec_ { void - (*init)( CFF_Decoder* decoder, - TT_Face face, - CFF_Size size, - CFF_GlyphSlot slot, - FT_Bool hinting, - FT_Render_Mode hint_mode, + (*init)( CFF_Decoder* decoder, + TT_Face face, + CFF_Size size, + CFF_GlyphSlot slot, + FT_Bool hinting, + FT_Render_Mode hint_mode, CFF_Decoder_Get_Glyph_Callback get_callback, CFF_Decoder_Free_Glyph_Callback free_callback ); diff --git a/include/freetype/internal/services/svcfftl.h b/include/freetype/internal/services/svcfftl.h index a47debf1f..851bcde3a 100644 --- a/include/freetype/internal/services/svcfftl.h +++ b/include/freetype/internal/services/svcfftl.h @@ -4,7 +4,14 @@ /* */ /* The FreeType CFF tables loader service (specification). */ /* */ -/* Copyright notice here */ +/* Copyright 2017 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ /* */ /***************************************************************************/ @@ -96,10 +103,9 @@ FT_BEGIN_HEADER #endif /* FT_CONFIG_OPTION_PIC */ - - FT_END_HEADER + #endif diff --git a/src/psaux/psobjs.h b/src/psaux/psobjs.h index e1f72407a..08fd4fc7f 100644 --- a/src/psaux/psobjs.h +++ b/src/psaux/psobjs.h @@ -245,7 +245,7 @@ FT_BEGIN_HEADER ps_builder_init( PS_Builder* ps_builder, void* builder, FT_Bool is_t1 ); - + FT_LOCAL( void ) ps_builder_done( PS_Builder* builder ); From 693a1181d60c287e4f8e557a62b3240fbd29a8e3 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Wed, 27 Sep 2017 08:42:50 +0200 Subject: [PATCH 291/470] * src/sfnt/ttload.c (tt_face_load_font_dir): Fix compiler warning. --- ChangeLog | 4 ++++ src/sfnt/ttload.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 459182d39..c98c4900e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2017-09-27 Werner Lemberg + + * src/sfnt/ttload.c (tt_face_load_font_dir): Fix compiler warning. + 2017-09-25 Werner Lemberg [psaux] Fix compiler warnings. diff --git a/src/sfnt/ttload.c b/src/sfnt/ttload.c index df99baa53..23c8e7df9 100644 --- a/src/sfnt/ttload.c +++ b/src/sfnt/ttload.c @@ -338,7 +338,7 @@ SFNT_HeaderRec sfnt; FT_Error error; FT_Memory memory = stream->memory; - FT_UShort nn, valid_entries; + FT_UShort nn, valid_entries = 0; static const FT_Frame_Field offset_table_fields[] = { From dd40d10e81b4d96c1bfc04f0797217c9e67a161b Mon Sep 17 00:00:00 2001 From: Ewald Hew Date: Thu, 28 Sep 2017 10:42:23 +0800 Subject: [PATCH 292/470] Fix compiler warning. * src/psaux/pshints.c (cf2_hintmap_dump): Add switch for tracing code. --- ChangeLog | 7 +++++++ src/psaux/pshints.c | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/ChangeLog b/ChangeLog index c98c4900e..03adef74d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2017-09-28 Ewald Hew + + [psaux] Fix compiler warning. + + * src/psaux/pshints.c (cf2_hintmap_dump): Add switch for tracing + code. + 2017-09-27 Werner Lemberg * src/sfnt/ttload.c (tt_face_load_font_dir): Fix compiler warning. diff --git a/src/psaux/pshints.c b/src/psaux/pshints.c index cf40bc01a..c8ad4e03e 100644 --- a/src/psaux/pshints.c +++ b/src/psaux/pshints.c @@ -302,6 +302,7 @@ static void cf2_hintmap_dump( CF2_HintMap hintmap ) { +#ifdef FT_DEBUG_LEVEL_TRACE CF2_UInt i; @@ -321,6 +322,9 @@ ( cf2_hint_isLocked( hint ) ? "L" : ""), ( cf2_hint_isSynthetic( hint ) ? "S" : "" ) )); } +#else + FT_UNUSED( hintmap ); +#endif } From 61d1818b5ef4fd9b014c4577f07cf5580ba67eee Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Thu, 28 Sep 2017 00:20:50 -0400 Subject: [PATCH 293/470] Bitmap metrics presetting [1/2]. This mainly just extracts the code for presetting the bitmap metrics from the monochrome, grayscale, and LCD renderers into a separate function. * src/base/ftobjs.c (ft_glyphslot_preset_bitmap): New function that calculates prespective bitmap metrics for the given rendering mode. * include/freetype/internal/ftobjs.h (ft_glyphslot_preset_bitmap): Declare it. * src/base/ftlcdfil.c (ft_lcd_padding): New helper function that adds padding to CBox taking into account pecularities of LCD rendering. * include/freetype/ftlcdfil.h (ft_lcd_padding): Declare it. * src/raster/ftrend1.c (ft_raster1_render): Reworked to use `ft_glyphslot_preset_bitmap'. * src/smooth/ftsmooth.c (ft_smooth_render_generic): Ditto. (ft_smooth_render_lcd, ft_smooth_render_lcd): The pixel_mode setting is moved to `ft_glyphslot_preset_bitmap'. --- ChangeLog | 23 ++++ include/freetype/ftlcdfil.h | 10 ++ include/freetype/internal/ftobjs.h | 6 + src/base/ftlcdfil.c | 49 ++++++- src/base/ftobjs.c | 129 ++++++++++++++++++ src/raster/ftrend1.c | 105 +++++---------- src/smooth/ftsmooth.c | 201 ++++++++--------------------- 7 files changed, 294 insertions(+), 229 deletions(-) diff --git a/ChangeLog b/ChangeLog index 03adef74d..c1a9b328a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,26 @@ +2017-09-28 Alexei Podtelezhnikov + + Bitmap metrics presetting [1/2]. + + This mainly just extracts the code for presetting the bitmap metrics + from the monochrome, grayscale, and LCD renderers into a separate + function. + + * src/base/ftobjs.c (ft_glyphslot_preset_bitmap): New function that + calculates prespective bitmap metrics for the given rendering mode. + * include/freetype/internal/ftobjs.h (ft_glyphslot_preset_bitmap): + Declare it. + + * src/base/ftlcdfil.c (ft_lcd_padding): New helper function that adds + padding to CBox taking into account pecularities of LCD rendering. + * include/freetype/ftlcdfil.h (ft_lcd_padding): Declare it. + + * src/raster/ftrend1.c (ft_raster1_render): Reworked to use + `ft_glyphslot_preset_bitmap'. + * src/smooth/ftsmooth.c (ft_smooth_render_generic): Ditto. + (ft_smooth_render_lcd, ft_smooth_render_lcd): The pixel_mode setting + is moved to `ft_glyphslot_preset_bitmap'. + 2017-09-28 Ewald Hew [psaux] Fix compiler warning. diff --git a/include/freetype/ftlcdfil.h b/include/freetype/ftlcdfil.h index 8c751418f..df1d7ccfa 100644 --- a/include/freetype/ftlcdfil.h +++ b/include/freetype/ftlcdfil.h @@ -316,6 +316,14 @@ FT_BEGIN_HEADER typedef FT_Byte FT_LcdFiveTapFilter[FT_LCD_FILTER_FIVE_TAPS]; + + FT_BASE( void ) + ft_lcd_padding( FT_Pos* Min, + FT_Pos* Max, + FT_GlyphSlot slot ); + +#ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING + typedef void (*FT_Bitmap_LcdFilterFunc)( FT_Bitmap* bitmap, FT_Render_Mode render_mode, FT_Byte* weights ); @@ -327,6 +335,8 @@ FT_BEGIN_HEADER FT_Render_Mode mode, FT_LcdFiveTapFilter weights ); +#endif /* FT_CONFIG_OPTION_SUBPIXEL_RENDERING */ + /* */ diff --git a/include/freetype/internal/ftobjs.h b/include/freetype/internal/ftobjs.h index 25c328f4f..97c4e6756 100644 --- a/include/freetype/internal/ftobjs.h +++ b/include/freetype/internal/ftobjs.h @@ -708,6 +708,12 @@ FT_BEGIN_HEADER ft_glyphslot_free_bitmap( FT_GlyphSlot slot ); + /* Preset bitmap metrics of an outline glyphslot prior to rendering. */ + FT_BASE( void ) + ft_glyphslot_preset_bitmap( FT_GlyphSlot slot, + FT_Render_Mode mode, + const FT_Vector* origin ); + /* Allocate a new bitmap buffer in a glyph slot. */ FT_BASE( FT_Error ) ft_glyphslot_alloc_bitmap( FT_GlyphSlot slot, diff --git a/src/base/ftlcdfil.c b/src/base/ftlcdfil.c index ca781f324..4971f93b4 100644 --- a/src/base/ftlcdfil.c +++ b/src/base/ftlcdfil.c @@ -31,6 +31,39 @@ #define FT_SHIFTCLAMP( x ) ( x >>= 8, (FT_Byte)( x > 255 ? 255 : x ) ) + + /* add padding according to filter weights */ + FT_BASE_DEF (void) + ft_lcd_padding( FT_Pos* Min, + FT_Pos* Max, + FT_GlyphSlot slot ) + { + FT_Byte* lcd_weights; + FT_Bitmap_LcdFilterFunc lcd_filter_func; + + + /* Per-face LCD filtering takes priority if set up. */ + if ( slot->face && slot->face->internal->lcd_filter_func ) + { + lcd_weights = slot->face->internal->lcd_weights; + lcd_filter_func = slot->face->internal->lcd_filter_func; + } + else + { + lcd_weights = slot->library->lcd_weights; + lcd_filter_func = slot->library->lcd_filter_func; + } + + if ( lcd_filter_func == ft_lcd_filter_fir ) + { + *Min -= lcd_weights[0] ? 43 : + lcd_weights[1] ? 22 : 0; + *Max += lcd_weights[4] ? 43 : + lcd_weights[3] ? 22 : 0; + } + } + + /* FIR filter used by the default and light filters */ FT_BASE_DEF( void ) ft_lcd_filter_fir( FT_Bitmap* bitmap, @@ -310,14 +343,16 @@ #else /* !FT_CONFIG_OPTION_SUBPIXEL_RENDERING */ - FT_BASE( void ) - ft_lcd_filter_fir( FT_Bitmap* bitmap, - FT_Render_Mode mode, - FT_LcdFiveTapFilter weights ) + /* add padding according to accommodate outline shifts */ + FT_BASE_DEF (void) + ft_lcd_padding( FT_Pos* Min, + FT_Pos* Max, + FT_GlyphSlot slot ) { - FT_UNUSED( bitmap ); - FT_UNUSED( mode ); - FT_UNUSED( weights ); + FT_UNUSED( slot ); + + *Min -= 21; + *Max += 21; } diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c index aedb1f33d..42ec58e70 100644 --- a/src/base/ftobjs.c +++ b/src/base/ftobjs.c @@ -327,6 +327,135 @@ } + FT_BASE_DEF( void ) + ft_glyphslot_preset_bitmap( FT_GlyphSlot slot, + FT_Render_Mode mode, + const FT_Vector* origin ) + { + FT_Outline* outline = &slot->outline; + FT_Bitmap* bitmap = &slot->bitmap; + + FT_Pixel_Mode pixel_mode; + + FT_BBox cbox; + FT_Pos x_shift = 0; + FT_Pos y_shift = 0; + FT_Pos x_left, y_top; + FT_Pos width, height, pitch; + + + if ( slot->internal && ( slot->internal->flags & FT_GLYPH_OWN_BITMAP ) ) + return; + + if ( origin ) + { + x_shift = origin->x; + y_shift = origin->y; + } + + /* compute the control box, and grid fit it */ + /* taking into account the origin shift */ + FT_Outline_Get_CBox( outline, &cbox ); + + cbox.xMin += x_shift; + cbox.yMin += y_shift; + cbox.xMax += x_shift; + cbox.yMax += y_shift; + + switch ( mode ) + { + case FT_RENDER_MODE_MONO: + pixel_mode = FT_PIXEL_MODE_MONO; +#if 1 + /* undocumented but confirmed: bbox values get rounded */ + /* unless the rounded box can collapse for a narrow glyph */ + if ( cbox.xMax - cbox.xMin < 64 ) + { + cbox.xMin = FT_PIX_FLOOR( cbox.xMin ); + cbox.xMax = FT_PIX_CEIL( cbox.xMax ); + } + else + { + cbox.xMin = FT_PIX_ROUND( cbox.xMin ); + cbox.xMax = FT_PIX_ROUND( cbox.xMax ); + } + + if ( cbox.yMax - cbox.yMin < 64 ) + { + cbox.yMin = FT_PIX_FLOOR( cbox.yMin ); + cbox.yMax = FT_PIX_CEIL( cbox.yMax ); + } + else + { + cbox.yMin = FT_PIX_ROUND( cbox.yMin ); + cbox.yMax = FT_PIX_ROUND( cbox.yMax ); + } +#else + cbox.xMin = FT_PIX_FLOOR( cbox.xMin ); + cbox.yMin = FT_PIX_FLOOR( cbox.yMin ); + cbox.xMax = FT_PIX_CEIL( cbox.xMax ); + cbox.yMax = FT_PIX_CEIL( cbox.yMax ); +#endif + break; + + case FT_RENDER_MODE_LCD: + pixel_mode = FT_PIXEL_MODE_LCD; + ft_lcd_padding( &cbox.xMin, &cbox.xMax, slot ); + goto Round; + + case FT_RENDER_MODE_LCD_V: + pixel_mode = FT_PIXEL_MODE_LCD_V; + ft_lcd_padding( &cbox.yMin, &cbox.yMax, slot ); + goto Round; + + case FT_RENDER_MODE_NORMAL: + case FT_RENDER_MODE_LIGHT: + default: + pixel_mode = FT_PIXEL_MODE_GRAY; + Round: + cbox.xMin = FT_PIX_FLOOR( cbox.xMin ); + cbox.yMin = FT_PIX_FLOOR( cbox.yMin ); + cbox.xMax = FT_PIX_CEIL( cbox.xMax ); + cbox.yMax = FT_PIX_CEIL( cbox.yMax ); + } + + x_shift -= cbox.xMin; + y_shift -= cbox.yMin; + + x_left = cbox.xMin >> 6; + y_top = cbox.yMax >> 6; + + width = (FT_ULong)( cbox.xMax - cbox.xMin ) >> 6; + height = (FT_ULong)( cbox.yMax - cbox.yMin ) >> 6; + + switch ( pixel_mode ) + { + case FT_PIXEL_MODE_MONO: + pitch = ( ( width + 15 ) >> 4 ) << 1; + break; + case FT_PIXEL_MODE_LCD: + width *= 3; + pitch = FT_PAD_CEIL( width, 4 ); + break; + case FT_PIXEL_MODE_LCD_V: + height *= 3; + /* fall through */ + case FT_PIXEL_MODE_GRAY: + default: + pitch = width; + } + + slot->bitmap_left = (FT_Int)x_left; + slot->bitmap_top = (FT_Int)y_top; + + bitmap->pixel_mode = pixel_mode; + bitmap->num_grays = 256; + bitmap->width = (unsigned int)width; + bitmap->rows = (unsigned int)height; + bitmap->pitch = pitch; + } + + FT_BASE_DEF( void ) ft_glyphslot_set_bitmap( FT_GlyphSlot slot, FT_Byte* buffer ) diff --git a/src/raster/ftrend1.c b/src/raster/ftrend1.c index 185a7f6fc..a5b8153e8 100644 --- a/src/raster/ftrend1.c +++ b/src/raster/ftrend1.c @@ -98,11 +98,11 @@ const FT_Vector* origin ) { FT_Error error; - FT_Outline* outline; - FT_BBox cbox, cbox0; - FT_UInt width, height, pitch; - FT_Bitmap* bitmap; - FT_Memory memory; + FT_Outline* outline = &slot->outline; + FT_Bitmap* bitmap = &slot->bitmap; + FT_Memory memory = render->root.memory; + FT_Pos x_shift = 0; + FT_Pos y_shift = 0; FT_Raster_Params params; @@ -121,60 +121,6 @@ return FT_THROW( Cannot_Render_Glyph ); } - outline = &slot->outline; - - /* translate the outline to the new origin if needed */ - if ( origin ) - FT_Outline_Translate( outline, origin->x, origin->y ); - - /* compute the control box, and grid fit it */ - FT_Outline_Get_CBox( outline, &cbox0 ); - - /* undocumented but confirmed: bbox values get rounded */ -#if 1 - cbox.xMin = FT_PIX_ROUND( cbox0.xMin ); - cbox.yMin = FT_PIX_ROUND( cbox0.yMin ); - cbox.xMax = FT_PIX_ROUND( cbox0.xMax ); - cbox.yMax = FT_PIX_ROUND( cbox0.yMax ); -#else - cbox.xMin = FT_PIX_FLOOR( cbox.xMin ); - cbox.yMin = FT_PIX_FLOOR( cbox.yMin ); - cbox.xMax = FT_PIX_CEIL( cbox.xMax ); - cbox.yMax = FT_PIX_CEIL( cbox.yMax ); -#endif - - /* If either `width' or `height' round to 0, try */ - /* explicitly rounding up/down. In the case of */ - /* glyphs containing only one very narrow feature, */ - /* this gives the drop-out compensation in the scan */ - /* conversion code a chance to do its stuff. */ - width = (FT_UInt)( ( cbox.xMax - cbox.xMin ) >> 6 ); - if ( width == 0 ) - { - cbox.xMin = FT_PIX_FLOOR( cbox0.xMin ); - cbox.xMax = FT_PIX_CEIL( cbox0.xMax ); - - width = (FT_UInt)( ( cbox.xMax - cbox.xMin ) >> 6 ); - } - - height = (FT_UInt)( ( cbox.yMax - cbox.yMin ) >> 6 ); - if ( height == 0 ) - { - cbox.yMin = FT_PIX_FLOOR( cbox0.yMin ); - cbox.yMax = FT_PIX_CEIL( cbox0.yMax ); - - height = (FT_UInt)( ( cbox.yMax - cbox.yMin ) >> 6 ); - } - - if ( width > FT_USHORT_MAX || height > FT_USHORT_MAX ) - { - error = FT_THROW( Invalid_Argument ); - goto Exit; - } - - bitmap = &slot->bitmap; - memory = render->root.memory; - /* release old bitmap buffer */ if ( slot->internal->flags & FT_GLYPH_OWN_BITMAP ) { @@ -182,20 +128,26 @@ slot->internal->flags &= ~FT_GLYPH_OWN_BITMAP; } - pitch = ( ( width + 15 ) >> 4 ) << 1; - bitmap->pixel_mode = FT_PIXEL_MODE_MONO; - - bitmap->width = width; - bitmap->rows = height; - bitmap->pitch = (int)pitch; + ft_glyphslot_preset_bitmap( slot, mode, origin ); - if ( FT_ALLOC_MULT( bitmap->buffer, height, pitch ) ) + /* allocate new one */ + if ( FT_ALLOC_MULT( bitmap->buffer, bitmap->rows, bitmap->pitch ) ) goto Exit; slot->internal->flags |= FT_GLYPH_OWN_BITMAP; + x_shift = -slot->bitmap_left * 64; + y_shift = ( bitmap->rows - slot->bitmap_top ) * 64; + + if ( origin ) + { + x_shift += origin->x; + y_shift += origin->y; + } + /* translate outline to render it into the bitmap */ - FT_Outline_Translate( outline, -cbox.xMin, -cbox.yMin ); + if ( x_shift || y_shift ) + FT_Outline_Translate( outline, x_shift, y_shift ); /* set up parameters */ params.target = bitmap; @@ -204,17 +156,24 @@ /* render outline into the bitmap */ error = render->raster_render( render->raster, ¶ms ); - - FT_Outline_Translate( outline, cbox.xMin, cbox.yMin ); - if ( error ) goto Exit; - slot->format = FT_GLYPH_FORMAT_BITMAP; - slot->bitmap_left = (FT_Int)( cbox.xMin >> 6 ); - slot->bitmap_top = (FT_Int)( cbox.yMax >> 6 ); + /* everything is fine; the glyph is now officially a bitmap */ + slot->format = FT_GLYPH_FORMAT_BITMAP; + + error = FT_Err_Ok; Exit: + if ( x_shift || y_shift ) + FT_Outline_Translate( outline, -x_shift, -y_shift ); + if ( slot->format != FT_GLYPH_FORMAT_BITMAP && + slot->internal->flags & FT_GLYPH_OWN_BITMAP ) + { + FT_FREE( bitmap->buffer ); + slot->internal->flags &= ~FT_GLYPH_OWN_BITMAP; + } + return error; } diff --git a/src/smooth/ftsmooth.c b/src/smooth/ftsmooth.c index 99a9883d2..50ce44b11 100644 --- a/src/smooth/ftsmooth.c +++ b/src/smooth/ftsmooth.c @@ -101,36 +101,13 @@ FT_Outline* outline = &slot->outline; FT_Bitmap* bitmap = &slot->bitmap; FT_Memory memory = render->root.memory; - FT_BBox cbox; FT_Pos x_shift = 0; FT_Pos y_shift = 0; - FT_Pos x_left, y_top; - FT_Pos width, height, pitch; FT_Int hmul = ( mode == FT_RENDER_MODE_LCD ); FT_Int vmul = ( mode == FT_RENDER_MODE_LCD_V ); FT_Raster_Params params; - FT_Bool have_outline_shifted = FALSE; - FT_Bool have_buffer = FALSE; - -#ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING - FT_Byte* lcd_weights; - FT_Bitmap_LcdFilterFunc lcd_filter_func; - - - /* Per-face LCD filtering takes priority if set up. */ - if ( slot->face && slot->face->internal->lcd_filter_func ) - { - lcd_weights = slot->face->internal->lcd_weights; - lcd_filter_func = slot->face->internal->lcd_filter_func; - } - else - { - lcd_weights = slot->library->lcd_weights; - lcd_filter_func = slot->library->lcd_filter_func; - } -#endif /* FT_CONFIG_OPTION_SUBPIXEL_RENDERING */ /* check glyph image format */ if ( slot->format != render->glyph_format ) @@ -146,100 +123,6 @@ goto Exit; } - if ( origin ) - { - x_shift = origin->x; - y_shift = origin->y; - } - - /* compute the control box, and grid fit it */ - /* taking into account the origin shift */ - FT_Outline_Get_CBox( outline, &cbox ); - -#ifndef FT_CONFIG_OPTION_SUBPIXEL_RENDERING - - /* add minimal padding for LCD rendering */ - if ( hmul ) - { - cbox.xMax += 21; - cbox.xMin -= 21; - } - - if ( vmul ) - { - cbox.yMax += 21; - cbox.yMin -= 21; - } - -#else /* FT_CONFIG_OPTION_SUBPIXEL_RENDERING */ - - /* add minimal padding for LCD filter depending on specific weights */ - if ( lcd_filter_func == ft_lcd_filter_fir ) - { - if ( hmul ) - { - cbox.xMax += lcd_weights[4] ? 43 - : lcd_weights[3] ? 22 : 0; - cbox.xMin -= lcd_weights[0] ? 43 - : lcd_weights[1] ? 22 : 0; - } - - if ( vmul ) - { - cbox.yMax += lcd_weights[4] ? 43 - : lcd_weights[3] ? 22 : 0; - cbox.yMin -= lcd_weights[0] ? 43 - : lcd_weights[1] ? 22 : 0; - } - } - -#endif /* FT_CONFIG_OPTION_SUBPIXEL_RENDERING */ - - cbox.xMin = FT_PIX_FLOOR( cbox.xMin + x_shift ); - cbox.yMin = FT_PIX_FLOOR( cbox.yMin + y_shift ); - cbox.xMax = FT_PIX_CEIL( cbox.xMax + x_shift ); - cbox.yMax = FT_PIX_CEIL( cbox.yMax + y_shift ); - - x_shift -= cbox.xMin; - y_shift -= cbox.yMin; - - x_left = cbox.xMin >> 6; - y_top = cbox.yMax >> 6; - - width = (FT_ULong)( cbox.xMax - cbox.xMin ) >> 6; - height = (FT_ULong)( cbox.yMax - cbox.yMin ) >> 6; - - pitch = width; - if ( hmul ) - { - width *= 3; - pitch = FT_PAD_CEIL( width, 4 ); - } - - if ( vmul ) - height *= 3; - - /* - * XXX: on 16bit system, we return an error for huge bitmap - * to prevent an overflow. - */ - if ( x_left > FT_INT_MAX || y_top > FT_INT_MAX || - x_left < FT_INT_MIN || y_top < FT_INT_MIN ) - { - error = FT_THROW( Invalid_Pixel_Size ); - goto Exit; - } - - /* Required check is (pitch * height < FT_ULONG_MAX), */ - /* but we care realistic cases only. Always pitch <= width. */ - if ( width > 0x7FFF || height > 0x7FFF ) - { - FT_ERROR(( "ft_smooth_render_generic: glyph too large: %u x %u\n", - width, height )); - error = FT_THROW( Raster_Overflow ); - goto Exit; - } - /* release old bitmap buffer */ if ( slot->internal->flags & FT_GLYPH_OWN_BITMAP ) { @@ -247,30 +130,30 @@ slot->internal->flags &= ~FT_GLYPH_OWN_BITMAP; } + ft_glyphslot_preset_bitmap( slot, mode, origin ); + /* allocate new one */ - if ( FT_ALLOC( bitmap->buffer, (FT_ULong)( pitch * height ) ) ) + if ( FT_ALLOC_MULT( bitmap->buffer, bitmap->rows, bitmap->pitch ) ) goto Exit; - else - have_buffer = TRUE; slot->internal->flags |= FT_GLYPH_OWN_BITMAP; - slot->format = FT_GLYPH_FORMAT_BITMAP; - slot->bitmap_left = (FT_Int)x_left; - slot->bitmap_top = (FT_Int)y_top; + x_shift = 64 * -slot->bitmap_left; + y_shift = 64 * -slot->bitmap_top; + if ( bitmap->pixel_mode == FT_PIXEL_MODE_LCD_V ) + y_shift += 64 * bitmap->rows / 3; + else + y_shift += 64 * bitmap->rows; - bitmap->pixel_mode = FT_PIXEL_MODE_GRAY; - bitmap->num_grays = 256; - bitmap->width = (unsigned int)width; - bitmap->rows = (unsigned int)height; - bitmap->pitch = pitch; + if ( origin ) + { + x_shift += origin->x; + y_shift += origin->y; + } /* translate outline to render it into the bitmap */ if ( x_shift || y_shift ) - { FT_Outline_Translate( outline, x_shift, y_shift ); - have_outline_shifted = TRUE; - } /* set up parameters */ params.target = bitmap; @@ -317,8 +200,28 @@ if ( error ) goto Exit; - if ( lcd_filter_func ) - lcd_filter_func( bitmap, mode, lcd_weights ); + /* finally apply filtering */ + if ( hmul || vmul ) + { + FT_Byte* lcd_weights; + FT_Bitmap_LcdFilterFunc lcd_filter_func; + + + /* Per-face LCD filtering takes priority if set up. */ + if ( slot->face && slot->face->internal->lcd_filter_func ) + { + lcd_weights = slot->face->internal->lcd_weights; + lcd_filter_func = slot->face->internal->lcd_filter_func; + } + else + { + lcd_weights = slot->library->lcd_weights; + lcd_filter_func = slot->library->lcd_filter_func; + } + + if ( lcd_filter_func ) + lcd_filter_func( bitmap, mode, lcd_weights ); + } #else /* !FT_CONFIG_OPTION_SUBPIXEL_RENDERING */ @@ -328,6 +231,10 @@ FT_Byte* temp; FT_Int i, j; + unsigned int height = bitmap->rows; + unsigned int width = bitmap->width; + int pitch = bitmap->pitch; + /* Render 3 separate monochrome bitmaps, shifting the outline */ /* by 1/3 pixel. */ @@ -378,6 +285,9 @@ } else if ( vmul ) /* lcd_v */ { + int pitch = bitmap->pitch; + + /* Render 3 separate monochrome bitmaps, shifting the outline */ /* by 1/3 pixel. Triple the pitch to render on each third row. */ bitmap->pitch *= 3; @@ -418,15 +328,16 @@ #endif /* !FT_CONFIG_OPTION_SUBPIXEL_RENDERING */ - /* everything is fine; don't deallocate buffer */ - have_buffer = FALSE; + /* everything is fine; the glyph is now officially a bitmap */ + slot->format = FT_GLYPH_FORMAT_BITMAP; error = FT_Err_Ok; Exit: - if ( have_outline_shifted ) + if ( x_shift || y_shift ) FT_Outline_Translate( outline, -x_shift, -y_shift ); - if ( have_buffer ) + if ( slot->format != FT_GLYPH_FORMAT_BITMAP && + slot->internal->flags & FT_GLYPH_OWN_BITMAP ) { FT_FREE( bitmap->buffer ); slot->internal->flags &= ~FT_GLYPH_OWN_BITMAP; @@ -460,12 +371,8 @@ { FT_Error error; - error = ft_smooth_render_generic( render, slot, mode, origin, - FT_RENDER_MODE_LCD ); - if ( !error ) - slot->bitmap.pixel_mode = FT_PIXEL_MODE_LCD; - - return error; + return ft_smooth_render_generic( render, slot, mode, origin, + FT_RENDER_MODE_LCD ); } @@ -478,12 +385,8 @@ { FT_Error error; - error = ft_smooth_render_generic( render, slot, mode, origin, - FT_RENDER_MODE_LCD_V ); - if ( !error ) - slot->bitmap.pixel_mode = FT_PIXEL_MODE_LCD_V; - - return error; + return ft_smooth_render_generic( render, slot, mode, origin, + FT_RENDER_MODE_LCD_V ); } From 97cd12657daf11fea4aee85c94716e3663f94fc8 Mon Sep 17 00:00:00 2001 From: Ewald Hew Date: Thu, 28 Sep 2017 08:29:33 +0200 Subject: [PATCH 294/470] * src/cid/cidgload.c (cid_slot_load_glyph): Fix memory leak. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3489 --- ChangeLog | 8 ++++++++ src/cid/cidgload.c | 9 +++++++++ 2 files changed, 17 insertions(+) diff --git a/ChangeLog b/ChangeLog index c1a9b328a..9d0bbbb72 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2017-09-28 Ewald Hew + + * src/cid/cidgload.c (cid_slot_load_glyph): Fix memory leak. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3489 + 2017-09-28 Alexei Podtelezhnikov Bitmap metrics presetting [1/2]. diff --git a/src/cid/cidgload.c b/src/cid/cidgload.c index e8a2be3ea..f0b498874 100644 --- a/src/cid/cidgload.c +++ b/src/cid/cidgload.c @@ -335,6 +335,7 @@ PSAux_Service psaux = (PSAux_Service)face->psaux; FT_Matrix font_matrix; FT_Vector font_offset; + FT_Bool must_finish_decoder = FALSE; if ( glyph_index >= (FT_UInt)face->root.num_glyphs ) @@ -375,6 +376,8 @@ /* TODO: initialize decoder.len_buildchar and decoder.buildchar */ /* if we ever support CID-keyed multiple master fonts */ + must_finish_decoder = TRUE; + /* set up the decoder */ decoder.builder.no_recurse = FT_BOOL( ( ( load_flags & FT_LOAD_NO_RECURSE ) != 0 ) ); @@ -393,6 +396,8 @@ /* save new glyph tables */ psaux->t1_decoder_funcs->done( &decoder ); + must_finish_decoder = FALSE; + /* now set the metrics -- this is rather simple, as */ /* the left side bearing is the xMin, and the top side */ /* bearing the yMax */ @@ -501,6 +506,10 @@ } Exit: + + if ( must_finish_decoder ) + psaux->t1_decoder_funcs->done( &decoder ); + return error; } From ec7d2e5f683dab0d1471cbc1f25d0e65aae63b5d Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Thu, 28 Sep 2017 14:21:34 +0200 Subject: [PATCH 295/470] * src/psaux/psintrp.c (cf2_doStems): Fix integer overflow. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3510 --- ChangeLog | 8 ++++++++ src/psaux/psintrp.c | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9d0bbbb72..7a613b124 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2017-09-28 Werner Lemberg + + * src/psaux/psintrp.c (cf2_doStems): Fix integer overflow. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3510 + 2017-09-28 Ewald Hew * src/cid/cidgload.c (cid_slot_load_glyph): Fix memory leak. diff --git a/src/psaux/psintrp.c b/src/psaux/psintrp.c index 9e6718702..ab6ed4954 100644 --- a/src/psaux/psintrp.c +++ b/src/psaux/psintrp.c @@ -297,8 +297,8 @@ " No width. Use hsbw/sbw as first op\n" )); } if ( !font->isT1 && hasWidthArg && !*haveWidth ) - *width = cf2_stack_getReal( opStack, 0 ) + - cf2_getNominalWidthX( font->decoder ); + *width = ADD_INT32( cf2_stack_getReal( opStack, 0 ), + cf2_getNominalWidthX( font->decoder ) ); if ( font->decoder->width_only ) goto exit; From c06b9cf56d0421275f3dd39488613026f23b79f2 Mon Sep 17 00:00:00 2001 From: Ben Wagner Date: Thu, 28 Sep 2017 19:08:38 +0200 Subject: [PATCH 296/470] [truetype] Really, really fix #52082. * src/truetype/ttinterp.c (Ins_MDRP): Correct conditional. --- ChangeLog | 6 ++++++ src/truetype/ttinterp.c | 10 +++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7a613b124..19f54a9d8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2017-09-28 Ben Wagner + + [truetype] Really, really fix #52082. + + * src/truetype/ttinterp.c (Ins_MDRP): Correct conditional. + 2017-09-28 Werner Lemberg * src/psaux/psintrp.c (cf2_doStems): Fix integer overflow. diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c index 50eb246c1..2bb43ec06 100644 --- a/src/truetype/ttinterp.c +++ b/src/truetype/ttinterp.c @@ -6079,11 +6079,11 @@ /* single width cut-in test */ /* |org_dist - single_width_value| < single_width_cutin */ - if ( exc->GS.single_width_cutin > 0 && - ( org_dist < exc->GS.single_width_value + - exc->GS.single_width_cutin || - org_dist > exc->GS.single_width_value - - exc->GS.single_width_cutin ) ) + if ( exc->GS.single_width_cutin > 0 && + org_dist < exc->GS.single_width_value + + exc->GS.single_width_cutin && + org_dist > exc->GS.single_width_value - + exc->GS.single_width_cutin ) { if ( org_dist >= 0 ) org_dist = exc->GS.single_width_value; From ae7dc1f62d826083d418e86cce3f66a76dff038a Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Thu, 28 Sep 2017 22:59:31 -0400 Subject: [PATCH 297/470] [smooth, raster] Miscellaneous cleanups. * src/raster/ftrend1.c (ft_raster1_render): Clean up the exit. * src/smooth/ftsmooth.c (ft_smooth_render_generic): Reduce translations and clean up the exit. (ft_smooth_render_lcd, ft_smooth_render_lcd): Remove unused `error'.. --- ChangeLog | 9 ++++++++ src/raster/ftrend1.c | 22 ++++++++---------- src/smooth/ftsmooth.c | 52 +++++++++++++++++-------------------------- 3 files changed, 38 insertions(+), 45 deletions(-) diff --git a/ChangeLog b/ChangeLog index 19f54a9d8..dba8499e2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2017-09-28 Alexei Podtelezhnikov + + [smooth, raster] Miscellaneous cleanups. + + * src/raster/ftrend1.c (ft_raster1_render): Clean up the exit. + * src/smooth/ftsmooth.c (ft_smooth_render_generic): Reduce + translations and clean up the exit. + (ft_smooth_render_lcd, ft_smooth_render_lcd): Remove unused `error'. + 2017-09-28 Ben Wagner [truetype] Really, really fix #52082. diff --git a/src/raster/ftrend1.c b/src/raster/ftrend1.c index a5b8153e8..bbce7bb2a 100644 --- a/src/raster/ftrend1.c +++ b/src/raster/ftrend1.c @@ -97,7 +97,7 @@ FT_Render_Mode mode, const FT_Vector* origin ) { - FT_Error error; + FT_Error error = FT_Err_Ok; FT_Outline* outline = &slot->outline; FT_Bitmap* bitmap = &slot->bitmap; FT_Memory memory = render->root.memory; @@ -152,28 +152,24 @@ /* set up parameters */ params.target = bitmap; params.source = outline; - params.flags = 0; + params.flags = FT_RASTER_FLAG_DEFAULT; /* render outline into the bitmap */ error = render->raster_render( render->raster, ¶ms ); - if ( error ) - goto Exit; - - /* everything is fine; the glyph is now officially a bitmap */ - slot->format = FT_GLYPH_FORMAT_BITMAP; - - error = FT_Err_Ok; Exit: - if ( x_shift || y_shift ) - FT_Outline_Translate( outline, -x_shift, -y_shift ); - if ( slot->format != FT_GLYPH_FORMAT_BITMAP && - slot->internal->flags & FT_GLYPH_OWN_BITMAP ) + if ( !error ) + /* everything is fine; the glyph is now officially a bitmap */ + slot->format = FT_GLYPH_FORMAT_BITMAP; + else if ( slot->internal->flags & FT_GLYPH_OWN_BITMAP ) { FT_FREE( bitmap->buffer ); slot->internal->flags &= ~FT_GLYPH_OWN_BITMAP; } + if ( x_shift || y_shift ) + FT_Outline_Translate( outline, -x_shift, -y_shift ); + return error; } diff --git a/src/smooth/ftsmooth.c b/src/smooth/ftsmooth.c index 50ce44b11..7946f28bb 100644 --- a/src/smooth/ftsmooth.c +++ b/src/smooth/ftsmooth.c @@ -97,7 +97,7 @@ const FT_Vector* origin, FT_Render_Mode required_mode ) { - FT_Error error; + FT_Error error = FT_Err_Ok; FT_Outline* outline = &slot->outline; FT_Bitmap* bitmap = &slot->bitmap; FT_Memory memory = render->root.memory; @@ -240,29 +240,28 @@ /* by 1/3 pixel. */ width /= 3; - FT_Outline_Translate( outline, 21, 0 ); + bitmap->buffer += width; error = render->raster_render( render->raster, ¶ms ); if ( error ) goto Exit; FT_Outline_Translate( outline, -21, 0 ); + x_shift -= 21; bitmap->buffer += width; error = render->raster_render( render->raster, ¶ms ); if ( error ) goto Exit; - FT_Outline_Translate( outline, -21, 0 ); - bitmap->buffer += width; + FT_Outline_Translate( outline, 42, 0 ); + x_shift += 42; + bitmap->buffer -= 2 * width; error = render->raster_render( render->raster, ¶ms ); if ( error ) goto Exit; - FT_Outline_Translate( outline, 21, 0 ); - bitmap->buffer -= 2 * width; - /* XXX: Rearrange the bytes according to FT_PIXEL_MODE_LCD. */ /* XXX: It is more efficient to render every third byte above. */ @@ -293,56 +292,49 @@ bitmap->pitch *= 3; bitmap->rows /= 3; - FT_Outline_Translate( outline, 0, 21 ); - bitmap->buffer += 2 * pitch; + bitmap->buffer += pitch; error = render->raster_render( render->raster, ¶ms ); if ( error ) goto Exit; - FT_Outline_Translate( outline, 0, -21 ); - bitmap->buffer -= pitch; + FT_Outline_Translate( outline, 0, 21 ); + y_shift += 21; + bitmap->buffer += pitch; error = render->raster_render( render->raster, ¶ms ); if ( error ) goto Exit; - FT_Outline_Translate( outline, 0, -21 ); - bitmap->buffer -= pitch; + FT_Outline_Translate( outline, 0, -42 ); + y_shift -= 42; + bitmap->buffer -= 2 * pitch; error = render->raster_render( render->raster, ¶ms ); if ( error ) goto Exit; - FT_Outline_Translate( outline, 0, 21 ); - bitmap->pitch /= 3; bitmap->rows *= 3; } else /* grayscale */ - { error = render->raster_render( render->raster, ¶ms ); - if ( error ) - goto Exit; - } #endif /* !FT_CONFIG_OPTION_SUBPIXEL_RENDERING */ - /* everything is fine; the glyph is now officially a bitmap */ - slot->format = FT_GLYPH_FORMAT_BITMAP; - - error = FT_Err_Ok; - Exit: - if ( x_shift || y_shift ) - FT_Outline_Translate( outline, -x_shift, -y_shift ); - if ( slot->format != FT_GLYPH_FORMAT_BITMAP && - slot->internal->flags & FT_GLYPH_OWN_BITMAP ) + if ( !error ) + /* everything is fine; the glyph is now officially a bitmap */ + slot->format = FT_GLYPH_FORMAT_BITMAP; + else if ( slot->internal->flags & FT_GLYPH_OWN_BITMAP ) { FT_FREE( bitmap->buffer ); slot->internal->flags &= ~FT_GLYPH_OWN_BITMAP; } + if ( x_shift || y_shift ) + FT_Outline_Translate( outline, -x_shift, -y_shift ); + return error; } @@ -369,8 +361,6 @@ FT_Render_Mode mode, const FT_Vector* origin ) { - FT_Error error; - return ft_smooth_render_generic( render, slot, mode, origin, FT_RENDER_MODE_LCD ); } @@ -383,8 +373,6 @@ FT_Render_Mode mode, const FT_Vector* origin ) { - FT_Error error; - return ft_smooth_render_generic( render, slot, mode, origin, FT_RENDER_MODE_LCD_V ); } From c26f7f975b5f7f58f2b6da3d3308e3915f757a6f Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Fri, 29 Sep 2017 00:13:19 -0400 Subject: [PATCH 298/470] Bitmap metrics presetting [2/2]. * src/base/ftobjs.c (FT_Load_Glyph): Preset the bitmap metrics when appropriate but `FT_Render_Glyph' is not called. * include/freetype/freetype.h (FT_GlyphSlotRec): Document the change. --- ChangeLog | 10 +++++++++- include/freetype/freetype.h | 18 ++++++++---------- src/base/ftobjs.c | 14 ++++++++------ 3 files changed, 25 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index dba8499e2..2549d0f9a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2017-09-29 Alexei Podtelezhnikov + + Bitmap metrics presetting [2/2]. + + * src/base/ftobjs.c (FT_Load_Glyph): Preset the bitmap metrics when + appropriate but `FT_Render_Glyph' is not called. + * include/freetype/freetype.h (FT_GlyphSlotRec): Document the change. + 2017-09-28 Alexei Podtelezhnikov [smooth, raster] Miscellaneous cleanups. @@ -38,7 +46,7 @@ function. * src/base/ftobjs.c (ft_glyphslot_preset_bitmap): New function that - calculates prespective bitmap metrics for the given rendering mode. + calculates prospective bitmap metrics for the given rendering mode. * include/freetype/internal/ftobjs.h (ft_glyphslot_preset_bitmap): Declare it. diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h index de4dc3982..f6049c044 100644 --- a/include/freetype/freetype.h +++ b/include/freetype/freetype.h @@ -1696,17 +1696,13 @@ FT_BEGIN_HEADER /* @FT_GLYPH_FORMAT_COMPOSITE, but other values */ /* are possible. */ /* */ - /* bitmap :: This field is used as a bitmap descriptor */ - /* when the slot format is */ - /* @FT_GLYPH_FORMAT_BITMAP. Note that the */ - /* address and content of the bitmap buffer can */ - /* change between calls of @FT_Load_Glyph and a */ - /* few other functions. */ + /* bitmap :: This field is used as a bitmap descriptor. */ + /* Note that the address and content of the */ + /* bitmap buffer can change between calls of */ + /* @FT_Load_Glyph and a few other functions. */ /* */ /* bitmap_left :: The bitmap's left bearing expressed in */ - /* integer pixels. Only valid if the format is */ - /* @FT_GLYPH_FORMAT_BITMAP, this is, if the */ - /* glyph slot contains a bitmap. */ + /* integer pixels. */ /* */ /* bitmap_top :: The bitmap's top bearing expressed in integer */ /* pixels. This is the distance from the */ @@ -1753,7 +1749,9 @@ FT_BEGIN_HEADER /* If @FT_Load_Glyph is called with default flags (see */ /* @FT_LOAD_DEFAULT) the glyph image is loaded in the glyph slot in */ /* its native format (e.g., an outline glyph for TrueType and Type~1 */ - /* formats). */ + /* formats). [Since 2.8.2] The prospective bitmap metrics are */ + /* calculated according to @FT_LOAD_TARGET_XXX and other flags even */ + /* for the outline glyph, even if @FT_LOAD_RENDER is not set. */ /* */ /* This image can later be converted into a bitmap by calling */ /* @FT_Render_Glyph. This function searches the current renderer for */ diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c index 42ec58e70..030c0336a 100644 --- a/src/base/ftobjs.c +++ b/src/base/ftobjs.c @@ -983,20 +983,22 @@ 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 or preset the bitmap now? */ if ( !error && slot->format != FT_GLYPH_FORMAT_BITMAP && - slot->format != FT_GLYPH_FORMAT_COMPOSITE && - load_flags & FT_LOAD_RENDER ) + slot->format != FT_GLYPH_FORMAT_COMPOSITE ) { FT_Render_Mode mode = FT_LOAD_TARGET_MODE( load_flags ); - if ( mode == FT_RENDER_MODE_NORMAL && - (load_flags & FT_LOAD_MONOCHROME ) ) + if ( mode == FT_RENDER_MODE_NORMAL && + load_flags & FT_LOAD_MONOCHROME ) mode = FT_RENDER_MODE_MONO; - error = FT_Render_Glyph( slot, mode ); + if ( load_flags & FT_LOAD_RENDER ) + error = FT_Render_Glyph( slot, mode ); + else if ( ( load_flags & FT_LOAD_NO_SCALE ) == 0 ) + ft_glyphslot_preset_bitmap( slot, mode, NULL ); } Exit: From c8d8e15803b0881809b3e15309795f8705471c32 Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Sat, 30 Sep 2017 14:28:58 -0400 Subject: [PATCH 299/470] Signedness fixes in bitmap presetting. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3514. * src/raster/ftrend1.c (ft_raster1_render): Exlicitly signed height. * src/smooth/ftsmooth.c (ft_smooth_render_generic): Ditto. * src/base/ftobjs.c (ft_glyphslot_preset_bitmap): Explicitly unsigned subtraction. --- ChangeLog | 13 +++++++++++++ src/base/ftobjs.c | 4 ++-- src/raster/ftrend1.c | 2 +- src/smooth/ftsmooth.c | 4 ++-- 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2549d0f9a..dac2e7dc6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2017-09-30 Alexei Podtelezhnikov + + Signedness fixes in bitmap presetting. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3514. + + * src/raster/ftrend1.c (ft_raster1_render): Exlicitly signed height. + * src/smooth/ftsmooth.c (ft_smooth_render_generic): Ditto. + * src/base/ftobjs.c (ft_glyphslot_preset_bitmap): Explicitly unsigned + subtraction. + 2017-09-29 Alexei Podtelezhnikov Bitmap metrics presetting [2/2]. diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c index 030c0336a..5722c55ba 100644 --- a/src/base/ftobjs.c +++ b/src/base/ftobjs.c @@ -425,8 +425,8 @@ x_left = cbox.xMin >> 6; y_top = cbox.yMax >> 6; - width = (FT_ULong)( cbox.xMax - cbox.xMin ) >> 6; - height = (FT_ULong)( cbox.yMax - cbox.yMin ) >> 6; + width = ( (FT_ULong)cbox.xMax - (FT_ULong)cbox.xMin ) >> 6; + height = ( (FT_ULong)cbox.yMax - (FT_ULong)cbox.yMin ) >> 6; switch ( pixel_mode ) { diff --git a/src/raster/ftrend1.c b/src/raster/ftrend1.c index bbce7bb2a..ede49167e 100644 --- a/src/raster/ftrend1.c +++ b/src/raster/ftrend1.c @@ -137,7 +137,7 @@ slot->internal->flags |= FT_GLYPH_OWN_BITMAP; x_shift = -slot->bitmap_left * 64; - y_shift = ( bitmap->rows - slot->bitmap_top ) * 64; + y_shift = ( (FT_Int)bitmap->rows - slot->bitmap_top ) * 64; if ( origin ) { diff --git a/src/smooth/ftsmooth.c b/src/smooth/ftsmooth.c index 7946f28bb..db3a1c31d 100644 --- a/src/smooth/ftsmooth.c +++ b/src/smooth/ftsmooth.c @@ -141,9 +141,9 @@ x_shift = 64 * -slot->bitmap_left; y_shift = 64 * -slot->bitmap_top; if ( bitmap->pixel_mode == FT_PIXEL_MODE_LCD_V ) - y_shift += 64 * bitmap->rows / 3; + y_shift += 64 * (FT_Int)bitmap->rows / 3; else - y_shift += 64 * bitmap->rows; + y_shift += 64 * (FT_Int)bitmap->rows; if ( origin ) { From 2127f07624b678c6228f4dca483b3b87f3f85f99 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sat, 30 Sep 2017 16:16:03 +0200 Subject: [PATCH 300/470] [include] Whitespace. --- include/freetype/config/ftconfig.h | 26 ++++++++--------- include/freetype/ftbitmap.h | 2 +- include/freetype/ftcid.h | 2 +- include/freetype/ftgxval.h | 8 ++--- include/freetype/fttypes.h | 2 +- include/freetype/internal/ftmemory.h | 2 +- include/freetype/internal/ftobjs.h | 29 ++++++++++--------- include/freetype/internal/ftserv.h | 12 ++++---- include/freetype/internal/ftstream.h | 4 +-- include/freetype/internal/services/svgldict.h | 4 +-- 10 files changed, 46 insertions(+), 45 deletions(-) diff --git a/include/freetype/config/ftconfig.h b/include/freetype/config/ftconfig.h index 6c7a3b792..6967b5fb7 100644 --- a/include/freetype/config/ftconfig.h +++ b/include/freetype/config/ftconfig.h @@ -73,11 +73,11 @@ FT_BEGIN_HEADER /* The size of an `int' type. */ #if FT_UINT_MAX == 0xFFFFUL -#define FT_SIZEOF_INT (16 / FT_CHAR_BIT) +#define FT_SIZEOF_INT ( 16 / FT_CHAR_BIT ) #elif FT_UINT_MAX == 0xFFFFFFFFUL -#define FT_SIZEOF_INT (32 / FT_CHAR_BIT) +#define FT_SIZEOF_INT ( 32 / FT_CHAR_BIT ) #elif FT_UINT_MAX > 0xFFFFFFFFUL && FT_UINT_MAX == 0xFFFFFFFFFFFFFFFFUL -#define FT_SIZEOF_INT (64 / FT_CHAR_BIT) +#define FT_SIZEOF_INT ( 64 / FT_CHAR_BIT ) #else #error "Unsupported size of `int' type!" #endif @@ -85,11 +85,11 @@ FT_BEGIN_HEADER /* The size of a `long' type. A five-byte `long' (as used e.g. on the */ /* DM642) is recognized but avoided. */ #if FT_ULONG_MAX == 0xFFFFFFFFUL -#define FT_SIZEOF_LONG (32 / FT_CHAR_BIT) +#define FT_SIZEOF_LONG ( 32 / FT_CHAR_BIT ) #elif FT_ULONG_MAX > 0xFFFFFFFFUL && FT_ULONG_MAX == 0xFFFFFFFFFFUL -#define FT_SIZEOF_LONG (32 / FT_CHAR_BIT) +#define FT_SIZEOF_LONG ( 32 / FT_CHAR_BIT ) #elif FT_ULONG_MAX > 0xFFFFFFFFUL && FT_ULONG_MAX == 0xFFFFFFFFFFFFFFFFUL -#define FT_SIZEOF_LONG (64 / FT_CHAR_BIT) +#define FT_SIZEOF_LONG ( 64 / FT_CHAR_BIT ) #else #error "Unsupported size of `long' type!" #endif @@ -236,12 +236,12 @@ FT_BEGIN_HEADER #endif -#if FT_SIZEOF_INT == (32 / FT_CHAR_BIT) +#if FT_SIZEOF_INT == ( 32 / FT_CHAR_BIT ) typedef signed int FT_Int32; typedef unsigned int FT_UInt32; -#elif FT_SIZEOF_LONG == (32 / FT_CHAR_BIT) +#elif FT_SIZEOF_LONG == ( 32 / FT_CHAR_BIT ) typedef signed long FT_Int32; typedef unsigned long FT_UInt32; @@ -252,12 +252,12 @@ FT_BEGIN_HEADER /* look up an integer type that is at least 32 bits */ -#if FT_SIZEOF_INT >= (32 / FT_CHAR_BIT) +#if FT_SIZEOF_INT >= ( 32 / FT_CHAR_BIT ) typedef int FT_Fast; typedef unsigned int FT_UFast; -#elif FT_SIZEOF_LONG >= (32 / FT_CHAR_BIT) +#elif FT_SIZEOF_LONG >= ( 32 / FT_CHAR_BIT ) typedef long FT_Fast; typedef unsigned long FT_UFast; @@ -267,7 +267,7 @@ FT_BEGIN_HEADER /* determine whether we have a 64-bit int type for platforms without */ /* Autoconf */ -#if FT_SIZEOF_LONG == (64 / FT_CHAR_BIT) +#if FT_SIZEOF_LONG == ( 64 / FT_CHAR_BIT ) /* FT_LONG64 must be defined if a 64-bit type is available */ #define FT_LONG64 @@ -440,7 +440,7 @@ FT_BEGIN_HEADER #ifndef FT_EXPORT #if defined( _DLL ) -#define FT_EXPORT( x ) __declspec(dllexport) x +#define FT_EXPORT( x ) __declspec( dllexport ) x #elif defined( __cplusplus ) #define FT_EXPORT( x ) extern "C" x #else @@ -453,7 +453,7 @@ FT_BEGIN_HEADER #ifndef FT_EXPORT_DEF #if defined( _DLL ) -#define FT_EXPORT_DEF( x ) __declspec(dllexport) x +#define FT_EXPORT_DEF( x ) __declspec( dllexport ) x #elif defined( __cplusplus ) #define FT_EXPORT_DEF( x ) extern "C" x #else diff --git a/include/freetype/ftbitmap.h b/include/freetype/ftbitmap.h index 04b2402ad..bb778cc0d 100644 --- a/include/freetype/ftbitmap.h +++ b/include/freetype/ftbitmap.h @@ -97,7 +97,7 @@ FT_BEGIN_HEADER FT_EXPORT( FT_Error ) FT_Bitmap_Copy( FT_Library library, const FT_Bitmap *source, - FT_Bitmap *target); + FT_Bitmap *target ); /*************************************************************************/ diff --git a/include/freetype/ftcid.h b/include/freetype/ftcid.h index 4adcbeeda..fb9b0c24c 100644 --- a/include/freetype/ftcid.h +++ b/include/freetype/ftcid.h @@ -87,7 +87,7 @@ FT_BEGIN_HEADER FT_Get_CID_Registry_Ordering_Supplement( FT_Face face, const char* *registry, const char* *ordering, - FT_Int *supplement); + FT_Int *supplement ); /********************************************************************** diff --git a/include/freetype/ftgxval.h b/include/freetype/ftgxval.h index f239c71eb..97c493c96 100644 --- a/include/freetype/ftgxval.h +++ b/include/freetype/ftgxval.h @@ -101,15 +101,15 @@ FT_BEGIN_HEADER * The number of tables checked in this module. Use it as a parameter * for the `table-length' argument of function @FT_TrueTypeGX_Validate. */ -#define FT_VALIDATE_GX_LENGTH (FT_VALIDATE_GX_LAST_INDEX + 1) +#define FT_VALIDATE_GX_LENGTH ( FT_VALIDATE_GX_LAST_INDEX + 1 ) /* */ /* Up to 0x1000 is used by otvalid. Ox2xxx is reserved for feature OT extension. */ -#define FT_VALIDATE_GX_START 0x4000 -#define FT_VALIDATE_GX_BITFIELD( tag ) \ - ( FT_VALIDATE_GX_START << FT_VALIDATE_##tag##_INDEX ) +#define FT_VALIDATE_GX_START 0x4000 +#define FT_VALIDATE_GX_BITFIELD( tag ) \ + ( FT_VALIDATE_GX_START << FT_VALIDATE_##tag##_INDEX ) /********************************************************************** diff --git a/include/freetype/fttypes.h b/include/freetype/fttypes.h index eab8adaad..8f904cea4 100644 --- a/include/freetype/fttypes.h +++ b/include/freetype/fttypes.h @@ -425,7 +425,7 @@ FT_BEGIN_HEADER /* The address of the FreeType object that is under finalization. */ /* Its client data is accessed through its `generic' field. */ /* */ - typedef void (*FT_Generic_Finalizer)(void* object); + typedef void (*FT_Generic_Finalizer)( void* object ); /*************************************************************************/ diff --git a/include/freetype/internal/ftmemory.h b/include/freetype/internal/ftmemory.h index 59e5b58a5..7a5459f39 100644 --- a/include/freetype/internal/ftmemory.h +++ b/include/freetype/internal/ftmemory.h @@ -210,7 +210,7 @@ extern "C++" NULL, \ &error ) ) -#define FT_MEM_QREALLOC_MULT( ptr, oldcnt, newcnt, itmsz) \ +#define FT_MEM_QREALLOC_MULT( ptr, oldcnt, newcnt, itmsz ) \ FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, \ (FT_Long)(itmsz), \ (FT_Long)(oldcnt), \ diff --git a/include/freetype/internal/ftobjs.h b/include/freetype/internal/ftobjs.h index 97c4e6756..538f48353 100644 --- a/include/freetype/internal/ftobjs.h +++ b/include/freetype/internal/ftobjs.h @@ -85,9 +85,9 @@ FT_BEGIN_HEADER : y + ( 3 * x >> 3 ) ) /* we use FT_TYPEOF to suppress signedness compilation warnings */ -#define FT_PAD_FLOOR( x, n ) ( (x) & ~FT_TYPEOF( x )( (n)-1 ) ) -#define FT_PAD_ROUND( x, n ) FT_PAD_FLOOR( (x) + (n)/2, n ) -#define FT_PAD_CEIL( x, n ) FT_PAD_FLOOR( (x) + (n)-1, n ) +#define FT_PAD_FLOOR( x, n ) ( (x) & ~FT_TYPEOF( x )( (n) - 1 ) ) +#define FT_PAD_ROUND( x, n ) FT_PAD_FLOOR( (x) + (n) / 2, n ) +#define FT_PAD_CEIL( x, n ) FT_PAD_FLOOR( (x) + (n) - 1, n ) #define FT_PIX_FLOOR( x ) ( (x) & ~FT_TYPEOF( x )63 ) #define FT_PIX_ROUND( x ) FT_PIX_FLOOR( (x) + 32 ) @@ -156,7 +156,7 @@ FT_BEGIN_HEADER } FT_CMapRec; /* typecase any pointer to a charmap handle */ -#define FT_CMAP( x ) ((FT_CMap)( x )) +#define FT_CMAP( x ) ( (FT_CMap)( x ) ) /* obvious macros */ #define FT_CMAP_PLATFORM_ID( x ) FT_CMAP( x )->charmap.platform_id @@ -519,7 +519,8 @@ FT_BEGIN_HEADER /* typecast an object to an FT_Module */ -#define FT_MODULE( x ) ((FT_Module)( x )) +#define FT_MODULE( x ) ( (FT_Module)(x) ) + #define FT_MODULE_CLASS( x ) FT_MODULE( x )->clazz #define FT_MODULE_LIBRARY( x ) FT_MODULE( x )->library #define FT_MODULE_MEMORY( x ) FT_MODULE( x )->memory @@ -605,9 +606,9 @@ FT_BEGIN_HEADER /* a few macros used to perform easy typecasts with minimal brain damage */ -#define FT_FACE( x ) ((FT_Face)(x)) -#define FT_SIZE( x ) ((FT_Size)(x)) -#define FT_SLOT( x ) ((FT_GlyphSlot)(x)) +#define FT_FACE( x ) ( (FT_Face)(x) ) +#define FT_SIZE( x ) ( (FT_Size)(x) ) +#define FT_SLOT( x ) ( (FT_GlyphSlot)(x) ) #define FT_FACE_DRIVER( x ) FT_FACE( x )->driver #define FT_FACE_LIBRARY( x ) FT_FACE_DRIVER( x )->root.library @@ -708,7 +709,7 @@ FT_BEGIN_HEADER ft_glyphslot_free_bitmap( FT_GlyphSlot slot ); - /* Preset bitmap metrics of an outline glyphslot prior to rendering. */ + /* Preset bitmap metrics of an outline glyphslot prior to rendering. */ FT_BASE( void ) ft_glyphslot_preset_bitmap( FT_GlyphSlot slot, FT_Render_Mode mode, @@ -740,10 +741,10 @@ FT_BEGIN_HEADER /*************************************************************************/ -#define FT_RENDERER( x ) ((FT_Renderer)( x )) -#define FT_GLYPH( x ) ((FT_Glyph)( x )) -#define FT_BITMAP_GLYPH( x ) ((FT_BitmapGlyph)( x )) -#define FT_OUTLINE_GLYPH( x ) ((FT_OutlineGlyph)( x )) +#define FT_RENDERER( x ) ( (FT_Renderer)(x) ) +#define FT_GLYPH( x ) ( (FT_Glyph)(x) ) +#define FT_BITMAP_GLYPH( x ) ( (FT_BitmapGlyph)(x) ) +#define FT_OUTLINE_GLYPH( x ) ( (FT_OutlineGlyph)(x) ) typedef struct FT_RendererRec_ @@ -774,7 +775,7 @@ FT_BEGIN_HEADER /* typecast a module into a driver easily */ -#define FT_DRIVER( x ) ((FT_Driver)(x)) +#define FT_DRIVER( x ) ( (FT_Driver)(x) ) /* typecast a module as a driver, and get its driver class */ #define FT_DRIVER_CLASS( x ) FT_DRIVER( x )->clazz diff --git a/include/freetype/internal/ftserv.h b/include/freetype/internal/ftserv.h index 5d95ee52c..e91d8a7ba 100644 --- a/include/freetype/internal/ftserv.h +++ b/include/freetype/internal/ftserv.h @@ -340,7 +340,7 @@ FT_BEGIN_HEADER serv_id_7, serv_data_7, \ serv_id_8, serv_data_8, \ serv_id_9, serv_data_9, \ - serv_id_10, serv_data_10) \ + serv_id_10, serv_data_10 ) \ static const FT_ServiceDescRec class_[] = \ { \ { serv_id_1, serv_data_1 }, \ @@ -583,7 +583,7 @@ FT_BEGIN_HEADER \ FT_Error \ FT_Create_Class_ ## class_( FT_Library library, \ - FT_ServiceDescRec** output_class) \ + FT_ServiceDescRec** output_class ) \ { \ FT_ServiceDescRec* clazz = NULL; \ FT_Error error; \ @@ -634,7 +634,7 @@ FT_BEGIN_HEADER \ FT_Error \ FT_Create_Class_ ## class_( FT_Library library, \ - FT_ServiceDescRec** output_class) \ + FT_ServiceDescRec** output_class ) \ { \ FT_ServiceDescRec* clazz = NULL; \ FT_Error error; \ @@ -688,7 +688,7 @@ FT_BEGIN_HEADER \ FT_Error \ FT_Create_Class_ ## class_( FT_Library library, \ - FT_ServiceDescRec** output_class) \ + FT_ServiceDescRec** output_class ) \ { \ FT_ServiceDescRec* clazz = NULL; \ FT_Error error; \ @@ -745,7 +745,7 @@ FT_BEGIN_HEADER \ FT_Error \ FT_Create_Class_ ## class_( FT_Library library, \ - FT_ServiceDescRec** output_class) \ + FT_ServiceDescRec** output_class ) \ { \ FT_ServiceDescRec* clazz = NULL; \ FT_Error error; \ @@ -805,7 +805,7 @@ FT_BEGIN_HEADER \ FT_Error \ FT_Create_Class_ ## class_( FT_Library library, \ - FT_ServiceDescRec** output_class) \ + FT_ServiceDescRec** output_class ) \ { \ FT_ServiceDescRec* clazz = NULL; \ FT_Error error; \ diff --git a/include/freetype/internal/ftstream.h b/include/freetype/internal/ftstream.h index 3e2c07b26..8acc1bec5 100644 --- a/include/freetype/internal/ftstream.h +++ b/include/freetype/internal/ftstream.h @@ -165,8 +165,8 @@ FT_BEGIN_HEADER #define FT_BYTE_U32( p, i, s ) ( FT_UINT32( FT_BYTE_( p, i ) ) << (s) ) -#define FT_PEEK_SHORT( p ) FT_INT16( FT_BYTE_U16( p, 0, 8) | \ - FT_BYTE_U16( p, 1, 0) ) +#define FT_PEEK_SHORT( p ) FT_INT16( FT_BYTE_U16( p, 0, 8 ) | \ + FT_BYTE_U16( p, 1, 0 ) ) #define FT_PEEK_USHORT( p ) FT_UINT16( FT_BYTE_U16( p, 0, 8 ) | \ FT_BYTE_U16( p, 1, 0 ) ) diff --git a/include/freetype/internal/services/svgldict.h b/include/freetype/internal/services/svgldict.h index 0cd13618d..3371c6b86 100644 --- a/include/freetype/internal/services/svgldict.h +++ b/include/freetype/internal/services/svgldict.h @@ -56,7 +56,7 @@ FT_BEGIN_HEADER #define FT_DEFINE_SERVICE_GLYPHDICTREC( class_, \ get_name_, \ - name_index_) \ + name_index_ ) \ static const FT_Service_GlyphDictRec class_ = \ { \ get_name_, name_index_ \ @@ -66,7 +66,7 @@ FT_BEGIN_HEADER #define FT_DEFINE_SERVICE_GLYPHDICTREC( class_, \ get_name_, \ - name_index_) \ + name_index_ ) \ void \ FT_Init_Class_ ## class_( FT_Library library, \ FT_Service_GlyphDictRec* clazz ) \ From 9b549fa69a9ef7518fb28a77641127f1ccbdc3c5 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sat, 30 Sep 2017 16:36:28 +0200 Subject: [PATCH 301/470] [base,cff,cid] Whitespace, formatting. --- src/base/ftobjs.c | 23 +++++++++++++---------- src/cff/cffdrivr.c | 19 ++++++++++--------- src/cff/cffgload.c | 1 + src/cff/cffload.c | 3 ++- src/cff/cffobjs.c | 12 ++++++------ src/cff/cffparse.c | 12 ++++-------- src/cid/cidgload.c | 42 ++++++++++++++++++++++++------------------ 7 files changed, 60 insertions(+), 52 deletions(-) diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c index 5722c55ba..79e751120 100644 --- a/src/base/ftobjs.c +++ b/src/base/ftobjs.c @@ -337,11 +337,11 @@ FT_Pixel_Mode pixel_mode; - FT_BBox cbox; - FT_Pos x_shift = 0; - FT_Pos y_shift = 0; - FT_Pos x_left, y_top; - FT_Pos width, height, pitch; + FT_BBox cbox; + FT_Pos x_shift = 0; + FT_Pos y_shift = 0; + FT_Pos x_left, y_top; + FT_Pos width, height, pitch; if ( slot->internal && ( slot->internal->flags & FT_GLYPH_OWN_BITMAP ) ) @@ -353,8 +353,8 @@ y_shift = origin->y; } - /* compute the control box, and grid fit it */ - /* taking into account the origin shift */ + /* compute the control box, and grid-fit it, */ + /* taking into account the origin shift */ FT_Outline_Get_CBox( outline, &cbox ); cbox.xMin += x_shift; @@ -422,8 +422,8 @@ x_shift -= cbox.xMin; y_shift -= cbox.yMin; - x_left = cbox.xMin >> 6; - y_top = cbox.yMax >> 6; + x_left = cbox.xMin >> 6; + y_top = cbox.yMax >> 6; width = ( (FT_ULong)cbox.xMax - (FT_ULong)cbox.xMin ) >> 6; height = ( (FT_ULong)cbox.yMax - (FT_ULong)cbox.yMin ) >> 6; @@ -431,15 +431,18 @@ switch ( pixel_mode ) { case FT_PIXEL_MODE_MONO: - pitch = ( ( width + 15 ) >> 4 ) << 1; + pitch = ( ( width + 15 ) >> 4 ) << 1; break; + case FT_PIXEL_MODE_LCD: width *= 3; pitch = FT_PAD_CEIL( width, 4 ); break; + case FT_PIXEL_MODE_LCD_V: height *= 3; /* fall through */ + case FT_PIXEL_MODE_GRAY: default: pitch = width; diff --git a/src/cff/cffdrivr.c b/src/cff/cffdrivr.c index 419cdfdcb..340de9c06 100644 --- a/src/cff/cffdrivr.c +++ b/src/cff/cffdrivr.c @@ -744,8 +744,8 @@ const void* value, FT_Bool value_is_string ) { - FT_Error error = FT_Err_Ok; - PS_Driver driver = (PS_Driver)module; + FT_Error error = FT_Err_Ok; + PS_Driver driver = (PS_Driver)module; #ifndef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES FT_UNUSED( value_is_string ); @@ -910,8 +910,8 @@ const char* property_name, const void* value ) { - FT_Error error = FT_Err_Ok; - PS_Driver driver = (PS_Driver)module; + FT_Error error = FT_Err_Ok; + PS_Driver driver = (PS_Driver)module; if ( !ft_strcmp( property_name, "darkening-parameters" ) ) @@ -1099,13 +1099,14 @@ FT_DEFINE_SERVICE_CFFLOADREC( cff_service_cff_load, - (FT_Get_Standard_Encoding_Func) cff_get_standard_encoding, - (FT_Load_Private_Dict_Func) cff_load_private_dict, - (FT_FD_Select_Get_Func) cff_fd_select_get, - (FT_Blend_Check_Vector_Func) cff_blend_check_vector, - (FT_Blend_Build_Vector_Func) cff_blend_build_vector + (FT_Get_Standard_Encoding_Func)cff_get_standard_encoding, + (FT_Load_Private_Dict_Func) cff_load_private_dict, + (FT_FD_Select_Get_Func) cff_fd_select_get, + (FT_Blend_Check_Vector_Func) cff_blend_check_vector, + (FT_Blend_Build_Vector_Func) cff_blend_build_vector ) + /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ diff --git a/src/cff/cffgload.c b/src/cff/cffgload.c index 9a2080b21..5429460cc 100644 --- a/src/cff/cffgload.c +++ b/src/cff/cffgload.c @@ -145,6 +145,7 @@ PSAux_Service psaux = (PSAux_Service)face->psaux; const CFF_Decoder_Funcs decoder_funcs = psaux->cff_decoder_funcs; + *max_advance = 0; /* Initialize load decoder */ diff --git a/src/cff/cffload.c b/src/cff/cffload.c index 21dd42366..0875ead7f 100644 --- a/src/cff/cffload.c +++ b/src/cff/cffload.c @@ -2097,7 +2097,8 @@ do { face->root.internal->random_seed = - (FT_Int32)psaux->cff_random( (FT_UInt32)face->root.internal->random_seed ); + (FT_Int32)psaux->cff_random( + (FT_UInt32)face->root.internal->random_seed ); } while ( face->root.internal->random_seed < 0 ); } diff --git a/src/cff/cffobjs.c b/src/cff/cffobjs.c index 29a14f954..c794d3239 100644 --- a/src/cff/cffobjs.c +++ b/src/cff/cffobjs.c @@ -504,8 +504,8 @@ FT_Library library = cffface->driver->root.library; - sfnt = (SFNT_Service)FT_Get_Module_Interface( - library, "sfnt" ); + sfnt = (SFNT_Service)FT_Get_Module_Interface( library, + "sfnt" ); if ( !sfnt ) { FT_ERROR(( "cff_face_init: cannot access `sfnt' module\n" )); @@ -515,11 +515,11 @@ FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_CMAPS ); - pshinter = (PSHinter_Service)FT_Get_Module_Interface( - library, "pshinter" ); + pshinter = (PSHinter_Service)FT_Get_Module_Interface( library, + "pshinter" ); - psaux = (PSAux_Service)FT_Get_Module_Interface( - library, "psaux" ); + psaux = (PSAux_Service)FT_Get_Module_Interface( library, + "psaux" ); if ( !psaux ) { FT_ERROR(( "cff_face_init: cannot access `psaux' module\n" )); diff --git a/src/cff/cffparse.c b/src/cff/cffparse.c index 888b2d5d9..e4e2bcd0b 100644 --- a/src/cff/cffparse.c +++ b/src/cff/cffparse.c @@ -1303,12 +1303,11 @@ PSAux_Service psaux; #endif - FT_Byte* p = start; FT_Error error = FT_Err_Ok; FT_Library library = parser->library; - FT_UNUSED( library ); + FT_UNUSED( library ); parser->top = parser->stack; @@ -1394,8 +1393,7 @@ cff_rec.top_font.font_dict.num_axes = parser->num_axes; decoder.cff = &cff_rec; - psaux = (PSAux_Service)FT_Get_Module_Interface( - library, "psaux" ); + psaux = (PSAux_Service)FT_Get_Module_Interface( library, "psaux" ); if ( !psaux ) { FT_ERROR(( "cff_parser_run: cannot access `psaux' module\n" )); @@ -1403,10 +1401,8 @@ goto Exit; } - error = psaux->cff_decoder_funcs->parse_charstrings_old( &decoder, - charstring_base, - charstring_len, - 1 ); + error = psaux->cff_decoder_funcs->parse_charstrings_old( + &decoder, charstring_base, charstring_len, 1 ); /* Now copy the stack data in the temporary decoder object, */ /* converting it back to charstring number representations */ diff --git a/src/cid/cidgload.c b/src/cid/cidgload.c index f0b498874..8541cca5a 100644 --- a/src/cid/cidgload.c +++ b/src/cid/cidgload.c @@ -56,11 +56,11 @@ FT_ULong glyph_length = 0; PSAux_Service psaux = (PSAux_Service)face->psaux; - FT_Bool force_scaling = FALSE; + FT_Bool force_scaling = FALSE; #ifdef FT_CONFIG_OPTION_INCREMENTAL - FT_Incremental_InterfaceRec *inc = - face->root.internal->incremental_interface; + FT_Incremental_InterfaceRec *inc = + face->root.internal->incremental_interface; #endif @@ -176,11 +176,13 @@ psaux->t1_decrypt( charstring, glyph_length, 4330 ); /* choose which renderer to use */ - if ( ((PS_Driver)FT_FACE_DRIVER( face ))->hinting_engine == FT_T1_HINTING_FREETYPE || - decoder->builder.metrics_only ) - error = psaux->t1_decoder_funcs->parse_charstrings_old( decoder, - charstring + cs_offset, - glyph_length - cs_offset ); + if ( ( (PS_Driver)FT_FACE_DRIVER( face ) )->hinting_engine == + FT_T1_HINTING_FREETYPE || + decoder->builder.metrics_only ) + error = psaux->t1_decoder_funcs->parse_charstrings_old( + decoder, + charstring + cs_offset, + glyph_length - cs_offset ); else { PS_Decoder psdecoder; @@ -189,12 +191,15 @@ psaux->ps_decoder_init( &psdecoder, decoder, TRUE ); - psaux->t1_make_subfont( FT_FACE( face ), &dict->private_dict, &subfont ); + psaux->t1_make_subfont( FT_FACE( face ), + &dict->private_dict, + &subfont ); psdecoder.current_subfont = &subfont; - error = psaux->t1_decoder_funcs->parse_charstrings( &psdecoder, - charstring + cs_offset, - glyph_length - cs_offset ); + error = psaux->t1_decoder_funcs->parse_charstrings( + &psdecoder, + charstring + cs_offset, + glyph_length - cs_offset ); /* Adobe's engine uses 16.16 numbers everywhere; */ /* as a consequence, glyphs larger than 2000ppem get rejected */ @@ -207,9 +212,10 @@ force_scaling = TRUE; - error = psaux->t1_decoder_funcs->parse_charstrings( &psdecoder, - charstring + cs_offset, - glyph_length - cs_offset ); + error = psaux->t1_decoder_funcs->parse_charstrings( + &psdecoder, + charstring + cs_offset, + glyph_length - cs_offset ); } } } @@ -386,9 +392,9 @@ if ( error ) goto Exit; - /* Copy flags back for forced scaling */ - hinting = glyph->hint; - scaled = glyph->scaled; + /* copy flags back for forced scaling */ + hinting = glyph->hint; + scaled = glyph->scaled; font_matrix = decoder.font_matrix; font_offset = decoder.font_offset; From 179caf5a618a684d3f8f25e0f3def3c41c2504ab Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sun, 1 Oct 2017 01:39:27 +0200 Subject: [PATCH 302/470] [psaux] Formatting, minor fixes, whitespace, copyright notices. --- src/psaux/cffdecode.c | 317 ++++++------ src/psaux/cffdecode.h | 37 +- src/psaux/psarrst.h | 6 +- src/psaux/psauxmod.c | 14 +- src/psaux/psblues.h | 6 +- src/psaux/pserror.h | 6 +- src/psaux/psfixed.h | 6 +- src/psaux/psfont.c | 2 + src/psaux/psfont.h | 8 +- src/psaux/psft.c | 24 +- src/psaux/psft.h | 6 +- src/psaux/psglue.h | 6 +- src/psaux/pshints.c | 11 +- src/psaux/pshints.h | 7 +- src/psaux/psintrp.c | 1060 +++++++++++++++++++++-------------------- src/psaux/psintrp.h | 6 +- src/psaux/psobjs.c | 142 +++--- src/psaux/psread.h | 6 +- src/psaux/psstack.h | 6 +- src/psaux/pstypes.h | 6 +- src/psaux/t1decode.c | 1 + 21 files changed, 882 insertions(+), 801 deletions(-) diff --git a/src/psaux/cffdecode.c b/src/psaux/cffdecode.c index 4fbb9d1e5..6c4800652 100644 --- a/src/psaux/cffdecode.c +++ b/src/psaux/cffdecode.c @@ -4,7 +4,14 @@ /* */ /* PostScript CFF (Type 2) decoding routines (body). */ /* */ -/* Copyright notice here. */ +/* Copyright 2017 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ /* */ /***************************************************************************/ @@ -190,6 +197,7 @@ 2 /* setcurrentpoint */ }; + static FT_Error cff_operator_seac( CFF_Decoder* decoder, FT_Pos asb, @@ -201,7 +209,7 @@ FT_Error error; CFF_Builder* builder = &decoder->builder; FT_Int bchar_index, achar_index; - TT_Face face = decoder->builder.face; + TT_Face face = decoder->builder.face; FT_Vector left_bearing, advance; FT_Byte* charstring; FT_ULong charstring_len; @@ -342,7 +350,6 @@ return error; } - #endif /* CFF_CONFIG_OPTION_OLD_ENGINE */ @@ -401,8 +408,10 @@ { FT_UInt n; FT_UShort glyph_sid; + FT_Service_CFFLoad cffload; + /* CID-keyed fonts don't have glyph names */ if ( !cff->charset.sids ) return -1; @@ -414,14 +423,14 @@ #if 0 /* retrieve cffload from list of current modules */ FT_Service_CFFLoad cffload; + + + FT_FACE_FIND_GLOBAL_SERVICE( face, cffload, CFF_LOAD ); + if ( !cffload ) { - FT_FACE_FIND_GLOBAL_SERVICE( face, cffload, CFF_LOAD ); - if ( !cffload ) - { - FT_ERROR(( "cff_lookup_glyph_by_stdcharcode:" - " the `cffload' module is not available\n" )); - return FT_THROW( Unimplemented_Feature ); - } + FT_ERROR(( "cff_lookup_glyph_by_stdcharcode:" + " the `cffload' module is not available\n" )); + return FT_THROW( Unimplemented_Feature ); } #endif @@ -439,6 +448,7 @@ return -1; } + #ifdef CFF_CONFIG_OPTION_OLD_ENGINE /*************************************************************************/ @@ -483,7 +493,7 @@ FT_UShort num_axes = decoder->cff->top_font.font_dict.num_axes; - T2_Hints_Funcs hinter; + T2_Hints_Funcs hinter; /* set default width */ @@ -564,7 +574,7 @@ ( (FT_UInt32)ip[1] << 16 ) | ( (FT_UInt32)ip[2] << 8 ) | (FT_UInt32)ip[3] ); - ip += 4; + ip += 4; if ( charstring_type == 2 ) shift = 0; } @@ -630,119 +640,117 @@ op = cff_op_return; break; case 12: - { - if ( ip >= limit ) - goto Syntax_Error; - v = *ip++; + if ( ip >= limit ) + goto Syntax_Error; + v = *ip++; - switch ( v ) - { - 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; - case 4: - op = cff_op_or; - break; - 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; - case 9: - op = cff_op_abs; - break; - case 10: - op = cff_op_add; - break; - case 11: - op = cff_op_sub; - break; - case 12: - op = cff_op_div; - break; - case 13: - op = cff_op_load; - break; - case 14: - op = cff_op_neg; - break; - case 15: - op = cff_op_eq; - break; - case 16: - op = cff_op_callothersubr; - break; - case 17: - op = cff_op_pop; - break; - case 18: - op = cff_op_drop; - break; - case 20: - op = cff_op_put; - break; - case 21: - op = cff_op_get; - break; - case 22: - op = cff_op_ifelse; - break; - case 23: - op = cff_op_random; - break; - case 24: - op = cff_op_mul; - break; - case 26: - op = cff_op_sqrt; - break; - case 27: - op = cff_op_dup; - break; - case 28: - op = cff_op_exch; - break; - case 29: - op = cff_op_index; - break; - case 30: - op = cff_op_roll; - break; - case 33: - op = cff_op_setcurrentpoint; - break; - case 34: - op = cff_op_hflex; - break; - case 35: - op = cff_op_flex; - break; - case 36: - op = cff_op_hflex1; - break; - case 37: - op = cff_op_flex1; - break; - default: - FT_TRACE4(( " unknown op (12, %d)\n", v )); - break; - } + switch ( v ) + { + 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; + case 4: + op = cff_op_or; + break; + 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; + case 9: + op = cff_op_abs; + break; + case 10: + op = cff_op_add; + break; + case 11: + op = cff_op_sub; + break; + case 12: + op = cff_op_div; + break; + case 13: + op = cff_op_load; + break; + case 14: + op = cff_op_neg; + break; + case 15: + op = cff_op_eq; + break; + case 16: + op = cff_op_callothersubr; + break; + case 17: + op = cff_op_pop; + break; + case 18: + op = cff_op_drop; + break; + case 20: + op = cff_op_put; + break; + case 21: + op = cff_op_get; + break; + case 22: + op = cff_op_ifelse; + break; + case 23: + op = cff_op_random; + break; + case 24: + op = cff_op_mul; + break; + case 26: + op = cff_op_sqrt; + break; + case 27: + op = cff_op_dup; + break; + case 28: + op = cff_op_exch; + break; + case 29: + op = cff_op_index; + break; + case 30: + op = cff_op_roll; + break; + case 33: + op = cff_op_setcurrentpoint; + break; + case 34: + op = cff_op_hflex; + break; + case 35: + op = cff_op_flex; + break; + case 36: + op = cff_op_hflex1; + break; + case 37: + op = cff_op_flex1; + break; + default: + FT_TRACE4(( " unknown op (12, %d)\n", v )); + break; } break; case 13: @@ -984,7 +992,7 @@ #ifdef FT_DEBUG_LEVEL_TRACE { - FT_UInt maskbyte; + FT_UInt maskbyte; FT_TRACE4(( " (maskbytes:" )); @@ -1386,7 +1394,7 @@ case cff_op_hflex1: { - FT_Pos start_y; + FT_Pos start_y; FT_TRACE4(( " hflex1\n" )); @@ -1437,7 +1445,7 @@ case cff_op_hflex: { - FT_Pos start_y; + FT_Pos start_y; FT_TRACE4(( " hflex\n" )); @@ -1577,19 +1585,19 @@ break; case cff_op_seac: - FT_TRACE4(( " seac\n" )); + 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 ) ); + 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 ); + /* add current outline to the glyph slot */ + FT_GlyphLoader_Add( builder->loader ); - /* return now! */ - FT_TRACE4(( "\n" )); - return error; + /* return now! */ + FT_TRACE4(( "\n" )); + return error; case cff_op_endchar: /* in dictionaries, `endchar' simply indicates end of data */ @@ -1813,7 +1821,7 @@ FT_TRACE4(( " dup\n" )); args[1] = args[0]; - args += 2; + args += 2; break; case cff_op_put: @@ -1855,7 +1863,7 @@ /* since we currently don't handle interpolation of multiple */ /* master fonts, this is a no-op */ - FT_TRACE4(( " store\n")); + FT_TRACE4(( " store\n" )); break; case cff_op_load: @@ -2253,12 +2261,12 @@ /* hint_mode :: The hinting mode. */ /* */ FT_LOCAL_DEF( void ) - cff_decoder_init( CFF_Decoder* decoder, - TT_Face face, - CFF_Size size, - CFF_GlyphSlot slot, - FT_Bool hinting, - FT_Render_Mode hint_mode, + cff_decoder_init( CFF_Decoder* decoder, + TT_Face face, + CFF_Size size, + CFF_GlyphSlot slot, + FT_Bool hinting, + FT_Render_Mode hint_mode, CFF_Decoder_Get_Glyph_Callback get_callback, CFF_Decoder_Free_Glyph_Callback free_callback ) { @@ -2279,7 +2287,7 @@ cff->top_font.font_dict.charstring_type, decoder->num_globals ); - decoder->hint_mode = hint_mode; + decoder->hint_mode = hint_mode; decoder->get_glyph_callback = get_callback; decoder->free_glyph_callback = free_callback; @@ -2300,10 +2308,12 @@ FT_Service_CFFLoad cffload = (FT_Service_CFFLoad)cff->cffload; + /* manage CID fonts */ if ( cff->num_subfonts ) { - FT_Byte fd_index = cffload->fd_select_get( &cff->fd_select, glyph_index ); + FT_Byte fd_index = cffload->fd_select_get( &cff->fd_select, + glyph_index ); if ( fd_index >= cff->num_subfonts ) @@ -2328,11 +2338,11 @@ } } - decoder->num_locals = sub->local_subrs_index.count; - decoder->locals = sub->local_subrs; - decoder->locals_bias = cff_compute_bias( - decoder->cff->top_font.font_dict.charstring_type, - decoder->num_locals ); + decoder->num_locals = sub->local_subrs_index.count; + decoder->locals = sub->local_subrs; + 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; @@ -2342,3 +2352,6 @@ Exit: return error; } + + +/* END */ diff --git a/src/psaux/cffdecode.h b/src/psaux/cffdecode.h index 4243ca699..15dfa8d62 100644 --- a/src/psaux/cffdecode.h +++ b/src/psaux/cffdecode.h @@ -4,7 +4,14 @@ /* */ /* PostScript CFF (Type 2) decoding routines (specification). */ /* */ -/* Copyright notice here. */ +/* Copyright 2017 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ /* */ /***************************************************************************/ @@ -19,14 +26,14 @@ FT_BEGIN_HEADER FT_LOCAL( void ) - cff_decoder_init( CFF_Decoder* decoder, - TT_Face face, - CFF_Size size, - CFF_GlyphSlot slot, - FT_Bool hinting, - FT_Render_Mode hint_mode, + cff_decoder_init( CFF_Decoder* decoder, + TT_Face face, + CFF_Size size, + CFF_GlyphSlot slot, + FT_Bool hinting, + FT_Render_Mode hint_mode, CFF_Decoder_Get_Glyph_Callback get_callback, - CFF_Decoder_Free_Glyph_Callback free_callback); + CFF_Decoder_Free_Glyph_Callback free_callback ); FT_LOCAL( FT_Error ) cff_decoder_prepare( CFF_Decoder* decoder, @@ -39,13 +46,13 @@ FT_BEGIN_HEADER FT_Int charcode ); - #ifdef CFF_CONFIG_OPTION_OLD_ENGINE - FT_LOCAL( FT_Error ) - cff_decoder_parse_charstrings( CFF_Decoder* decoder, - FT_Byte* charstring_base, - FT_ULong charstring_len, - FT_Bool in_dict ); - #endif +#ifdef CFF_CONFIG_OPTION_OLD_ENGINE + FT_LOCAL( FT_Error ) + cff_decoder_parse_charstrings( CFF_Decoder* decoder, + FT_Byte* charstring_base, + FT_ULong charstring_len, + FT_Bool in_dict ); +#endif FT_END_HEADER diff --git a/src/psaux/psarrst.h b/src/psaux/psarrst.h index b7d114079..b3568eb61 100644 --- a/src/psaux/psarrst.h +++ b/src/psaux/psarrst.h @@ -36,8 +36,8 @@ /***************************************************************************/ -#ifndef CF2ARRST_H_ -#define CF2ARRST_H_ +#ifndef PSARRST_H_ +#define PSARRST_H_ #include "pserror.h" @@ -94,7 +94,7 @@ FT_BEGIN_HEADER FT_END_HEADER -#endif /* CF2ARRST_H_ */ +#endif /* PSARRST_H_ */ /* END */ diff --git a/src/psaux/psauxmod.c b/src/psaux/psauxmod.c index fea60ce6d..b539b1ac1 100644 --- a/src/psaux/psauxmod.c +++ b/src/psaux/psauxmod.c @@ -87,10 +87,10 @@ FT_CALLBACK_TABLE_DEF const T1_Decoder_FuncsRec t1_decoder_funcs = { - t1_decoder_init, /* init */ - t1_decoder_done, /* done */ - t1_decoder_parse_charstrings, /* parse_charstrings_old */ - cf2_decoder_parse_charstrings /* parse_charstrings */ + t1_decoder_init, /* init */ + t1_decoder_done, /* done */ + t1_decoder_parse_charstrings, /* parse_charstrings_old */ + cf2_decoder_parse_charstrings /* parse_charstrings */ }; @@ -133,13 +133,13 @@ FT_CALLBACK_TABLE_DEF const CFF_Decoder_FuncsRec cff_decoder_funcs = { - cff_decoder_init, /* init */ - cff_decoder_prepare, /* prepare */ + cff_decoder_init, /* init */ + cff_decoder_prepare, /* prepare */ #ifdef CFF_CONFIG_OPTION_OLD_ENGINE cff_decoder_parse_charstrings, /* parse_charstrings_old */ #endif - cf2_decoder_parse_charstrings /* parse_charstrings */ + cf2_decoder_parse_charstrings /* parse_charstrings */ }; diff --git a/src/psaux/psblues.h b/src/psaux/psblues.h index 888de9f30..25ef6849c 100644 --- a/src/psaux/psblues.h +++ b/src/psaux/psblues.h @@ -65,8 +65,8 @@ */ -#ifndef CF2BLUES_H_ -#define CF2BLUES_H_ +#ifndef PSBLUES_H_ +#define PSBLUES_H_ #include "psglue.h" @@ -179,7 +179,7 @@ FT_BEGIN_HEADER FT_END_HEADER -#endif /* CF2BLUES_H_ */ +#endif /* PSBLUES_H_ */ /* END */ diff --git a/src/psaux/pserror.h b/src/psaux/pserror.h index 4a631b8df..13d52062b 100644 --- a/src/psaux/pserror.h +++ b/src/psaux/pserror.h @@ -36,8 +36,8 @@ /***************************************************************************/ -#ifndef CF2ERROR_H_ -#define CF2ERROR_H_ +#ifndef PSERROR_H_ +#define PSERROR_H_ #include FT_MODULE_ERRORS_H @@ -113,7 +113,7 @@ FT_BEGIN_HEADER FT_END_HEADER -#endif /* CF2ERROR_H_ */ +#endif /* PSERROR_H_ */ /* END */ diff --git a/src/psaux/psfixed.h b/src/psaux/psfixed.h index b93163034..219589e7f 100644 --- a/src/psaux/psfixed.h +++ b/src/psaux/psfixed.h @@ -36,8 +36,8 @@ /***************************************************************************/ -#ifndef CF2FIXED_H_ -#define CF2FIXED_H_ +#ifndef PSFIXED_H_ +#define PSFIXED_H_ FT_BEGIN_HEADER @@ -89,7 +89,7 @@ FT_BEGIN_HEADER FT_END_HEADER -#endif /* CF2FIXED_H_ */ +#endif /* PSFIXED_H_ */ /* END */ diff --git a/src/psaux/psfont.c b/src/psaux/psfont.c index ff69b828d..dde67a739 100644 --- a/src/psaux/psfont.c +++ b/src/psaux/psfont.c @@ -275,6 +275,8 @@ if ( !font->isT1 ) { FT_Service_CFFLoad cffload = (FT_Service_CFFLoad)font->cffload; + + /* check for variation vectors */ vstore = cf2_getVStore( decoder ); hasVariations = ( vstore->dataCount != 0 ); diff --git a/src/psaux/psfont.h b/src/psaux/psfont.h index 7f5341694..e611ac4bd 100644 --- a/src/psaux/psfont.h +++ b/src/psaux/psfont.h @@ -36,8 +36,8 @@ /***************************************************************************/ -#ifndef CF2FONT_H_ -#define CF2FONT_H_ +#ifndef PSFONT_H_ +#define PSFONT_H_ #include FT_SERVICE_CFF_TABLE_LOAD_H @@ -114,7 +114,7 @@ FT_BEGIN_HEADER CF2_BluesRec blues; /* computed zone data */ - FT_Service_CFFLoad cffload; /* Pointer to cff functions */ + FT_Service_CFFLoad cffload; /* pointer to cff functions */ }; @@ -128,7 +128,7 @@ FT_BEGIN_HEADER FT_END_HEADER -#endif /* CF2FONT_H_ */ +#endif /* PSFONT_H_ */ /* END */ diff --git a/src/psaux/psft.c b/src/psaux/psft.c index 8ddabc26d..6c67276d9 100644 --- a/src/psaux/psft.c +++ b/src/psaux/psft.c @@ -49,6 +49,7 @@ #include FT_SERVICE_CFF_TABLE_LOAD_H + #define CF2_MAX_SIZE cf2_intToFixed( 2000 ) /* max ppem */ @@ -479,15 +480,16 @@ CF2_UInt *len, FT_Fixed* *vec ) { - TT_Face face; + TT_Face face; FT_Service_MultiMasters mm; + FT_ASSERT( decoder && decoder->builder.face ); FT_ASSERT( vec && len ); FT_ASSERT( !decoder->builder.is_t1 ); face = (TT_Face)decoder->builder.face; - mm = (FT_Service_MultiMasters)face->mm; + mm = (FT_Service_MultiMasters)face->mm; return mm->get_var_blend( FT_FACE( face ), len, NULL, vec, NULL ); } @@ -498,8 +500,8 @@ FT_LOCAL_DEF( CF2_Fixed ) cf2_getPpemY( PS_Decoder* decoder ) { - FT_ASSERT( decoder && - decoder->builder.face && + FT_ASSERT( decoder && + decoder->builder.face && decoder->builder.face->size ); /* @@ -723,8 +725,10 @@ T1_Font type1 = &face->type1; #ifdef FT_CONFIG_OPTION_INCREMENTAL - FT_Incremental_InterfaceRec *inc = + FT_Incremental_InterfaceRec *inc = face->root.internal->incremental_interface; + + /* For incremental fonts get the character data using the */ /* callback function. */ if ( inc ) @@ -732,7 +736,7 @@ glyph_index, &glyph_data ); else #endif - /* For ordinary fonts get the character data stored in the face record. */ + /* For ordinary fonts get the character data stored in the face record. */ { glyph_data.pointer = type1->charstrings[glyph_index]; glyph_data.length = (FT_Int)type1->charstrings_len[glyph_index]; @@ -806,13 +810,13 @@ /* The CID driver stores subroutines with seed bytes. This */ /* case is taken care of when decoder->subrs_len == 0. */ if ( decoder->locals_len ) - buf->end = buf->start + decoder->locals_len[idx]; + buf->end = buf->start + decoder->locals_len[idx]; else { /* We are using subroutines from a CID font. We must adjust */ /* for the seed bytes. */ - buf->start += ( decoder->lenIV >= 0 ? decoder->lenIV : 0 ); - buf->end = decoder->locals[idx + 1]; + buf->start += ( decoder->lenIV >= 0 ? decoder->lenIV : 0 ); + buf->end = decoder->locals[idx + 1]; } if ( !buf->start ) @@ -823,7 +827,7 @@ } else { - buf->end = decoder->locals[idx + 1]; + buf->end = decoder->locals[idx + 1]; } buf->ptr = buf->start; diff --git a/src/psaux/psft.h b/src/psaux/psft.h index 28bc49c19..ab172110b 100644 --- a/src/psaux/psft.h +++ b/src/psaux/psft.h @@ -36,8 +36,8 @@ /***************************************************************************/ -#ifndef CF2FT_H_ -#define CF2FT_H_ +#ifndef PSFT_H_ +#define PSFT_H_ #include "pstypes.h" @@ -161,7 +161,7 @@ FT_BEGIN_HEADER FT_END_HEADER -#endif /* CF2FT_H_ */ +#endif /* PSFT_H_ */ /* END */ diff --git a/src/psaux/psglue.h b/src/psaux/psglue.h index 4fa544527..5545e12a5 100644 --- a/src/psaux/psglue.h +++ b/src/psaux/psglue.h @@ -36,8 +36,8 @@ /***************************************************************************/ -#ifndef CF2GLUE_H_ -#define CF2GLUE_H_ +#ifndef PSGLUE_H_ +#define PSGLUE_H_ /* common includes for other modules */ @@ -138,7 +138,7 @@ FT_BEGIN_HEADER FT_END_HEADER -#endif /* CF2GLUE_H_ */ +#endif /* PSGLUE_H_ */ /* END */ diff --git a/src/psaux/pshints.c b/src/psaux/pshints.c index c8ad4e03e..93e1587da 100644 --- a/src/psaux/pshints.c +++ b/src/psaux/pshints.c @@ -312,10 +312,11 @@ { CF2_Hint hint = &hintmap->edge[i]; + FT_TRACE6(( " %3d %7.2f %7.2f %5d %s%s%s%s\n", hint->index, hint->csCoord / 65536.0, - hint->dsCoord / (hint->scale * 1.0), + hint->dsCoord / ( hint->scale * 1.0 ), hint->scale, ( cf2_hint_isPair( hint ) ? "p" : "g" ), ( cf2_hint_isTop( hint ) ? "t" : "b" ), @@ -645,9 +646,9 @@ firstHintEdge->csCoord / 65536.0, firstHintEdge->dsCoord / 65536.0 )); if ( isPair ) - FT_TRACE7(( " Got hint at %.2f (%.2f)\n", - secondHintEdge->csCoord / 65536.0, - secondHintEdge->dsCoord / 65536.0 )); + FT_TRACE7(( " Got hint at %.2f (%.2f)\n", + secondHintEdge->csCoord / 65536.0, + secondHintEdge->dsCoord / 65536.0 )); /* * Discard any hints that overlap in character space. Most often, this @@ -767,6 +768,7 @@ /* insert first edge */ hintmap->edge[indexInsert] = *firstHintEdge; /* copy struct */ hintmap->count += 1; + FT_TRACE7(( " Inserting hint %.2f (%.2f)\n", firstHintEdge->csCoord / 65536.0, firstHintEdge->dsCoord / 65536.0 )); @@ -776,6 +778,7 @@ /* insert second edge */ hintmap->edge[indexInsert + 1] = *secondHintEdge; /* copy struct */ hintmap->count += 1; + FT_TRACE7(( " Inserting hint %.2f (%.2f)\n", secondHintEdge->csCoord / 65536.0, secondHintEdge->dsCoord / 65536.0 )); diff --git a/src/psaux/pshints.h b/src/psaux/pshints.h index 02fdc53cb..92e37e98a 100644 --- a/src/psaux/pshints.h +++ b/src/psaux/pshints.h @@ -36,9 +36,8 @@ /***************************************************************************/ -#ifndef CF2HINTS_H_ -#define CF2HINTS_H_ - +#ifndef PSHINT_H_ +#define PSHINT_H_ FT_BEGIN_HEADER @@ -283,7 +282,7 @@ FT_BEGIN_HEADER FT_END_HEADER -#endif /* CF2HINTS_H_ */ +#endif /* PSHINT_H_ */ /* END */ diff --git a/src/psaux/psintrp.c b/src/psaux/psintrp.c index ab6ed4954..a60597e3c 100644 --- a/src/psaux/psintrp.c +++ b/src/psaux/psintrp.c @@ -49,7 +49,8 @@ #include "pserror.h" #include "psobjs.h" /* for cff_random */ -#include "t1decode.h" /* for t1 seac */ +#include "t1decode.h" /* for t1 seac */ + /*************************************************************************/ /* */ @@ -292,10 +293,9 @@ CF2_Fixed position = hintOffset; if ( font->isT1 && !font->decoder->flex_state && !*haveWidth ) - { FT_ERROR(( "cf2_doStems (Type 1 mode):" " No width. Use hsbw/sbw as first op\n" )); - } + if ( !font->isT1 && hasWidthArg && !*haveWidth ) *width = ADD_INT32( cf2_stack_getReal( opStack, 0 ), cf2_getNominalWidthX( font->decoder ) ); @@ -489,10 +489,11 @@ CF2_Fixed scaleY = font->innerTransform.d; CF2_Fixed nominalWidthX = cf2_getNominalWidthX( decoder ); - /* Stuff for Type 1 */ - FT_Int known_othersubr_result_cnt = 0; - FT_Bool large_int = FALSE; - FT_Bool initial_map_ready = FALSE; + /* stuff for Type 1 */ + FT_Int known_othersubr_result_cnt = 0; + FT_Bool large_int = FALSE; + FT_Bool initial_map_ready = FALSE; + #define PS_STORAGE_SIZE 3 CF2_F16Dot16 results[PS_STORAGE_SIZE]; /* for othersubr results */ FT_Int result_cnt = 0; @@ -505,7 +506,7 @@ FT_Byte op1; /* first opcode byte */ CF2_F16Dot16 storage[CF2_STORAGE_SIZE]; /* for `put' and `get' */ - CF2_F16Dot16 flexStore[6]; /* for Type 1 flex */ + CF2_F16Dot16 flexStore[6]; /* for Type 1 flex */ /* instruction limit; 20,000,000 matches Avalon */ FT_UInt32 instructionLimit = 20000000UL; @@ -623,10 +624,8 @@ while ( 1 ) { if ( font->isT1 ) - { - FT_ASSERT( known_othersubr_result_cnt == 0 || - result_cnt == 0 ); - } + FT_ASSERT( known_othersubr_result_cnt == 0 || + result_cnt == 0 ); if ( cf2_buf_isEnd( charstring ) ) { @@ -651,14 +650,14 @@ if ( font->isT1 ) { - if ( !initial_map_ready && - !( op1 == cf2_cmdHSTEM || - op1 == cf2_cmdVSTEM || - op1 == cf2_cmdHSBW || - op1 == cf2_cmdCALLSUBR || - op1 == cf2_cmdRETURN || - op1 == cf2_cmdESC || - op1 == cf2_cmdENDCHAR || + if ( !initial_map_ready && + !( op1 == cf2_cmdHSTEM || + op1 == cf2_cmdVSTEM || + op1 == cf2_cmdHSBW || + op1 == cf2_cmdCALLSUBR || + op1 == cf2_cmdRETURN || + op1 == cf2_cmdESC || + op1 == cf2_cmdENDCHAR || op1 >= 32 /* Numbers */ ) ) { /* Skip outline commands first time round. */ @@ -668,10 +667,10 @@ continue; } - if ( result_cnt > 0 && - !( op1 == cf2_cmdCALLSUBR || - op1 == cf2_cmdRETURN || - op1 == cf2_cmdESC || + if ( result_cnt > 0 && + !( op1 == cf2_cmdCALLSUBR || + op1 == cf2_cmdRETURN || + op1 == cf2_cmdESC || op1 >= 32 /* Numbers */ ) ) { /* all operands have been transferred by previous pops */ @@ -790,7 +789,7 @@ } } - /* Add left-sidebearing correction in Type 1 mode */ + /* add left-sidebearing correction in Type 1 mode */ cf2_doStems( font, opStack, &hStemHintArray, @@ -820,7 +819,7 @@ } } - /* Add left-sidebearing correction in Type 1 mode */ + /* add left-sidebearing correction in Type 1 mode */ cf2_doStems( font, opStack, &vStemHintArray, @@ -838,10 +837,8 @@ FT_TRACE4(( " vmoveto\n" )); if ( font->isT1 && !decoder->flex_state && !haveWidth ) - { FT_ERROR(( "cf2_interpT2CharString (Type 1 mode):" " No width. Use hsbw/sbw as first op\n" )); - } if ( cf2_stack_count( opStack ) > 1 && !haveWidth ) *width = ADD_INT32( cf2_stack_getReal( opStack, 0 ), @@ -956,9 +953,7 @@ case cf2_cmdCLOSEPATH: if ( !font->isT1 ) - { FT_TRACE4(( " unknown op (%d)\n", op1 )); - } else { FT_TRACE4(( " closepath" )); @@ -979,7 +974,7 @@ FT_TRACE4(( op1 == cf2_cmdCALLGSUBR ? " callgsubr" : " callsubr" )); - if ( ( !font->isT1 && charstringIndex > CF2_MAX_SUBR ) || + if ( ( !font->isT1 && charstringIndex > CF2_MAX_SUBR ) || ( font->isT1 && charstringIndex > T1_MAX_SUBRS_CALLS ) ) { /* max subr plus one for charstring */ @@ -1001,6 +996,7 @@ size_t* val = ft_hash_num_lookup( subrNum, decoder->locals_hash ); + if ( val ) subrNum = *val; else @@ -1179,11 +1175,14 @@ if ( font->isCFF2 || op2 >= cf2_escRESERVED_38 ) FT_TRACE4(( " unknown op (12, %d)\n", op2 )); else if ( font->isT1 && result_cnt > 0 && op2 != cf2_escPOP ) + { /* all operands have been transferred by previous pops */ result_cnt = 0; + } else { - /* second switch for 2-byte operators handles CFF and Type 1 */ + /* second switch for 2-byte operators handles */ + /* CFF and Type 1 */ switch ( op2 ) { @@ -1195,10 +1194,13 @@ case cf2_escVSTEM3: case cf2_escHSTEM3: - /* Type 1: */ /* Type 2: */ - /* x0 dx0 x1 dx1 x2 dx2 vstem3 */ /* x dx {dxa dxb}* vstem */ - /* y0 dy0 y1 dy1 y2 dy2 hstem3 */ /* y dy {dya dyb}* hstem */ - /* relative to lsb point */ /* relative to zero */ + /* + * Type 1: Type 2: + * x0 dx0 x1 dx1 x2 dx2 vstem3 x dx {dxa dxb}* vstem + * y0 dy0 y1 dy1 y2 dy2 hstem3 y dy {dya dyb}* hstem + * relative to lsb point relative to zero + * + */ { if ( !font->isT1 ) FT_TRACE4(( " unknown op (12, %d)\n", op2 )); @@ -1206,26 +1208,28 @@ { CF2_F16Dot16 v0, v1, v2; - FT_Bool isV = FT_BOOL( op2 == cf2_escVSTEM3 ); + FT_Bool isV = FT_BOOL( op2 == cf2_escVSTEM3 ); FT_TRACE4(( isV ? " vstem3\n" : " hstem3\n" )); - FT_ASSERT( ( cf2_stack_count( opStack ) == 6 ) ); + FT_ASSERT( cf2_stack_count( opStack ) == 6 ); v0 = cf2_stack_getReal( opStack, 0 ); v1 = cf2_stack_getReal( opStack, 2 ); v2 = cf2_stack_getReal( opStack, 4 ); - cf2_stack_setReal( opStack, 2, - SUB_INT32( SUB_INT32( v1, v0 ), - cf2_stack_getReal( opStack, 1 ) ) ); - cf2_stack_setReal( opStack, 4, - SUB_INT32( SUB_INT32( v2, v1 ), - cf2_stack_getReal( opStack, 3 ) ) ); + cf2_stack_setReal( + opStack, 2, + SUB_INT32( SUB_INT32( v1, v0 ), + cf2_stack_getReal( opStack, 1 ) ) ); + cf2_stack_setReal( + opStack, 4, + SUB_INT32( SUB_INT32( v2, v1 ), + cf2_stack_getReal( opStack, 3 ) ) ); - /* Add left-sidebearing correction */ + /* add left-sidebearing correction */ cf2_doStems( font, opStack, isV ? &vStemHintArray : &hStemHintArray, @@ -1284,226 +1288,234 @@ continue; /* do not clear the stack */ case cf2_escSEAC: + if ( !font->isT1 ) + FT_TRACE4(( " unknown op (12, %d)\n", op2 )); + else { - if ( !font->isT1 ) - FT_TRACE4(( " unknown op (12, %d)\n", op2 )); - else - { - FT_Error error2; - CF2_Int bchar_index, achar_index; - FT_Vector left_bearing, advance; + FT_Error error2; + CF2_Int bchar_index, achar_index; + FT_Vector left_bearing, advance; + #ifdef FT_CONFIG_OPTION_INCREMENTAL - T1_Face face = (T1_Face)decoder->builder.face; + T1_Face face = (T1_Face)decoder->builder.face; #endif - CF2_BufferRec component; - CF2_Fixed dummyWidth; + CF2_BufferRec component; + CF2_Fixed dummyWidth; - CF2_Int achar = cf2_stack_popInt( opStack ); - CF2_Int bchar = cf2_stack_popInt( opStack ); + CF2_Int achar = cf2_stack_popInt( opStack ); + CF2_Int bchar = cf2_stack_popInt( opStack ); - FT_Pos ady = cf2_stack_popFixed ( opStack ); - FT_Pos adx = cf2_stack_popFixed ( opStack ); - FT_Pos asb = cf2_stack_popFixed ( opStack ); + FT_Pos ady = cf2_stack_popFixed ( opStack ); + FT_Pos adx = cf2_stack_popFixed ( opStack ); + FT_Pos asb = cf2_stack_popFixed ( opStack ); - FT_TRACE4(( " seac\n" )); + FT_TRACE4(( " seac\n" )); - if ( doingSeac ) - { - FT_ERROR(( " nested seac\n" )); - lastError = FT_THROW( Invalid_Glyph_Format ); - goto exit; /* nested seac */ - } + if ( doingSeac ) + { + FT_ERROR(( " nested seac\n" )); + lastError = FT_THROW( Invalid_Glyph_Format ); + goto exit; /* nested seac */ + } - if ( decoder->builder.metrics_only ) - { - FT_ERROR(( " unexpected seac\n" )); - lastError = FT_THROW( Invalid_Glyph_Format ); - goto exit; /* unexpected seac */ - } + if ( decoder->builder.metrics_only ) + { + FT_ERROR(( " unexpected seac\n" )); + lastError = FT_THROW( Invalid_Glyph_Format ); + goto exit; /* unexpected seac */ + } - /* `glyph_names' is set to 0 for CID fonts which do not */ - /* include an encoding. How can we deal with these? */ + /* `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 ) + 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(( "cf2_interpT2CharString: (Type 1 seac)" - " glyph names table not available in this font\n" )); - lastError = FT_THROW( Invalid_Glyph_Format ); - goto exit; - } - - - /* seac weirdness */ - adx += decoder->builder.left_bearing->x; - -#ifdef FT_CONFIG_OPTION_INCREMENTAL - if ( face->root.internal->incremental_interface ) { - /* the caller must handle the font encoding also */ - bchar_index = bchar; - achar_index = achar; - } - else -#endif - { - bchar_index = t1_lookup_glyph_by_stdcharcode_ps( decoder, bchar ); - achar_index = t1_lookup_glyph_by_stdcharcode_ps( decoder, achar ); - } - - if ( bchar_index < 0 || achar_index < 0 ) - { - FT_ERROR(( "cf2_interpT2CharString: (Type 1 seac)" - " invalid seac character code arguments\n" )); + FT_ERROR(( + "cf2_interpT2CharString: (Type 1 seac)" + " glyph names table not available in this font\n" )); lastError = FT_THROW( Invalid_Glyph_Format ); goto exit; } - /* if we are trying to load a composite glyph, do not load the */ - /* accent character and return the array of subglyphs. */ - if ( decoder->builder.no_recurse ) - { - FT_GlyphSlot glyph = (FT_GlyphSlot)decoder->builder.glyph; - FT_GlyphLoader loader = glyph->internal->loader; - FT_SubGlyph subg; - - - /* reallocate subglyph array if necessary */ - error2 = FT_GlyphLoader_CheckSubGlyphs( loader, 2 ); - if ( error2 ) - { - lastError = error2; /* pass FreeType error through */ - goto exit; - } - - subg = loader->current.subglyphs; + /* seac weirdness */ + adx += decoder->builder.left_bearing->x; - /* subglyph 0 = base character */ - subg->index = bchar_index; - subg->flags = FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES | - FT_SUBGLYPH_FLAG_USE_MY_METRICS; - subg->arg1 = 0; - subg->arg2 = 0; - subg++; +#ifdef FT_CONFIG_OPTION_INCREMENTAL + if ( face->root.internal->incremental_interface ) + { + /* the caller must handle the font encoding also */ + bchar_index = bchar; + achar_index = achar; + } + else +#endif + { + bchar_index = t1_lookup_glyph_by_stdcharcode_ps( + decoder, bchar ); + achar_index = t1_lookup_glyph_by_stdcharcode_ps( + decoder, achar ); + } - /* subglyph 1 = accent character */ - subg->index = achar_index; - subg->flags = FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES; - subg->arg1 = (FT_Int)FIXED_TO_INT( adx - asb ); - subg->arg2 = (FT_Int)FIXED_TO_INT( ady ); + if ( bchar_index < 0 || achar_index < 0 ) + { + FT_ERROR(( + "cf2_interpT2CharString: (Type 1 seac)" + " invalid seac character code arguments\n" )); + lastError = FT_THROW( Invalid_Glyph_Format ); + goto exit; + } - /* set up remaining glyph fields */ - glyph->num_subglyphs = 2; - glyph->subglyphs = loader->base.subglyphs; - glyph->format = FT_GLYPH_FORMAT_COMPOSITE; + /* if we are trying to load a composite glyph, */ + /* do not load the accent character and return */ + /* the array of subglyphs. */ + if ( decoder->builder.no_recurse ) + { + FT_GlyphSlot glyph = (FT_GlyphSlot)decoder->builder.glyph; + FT_GlyphLoader loader = glyph->internal->loader; + FT_SubGlyph subg; - loader->current.num_subglyphs = 2; + /* reallocate subglyph array if necessary */ + error2 = FT_GlyphLoader_CheckSubGlyphs( loader, 2 ); + if ( error2 ) + { + lastError = error2; /* pass FreeType error through */ goto exit; } - /* First load `bchar' in builder */ - /* now load the unscaled outline */ + subg = loader->current.subglyphs; - FT_GlyphLoader_Prepare( decoder->builder.loader ); /* prepare loader */ + /* subglyph 0 = base character */ + subg->index = bchar_index; + subg->flags = FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES | + FT_SUBGLYPH_FLAG_USE_MY_METRICS; + subg->arg1 = 0; + subg->arg2 = 0; + subg++; - error2 = cf2_getT1SeacComponent( decoder, (FT_UInt)bchar_index, &component ); - if ( error2 ) - { - lastError = error2; /* pass FreeType error through */ - goto exit; - } - cf2_interpT2CharString( font, - &component, - callbacks, - translation, - TRUE, - 0, - 0, - &dummyWidth ); - cf2_freeT1SeacComponent( decoder, &component ); + /* subglyph 1 = accent character */ + subg->index = achar_index; + subg->flags = FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES; + subg->arg1 = (FT_Int)FIXED_TO_INT( adx - asb ); + subg->arg2 = (FT_Int)FIXED_TO_INT( ady ); - /* save the left bearing and width of the base character */ - /* as they will be erased by the next load. */ + /* set up remaining glyph fields */ + glyph->num_subglyphs = 2; + glyph->subglyphs = loader->base.subglyphs; + glyph->format = FT_GLYPH_FORMAT_COMPOSITE; - left_bearing = *decoder->builder.left_bearing; - advance = *decoder->builder.advance; + loader->current.num_subglyphs = 2; - decoder->builder.left_bearing->x = 0; - decoder->builder.left_bearing->y = 0; + goto exit; + } - /* Now load `achar' on top of */ - /* the base outline */ + /* First load `bchar' in builder */ + /* now load the unscaled outline */ - error2 = cf2_getT1SeacComponent( decoder, (FT_UInt)achar_index, &component ); - if ( error2 ) - { - lastError = error2; /* pass FreeType error through */ - goto exit; - } - cf2_interpT2CharString( font, - &component, - callbacks, - translation, - TRUE, - adx - asb, - ady, - &dummyWidth ); - cf2_freeT1SeacComponent( decoder, &component ); - - /* restore the left side bearing and */ - /* advance width of the base character */ - - *decoder->builder.left_bearing = left_bearing; - *decoder->builder.advance = advance; + /* prepare loader */ + FT_GlyphLoader_Prepare( decoder->builder.loader ); + error2 = cf2_getT1SeacComponent( decoder, + (FT_UInt)bchar_index, + &component ); + if ( error2 ) + { + lastError = error2; /* pass FreeType error through */ goto exit; } + cf2_interpT2CharString( font, + &component, + callbacks, + translation, + TRUE, + 0, + 0, + &dummyWidth ); + cf2_freeT1SeacComponent( decoder, &component ); + + /* save the left bearing and width of the base */ + /* character as they will be erased by the next load */ + + left_bearing = *decoder->builder.left_bearing; + advance = *decoder->builder.advance; + + decoder->builder.left_bearing->x = 0; + decoder->builder.left_bearing->y = 0; + + /* Now load `achar' on top of */ + /* the base outline */ + + error2 = cf2_getT1SeacComponent( decoder, + (FT_UInt)achar_index, + &component ); + if ( error2 ) + { + lastError = error2; /* pass FreeType error through */ + goto exit; + } + cf2_interpT2CharString( font, + &component, + callbacks, + translation, + TRUE, + adx - asb, + ady, + &dummyWidth ); + cf2_freeT1SeacComponent( decoder, &component ); + + /* restore the left side bearing and */ + /* advance width of the base character */ + + *decoder->builder.left_bearing = left_bearing; + *decoder->builder.advance = advance; + + goto exit; } break; case cf2_escSBW: + if ( !font->isT1 ) + FT_TRACE4(( " unknown op (12, %d)\n", op2 )); + else { - if ( !font->isT1 ) - FT_TRACE4(( " unknown op (12, %d)\n", op2 )); - else - { - CF2_Fixed lsb_x, lsb_y; - PS_Builder* builder; + CF2_Fixed lsb_x, lsb_y; + PS_Builder* builder; - FT_TRACE4(( " sbw" )); + FT_TRACE4(( " sbw" )); - builder = &decoder->builder; + builder = &decoder->builder; - builder->advance->y = cf2_stack_popFixed( opStack ); - builder->advance->x = cf2_stack_popFixed( opStack ); + builder->advance->y = cf2_stack_popFixed( opStack ); + builder->advance->x = cf2_stack_popFixed( opStack ); - lsb_y = cf2_stack_popFixed( opStack ); - lsb_x = cf2_stack_popFixed( opStack ); + lsb_y = cf2_stack_popFixed( opStack ); + lsb_x = cf2_stack_popFixed( opStack ); - builder->left_bearing->x = ADD_INT32( builder->left_bearing->x, - lsb_x ); - builder->left_bearing->y = ADD_INT32( builder->left_bearing->y, - lsb_y ); + builder->left_bearing->x = + ADD_INT32( builder->left_bearing->x, lsb_x ); + builder->left_bearing->y = + ADD_INT32( builder->left_bearing->y, lsb_y ); - haveWidth = TRUE; + haveWidth = TRUE; - /* the `metrics_only' indicates that we only want to compute */ - /* the glyph's metrics (lsb + advance width), not load the */ - /* rest of it; so exit immediately */ - if ( builder->metrics_only ) - goto exit; + /* the `metrics_only' indicates that we only want */ + /* to compute the glyph's metrics (lsb + advance */ + /* width), not load the rest of it; so exit */ + /* immediately */ + if ( builder->metrics_only ) + goto exit; - if ( initial_map_ready ) - { - curX = ADD_INT32( curX, lsb_x ); - curY = ADD_INT32( curY, lsb_y ); - } + if ( initial_map_ready ) + { + curX = ADD_INT32( curX, lsb_x ); + curY = ADD_INT32( curY, lsb_y ); } } break; @@ -1625,21 +1637,22 @@ CF2_UInt count; CF2_UInt opIdx = 0; + FT_TRACE4(( " callothersubr\n" )); subr_no = cf2_stack_popInt( opStack ); arg_cnt = cf2_stack_popInt( opStack ); - /***********************************************************/ - /* */ - /* remove all operands to callothersubr from the stack */ - /* */ - /* for handled othersubrs, where we know the number of */ - /* arguments, we increase the stack by the value of */ - /* known_othersubr_result_cnt */ - /* */ - /* for unhandled othersubrs the following pops adjust the */ - /* stack pointer as necessary */ + /*******************************************************/ + /* */ + /* remove all operands to callothersubr from the stack */ + /* */ + /* for handled othersubrs, where we know the number of */ + /* arguments, we increase the stack by the value of */ + /* known_othersubr_result_cnt */ + /* */ + /* for unhandled othersubrs the following pops adjust */ + /* the stack pointer as necessary */ count = cf2_stack_count( opStack ); FT_ASSERT( (CF2_UInt)arg_cnt <= count ); @@ -1647,23 +1660,25 @@ opIdx += count - (CF2_UInt)arg_cnt; known_othersubr_result_cnt = 0; - result_cnt = 0; - - /* XXX TODO: The checks to `arg_count == ' */ - /* might not be correct; an othersubr expects a certain */ - /* number of operands on the PostScript stack (as opposed */ - /* to the T1 stack) but it doesn't have to put them there */ - /* by itself; previous othersubrs might have left the */ - /* operands there if they were not followed by an */ - /* appropriate number of pops */ - /* */ - /* On the other hand, Adobe Reader 7.0.8 for Linux doesn't */ - /* accept a font that contains charstrings like */ - /* */ - /* 100 200 2 20 callothersubr */ - /* 300 1 20 callothersubr pop */ - /* */ - /* Perhaps this is the reason why BuildCharArray exists. */ + result_cnt = 0; + + /* XXX TODO: The checks to `arg_count == ' */ + /* might not be correct; an othersubr expects a */ + /* certain number of operands on the PostScript stack */ + /* (as opposed to the T1 stack) but it doesn't have to */ + /* put them there by itself; previous othersubrs might */ + /* have left the operands there if they were not */ + /* followed by an appropriate number of pops */ + /* */ + /* On the other hand, Adobe Reader 7.0.8 for Linux */ + /* doesn't accept a font that contains charstrings */ + /* like */ + /* */ + /* 100 200 2 20 callothersubr */ + /* 300 1 20 callothersubr pop */ + /* */ + /* Perhaps this is the reason why BuildCharArray */ + /* exists. */ switch ( subr_no ) { @@ -1681,7 +1696,8 @@ goto exit; } - /* the two `results' are popped by the following setcurrentpoint */ + /* the two `results' are popped */ + /* by the following setcurrentpoint */ cf2_stack_pushFixed( opStack, curX ); cf2_stack_pushFixed( opStack, curY ); known_othersubr_result_cnt = 2; @@ -1702,58 +1718,61 @@ break; case 2: /* add flex vectors */ - { - FT_Int idx; - FT_Int idx2; + { + FT_Int idx; + FT_Int idx2; - if ( arg_cnt != 0 ) - goto Unexpected_OtherSubr; + if ( arg_cnt != 0 ) + goto Unexpected_OtherSubr; - if ( !initial_map_ready ) - break; - - if ( !decoder->flex_state ) - { - FT_ERROR(( "cf2_interpT2CharString (Type 1 mode):" - " missing flex start\n" )); - lastError = FT_THROW( Invalid_Glyph_Format ); - goto exit; - } + if ( !initial_map_ready ) + break; - /* note that we should not add a point for index 0; */ - /* this will move our current position to the flex */ - /* point without adding any point to the outline */ - idx = decoder->num_flex_vectors++; - if ( idx > 0 && idx < 7 ) - { - /* in malformed fonts it is possible to have other */ - /* opcodes in the middle of a flex (which don't */ - /* increase `num_flex_vectors'); we thus have to */ - /* check whether we can add a point */ - if ( ps_builder_check_points( &decoder->builder, 1 ) ) + if ( !decoder->flex_state ) { + FT_ERROR(( "cf2_interpT2CharString (Type 1 mode):" + " missing flex start\n" )); lastError = FT_THROW( Invalid_Glyph_Format ); goto exit; } - /* map: 1->2 2->4 3->6 4->2 5->4 6->6 */ - idx2 = ( idx > 3 ? idx - 3 : idx ) * 2; - - flexStore[idx2 - 2] = curX; - flexStore[idx2 - 1] = curY; - - if ( idx == 3 || idx == 6 ) - cf2_glyphpath_curveTo( &glyphPath, - flexStore[0], - flexStore[1], - flexStore[2], - flexStore[3], - flexStore[4], - flexStore[5] ); + /* note that we should not add a point for */ + /* index 0; this will move our current position */ + /* to the flex point without adding any point */ + /* to the outline */ + idx = decoder->num_flex_vectors++; + if ( idx > 0 && idx < 7 ) + { + /* in malformed fonts it is possible to have */ + /* other opcodes in the middle of a flex (which */ + /* don't increase `num_flex_vectors'); we thus */ + /* have to check whether we can add a point */ + + if ( ps_builder_check_points( &decoder->builder, + 1 ) ) + { + lastError = FT_THROW( Invalid_Glyph_Format ); + goto exit; + } + + /* map: 1->2 2->4 3->6 4->2 5->4 6->6 */ + idx2 = ( idx > 3 ? idx - 3 : idx ) * 2; + + flexStore[idx2 - 2] = curX; + flexStore[idx2 - 1] = curY; + + if ( idx == 3 || idx == 6 ) + cf2_glyphpath_curveTo( &glyphPath, + flexStore[0], + flexStore[1], + flexStore[2], + flexStore[3], + flexStore[4], + flexStore[5] ); + } } - } - break; + break; case 3: /* change hints */ if ( arg_cnt != 1 ) @@ -1785,221 +1804,242 @@ case 16: case 17: case 18: /* multiple masters */ - { - PS_Blend blend = decoder->blend; - FT_UInt num_points, nn, mm; - CF2_UInt delta; - CF2_UInt values; + { + PS_Blend blend = decoder->blend; + FT_UInt num_points, nn, mm; + CF2_UInt delta; + CF2_UInt values; - if ( !blend ) - { - FT_ERROR(( "t1_decoder_parse_charstrings:" - " unexpected multiple masters operator\n" )); - lastError = FT_THROW( Invalid_Glyph_Format ); - goto exit; - } + if ( !blend ) + { + FT_ERROR(( + "cf2_interpT2CharString:" + " unexpected multiple masters operator\n" )); + lastError = FT_THROW( Invalid_Glyph_Format ); + goto exit; + } - num_points = (FT_UInt)subr_no - 13 + ( subr_no == 18 ); - if ( arg_cnt != (FT_Int)( num_points * blend->num_designs ) ) - { - FT_ERROR(( "t1_decoder_parse_charstrings:" - " incorrect number of multiple masters arguments\n" )); - lastError = FT_THROW( Invalid_Glyph_Format ); - goto exit; - } + num_points = (FT_UInt)subr_no - 13 + + ( subr_no == 18 ); + if ( arg_cnt != (FT_Int)( num_points * + blend->num_designs ) ) + { + FT_ERROR(( + "cf2_interpT2CharString:" + " incorrect number of multiple masters arguments\n" )); + lastError = FT_THROW( Invalid_Glyph_Format ); + goto exit; + } - /* We want to compute */ - /* */ - /* a0*w0 + a1*w1 + ... + ak*wk */ - /* */ - /* but we only have a0, a1-a0, a2-a0, ..., ak-a0. */ - /* */ - /* However, given that w0 + w1 + ... + wk == 1, we can */ - /* rewrite it easily as */ - /* */ - /* a0 + (a1-a0)*w1 + (a2-a0)*w2 + ... + (ak-a0)*wk */ - /* */ - /* where k == num_designs-1. */ - /* */ - /* I guess that's why it's written in this `compact' */ - /* form. */ - /* */ - delta = opIdx + num_points; - values = opIdx; - for ( nn = 0; nn < num_points; nn++ ) - { - CF2_Fixed tmp = cf2_stack_getReal( opStack, values ); + /* We want to compute */ + /* */ + /* a0*w0 + a1*w1 + ... + ak*wk */ + /* */ + /* but we only have a0, a1-a0, a2-a0, ..., ak-a0. */ + /* */ + /* However, given that w0 + w1 + ... + wk == 1, we */ + /* can rewrite it easily as */ + /* */ + /* a0 + (a1-a0)*w1 + (a2-a0)*w2 + ... + (ak-a0)*wk */ + /* */ + /* where k == num_designs-1. */ + /* */ + /* I guess that's why it's written in this `compact' */ + /* form. */ + /* */ + delta = opIdx + num_points; + values = opIdx; + for ( nn = 0; nn < num_points; nn++ ) + { + CF2_Fixed tmp = cf2_stack_getReal( opStack, + values ); - for ( mm = 1; mm < blend->num_designs; mm++ ) - tmp = ADD_INT32( tmp, - FT_MulFix( cf2_stack_getReal( opStack, delta++ ), - blend->weight_vector[mm] ) ); + for ( mm = 1; mm < blend->num_designs; mm++ ) + tmp = ADD_INT32( tmp, + FT_MulFix( + cf2_stack_getReal( opStack, + delta++ ), + blend->weight_vector[mm] ) ); - cf2_stack_setReal( opStack, values++, tmp ); - } - cf2_stack_pop( opStack, - (CF2_UInt)arg_cnt - num_points ); + cf2_stack_setReal( opStack, values++, tmp ); + } + cf2_stack_pop( opStack, + (CF2_UInt)arg_cnt - num_points ); - known_othersubr_result_cnt = (FT_Int)num_points; - break; - } + known_othersubr_result_cnt = (FT_Int)num_points; + break; + } case 19: - /* 1 19 callothersubr */ - /* => replace elements starting from index cvi( ) */ - /* of BuildCharArray with WeightVector */ - { - FT_Int idx; - PS_Blend blend = decoder->blend; + /* 1 19 callothersubr */ + /* ==> replace elements starting from index */ + /* cvi( ) of BuildCharArray with */ + /* WeightVector */ + { + FT_Int idx; + PS_Blend blend = decoder->blend; - if ( arg_cnt != 1 || !blend ) - goto Unexpected_OtherSubr; + if ( arg_cnt != 1 || !blend ) + goto Unexpected_OtherSubr; - idx = cf2_stack_popInt( opStack ); + idx = cf2_stack_popInt( opStack ); - if ( idx < 0 || - (FT_UInt)idx + blend->num_designs > decoder->len_buildchar ) - goto Unexpected_OtherSubr; + if ( idx < 0 || + (FT_UInt)idx + blend->num_designs > + decoder->len_buildchar ) + goto Unexpected_OtherSubr; - ft_memcpy( &decoder->buildchar[idx], - blend->weight_vector, - blend->num_designs * - sizeof ( blend->weight_vector[0] ) ); - } - break; + ft_memcpy( &decoder->buildchar[idx], + blend->weight_vector, + blend->num_designs * + sizeof ( blend->weight_vector[0] ) ); + } + break; case 20: /* 2 20 callothersubr pop */ /* ==> push + onto T1 stack */ - { - CF2_F16Dot16 summand1; - CF2_F16Dot16 summand2; + { + CF2_F16Dot16 summand1; + CF2_F16Dot16 summand2; - if ( arg_cnt != 2 ) - goto Unexpected_OtherSubr; - summand2 = cf2_stack_popFixed( opStack ); - summand1 = cf2_stack_popFixed( opStack ); + if ( arg_cnt != 2 ) + goto Unexpected_OtherSubr; - cf2_stack_pushFixed( opStack, - ADD_INT32( summand1, - summand2 ) ); - known_othersubr_result_cnt = 1; - } - break; + summand2 = cf2_stack_popFixed( opStack ); + summand1 = cf2_stack_popFixed( opStack ); + + cf2_stack_pushFixed( opStack, + ADD_INT32( summand1, + summand2 ) ); + known_othersubr_result_cnt = 1; + } + break; case 21: /* 2 21 callothersubr pop */ /* ==> push - onto T1 stack */ - { - CF2_F16Dot16 minuend; - CF2_F16Dot16 subtrahend; + { + CF2_F16Dot16 minuend; + CF2_F16Dot16 subtrahend; - if ( arg_cnt != 2 ) - goto Unexpected_OtherSubr; - subtrahend = cf2_stack_popFixed( opStack ); - minuend = cf2_stack_popFixed( opStack ); + if ( arg_cnt != 2 ) + goto Unexpected_OtherSubr; - cf2_stack_pushFixed( opStack, - SUB_INT32( minuend, subtrahend ) ); - known_othersubr_result_cnt = 1; - } - break; + subtrahend = cf2_stack_popFixed( opStack ); + minuend = cf2_stack_popFixed( opStack ); + + cf2_stack_pushFixed( opStack, + SUB_INT32( minuend, + subtrahend ) ); + known_othersubr_result_cnt = 1; + } + break; case 22: /* 2 22 callothersubr pop */ /* ==> push * onto T1 stack */ - { - CF2_F16Dot16 factor1; - CF2_F16Dot16 factor2; + { + CF2_F16Dot16 factor1; + CF2_F16Dot16 factor2; - if ( arg_cnt != 2 ) - goto Unexpected_OtherSubr; - factor2 = cf2_stack_popFixed( opStack ); - factor1 = cf2_stack_popFixed( opStack ); + if ( arg_cnt != 2 ) + goto Unexpected_OtherSubr; - cf2_stack_pushFixed( opStack, - FT_MulFix( factor1, factor2 ) ); - known_othersubr_result_cnt = 1; - } - break; + factor2 = cf2_stack_popFixed( opStack ); + factor1 = cf2_stack_popFixed( opStack ); + + cf2_stack_pushFixed( opStack, + FT_MulFix( factor1, factor2 ) ); + known_othersubr_result_cnt = 1; + } + break; case 23: /* 2 23 callothersubr pop */ /* ==> push / onto T1 stack */ - { - CF2_F16Dot16 dividend; - CF2_F16Dot16 divisor; + { + CF2_F16Dot16 dividend; + CF2_F16Dot16 divisor; - if ( arg_cnt != 2 ) - goto Unexpected_OtherSubr; - divisor = cf2_stack_popFixed( opStack ); - dividend = cf2_stack_popFixed( opStack ); + if ( arg_cnt != 2 ) + goto Unexpected_OtherSubr; - if ( divisor == 0 ) - goto Unexpected_OtherSubr; + divisor = cf2_stack_popFixed( opStack ); + dividend = cf2_stack_popFixed( opStack ); - cf2_stack_pushFixed( opStack, - FT_DivFix( dividend, divisor ) ); - known_othersubr_result_cnt = 1; - } - break; + if ( divisor == 0 ) + goto Unexpected_OtherSubr; + + cf2_stack_pushFixed( opStack, + FT_DivFix( dividend, + divisor ) ); + known_othersubr_result_cnt = 1; + } + break; case 24: /* 2 24 callothersubr */ /* ==> set BuildCharArray[cvi( )] = */ - { - CF2_Int idx; - PS_Blend blend = decoder->blend; + { + CF2_Int idx; + PS_Blend blend = decoder->blend; - if ( arg_cnt != 2 || !blend ) - goto Unexpected_OtherSubr; + if ( arg_cnt != 2 || !blend ) + goto Unexpected_OtherSubr; - idx = cf2_stack_popInt( opStack ); + idx = cf2_stack_popInt( opStack ); - if ( idx < 0 || (FT_UInt) idx >= decoder->len_buildchar ) - goto Unexpected_OtherSubr; + if ( idx < 0 || + (FT_UInt)idx >= decoder->len_buildchar ) + goto Unexpected_OtherSubr; - decoder->buildchar[idx] = cf2_stack_popFixed( opStack ); - } - break; + decoder->buildchar[idx] = + cf2_stack_popFixed( opStack ); + } + break; case 25: /* 1 25 callothersubr pop */ /* ==> push BuildCharArray[cvi( idx )] */ /* onto T1 stack */ - { - CF2_Int idx; - PS_Blend blend = decoder->blend; + { + CF2_Int idx; + PS_Blend blend = decoder->blend; - if ( arg_cnt != 1 || !blend ) - goto Unexpected_OtherSubr; + if ( arg_cnt != 1 || !blend ) + goto Unexpected_OtherSubr; - idx = cf2_stack_popInt( opStack ); + idx = cf2_stack_popInt( opStack ); - if ( idx < 0 || (FT_UInt) idx >= decoder->len_buildchar ) - goto Unexpected_OtherSubr; + if ( idx < 0 || + (FT_UInt)idx >= decoder->len_buildchar ) + goto Unexpected_OtherSubr; - cf2_stack_pushFixed( opStack, - decoder->buildchar[idx] ); - known_othersubr_result_cnt = 1; - } - break; + cf2_stack_pushFixed( opStack, + decoder->buildchar[idx] ); + known_othersubr_result_cnt = 1; + } + break; #if 0 case 26: - /* mark ==> set BuildCharArray[cvi( )] = , */ - /* leave mark on T1 stack */ - /* ==> set BuildCharArray[cvi( )] = */ - XXX which routine has left its mark on the (PostScript) stack?; + /* mark */ + /* ==> set BuildCharArray[cvi( )] = , */ + /* leave mark on T1 stack */ + /* */ + /* ==> set BuildCharArray[cvi( )] = */ + XXX which routine has left its mark on the + XXX (PostScript) stack?; break; #endif @@ -2007,67 +2047,72 @@ /* 4 27 callothersubr pop */ /* ==> push onto T1 stack if <= , */ /* otherwise push */ - { - CF2_F16Dot16 arg1; - CF2_F16Dot16 arg2; - CF2_F16Dot16 cond1; - CF2_F16Dot16 cond2; + { + CF2_F16Dot16 arg1; + CF2_F16Dot16 arg2; + CF2_F16Dot16 cond1; + CF2_F16Dot16 cond2; - if ( arg_cnt != 4 ) - goto Unexpected_OtherSubr; - cond2 = cf2_stack_popFixed( opStack ); - cond1 = cf2_stack_popFixed( opStack ); - arg2 = cf2_stack_popFixed( opStack ); - arg1 = cf2_stack_popFixed( opStack ); + if ( arg_cnt != 4 ) + goto Unexpected_OtherSubr; - cf2_stack_pushFixed( opStack, - cond1 <= cond2 ? arg1 : arg2 ); - known_othersubr_result_cnt = 1; - } - break; + cond2 = cf2_stack_popFixed( opStack ); + cond1 = cf2_stack_popFixed( opStack ); + arg2 = cf2_stack_popFixed( opStack ); + arg1 = cf2_stack_popFixed( opStack ); + + cf2_stack_pushFixed( opStack, + cond1 <= cond2 ? arg1 : arg2 ); + known_othersubr_result_cnt = 1; + } + break; case 28: - /* 0 28 callothersubr pop */ - /* => push random value from interval [0, 1) onto stack */ - { - CF2_F16Dot16 r; + /* 0 28 callothersubr pop */ + /* ==> push random value from interval [0, 1) */ + /* onto stack */ + { + CF2_F16Dot16 r; - if ( arg_cnt != 0 ) - goto Unexpected_OtherSubr; - /* only use the lower 16 bits of `random' */ - /* to generate a number in the range (0;1] */ - r = (CF2_F16Dot16) - ( ( decoder->current_subfont->random & 0xFFFF ) + 1 ); + if ( arg_cnt != 0 ) + goto Unexpected_OtherSubr; - decoder->current_subfont->random = - cff_random( decoder->current_subfont->random ); + /* only use the lower 16 bits of `random' */ + /* to generate a number in the range (0;1] */ + r = (CF2_F16Dot16) + ( ( decoder->current_subfont->random & 0xFFFF ) + 1 ); - cf2_stack_pushFixed( opStack, r ); - known_othersubr_result_cnt = 1; - } - break; + decoder->current_subfont->random = + cff_random( decoder->current_subfont->random ); + + cf2_stack_pushFixed( opStack, r ); + known_othersubr_result_cnt = 1; + } + break; default: if ( arg_cnt >= 0 && subr_no >= 0 ) { FT_Int i; - FT_ERROR(( "cf2_interpT2CharString (Type 1 mode):" - " unknown othersubr [%d %d], wish me luck\n", - arg_cnt, subr_no )); - /* Store the unused args for this unhandled OtherSubr */ + FT_ERROR(( + "cf2_interpT2CharString (Type 1 mode):" + " unknown othersubr [%d %d], wish me luck\n", + arg_cnt, subr_no )); + + /* store the unused args */ + /* for this unhandled OtherSubr */ if ( arg_cnt > PS_STORAGE_SIZE ) arg_cnt = PS_STORAGE_SIZE; result_cnt = arg_cnt; for ( i = 1; i <= arg_cnt; i++ ) - { - results[result_cnt - i] = cf2_stack_popFixed( opStack ); - } + results[result_cnt - i] = + cf2_stack_popFixed( opStack ); break; } @@ -2075,7 +2120,8 @@ Unexpected_OtherSubr: FT_ERROR(( "cf2_interpT2CharString (Type 1 mode):" - " invalid othersubr [%d %d]\n", arg_cnt, subr_no )); + " invalid othersubr [%d %d]\n", + arg_cnt, subr_no )); lastError = FT_THROW( Invalid_Glyph_Format ); goto exit; } @@ -2320,23 +2366,24 @@ if ( !initial_map_ready ) break; - /* From the T1 specification, section 6.4: */ - /* */ - /* The setcurrentpoint command is used only in */ - /* conjunction with results from OtherSubrs procedures. */ + /* 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. */ + /* 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:" + FT_ERROR(( "cf2_interpT2CharString:" " unexpected `setcurrentpoint'\n" )); goto Syntax_Error; } @@ -2361,9 +2408,7 @@ case cf2_cmdHSBW: if ( !font->isT1 ) - { FT_TRACE4(( " unknown op (%d)\n", op1 )); - } else { CF2_Fixed lsb_x; @@ -2403,12 +2448,12 @@ FT_TRACE5(( "cf2_interpT2CharString (Type 1 mode): " "Build initial hintmap, rewinding...\n" )); - /* Trigger initial hintmap build */ + /* trigger initial hintmap build */ cf2_glyphpath_moveTo( &glyphPath, curX, curY ); initial_map_ready = TRUE; - /* Change hints routine - clear for rewind */ + /* change hints routine - clear for rewind */ cf2_arrstack_clear( &vStemHintArray ); cf2_arrstack_clear( &hStemHintArray ); @@ -2416,7 +2461,7 @@ hintMask.isValid = FALSE; hintMask.isNew = TRUE; - /* Rewind charstring */ + /* rewind charstring */ charstring->ptr = charstring->start; break; @@ -2439,7 +2484,8 @@ /* close path if still open */ cf2_glyphpath_closeOpenPath( &glyphPath ); - /* disable seac for CFF2 and Type1 (charstring ending with args on stack) */ + /* disable seac for CFF2 and Type1 */ + /* (charstring ending with args on stack) */ if ( !font->isCFF2 && !font->isT1 && cf2_stack_count( opStack ) > 1 ) { /* must be either 4 or 5 -- */ @@ -2575,10 +2621,8 @@ FT_TRACE4(( " rmoveto\n" )); if ( font->isT1 && !decoder->flex_state && !haveWidth ) - { FT_ERROR(( "cf2_interpT2CharString (Type 1 mode):" " No width. Use hsbw/sbw as first op\n" )); - } if ( cf2_stack_count( opStack ) > 2 && !haveWidth ) *width = ADD_INT32( cf2_stack_getReal( opStack, 0 ), @@ -2602,10 +2646,8 @@ FT_TRACE4(( " hmoveto\n" )); if ( font->isT1 && !decoder->flex_state && !haveWidth ) - { FT_ERROR(( "cf2_interpT2CharString (Type 1 mode):" " No width. Use hsbw/sbw as first op\n" )); - } if ( cf2_stack_count( opStack ) > 1 && !haveWidth ) *width = ADD_INT32( cf2_stack_getReal( opStack, 0 ), @@ -2910,25 +2952,28 @@ ( byte3 << 8 ) | byte4 ); - /* For Type 1: */ - /* According to the specification, values > 32000 or < -32000 must */ - /* be followed by a `div' operator to make the result be in the */ - /* range [-32000;32000]. We expect that the second argument of */ - /* `div' is not a large number. Additionally, we don't handle */ - /* stuff like ` div div' or */ - /* div div'. This is probably not allowed */ - /* anyway. */ - /* + div is not checked but should not be */ - /* allowed as the large value remains untouched. */ + /* + * For Type 1: + * + * According to the specification, values > 32000 or < -32000 + * must be followed by a `div' operator to make the result be + * in the range [-32000;32000]. We expect that the second + * argument of `div' is not a large number. Additionally, we + * don't handle stuff like ` div + * div' or div div'. This is probably + * not allowed anyway. + * + * + div is not checked but should not be + * allowed as the large value remains untouched. + * + */ if ( font->isT1 ) { if ( v > 32000 || v < -32000 ) { if ( large_int ) - { FT_ERROR(( "cf2_interpT2CharString (Type 1 mode):" " no `div' after large integer\n" )); - } else large_int = TRUE; } @@ -2943,7 +2988,6 @@ cf2_stack_pushFixed( opStack, v ); } - } } continue; /* don't clear stack */ diff --git a/src/psaux/psintrp.h b/src/psaux/psintrp.h index ec22ddcb7..4790aaa30 100644 --- a/src/psaux/psintrp.h +++ b/src/psaux/psintrp.h @@ -36,8 +36,8 @@ /***************************************************************************/ -#ifndef CF2INTRP_H_ -#define CF2INTRP_H_ +#ifndef PSINTRP_H_ +#define PSINTRP_H_ #include "psft.h" @@ -77,7 +77,7 @@ FT_BEGIN_HEADER FT_END_HEADER -#endif /* CF2INTRP_H_ */ +#endif /* PSINTRP_H_ */ /* END */ diff --git a/src/psaux/psobjs.c b/src/psaux/psobjs.c index 1b0b094c0..72442058c 100644 --- a/src/psaux/psobjs.c +++ b/src/psaux/psobjs.c @@ -2064,53 +2064,55 @@ { T1_Builder t1builder = (T1_Builder)builder; - ps_builder->memory = t1builder->memory; - ps_builder->face = (FT_Face)t1builder->face; - ps_builder->glyph = (CFF_GlyphSlot)t1builder->glyph; - ps_builder->loader = t1builder->loader; - ps_builder->base = t1builder->base; - ps_builder->current = t1builder->current; - ps_builder->pos_x = &t1builder->pos_x; - ps_builder->pos_y = &t1builder->pos_y; + ps_builder->memory = t1builder->memory; + ps_builder->face = (FT_Face)t1builder->face; + ps_builder->glyph = (CFF_GlyphSlot)t1builder->glyph; + ps_builder->loader = t1builder->loader; + ps_builder->base = t1builder->base; + ps_builder->current = t1builder->current; - ps_builder->left_bearing = &t1builder->left_bearing; - ps_builder->advance = &t1builder->advance; + ps_builder->pos_x = &t1builder->pos_x; + ps_builder->pos_y = &t1builder->pos_y; - ps_builder->bbox = &t1builder->bbox; - ps_builder->path_begun = 0; - ps_builder->load_points = t1builder->load_points; - ps_builder->no_recurse = t1builder->no_recurse; + ps_builder->left_bearing = &t1builder->left_bearing; + ps_builder->advance = &t1builder->advance; - ps_builder->metrics_only = t1builder->metrics_only; + ps_builder->bbox = &t1builder->bbox; + ps_builder->path_begun = 0; + ps_builder->load_points = t1builder->load_points; + ps_builder->no_recurse = t1builder->no_recurse; + + ps_builder->metrics_only = t1builder->metrics_only; } else { CFF_Builder* cffbuilder = (CFF_Builder*)builder; - ps_builder->memory = cffbuilder->memory; - ps_builder->face = (FT_Face)cffbuilder->face; - ps_builder->glyph = cffbuilder->glyph; - ps_builder->loader = cffbuilder->loader; - ps_builder->base = cffbuilder->base; - ps_builder->current = cffbuilder->current; - ps_builder->pos_x = &cffbuilder->pos_x; - ps_builder->pos_y = &cffbuilder->pos_y; + ps_builder->memory = cffbuilder->memory; + ps_builder->face = (FT_Face)cffbuilder->face; + ps_builder->glyph = cffbuilder->glyph; + ps_builder->loader = cffbuilder->loader; + ps_builder->base = cffbuilder->base; + ps_builder->current = cffbuilder->current; + + ps_builder->pos_x = &cffbuilder->pos_x; + ps_builder->pos_y = &cffbuilder->pos_y; - ps_builder->left_bearing = &cffbuilder->left_bearing; - ps_builder->advance = &cffbuilder->advance; + ps_builder->left_bearing = &cffbuilder->left_bearing; + ps_builder->advance = &cffbuilder->advance; - ps_builder->bbox = &cffbuilder->bbox; - ps_builder->path_begun = cffbuilder->path_begun; - ps_builder->load_points = cffbuilder->load_points; - ps_builder->no_recurse = cffbuilder->no_recurse; + ps_builder->bbox = &cffbuilder->bbox; + ps_builder->path_begun = cffbuilder->path_begun; + ps_builder->load_points = cffbuilder->load_points; + ps_builder->no_recurse = cffbuilder->no_recurse; - ps_builder->metrics_only = cffbuilder->metrics_only; + ps_builder->metrics_only = cffbuilder->metrics_only; } - ps_builder->is_t1 = is_t1; - ps_builder->funcs = ps_builder_funcs; + ps_builder->is_t1 = is_t1; + ps_builder->funcs = ps_builder_funcs; } @@ -2164,6 +2166,7 @@ PS_Driver driver = (PS_Driver)FT_FACE_DRIVER( builder->face ); + #ifdef CFF_CONFIG_OPTION_OLD_ENGINE if ( !builder->is_t1 && driver->hinting_engine == FT_CFF_HINTING_FREETYPE ) @@ -2219,7 +2222,7 @@ /* this might happen in invalid fonts */ if ( !outline ) { - FT_ERROR(( "t1_builder_add_contour: no outline to add points to\n" )); + FT_ERROR(( "ps_builder_add_contour: no outline to add points to\n" )); return FT_THROW( Invalid_File_Format ); } @@ -2356,61 +2359,63 @@ { T1_Decoder t1_decoder = (T1_Decoder)decoder; + ps_builder_init( &ps_decoder->builder, &t1_decoder->builder, is_t1 ); - ps_decoder->cf2_instance = &t1_decoder->cf2_instance; - ps_decoder->psnames = t1_decoder->psnames; + ps_decoder->cf2_instance = &t1_decoder->cf2_instance; + ps_decoder->psnames = t1_decoder->psnames; - ps_decoder->num_glyphs = t1_decoder->num_glyphs; - ps_decoder->glyph_names = t1_decoder->glyph_names; - ps_decoder->hint_mode = t1_decoder->hint_mode; - ps_decoder->blend = t1_decoder->blend; + ps_decoder->num_glyphs = t1_decoder->num_glyphs; + ps_decoder->glyph_names = t1_decoder->glyph_names; + ps_decoder->hint_mode = t1_decoder->hint_mode; + ps_decoder->blend = t1_decoder->blend; - ps_decoder->num_locals = (FT_UInt)t1_decoder->num_subrs; - ps_decoder->locals = t1_decoder->subrs; - ps_decoder->locals_len = t1_decoder->subrs_len; - ps_decoder->locals_hash = t1_decoder->subrs_hash; + ps_decoder->num_locals = (FT_UInt)t1_decoder->num_subrs; + ps_decoder->locals = t1_decoder->subrs; + ps_decoder->locals_len = t1_decoder->subrs_len; + ps_decoder->locals_hash = t1_decoder->subrs_hash; - ps_decoder->buildchar = t1_decoder->buildchar; - ps_decoder->len_buildchar = t1_decoder->len_buildchar; + ps_decoder->buildchar = t1_decoder->buildchar; + ps_decoder->len_buildchar = t1_decoder->len_buildchar; - ps_decoder->lenIV = t1_decoder->lenIV; + ps_decoder->lenIV = t1_decoder->lenIV; } else { CFF_Decoder* cff_decoder = (CFF_Decoder*)decoder; + ps_builder_init( &ps_decoder->builder, &cff_decoder->builder, is_t1 ); - ps_decoder->cff = cff_decoder->cff; - ps_decoder->cf2_instance = &cff_decoder->cff->cf2_instance; - ps_decoder->current_subfont = cff_decoder->current_subfont; + ps_decoder->cff = cff_decoder->cff; + ps_decoder->cf2_instance = &cff_decoder->cff->cf2_instance; + ps_decoder->current_subfont = cff_decoder->current_subfont; - ps_decoder->num_globals = cff_decoder->num_globals; - ps_decoder->globals = cff_decoder->globals; - ps_decoder->globals_bias = cff_decoder->globals_bias; - ps_decoder->num_locals = cff_decoder->num_locals; - ps_decoder->locals = cff_decoder->locals; - ps_decoder->locals_bias = cff_decoder->locals_bias; + ps_decoder->num_globals = cff_decoder->num_globals; + ps_decoder->globals = cff_decoder->globals; + ps_decoder->globals_bias = cff_decoder->globals_bias; + ps_decoder->num_locals = cff_decoder->num_locals; + ps_decoder->locals = cff_decoder->locals; + ps_decoder->locals_bias = cff_decoder->locals_bias; - ps_decoder->glyph_width = cff_decoder->glyph_width; - ps_decoder->nominal_width = cff_decoder->nominal_width; - ps_decoder->width_only = cff_decoder->width_only; + ps_decoder->glyph_width = cff_decoder->glyph_width; + ps_decoder->nominal_width = cff_decoder->nominal_width; + ps_decoder->width_only = cff_decoder->width_only; - ps_decoder->hint_mode = cff_decoder->hint_mode; + ps_decoder->hint_mode = cff_decoder->hint_mode; - ps_decoder->get_glyph_callback = cff_decoder->get_glyph_callback; - ps_decoder->free_glyph_callback = cff_decoder->free_glyph_callback; + ps_decoder->get_glyph_callback = cff_decoder->get_glyph_callback; + ps_decoder->free_glyph_callback = cff_decoder->free_glyph_callback; } } /* Synthesize a SubFont object for Type 1 fonts, for use in the */ - /* new interpreter to access Private dict data */ + /* new interpreter to access Private dict data. */ FT_LOCAL_DEF( void ) t1_make_subfont( FT_Face face, PS_Private priv, @@ -2419,6 +2424,7 @@ CFF_Private cpriv = &subfont->private_dict; FT_UInt n, count; + FT_ZERO( subfont ); FT_ZERO( cpriv ); @@ -2442,8 +2448,8 @@ cpriv->blue_shift = (FT_Pos)priv->blue_shift; cpriv->blue_fuzz = (FT_Pos)priv->blue_fuzz; - cpriv->standard_width = (FT_Pos)priv->standard_width[0]; - cpriv->standard_height = (FT_Pos)priv->standard_height[0]; + cpriv->standard_width = (FT_Pos)priv->standard_width[0]; + cpriv->standard_height = (FT_Pos)priv->standard_height[0]; count = cpriv->num_snap_widths = priv->num_snap_widths; for ( n = 0; n < count; n++ ) @@ -2458,14 +2464,14 @@ cpriv->language_group = priv->language_group; cpriv->expansion_factor = priv->expansion_factor; - cpriv->subfont = subfont; + cpriv->subfont = subfont; /* Initialize the random number generator. */ if ( face->internal->random_seed != -1 ) { - /* . If we have a face-specific seed, use it. */ - /* If non-zero, update it to a positive value. */ + /* If we have a face-specific seed, use it. */ + /* If non-zero, update it to a positive value. */ subfont->random = (FT_UInt32)face->internal->random_seed; if ( face->internal->random_seed ) { @@ -2473,6 +2479,7 @@ { face->internal->random_seed = (FT_Int32)cff_random( (FT_UInt32)face->internal->random_seed ); + } while ( face->internal->random_seed < 0 ); } } @@ -2480,6 +2487,7 @@ { FT_UInt32 seed; + /* compute random seed from some memory addresses */ seed = (FT_UInt32)( (FT_Offset)(char*)&seed ^ (FT_Offset)(char*)&face ^ diff --git a/src/psaux/psread.h b/src/psaux/psread.h index 9e2119509..464b29ba7 100644 --- a/src/psaux/psread.h +++ b/src/psaux/psread.h @@ -36,8 +36,8 @@ /***************************************************************************/ -#ifndef CF2READ_H_ -#define CF2READ_H_ +#ifndef PSREAD_H_ +#define PSREAD_H_ FT_BEGIN_HEADER @@ -62,7 +62,7 @@ FT_BEGIN_HEADER FT_END_HEADER -#endif /* CF2READ_H_ */ +#endif /* PSREAD_H_ */ /* END */ diff --git a/src/psaux/psstack.h b/src/psaux/psstack.h index 1b9865dea..38f7b41c6 100644 --- a/src/psaux/psstack.h +++ b/src/psaux/psstack.h @@ -36,8 +36,8 @@ /***************************************************************************/ -#ifndef CF2STACK_H_ -#define CF2STACK_H_ +#ifndef PSSTACK_H_ +#define PSSTACK_H_ FT_BEGIN_HEADER @@ -115,7 +115,7 @@ FT_BEGIN_HEADER FT_END_HEADER -#endif /* CF2STACK_H_ */ +#endif /* PSSTACK_H_ */ /* END */ diff --git a/src/psaux/pstypes.h b/src/psaux/pstypes.h index 9f31493f2..dfbaa3d47 100644 --- a/src/psaux/pstypes.h +++ b/src/psaux/pstypes.h @@ -36,8 +36,8 @@ /***************************************************************************/ -#ifndef CF2TYPES_H_ -#define CF2TYPES_H_ +#ifndef PSTYPES_H_ +#define PSTYPES_H_ #include #include FT_FREETYPE_H @@ -72,7 +72,7 @@ FT_BEGIN_HEADER FT_END_HEADER -#endif /* CF2TYPES_H_ */ +#endif /* PSTYPES_H_ */ /* END */ diff --git a/src/psaux/t1decode.c b/src/psaux/t1decode.c index 37790c50b..e68b76dac 100644 --- a/src/psaux/t1decode.c +++ b/src/psaux/t1decode.c @@ -1692,6 +1692,7 @@ { FT_Memory memory = decoder->builder.memory; + t1_builder_done( &decoder->builder ); if ( decoder->cf2_instance.finalizer ) From af03d1eaa173d9a1016370ed182fd98cda66965e Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sun, 1 Oct 2017 09:23:42 +0200 Subject: [PATCH 303/470] [smooth,type1] Formatting, whitespace. --- src/smooth/ftsmooth.c | 18 ++++++++++-------- src/type1/t1gload.c | 40 ++++++++++++++++++++++------------------ 2 files changed, 32 insertions(+), 26 deletions(-) diff --git a/src/smooth/ftsmooth.c b/src/smooth/ftsmooth.c index db3a1c31d..938d295ad 100644 --- a/src/smooth/ftsmooth.c +++ b/src/smooth/ftsmooth.c @@ -231,9 +231,9 @@ FT_Byte* temp; FT_Int i, j; - unsigned int height = bitmap->rows; - unsigned int width = bitmap->width; - int pitch = bitmap->pitch; + unsigned int height = bitmap->rows; + unsigned int width = bitmap->width; + int pitch = bitmap->pitch; /* Render 3 separate monochrome bitmaps, shifting the outline */ @@ -247,7 +247,7 @@ goto Exit; FT_Outline_Translate( outline, -21, 0 ); - x_shift -= 21; + x_shift -= 21; bitmap->buffer += width; error = render->raster_render( render->raster, ¶ms ); @@ -255,7 +255,7 @@ goto Exit; FT_Outline_Translate( outline, 42, 0 ); - x_shift += 42; + x_shift += 42; bitmap->buffer -= 2 * width; error = render->raster_render( render->raster, ¶ms ); @@ -284,7 +284,7 @@ } else if ( vmul ) /* lcd_v */ { - int pitch = bitmap->pitch; + int pitch = bitmap->pitch; /* Render 3 separate monochrome bitmaps, shifting the outline */ @@ -299,7 +299,7 @@ goto Exit; FT_Outline_Translate( outline, 0, 21 ); - y_shift += 21; + y_shift += 21; bitmap->buffer += pitch; error = render->raster_render( render->raster, ¶ms ); @@ -307,7 +307,7 @@ goto Exit; FT_Outline_Translate( outline, 0, -42 ); - y_shift -= 42; + y_shift -= 42; bitmap->buffer -= 2 * pitch; error = render->raster_render( render->raster, ¶ms ); @@ -324,8 +324,10 @@ Exit: if ( !error ) + { /* everything is fine; the glyph is now officially a bitmap */ slot->format = FT_GLYPH_FORMAT_BITMAP; + } else if ( slot->internal->flags & FT_GLYPH_OWN_BITMAP ) { FT_FREE( bitmap->buffer ); diff --git a/src/type1/t1gload.c b/src/type1/t1gload.c index 341d71a0f..30ca186fc 100644 --- a/src/type1/t1gload.c +++ b/src/type1/t1gload.c @@ -49,9 +49,9 @@ T1_Font type1 = &face->type1; FT_Error error = FT_Err_Ok; - PSAux_Service psaux = (PSAux_Service)face->psaux; - const T1_Decoder_Funcs decoder_funcs = psaux->t1_decoder_funcs; - PS_Decoder psdecoder; + PSAux_Service psaux = (PSAux_Service)face->psaux; + const T1_Decoder_Funcs decoder_funcs = psaux->t1_decoder_funcs; + PS_Decoder psdecoder; #ifdef FT_CONFIG_OPTION_INCREMENTAL FT_Incremental_InterfaceRec *inc = @@ -60,6 +60,7 @@ PS_Driver driver = (PS_Driver)FT_FACE_DRIVER( face ); + decoder->font_matrix = type1->font_matrix; decoder->font_offset = type1->font_offset; @@ -84,10 +85,11 @@ { /* choose which renderer to use */ if ( driver->hinting_engine == FT_T1_HINTING_FREETYPE || - decoder->builder.metrics_only ) - error = decoder_funcs->parse_charstrings_old( decoder, - (FT_Byte*)char_string->pointer, - (FT_UInt)char_string->length ); + decoder->builder.metrics_only ) + error = decoder_funcs->parse_charstrings_old( + decoder, + (FT_Byte*)char_string->pointer, + (FT_UInt)char_string->length ); else { CFF_SubFontRec subfont; @@ -95,12 +97,14 @@ psaux->ps_decoder_init( &psdecoder, decoder, TRUE ); - psaux->t1_make_subfont( FT_FACE( face ), &face->type1.private_dict, &subfont ); + psaux->t1_make_subfont( FT_FACE( face ), + &face->type1.private_dict, &subfont ); psdecoder.current_subfont = &subfont; - error = decoder_funcs->parse_charstrings( &psdecoder, - (FT_Byte*)char_string->pointer, - (FT_ULong)char_string->length ); + error = decoder_funcs->parse_charstrings( + &psdecoder, + (FT_Byte*)char_string->pointer, + (FT_ULong)char_string->length ); /* Adobe's engine uses 16.16 numbers everywhere; */ /* as a consequence, glyphs larger than 2000ppem get rejected */ @@ -113,12 +117,12 @@ *force_scaling = TRUE; - error = decoder_funcs->parse_charstrings( &psdecoder, - (FT_Byte*)char_string->pointer, - (FT_ULong)char_string->length ); + error = decoder_funcs->parse_charstrings( + &psdecoder, + (FT_Byte*)char_string->pointer, + (FT_ULong)char_string->length ); } } - } #ifdef FT_CONFIG_OPTION_INCREMENTAL @@ -154,9 +158,9 @@ { FT_Data glyph_data; FT_Bool force_scaling = FALSE; - FT_Error error = T1_Parse_Glyph_And_Get_Char_String( - decoder, glyph_index, &glyph_data, - &force_scaling ); + FT_Error error = T1_Parse_Glyph_And_Get_Char_String( + decoder, glyph_index, &glyph_data, + &force_scaling ); #ifdef FT_CONFIG_OPTION_INCREMENTAL From 4a5c0b1456b7f64da598e9ba082cfcabf0c98c27 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Mon, 2 Oct 2017 06:09:50 +0200 Subject: [PATCH 304/470] CHANGES: Formatting. --- docs/CHANGES | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/docs/CHANGES b/docs/CHANGES index 510da893c..d81c40f8d 100644 --- a/docs/CHANGES +++ b/docs/CHANGES @@ -15,12 +15,12 @@ CHANGES BETWEEN 2.8 and 2.8.1 II. IMPORTANT CHANGES - - By default, FreeType now offers high quality LCD-optimized - output without resorting to ClearType techniques of resolution - tripling and filtering. In this method, called Harmony, each - color channel is generated separately after shifting the glyph - outline, capitalizing on the fact that the color grids on LCD - panels are shifted by a third of a pixel. This output is + - By default, FreeType now offers high quality LCD-optimized + output without resorting to ClearType techniques of resolution + tripling and filtering. In this method, called Harmony, each + color channel is generated separately after shifting the glyph + outline, capitalizing on the fact that the color grids on LCD + panels are shifted by a third of a pixel. This output is indistinguishable from ClearType with a light 3-tap filter. @@ -67,16 +67,16 @@ CHANGES BETWEEN 2.8 and 2.8.1 were no error or problem reports either it seems that it is no longer needed. - - The `ftgrid' demo program can now toggle the display of grid lines - with the `G' key. + - The `ftgrid' demo program can now toggle the display of grid + lines with the `G' key. - - The `ftgrid' demo program can toggle a different set of colors + - The `ftgrid' demo program can toggle a different set of colors (suitable to color-blind people) with the `C' key. - - The `ftgrid' demo program now supports the `-e' command line option - to select a cmap. + - The `ftgrid' demo program now supports the `-e' command line + option to select a cmap. - - The `ftdump' demo program has a new command line option `-t' to + - The `ftdump' demo program has a new command line option `-t' to output the SFNT table list. From 1df35d94c79dea3f981bd2907dd979973c8199dc Mon Sep 17 00:00:00 2001 From: John Tytgat Date: Wed, 4 Oct 2017 22:46:36 +0200 Subject: [PATCH 305/470] [cff] Add support for `FSType'. * include/freetype/internal/cfftypes.h (CFF_FontRec): Add `font_extra' entry. * src/cff/cffdrivr.c (cff_ps_get_font_extra): New function to retrieve FSType info from the embedded PostScript data. (cff_service_ps_info): Register function. * src/cff/cffload.c (cff_font_done): Free `font_extra'. --- ChangeLog | 13 +++++ include/freetype/internal/cfftypes.h | 4 ++ src/cff/cffdrivr.c | 82 +++++++++++++++++++++++++++- src/cff/cffload.c | 2 + 4 files changed, 100 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index dac2e7dc6..b30c3b94f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2017-10-04 John Tytgat + + [cff] Add support for `FSType'. + + * include/freetype/internal/cfftypes.h (CFF_FontRec): Add + `font_extra' entry. + + * src/cff/cffdrivr.c (cff_ps_get_font_extra): New function to + retrieve FSType info from the embedded PostScript data. + (cff_service_ps_info): Register function. + + * src/cff/cffload.c (cff_font_done): Free `font_extra'. + 2017-09-30 Alexei Podtelezhnikov Signedness fixes in bitmap presetting. diff --git a/include/freetype/internal/cfftypes.h b/include/freetype/internal/cfftypes.h index d6de1f33c..0b9dbdf8d 100644 --- a/include/freetype/internal/cfftypes.h +++ b/include/freetype/internal/cfftypes.h @@ -27,6 +27,7 @@ #include FT_INTERNAL_SERVICE_H #include FT_SERVICE_POSTSCRIPT_CMAPS_H #include FT_INTERNAL_POSTSCRIPT_HINTS_H +#include FT_INTERNAL_TYPE1_TYPES_H FT_BEGIN_HEADER @@ -397,6 +398,9 @@ FT_BEGIN_HEADER /* since version 2.7.1 */ CFF_VStoreRec vstore; /* parsed vstore structure */ + /* since version 2.8.2 */ + PS_FontExtraRec* font_extra; + } CFF_FontRec; diff --git a/src/cff/cffdrivr.c b/src/cff/cffdrivr.c index 340de9c06..e76140969 100644 --- a/src/cff/cffdrivr.c +++ b/src/cff/cffdrivr.c @@ -496,11 +496,91 @@ } + static FT_Error + cff_ps_get_font_extra( CFF_Face face, + PS_FontExtraRec* afont_extra ) + { + CFF_Font cff = (CFF_Font)face->extra.data; + FT_Error error = FT_Err_Ok; + + + if ( cff && cff->font_extra == NULL ) + { + CFF_FontRecDict dict = &cff->top_font.font_dict; + PS_FontExtraRec* font_extra = NULL; + FT_Memory memory = face->root.memory; + FT_String* embedded_postscript; + + + if ( FT_ALLOC( font_extra, sizeof ( *font_extra ) ) ) + goto Fail; + + font_extra->fs_type = 0u; + + embedded_postscript = cff_index_get_sid_string( + cff, + dict->embedded_postscript ); + if ( embedded_postscript ) + { + FT_String* start_fstype; + FT_String* start_def; + + + /* Identify the XYZ integer in `/FSType XYZ def' substring. */ + if ( ( start_fstype = ft_strstr( embedded_postscript, + "/FSType" ) ) != NULL && + ( start_def = ft_strstr( start_fstype + + sizeof ( "/FSType" ) - 1, + "def" ) ) != NULL ) + { + FT_String* s; + + + for ( s = start_fstype + sizeof ( "/FSType" ) - 1; + s != start_def; + s++ ) + { + if ( *s >= '0' && *s <= '9' ) + { + FT_UShort prev_fs_type; + + + prev_fs_type = font_extra->fs_type; + font_extra->fs_type = 10 * font_extra->fs_type + *s - '0'; + if ( font_extra->fs_type < prev_fs_type ) + { + /* Overflow - ignore the FSType value. */ + font_extra->fs_type = 0U; + break; + } + } + else if ( *s != ' ' && *s != '\n' && *s != '\r' ) + { + /* Non-whitespace character between `/FSType' and next `def' */ + /* - ignore the FSType value. */ + font_extra->fs_type = 0U; + break; + } + } + } + } + + cff->font_extra = font_extra; + } + + if ( cff ) + *afont_extra = *cff->font_extra; + + Fail: + return error; + } + + FT_DEFINE_SERVICE_PSINFOREC( cff_service_ps_info, (PS_GetFontInfoFunc) cff_ps_get_font_info, /* ps_get_font_info */ - (PS_GetFontExtraFunc) NULL, /* ps_get_font_extra */ + (PS_GetFontExtraFunc) cff_ps_get_font_extra, /* ps_get_font_extra */ (PS_HasGlyphNamesFunc) cff_ps_has_glyph_names, /* ps_has_glyph_names */ /* unsupported with CFF fonts */ (PS_GetFontPrivateFunc)NULL, /* ps_get_font_private */ diff --git a/src/cff/cffload.c b/src/cff/cffload.c index 0875ead7f..0f0c839d0 100644 --- a/src/cff/cffload.c +++ b/src/cff/cffload.c @@ -2539,6 +2539,8 @@ font->cf2_instance.finalizer( font->cf2_instance.data ); FT_FREE( font->cf2_instance.data ); } + + FT_FREE( font->font_extra ); } From 2e58808d4850f2a2d4d126974bc7d6f83499ce90 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Thu, 5 Oct 2017 14:26:33 +0200 Subject: [PATCH 306/470] Fix compiler warnings. * src/cff/cffdrivr.c (cff_ps_get_font_extra): Avoid code that relies on numeric overflow. Add cast. * src/smooth/ftsmooth.c (ft_smooth_render_generic): Fix variable types, add cast. --- ChangeLog | 11 +++++++++++ src/cff/cffdrivr.c | 12 +++++------- src/smooth/ftsmooth.c | 4 ++-- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index b30c3b94f..1890cbfc5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2017-10-05 Werner Lemberg + + Fix compiler warnings. + + * src/cff/cffdrivr.c (cff_ps_get_font_extra): Avoid code that relies + on numeric overflow. + Add cast. + + * src/smooth/ftsmooth.c (ft_smooth_render_generic): Fix variable + types, add cast. + 2017-10-04 John Tytgat [cff] Add support for `FSType'. diff --git a/src/cff/cffdrivr.c b/src/cff/cffdrivr.c index e76140969..906d315c9 100644 --- a/src/cff/cffdrivr.c +++ b/src/cff/cffdrivr.c @@ -515,7 +515,7 @@ if ( FT_ALLOC( font_extra, sizeof ( *font_extra ) ) ) goto Fail; - font_extra->fs_type = 0u; + font_extra->fs_type = 0U; embedded_postscript = cff_index_get_sid_string( cff, @@ -542,17 +542,15 @@ { if ( *s >= '0' && *s <= '9' ) { - FT_UShort prev_fs_type; - - - prev_fs_type = font_extra->fs_type; - font_extra->fs_type = 10 * font_extra->fs_type + *s - '0'; - if ( font_extra->fs_type < prev_fs_type ) + if ( font_extra->fs_type >= ( FT_USHORT_MAX - 9 ) / 10 ) { /* Overflow - ignore the FSType value. */ font_extra->fs_type = 0U; break; } + + font_extra->fs_type *= 10; + font_extra->fs_type += (FT_UShort)( *s - '0' ); } else if ( *s != ' ' && *s != '\n' && *s != '\r' ) { diff --git a/src/smooth/ftsmooth.c b/src/smooth/ftsmooth.c index 938d295ad..82627462e 100644 --- a/src/smooth/ftsmooth.c +++ b/src/smooth/ftsmooth.c @@ -229,7 +229,7 @@ { FT_Byte* line; FT_Byte* temp; - FT_Int i, j; + FT_UInt i, j; unsigned int height = bitmap->rows; unsigned int width = bitmap->width; @@ -270,7 +270,7 @@ for ( i = 0; i < height; i++ ) { - line = bitmap->buffer + i * pitch; + line = bitmap->buffer + i * (FT_ULong)pitch; for ( j = 0; j < width; j++ ) { temp[3 * j ] = line[j]; From c3083e459584d0e8481fa2401232c8a3145fae4b Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Thu, 5 Oct 2017 14:32:24 +0200 Subject: [PATCH 307/470] * src/base/ftobjs.c (ft_glyphslot_preset_bitmap): Fix integer overflow. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3539 --- ChangeLog | 9 +++++++++ src/base/ftobjs.c | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1890cbfc5..f131f2f8b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2017-10-05 Werner Lemberg + + * src/base/ftobjs.c (ft_glyphslot_preset_bitmap): Fix integer + overflow. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3539 + 2017-10-05 Werner Lemberg Fix compiler warnings. diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c index 79e751120..2258a3175 100644 --- a/src/base/ftobjs.c +++ b/src/base/ftobjs.c @@ -419,8 +419,8 @@ cbox.yMax = FT_PIX_CEIL( cbox.yMax ); } - x_shift -= cbox.xMin; - y_shift -= cbox.yMin; + x_shift = SUB_LONG( x_shift, cbox.xMin ); + y_shift = SUB_LONG( y_shift, cbox.yMin ); x_left = cbox.xMin >> 6; y_top = cbox.yMax >> 6; From f06456a82d5751d637a7e2cea21e4c71d2c8d2db Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sat, 7 Oct 2017 10:35:11 +0200 Subject: [PATCH 308/470] [type1] Minor code shuffling. * src/type1/t1load.c (T1_Set_MM_Blend): Make it a wrapper of... (t1_set_mm_blend): ...this new function. (T1_Set_MM_Design): Use `t1_set_mm_blend'. --- ChangeLog | 8 ++++++++ src/type1/t1load.c | 15 ++++++++++++--- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index f131f2f8b..1ed0a4cd0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2017-10-07 Werner Lemberg + + [type1] Minor code shuffling. + + * src/type1/t1load.c (T1_Set_MM_Blend): Make it a wrapper of... + (t1_set_mm_blend): ...this new function. + (T1_Set_MM_Design): Use `t1_set_mm_blend'. + 2017-10-05 Werner Lemberg * src/base/ftobjs.c (ft_glyphslot_preset_bitmap): Fix integer diff --git a/src/type1/t1load.c b/src/type1/t1load.c index f569d6bec..54c8b6078 100644 --- a/src/type1/t1load.c +++ b/src/type1/t1load.c @@ -366,8 +366,8 @@ } - FT_LOCAL_DEF( FT_Error ) - T1_Set_MM_Blend( T1_Face face, + static FT_Error + t1_set_mm_blend( T1_Face face, FT_UInt num_coords, FT_Fixed* coords ) { @@ -412,6 +412,15 @@ } + FT_LOCAL_DEF( FT_Error ) + T1_Set_MM_Blend( T1_Face face, + FT_UInt num_coords, + FT_Fixed* coords ) + { + return t1_set_mm_blend( face, num_coords, coords ); + } + + FT_LOCAL_DEF( FT_Error ) T1_Get_MM_Blend( T1_Face face, FT_UInt num_coords, @@ -518,7 +527,7 @@ final_blends[n] = the_blend; } - return T1_Set_MM_Blend( face, blend->num_axis, final_blends ); + return t1_set_mm_blend( face, blend->num_axis, final_blends ); } From e23fe2adbcdbd7019a62a4775bcece1b22c76641 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sat, 7 Oct 2017 11:25:04 +0200 Subject: [PATCH 309/470] Add framework for setting named instance in MM service. * include/freetype/internal/services/svmm.h (FT_Set_Instance_Func): New function typedef. (MultiMasters): Add `set_instance' member. (FT_DEFINE_SERVICE_MULTIMASTERSREC): Updated. * src/cff/cffdrivr.c (cff_service_multi_masters), src/truetype/ttdriver (tt_service_gx_multi_masters), src/type1/t1driver.c (t1_service_multi_masters): Updated. --- ChangeLog | 13 ++++++ include/freetype/internal/services/svmm.h | 51 +++++++++++++---------- src/cff/cffdrivr.c | 1 + src/truetype/ttdriver.c | 1 + src/type1/t1driver.c | 1 + 5 files changed, 46 insertions(+), 21 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1ed0a4cd0..d3a96d2b5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2017-10-07 Werner Lemberg + + Add framework for setting named instance in MM service. + + * include/freetype/internal/services/svmm.h (FT_Set_Instance_Func): + New function typedef. + (MultiMasters): Add `set_instance' member. + (FT_DEFINE_SERVICE_MULTIMASTERSREC): Updated. + + * src/cff/cffdrivr.c (cff_service_multi_masters), + src/truetype/ttdriver (tt_service_gx_multi_masters), + src/type1/t1driver.c (t1_service_multi_masters): Updated. + 2017-10-07 Werner Lemberg [type1] Minor code shuffling. diff --git a/include/freetype/internal/services/svmm.h b/include/freetype/internal/services/svmm.h index 1d51cd909..a934f9452 100644 --- a/include/freetype/internal/services/svmm.h +++ b/include/freetype/internal/services/svmm.h @@ -63,6 +63,10 @@ FT_BEGIN_HEADER FT_UInt num_coords, FT_Fixed* coords ); + typedef FT_Error + (*FT_Set_Instance_Func)( FT_Face face, + FT_UInt instance_index ); + typedef FT_Error (*FT_Get_MM_Blend_Func)( FT_Face face, FT_UInt num_coords, @@ -88,6 +92,7 @@ FT_BEGIN_HEADER FT_Get_MM_Var_Func get_mm_var; FT_Set_Var_Design_Func set_var_design; FT_Get_Var_Design_Func get_var_design; + FT_Set_Instance_Func set_instance; /* for internal use; only needed for code sharing between modules */ FT_Get_Var_Blend_Func get_var_blend; @@ -97,27 +102,29 @@ FT_BEGIN_HEADER #ifndef FT_CONFIG_OPTION_PIC -#define FT_DEFINE_SERVICE_MULTIMASTERSREC( class_, \ - get_mm_, \ - set_mm_design_, \ - set_mm_blend_, \ - get_mm_blend_, \ - get_mm_var_, \ - set_var_design_, \ - get_var_design_, \ - get_var_blend_, \ - done_blend_ ) \ - static const FT_Service_MultiMastersRec class_ = \ - { \ - get_mm_, \ - set_mm_design_, \ - set_mm_blend_, \ - get_mm_blend_, \ - get_mm_var_, \ - set_var_design_, \ - get_var_design_, \ - get_var_blend_, \ - done_blend_ \ +#define FT_DEFINE_SERVICE_MULTIMASTERSREC( class_, \ + get_mm_, \ + set_mm_design_, \ + set_mm_blend_, \ + get_mm_blend_, \ + get_mm_var_, \ + set_var_design_, \ + get_var_design_, \ + set_instance_, \ + get_var_blend_, \ + done_blend_ ) \ + static const FT_Service_MultiMastersRec class_ = \ + { \ + get_mm_, \ + set_mm_design_, \ + set_mm_blend_, \ + get_mm_blend_, \ + get_mm_var_, \ + set_var_design_, \ + get_var_design_, \ + set_instance_, \ + get_var_blend_, \ + done_blend_ \ }; #else /* FT_CONFIG_OPTION_PIC */ @@ -130,6 +137,7 @@ FT_BEGIN_HEADER get_mm_var_, \ set_var_design_, \ get_var_design_, \ + set_instance_, \ get_var_blend_, \ done_blend_ ) \ void \ @@ -142,6 +150,7 @@ FT_BEGIN_HEADER clazz->get_mm_var = get_mm_var_; \ clazz->set_var_design = set_var_design_; \ clazz->get_var_design = get_var_design_; \ + clazz->set_instance = set_instance_; \ clazz->get_var_blend = get_var_blend_; \ clazz->done_blend = done_blend_; \ } diff --git a/src/cff/cffdrivr.c b/src/cff/cffdrivr.c index 906d315c9..3cecbc0d7 100644 --- a/src/cff/cffdrivr.c +++ b/src/cff/cffdrivr.c @@ -1119,6 +1119,7 @@ (FT_Get_MM_Var_Func) cff_get_mm_var, /* get_mm_var */ (FT_Set_Var_Design_Func)cff_set_var_design, /* set_var_design */ (FT_Get_Var_Design_Func)cff_get_var_design, /* get_var_design */ + (FT_Set_Instance_Func) NULL, /* set_instance */ (FT_Get_Var_Blend_Func) cff_get_var_blend, /* get_var_blend */ (FT_Done_Blend_Func) cff_done_blend /* done_blend */ diff --git a/src/truetype/ttdriver.c b/src/truetype/ttdriver.c index a1653b241..22bb87282 100644 --- a/src/truetype/ttdriver.c +++ b/src/truetype/ttdriver.c @@ -498,6 +498,7 @@ (FT_Get_MM_Var_Func) TT_Get_MM_Var, /* get_mm_var */ (FT_Set_Var_Design_Func)TT_Set_Var_Design, /* set_var_design */ (FT_Get_Var_Design_Func)TT_Get_Var_Design, /* get_var_design */ + (FT_Set_Instance_Func) NULL, /* set_instance */ (FT_Get_Var_Blend_Func) tt_get_var_blend, /* get_var_blend */ (FT_Done_Blend_Func) tt_done_blend /* done_blend */ diff --git a/src/type1/t1driver.c b/src/type1/t1driver.c index 866a8244d..b319f566d 100644 --- a/src/type1/t1driver.c +++ b/src/type1/t1driver.c @@ -126,6 +126,7 @@ (FT_Get_MM_Var_Func) T1_Get_MM_Var, /* get_mm_var */ (FT_Set_Var_Design_Func)T1_Set_Var_Design, /* set_var_design */ (FT_Get_Var_Design_Func)T1_Get_Var_Design, /* get_var_design */ + (FT_Set_Instance_Func) NULL, /* set_instance */ (FT_Get_Var_Blend_Func) NULL, /* get_var_blend */ (FT_Done_Blend_Func) T1_Done_Blend /* done_blend */ From b3f9c4f2f69a49a70e1dd76ce767ab603de312ac Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sat, 7 Oct 2017 11:34:23 +0200 Subject: [PATCH 310/470] Add macros for checking whether a font variation is active. * include/freetype/freetype.h (FT_FACE_FLAG_VARIATION, FT_IS_VARIATION): New macros. No effect yet. --- ChangeLog | 8 ++++++++ include/freetype/freetype.h | 33 +++++++++++++++++++++++++++++++-- 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index d3a96d2b5..5f21f6766 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2017-10-07 Werner Lemberg + + Add macros for checking whether a font variation is active. + + * include/freetype/freetype.h (FT_FACE_FLAG_VARIATION, + FT_IS_VARIATION): New macros. + No effect yet. + 2017-10-07 Werner Lemberg Add framework for setting named instance in MM service. diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h index f6049c044..3499d622b 100644 --- a/include/freetype/freetype.h +++ b/include/freetype/freetype.h @@ -138,6 +138,7 @@ FT_BEGIN_HEADER /* FT_FACE_FLAG_TRICKY */ /* FT_FACE_FLAG_KERNING */ /* FT_FACE_FLAG_MULTIPLE_MASTERS */ + /* FT_FACE_FLAG_VARIATION */ /* FT_FACE_FLAG_GLYPH_NAMES */ /* FT_FACE_FLAG_EXTERNAL_STREAM */ /* FT_FACE_FLAG_HINTER */ @@ -147,14 +148,16 @@ FT_BEGIN_HEADER /* FT_HAS_KERNING */ /* FT_HAS_FIXED_SIZES */ /* FT_HAS_GLYPH_NAMES */ - /* FT_HAS_MULTIPLE_MASTERS */ /* FT_HAS_COLOR */ + /* FT_HAS_MULTIPLE_MASTERS */ /* */ /* FT_IS_SFNT */ /* FT_IS_SCALABLE */ /* FT_IS_FIXED_WIDTH */ /* FT_IS_CID_KEYED */ /* FT_IS_TRICKY */ + /* FT_IS_NAMED_INSTANCE */ + /* FT_IS_VARIATION */ /* */ /* FT_STYLE_FLAG_BOLD */ /* FT_STYLE_FLAG_ITALIC */ @@ -909,7 +912,7 @@ FT_BEGIN_HEADER /* flags indicating the style of the face; see */ /* @FT_STYLE_FLAG_XXX for the details. */ /* */ - /* [Since 2.6.1] Bits 16-30 hold the number */ + /* [Since 2.6.1] Bits 16-30 hold the number */ /* of named instances available for the */ /* current face if we have a GX or OpenType */ /* variation (sub)font. Bit 31 is always zero */ @@ -1216,6 +1219,13 @@ FT_BEGIN_HEADER /* [Since 2.5.1] The face has color glyph tables. To access color */ /* glyphs use @FT_LOAD_COLOR. */ /* */ + /* FT_FACE_FLAG_VARIATION :: */ + /* [Since 2.8.2] Set if the current face (or named instance) has */ + /* been altered with @FT_Set_MM_Design_Coordinates, */ + /* @FT_Set_Var_Design_Coordinates, or */ + /* @FT_Set_Var_Blend_Coordinates. This flag is unset by a call to */ + /* @FT_Set_Named_Instance. */ + /* */ #define FT_FACE_FLAG_SCALABLE ( 1L << 0 ) #define FT_FACE_FLAG_FIXED_SIZES ( 1L << 1 ) #define FT_FACE_FLAG_FIXED_WIDTH ( 1L << 2 ) @@ -1231,6 +1241,7 @@ FT_BEGIN_HEADER #define FT_FACE_FLAG_CID_KEYED ( 1L << 12 ) #define FT_FACE_FLAG_TRICKY ( 1L << 13 ) #define FT_FACE_FLAG_COLOR ( 1L << 14 ) +#define FT_FACE_FLAG_VARIATION ( 1L << 15 ) /************************************************************************* @@ -1400,6 +1411,24 @@ FT_BEGIN_HEADER ( (face)->face_index & 0x7FFF0000L ) + /************************************************************************* + * + * @macro: + * FT_IS_VARIATION( face ) + * + * @description: + * A macro that returns true whenever a face object has been altered + * by @FT_Set_MM_Design_Coordinates, @FT_Set_Var_Design_Coordinates, or + * @FT_Set_Var_Blend_Coordinates. + * + * @since: + * 2.8.2 + * + */ +#define FT_IS_VARIATION( face ) \ + ( (face)->face_flags & FT_FACE_FLAG_VARIATION ) + + /************************************************************************* * * @macro: From dd8539ef823d21337cd31894b1072808c297574f Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sat, 7 Oct 2017 11:40:03 +0200 Subject: [PATCH 311/470] New function `FT_Set_Named_Instance'. No effect yet. * src/base/ftmm.c (FT_Set_Named_Instance): New function. * include/freetype/ftmm.h: Updated. --- ChangeLog | 10 +++++++++ include/freetype/ftmm.h | 37 +++++++++++++++++++++++++++++++ src/base/ftmm.c | 48 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 95 insertions(+) diff --git a/ChangeLog b/ChangeLog index 5f21f6766..0d8d0069d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2017-10-07 Werner Lemberg + + New function `FT_Set_Named_Instance'. + + No effect yet. + + * src/base/ftmm.c (FT_Set_Named_Instance): New function. + + * include/freetype/ftmm.h: Updated. + 2017-10-07 Werner Lemberg Add macros for checking whether a font variation is active. diff --git a/include/freetype/ftmm.h b/include/freetype/ftmm.h index c08119933..fe66f2d6c 100644 --- a/include/freetype/ftmm.h +++ b/include/freetype/ftmm.h @@ -551,6 +551,43 @@ FT_BEGIN_HEADER FT_UInt axis_index, FT_UInt* flags ); + + /*************************************************************************/ + /* */ + /* */ + /* FT_Set_Named_Instance */ + /* */ + /* */ + /* Set or change the current named instance. */ + /* */ + /* */ + /* face :: A handle to the source face. */ + /* */ + /* instance_index :: The index of the requested instance, starting */ + /* with value 1. If set to value 0, FreeType */ + /* switches to font access without a named */ + /* instance. */ + /* */ + /* */ + /* FreeType error code. 0~means success. */ + /* */ + /* */ + /* The function uses the value of `instance_index' to set bits 16-30 */ + /* of the face's `face_index' field. It also resets any variation */ + /* applied to the font, and the @FT_FACE_FLAG_VARIATION bit of the */ + /* face's `face_flags' field gets reset to zero (i.e., */ + /* @FT_IS_VARIATION will return false). */ + /* */ + /* For Adobe MM fonts (which don't have named instances) this */ + /* function simply resets the current face to the default instance. */ + /* */ + /* */ + /* 2.8.2 */ + /* */ + FT_EXPORT( FT_Error ) + FT_Set_Named_Instance( FT_Face face, + FT_UInt instance_index ); + /* */ diff --git a/src/base/ftmm.c b/src/base/ftmm.c index 43877ece4..e0131ece3 100644 --- a/src/base/ftmm.c +++ b/src/base/ftmm.c @@ -426,4 +426,52 @@ } + /* documentation is in ftmm.h */ + + FT_EXPORT_DEF( FT_Error ) + FT_Set_Named_Instance( FT_Face face, + FT_UInt instance_index ) + { + FT_Error error; + + FT_Service_MultiMasters service_mm = NULL; + FT_Service_MetricsVariations service_mvar = NULL; + + + /* check of `face' delayed to `ft_face_get_mm_service' */ + + error = ft_face_get_mm_service( face, &service_mm ); + if ( !error ) + { + error = FT_ERR( Invalid_Argument ); + if ( service_mm->set_instance ) + error = service_mm->set_instance( face, instance_index ); + } + + if ( !error ) + { + (void)ft_face_get_mvar_service( face, &service_mvar ); + + if ( service_mvar && service_mvar->metrics_adjust ) + service_mvar->metrics_adjust( face ); + } + + /* enforce recomputation of auto-hinting data */ + if ( !error && face->autohint.finalizer ) + { + face->autohint.finalizer( face->autohint.data ); + face->autohint.data = NULL; + } + + if ( !error ) + { + face->face_index = ( instance_index << 16 ) | + ( face->face_index & 0xFFFFL ); + face->face_flags &= ~FT_FACE_FLAG_VARIATION; + } + + return error; + } + + /* END */ From 8c92f7622cdf1e2a0354a818f67edfaa92e4cced Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sat, 7 Oct 2017 12:12:49 +0200 Subject: [PATCH 312/470] Make `FT_FACE_FLAG_VARIATION' work. * include/freetype/internal/tttypes.h (TT_Face): Remove `is_default_instance'; this can be replaced with a combination of `FT_IS_VARIATION' and `FT_IS_INSTANCE'. * src/cff/cffdrivr.c (cff_get_advances): Updated. * src/sfnt/sfdriver.c (sfnt_get_ps_name), src/sfnt/sfobjs.c (sfnt_init_face): Updated. * src/truetype/ttdriver.c (tt_get_advances), src/truetype/ttgload.c (TT_Process_Simple_Glyph, load_truetype_glyph, IS_DEFAULT_INSTANCE), src/truetype/ttgxvar.c (tt_set_mm_blend): Updated. * src/truetype/ttgxvar.c (TT_Set_MM_Blend, TT_Set_Var_Design): Handle `FT_FACE_FLAG_VARIATION'. * src/type1/t1load.c (T1_Set_MM_Blend, T1_Set_MM_Design): Handle `FT_FACE_FLAG_VARIATION'. --- ChangeLog | 22 ++++++++++++++++++++++ include/freetype/internal/tttypes.h | 5 ----- src/cff/cffdrivr.c | 8 ++++---- src/sfnt/sfdriver.c | 4 +++- src/sfnt/sfobjs.c | 2 -- src/truetype/ttdriver.c | 8 ++++---- src/truetype/ttgload.c | 12 ++++++++---- src/truetype/ttgxvar.c | 29 +++++++++++++++++++++-------- src/type1/t1load.c | 26 ++++++++++++++++++++++++-- 9 files changed, 86 insertions(+), 30 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0d8d0069d..1bdfbe472 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,25 @@ +2017-10-07 Werner Lemberg + + Make `FT_FACE_FLAG_VARIATION' work. + + * include/freetype/internal/tttypes.h (TT_Face): Remove + `is_default_instance'; this can be replaced with a combination of + `FT_IS_VARIATION' and `FT_IS_INSTANCE'. + + * src/cff/cffdrivr.c (cff_get_advances): Updated. + + * src/sfnt/sfdriver.c (sfnt_get_ps_name), src/sfnt/sfobjs.c + (sfnt_init_face): Updated. + + * src/truetype/ttdriver.c (tt_get_advances), src/truetype/ttgload.c + (TT_Process_Simple_Glyph, load_truetype_glyph, IS_DEFAULT_INSTANCE), + src/truetype/ttgxvar.c (tt_set_mm_blend): Updated. + * src/truetype/ttgxvar.c (TT_Set_MM_Blend, TT_Set_Var_Design): + Handle `FT_FACE_FLAG_VARIATION'. + + * src/type1/t1load.c (T1_Set_MM_Blend, T1_Set_MM_Design): Handle + `FT_FACE_FLAG_VARIATION'. + 2017-10-07 Werner Lemberg New function `FT_Set_Named_Instance'. diff --git a/include/freetype/internal/tttypes.h b/include/freetype/internal/tttypes.h index 0fcc6b04d..3bc6c9893 100644 --- a/include/freetype/internal/tttypes.h +++ b/include/freetype/internal/tttypes.h @@ -1299,10 +1299,6 @@ FT_BEGIN_HEADER /* variation tables (rather like Multiple */ /* Master data). */ /* */ - /* is_default_instance :: Set if the glyph outlines can be used */ - /* unmodified (i.e., without applying glyph */ - /* variation deltas). */ - /* */ /* variation_support :: Flags that indicate which OpenType */ /* functionality related to font variation */ /* support is present, valid, and usable. */ @@ -1512,7 +1508,6 @@ FT_BEGIN_HEADER FT_Bool doblend; GX_Blend blend; - FT_Bool is_default_instance; /* since 2.7.1 */ FT_UInt32 variation_support; /* since 2.7.1 */ const char* var_postscript_prefix; /* since 2.7.2 */ diff --git a/src/cff/cffdrivr.c b/src/cff/cffdrivr.c index 3cecbc0d7..032ce3730 100644 --- a/src/cff/cffdrivr.c +++ b/src/cff/cffdrivr.c @@ -217,8 +217,8 @@ { #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT /* no fast retrieval for blended MM fonts without VVAR table */ - if ( !ttface->is_default_instance && - !( ttface->variation_support & TT_FACE_FLAG_VAR_VADVANCE ) ) + if ( ( FT_IS_NAMED_INSTANCE( face ) || FT_IS_VARIATION( face ) ) && + !( ttface->variation_support & TT_FACE_FLAG_VAR_VADVANCE ) ) return FT_THROW( Unimplemented_Feature ); #endif @@ -249,8 +249,8 @@ { #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT /* no fast retrieval for blended MM fonts without HVAR table */ - if ( !ttface->is_default_instance && - !( ttface->variation_support & TT_FACE_FLAG_VAR_HADVANCE ) ) + if ( ( FT_IS_NAMED_INSTANCE( face ) || FT_IS_VARIATION( face ) ) && + !( ttface->variation_support & TT_FACE_FLAG_VAR_HADVANCE ) ) return FT_THROW( Unimplemented_Feature ); #endif diff --git a/src/sfnt/sfdriver.c b/src/sfnt/sfdriver.c index b4f084247..fc4eaf74c 100644 --- a/src/sfnt/sfdriver.c +++ b/src/sfnt/sfdriver.c @@ -1029,7 +1029,9 @@ return face->postscript_name; #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT - if ( face->blend && !face->is_default_instance ) + if ( face->blend && + ( FT_IS_NAMED_INSTANCE( FT_FACE( face ) ) || + FT_IS_VARIATION( FT_FACE( face ) ) ) ) { face->postscript_name = sfnt_get_var_ps_name( face ); return face->postscript_name; diff --git a/src/sfnt/sfobjs.c b/src/sfnt/sfobjs.c index 69bf0a5c3..1764807c6 100644 --- a/src/sfnt/sfobjs.c +++ b/src/sfnt/sfobjs.c @@ -962,8 +962,6 @@ FT_Byte* instance_values = NULL; - face->is_default_instance = 1; - instance_index = FT_ABS( face_instance_index ) >> 16; /* test whether current face is a GX font with named instances */ diff --git a/src/truetype/ttdriver.c b/src/truetype/ttdriver.c index 22bb87282..af36481c1 100644 --- a/src/truetype/ttdriver.c +++ b/src/truetype/ttdriver.c @@ -233,8 +233,8 @@ { #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT /* no fast retrieval for blended MM fonts without VVAR table */ - if ( !face->is_default_instance && - !( face->variation_support & TT_FACE_FLAG_VAR_VADVANCE ) ) + if ( ( FT_IS_NAMED_INSTANCE( ttface ) || FT_IS_VARIATION( ttface ) ) && + !( face->variation_support & TT_FACE_FLAG_VAR_VADVANCE ) ) return FT_THROW( Unimplemented_Feature ); #endif @@ -253,8 +253,8 @@ { #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT /* no fast retrieval for blended MM fonts without HVAR table */ - if ( !face->is_default_instance && - !( face->variation_support & TT_FACE_FLAG_VAR_HADVANCE ) ) + if ( ( FT_IS_NAMED_INSTANCE( ttface ) || FT_IS_VARIATION( ttface ) ) && + !( face->variation_support & TT_FACE_FLAG_VAR_HADVANCE ) ) return FT_THROW( Unimplemented_Feature ); #endif diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c index 5e102c615..94ba25673 100644 --- a/src/truetype/ttgload.c +++ b/src/truetype/ttgload.c @@ -889,7 +889,8 @@ #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT - if ( !loader->face->is_default_instance ) + if ( FT_IS_NAMED_INSTANCE( FT_FACE( loader->face ) ) || + FT_IS_VARIATION( FT_FACE( loader->face ) ) ) { /* Deltas apply to the unscaled data. */ error = TT_Vary_Apply_Glyph_Deltas( loader->face, @@ -1577,7 +1578,8 @@ #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT - if ( !loader->face->is_default_instance ) + if ( FT_IS_NAMED_INSTANCE( FT_FACE( face ) ) || + FT_IS_VARIATION( FT_FACE( face ) ) ) { /* a small outline structure with four elements for */ /* communication with `TT_Vary_Apply_Glyph_Deltas' */ @@ -1751,7 +1753,8 @@ #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT - if ( !face->is_default_instance ) + if ( FT_IS_NAMED_INSTANCE( FT_FACE( face ) ) || + FT_IS_VARIATION( FT_FACE( face ) ) ) { short i, limit; FT_SubGlyph subglyph; @@ -2609,7 +2612,8 @@ TT_LoaderRec loader; #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT -#define IS_DEFAULT_INSTANCE ( ( (TT_Face)glyph->face )->is_default_instance ) +#define IS_DEFAULT_INSTANCE ( !( FT_IS_NAMED_INSTANCE( glyph->face ) || \ + FT_IS_VARIATION( glyph->face ) ) ) #else #define IS_DEFAULT_INSTANCE 1 #endif diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c index 461b230a0..d2365ac3d 100644 --- a/src/truetype/ttgxvar.c +++ b/src/truetype/ttgxvar.c @@ -2350,8 +2350,7 @@ FT_MM_Var* mmvar; FT_UInt i, j; - FT_Bool is_default_instance = TRUE; - FT_Bool all_design_coords = FALSE; + FT_Bool all_design_coords = FALSE; FT_Memory memory = face->root.memory; @@ -2396,9 +2395,6 @@ error = FT_THROW( Invalid_Argument ); goto Exit; } - - if ( coords[i] != 0 ) - is_default_instance = FALSE; } FT_TRACE5(( "\n" )); @@ -2517,8 +2513,6 @@ if ( i < blend->mmvar->num_namedstyles ) face->root.face_index |= ( i + 1 ) << 16; - face->is_default_instance = is_default_instance; - /* enforce recomputation of the PostScript name; */ FT_FREE( face->postscript_name ); face->postscript_name = NULL; @@ -2558,7 +2552,19 @@ FT_UInt num_coords, FT_Fixed* coords ) { - return tt_set_mm_blend( face, num_coords, coords, 1 ); + FT_Error error; + + + error = tt_set_mm_blend( face, num_coords, coords, 1 ); + if ( error ) + return error; + + if ( num_coords ) + face->root.face_flags |= FT_FACE_FLAG_VARIATION; + else + face->root.face_flags &= ~FT_FACE_FLAG_VARIATION; + + return FT_Err_Ok; } @@ -2721,6 +2727,13 @@ ft_var_to_normalized( face, num_coords, blend->coords, normalized ); error = tt_set_mm_blend( face, mmvar->num_axis, normalized, 0 ); + if ( error ) + goto Exit; + + if ( num_coords ) + face->root.face_flags |= FT_FACE_FLAG_VARIATION; + else + face->root.face_flags &= ~FT_FACE_FLAG_VARIATION; Exit: FT_FREE( normalized ); diff --git a/src/type1/t1load.c b/src/type1/t1load.c index 54c8b6078..8ac3810ff 100644 --- a/src/type1/t1load.c +++ b/src/type1/t1load.c @@ -417,7 +417,19 @@ FT_UInt num_coords, FT_Fixed* coords ) { - return t1_set_mm_blend( face, num_coords, coords ); + FT_Error error; + + + error = t1_set_mm_blend( face, num_coords, coords ); + if ( error ) + return error; + + if ( num_coords ) + face->root.face_flags |= FT_FACE_FLAG_VARIATION; + else + face->root.face_flags &= ~FT_FACE_FLAG_VARIATION; + + return FT_Err_Ok; } @@ -461,6 +473,7 @@ FT_UInt num_coords, FT_Long* coords ) { + FT_Error error; PS_Blend blend = face->blend; FT_UInt n, p; FT_Fixed final_blends[T1_MAX_MM_DESIGNS]; @@ -527,7 +540,16 @@ final_blends[n] = the_blend; } - return t1_set_mm_blend( face, blend->num_axis, final_blends ); + error = t1_set_mm_blend( face, blend->num_axis, final_blends ); + if ( error ) + return error; + + if ( num_coords ) + face->root.face_flags |= FT_FACE_FLAG_VARIATION; + else + face->root.face_flags &= ~FT_FACE_FLAG_VARIATION; + + return FT_Err_Ok; } From e9ef538a4fb6745ed26bdc6905abb6b5af325e91 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sat, 7 Oct 2017 12:57:11 +0200 Subject: [PATCH 313/470] Make `FT_Set_Named_Instance' work. * src/cff/cffdrivr.c (cff_set_instance): New function. (cff_service_multi_masters): Register it. * src/truetype/ttgxvar.c (TT_Set_Named_Instance): New function. * src/truetype/ttgxvar.h: Updated. * src/truetype/ttdriver.c (tt_service_gx_multi_masters): Register it. * src/type1/t1load.c (T1_Reset_MM_Blend): New function. * src/type1/t1load.h: Updated. * src/type1/t1driver.c (t1_service_multi_masters): Register it. --- ChangeLog | 16 ++++++++ src/cff/cffdrivr.c | 13 ++++++- src/truetype/ttdriver.c | 2 +- src/truetype/ttgxvar.c | 84 +++++++++++++++++++++++++++++++++++++++++ src/truetype/ttgxvar.h | 4 ++ src/type1/t1driver.c | 2 +- src/type1/t1load.c | 12 ++++++ src/type1/t1load.h | 4 ++ 8 files changed, 134 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1bdfbe472..80e97b167 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2017-10-07 Werner Lemberg + + Make `FT_Set_Named_Instance' work. + + * src/cff/cffdrivr.c (cff_set_instance): New function. + (cff_service_multi_masters): Register it. + + * src/truetype/ttgxvar.c (TT_Set_Named_Instance): New function. + * src/truetype/ttgxvar.h: Updated. + * src/truetype/ttdriver.c (tt_service_gx_multi_masters): Register + it. + + * src/type1/t1load.c (T1_Reset_MM_Blend): New function. + * src/type1/t1load.h: Updated. + * src/type1/t1driver.c (t1_service_multi_masters): Register it. + 2017-10-07 Werner Lemberg Make `FT_FACE_FLAG_VARIATION' work. diff --git a/src/cff/cffdrivr.c b/src/cff/cffdrivr.c index 032ce3730..cf630a8a1 100644 --- a/src/cff/cffdrivr.c +++ b/src/cff/cffdrivr.c @@ -1109,6 +1109,17 @@ } + static FT_Error + cff_set_instance( CFF_Face face, + FT_UInt instance_index ) + { + FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm; + + + return mm->set_instance( FT_FACE( face ), instance_index ); + } + + FT_DEFINE_SERVICE_MULTIMASTERSREC( cff_service_multi_masters, @@ -1119,7 +1130,7 @@ (FT_Get_MM_Var_Func) cff_get_mm_var, /* get_mm_var */ (FT_Set_Var_Design_Func)cff_set_var_design, /* set_var_design */ (FT_Get_Var_Design_Func)cff_get_var_design, /* get_var_design */ - (FT_Set_Instance_Func) NULL, /* set_instance */ + (FT_Set_Instance_Func) cff_set_instance, /* set_instance */ (FT_Get_Var_Blend_Func) cff_get_var_blend, /* get_var_blend */ (FT_Done_Blend_Func) cff_done_blend /* done_blend */ diff --git a/src/truetype/ttdriver.c b/src/truetype/ttdriver.c index af36481c1..ba05cefb3 100644 --- a/src/truetype/ttdriver.c +++ b/src/truetype/ttdriver.c @@ -498,7 +498,7 @@ (FT_Get_MM_Var_Func) TT_Get_MM_Var, /* get_mm_var */ (FT_Set_Var_Design_Func)TT_Set_Var_Design, /* set_var_design */ (FT_Get_Var_Design_Func)TT_Get_Var_Design, /* get_var_design */ - (FT_Set_Instance_Func) NULL, /* set_instance */ + (FT_Set_Instance_Func) TT_Set_Named_Instance, /* set_instance */ (FT_Get_Var_Blend_Func) tt_get_var_blend, /* get_var_blend */ (FT_Done_Blend_Func) tt_done_blend /* done_blend */ diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c index d2365ac3d..4ad6533bf 100644 --- a/src/truetype/ttgxvar.c +++ b/src/truetype/ttgxvar.c @@ -2816,6 +2816,90 @@ } + /*************************************************************************/ + /* */ + /* */ + /* TT_Set_Named_Instance */ + /* */ + /* */ + /* Set the given named instance, also resetting any further */ + /* variation. */ + /* */ + /* */ + /* face :: A handle to the source face. */ + /* */ + /* instance_index :: The instance index, starting with value 1. */ + /* Value 0 indicates to not use an instance. */ + /* */ + /* */ + /* FreeType error code. 0~means success. */ + /* */ + FT_LOCAL_DEF( FT_Error ) + TT_Set_Named_Instance( TT_Face face, + FT_UInt instance_index ) + { + FT_Error error = FT_ERR( Invalid_Argument ); + GX_Blend blend; + FT_MM_Var* mmvar; + + FT_UInt num_instances; + + + if ( !face->blend ) + { + if ( FT_SET_ERROR( TT_Get_MM_Var( face, NULL ) ) ) + goto Exit; + } + + blend = face->blend; + mmvar = blend->mmvar; + + num_instances = (FT_UInt)face->root.style_flags >> 16; + + /* `instance_index' starts with value 1, thus `>' */ + if ( instance_index > num_instances ) + goto Exit; + + if ( instance_index > 0 && mmvar->namedstyle ) + { + FT_Memory memory = face->root.memory; + SFNT_Service sfnt = (SFNT_Service)face->sfnt; + + FT_Var_Named_Style* named_style; + FT_String* style_name; + + + named_style = mmvar->namedstyle + instance_index - 1; + + error = sfnt->get_name( face, + (FT_UShort)named_style->strid, + &style_name ); + if ( error ) + goto Exit; + + /* set (or replace) style name */ + FT_FREE( face->root.style_name ); + face->root.style_name = style_name; + + /* finally, select the named instance */ + error = TT_Set_Var_Design( face, + mmvar->num_axis, + named_style->coords ); + if ( error ) + goto Exit; + } + else + error = TT_Set_Var_Design( face, 0, NULL ); + + face->root.face_index = ( instance_index << 16 ) | + ( face->root.face_index & 0xFFFFL ); + face->root.face_flags &= ~FT_FACE_FLAG_VARIATION; + + Exit: + return error; + } + + /*************************************************************************/ /*************************************************************************/ /***** *****/ diff --git a/src/truetype/ttgxvar.h b/src/truetype/ttgxvar.h index 7e81719a3..a9a116500 100644 --- a/src/truetype/ttgxvar.h +++ b/src/truetype/ttgxvar.h @@ -401,6 +401,10 @@ FT_BEGIN_HEADER FT_UInt num_coords, FT_Fixed* coords ); + FT_LOCAL( FT_Error ) + TT_Set_Named_Instance( TT_Face face, + FT_UInt instance_index ); + FT_LOCAL( FT_Error ) tt_face_vary_cvt( TT_Face face, FT_Stream stream ); diff --git a/src/type1/t1driver.c b/src/type1/t1driver.c index b319f566d..06cb26e47 100644 --- a/src/type1/t1driver.c +++ b/src/type1/t1driver.c @@ -126,7 +126,7 @@ (FT_Get_MM_Var_Func) T1_Get_MM_Var, /* get_mm_var */ (FT_Set_Var_Design_Func)T1_Set_Var_Design, /* set_var_design */ (FT_Get_Var_Design_Func)T1_Get_Var_Design, /* get_var_design */ - (FT_Set_Instance_Func) NULL, /* set_instance */ + (FT_Set_Instance_Func) T1_Reset_MM_Blend, /* set_instance */ (FT_Get_Var_Blend_Func) NULL, /* get_var_blend */ (FT_Done_Blend_Func) T1_Done_Blend /* done_blend */ diff --git a/src/type1/t1load.c b/src/type1/t1load.c index 8ac3810ff..9259df64a 100644 --- a/src/type1/t1load.c +++ b/src/type1/t1load.c @@ -553,6 +553,18 @@ } + /* MM fonts don't have named instances, so only the design is reset */ + + FT_LOCAL_DEF( FT_Error ) + T1_Reset_MM_Blend( T1_Face face, + FT_UInt instance_index ) + { + FT_UNUSED( instance_index ); + + return T1_Set_MM_Blend( face, 0, NULL ); + } + + /*************************************************************************/ /* */ /* Just a wrapper around T1_Set_MM_Design to support the different */ diff --git a/src/type1/t1load.h b/src/type1/t1load.h index 2d86984f0..492ba5add 100644 --- a/src/type1/t1load.h +++ b/src/type1/t1load.h @@ -89,6 +89,10 @@ FT_BEGIN_HEADER FT_UInt num_coords, FT_Long* coords ); + FT_LOCAL( FT_Error ) + T1_Reset_MM_Blend( T1_Face face, + FT_UInt instance_index ); + FT_LOCAL( FT_Error ) T1_Get_Var_Design( T1_Face face, FT_UInt num_coords, From f89c67f043c73e709e5721e651f2b616dab72ead Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sat, 7 Oct 2017 13:10:53 +0200 Subject: [PATCH 314/470] [cff, truetype] Adjust behaviour of named instances. This commit completely separates the interaction between named instances and variation functions. In particular, resetting the variation returns to the current named instance (if set) and not to the base font. As a side effect, variation functions no longer change the named instance index. * src/cff/cffobjs.c (cff_face_init): Use MM service's `set_instance' function. Also apply `MVAR' table to named instances. * src/truetype/ttgxvar.c (TT_Get_MM_Var): Add cast. (tt_set_mm_blend): No longer check whether requested variation coincides with a named instance. (TT_Set_Var_Design): Use current named instance for default coordinates. * src/truetype/ttobjs.c (tt_face_init): Use `TT_Set_Named_Instance'. --- ChangeLog | 23 +++++++++++++++ include/freetype/freetype.h | 12 ++++++++ include/freetype/ftmm.h | 37 +++++++++++++++++------ src/cff/cffobjs.c | 40 ++++--------------------- src/truetype/ttgxvar.c | 59 +++++++++++++++++-------------------- src/truetype/ttobjs.c | 35 ++-------------------- 6 files changed, 99 insertions(+), 107 deletions(-) diff --git a/ChangeLog b/ChangeLog index 80e97b167..98c837407 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,26 @@ +2017-10-07 Werner Lemberg + + [cff, truetype] Adjust behaviour of named instances. + + This commit completely separates the interaction between named + instances and variation functions. In particular, resetting the + variation returns to the current named instance (if set) and not to + the base font. + + As a side effect, variation functions no longer change the named + instance index. + + * src/cff/cffobjs.c (cff_face_init): Use MM service's `set_instance' + function. + Also apply `MVAR' table to named instances. + + * src/truetype/ttgxvar.c (TT_Get_MM_Var): Add cast. + (tt_set_mm_blend): No longer check whether requested variation + coincides with a named instance. + (TT_Set_Var_Design): Use current named instance for default + coordinates. + * src/truetype/ttobjs.c (tt_face_init): Use `TT_Set_Named_Instance'. + 2017-10-07 Werner Lemberg Make `FT_Set_Named_Instance' work. diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h index 3499d622b..77d277ef5 100644 --- a/include/freetype/freetype.h +++ b/include/freetype/freetype.h @@ -904,6 +904,13 @@ FT_BEGIN_HEADER /* Bit 31 is always zero (this is, */ /* `face_index' is always a positive value). */ /* */ + /* [Since 2.8.2] Changing the design */ + /* coordinates with */ + /* @FT_Set_Var_Design_Coordinates or */ + /* @FT_Set_Var_Blend_Coordinates does not */ + /* influence the named instance index value */ + /* (only @FT_Set_Named_Instance does that). */ + /* */ /* face_flags :: A set of bit flags that give important */ /* information about the face; see */ /* @FT_FACE_FLAG_XXX for the details. */ @@ -1403,6 +1410,11 @@ FT_BEGIN_HEADER * A macro that returns true whenever a face object is a named instance * of a GX or OpenType variation font. * + * [Since 2.8.2] Changing the design coordinates with + * @FT_Set_Var_Design_Coordinates or @FT_Set_Var_Blend_Coordinates does + * not influence the return value of this macro (only + * @FT_Set_Named_Instance does that). + * * @since: * 2.7 * diff --git a/include/freetype/ftmm.h b/include/freetype/ftmm.h index fe66f2d6c..49da79606 100644 --- a/include/freetype/ftmm.h +++ b/include/freetype/ftmm.h @@ -323,9 +323,13 @@ FT_BEGIN_HEADER /* FreeType error code. 0~means success. */ /* */ /* */ - /* To reset all axes to the default values, call the function with */ - /* `num_coords' set to zero and `coords' set to NULL (new feature in */ - /* FreeType version 2.8.1). */ + /* [Since 2.8.1] To reset all axes to the default values, call the */ + /* function with `num_coords' set to zero and `coords' set to NULL. */ + /* */ + /* [Since 2.8.2] If `num_coords' is larger than zero, this function */ + /* sets the @FT_FACE_FLAG_VARIATION bit in @FT_Face's `face_flags' */ + /* field (i.e., @FT_IS_VARIATION will return true). If `num_coords' */ + /* is zero, this bit flag gets unset. */ /* */ FT_EXPORT( FT_Error ) FT_Set_MM_Design_Coordinates( FT_Face face, @@ -358,9 +362,15 @@ FT_BEGIN_HEADER /* FreeType error code. 0~means success. */ /* */ /* */ - /* To reset all axes to the default values, call the function with */ - /* `num_coords' set to zero and `coords' set to NULL (new feature in */ - /* FreeType version 2.8.1). */ + /* [Since 2.8.1] To reset all axes to the default values, call the */ + /* function with `num_coords' set to zero and `coords' set to NULL. */ + /* [Since 2.8.2] `Default values' means the currently selected named */ + /* instance (or the base font if no named instance is selected). */ + /* */ + /* [Since 2.8.2] If `num_coords' is larger than zero, this function */ + /* sets the @FT_FACE_FLAG_VARIATION bit in @FT_Face's `face_flags' */ + /* field (i.e., @FT_IS_VARIATION will return true). If `num_coords' */ + /* is zero, this bit flag gets unset. */ /* */ FT_EXPORT( FT_Error ) FT_Set_Var_Design_Coordinates( FT_Face face, @@ -430,9 +440,15 @@ FT_BEGIN_HEADER /* FreeType error code. 0~means success. */ /* */ /* */ - /* To reset all axes to the default values, call the function with */ - /* `num_coords' set to zero and `coords' set to NULL (new feature in */ - /* FreeType version 2.8.1). */ + /* [Since 2.8.1] To reset all axes to the default values, call the */ + /* function with `num_coords' set to zero and `coords' set to NULL. */ + /* [Since 2.8.2] `Default values' means the currently selected named */ + /* instance (or the base font if no named instance is selected). */ + /* */ + /* [Since 2.8.2] If `num_coords' is larger than zero, this function */ + /* sets the @FT_FACE_FLAG_VARIATION bit in @FT_Face's `face_flags' */ + /* field (i.e., @FT_IS_VARIATION will return true). If `num_coords' */ + /* is zero, this bit flag gets unset. */ /* */ FT_EXPORT( FT_Error ) FT_Set_MM_Blend_Coordinates( FT_Face face, @@ -518,6 +534,9 @@ FT_BEGIN_HEADER /* FT_VAR_AXIS_FLAG_HIDDEN :: */ /* The variation axis should not be exposed to user interfaces. */ /* */ + /* */ + /* 2.8.1 */ + /* */ #define FT_VAR_AXIS_FLAG_HIDDEN 1 diff --git a/src/cff/cffobjs.c b/src/cff/cffobjs.c index c794d3239..983fd2e71 100644 --- a/src/cff/cffobjs.c +++ b/src/cff/cffobjs.c @@ -708,50 +708,22 @@ #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT { - FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm; + FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm; + FT_Service_MetricsVariations var = (FT_Service_MetricsVariations)face->var; - FT_Int instance_index = face_index >> 16; + FT_UInt instance_index = (FT_UInt)face_index >> 16; if ( FT_HAS_MULTIPLE_MASTERS( cffface ) && mm && instance_index > 0 ) { - FT_MM_Var* mm_var; - - - error = mm->get_mm_var( cffface, NULL ); + error = mm->set_instance( cffface, instance_index ); if ( error ) goto Exit; - mm->get_var_blend( cffface, NULL, NULL, NULL, &mm_var ); - - if ( mm_var->namedstyle ) - { - FT_Var_Named_Style* named_style; - FT_String* style_name; - - - /* in `face_index', the instance index starts with value 1 */ - named_style = mm_var->namedstyle + instance_index - 1; - error = sfnt->get_name( face, - (FT_UShort)named_style->strid, - &style_name ); - if ( error ) - goto Exit; - - /* set style name; if already set, replace it */ - if ( face->root.style_name ) - FT_FREE( face->root.style_name ); - face->root.style_name = style_name; - - /* finally, select the named instance */ - error = mm->set_var_design( cffface, - mm_var->num_axis, - named_style->coords ); - if ( error ) - goto Exit; - } + if ( var ) + var->metrics_adjust( cffface ); } } #endif /* TT_CONFIG_OPTION_GX_VAR_SUPPORT */ diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c index 4ad6533bf..f3c2430da 100644 --- a/src/truetype/ttgxvar.c +++ b/src/truetype/ttgxvar.c @@ -2057,7 +2057,7 @@ /* `num_instances' holds the number of all named instances, */ /* including the default instance which might be missing */ /* in fvar's table of named instances */ - num_instances = face->root.style_flags >> 16; + num_instances = (FT_UInt)face->root.style_flags >> 16; /* prepare storage area for MM data; this cannot overflow */ /* 32-bit arithmetic because of the size limits used in the */ @@ -2348,7 +2348,7 @@ FT_Error error = FT_Err_Ok; GX_Blend blend; FT_MM_Var* mmvar; - FT_UInt i, j; + FT_UInt i; FT_Bool all_design_coords = FALSE; @@ -2489,30 +2489,6 @@ } } - /* check whether the current variation tuple coincides */ - /* with a named instance */ - - for ( i = 0; i < blend->mmvar->num_namedstyles; i++ ) - { - FT_Fixed* nsc = blend->normalized_stylecoords + i * blend->num_axis; - FT_Fixed* ns = blend->normalizedcoords; - - - for ( j = 0; j < blend->num_axis; j++, nsc++, ns++ ) - { - if ( *nsc != *ns ) - break; - } - - if ( j == blend->num_axis ) - break; - } - - /* adjust named instance index */ - face->root.face_index &= 0xFFFF; - if ( i < blend->mmvar->num_namedstyles ) - face->root.face_index |= ( i + 1 ) << 16; - /* enforce recomputation of the PostScript name; */ FT_FREE( face->postscript_name ); face->postscript_name = NULL; @@ -2680,9 +2656,7 @@ FT_UInt i; FT_Memory memory = face->root.memory; - FT_Var_Axis* a; - FT_Fixed* c; - + FT_Fixed* c; FT_Fixed* normalized = NULL; @@ -2713,10 +2687,31 @@ coords, num_coords * sizeof ( FT_Fixed ) ); - a = mmvar->axis + num_coords; c = blend->coords + num_coords; - for ( i = num_coords; i < mmvar->num_axis; i++, a++, c++ ) - *c = a->def; + + if ( FT_IS_NAMED_INSTANCE( FT_FACE( face ) ) ) + { + FT_UInt instance_index; + FT_Var_Named_Style* named_style; + FT_Fixed* n; + + + instance_index = (FT_UInt)face->root.face_index >> 16; + named_style = mmvar->namedstyle + instance_index - 1; + + n = named_style->coords + num_coords; + for ( i = num_coords; i < mmvar->num_axis; i++, n++, c++ ) + *c = *n; + } + else + { + FT_Var_Axis* a; + + + a = mmvar->axis + num_coords; + for ( i = num_coords; i < mmvar->num_axis; i++, a++, c++ ) + *c = a->def; + } if ( FT_NEW_ARRAY( normalized, mmvar->num_axis ) ) goto Exit; diff --git a/src/truetype/ttobjs.c b/src/truetype/ttobjs.c index 081fa2f1a..70df32b21 100644 --- a/src/truetype/ttobjs.c +++ b/src/truetype/ttobjs.c @@ -657,46 +657,17 @@ #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT { - FT_Int instance_index = face_index >> 16; + FT_UInt instance_index = (FT_UInt)face_index >> 16; if ( FT_HAS_MULTIPLE_MASTERS( ttface ) && instance_index > 0 ) { - error = TT_Get_MM_Var( face, NULL ); + error = TT_Set_Named_Instance( face, instance_index ); if ( error ) goto Exit; - if ( face->blend->mmvar->namedstyle ) - { - FT_Memory memory = ttface->memory; - - FT_Var_Named_Style* named_style; - FT_String* style_name; - - - /* in `face_index', the instance index starts with value 1 */ - named_style = face->blend->mmvar->namedstyle + instance_index - 1; - error = sfnt->get_name( face, - (FT_UShort)named_style->strid, - &style_name ); - if ( error ) - goto Exit; - - /* set style name; if already set, replace it */ - if ( face->root.style_name ) - FT_FREE( face->root.style_name ); - face->root.style_name = style_name; - - /* finally, select the named instance */ - error = TT_Set_Var_Design( face, - face->blend->mmvar->num_axis, - named_style->coords ); - if ( error ) - goto Exit; - - tt_apply_mvar( face ); - } + tt_apply_mvar( face ); } } From 7bfcaacaf5153001b071482fdc7744b3ec71fcd3 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sat, 7 Oct 2017 13:14:38 +0200 Subject: [PATCH 315/470] [sfnt] Adjust behaviour of PS font names for variation fonts. * src/sfnt/sfdriver.c (sfnt_get_var_ps_name): Use a named instance's PS name only if no variation is applied. --- ChangeLog | 7 +++++++ include/freetype/freetype.h | 7 +++++++ src/sfnt/sfdriver.c | 3 ++- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 98c837407..2e8c6d829 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2017-10-07 Werner Lemberg + + [sfnt] Adjust behaviour of PS font names for variation fonts. + + * src/sfnt/sfdriver.c (sfnt_get_var_ps_name): Use a named instance's + PS name only if no variation is applied. + 2017-10-07 Werner Lemberg [cff, truetype] Adjust behaviour of named instances. diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h index 77d277ef5..113f68260 100644 --- a/include/freetype/freetype.h +++ b/include/freetype/freetype.h @@ -3519,6 +3519,13 @@ FT_BEGIN_HEADER /* */ /* http://wwwimages.adobe.com/content/dam/Adobe/en/devnet/font/pdfs/5902.AdobePSNameGeneration.html */ /* */ + /* [Since 2.8.2] Special PostScript names for named instances are */ + /* only returned if the named instance is set with */ + /* @FT_Set_Named_Instance (and the font has corresponding entries in */ + /* its `fvar' table). If @FT_IS_VARIATION returns true, the */ + /* algorithmically derived PostScript name is provided, not looking */ + /* up special entries for named instances. */ + /* */ FT_EXPORT( const char* ) FT_Get_Postscript_Name( FT_Face face ); diff --git a/src/sfnt/sfdriver.c b/src/sfnt/sfdriver.c index fc4eaf74c..293306717 100644 --- a/src/sfnt/sfdriver.c +++ b/src/sfnt/sfdriver.c @@ -862,7 +862,8 @@ NULL, &mm_var ); - if ( FT_IS_NAMED_INSTANCE( FT_FACE( face ) ) ) + if ( FT_IS_NAMED_INSTANCE( FT_FACE( face ) ) && + !FT_IS_VARIATION( FT_FACE( face ) ) ) { SFNT_Service sfnt = (SFNT_Service)face->sfnt; From 91448669a2ea6279df3b2b9dc84ed6d08761d1a1 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sun, 8 Oct 2017 10:23:47 +0200 Subject: [PATCH 316/470] Prevent creation of an incorrect documentation entry. --- include/freetype/config/ftoption.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/freetype/config/ftoption.h b/include/freetype/config/ftoption.h index cb10b1dc6..10b9c644b 100644 --- a/include/freetype/config/ftoption.h +++ b/include/freetype/config/ftoption.h @@ -75,7 +75,7 @@ FT_BEGIN_HEADER /*************************************************************************/ - /*************************************************************************/ + /*#***********************************************************************/ /* */ /* If you enable this configuration option, FreeType recognizes an */ /* environment variable called `FREETYPE_PROPERTIES', which can be used */ From 08e2e311ef0d59e45f845fbd24cc20bea6e2e72d Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sun, 8 Oct 2017 10:37:50 +0200 Subject: [PATCH 317/470] Document global size metrics needed for native bytecode hinting (#52165). --- include/freetype/freetype.h | 42 ++++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h index 113f68260..b4e6627ea 100644 --- a/include/freetype/freetype.h +++ b/include/freetype/freetype.h @@ -1063,6 +1063,9 @@ FT_BEGIN_HEADER /* `descender', `height', `underline_position', and */ /* `underline_thickness'. */ /* */ + /* Especially for TrueType fonts see also the documentation for */ + /* @FT_Size_Metrics. */ + /* */ typedef struct FT_FaceRec_ { FT_Long num_faces; @@ -1582,7 +1585,7 @@ FT_BEGIN_HEADER /* to the following. */ /* */ /* { */ - /* scaled_ascender = FT_MulFix( face->root.ascender, */ + /* scaled_ascender = FT_MulFix( face->ascender, */ /* size_metrics->y_scale ); */ /* } */ /* */ @@ -1596,6 +1599,43 @@ FT_BEGIN_HEADER /* */ /* The `FT_Size_Metrics' structure is valid for bitmap fonts also. */ /* */ + /* */ + /* *TrueType* *fonts* *with* *native* *bytecode* *hinting* */ + /* */ + /* All applications that handle TrueType fonts with native hinting */ + /* must be aware that TTFs expect different rounding of vertical font */ + /* dimensions. The application has to cater for this, especially if */ + /* it wants to rely on a TTF's vertical data (for example, to */ + /* properly align box characters vertically). */ + /* */ + /* Only the application knows _in_ _advance_ that it is going to use */ + /* native hinting for TTFs! FreeType, on the other hand, selects the */ + /* hinting mode not at the time of creating an @FT_Size object but */ + /* much later, namely while calling @FT_Load_Glyph. */ + /* */ + /* Here is some pseudo code that illustrates a possible solution. */ + /* */ + /* { */ + /* font_format = FT_Get_Font_Format( face ); */ + /* */ + /* if ( !strcmp( font_format, "TrueType" ) && */ + /* do_native_bytecode_hinting ) */ + /* { */ + /* ascender = ROUND( FT_MulFix( face->ascender, */ + /* size_metrics->y_scale ) ); */ + /* descender = ROUND( FT_MulFix( face->descender, */ + /* size_metrics->y_scale ) ); */ + /* } */ + /* else */ + /* { */ + /* ascender = size_metrics->ascender; */ + /* descender = size_metrics->descender; */ + /* } */ + /* */ + /* height = size_metrics->height; */ + /* max_advance = size_metrics->max_advance; */ + /* } */ + /* */ typedef struct FT_Size_Metrics_ { FT_UShort x_ppem; /* horizontal pixels per EM */ From b7e43f7d7dc9a2fdb488c989162272e840c88bb8 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sun, 8 Oct 2017 11:58:39 +0200 Subject: [PATCH 318/470] * src/base/ftobjs.c (ft_glyphslot_preset_bitmap): Integer overflows. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3579 --- ChangeLog | 8 ++++++++ src/base/ftobjs.c | 20 ++++++++++---------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2e8c6d829..178ea064c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2017-10-08 Werner Lemberg + + * src/base/ftobjs.c (ft_glyphslot_preset_bitmap): Integer overflows. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3579 + 2017-10-07 Werner Lemberg [sfnt] Adjust behaviour of PS font names for variation fonts. diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c index 2258a3175..3569ca213 100644 --- a/src/base/ftobjs.c +++ b/src/base/ftobjs.c @@ -372,29 +372,29 @@ if ( cbox.xMax - cbox.xMin < 64 ) { cbox.xMin = FT_PIX_FLOOR( cbox.xMin ); - cbox.xMax = FT_PIX_CEIL( cbox.xMax ); + cbox.xMax = FT_PIX_CEIL_LONG( cbox.xMax ); } else { - cbox.xMin = FT_PIX_ROUND( cbox.xMin ); - cbox.xMax = FT_PIX_ROUND( cbox.xMax ); + cbox.xMin = FT_PIX_ROUND_LONG( cbox.xMin ); + cbox.xMax = FT_PIX_ROUND_LONG( cbox.xMax ); } if ( cbox.yMax - cbox.yMin < 64 ) { cbox.yMin = FT_PIX_FLOOR( cbox.yMin ); - cbox.yMax = FT_PIX_CEIL( cbox.yMax ); + cbox.yMax = FT_PIX_CEIL_LONG( cbox.yMax ); } else { - cbox.yMin = FT_PIX_ROUND( cbox.yMin ); - cbox.yMax = FT_PIX_ROUND( cbox.yMax ); + cbox.yMin = FT_PIX_ROUND_LONG( cbox.yMin ); + cbox.yMax = FT_PIX_ROUND_LONG( cbox.yMax ); } #else cbox.xMin = FT_PIX_FLOOR( cbox.xMin ); cbox.yMin = FT_PIX_FLOOR( cbox.yMin ); - cbox.xMax = FT_PIX_CEIL( cbox.xMax ); - cbox.yMax = FT_PIX_CEIL( cbox.yMax ); + cbox.xMax = FT_PIX_CEIL_LONG( cbox.xMax ); + cbox.yMax = FT_PIX_CEIL_LONG( cbox.yMax ); #endif break; @@ -415,8 +415,8 @@ Round: cbox.xMin = FT_PIX_FLOOR( cbox.xMin ); cbox.yMin = FT_PIX_FLOOR( cbox.yMin ); - cbox.xMax = FT_PIX_CEIL( cbox.xMax ); - cbox.yMax = FT_PIX_CEIL( cbox.yMax ); + cbox.xMax = FT_PIX_CEIL_LONG( cbox.xMax ); + cbox.yMax = FT_PIX_CEIL_LONG( cbox.yMax ); } x_shift = SUB_LONG( x_shift, cbox.xMin ); From 64985519210a1b62fcfccf394e6ab0f7bfe9be09 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Mon, 9 Oct 2017 07:45:03 +0200 Subject: [PATCH 319/470] * src/base/ftoutln.c (FT_Outline_Translate): Fix integer overflow. Reported as https://bugs.chromium.org/p/chromium/issues/detail?id=772775 --- ChangeLog | 8 ++++++++ src/base/ftoutln.c | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 178ea064c..0c0650f2b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2017-10-09 Werner Lemberg + + * src/base/ftoutln.c (FT_Outline_Translate): Fix integer overflow. + + Reported as + + https://bugs.chromium.org/p/chromium/issues/detail?id=772775 + 2017-10-08 Werner Lemberg * src/base/ftobjs.c (ft_glyphslot_preset_bitmap): Integer overflows. diff --git a/src/base/ftoutln.c b/src/base/ftoutln.c index 9ceb9cf1b..cbbcb859a 100644 --- a/src/base/ftoutln.c +++ b/src/base/ftoutln.c @@ -540,8 +540,8 @@ for ( n = 0; n < outline->n_points; n++ ) { - vec->x += xOffset; - vec->y += yOffset; + vec->x = ADD_LONG( vec->x, xOffset ); + vec->y = ADD_LONG( vec->y, yOffset ); vec++; } } From 8768536c89d6bb3e747bc69a7c2c1e58d2ed4aa9 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Thu, 12 Oct 2017 00:13:51 +0200 Subject: [PATCH 320/470] [autofit] Better visualize table tracing in source code. --- src/autofit/afhints.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/autofit/afhints.c b/src/autofit/afhints.c index 1b21c06c2..5b70c6d3a 100644 --- a/src/autofit/afhints.c +++ b/src/autofit/afhints.c @@ -314,8 +314,12 @@ AF_DUMP(( "Table of points:\n" )); if ( hints->num_points ) + { AF_DUMP(( " index hedge hseg vedge vseg flags " + /* " XXXXX XXXXX XXXXX XXXXX XXXXX XXXXXX" */ " xorg yorg xscale yscale xfit yfit" )); + /* " XXXXX XXXXX XXXX.XX XXXX.XX XXXX.XX XXXX.XX" */ + } else AF_DUMP(( " (none)\n" )); @@ -420,9 +424,14 @@ dimension == AF_DIMENSION_HORZ ? "vertical" : "horizontal" )); if ( axis->num_segments ) + { AF_DUMP(( " index pos delta dir from to " + /* " XXXXX XXXXX XXXXX XXXXX XXXX XXXX" */ " link serif edge" + /* " XXXX XXXXX XXXX" */ " height extra flags\n" )); + /* " XXXXXX XXXXX XXXXXXXXXXX" */ + } else AF_DUMP(( " (none)\n" )); @@ -564,8 +573,12 @@ 10.0 * hints->y_scale / 65536.0 / 64.0 )); if ( axis->num_edges ) + { AF_DUMP(( " index pos dir link serif" + /* " XXXXX XXXX.XX XXXXX XXXX XXXXX" */ " blue opos pos flags\n" )); + /* " X XXXX.XX XXXX.XX XXXXXXXXXXX" */ + } else AF_DUMP(( " (none)\n" )); From 78df3c27b651e3de068437ac35ee2214849badb9 Mon Sep 17 00:00:00 2001 From: Ewald Hew Date: Thu, 12 Oct 2017 18:13:08 +0800 Subject: [PATCH 321/470] Extract width parsing from Type 1 parser. Duplicate the fast advance width calculations from the old parser. This is to facilitate adding options for compiling out the old parser. * src/psaux/t1decode.{c,h} (t1_decoder_parse_metrics): New function. * include/freetype/internal/psaux.h (T1_Decoder_Funcs): New entry `parse_metrics'. * src/psaux/psauxmod.c: Set the new entry. * src/type1/t1gload.c (T1_Parse_Glyph_And_Get_Char_String), src/cid/cidgload.c (cid_load_glyph): Separate conditional for selecting engine. --- ChangeLog | 16 ++ include/freetype/internal/psaux.h | 5 + src/cid/cidgload.c | 5 + src/psaux/psauxmod.c | 1 + src/psaux/t1decode.c | 277 ++++++++++++++++++++++++++++++ src/psaux/t1decode.h | 4 + src/type1/t1gload.c | 5 + 7 files changed, 313 insertions(+) diff --git a/ChangeLog b/ChangeLog index 0c0650f2b..e973ff8bf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2017-10-12 Ewald Hew + + Extract width parsing from Type 1 parser. + + Duplicate the fast advance width calculations from the old parser. + This is to facilitate adding options for compiling out the old parser. + + * src/psaux/t1decode.{c,h} (t1_decoder_parse_metrics): New function. + * include/freetype/internal/psaux.h (T1_Decoder_Funcs): New entry + `parse_metrics'. + * src/psaux/psauxmod.c: Set the new entry. + + * src/type1/t1gload.c (T1_Parse_Glyph_And_Get_Char_String), + src/cid/cidgload.c (cid_load_glyph): Separate + conditional for selecting engine. + 2017-10-09 Werner Lemberg * src/base/ftoutln.c (FT_Outline_Translate): Fix integer overflow. diff --git a/include/freetype/internal/psaux.h b/include/freetype/internal/psaux.h index 46c238a5c..96b2f1f92 100644 --- a/include/freetype/internal/psaux.h +++ b/include/freetype/internal/psaux.h @@ -879,6 +879,11 @@ FT_BEGIN_HEADER FT_Byte* base, FT_UInt len ); + FT_Error + (*parse_metrics)( T1_Decoder decoder, + FT_Byte* base, + FT_UInt len ); + FT_Error (*parse_charstrings)( PS_Decoder* decoder, FT_Byte* charstring_base, diff --git a/src/cid/cidgload.c b/src/cid/cidgload.c index 8541cca5a..82be44008 100644 --- a/src/cid/cidgload.c +++ b/src/cid/cidgload.c @@ -183,6 +183,11 @@ decoder, charstring + cs_offset, glyph_length - cs_offset ); + else if ( decoder->builder.metrics_only ) + error = psaux->t1_decoder_funcs->parse_metrics( + decoder, + charstring + cs_offset, + glyph_length - cs_offset ); else { PS_Decoder psdecoder; diff --git a/src/psaux/psauxmod.c b/src/psaux/psauxmod.c index b539b1ac1..16e887dec 100644 --- a/src/psaux/psauxmod.c +++ b/src/psaux/psauxmod.c @@ -90,6 +90,7 @@ t1_decoder_init, /* init */ t1_decoder_done, /* done */ t1_decoder_parse_charstrings, /* parse_charstrings_old */ + t1_decoder_parse_metrics, /* parse_metrics */ cf2_decoder_parse_charstrings /* parse_charstrings */ }; diff --git a/src/psaux/t1decode.c b/src/psaux/t1decode.c index e68b76dac..61d246269 100644 --- a/src/psaux/t1decode.c +++ b/src/psaux/t1decode.c @@ -1628,6 +1628,283 @@ return FT_THROW( Stack_Underflow ); } + /*************************************************************************/ + /* */ + /* */ + /* t1_decoder_parse_metrics */ + /* */ + /* */ + /* Parses a given Type 1 charstrings program to extract width */ + /* */ + /* */ + /* decoder :: The current Type 1 decoder. */ + /* */ + /* charstring_base :: The base address of the charstring stream. */ + /* */ + /* charstring_len :: The length in bytes of the charstring stream. */ + /* */ + /* */ + /* FreeType error code. 0 means success. */ + /* */ + FT_LOCAL_DEF( FT_Error ) + t1_decoder_parse_metrics( T1_Decoder decoder, + FT_Byte* charstring_base, + FT_UInt charstring_len ) + { + T1_Decoder_Zone zone; + FT_Byte* ip; + FT_Byte* limit; + T1_Builder builder = &decoder->builder; + +#ifdef FT_DEBUG_LEVEL_TRACE + FT_Bool bol = TRUE; +#endif + + + /* First of all, initialize the decoder */ + decoder->top = decoder->stack; + decoder->zone = decoder->zones; + zone = decoder->zones; + + builder->parse_state = T1_Parse_Start; + + FT_TRACE4(( "\n" + "Start charstring: get width\n" )); + + zone->base = charstring_base; + limit = zone->limit = charstring_base + charstring_len; + ip = zone->cursor = zone->base; + + /* now, execute loop */ + while ( ip < limit ) + { + FT_Long* top = decoder->top; + T1_Operator op = op_none; + FT_Int32 value = 0; + + +#ifdef FT_DEBUG_LEVEL_TRACE + if ( bol ) + { + FT_TRACE5(( " (%d)", decoder->top - decoder->stack )); + bol = FALSE; + } +#endif + + /*********************************************************************/ + /* */ + /* Decode operator or operand */ + /* */ + /* */ + + /* first of all, decompress operator or value */ + switch ( *ip++ ) + { + case 1: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 14: + case 15: + case 21: + case 22: + case 30: + case 31: + goto No_Width; + + case 13: + op = op_hsbw; + break; + + case 12: + if ( ip >= limit ) + { + FT_ERROR(( "t1_decoder_parse_metrics:" + " invalid escape (12+EOF)\n" )); + goto Syntax_Error; + } + + switch ( *ip++ ) + { + case 7: + op = op_sbw; + break; + + default: + goto No_Width; + } + break; + + case 255: /* four bytes integer */ + if ( ip + 4 > limit ) + { + FT_ERROR(( "t1_decoder_parse_metrics:" + " unexpected EOF in integer\n" )); + goto Syntax_Error; + } + + value = (FT_Int32)( ( (FT_UInt32)ip[0] << 24 ) | + ( (FT_UInt32)ip[1] << 16 ) | + ( (FT_UInt32)ip[2] << 8 ) | + (FT_UInt32)ip[3] ); + ip += 4; + + /* According to the specification, values > 32000 or < -32000 must */ + /* be followed by a `div' operator to make the result be in the */ + /* range [-32000;32000]. We expect that the second argument of */ + /* `div' is not a large number. Additionally, we don't handle */ + /* stuff like ` div div' or */ + /* div div'. This is probably not allowed */ + /* anyway. */ + if ( value > 32000 || value < -32000 ) + { + FT_ERROR(( "t1_decoder_parse_metrics:" + " large integer found for width\n" )); + goto Syntax_Error; + } + else + { + value = (FT_Int32)( (FT_UInt32)value << 16 ); + } + + break; + + default: + if ( ip[-1] >= 32 ) + { + if ( ip[-1] < 247 ) + value = (FT_Int32)ip[-1] - 139; + else + { + if ( ++ip > limit ) + { + FT_ERROR(( "t1_decoder_parse_metrics:" + " unexpected EOF in integer\n" )); + goto Syntax_Error; + } + + if ( ip[-2] < 251 ) + value = ( ( ip[-2] - 247 ) * 256 ) + ip[-1] + 108; + else + value = -( ( ( ip[-2] - 251 ) * 256 ) + ip[-1] + 108 ); + } + + value = (FT_Int32)( (FT_UInt32)value << 16 ); + } + else + { + FT_ERROR(( "t1_decoder_parse_metrics:" + " invalid byte (%d)\n", ip[-1] )); + goto Syntax_Error; + } + } + + /*********************************************************************/ + /* */ + /* Push value on stack, or process operator */ + /* */ + /* */ + if ( op == op_none ) + { + if ( top - decoder->stack >= T1_MAX_CHARSTRINGS_OPERANDS ) + { + FT_ERROR(( "t1_decoder_parse_metrics: stack overflow\n" )); + goto Syntax_Error; + } + +#ifdef FT_DEBUG_LEVEL_TRACE + FT_TRACE4(( " %d", value / 65536 )); +#endif + + *top++ = value; + decoder->top = top; + } + else /* general operator */ + { + FT_Int num_args = t1_args_count[op]; + + + FT_ASSERT( num_args >= 0 ); + + if ( top - decoder->stack < num_args ) + goto Stack_Underflow; + +#ifdef FT_DEBUG_LEVEL_TRACE + + if ( top - decoder->stack != num_args ) + FT_TRACE0(( "t1_decoder_parse_metrics:" + " too much operands on the stack" + " (seen %d, expected %d)\n", + top - decoder->stack, num_args )); + +#endif /* FT_DEBUG_LEVEL_TRACE */ + + top -= num_args; + + switch ( op ) + { + case op_hsbw: + FT_TRACE4(( " hsbw" )); + + builder->parse_state = T1_Parse_Have_Width; + + builder->left_bearing.x = ADD_LONG( builder->left_bearing.x, + top[0] ); + + builder->advance.x = top[1]; + builder->advance.y = 0; + + /* we only want to compute the glyph's metrics */ + /* (lsb + advance width), not load the rest of */ + /* it; so exit immediately */ + return FT_Err_Ok; + + case op_sbw: + FT_TRACE4(( " sbw" )); + + builder->parse_state = T1_Parse_Have_Width; + + builder->left_bearing.x = ADD_LONG( builder->left_bearing.x, + top[0] ); + builder->left_bearing.y = ADD_LONG( builder->left_bearing.y, + top[1] ); + + builder->advance.x = top[2]; + builder->advance.y = top[3]; + + /* we only want to compute the glyph's metrics */ + /* (lsb + advance width), not load the rest of */ + /* it; so exit immediately */ + return FT_Err_Ok; + + default: + FT_ERROR(( "t1_decoder_parse_metrics:" + " unhandled opcode %d\n", op )); + goto Syntax_Error; + } + + } /* general operator processing */ + + } /* while ip < limit */ + + FT_TRACE4(( "..end..\n\n" )); + + No_Width: + FT_ERROR(( "t1_decoder_parse_metrics:" + " no width, found op %d instead\n", + ip[-1] )); + Syntax_Error: + return FT_THROW( Syntax_Error ); + + Stack_Underflow: + return FT_THROW( Stack_Underflow ); + } /* parse a single Type 1 glyph */ FT_LOCAL_DEF( FT_Error ) diff --git a/src/psaux/t1decode.h b/src/psaux/t1decode.h index 1ca7e013d..420d120ff 100644 --- a/src/psaux/t1decode.h +++ b/src/psaux/t1decode.h @@ -43,6 +43,10 @@ FT_BEGIN_HEADER t1_decoder_parse_charstrings( T1_Decoder decoder, FT_Byte* base, FT_UInt len ); + FT_LOCAL( FT_Error ) + t1_decoder_parse_metrics( T1_Decoder decoder, + FT_Byte* charstring_base, + FT_UInt charstring_len ); FT_LOCAL( FT_Error ) t1_decoder_init( T1_Decoder decoder, diff --git a/src/type1/t1gload.c b/src/type1/t1gload.c index 30ca186fc..53f89b230 100644 --- a/src/type1/t1gload.c +++ b/src/type1/t1gload.c @@ -90,6 +90,11 @@ decoder, (FT_Byte*)char_string->pointer, (FT_UInt)char_string->length ); + else if ( decoder->builder.metrics_only ) + error = decoder_funcs->parse_metrics( + decoder, + (FT_Byte*)char_string->pointer, + (FT_UInt)char_string->length ); else { CFF_SubFontRec subfont; From dff40d03dff05734b8bf026716b780688f89e830 Mon Sep 17 00:00:00 2001 From: Ewald Hew Date: Thu, 12 Oct 2017 18:13:21 +0800 Subject: [PATCH 322/470] Add T1_CONFIG_OPTION_OLD_ENGINE configuration option. This controls whether the old Type 1 engine gets compiled into FreeType. It is disabled by default. * devel/ftoption.h, include/freetype/config/ftoption.h (T1_CONFIG_OPTION_OLD_ENGINE): New macro. * include/freetype/internal/psaux.h (PS_Decoder): Remove unused field. * include/freetype/internal/psaux.h, src/cid/cidgload.c (cid_load_glyph), src/psaux/psauxmod.c, src/psaux/psobjs.c (ps_builder_add_point), src/psaux/t1decode.c (t1_lookup_glyph_by_stdcharcode, t1_decoder_parse_glyph, t1operator_seac, t1_decoder_parse_charstrings), src/psaux/t1decode.h, src/type1/t1gload.c (T1_Parse_Glyph_And_Get_Char_String): Surround relevant code with macro. Minor code changes. --- ChangeLog | 20 ++++++++++++++++++++ devel/ftoption.h | 10 ++++++++++ include/freetype/config/ftoption.h | 10 ++++++++++ include/freetype/internal/psaux.h | 6 +++--- src/cid/cidgload.c | 5 ++++- src/psaux/psauxmod.c | 3 +++ src/psaux/psobjs.c | 7 ++++++- src/psaux/t1decode.c | 21 +++++++++++++-------- src/psaux/t1decode.h | 3 +++ src/type1/t1gload.c | 8 ++++++-- 10 files changed, 78 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index e973ff8bf..3a35eedd6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,23 @@ +2017-10-12 Ewald Hew + + Add T1_CONFIG_OPTION_OLD_ENGINE configuration option. + + This controls whether the old Type 1 engine gets compiled into FreeType. + It is disabled by default. + + * devel/ftoption.h, include/freetype/config/ftoption.h + (T1_CONFIG_OPTION_OLD_ENGINE): New macro. + + * include/freetype/internal/psaux.h (PS_Decoder): Remove unused field. + * include/freetype/internal/psaux.h, src/cid/cidgload.c + (cid_load_glyph), src/psaux/psauxmod.c, src/psaux/psobjs.c + (ps_builder_add_point), src/psaux/t1decode.c + (t1_lookup_glyph_by_stdcharcode, t1_decoder_parse_glyph, + t1operator_seac, t1_decoder_parse_charstrings), src/psaux/t1decode.h, + src/type1/t1gload.c (T1_Parse_Glyph_And_Get_Char_String): Surround + relevant code with macro. + Minor code changes. + 2017-10-12 Ewald Hew Extract width parsing from Type 1 parser. diff --git a/devel/ftoption.h b/devel/ftoption.h index 11a2d1f49..fadda13a6 100644 --- a/devel/ftoption.h +++ b/devel/ftoption.h @@ -744,6 +744,16 @@ FT_BEGIN_HEADER #undef T1_CONFIG_OPTION_NO_MM_SUPPORT + /*************************************************************************/ + /* */ + /* T1_CONFIG_OPTION_OLD_ENGINE controls whether the pre-Adobe Type 1 */ + /* engine gets compiled into FreeType. If defined, it is possible to */ + /* switch between the two engines using the `hinting-engine' property of */ + /* the type1 driver module. */ + /* */ +/* #define T1_CONFIG_OPTION_OLD_ENGINE */ + + /*************************************************************************/ /*************************************************************************/ /**** ****/ diff --git a/include/freetype/config/ftoption.h b/include/freetype/config/ftoption.h index 10b9c644b..3d5e5a453 100644 --- a/include/freetype/config/ftoption.h +++ b/include/freetype/config/ftoption.h @@ -753,6 +753,16 @@ FT_BEGIN_HEADER #undef T1_CONFIG_OPTION_NO_MM_SUPPORT + /*************************************************************************/ + /* */ + /* T1_CONFIG_OPTION_OLD_ENGINE controls whether the pre-Adobe Type 1 */ + /* engine gets compiled into FreeType. If defined, it is possible to */ + /* switch between the two engines using the `hinting-engine' property of */ + /* the type1 driver module. */ + /* */ +/* #define T1_CONFIG_OPTION_OLD_ENGINE */ + + /*************************************************************************/ /*************************************************************************/ /**** ****/ diff --git a/include/freetype/internal/psaux.h b/include/freetype/internal/psaux.h index 96b2f1f92..26652f888 100644 --- a/include/freetype/internal/psaux.h +++ b/include/freetype/internal/psaux.h @@ -655,8 +655,6 @@ FT_BEGIN_HEADER FT_Long* buildchar; FT_UInt len_buildchar; - void* t1_parse_callback; - } PS_Decoder; @@ -874,15 +872,17 @@ FT_BEGIN_HEADER void (*done)( T1_Decoder decoder ); +#ifdef T1_CONFIG_OPTION_OLD_ENGINE FT_Error (*parse_charstrings_old)( T1_Decoder decoder, FT_Byte* base, FT_UInt len ); - +#else FT_Error (*parse_metrics)( T1_Decoder decoder, FT_Byte* base, FT_UInt len ); +#endif FT_Error (*parse_charstrings)( PS_Decoder* decoder, diff --git a/src/cid/cidgload.c b/src/cid/cidgload.c index 82be44008..086e88997 100644 --- a/src/cid/cidgload.c +++ b/src/cid/cidgload.c @@ -176,6 +176,7 @@ psaux->t1_decrypt( charstring, glyph_length, 4330 ); /* choose which renderer to use */ +#ifdef T1_CONFIG_OPTION_OLD_ENGINE if ( ( (PS_Driver)FT_FACE_DRIVER( face ) )->hinting_engine == FT_T1_HINTING_FREETYPE || decoder->builder.metrics_only ) @@ -183,11 +184,13 @@ decoder, charstring + cs_offset, glyph_length - cs_offset ); - else if ( decoder->builder.metrics_only ) +#else + if ( decoder->builder.metrics_only ) error = psaux->t1_decoder_funcs->parse_metrics( decoder, charstring + cs_offset, glyph_length - cs_offset ); +#endif else { PS_Decoder psdecoder; diff --git a/src/psaux/psauxmod.c b/src/psaux/psauxmod.c index 16e887dec..52f9e9999 100644 --- a/src/psaux/psauxmod.c +++ b/src/psaux/psauxmod.c @@ -89,8 +89,11 @@ { t1_decoder_init, /* init */ t1_decoder_done, /* done */ +#ifdef T1_CONFIG_OPTION_OLD_ENGINE t1_decoder_parse_charstrings, /* parse_charstrings_old */ +#else t1_decoder_parse_metrics, /* parse_metrics */ +#endif cf2_decoder_parse_charstrings /* parse_charstrings */ }; diff --git a/src/psaux/psobjs.c b/src/psaux/psobjs.c index 72442058c..a88bcb78c 100644 --- a/src/psaux/psobjs.c +++ b/src/psaux/psobjs.c @@ -2164,10 +2164,10 @@ FT_Vector* point = outline->points + outline->n_points; FT_Byte* control = (FT_Byte*)outline->tags + outline->n_points; +#ifdef CFF_CONFIG_OPTION_OLD_ENGINE PS_Driver driver = (PS_Driver)FT_FACE_DRIVER( builder->face ); -#ifdef CFF_CONFIG_OPTION_OLD_ENGINE if ( !builder->is_t1 && driver->hinting_engine == FT_CFF_HINTING_FREETYPE ) { @@ -2175,6 +2175,10 @@ point->y = y >> 16; } else +#endif +#ifdef T1_CONFIG_OPTION_OLD_ENGINE +#ifndef CFF_CONFIG_OPTION_OLD_ENGINE + PS_Driver driver = (PS_Driver)FT_FACE_DRIVER( builder->face ); #endif if ( builder->is_t1 && driver->hinting_engine == FT_T1_HINTING_FREETYPE ) @@ -2183,6 +2187,7 @@ point->y = FIXED_TO_INT( y ); } else +#endif { /* cf2_decoder_parse_charstrings uses 16.16 coordinates */ point->x = x >> 10; diff --git a/src/psaux/t1decode.c b/src/psaux/t1decode.c index 61d246269..03183c8e0 100644 --- a/src/psaux/t1decode.c +++ b/src/psaux/t1decode.c @@ -158,6 +158,7 @@ } +#ifdef T1_CONFIG_OPTION_OLD_ENGINE /*************************************************************************/ /* */ /* */ @@ -207,6 +208,15 @@ } + /* parse a single Type 1 glyph */ + FT_LOCAL_DEF( FT_Error ) + t1_decoder_parse_glyph( T1_Decoder decoder, + FT_UInt glyph ) + { + return decoder->parse_callback( decoder, glyph ); + } + + /*************************************************************************/ /* */ /* */ @@ -1628,6 +1638,8 @@ return FT_THROW( Stack_Underflow ); } +#else /* T1_CONFIG_OPTION_OLD_ENGINE */ + /*************************************************************************/ /* */ /* */ @@ -1905,14 +1917,7 @@ Stack_Underflow: return FT_THROW( Stack_Underflow ); } - - /* parse a single Type 1 glyph */ - FT_LOCAL_DEF( FT_Error ) - t1_decoder_parse_glyph( T1_Decoder decoder, - FT_UInt glyph ) - { - return decoder->parse_callback( decoder, glyph ); - } +#endif /* T1_CONFIG_OPTION_OLD_ENGINE */ /* initialize T1 decoder */ diff --git a/src/psaux/t1decode.h b/src/psaux/t1decode.h index 420d120ff..879f8f999 100644 --- a/src/psaux/t1decode.h +++ b/src/psaux/t1decode.h @@ -35,6 +35,7 @@ FT_BEGIN_HEADER t1_lookup_glyph_by_stdcharcode_ps( PS_Decoder* decoder, FT_Int charcode ); +#ifdef T1_CONFIG_OPTION_OLD_ENGINE FT_LOCAL( FT_Error ) t1_decoder_parse_glyph( T1_Decoder decoder, FT_UInt glyph_index ); @@ -43,10 +44,12 @@ FT_BEGIN_HEADER t1_decoder_parse_charstrings( T1_Decoder decoder, FT_Byte* base, FT_UInt len ); +#else FT_LOCAL( FT_Error ) t1_decoder_parse_metrics( T1_Decoder decoder, FT_Byte* charstring_base, FT_UInt charstring_len ); +#endif FT_LOCAL( FT_Error ) t1_decoder_init( T1_Decoder decoder, diff --git a/src/type1/t1gload.c b/src/type1/t1gload.c index 53f89b230..e50d7a5f6 100644 --- a/src/type1/t1gload.c +++ b/src/type1/t1gload.c @@ -58,8 +58,9 @@ face->root.internal->incremental_interface; #endif +#ifdef T1_CONFIG_OPTION_OLD_ENGINE PS_Driver driver = (PS_Driver)FT_FACE_DRIVER( face ); - +#endif decoder->font_matrix = type1->font_matrix; decoder->font_offset = type1->font_offset; @@ -84,17 +85,20 @@ if ( !error ) { /* choose which renderer to use */ +#ifdef T1_CONFIG_OPTION_OLD_ENGINE if ( driver->hinting_engine == FT_T1_HINTING_FREETYPE || decoder->builder.metrics_only ) error = decoder_funcs->parse_charstrings_old( decoder, (FT_Byte*)char_string->pointer, (FT_UInt)char_string->length ); - else if ( decoder->builder.metrics_only ) +#else + if ( decoder->builder.metrics_only ) error = decoder_funcs->parse_metrics( decoder, (FT_Byte*)char_string->pointer, (FT_UInt)char_string->length ); +#endif else { CFF_SubFontRec subfont; From 7e23568b163bc3ab2b4fe735fd538c35246fca05 Mon Sep 17 00:00:00 2001 From: Ewald Hew Date: Thu, 12 Oct 2017 18:13:22 +0800 Subject: [PATCH 323/470] [type1, cid] Add hinting engine switch. Implement property service in `type1' and `cid' drivers to allow switching between FreeType or Adobe hinting engine when both are available. * src/cid/cidriver.c (cid_property_{set,get}, cid_services), src/type1/t1driver.c (t1_property_{set,get}, t1_services): Add Properties service. * src/cid/cidobjs.c (cid_driver_init), src/type1/t1objs.c (T1_Driver_Init): Add default property values. --- ChangeLog | 15 +++ src/cid/cidobjs.c | 6 +- src/cid/cidriver.c | 234 +++++++++++++++++++++++++++++++++++++++++++ src/type1/t1driver.c | 234 +++++++++++++++++++++++++++++++++++++++++++ src/type1/t1objs.c | 4 + 5 files changed, 492 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 3a35eedd6..2f8d322d4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2017-10-12 Ewald Hew + + [type1, cid] Add hinting engine switch. + + Implement property service in `type1' and `cid' drivers to allow + switching between FreeType or Adobe hinting engine when both are + available. + + * src/cid/cidriver.c (cid_property_{set,get}, cid_services), + src/type1/t1driver.c (t1_property_{set,get}, t1_services): Add + Properties service. + + * src/cid/cidobjs.c (cid_driver_init), src/type1/t1objs.c + (T1_Driver_Init): Add default property values. + 2017-10-12 Ewald Hew Add T1_CONFIG_OPTION_OLD_ENGINE configuration option. diff --git a/src/cid/cidobjs.c b/src/cid/cidobjs.c index 52c6438f9..4f4cf4697 100644 --- a/src/cid/cidobjs.c +++ b/src/cid/cidobjs.c @@ -471,8 +471,12 @@ FT_UInt32 seed; - /* set default property values, cf. `ftcffdrv.h' */ + /* set default property values, cf. `ftt1drv.h' */ +#ifdef T1_CONFIG_OPTION_OLD_ENGINE + driver->hinting_engine = FT_T1_HINTING_FREETYPE; +#else driver->hinting_engine = FT_T1_HINTING_ADOBE; +#endif driver->no_stem_darkening = TRUE; diff --git a/src/cid/cidriver.c b/src/cid/cidriver.c index c7d42f939..2ee2707f3 100644 --- a/src/cid/cidriver.c +++ b/src/cid/cidriver.c @@ -27,6 +27,8 @@ #include FT_SERVICE_FONT_FORMAT_H #include FT_SERVICE_POSTSCRIPT_INFO_H #include FT_SERVICE_CID_H +#include FT_SERVICE_PROPERTIES_H +#include FT_TYPE1_DRIVER_H /*************************************************************************/ @@ -167,6 +169,237 @@ }; + /* + * PROPERTY SERVICE + * + */ + static FT_Error + cid_property_set( FT_Module module, /* PS_Driver */ + const char* property_name, + const void* value, + FT_Bool value_is_string ) + { + FT_Error error = FT_Err_Ok; + PS_Driver driver = (PS_Driver)module; + +#ifndef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES + FT_UNUSED( value_is_string ); +#endif + + + if ( !ft_strcmp( property_name, "darkening-parameters" ) ) + { + FT_Int* darken_params; + FT_Int x1, y1, x2, y2, x3, y3, x4, y4; + +#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES + FT_Int dp[8]; + + + if ( value_is_string ) + { + const char* s = (const char*)value; + char* ep; + int i; + + + /* eight comma-separated numbers */ + for ( i = 0; i < 7; i++ ) + { + dp[i] = (FT_Int)ft_strtol( s, &ep, 10 ); + if ( *ep != ',' || s == ep ) + return FT_THROW( Invalid_Argument ); + + s = ep + 1; + } + + dp[7] = (FT_Int)ft_strtol( s, &ep, 10 ); + if ( !( *ep == '\0' || *ep == ' ' ) || s == ep ) + return FT_THROW( Invalid_Argument ); + + darken_params = dp; + } + else +#endif + darken_params = (FT_Int*)value; + + x1 = darken_params[0]; + y1 = darken_params[1]; + x2 = darken_params[2]; + y2 = darken_params[3]; + x3 = darken_params[4]; + y3 = darken_params[5]; + x4 = darken_params[6]; + y4 = darken_params[7]; + + if ( x1 < 0 || x2 < 0 || x3 < 0 || x4 < 0 || + y1 < 0 || y2 < 0 || y3 < 0 || y4 < 0 || + x1 > x2 || x2 > x3 || x3 > x4 || + y1 > 500 || y2 > 500 || y3 > 500 || y4 > 500 ) + return FT_THROW( Invalid_Argument ); + + driver->darken_params[0] = x1; + driver->darken_params[1] = y1; + driver->darken_params[2] = x2; + driver->darken_params[3] = y2; + driver->darken_params[4] = x3; + driver->darken_params[5] = y3; + driver->darken_params[6] = x4; + driver->darken_params[7] = y4; + + return error; + } + else if ( !ft_strcmp( property_name, "hinting-engine" ) ) + { +#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES + if ( value_is_string ) + { + const char* s = (const char*)value; + + + if ( !ft_strcmp( s, "adobe" ) ) + driver->hinting_engine = FT_T1_HINTING_ADOBE; +#ifdef T1_CONFIG_OPTION_OLD_ENGINE + else if ( !ft_strcmp( s, "freetype" ) ) + driver->hinting_engine = FT_T1_HINTING_FREETYPE; +#endif + else + return FT_THROW( Invalid_Argument ); + } + else +#endif + { + FT_UInt* hinting_engine = (FT_UInt*)value; + + + if ( *hinting_engine == FT_T1_HINTING_ADOBE +#ifdef T1_CONFIG_OPTION_OLD_ENGINE + || *hinting_engine == FT_T1_HINTING_FREETYPE +#endif + ) + driver->hinting_engine = *hinting_engine; + else + error = FT_ERR( Unimplemented_Feature ); + + return error; + } + } + else if ( !ft_strcmp( property_name, "no-stem-darkening" ) ) + { +#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES + if ( value_is_string ) + { + const char* s = (const char*)value; + long nsd = ft_strtol( s, NULL, 10 ); + + + if ( !nsd ) + driver->no_stem_darkening = FALSE; + else + driver->no_stem_darkening = TRUE; + } + else +#endif + { + FT_Bool* no_stem_darkening = (FT_Bool*)value; + + + driver->no_stem_darkening = *no_stem_darkening; + } + + return error; + } + else if ( !ft_strcmp( property_name, "random-seed" ) ) + { + FT_Int32 random_seed; + + +#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES + if ( value_is_string ) + { + const char* s = (const char*)value; + + + random_seed = (FT_Int32)ft_strtol( s, NULL, 10 ); + } + else +#endif + random_seed = *(FT_Int32*)value; + + if ( random_seed < 0 ) + random_seed = 0; + + driver->random_seed = random_seed; + + return error; + } + + FT_TRACE0(( "cid_property_set: missing property `%s'\n", + property_name )); + return FT_THROW( Missing_Property ); + } + + + static FT_Error + cid_property_get( FT_Module module, /* PS_Driver */ + const char* property_name, + const void* value ) + { + FT_Error error = FT_Err_Ok; + PS_Driver driver = (PS_Driver)module; + + + if ( !ft_strcmp( property_name, "darkening-parameters" ) ) + { + FT_Int* darken_params = driver->darken_params; + FT_Int* val = (FT_Int*)value; + + + val[0] = darken_params[0]; + val[1] = darken_params[1]; + val[2] = darken_params[2]; + val[3] = darken_params[3]; + val[4] = darken_params[4]; + val[5] = darken_params[5]; + val[6] = darken_params[6]; + val[7] = darken_params[7]; + + return error; + } + else if ( !ft_strcmp( property_name, "hinting-engine" ) ) + { + FT_UInt hinting_engine = driver->hinting_engine; + FT_UInt* val = (FT_UInt*)value; + + + *val = hinting_engine; + + return error; + } + else if ( !ft_strcmp( property_name, "no-stem-darkening" ) ) + { + FT_Bool no_stem_darkening = driver->no_stem_darkening; + FT_Bool* val = (FT_Bool*)value; + + + *val = no_stem_darkening; + + return error; + } + + FT_TRACE0(( "cid_property_get: missing property `%s'\n", + property_name )); + return FT_THROW( Missing_Property ); + } + + + FT_DEFINE_SERVICE_PROPERTIESREC( + cid_service_properties, + + (FT_Properties_SetFunc)cid_property_set, /* set_property */ + (FT_Properties_GetFunc)cid_property_get ) /* get_property */ + + /* * SERVICE LIST * @@ -178,6 +411,7 @@ { FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &cid_service_ps_name }, { FT_SERVICE_ID_POSTSCRIPT_INFO, &cid_service_ps_info }, { FT_SERVICE_ID_CID, &cid_service_cid_info }, + { FT_SERVICE_ID_PROPERTIES, &cid_service_properties }, { NULL, NULL } }; diff --git a/src/type1/t1driver.c b/src/type1/t1driver.c index 06cb26e47..c9559329b 100644 --- a/src/type1/t1driver.c +++ b/src/type1/t1driver.c @@ -30,6 +30,7 @@ #include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_STREAM_H #include FT_INTERNAL_HASH_H +#include FT_TYPE1_DRIVER_H #include FT_SERVICE_MULTIPLE_MASTERS_H #include FT_SERVICE_GLYPH_DICT_H @@ -37,6 +38,7 @@ #include FT_SERVICE_POSTSCRIPT_NAME_H #include FT_SERVICE_POSTSCRIPT_CMAPS_H #include FT_SERVICE_POSTSCRIPT_INFO_H +#include FT_SERVICE_PROPERTIES_H #include FT_SERVICE_KERNING_H @@ -614,6 +616,237 @@ #endif + /* + * PROPERTY SERVICE + * + */ + static FT_Error + t1_property_set( FT_Module module, /* PS_Driver */ + const char* property_name, + const void* value, + FT_Bool value_is_string ) + { + FT_Error error = FT_Err_Ok; + PS_Driver driver = (PS_Driver)module; + +#ifndef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES + FT_UNUSED( value_is_string ); +#endif + + + if ( !ft_strcmp( property_name, "darkening-parameters" ) ) + { + FT_Int* darken_params; + FT_Int x1, y1, x2, y2, x3, y3, x4, y4; + +#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES + FT_Int dp[8]; + + + if ( value_is_string ) + { + const char* s = (const char*)value; + char* ep; + int i; + + + /* eight comma-separated numbers */ + for ( i = 0; i < 7; i++ ) + { + dp[i] = (FT_Int)ft_strtol( s, &ep, 10 ); + if ( *ep != ',' || s == ep ) + return FT_THROW( Invalid_Argument ); + + s = ep + 1; + } + + dp[7] = (FT_Int)ft_strtol( s, &ep, 10 ); + if ( !( *ep == '\0' || *ep == ' ' ) || s == ep ) + return FT_THROW( Invalid_Argument ); + + darken_params = dp; + } + else +#endif + darken_params = (FT_Int*)value; + + x1 = darken_params[0]; + y1 = darken_params[1]; + x2 = darken_params[2]; + y2 = darken_params[3]; + x3 = darken_params[4]; + y3 = darken_params[5]; + x4 = darken_params[6]; + y4 = darken_params[7]; + + if ( x1 < 0 || x2 < 0 || x3 < 0 || x4 < 0 || + y1 < 0 || y2 < 0 || y3 < 0 || y4 < 0 || + x1 > x2 || x2 > x3 || x3 > x4 || + y1 > 500 || y2 > 500 || y3 > 500 || y4 > 500 ) + return FT_THROW( Invalid_Argument ); + + driver->darken_params[0] = x1; + driver->darken_params[1] = y1; + driver->darken_params[2] = x2; + driver->darken_params[3] = y2; + driver->darken_params[4] = x3; + driver->darken_params[5] = y3; + driver->darken_params[6] = x4; + driver->darken_params[7] = y4; + + return error; + } + else if ( !ft_strcmp( property_name, "hinting-engine" ) ) + { +#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES + if ( value_is_string ) + { + const char* s = (const char*)value; + + + if ( !ft_strcmp( s, "adobe" ) ) + driver->hinting_engine = FT_T1_HINTING_ADOBE; +#ifdef T1_CONFIG_OPTION_OLD_ENGINE + else if ( !ft_strcmp( s, "freetype" ) ) + driver->hinting_engine = FT_T1_HINTING_FREETYPE; +#endif + else + return FT_THROW( Invalid_Argument ); + } + else +#endif + { + FT_UInt* hinting_engine = (FT_UInt*)value; + + + if ( *hinting_engine == FT_T1_HINTING_ADOBE +#ifdef T1_CONFIG_OPTION_OLD_ENGINE + || *hinting_engine == FT_T1_HINTING_FREETYPE +#endif + ) + driver->hinting_engine = *hinting_engine; + else + error = FT_ERR( Unimplemented_Feature ); + + return error; + } + } + else if ( !ft_strcmp( property_name, "no-stem-darkening" ) ) + { +#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES + if ( value_is_string ) + { + const char* s = (const char*)value; + long nsd = ft_strtol( s, NULL, 10 ); + + + if ( !nsd ) + driver->no_stem_darkening = FALSE; + else + driver->no_stem_darkening = TRUE; + } + else +#endif + { + FT_Bool* no_stem_darkening = (FT_Bool*)value; + + + driver->no_stem_darkening = *no_stem_darkening; + } + + return error; + } + else if ( !ft_strcmp( property_name, "random-seed" ) ) + { + FT_Int32 random_seed; + + +#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES + if ( value_is_string ) + { + const char* s = (const char*)value; + + + random_seed = (FT_Int32)ft_strtol( s, NULL, 10 ); + } + else +#endif + random_seed = *(FT_Int32*)value; + + if ( random_seed < 0 ) + random_seed = 0; + + driver->random_seed = random_seed; + + return error; + } + + FT_TRACE0(( "t1_property_set: missing property `%s'\n", + property_name )); + return FT_THROW( Missing_Property ); + } + + + static FT_Error + t1_property_get( FT_Module module, /* PS_Driver */ + const char* property_name, + const void* value ) + { + FT_Error error = FT_Err_Ok; + PS_Driver driver = (PS_Driver)module; + + + if ( !ft_strcmp( property_name, "darkening-parameters" ) ) + { + FT_Int* darken_params = driver->darken_params; + FT_Int* val = (FT_Int*)value; + + + val[0] = darken_params[0]; + val[1] = darken_params[1]; + val[2] = darken_params[2]; + val[3] = darken_params[3]; + val[4] = darken_params[4]; + val[5] = darken_params[5]; + val[6] = darken_params[6]; + val[7] = darken_params[7]; + + return error; + } + else if ( !ft_strcmp( property_name, "hinting-engine" ) ) + { + FT_UInt hinting_engine = driver->hinting_engine; + FT_UInt* val = (FT_UInt*)value; + + + *val = hinting_engine; + + return error; + } + else if ( !ft_strcmp( property_name, "no-stem-darkening" ) ) + { + FT_Bool no_stem_darkening = driver->no_stem_darkening; + FT_Bool* val = (FT_Bool*)value; + + + *val = no_stem_darkening; + + return error; + } + + FT_TRACE0(( "t1_property_get: missing property `%s'\n", + property_name )); + return FT_THROW( Missing_Property ); + } + + + FT_DEFINE_SERVICE_PROPERTIESREC( + t1_service_properties, + + (FT_Properties_SetFunc)t1_property_set, /* set_property */ + (FT_Properties_GetFunc)t1_property_get ) /* get_property */ + + /* * SERVICE LIST * @@ -625,6 +858,7 @@ { FT_SERVICE_ID_GLYPH_DICT, &t1_service_glyph_dict }, { FT_SERVICE_ID_FONT_FORMAT, FT_FONT_FORMAT_TYPE_1 }, { FT_SERVICE_ID_POSTSCRIPT_INFO, &t1_service_ps_info }, + { FT_SERVICE_ID_PROPERTIES, &t1_service_properties }, #ifndef T1_CONFIG_OPTION_NO_AFM { FT_SERVICE_ID_KERNING, &t1_service_kerning }, diff --git a/src/type1/t1objs.c b/src/type1/t1objs.c index 8cdbb938a..c6bae004a 100644 --- a/src/type1/t1objs.c +++ b/src/type1/t1objs.c @@ -587,7 +587,11 @@ /* set default property values, cf. `ftt1drv.h' */ +#ifdef T1_CONFIG_OPTION_OLD_ENGINE + driver->hinting_engine = FT_T1_HINTING_FREETYPE; +#else driver->hinting_engine = FT_T1_HINTING_ADOBE; +#endif driver->no_stem_darkening = TRUE; From d2b3b9e682ca60944e02957b9284a3b9a10263a0 Mon Sep 17 00:00:00 2001 From: Ewald Hew Date: Thu, 12 Oct 2017 18:48:57 +0800 Subject: [PATCH 324/470] * devel/ftoption.h: Enable T1_CONFIG_OPTION_OLD_ENGINE by default. --- devel/ftoption.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/devel/ftoption.h b/devel/ftoption.h index fadda13a6..21af1cd63 100644 --- a/devel/ftoption.h +++ b/devel/ftoption.h @@ -751,7 +751,7 @@ FT_BEGIN_HEADER /* switch between the two engines using the `hinting-engine' property of */ /* the type1 driver module. */ /* */ -/* #define T1_CONFIG_OPTION_OLD_ENGINE */ +#define T1_CONFIG_OPTION_OLD_ENGINE /*************************************************************************/ From 90461c0137e5369fc0fdcaffc4abd640a9591cd3 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sat, 14 Oct 2017 08:42:07 +0200 Subject: [PATCH 325/470] [afshaper] Delay creating `hb_set' objects until needed. In runs on Noto Naskh Arabic, this results in 89 sets created instead of 340 before. Makes auto-hinter setup with HarfBuzz enabled 20% to 30% faster. * src/autofit/afshaper.c (af_shaper_get_coverage): Implement it. --- ChangeLog | 10 ++++++++++ src/autofit/afshaper.c | 31 +++++++++++++++---------------- 2 files changed, 25 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2f8d322d4..4cc182ab2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2017-10-14 Behdad Esfahbod + + [afshaper] Delay creating `hb_set' objects until needed. + + In runs on Noto Naskh Arabic, this results in 89 sets created + instead of 340 before. Makes auto-hinter setup with HarfBuzz + enabled 20% to 30% faster. + + * src/autofit/afshaper.c (af_shaper_get_coverage): Implement it. + 2017-10-12 Ewald Hew [type1, cid] Add hinting engine switch. diff --git a/src/autofit/afshaper.c b/src/autofit/afshaper.c index d25996421..8ee9ba1a6 100644 --- a/src/autofit/afshaper.c +++ b/src/autofit/afshaper.c @@ -104,10 +104,10 @@ { hb_face_t* face; - hb_set_t* gsub_lookups; /* GSUB lookups for a given script */ - hb_set_t* gsub_glyphs; /* glyphs covered by GSUB lookups */ - hb_set_t* gpos_lookups; /* GPOS lookups for a given script */ - hb_set_t* gpos_glyphs; /* glyphs covered by GPOS lookups */ + hb_set_t* gsub_lookups = NULL; /* GSUB lookups for a given script */ + hb_set_t* gsub_glyphs = NULL; /* glyphs covered by GSUB lookups */ + hb_set_t* gpos_lookups = NULL; /* GPOS lookups for a given script */ + hb_set_t* gpos_glyphs = NULL; /* glyphs covered by GPOS lookups */ hb_script_t script; const hb_tag_t* coverage_tags; @@ -127,11 +127,6 @@ face = hb_font_get_face( globals->hb_font ); - gsub_lookups = hb_set_create(); - gsub_glyphs = hb_set_create(); - gpos_lookups = hb_set_create(); - gpos_glyphs = hb_set_create(); - coverage_tags = coverages[style_class->coverage]; script = scripts[style_class->script]; @@ -168,6 +163,7 @@ script_tags[1] = HB_TAG_NONE; } + gsub_lookups = hb_set_create(); hb_ot_layout_collect_lookups( face, HB_OT_TAG_GSUB, script_tags, @@ -178,13 +174,6 @@ if ( hb_set_is_empty( gsub_lookups ) ) goto Exit; /* nothing to do */ - hb_ot_layout_collect_lookups( face, - HB_OT_TAG_GPOS, - script_tags, - NULL, - coverage_tags, - gpos_lookups ); - FT_TRACE4(( "GSUB lookups (style `%s'):\n" " ", af_style_names[style_class->style] )); @@ -193,6 +182,7 @@ count = 0; #endif + gsub_glyphs = hb_set_create(); for ( idx = HB_SET_VALUE_INVALID; hb_set_next( gsub_lookups, &idx ); ) { #ifdef FT_DEBUG_LEVEL_TRACE @@ -220,10 +210,19 @@ " ", af_style_names[style_class->style] )); + gpos_lookups = hb_set_create(); + hb_ot_layout_collect_lookups( face, + HB_OT_TAG_GPOS, + script_tags, + NULL, + coverage_tags, + gpos_lookups ); + #ifdef FT_DEBUG_LEVEL_TRACE count = 0; #endif + gpos_glyphs = hb_set_create(); for ( idx = HB_SET_VALUE_INVALID; hb_set_next( gpos_lookups, &idx ); ) { #ifdef FT_DEBUG_LEVEL_TRACE From 73840852016dc69bcf44373ef8ffae0238fead26 Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Sat, 14 Oct 2017 22:22:27 -0400 Subject: [PATCH 326/470] * builds/windows/ftdebug.c (FT_Message): Print to stderr. * builds/wince/ftdebug.c (FT_Message): Ditto. --- ChangeLog | 5 +++++ builds/wince/ftdebug.c | 2 +- builds/windows/ftdebug.c | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4cc182ab2..1ee88caac 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2017-10-14 Alexei Podtelezhnikov + + * builds/windows/ftdebug.c (FT_Message): Print to stderr. + * builds/wince/ftdebug.c (FT_Message): Ditto. + 2017-10-14 Behdad Esfahbod [afshaper] Delay creating `hb_set' objects until needed. diff --git a/builds/wince/ftdebug.c b/builds/wince/ftdebug.c index 7a20e2fac..f516726c3 100644 --- a/builds/wince/ftdebug.c +++ b/builds/wince/ftdebug.c @@ -79,7 +79,7 @@ va_start( ap, fmt ); - vprintf( fmt, ap ); + vfprintf( stderr, fmt, ap ); /* send the string to the debugger as well */ vsprintf( buf, fmt, ap ); OutputDebugStringEx( buf ); diff --git a/builds/windows/ftdebug.c b/builds/windows/ftdebug.c index cadfceade..510768c12 100644 --- a/builds/windows/ftdebug.c +++ b/builds/windows/ftdebug.c @@ -65,7 +65,7 @@ va_start( ap, fmt ); - vprintf( fmt, ap ); + vfprintf( stderr, fmt, ap ); /* send the string to the debugger as well */ vsprintf( buf, fmt, ap ); OutputDebugStringA( buf ); From 6bea49e026ce8a103de2b3c232042458b8f309eb Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Sat, 14 Oct 2017 22:45:11 -0400 Subject: [PATCH 327/470] [base] Netpbm image tracing. * src/base/ftobjs.c (FT_Load_Glyph): Trace bitmap size. (FT_Render_Glyph_Internal): Trace bitmap in Netpbm format. * src/smooth/ftgrays.c (gray_sweep): Sweep remnants of span tracing. --- ChangeLog | 9 ++++++++ src/base/ftobjs.c | 49 ++++++++++++++++++++++++++++++++++++++++++++ src/smooth/ftgrays.c | 4 ---- 3 files changed, 58 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1ee88caac..6b4eca8cf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2017-10-14 Alexei Podtelezhnikov + + [base] Netpbm image tracing. + + * src/base/ftobjs.c (FT_Load_Glyph): Trace bitmap size. + (FT_Render_Glyph_Internal): Trace bitmap in Netpbm format. + + * src/smooth/ftgrays.c (gray_sweep): Sweep remnants of span tracing. + 2017-10-14 Alexei Podtelezhnikov * builds/windows/ftdebug.c (FT_Message): Print to stderr. diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c index 3569ca213..56277d64a 100644 --- a/src/base/ftobjs.c +++ b/src/base/ftobjs.c @@ -1004,6 +1004,10 @@ ft_glyphslot_preset_bitmap( slot, mode, NULL ); } + FT_TRACE5(( " bitmap pixel_mode: %d\n" , slot->bitmap.pixel_mode )); + FT_TRACE5(( " bitmap dimensions: %dx%d\n" , slot->bitmap.width, + slot->bitmap.rows )); + Exit: return error; } @@ -4583,6 +4587,51 @@ } } + /* + * Dump bitmap in Netpbm format (PBM or PGM). + */ + + /* we use FT_TRACE2 in this block */ + if ( ft_trace_levels[trace_bitmap] >= 2 && + !error && + slot->bitmap.rows < 128U && + slot->bitmap.width < 128U ) + { + int rows = (int)slot->bitmap.rows; + int width = (int)slot->bitmap.width; + int pitch = slot->bitmap.pitch; + int i, j, m; + unsigned char* topleft = slot->bitmap.buffer; + + if ( pitch < 0 ) + topleft -= pitch * ( rows - 1 ); + + FT_TRACE2(( "Netpbm image: start\n" )); + switch ( slot->bitmap.pixel_mode ) + { + case FT_PIXEL_MODE_MONO: + FT_TRACE2(( "P1 %d %d\n", width, rows )); + for ( i = 0; i < rows; i++ ) + { + for ( j = 0; j < width; ) + for ( m = 128; m > 0 && j < width; m >>= 1, j++ ) + FT_TRACE2(( " %d", ( topleft[i * pitch + j / 8] & m ) != 0 )); + FT_TRACE2(( "\n" )); + } + break; + + default: + FT_TRACE2(( "P2 %d %d 255\n", width, rows )); + for ( i = 0; i < rows; i++ ) + { + for ( j = 0; j < width; j += 1 ) + FT_TRACE2(( " %3u", topleft[i * pitch + j] )); + FT_TRACE2(( "\n" )); + } + } + FT_TRACE2(( "Netpbm image: end\n" )); + } + #undef FT_COMPONENT #define FT_COMPONENT trace_objs diff --git a/src/smooth/ftgrays.c b/src/smooth/ftgrays.c index df645e66c..e84e38d85 100644 --- a/src/smooth/ftgrays.c +++ b/src/smooth/ftgrays.c @@ -1300,8 +1300,6 @@ typedef ptrdiff_t FT_PtrDist; int y; - FT_TRACE7(( "gray_sweep: start\n" )); - for ( y = ras.min_ey; y < ras.max_ey; y++ ) { PCell cell = ras.ycells[y - ras.min_ey]; @@ -1327,8 +1325,6 @@ typedef ptrdiff_t FT_PtrDist; if ( cover != 0 ) gray_hline( RAS_VAR_ x, y, cover, ras.max_ex - x ); } - - FT_TRACE7(( "gray_sweep: end\n" )); } From ccb0f7998da38aeb5cb353a6f9656f9846a397f4 Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Sun, 15 Oct 2017 14:19:13 -0400 Subject: [PATCH 328/470] [base, cff] Fix MSVC warnings. * src/base/ftobjs.c (FT_New_Library): C4702: unreachable code. (ft_glyphslot_preset_bitmap): C4244: possible loss of data. * src/cff/cffload.c (cff_blend_doBlend): C4244: possible loss of data. Turn `sum' into unsigned. --- ChangeLog | 9 +++++++++ src/base/ftobjs.c | 4 ++-- src/cff/cffload.c | 19 +++++++------------ 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6b4eca8cf..b7db5d97e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2017-10-15 Alexei Podtelezhnikov + + [base, cff] Fix MSVC warnings. + + * src/base/ftobjs.c (FT_New_Library): C4702: unreachable code. + (ft_glyphslot_preset_bitmap): C4244: possible loss of data. + * src/cff/cffload.c (cff_blend_doBlend): C4244: possible loss of data. + Turn `sum' into unsigned. + 2017-10-14 Alexei Podtelezhnikov [base] Netpbm image tracing. diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c index 56277d64a..eb14c6dd9 100644 --- a/src/base/ftobjs.c +++ b/src/base/ftobjs.c @@ -451,7 +451,7 @@ slot->bitmap_left = (FT_Int)x_left; slot->bitmap_top = (FT_Int)y_top; - bitmap->pixel_mode = pixel_mode; + bitmap->pixel_mode = (unsigned char)pixel_mode; bitmap->num_grays = 256; bitmap->width = (unsigned int)width; bitmap->rows = (unsigned int)height; @@ -5174,9 +5174,9 @@ #ifdef FT_CONFIG_OPTION_PIC Fail: ft_pic_container_destroy( library ); -#endif FT_FREE( library ); return error; +#endif } diff --git a/src/cff/cffload.c b/src/cff/cffload.c index 0f0c839d0..069e904f5 100644 --- a/src/cff/cffload.c +++ b/src/cff/cffload.c @@ -1345,19 +1345,14 @@ for ( i = 0; i < numBlends; i++ ) { const FT_Int32* weight = &blend->BV[1]; - FT_Int32 sum; + FT_UInt32 sum; /* convert inputs to 16.16 fixed point */ - sum = cff_parse_num( parser, &parser->stack[i + base] ) * 65536; + sum = cff_parse_num( parser, &parser->stack[i + base] ) * 0x10000; for ( j = 1; j < blend->lenBV; j++ ) - sum = ADD_INT32( - sum, - FT_MulFix( - *weight++, - cff_parse_num( parser, - &parser->stack[delta++] ) * 65536 ) ); + sum += cff_parse_num( parser, &parser->stack[delta++] ) * *weight++; /* point parser stack to new value on blend_stack */ parser->stack[i + base] = subFont->blend_top; @@ -1367,10 +1362,10 @@ /* opcode in both CFF and CFF2 DICTs. See `cff_parse_num' for */ /* decode of this, which rounds to an integer. */ *subFont->blend_top++ = 255; - *subFont->blend_top++ = ( (FT_UInt32)sum & 0xFF000000U ) >> 24; - *subFont->blend_top++ = ( (FT_UInt32)sum & 0x00FF0000U ) >> 16; - *subFont->blend_top++ = ( (FT_UInt32)sum & 0x0000FF00U ) >> 8; - *subFont->blend_top++ = (FT_UInt32)sum & 0x000000FFU; + *subFont->blend_top++ = (FT_Byte)( sum >> 24 ); + *subFont->blend_top++ = (FT_Byte)( sum >> 16 ); + *subFont->blend_top++ = (FT_Byte)( sum >> 8 ); + *subFont->blend_top++ = (FT_Byte)sum; } /* leave only numBlends results on parser stack */ From 94f6d57a4c4264e59493ccdf9b8cef92600c0c25 Mon Sep 17 00:00:00 2001 From: Ewald Hew Date: Mon, 16 Oct 2017 11:48:31 +0800 Subject: [PATCH 329/470] [cff] Fix segfault on missing `psaux' (#52218) * src/cff/cffload.c (cff_done_blend): Add a check for possible nullptr. * modules.cfg: Update dependency list. --- ChangeLog | 8 ++++++++ modules.cfg | 2 +- src/cff/cffload.c | 3 ++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index b7db5d97e..160f445cb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2017-10-12 Ewald Hew + + [cff] Fix segfault on missing `psaux' (#52218) + + * src/cff/cffload.c (cff_done_blend): Add a check for possible nullptr. + + * modules.cfg: Update dependency list. + 2017-10-15 Alexei Podtelezhnikov [base, cff] Fix MSVC warnings. diff --git a/modules.cfg b/modules.cfg index 517111efe..56a2340e5 100644 --- a/modules.cfg +++ b/modules.cfg @@ -42,7 +42,7 @@ FONT_MODULES += type1 # CFF/OpenType font driver. # -# This driver needs the `sfnt', `pshinter', and `psnames' modules. +# This driver needs the `sfnt', `psaux', `pshinter', and `psnames' modules. FONT_MODULES += cff # Type 1 CID-keyed font driver. diff --git a/src/cff/cffload.c b/src/cff/cffload.c index 069e904f5..e8479d48f 100644 --- a/src/cff/cffload.c +++ b/src/cff/cffload.c @@ -1595,7 +1595,8 @@ FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm; - mm->done_blend( FT_FACE( face ) ); + if (mm) + mm->done_blend( FT_FACE( face ) ); } #endif /* TT_CONFIG_OPTION_GX_VAR_SUPPORT */ From c10e7800d70dd09cd9394d9b4dc56b67f9f2e59f Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Wed, 18 Oct 2017 23:05:51 -0400 Subject: [PATCH 330/470] [base] Improve tracing in FT_Render_Glyph. * src/base/ftobjs.c (FT_Render_Glyph_Internal): Add total coverage calculations and downgrade Netpbm dump to bitmap:7. --- ChangeLog | 9 ++++- src/base/ftobjs.c | 91 ++++++++++++++++++++++++++--------------------- 2 files changed, 58 insertions(+), 42 deletions(-) diff --git a/ChangeLog b/ChangeLog index 160f445cb..63a33cd1f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,11 @@ -2017-10-12 Ewald Hew +2017-10-18 Alexei Podtelezhnikov + + [base] Improve tracing in FT_Render_Glyph. + + * src/base/ftobjs.c (FT_Render_Glyph_Internal): Add total coverage + calculations and downgrade Netpbm dump to bitmap:7. + +2017-10-15 Ewald Hew [cff] Fix segfault on missing `psaux' (#52218) diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c index eb14c6dd9..8f7466e0f 100644 --- a/src/base/ftobjs.c +++ b/src/base/ftobjs.c @@ -4548,54 +4548,63 @@ */ /* we use FT_TRACE3 in this block */ - if ( ft_trace_levels[trace_bitmap] >= 3 ) + if ( !error && + ft_trace_levels[trace_bitmap] >= 3 && + slot->bitmap.buffer ) { + FT_Bitmap bitmap; + FT_Error err; + + + FT_Bitmap_Init( &bitmap ); + /* we convert to a single bitmap format for computing the checksum */ - if ( !error && slot->bitmap.buffer ) + /* this also converts the bitmap flow to `down' (i.e., pitch > 0) */ + err = FT_Bitmap_Convert( library, &slot->bitmap, &bitmap, 1 ); + if ( !err ) { - FT_Bitmap bitmap; - FT_Error err; + MD5_CTX ctx; + unsigned char md5[16]; + unsigned long coverage = 0; + int i, j; + int rows = (int)bitmap.rows; + int pitch = bitmap.pitch; - FT_Bitmap_Init( &bitmap ); + FT_TRACE3(( "FT_Render_Glyph: bitmap %dx%d, mode %d\n", + rows, pitch, slot->bitmap.pixel_mode )); - /* this also converts the bitmap flow to `down' (i.e., pitch > 0) */ - err = FT_Bitmap_Convert( library, &slot->bitmap, &bitmap, 1 ); - if ( !err ) - { - MD5_CTX ctx; - unsigned char md5[16]; - int i; - unsigned int rows = bitmap.rows; - unsigned int pitch = (unsigned int)bitmap.pitch; - - - MD5_Init( &ctx ); - if ( bitmap.buffer ) - MD5_Update( &ctx, bitmap.buffer, rows * pitch ); - MD5_Final( md5, &ctx ); - - FT_TRACE3(( "MD5 checksum for %dx%d bitmap:\n" - " ", - rows, pitch )); - for ( i = 0; i < 16; i++ ) - FT_TRACE3(( "%02X", md5[i] )); - FT_TRACE3(( "\n" )); - } + for ( i = 0; i < rows; i++ ) + for ( j = 0; j < pitch; j++ ) + coverage += bitmap.buffer[i * pitch + j]; + + FT_TRACE3(( " Total coverage: %lu\n", coverage )); - FT_Bitmap_Done( library, &bitmap ); + MD5_Init( &ctx ); + if ( bitmap.buffer ) + MD5_Update( &ctx, bitmap.buffer, + (unsigned long)rows * (unsigned long)pitch ); + MD5_Final( md5, &ctx ); + + FT_TRACE3(( " MD5 checksum: " )); + for ( i = 0; i < 16; i++ ) + FT_TRACE3(( "%02X", md5[i] )); + FT_TRACE3(( "\n" )); } + + FT_Bitmap_Done( library, &bitmap ); } /* * Dump bitmap in Netpbm format (PBM or PGM). */ - /* we use FT_TRACE2 in this block */ - if ( ft_trace_levels[trace_bitmap] >= 2 && - !error && + /* we use FT_TRACE7 in this block */ + if ( !error && + ft_trace_levels[trace_bitmap] >= 7 && slot->bitmap.rows < 128U && - slot->bitmap.width < 128U ) + slot->bitmap.width < 128U && + slot->bitmap.buffer ) { int rows = (int)slot->bitmap.rows; int width = (int)slot->bitmap.width; @@ -4606,30 +4615,30 @@ if ( pitch < 0 ) topleft -= pitch * ( rows - 1 ); - FT_TRACE2(( "Netpbm image: start\n" )); + FT_TRACE7(( "Netpbm image: start\n" )); switch ( slot->bitmap.pixel_mode ) { case FT_PIXEL_MODE_MONO: - FT_TRACE2(( "P1 %d %d\n", width, rows )); + FT_TRACE7(( "P1 %d %d\n", width, rows )); for ( i = 0; i < rows; i++ ) { for ( j = 0; j < width; ) for ( m = 128; m > 0 && j < width; m >>= 1, j++ ) - FT_TRACE2(( " %d", ( topleft[i * pitch + j / 8] & m ) != 0 )); - FT_TRACE2(( "\n" )); + FT_TRACE7(( " %d", ( topleft[i * pitch + j / 8] & m ) != 0 )); + FT_TRACE7(( "\n" )); } break; default: - FT_TRACE2(( "P2 %d %d 255\n", width, rows )); + FT_TRACE7(( "P2 %d %d 255\n", width, rows )); for ( i = 0; i < rows; i++ ) { for ( j = 0; j < width; j += 1 ) - FT_TRACE2(( " %3u", topleft[i * pitch + j] )); - FT_TRACE2(( "\n" )); + FT_TRACE7(( " %3u", topleft[i * pitch + j] )); + FT_TRACE7(( "\n" )); } } - FT_TRACE2(( "Netpbm image: end\n" )); + FT_TRACE7(( "Netpbm image: end\n" )); } #undef FT_COMPONENT From d74440a327d6437b5eecd7d552576dbf22e12028 Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Fri, 20 Oct 2017 16:27:33 -0400 Subject: [PATCH 331/470] [base] Improve tracing in FT_Load_Glyph, FT_*_Size. * src/base/ftobjs.c (FT_Load_Glyph): Tag tracing messages with function name, glyph index, and load flags. (FT_Select_Metrics, FT_Request_Metrics): Remove all tracing. (FT_Select_Size, FT_Request_Size): Improve tracing. --- ChangeLog | 9 +++ src/base/ftobjs.c | 174 ++++++++++++++++++++-------------------------- 2 files changed, 85 insertions(+), 98 deletions(-) diff --git a/ChangeLog b/ChangeLog index 63a33cd1f..7340978ce 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2017-10-20 Alexei Podtelezhnikov + + [base] Improve tracing in FT_Load_Glyph, FT_*_Size. + + * src/base/ftobjs.c (FT_Load_Glyph): Tag tracing messages with + function name, glyph index, and load flags. + (FT_Select_Metrics, FT_Request_Metrics): Remove all tracing. + (FT_Select_Size, FT_Request_Size): Improve tracing. + 2017-10-18 Alexei Podtelezhnikov [base] Improve tracing in FT_Render_Glyph. diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c index 8f7466e0f..510825359 100644 --- a/src/base/ftobjs.c +++ b/src/base/ftobjs.c @@ -863,8 +863,8 @@ /* XXX: This is really a temporary hack that should disappear */ /* promptly with FreeType 2.1! */ /* */ - if ( FT_HAS_FIXED_SIZES( face ) && - ( load_flags & FT_LOAD_NO_BITMAP ) == 0 ) + if ( FT_HAS_FIXED_SIZES( face ) && + ( load_flags & FT_LOAD_NO_BITMAP ) == 0 ) { error = driver->clazz->load_glyph( slot, face->size, glyph_index, @@ -932,7 +932,7 @@ /* compute the linear advance in 16.16 pixels */ if ( ( load_flags & FT_LOAD_LINEAR_DESIGN ) == 0 && - ( FT_IS_SCALABLE( face ) ) ) + FT_IS_SCALABLE( face ) ) { FT_Size_Metrics* metrics = &face->size->metrics; @@ -980,12 +980,6 @@ } } - 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 or preset the bitmap now? */ if ( !error && slot->format != FT_GLYPH_FORMAT_BITMAP && @@ -1004,9 +998,17 @@ ft_glyphslot_preset_bitmap( slot, mode, NULL ); } - FT_TRACE5(( " bitmap pixel_mode: %d\n" , slot->bitmap.pixel_mode )); - FT_TRACE5(( " bitmap dimensions: %dx%d\n" , slot->bitmap.width, - slot->bitmap.rows )); + FT_TRACE5(( "FT_Load_Glyph: index %d, flags %x\n", + glyph_index, load_flags )); + FT_TRACE5(( " x advance: %f\n", slot->advance.x / 64.0 )); + FT_TRACE5(( " y advance: %f\n", slot->advance.y / 64.0 )); + FT_TRACE5(( " linear x advance: %f\n", + slot->linearHoriAdvance / 65536.0 )); + FT_TRACE5(( " linear y advance: %f\n", + slot->linearVertAdvance / 65536.0 )); + FT_TRACE5(( " bitmap %dx%d, mode %d\n", + slot->bitmap.width, slot->bitmap.rows, + slot->bitmap.pixel_mode )); Exit: return error; @@ -3003,18 +3005,6 @@ metrics->height = bsize->height << 6; metrics->max_advance = bsize->x_ppem; } - - FT_TRACE5(( "FT_Select_Metrics:\n" )); - FT_TRACE5(( " x scale: %d (%f)\n", - metrics->x_scale, metrics->x_scale / 65536.0 )); - FT_TRACE5(( " y scale: %d (%f)\n", - metrics->y_scale, metrics->y_scale / 65536.0 )); - FT_TRACE5(( " ascender: %f\n", metrics->ascender / 64.0 )); - FT_TRACE5(( " descender: %f\n", metrics->descender / 64.0 )); - FT_TRACE5(( " height: %f\n", metrics->height / 64.0 )); - FT_TRACE5(( " max advance: %f\n", metrics->max_advance / 64.0 )); - FT_TRACE5(( " x ppem: %d\n", metrics->x_ppem )); - FT_TRACE5(( " y ppem: %d\n", metrics->y_ppem )); } @@ -3123,18 +3113,6 @@ metrics->x_scale = 1L << 16; metrics->y_scale = 1L << 16; } - - FT_TRACE5(( "FT_Request_Metrics:\n" )); - FT_TRACE5(( " x scale: %d (%f)\n", - metrics->x_scale, metrics->x_scale / 65536.0 )); - FT_TRACE5(( " y scale: %d (%f)\n", - metrics->y_scale, metrics->y_scale / 65536.0 )); - FT_TRACE5(( " ascender: %f\n", metrics->ascender / 64.0 )); - FT_TRACE5(( " descender: %f\n", metrics->descender / 64.0 )); - FT_TRACE5(( " height: %f\n", metrics->height / 64.0 )); - FT_TRACE5(( " max advance: %f\n", metrics->max_advance / 64.0 )); - FT_TRACE5(( " x ppem: %d\n", metrics->x_ppem )); - FT_TRACE5(( " y ppem: %d\n", metrics->y_ppem )); } @@ -3144,6 +3122,7 @@ FT_Select_Size( FT_Face face, FT_Int strike_index ) { + FT_Error error = FT_Err_Ok; FT_Driver_Class clazz; @@ -3157,36 +3136,37 @@ if ( clazz->select_size ) { - FT_Error error; + error = clazz->select_size( face->size, (FT_ULong)strike_index ); + FT_TRACE5(( "FT_Select_Size (%s driver):\n", + face->driver->root.clazz->module_name )); + } + else + { + FT_Select_Metrics( face, (FT_ULong)strike_index ); - error = clazz->select_size( face->size, (FT_ULong)strike_index ); + FT_TRACE5(( "FT_Select_Size:\n" )); + } #ifdef FT_DEBUG_LEVEL_TRACE - { - FT_Size_Metrics* metrics = &face->size->metrics; - - - FT_TRACE5(( "FT_Select_Size (font driver's `select_size'):\n" )); - FT_TRACE5(( " x scale: %d (%f)\n", - metrics->x_scale, metrics->x_scale / 65536.0 )); - FT_TRACE5(( " y scale: %d (%f)\n", - metrics->y_scale, metrics->y_scale / 65536.0 )); - FT_TRACE5(( " ascender: %f\n", metrics->ascender / 64.0 )); - FT_TRACE5(( " descender: %f\n", metrics->descender / 64.0 )); - FT_TRACE5(( " height: %f\n", metrics->height / 64.0 )); - FT_TRACE5(( " max advance: %f\n", metrics->max_advance / 64.0 )); - FT_TRACE5(( " x ppem: %d\n", metrics->x_ppem )); - FT_TRACE5(( " y ppem: %d\n", metrics->y_ppem )); - } -#endif + { + FT_Size_Metrics* metrics = &face->size->metrics; - return error; - } - FT_Select_Metrics( face, (FT_ULong)strike_index ); + FT_TRACE5(( " x scale: %d (%f)\n", + metrics->x_scale, metrics->x_scale / 65536.0 )); + FT_TRACE5(( " y scale: %d (%f)\n", + metrics->y_scale, metrics->y_scale / 65536.0 )); + FT_TRACE5(( " ascender: %f\n", metrics->ascender / 64.0 )); + FT_TRACE5(( " descender: %f\n", metrics->descender / 64.0 )); + FT_TRACE5(( " height: %f\n", metrics->height / 64.0 )); + FT_TRACE5(( " max advance: %f\n", metrics->max_advance / 64.0 )); + FT_TRACE5(( " x ppem: %d\n", metrics->x_ppem )); + FT_TRACE5(( " y ppem: %d\n", metrics->y_ppem )); + } +#endif - return FT_Err_Ok; + return error; } @@ -3196,6 +3176,7 @@ FT_Request_Size( FT_Face face, FT_Size_Request req ) { + FT_Error error = FT_Err_Ok; FT_Driver_Class clazz; FT_ULong strike_index; @@ -3215,55 +3196,52 @@ if ( clazz->request_size ) { - FT_Error error; - - error = clazz->request_size( face->size, req ); -#ifdef FT_DEBUG_LEVEL_TRACE - { - FT_Size_Metrics* metrics = &face->size->metrics; - - - FT_TRACE5(( "FT_Request_Size (font driver's `request_size'):\n" )); - FT_TRACE5(( " x scale: %d (%f)\n", - metrics->x_scale, metrics->x_scale / 65536.0 )); - FT_TRACE5(( " y scale: %d (%f)\n", - metrics->y_scale, metrics->y_scale / 65536.0 )); - FT_TRACE5(( " ascender: %f\n", metrics->ascender / 64.0 )); - FT_TRACE5(( " descender: %f\n", metrics->descender / 64.0 )); - FT_TRACE5(( " height: %f\n", metrics->height / 64.0 )); - FT_TRACE5(( " max advance: %f\n", metrics->max_advance / 64.0 )); - FT_TRACE5(( " x ppem: %d\n", metrics->x_ppem )); - FT_TRACE5(( " y ppem: %d\n", metrics->y_ppem )); - } -#endif - - return error; + FT_TRACE5(( "FT_Request_Size (%s driver):\n", + face->driver->root.clazz->module_name )); } - - /* - * The reason that a driver doesn't have `request_size' defined is - * either that the scaling here suffices or that the supported formats - * are bitmap-only and size matching is not implemented. - * - * In the latter case, a simple size matching is done. - */ - if ( !FT_IS_SCALABLE( face ) && FT_HAS_FIXED_SIZES( face ) ) + else if ( !FT_IS_SCALABLE( face ) && FT_HAS_FIXED_SIZES( face ) ) { - FT_Error error; - - + /* + * The reason that a driver doesn't have `request_size' defined is + * either that the scaling here suffices or that the supported formats + * are bitmap-only and size matching is not implemented. + * + * In the latter case, a simple size matching is done. + */ error = FT_Match_Size( face, req, 0, &strike_index ); if ( error ) return error; return FT_Select_Size( face, (FT_Int)strike_index ); } + else + { + FT_Request_Metrics( face, req ); + + FT_TRACE5(( "FT_Request_Size:\n" )); + } + +#ifdef FT_DEBUG_LEVEL_TRACE + { + FT_Size_Metrics* metrics = &face->size->metrics; - FT_Request_Metrics( face, req ); - return FT_Err_Ok; + FT_TRACE5(( " x scale: %d (%f)\n", + metrics->x_scale, metrics->x_scale / 65536.0 )); + FT_TRACE5(( " y scale: %d (%f)\n", + metrics->y_scale, metrics->y_scale / 65536.0 )); + FT_TRACE5(( " ascender: %f\n", metrics->ascender / 64.0 )); + FT_TRACE5(( " descender: %f\n", metrics->descender / 64.0 )); + FT_TRACE5(( " height: %f\n", metrics->height / 64.0 )); + FT_TRACE5(( " max advance: %f\n", metrics->max_advance / 64.0 )); + FT_TRACE5(( " x ppem: %d\n", metrics->x_ppem )); + FT_TRACE5(( " y ppem: %d\n", metrics->y_ppem )); + } +#endif + + return error; } @@ -4550,7 +4528,7 @@ /* we use FT_TRACE3 in this block */ if ( !error && ft_trace_levels[trace_bitmap] >= 3 && - slot->bitmap.buffer ) + slot->bitmap.buffer ) { FT_Bitmap bitmap; FT_Error err; @@ -4604,7 +4582,7 @@ ft_trace_levels[trace_bitmap] >= 7 && slot->bitmap.rows < 128U && slot->bitmap.width < 128U && - slot->bitmap.buffer ) + slot->bitmap.buffer ) { int rows = (int)slot->bitmap.rows; int width = (int)slot->bitmap.width; From 91015cb41d8f56777f93394f5a60914bc0c0f330 Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Sat, 21 Oct 2017 22:57:43 -0400 Subject: [PATCH 332/470] [smooth] Improve complex rendering at high ppem. At large sizes almost but not exactly horizontal segments can quickly drain the rendering pool. This patch at least avoids filling the pool with trivial cells. Beyond this, we can only increase the pool size. Reported, analyzed, and tested by Colin Fahey. * src/smooth/ftgrays.c (gray_set_cell): Do not record trivial cells. --- ChangeLog | 14 +++++++++++++- src/smooth/ftgrays.c | 4 ++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7340978ce..afe63fc84 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2017-10-20 Alexei Podtelezhnikov + + [smooth] Improve complex rendering at high ppem. + + At large sizes almost but not exactly horizontal segments can quickly + drain the rendering pool. This patch at least avoids filling the pool + with trivial cells. Beyond this, we can only increase the pool size. + + Reported, analyzed, and tested by Colin Fahey. + + * src/smooth/ftgrays.c (gray_set_cell): Do not record trivial cells. + 2017-10-20 Alexei Podtelezhnikov [base] Improve tracing in FT_Load_Glyph, FT_*_Size. @@ -43,7 +55,7 @@ 2017-10-14 Alexei Podtelezhnikov * builds/windows/ftdebug.c (FT_Message): Print to stderr. - * builds/wince/ftdebug.c (FT_Message): Ditto. + * builds/wince/ftdebug.c (FT_Message): Ditto. 2017-10-14 Behdad Esfahbod diff --git a/src/smooth/ftgrays.c b/src/smooth/ftgrays.c index e84e38d85..fa488ecb9 100644 --- a/src/smooth/ftgrays.c +++ b/src/smooth/ftgrays.c @@ -582,8 +582,8 @@ typedef ptrdiff_t FT_PtrDist; if ( ex < ras.min_ex ) ex = ras.min_ex - 1; - /* record the current one if it is valid */ - if ( !ras.invalid ) + /* record the current one if it is substantial and valid */ + if ( ( ras.area || ras.cover ) && !ras.invalid ) gray_record_cell( RAS_VAR ); ras.area = 0; From 816516360c7609916a889b5d0f38759e49507e7f Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Wed, 1 Nov 2017 22:51:03 -0400 Subject: [PATCH 333/470] [smooth] Fix complex rendering at high ppem. We used to split large glyphs into horizontal bands and continue bisecting them still horizontally if that was not enough. This is guaranteed to fail when a single scanline cannot fit into the rendering memory pool. Now we bisect the bands vertically so that the smallest unit is a column of the band height, which is guranteed to fit into memory. * src/smooth/ftgrays.c (gray_convert_glyph): Implement it. --- ChangeLog | 13 +++++++++ src/smooth/ftgrays.c | 64 +++++++++++++++++++------------------------- 2 files changed, 41 insertions(+), 36 deletions(-) diff --git a/ChangeLog b/ChangeLog index afe63fc84..2f05d8e58 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2017-11-01 Alexei Podtelezhnikov + + [smooth] Fix complex rendering at high ppem. + + We used to split large glyphs into horizontal bands and continue + bisecting them still horizontally if that was not enough. This is + guaranteed to fail when a single scanline cannot fit into the + rendering memory pool. Now we bisect the bands vertically so that + the smallest unit is a column of the band height, which is guranteed + to fit into memory. + + * src/smooth/ftgrays.c (gray_convert_glyph): Implement it. + 2017-10-20 Alexei Podtelezhnikov [smooth] Improve complex rendering at high ppem. diff --git a/src/smooth/ftgrays.c b/src/smooth/ftgrays.c index fa488ecb9..91ca6e339 100644 --- a/src/smooth/ftgrays.c +++ b/src/smooth/ftgrays.c @@ -1736,35 +1736,43 @@ typedef ptrdiff_t FT_PtrDist; static int gray_convert_glyph( RAS_ARG ) { + const TCoord yMin = ras.min_ey; + const TCoord yMax = ras.max_ey; + const TCoord xMin = ras.min_ex; + const TCoord xMax = ras.max_ex; + TCell buffer[FT_MAX_GRAY_POOL]; - TCoord band_size = FT_MAX_GRAY_POOL / 8; - TCoord count = ras.max_ey - ras.min_ey; - int num_bands; - TCoord min, max, max_y; + size_t height = (size_t)( yMax - yMin ); + size_t n = FT_MAX_GRAY_POOL / 8; + TCoord y; TCoord bands[32]; /* enough to accommodate bisections */ TCoord* band; /* set up vertical bands */ - if ( count > band_size ) + if ( height > n ) { /* two divisions rounded up */ - num_bands = (int)( ( count + band_size - 1) / band_size ); - band_size = ( count + num_bands - 1 ) / num_bands; + n = ( height + n - 1 ) / n; + height = ( height + n - 1 ) / n; } - min = ras.min_ey; - max_y = ras.max_ey; + /* memory management */ + n = ( height * sizeof ( PCell ) + sizeof ( TCell ) - 1 ) / sizeof ( TCell ); + + ras.cells = buffer + n; + ras.max_cells = (FT_PtrDist)( FT_MAX_GRAY_POOL - n ); + ras.ycells = (PCell*)buffer; - for ( ; min < max_y; min = max ) + for ( y = yMin; y < yMax; ) { - max = min + band_size; - if ( max > max_y ) - max = max_y; + ras.min_ey = y; + y += height; + ras.max_ey = FT_MIN( y, yMax ); band = bands; - band[1] = min; - band[0] = max; + band[1] = xMin; + band[0] = xMax; do { @@ -1772,27 +1780,12 @@ typedef ptrdiff_t FT_PtrDist; int error; - /* memory management */ - { - size_t ycount = (size_t)width; - size_t cell_start; - - - cell_start = ( ycount * sizeof ( PCell ) + sizeof ( TCell ) - 1 ) / - sizeof ( TCell ); - - ras.cells = buffer + cell_start; - ras.max_cells = (FT_PtrDist)( FT_MAX_GRAY_POOL - cell_start ); - ras.num_cells = 0; - - ras.ycells = (PCell*)buffer; - while ( ycount ) - ras.ycells[--ycount] = NULL; - } + FT_MEM_ZERO( ras.ycells, height * sizeof ( PCell ) ); + ras.num_cells = 0; ras.invalid = 1; - ras.min_ey = band[1]; - ras.max_ey = band[0]; + ras.min_ex = band[1]; + ras.max_ex = band[0]; error = gray_convert_glyph_inner( RAS_VAR ); @@ -1808,8 +1801,7 @@ typedef ptrdiff_t FT_PtrDist; /* render pool overflow; we will reduce the render band by half */ width >>= 1; - /* This is too complex for a single scanline; there must */ - /* be some problems. */ + /* this should never happen even with tiny rendering pool */ if ( width == 0 ) { FT_TRACE7(( "gray_convert_glyph: rotten glyph\n" )); From 77b34e01ed459cd7bc3b46241a109cc4c2981a83 Mon Sep 17 00:00:00 2001 From: suzuki toshiya Date: Fri, 3 Nov 2017 16:13:29 +0900 Subject: [PATCH 334/470] [truetype] Add more tricky fonts. See the report by Yang Yinsen. https://lists.gnu.org/archive/html/freetype-devel/2017-11/msg00000.html * src/truetype/ttobjs.c (trick_names): Add `DFGothic-EB', `DFGyoSho-Lt', `DFHSGothic-W5', `DFHSMincho-W3' and `DFHSMincho-W7'. (tt_check_trickyness_sfnt_ids): Add checksums for DFGothic-EB, DFGyoSho-Lt, DFHSGothic-W5, DFHSMincho-W3 and DFHSMincho-W7. Also add checksums for DLCLiShu and DLCHayBold which their family names were already listed but their checksums were previously unknown. --- ChangeLog | 14 ++++++++++++++ src/truetype/ttobjs.c | 44 +++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 56 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2f05d8e58..2c84dbda2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2017-11-03 suzuki toshiya + + [truetype] Add more tricky fonts. + + See the report by Yang Yinsen. + https://lists.gnu.org/archive/html/freetype-devel/2017-11/msg00000.html + + * src/truetype/ttobjs.c (trick_names): Add `DFGothic-EB', + `DFGyoSho-Lt', `DFHSGothic-W5', `DFHSMincho-W3' and `DFHSMincho-W7'. + (tt_check_trickyness_sfnt_ids): Add checksums for DFGothic-EB, + DFGyoSho-Lt, DFHSGothic-W5, DFHSMincho-W3 and DFHSMincho-W7. Also + add checksums for DLCLiShu and DLCHayBold which their family names + were already listed but their checksums were previously unknown. + 2017-11-01 Alexei Podtelezhnikov [smooth] Fix complex rendering at high ppem. diff --git a/src/truetype/ttobjs.c b/src/truetype/ttobjs.c index 70df32b21..1726b0eb8 100644 --- a/src/truetype/ttobjs.c +++ b/src/truetype/ttobjs.c @@ -147,7 +147,7 @@ { #define TRICK_NAMES_MAX_CHARACTERS 19 -#define TRICK_NAMES_COUNT 18 +#define TRICK_NAMES_COUNT 23 static const char trick_names[TRICK_NAMES_COUNT] [TRICK_NAMES_MAX_CHARACTERS + 1] = @@ -165,6 +165,11 @@ "cpop", /* dftt-p7.ttf; version 1.00, 1992 [DLJGyShoMedium] */ "DFGirl-W6-WIN-BF", /* dftt-h6.ttf; version 1.00, 1993 */ + "DFGothic-EB", /* DynaLab Inc. 1992-1995 */ + "DFGyoSho-Lt", /* DynaLab Inc. 1992-1995 */ + "DFHSGothic-W5", /* DynaLab Inc. 1992-1995 */ + "DFHSMincho-W3", /* DynaLab Inc. 1992-1995 */ + "DFHSMincho-W7", /* DynaLab Inc. 1992-1995 */ "DFKaiSho-SB", /* dfkaisb.ttf */ "DFKaiShu", "DFKai-SB", /* kaiu.ttf; version 3.00, 1998 [DFKaiShu-SB-Estd-BF] */ @@ -265,7 +270,7 @@ tt_check_trickyness_sfnt_ids( TT_Face face ) { #define TRICK_SFNT_IDS_PER_FACE 3 -#define TRICK_SFNT_IDS_NUM_FACES 19 +#define TRICK_SFNT_IDS_NUM_FACES 26 static const tt_sfnt_id_rec sfnt_id[TRICK_SFNT_IDS_NUM_FACES] [TRICK_SFNT_IDS_PER_FACE] = { @@ -284,6 +289,31 @@ { 0x28233BF1UL, 0x000087C4UL }, /* fpgm */ { 0xA344A1EBUL, 0x000001E1UL } /* prep */ }, + { /* DFGothic-EB */ + { 0x12C3EBB2UL, 0x00000350UL }, /* cvt */ + { 0xB680EE64UL, 0x000087A7UL }, /* fpgm */ + { 0xCE939563UL, 0x00000758UL } /* prep */ + }, + { /* DFGyoSho-Lt */ + { 0x11E5EAD4UL, 0x00000350UL }, /* cvt */ + { 0xCE5956E9UL, 0x0000BC85UL }, /* fpgm */ + { 0x8272F416UL, 0x00000045UL } /* prep */ + }, + { /* DFHSGothic-W5 */ + { 0x1262EB4EUL, 0x00000350UL }, /* cvt */ + { 0xE86A5D64UL, 0x00007940UL }, /* fpgm */ + { 0x7850F729UL, 0x000005FFUL } /* prep */ + }, + { /* DFHSMincho-W3 */ + { 0x122DEB0AUL, 0x00000350UL }, /* cvt */ + { 0x3D16328AUL, 0x0000859BUL }, /* fpgm */ + { 0xA93FC33BUL, 0x000002CBUL } /* prep */ + }, + { /* DFHSMincho-W7 */ + { 0x125FEB26UL, 0x00000350UL }, /* cvt */ + { 0xA5ACC982UL, 0x00007EE1UL }, /* fpgm */ + { 0x90999196UL, 0x0000041FUL } /* prep */ + }, { /* DFKaiShu */ { 0x11E5EAD4UL, 0x00000350UL }, /* cvt */ { 0x5A30CA3BUL, 0x00009063UL }, /* fpgm */ @@ -294,6 +324,16 @@ { 0xA6E78C01UL, 0x00008998UL }, /* fpgm */ { 0x13A42602UL, 0x0000007EUL } /* prep */ }, + { /* DLCLiShu */ + { 0x07DCF546UL, 0x00000308UL }, /* cvt */ + { 0x40FE7C90UL, 0x00008E2AUL }, /* fpgm */ + { 0x608174B5UL, 0x0000007AUL } /* prep */ + }, + { /* DLCHayBold */ + { 0xEB891238UL, 0x00000308UL }, /* cvt */ + { 0xD2E4DCD4UL, 0x0000676FUL }, /* fpgm */ + { 0x8EA5F293UL, 0x000003B8UL } /* prep */ + }, { /* HuaTianKaiTi */ { 0xFFFBFFFCUL, 0x00000008UL }, /* cvt */ { 0x9C9E48B8UL, 0x0000BEA2UL }, /* fpgm */ From cdab9cfae9f336bddf709bad6f4f1de66f67524e Mon Sep 17 00:00:00 2001 From: Ewald Hew Date: Sat, 21 Oct 2017 16:36:49 +0800 Subject: [PATCH 335/470] [psaux] Fix PostScript interpreter rewinding in Type 1 mode. (#52251) The interpreter in Type 1 mode rewinds the charstring after collecting all hints for building the initial hintmap (commit d52dd7f). However, some charstrings use `endchar' in a final subroutine call, rewinding to the start of that subroutine, and only a small section of the actual glyph is drawn. * src/psaux/psintrp.c (cf2_interpT2CharString) : Ensure we are on the top level charstring before rewinding. --- ChangeLog | 13 +++++++++++++ src/psaux/psintrp.c | 13 +++++++++++++ 2 files changed, 26 insertions(+) diff --git a/ChangeLog b/ChangeLog index 2c84dbda2..6ce0c2030 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2017-11-03 Ewald Hew + + [psaux] Fix PostScript interpreter rewinding in Type 1 mode. (#52251) + + The interpreter in Type 1 mode rewinds the charstring after collecting + all hints for building the initial hintmap (commit d52dd7f). However, + some charstrings use `endchar' in a final subroutine call, rewinding to + the start of that subroutine, and only a small section of the actual + glyph is drawn. + + * src/psaux/psintrp.c (cf2_interpT2CharString) : + Ensure we are on the top level charstring before rewinding. + 2017-11-03 suzuki toshiya [truetype] Add more tricky fonts. diff --git a/src/psaux/psintrp.c b/src/psaux/psintrp.c index a60597e3c..5c0ee7849 100644 --- a/src/psaux/psintrp.c +++ b/src/psaux/psintrp.c @@ -2462,6 +2462,19 @@ hintMask.isNew = TRUE; /* rewind charstring */ + /* some charstrings use endchar from a final subroutine call */ + /* without returning, detect these and exit to the top level */ + /* charstring */ + while ( charstringIndex > 0 ) + { + FT_TRACE4(( " return (leaving level %d)\n", charstringIndex )); + + /* restore position in previous charstring */ + charstring = (CF2_Buffer) + cf2_arrstack_getPointer( + &subrStack, + (CF2_UInt)--charstringIndex ); + } charstring->ptr = charstring->start; break; From ab6fe0768fd2a319d73adfd6cc1c8338bf2e669c Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Mon, 6 Nov 2017 21:34:56 -0500 Subject: [PATCH 336/470] * src/smooth/ftgrays.c (gray_set_cell): Fix uninitialized variables. --- ChangeLog | 4 ++++ src/smooth/ftgrays.c | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6ce0c2030..620cebc24 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2017-11-01 Alexei Podtelezhnikov + + * src/smooth/ftgrays.c (gray_set_cell): Fix uninitialized variables. + 2017-11-03 Ewald Hew [psaux] Fix PostScript interpreter rewinding in Type 1 mode. (#52251) diff --git a/src/smooth/ftgrays.c b/src/smooth/ftgrays.c index 91ca6e339..3b3dcb31e 100644 --- a/src/smooth/ftgrays.c +++ b/src/smooth/ftgrays.c @@ -582,8 +582,8 @@ typedef ptrdiff_t FT_PtrDist; if ( ex < ras.min_ex ) ex = ras.min_ex - 1; - /* record the current one if it is substantial and valid */ - if ( ( ras.area || ras.cover ) && !ras.invalid ) + /* record the current one if it is valid and substantial */ + if ( !ras.invalid && ( ras.area || ras.cover ) ) gray_record_cell( RAS_VAR ); ras.area = 0; From 8f5568bfc4fd5fe707f0e41915b57affc1bff0e3 Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Mon, 6 Nov 2017 21:42:46 -0500 Subject: [PATCH 337/470] * src/base/ftobjs.c (FT_Load_Glyph): Relocate condition. --- ChangeLog | 6 +++++- src/base/ftobjs.c | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 620cebc24..1ce5029a1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,8 @@ -2017-11-01 Alexei Podtelezhnikov +2017-11-06 Alexei Podtelezhnikov + + * src/base/ftobjs.c (FT_Load_Glyph): Relocate condition. + +2017-11-06 Alexei Podtelezhnikov * src/smooth/ftgrays.c (gray_set_cell): Fix uninitialized variables. diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c index 510825359..c85d06003 100644 --- a/src/base/ftobjs.c +++ b/src/base/ftobjs.c @@ -982,6 +982,7 @@ /* do we need to render the image or preset the bitmap now? */ if ( !error && + ( load_flags & FT_LOAD_NO_SCALE ) == 0 && slot->format != FT_GLYPH_FORMAT_BITMAP && slot->format != FT_GLYPH_FORMAT_COMPOSITE ) { @@ -994,7 +995,7 @@ if ( load_flags & FT_LOAD_RENDER ) error = FT_Render_Glyph( slot, mode ); - else if ( ( load_flags & FT_LOAD_NO_SCALE ) == 0 ) + else ft_glyphslot_preset_bitmap( slot, mode, NULL ); } From af585ad4fec965fa85f5d61c759f3bc940936de4 Mon Sep 17 00:00:00 2001 From: yuri_levchenko Date: Thu, 9 Nov 2017 13:38:26 +0200 Subject: [PATCH 338/470] * CMakeLists.txt: Add `DISABLE_FORCE_DEBUG_PREFIX' option. --- CMakeLists.txt | 4 +++- ChangeLog | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8115f1a4b..16715490d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -331,7 +331,9 @@ if (BUILD_FRAMEWORK) ) endif () -set(CMAKE_DEBUG_POSTFIX d) +if (NOT DISABLE_FORCE_DEBUG_POSTFIX) + set(CMAKE_DEBUG_POSTFIX d) +endif() add_library(freetype ${PUBLIC_HEADERS} diff --git a/ChangeLog b/ChangeLog index 1ce5029a1..aa36c9ccb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2017-11-10 Yuri Levchenko + + * CMakeLists.txt: Add `DISABLE_FORCE_DEBUG_PREFIX' option. + 2017-11-06 Alexei Podtelezhnikov * src/base/ftobjs.c (FT_Load_Glyph): Relocate condition. From a364e38ae7c98992a67b8d5be744445a826926ef Mon Sep 17 00:00:00 2001 From: Nikolaus Waxweiler Date: Tue, 14 Nov 2017 07:54:53 +0100 Subject: [PATCH 339/470] Use Adobe hinting engine for `light' hinting of both CFF and Type 1. Since Ewald Hew factored the Adobe hinting engine out of the CFF driver code, we can now use it on Type 1 (and CID) font formats, as both have the same hinting philosophy. This change activates the Adobe hinter when in LIGHT mode, and therefore always unless explicitly asking for the auto-hinter. This makes LIGHT behavior consistent with CFF fonts. As of this commit, the hinting engine table looks as follows. LIGHT NORMAL ------------------------- TrueType Auto v40 CFF Adobe Adobe Type 1 Adobe Adobe --- ChangeLog | 19 +++++++++++++++++++ src/base/ftobjs.c | 29 +++++++++++++++++++++++------ 2 files changed, 42 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index aa36c9ccb..358662c14 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,22 @@ +2017-11-14 Nikolaus Waxweiler + + Use Adobe hinting engine for `light' hinting of both CFF and Type 1. + + Since Ewald Hew factored the Adobe hinting engine out of the CFF + driver code, we can now use it on Type 1 (and CID) font formats, as + both have the same hinting philosophy. + + This change activates the Adobe hinter when in LIGHT mode, and + therefore always unless explicitly asking for the auto-hinter. This + makes LIGHT behavior consistent with CFF fonts. As of this commit, + the hinting engine table looks as follows. + + LIGHT NORMAL + ------------------------- + TrueType Auto v40 + CFF Adobe Adobe + Type 1 Adobe Adobe + 2017-11-10 Yuri Levchenko * CMakeLists.txt: Add `DISABLE_FORCE_DEBUG_PREFIX' option. diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c index c85d06003..ccf526f23 100644 --- a/src/base/ftobjs.c +++ b/src/base/ftobjs.c @@ -19,12 +19,16 @@ #include #include FT_LIST_H #include FT_OUTLINE_H +#include FT_FONT_FORMATS_H + #include FT_INTERNAL_VALIDATE_H #include FT_INTERNAL_OBJECTS_H #include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_RFORK_H #include FT_INTERNAL_STREAM_H -#include FT_INTERNAL_SFNT_H /* for SFNT_Load_Table_Func */ +#include FT_INTERNAL_SFNT_H /* for SFNT_Load_Table_Func */ +#include FT_INTERNAL_POSTSCRIPT_AUX_H /* for PS_Driver */ + #include FT_TRUETYPE_TABLES_H #include FT_TRUETYPE_TAGS_H #include FT_TRUETYPE_IDS_H @@ -39,6 +43,7 @@ #include FT_AUTOHINTER_H #include FT_CFF_DRIVER_H +#include FT_TYPE1_DRIVER_H #ifdef FT_CONFIG_OPTION_MAC_FONTS #include "ftbase.h" @@ -801,9 +806,13 @@ * Determine whether we need to auto-hint or not. * The general rules are: * - * - Do only auto-hinting if we have a hinter module, a scalable font - * format dealing with outlines, and no transforms except simple - * slants and/or rotations by integer multiples of 90 degrees. + * - Do only auto-hinting if we have + * + * - a hinter module, + * - a scalable font format dealing with outlines, + * - not a tricky font, and + * - no transforms except simple slants and/or rotations by + * integer multiples of 90 degrees. * * - Then, auto-hint if FT_LOAD_FORCE_AUTOHINT is set or if we don't * have a native font hinter. @@ -833,7 +842,14 @@ else { FT_Render_Mode mode = FT_LOAD_TARGET_MODE( load_flags ); + FT_Bool is_light_type1; + + /* only the new Adobe engine (for both CFF and Type 1) is `light'; */ + /* we use `strstr' to catch both `Type 1' and `CID Type 1' */ + is_light_type1 = + ft_strstr( FT_Get_Font_Format( face ), "Type 1" ) != NULL && + ((PS_Driver)driver)->hinting_engine == FT_T1_HINTING_ADOBE; /* the check for `num_locations' assures that we actually */ /* test for instructions in a TTF and not in a CFF-based OTF */ @@ -842,8 +858,9 @@ /* check the size of the `fpgm' and `prep' tables, too -- */ /* the assumption is that there don't exist real TTFs where */ /* both `fpgm' and `prep' tables are missing */ - if ( ( mode == FT_RENDER_MODE_LIGHT && - !FT_DRIVER_HINTS_LIGHTLY( driver ) ) || + if ( ( mode == FT_RENDER_MODE_LIGHT && + ( !FT_DRIVER_HINTS_LIGHTLY( driver ) && + !is_light_type1 ) ) || ( FT_IS_SFNT( face ) && ttface->num_locations && ttface->max_profile.maxSizeOfInstructions == 0 && From 954710ddd756733b851c0d2e472b93cbb9a6a44a Mon Sep 17 00:00:00 2001 From: Vlad Tsyrklevich Date: Wed, 15 Nov 2017 23:06:29 +0100 Subject: [PATCH 340/470] * include/freetype/ftrender.h: Fix `FT_Renderer_RenderFunc' type. --- ChangeLog | 4 ++++ include/freetype/ftrender.h | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 358662c14..cb8bd8a34 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2017-11-15 Vlad Tsyrklevich + + * include/freetype/ftrender.h: Fix `FT_Renderer_RenderFunc' type. + 2017-11-14 Nikolaus Waxweiler Use Adobe hinting engine for `light' hinting of both CFF and Type 1. diff --git a/include/freetype/ftrender.h b/include/freetype/ftrender.h index 960837580..ff05a9fc7 100644 --- a/include/freetype/ftrender.h +++ b/include/freetype/ftrender.h @@ -88,7 +88,7 @@ FT_BEGIN_HEADER typedef FT_Error (*FT_Renderer_RenderFunc)( FT_Renderer renderer, FT_GlyphSlot slot, - FT_UInt mode, + FT_Render_Mode mode, const FT_Vector* origin ); typedef FT_Error From b9bd2d14e2836122028b4f41eee937fc31e6b93c Mon Sep 17 00:00:00 2001 From: Ewald Hew Date: Wed, 22 Nov 2017 12:32:47 +0800 Subject: [PATCH 341/470] [psaux] Fix CFF advance widths. (#52466) Glyph advance widths were being written to the new `PS_Decoder' but not saved to the underlying format specific decoder. This caused pure CFF fonts to have bad advance width. * include/freetype/internal/psaux.h (PS_Decoder): Change `glyph_width' field to pointer. Remove unused fields. * src/psaux/psobjs.c (ps_decoder_init): Change `glyph_width' from copy to reference. Remove unused. * src/psaux/psft.c (cf2_setGlyphWidth): Update code. --- ChangeLog | 16 ++++++++++++++++ include/freetype/internal/psaux.h | 5 +---- src/psaux/psft.c | 2 +- src/psaux/psobjs.c | 3 +-- 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index cb8bd8a34..d5fc9c251 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2017-11-22 Ewald Hew + + [psaux] Fix CFF advance widths. (#52466) + + Glyph advance widths were being written to the new `PS_Decoder' but not + saved to the underlying format specific decoder. This caused pure CFF + fonts to have bad advance width. + + * include/freetype/internal/psaux.h (PS_Decoder): Change `glyph_width' + field to pointer. + Remove unused fields. + * src/psaux/psobjs.c (ps_decoder_init): Change `glyph_width' from copy + to reference. + Remove unused. + * src/psaux/psft.c (cf2_setGlyphWidth): Update code. + 2017-11-15 Vlad Tsyrklevich * include/freetype/ftrender.h: Fix `FT_Renderer_RenderFunc' type. diff --git a/include/freetype/internal/psaux.h b/include/freetype/internal/psaux.h index 26652f888..80c4465f4 100644 --- a/include/freetype/internal/psaux.h +++ b/include/freetype/internal/psaux.h @@ -614,10 +614,7 @@ FT_BEGIN_HEADER CFF_SubFont current_subfont; /* for current glyph_index */ FT_Generic* cf2_instance; - FT_Pos glyph_width; - FT_Pos nominal_width; - - FT_Bool read_width; + FT_Pos* glyph_width; FT_Bool width_only; FT_Int num_hints; diff --git a/src/psaux/psft.c b/src/psaux/psft.c index 6c67276d9..0f9bdd9c6 100644 --- a/src/psaux/psft.c +++ b/src/psaux/psft.c @@ -95,7 +95,7 @@ FT_ASSERT( decoder ); - decoder->glyph_width = cf2_fixedToInt( width ); + *decoder->glyph_width = cf2_fixedToInt( width ); } diff --git a/src/psaux/psobjs.c b/src/psaux/psobjs.c index a88bcb78c..ee5819903 100644 --- a/src/psaux/psobjs.c +++ b/src/psaux/psobjs.c @@ -2407,8 +2407,7 @@ ps_decoder->locals = cff_decoder->locals; ps_decoder->locals_bias = cff_decoder->locals_bias; - ps_decoder->glyph_width = cff_decoder->glyph_width; - ps_decoder->nominal_width = cff_decoder->nominal_width; + ps_decoder->glyph_width = &cff_decoder->glyph_width; ps_decoder->width_only = cff_decoder->width_only; ps_decoder->hint_mode = cff_decoder->hint_mode; From bec14f688925467be708f01378fbbf82e6b19b42 Mon Sep 17 00:00:00 2001 From: Ewald Hew Date: Wed, 22 Nov 2017 18:57:56 +0800 Subject: [PATCH 342/470] * src/psaux/psft.c (cf2_setGlyphWidth): Check format before setting. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=4377 --- ChangeLog | 8 ++++++++ src/psaux/psft.c | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index d5fc9c251..82d6f2c2d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2017-11-22 Ewald Hew + + * src/psaux/psft.c (cf2_setGlyphWidth): Check format before setting. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=4377 + 2017-11-22 Ewald Hew [psaux] Fix CFF advance widths. (#52466) diff --git a/src/psaux/psft.c b/src/psaux/psft.c index 0f9bdd9c6..bd5f831f4 100644 --- a/src/psaux/psft.c +++ b/src/psaux/psft.c @@ -95,7 +95,8 @@ FT_ASSERT( decoder ); - *decoder->glyph_width = cf2_fixedToInt( width ); + if ( !decoder->builder.is_t1 ) + *decoder->glyph_width = cf2_fixedToInt( width ); } From 2f1863cfb72f72fc9a454c8cb91cc711f56d01bd Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Thu, 23 Nov 2017 20:40:52 +0100 Subject: [PATCH 343/470] Silence unused function warnings. Some static function declarations cause unused function warnings if certain config options are turned off via `ftoption.h'. * src/base/ftbase.h, src/base/ftrfork.c, src/sfnt/ttbdf.h, src/truetype/ttgxvar.h: Add #ifdef guards around these sections. --- ChangeLog | 10 ++++++++++ src/base/ftbase.h | 6 +++++- src/base/ftrfork.c | 2 +- src/sfnt/ttbdf.h | 4 ++++ src/truetype/ttgxvar.h | 4 ++++ 5 files changed, 24 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 82d6f2c2d..40b09b9c5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2017-11-23 Tor Andersson + + Silence unused function warnings. + + Some static function declarations cause unused function warnings if + certain config options are turned off via `ftoption.h'. + + * src/base/ftbase.h, src/base/ftrfork.c, src/sfnt/ttbdf.h, + src/truetype/ttgxvar.h: Add #ifdef guards around these sections. + 2017-11-22 Ewald Hew * src/psaux/psft.c (cf2_setGlyphWidth): Check format before setting. diff --git a/src/base/ftbase.h b/src/base/ftbase.h index 2072284f0..a4493cc06 100644 --- a/src/base/ftbase.h +++ b/src/base/ftbase.h @@ -2,7 +2,7 @@ /* */ /* ftbase.h */ /* */ -/* The FreeType private functions used in base module (specification). */ +/* Private functions used in the `base' module (specification). */ /* */ /* Copyright 2008-2017 by */ /* David Turner, Robert Wilhelm, Werner Lemberg, and suzuki toshiya. */ @@ -27,6 +27,8 @@ FT_BEGIN_HEADER +#ifdef FT_CONFIG_OPTION_MAC_FONTS + /* MacOS resource fork cannot exceed 16MB at least for Carbon code; */ /* see https://support.microsoft.com/en-us/kb/130437 */ #define FT_MAC_RFORK_MAX_LEN 0x00FFFFFFUL @@ -65,6 +67,8 @@ FT_BEGIN_HEADER ft_raccess_rule_by_darwin_vfs( FT_Library library, FT_UInt rule_index ); #endif +#endif /* FT_CONFIG_OPTION_MAC_FONTS */ + FT_END_HEADER diff --git a/src/base/ftrfork.c b/src/base/ftrfork.c index f5ad2874d..b86cf8c82 100644 --- a/src/base/ftrfork.c +++ b/src/base/ftrfork.c @@ -478,7 +478,7 @@ } -#ifndef FT_MACINTOSH +#if defined( FT_CONFIG_OPTION_MAC_FONTS ) && !defined( FT_MACINTOSH ) static FT_RFork_Rule raccess_get_rule_type_from_rule_index( FT_Library library, FT_UInt rule_index ) diff --git a/src/sfnt/ttbdf.h b/src/sfnt/ttbdf.h index 398b62060..31d4ab16f 100644 --- a/src/sfnt/ttbdf.h +++ b/src/sfnt/ttbdf.h @@ -28,6 +28,8 @@ FT_BEGIN_HEADER +#ifdef TT_CONFIG_OPTION_BDF + FT_LOCAL( void ) tt_face_free_bdf_props( TT_Face face ); @@ -37,6 +39,8 @@ FT_BEGIN_HEADER const char* property_name, BDF_PropertyRec *aprop ); +#endif /* TT_CONFIG_OPTION_BDF */ + FT_END_HEADER diff --git a/src/truetype/ttgxvar.h b/src/truetype/ttgxvar.h index a9a116500..bce66ee5c 100644 --- a/src/truetype/ttgxvar.h +++ b/src/truetype/ttgxvar.h @@ -27,6 +27,8 @@ FT_BEGIN_HEADER +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT + /*************************************************************************/ /* */ /* */ @@ -439,6 +441,8 @@ FT_BEGIN_HEADER FT_LOCAL( void ) tt_done_blend( TT_Face face ); +#endif /* TT_CONFIG_OPTION_GX_VAR_SUPPORT */ + FT_END_HEADER From 0d0e5bb1e60ef013f40c8964731df6b698aa4fdf Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Thu, 23 Nov 2017 20:42:57 +0100 Subject: [PATCH 344/470] Minor. --- ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 40b09b9c5..99c64a20f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,6 @@ 2017-11-23 Tor Andersson - Silence unused function warnings. + Silence unused function warnings (#52465). Some static function declarations cause unused function warnings if certain config options are turned off via `ftoption.h'. From 8f4851997b76b5f80095e355cf2444d925cab328 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Fri, 24 Nov 2017 10:34:09 +0100 Subject: [PATCH 345/470] [unix] Install a massaged `ftoption.h' file (#51780). * builds/unix/configure.raw (ftoption_set, ftoption_unset): New auxiliary functions to construct... (FTOPTION_H_SED): ... this new variable. Apply it as a sed argument while copying `ftoption.h' to the `builds/unix' directory (using `AC_CONFIG_FILES'). Simplify code of test that checks cpp's computation of bit length (the test previously created an empty `ftoption.h' file and deleted it immediately afterwards); without this change, it can happen on my GNU/Linux box that `configure's execution of `config.status' doesn't create `ftoption.h' (no idea why this happens). * builds/unix/install.mk (install): Install `builds/unix/ftoption.h'. * builds/unix/unix-def.in (DISTCLEAN): Updated. * builds/unix/.gitignore: Updated. --- ChangeLog | 22 ++++++++++++ builds/unix/.gitignore | 1 + builds/unix/configure.raw | 58 +++++++++++++++++++++++------- builds/unix/install.mk | 5 +++ builds/unix/unix-def.in | 1 + include/freetype/config/ftoption.h | 16 +++++++++ 6 files changed, 91 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 99c64a20f..6a4c00b35 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,25 @@ +2017-11-24 Werner Lemberg + + [unix] Install a massaged `ftoption.h' file (#51780). + + * builds/unix/configure.raw (ftoption_set, ftoption_unset): New + auxiliary functions to construct... + (FTOPTION_H_SED): ... this new variable. + Apply it as a sed argument while copying `ftoption.h' to the + `builds/unix' directory (using `AC_CONFIG_FILES'). + Simplify code of test that checks cpp's computation of bit length + (the test previously created an empty `ftoption.h' file and deleted + it immediately afterwards); without this change, it can happen on my + GNU/Linux box that `configure's execution of `config.status' doesn't + create `ftoption.h' (no idea why this happens). + + * builds/unix/install.mk (install): Install + `builds/unix/ftoption.h'. + + * builds/unix/unix-def.in (DISTCLEAN): Updated. + + * builds/unix/.gitignore: Updated. + 2017-11-23 Tor Andersson Silence unused function warnings (#52465). diff --git a/builds/unix/.gitignore b/builds/unix/.gitignore index e4e0a12c6..f89b226b8 100644 --- a/builds/unix/.gitignore +++ b/builds/unix/.gitignore @@ -10,6 +10,7 @@ configure.ac freetype2.pc freetype-config ftconfig.h +ftoption.h install-sh libtool ltmain.sh diff --git a/builds/unix/configure.raw b/builds/unix/configure.raw index d91a73266..466c0ca00 100644 --- a/builds/unix/configure.raw +++ b/builds/unix/configure.raw @@ -112,15 +112,13 @@ AC_TYPE_LONG_LONG_INT AC_MSG_CHECKING([whether cpp computation of bit length in ftconfig.in works]) orig_CPPFLAGS="${CPPFLAGS}" -CPPFLAGS="-I${srcdir} -I. ${CPPFLAGS}" +CPPFLAGS="-I${srcdir} -I. -I${srcdir}/../../include/freetype/config ${CPPFLAGS}" ac_clean_files= -for f in ft2build.h ftoption.h ftstdlib.h; do - if test ! -f $f; then - ac_clean_files="$ac_clean_files $f" - touch $f - fi -done +if test ! -f ft2build.h; then + ac_clean_files=ft2build.h + touch ft2build.h +fi cat > conftest.c <<\_ACEOF #include @@ -977,27 +975,63 @@ AC_SUBST([build_libtool_libs]) # changing LDFLAGS value should only be done after # lt_cv_prog_compiler_static_works test +ftoption_set() +{ + regexp="-e \\\"s|.*#.*def.*$1.*|#define $1|\\\"" + FTOPTION_H_SED="$FTOPTION_H_SED $regexp" +} + +ftoption_unset() +{ + regexp="-e \\\"s|.*#.*def.*$1.*|/* #undef $1 */|\\\"" + FTOPTION_H_SED="$FTOPTION_H_SED $regexp" +} + if test "$have_zlib" != no; then - CFLAGS="$CFLAGS $ZLIB_CFLAGS -DFT_CONFIG_OPTION_SYSTEM_ZLIB" + CFLAGS="$CFLAGS $ZLIB_CFLAGS" LDFLAGS="$LDFLAGS $ZLIB_LIBS" + ftoption_set FT_CONFIG_OPTION_SYSTEM_ZLIB +else + ftoption_unset FT_CONFIG_OPTION_SYSTEM_ZLIB fi - if test "$have_bzip2" != no; then - CFLAGS="$CFLAGS $BZIP2_CFLAGS -DFT_CONFIG_OPTION_USE_BZIP2" + CFLAGS="$CFLAGS $BZIP2_CFLAGS" LDFLAGS="$LDFLAGS $BZIP2_LIBS" + ftoption_set FT_CONFIG_OPTION_USE_BZIP2 +else + ftoption_unset FT_CONFIG_OPTION_USE_BZIP2 fi if test "$have_libpng" != no; then - CFLAGS="$CFLAGS $LIBPNG_CFLAGS -DFT_CONFIG_OPTION_USE_PNG" + CFLAGS="$CFLAGS $LIBPNG_CFLAGS" LDFLAGS="$LDFLAGS $LIBPNG_LIBS" + ftoption_set FT_CONFIG_OPTION_USE_PNG +else + ftoption_unset FT_CONFIG_OPTION_USE_PNG fi if test "$have_harfbuzz" != no; then - CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS -DFT_CONFIG_OPTION_USE_HARFBUZZ" + CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS" LDFLAGS="$LDFLAGS $HARFBUZZ_LIBS" + ftoption_set FT_CONFIG_OPTION_USE_HARFBUZZ +else + ftoption_unset FT_CONFIG_OPTION_USE_HARFBUZZ fi AC_SUBST([CFLAGS]) AC_SUBST([LDFLAGS]) +# We don't want to use a template file for `ftoption.h', since compilation +# should work without calling a configure script also. For this reason, we +# copy the `include/freetype/config/ftoption.h' file to the `unix/builds' +# directory (using a dummy `AC_CONFIG_FILES' call) and apply the just +# constructed $FTOPTION_H_SED regexp (using the post-action of +# `AC_CONFIG_FILES'); this is also the version that gets installed later on. +# +AC_CONFIG_FILES([ftoption.h:${srcdir}/../../include/freetype/config/ftoption.h], + [mv ftoption.h ftoption.tmp + eval "sed $FTOPTION_H_SED < ftoption.tmp > ftoption.h" + rm ftoption.tmp], + [FTOPTION_H_SED="$FTOPTION_H_SED"]) + # configuration file -- stay in 8.3 limit # # since #undef doesn't survive in configuration header files we replace diff --git a/builds/unix/install.mk b/builds/unix/install.mk index fae486cb3..35d50aac5 100644 --- a/builds/unix/install.mk +++ b/builds/unix/install.mk @@ -30,6 +30,9 @@ # # We also remove `$(includedir)/ft2build.h' for the same reason. # +# Note that some header files get handled twice for simplicity; a special, +# configured version overwrites the generic one. +# install: $(PROJECT_LIBRARY) -$(DELDIR) $(DESTDIR)$(includedir)/freetype2 -$(DELETE) $(DESTDIR)$(includedir)/ft2build.h @@ -55,6 +58,8 @@ install: $(PROJECT_LIBRARY) $(DESTDIR)$(includedir)/freetype2/freetype/config/ftconfig.h $(INSTALL_DATA) $(OBJ_DIR)/ftmodule.h \ $(DESTDIR)$(includedir)/freetype2/freetype/config/ftmodule.h + $(INSTALL_DATA) $(OBJ_BUILD)/ftoption.h \ + $(DESTDIR)$(includedir)/freetype2/freetype/config/ftoption.h $(INSTALL_SCRIPT) -m 755 $(OBJ_BUILD)/freetype-config \ $(DESTDIR)$(bindir)/freetype-config $(INSTALL_SCRIPT) -m 644 $(BUILD_DIR)/freetype2.m4 \ diff --git a/builds/unix/unix-def.in b/builds/unix/unix-def.in index 34e06e380..5de36efab 100644 --- a/builds/unix/unix-def.in +++ b/builds/unix/unix-def.in @@ -43,6 +43,7 @@ DISTCLEAN += $(OBJ_BUILD)/config.cache \ $(OBJ_BUILD)/unix-def.mk \ $(OBJ_BUILD)/unix-cc.mk \ $(OBJ_BUILD)/ftconfig.h \ + $(OBJ_BUILD)/ftoption.h \ $(LIBTOOL) \ $(OBJ_BUILD)/Makefile diff --git a/include/freetype/config/ftoption.h b/include/freetype/config/ftoption.h index 3d5e5a453..fbee57352 100644 --- a/include/freetype/config/ftoption.h +++ b/include/freetype/config/ftoption.h @@ -211,6 +211,10 @@ FT_BEGIN_HEADER /* Do not #undef this macro here since the build system might define */ /* it for certain configurations only. */ /* */ + /* If you use a build system like cmake or the `configure' script, */ + /* options set by those programs have precendence, overwriting the */ + /* value here with the configured one. */ + /* */ /* #define FT_CONFIG_OPTION_SYSTEM_ZLIB */ @@ -227,6 +231,10 @@ FT_BEGIN_HEADER /* */ /* Define this macro if you want to enable this `feature'. */ /* */ + /* If you use a build system like cmake or the `configure' script, */ + /* options set by those programs have precendence, overwriting the */ + /* value here with the configured one. */ + /* */ /* #define FT_CONFIG_OPTION_USE_BZIP2 */ @@ -252,6 +260,10 @@ FT_BEGIN_HEADER /* */ /* Define this macro if you want to enable this `feature'. */ /* */ + /* If you use a build system like cmake or the `configure' script, */ + /* options set by those programs have precendence, overwriting the */ + /* value here with the configured one. */ + /* */ /* #define FT_CONFIG_OPTION_USE_PNG */ @@ -265,6 +277,10 @@ FT_BEGIN_HEADER /* */ /* Define this macro if you want to enable this `feature'. */ /* */ + /* If you use a build system like cmake or the `configure' script, */ + /* options set by those programs have precendence, overwriting the */ + /* value here with the configured one. */ + /* */ /* #define FT_CONFIG_OPTION_USE_HARFBUZZ */ From 7d81ba7e17ffe2eecf682025b02d652be3be496f Mon Sep 17 00:00:00 2001 From: "Jan Alexander Steffens (heftig)" Date: Mon, 27 Nov 2017 07:15:04 +0100 Subject: [PATCH 346/470] Fix last commit (#52522). * builds/freetype.mk: Set `FT_OPTION_H' and `FTOPTION_FLAG' properly if we have `ftoption.h' in `BUILD_DIR'. --- ChangeLog | 7 +++++++ builds/freetype.mk | 3 +++ 2 files changed, 10 insertions(+) diff --git a/ChangeLog b/ChangeLog index 6a4c00b35..ef5d5b04b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2017-11-27 Jan Alexander Steffens (heftig) + + Fix last commit (#52522). + + * builds/freetype.mk: Set `FT_OPTION_H' and `FTOPTION_FLAG' + properly if we have `ftoption.h' in `BUILD_DIR'. + 2017-11-24 Werner Lemberg [unix] Install a massaged `ftoption.h' file (#51780). diff --git a/builds/freetype.mk b/builds/freetype.mk index f8cfd411c..d9dbf7996 100644 --- a/builds/freetype.mk +++ b/builds/freetype.mk @@ -153,6 +153,9 @@ endif ifneq ($(wildcard $(OBJ_DIR)/ftoption.h),) FTOPTION_H := $(OBJ_DIR)/ftoption.h FTOPTION_FLAG := $DFT_CONFIG_OPTIONS_H="" +else ifneq ($(wildcard $(BUILD_DIR)/ftoption.h),) + FTOPTION_H := $(BUILD_DIR)/ftoption.h + FTOPTION_FLAG := $DFT_CONFIG_OPTIONS_H="" endif # `CPPFLAGS' might be specified by the user in the environment. From 40db4a9954304d14e5e1c85a09b28dde83bddae6 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Mon, 27 Nov 2017 22:17:41 +0100 Subject: [PATCH 347/470] Allow (again) encoding vectors with more than 256 elements (#52464). In version 2.6.1, this has been disallowed to better reject malformed fonts; however, this restriction was too strong. This time, we only take the first 256 elements into account, since encoding arrays are always accessed with a 8bit integer, according to the PostScript Language Reference. * src/type1/t1load.c (parse_encoding): Implement it. --- ChangeLog | 12 ++++++++++++ src/type1/t1load.c | 34 ++++++++++++++++++---------------- 2 files changed, 30 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index ef5d5b04b..6bc3a5869 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2017-11-27 Werner Lemberg + + Allow (again) encoding vectors with more than 256 elements (#52464). + + In version 2.6.1, this has been disallowed to better reject + malformed fonts; however, this restriction was too strong. This + time, we only take the first 256 elements into account, since + encoding arrays are always accessed with a 8bit integer, according + to the PostScript Language Reference. + + * src/type1/t1load.c (parse_encoding): Implement it. + 2017-11-27 Jan Alexander Steffens (heftig) Fix last commit (#52522). diff --git a/src/type1/t1load.c b/src/type1/t1load.c index 9259df64a..bdb986a01 100644 --- a/src/type1/t1load.c +++ b/src/type1/t1load.c @@ -1309,7 +1309,7 @@ if ( ft_isdigit( *cur ) || *cur == '[' ) { T1_Encoding encode = &face->type1.encoding; - FT_Int count, n; + FT_Int count, array_size, n; PS_Table char_table = &loader->encoding_table; FT_Memory memory = parser->root.memory; FT_Error error; @@ -1326,13 +1326,12 @@ else count = (FT_Int)T1_ToInt( parser ); - /* only composite fonts (which we don't support) */ - /* can have larger values */ + array_size = count; if ( count > 256 ) { - FT_ERROR(( "parse_encoding: invalid encoding array size\n" )); - parser->root.error = FT_THROW( Invalid_File_Format ); - return; + FT_TRACE2(( "parse_encoding:" + " only using first 256 encoding array entries\n" )); + array_size = 256; } T1_Skip_Spaces( parser ); @@ -1348,18 +1347,18 @@ } /* we use a T1_Table to store our charnames */ - loader->num_chars = encode->num_chars = count; - if ( FT_NEW_ARRAY( encode->char_index, count ) || - FT_NEW_ARRAY( encode->char_name, count ) || + loader->num_chars = encode->num_chars = array_size; + if ( FT_NEW_ARRAY( encode->char_index, array_size ) || + FT_NEW_ARRAY( encode->char_name, array_size ) || FT_SET_ERROR( psaux->ps_table_funcs->init( - char_table, count, memory ) ) ) + char_table, array_size, memory ) ) ) { parser->root.error = error; return; } /* We need to `zero' out encoding_table.elements */ - for ( n = 0; n < count; n++ ) + for ( n = 0; n < array_size; n++ ) { char* notdef = (char *)".notdef"; @@ -1452,11 +1451,14 @@ len = (FT_UInt)( parser->root.cursor - cur ); - parser->root.error = T1_Add_Table( char_table, charcode, - cur, len + 1 ); - if ( parser->root.error ) - return; - char_table->elements[charcode][len] = '\0'; + if ( n < array_size ) + { + parser->root.error = T1_Add_Table( char_table, charcode, + cur, len + 1 ); + if ( parser->root.error ) + return; + char_table->elements[charcode][len] = '\0'; + } n++; } From c18c391b688a59a1c1e8366e216e473c1bd6361c Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Tue, 28 Nov 2017 12:43:45 +0100 Subject: [PATCH 348/470] [truetype] Improving tracing of composite glyphs. * src/truetype/ttgload.c (TT_Load_Composite_Glyph) [FT_DEBUG_LEVEL_TRACE]: Show composite glyph information. --- ChangeLog | 9 +++++++- src/truetype/ttgload.c | 47 +++++++++++++++++++++++++++++++++++++++++- 2 files changed, 54 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6bc3a5869..a1ebeb353 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,13 @@ +2017-11-28 Werner Lemberg + + [truetype] Improving tracing of composite glyphs. + + * src/truetype/ttgload.c (TT_Load_Composite_Glyph) + [FT_DEBUG_LEVEL_TRACE]: Show composite glyph information. + 2017-11-27 Werner Lemberg - Allow (again) encoding vectors with more than 256 elements (#52464). + [type1] Allow (again) `/Encoding' with >256 elements (#52464). In version 2.6.1, this has been disallowed to better reject malformed fonts; however, this restriction was too strong. This diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c index 94ba25673..dfdeb9eb6 100644 --- a/src/truetype/ttgload.c +++ b/src/truetype/ttgload.c @@ -664,7 +664,52 @@ } while ( subglyph->flags & MORE_COMPONENTS ); gloader->current.num_subglyphs = num_subglyphs; - FT_TRACE5(( " %d components\n", num_subglyphs )); + FT_TRACE5(( " %d component%s\n", + num_subglyphs, + num_subglyphs > 1 ? "s" : "" )); + +#ifdef FT_DEBUG_LEVEL_TRACE + { + FT_UInt i; + + + subglyph = gloader->current.subglyphs; + + for ( i = 0; i < num_subglyphs; i++ ) + { + if ( num_subglyphs > 1 ) + FT_TRACE7(( " subglyph %d:\n", i )); + + FT_TRACE7(( " glyph index: %d\n", subglyph->index )); + + if ( subglyph->flags & ARGS_ARE_XY_VALUES ) + FT_TRACE7(( " offset: x=%d, y=%d\n", + subglyph->arg1, + subglyph->arg2 )); + else + FT_TRACE7(( " matching points: base=%d, component=%d\n", + subglyph->arg1, + subglyph->arg2 )); + + if ( subglyph->flags & WE_HAVE_A_SCALE ) + FT_TRACE7(( " scaling: %f\n", + subglyph->transform.xx / 65536.0 )); + else if ( subglyph->flags & WE_HAVE_AN_XY_SCALE ) + FT_TRACE7(( " scaling: x=%f, y=%f\n", + subglyph->transform.xx / 65536.0, + subglyph->transform.yy / 65536.0 )); + else if ( subglyph->flags & WE_HAVE_A_2X2 ) + FT_TRACE7(( " scaling: xx=%f, yx=%f\n" + " xy=%f, yy=%f\n", + subglyph->transform.xx / 65536.0, + subglyph->transform.yx / 65536.0, + subglyph->transform.xy / 65536.0, + subglyph->transform.yy / 65536.0 )); + + subglyph++; + } + } +#endif /* FT_DEBUG_LEVEL_TRACE */ #ifdef TT_USE_BYTECODE_INTERPRETER From 337e49cfe2cbcdd82a34e07d23097170bf699d6e Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Mon, 4 Dec 2017 12:36:07 +0100 Subject: [PATCH 349/470] [truetype] Allow shared points in `cvar' table (#52532). * src/truetype/ttgxvar.c (tt_face_vary_cvt): Implement it by copying and adjusting the corresponding code from `TT_Vary_Apply_Glyph_Deltas'. --- ChangeLog | 8 +++++ src/truetype/ttgxvar.c | 81 ++++++++++++++++++++++++++---------------- 2 files changed, 58 insertions(+), 31 deletions(-) diff --git a/ChangeLog b/ChangeLog index a1ebeb353..c7aa3f61d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2017-12-04 Werner Lemberg + + [truetype] Allow shared points in `cvar' table (#52532). + + * src/truetype/ttgxvar.c (tt_face_vary_cvt): Implement it by copying + and adjusting the corresponding code from + `TT_Vary_Apply_Glyph_Deltas'. + 2017-11-28 Werner Lemberg [truetype] Improving tracing of composite glyphs. diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c index f3c2430da..4ff16570f 100644 --- a/src/truetype/ttgxvar.c +++ b/src/truetype/ttgxvar.c @@ -2941,8 +2941,10 @@ FT_Fixed* im_start_coords = NULL; FT_Fixed* im_end_coords = NULL; GX_Blend blend = face->blend; - FT_UInt point_count; - FT_UShort* localpoints; + FT_UInt point_count, spoint_count = 0; + FT_UShort* sharedpoints = NULL; + FT_UShort* localpoints = NULL; + FT_UShort* points; FT_Short* deltas; @@ -3011,9 +3013,19 @@ offsetToData += table_start; - /* The documentation implies there are flags packed into */ - /* `tupleCount', but John Jenkins says that shared points don't apply */ - /* to `cvar', and no other flags are defined. */ + if ( tupleCount & GX_TC_TUPLES_SHARE_POINT_NUMBERS ) + { + here = FT_Stream_FTell( stream ); + + FT_Stream_SeekSet( stream, offsetToData ); + + sharedpoints = ft_var_readpackedpoints( stream, + table_len, + &spoint_count ); + offsetToData = FT_Stream_FTell( stream ); + + FT_Stream_SeekSet( stream, here ); + } FT_TRACE5(( "cvar: there are %d tuples:\n", tupleCount & 0xFFF )); @@ -3029,26 +3041,25 @@ tupleDataSize = FT_GET_USHORT(); tupleIndex = FT_GET_USHORT(); - /* There is no provision here for a global tuple coordinate section, */ - /* so John says. There are no tuple indices, just embedded tuples. */ - if ( tupleIndex & GX_TI_EMBEDDED_TUPLE_COORD ) { for ( j = 0; j < blend->num_axis; j++ ) tuple_coords[j] = FT_GET_SHORT() * 4; /* convert from */ /* short frac to fixed */ } - else + else if ( ( tupleIndex & GX_TI_TUPLE_INDEX_MASK ) >= blend->tuplecount ) { - /* skip this tuple; it makes no sense */ - - if ( tupleIndex & GX_TI_INTERMEDIATE_TUPLE ) - for ( j = 0; j < 2 * blend->num_axis; j++ ) - (void)FT_GET_SHORT(); + FT_TRACE2(( "tt_face_vary_cvt:" + " invalid tuple index\n" )); - offsetToData += tupleDataSize; - continue; + error = FT_THROW( Invalid_Table ); + goto Exit; } + else + FT_MEM_COPY( + tuple_coords, + &blend->tuplecoords[( tupleIndex & 0xFFF ) * blend->num_axis], + blend->num_axis * sizeof ( FT_Fixed ) ); if ( tupleIndex & GX_TI_INTERMEDIATE_TUPLE ) { @@ -3063,11 +3074,8 @@ tuple_coords, im_start_coords, im_end_coords ); - if ( /* tuple isn't active for our blend */ - apply == 0 || - /* global points not allowed, */ - /* if they aren't local, makes no sense */ - !( tupleIndex & GX_TI_PRIVATE_POINT_NUMBERS ) ) + + if ( apply == 0 ) /* tuple isn't active for our blend */ { offsetToData += tupleDataSize; continue; @@ -3077,14 +3085,24 @@ FT_Stream_SeekSet( stream, offsetToData ); - localpoints = ft_var_readpackedpoints( stream, - table_len, - &point_count ); - deltas = ft_var_readpackeddeltas( stream, - table_len, - point_count == 0 ? face->cvt_size - : point_count ); - if ( !localpoints || !deltas ) + if ( tupleIndex & GX_TI_PRIVATE_POINT_NUMBERS ) + { + localpoints = ft_var_readpackedpoints( stream, + table_len, + &point_count ); + points = localpoints; + } + else + { + points = sharedpoints; + point_count = spoint_count; + } + + deltas = ft_var_readpackeddeltas( stream, + table_len, + point_count == 0 ? face->cvt_size + : point_count ); + if ( !points || !deltas ) ; /* failure, ignore it */ else if ( localpoints == ALL_POINTS ) @@ -3136,7 +3154,7 @@ FT_Long orig_cvt; - pindex = localpoints[j]; + pindex = points[j]; if ( (FT_ULong)pindex >= face->cvt_size ) continue; @@ -3175,6 +3193,8 @@ FT_FRAME_EXIT(); Exit: + if ( sharedpoints != ALL_POINTS ) + FT_FREE( sharedpoints ); FT_FREE( tuple_coords ); FT_FREE( im_start_coords ); FT_FREE( im_end_coords ); @@ -3461,7 +3481,6 @@ glyph_start = FT_Stream_FTell( stream ); /* each set of glyph variation data is formatted similarly to `cvar' */ - /* (except we get shared points and global tuples) */ if ( FT_NEW_ARRAY( tuple_coords, blend->num_axis ) || FT_NEW_ARRAY( im_start_coords, blend->num_axis ) || From 87ddad20076d330c4139757054d783be9b3c56ab Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Mon, 4 Dec 2017 20:43:30 +0100 Subject: [PATCH 350/470] Update or fix links to use the https protocol instead of http. --- ChangeLog | 4 +- ChangeLog.22 | 4 +- ChangeLog.23 | 48 +++++++++++------------ ChangeLog.24 | 60 ++++++++++++++--------------- ChangeLog.25 | 14 +++---- ChangeLog.26 | 14 +++---- README | 8 ++-- builds/unix/freetype2.in | 2 +- devel/ftoption.h | 4 +- docs/CHANGES | 28 ++++++-------- docs/FTL.TXT | 2 +- docs/formats.txt | 13 +++---- include/freetype/config/ftoption.h | 4 +- include/freetype/freetype.h | 18 ++++----- include/freetype/ftttdrv.h | 4 +- include/freetype/internal/tttypes.h | 2 +- include/freetype/ttnameid.h | 2 +- src/autofit/afcjk.c | 4 +- src/autofit/afhints.h | 2 +- src/base/ftbitmap.c | 2 +- src/bdf/README | 2 +- src/gxvalid/README | 10 ++--- src/gxvalid/gxvfgen.c | 2 +- src/psaux/pshints.c | 2 +- src/sfnt/sfobjs.c | 6 +-- src/smooth/ftgrays.c | 2 +- src/tools/docmaker/sources.py | 2 +- src/tools/docmaker/tohtml.py | 2 +- src/tools/ftfuzzer/README | 4 +- src/tools/glnames.py | 2 +- src/type1/t1objs.c | 2 +- 31 files changed, 134 insertions(+), 141 deletions(-) diff --git a/ChangeLog b/ChangeLog index c7aa3f61d..fbb6d3b0f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2773,7 +2773,7 @@ Reported by Earnestly in - http://lists.nongnu.org/archive/html/freetype/2017-04/msg00031.html + https://lists.nongnu.org/archive/html/freetype/2017-04/msg00031.html 2017-04-27 Werner Lemberg @@ -3110,7 +3110,7 @@ Problem reported by 張俊芝 <418092625@qq.com> in - http://lists.nongnu.org/archive/html/freetype-devel/2017-03/msg00074.html + https://lists.nongnu.org/archive/html/freetype-devel/2017-03/msg00074.html 2017-03-30 Werner Lemberg diff --git a/ChangeLog.22 b/ChangeLog.22 index e3aec745a..d0876138c 100644 --- a/ChangeLog.22 +++ b/ChangeLog.22 @@ -612,7 +612,7 @@ * src/base/ftobjs.c (ft_recompute_scaled_metrics): Re-enable conservative rounding of metrics to avoid breaking clients like - Pango (see http://bugzilla.gnome.org/show_bug.cgi?id=327852). + Pango (see https://bugzilla.gnome.org/show_bug.cgi?id=327852). 2006-02-25 Werner Lemberg @@ -2318,7 +2318,7 @@ Further information on the SING Glyphlet format can be found at: - http://www.adobe.com/products/indesign/sing_gaiji.html + https://www.adobe.com/content/dam/acom/en/devnet/font/pdfs/5148.SING_Tutorial.pdf * include/freetype/tttags.h (TTAG_SING, TTAG_META): New macros for the OpenType tables `SING' and `META'. These two tables are used in diff --git a/ChangeLog.23 b/ChangeLog.23 index 834f34d38..dab356db9 100644 --- a/ChangeLog.23 +++ b/ChangeLog.23 @@ -43,7 +43,7 @@ * src/base/ftoutln.c (FT_Outline_New_Internal): The length of FT_Outline->points[] should be numPoints, not 2 * numPoints. Found by Paul Messmer, see - http://lists.gnu.org/archive/html/freetype-devel/2010-02/msg00003.html + https://lists.gnu.org/archive/html/freetype-devel/2010-02/msg00003.html 2010-02-10 Ken Sharp @@ -108,7 +108,7 @@ Preferred family names should be used for legacy systems that can hold only a few faces (<= 4) for a family name. Suggested by Andreas Heinrich. - http://lists.gnu.org/archive/html/freetype/2010-01/msg00001.html + https://lists.gnu.org/archive/html/freetype/2010-01/msg00001.html * include/freetype/ftsnames.h (FT_PARAM_TAG_IGNORE_PREFERRED_FAMILY, FT_PARAM_TAG_IGNORE_PREFERRED_SUBFAMILY): Define. @@ -631,7 +631,7 @@ The issue of incompatible cast between unsigned long and void* on LLP64 platform is reported by NightStrike from MinGW-Win64 project. See - http://lists.gnu.org/archive/html/freetype/2009-09/msg00000.html + https://lists.gnu.org/archive/html/freetype/2009-09/msg00000.html * src/bdf/bdf.h: The type of hashnode->data is changed from void* to size_t. @@ -657,7 +657,7 @@ On LLP64 platform, the conversion from pointer to FT_Fixed need to drop higher 32-bit. Explicit casts are required. Reported by NightStrike from MinGW-w64 project. See - http://lists.gnu.org/archive/html/freetype/2009-09/msg00000.html + https://lists.gnu.org/archive/html/freetype/2009-09/msg00000.html * src/cff/cffgload.c: Convert the pointers to FT_Fixed explicitly. @@ -864,7 +864,7 @@ LP64 systems: Higher bits are not used. 16-bit systems: Drop can occur. See - http://lists.gnu.org/archive/html/freetype-devel/2008-12/msg00065.html + https://lists.gnu.org/archive/html/freetype-devel/2008-12/msg00065.html These functions will be refined to take FT_ULong flags in next bump with incompatible API change. @@ -1765,7 +1765,7 @@ ftgzip.c by FT2 are enabled by default. To use zlib zcalloc() & zfree(), define USE_ZLIB_ZCALLOC. See discussion: - http://lists.gnu.org/archive/html/freetype-devel/2009-02/msg00000.html + https://lists.gnu.org/archive/html/freetype-devel/2009-02/msg00000.html 2009-07-31 suzuki toshiya @@ -1904,7 +1904,7 @@ 2009-07-15 suzuki toshiya Borland C++ compiler patch proposed by Mirco Babin. - http://lists.gnu.org/archive/html/freetype/2009-07/msg00016.html. + https://lists.gnu.org/archive/html/freetype/2009-07/msg00016.html. * builds/exports.mk: Delete unused flags, CCexe_{CFLAGS,LDFLAGS}. Fix APINAMES_C and APINAMES_EXE pathnames to reflect the platform @@ -1929,7 +1929,7 @@ * src/tools/chktrcmp.py: A script to check trace_XXXX macros that are used in C source but undefined in fttrace.h, or defined in fttrace.h but unused in C sources. See - http://lists.gnu.org/archive/html/freetype-devel/2009-07/msg00013.html. + https://lists.gnu.org/archive/html/freetype-devel/2009-07/msg00013.html. * docs/DEBUG: Mention on chktrcmp.py. * docs/release: Ditto. @@ -1961,7 +1961,7 @@ * include/freetype/internal/fttrace.h: Add FT_TRACE_DEF( t1afm ) and FT_TRACE_DEF( ttbdf ). See - http://lists.gnu.org/archive/html/freetype-devel/2009-07/msg00013.html + https://lists.gnu.org/archive/html/freetype-devel/2009-07/msg00013.html 2009-07-09 suzuki toshiya @@ -1975,8 +1975,8 @@ Prevent the overflows by a glyph with too many points or contours. The bug is reported by Boris Letocha . See - http://lists.gnu.org/archive/html/freetype-devel/2009-06/msg00031.html - http://lists.gnu.org/archive/html/freetype-devel/2009-07/msg00002.html + https://lists.gnu.org/archive/html/freetype-devel/2009-06/msg00031.html + https://lists.gnu.org/archive/html/freetype-devel/2009-07/msg00002.html * include/freetype/ftimage.h (FT_OUTLINE_CONTOURS_MAX, FT_OUTLINE_POINTS_MAX): New macros to declare the maximum @@ -2001,7 +2001,7 @@ 2009-06-28 suzuki toshiya ftpatent: Fix a bug by wrong usage of service->table_info(). - http://lists.gnu.org/archive/html/freetype-devel/2008-12/msg00039.html + https://lists.gnu.org/archive/html/freetype-devel/2008-12/msg00039.html * include/freetype/internal/services/svsfnt.h: Extend FT_SFNT_TableInfoFunc() to take new argument to obtain the offset @@ -2069,7 +2069,7 @@ * builds/unix/configure.raw: Fix a bug in sed script to extract native suffix for binary executables, patch by Peter Breitenlohner. - http://lists.gnu.org/archive/html/freetype-devel/2009-04/msg00036.html + https://lists.gnu.org/archive/html/freetype-devel/2009-04/msg00036.html 2009-06-26 Werner Lemberg @@ -3469,8 +3469,8 @@ faces includes broken face which FT_Done_Face() cannot free, FT_Done_Library() retries FT_Done_Face() and it can fall into an endless loop. See the discussion: - http://lists.gnu.org/archive/html/freetype-devel/2008-09/msg00047.html - http://lists.gnu.org/archive/html/freetype-devel/2008-10/msg00000.html + https://lists.gnu.org/archive/html/freetype-devel/2008-09/msg00047.html + https://lists.gnu.org/archive/html/freetype-devel/2008-10/msg00000.html 2009-01-07 Werner Lemberg @@ -3492,7 +3492,7 @@ * builds/unix/configure.raw: Don't call AC_CANONICAL_BUILD and AC_CANONICAL_TARGET and use $host_os only. A nice explanation for this change can be found at - http://blog.flameeyes.eu/s/canonical-target. + https://blog.flameeyes.eu/s/canonical-target. From Savannah patch #6712. @@ -4516,7 +4516,7 @@ recommends to add the option only to CFLAGS, LDFLAGS should include it because libfreetype.la is built with -no-undefined. This fixes a bug reported by Ryan Schmidt in MacPorts, - http://trac.macports.org/ticket/15331. + https://trac.macports.org/ticket/15331. 2008-06-21 Werner Lemberg @@ -6187,13 +6187,13 @@ * builds/unix/ftsystem.c (FT_Stream_Open): Temporary fix to prevent 32bit unsigned long overflow by 64bit filesize on LP64 platform, as proposed by Sean McBride: - http://lists.gnu.org/archive/html/freetype-devel/2007-03/msg00032.html + https://lists.gnu.org/archive/html/freetype-devel/2007-03/msg00032.html 2007-03-22 suzuki toshiya * builds/unix/ftconfig.in: Suppress SGI compiler's warning against setjmp, proposed by Sean McBride: - http://lists.gnu.org/archive/html/freetype-devel/2007-03/msg00032.html + https://lists.gnu.org/archive/html/freetype-devel/2007-03/msg00032.html 2007-03-19 suzuki toshiya @@ -6852,7 +6852,7 @@ * include/freetype/internal/services/svotval.h: Add `volatile' to sync with the modification by Jens Claudius on 2006-08-22; cf. - http://cvs.savannah.gnu.org/viewcvs/freetype/freetype2/src/otvalid/otvmod.c?r1=1.4&r2=1.5 + https://cvs.savannah.gnu.org/viewcvs/freetype/freetype2/src/otvalid/otvmod.c?r1=1.4&r2=1.5 2006-12-15 suzuki toshiya @@ -6876,7 +6876,7 @@ * src/base/ftobjs.c: Improvement of resource fork handler for POSIX, cf. - http://lists.gnu.org/archive/html/freetype-devel/2006-10/msg00025.html + https://lists.gnu.org/archive/html/freetype-devel/2006-10/msg00025.html (Mac_Read_sfnt_Resource): Count only `sfnt' resource of suitcase font format or .dfont, to simulate the face index number counted by ftmac.c. (IsMacResource): Return the number of scalable faces correctly. @@ -7524,7 +7524,7 @@ `ft_validator_run' wrapping `setjmp' can cause a crash, as found by Jens: - http://lists.gnu.org/archive/html/freetype-devel/2006-08/msg00004.htm. + https://lists.gnu.org/archive/html/freetype-devel/2006-08/msg00004.htm. * src/otvalid/otvmod.c: Replace `ft_validator_run' by `ft_setjmp'. It reverts the change introduced on 2005-08-20. @@ -7721,7 +7721,7 @@ 2006-06-24 Eugeniy Meshcheryakov Fix two hinting bugs as reported in - http://lists.gnu.org/archive/html/freetype-devel/2006-06/msg00057.html. + https://lists.gnu.org/archive/html/freetype-devel/2006-06/msg00057.html. * include/freetype/internal/tttypes.h (TT_GlyphZoneRec): Add `first_point' member. @@ -7761,7 +7761,7 @@ should return `FT_Err_Unimplemented_Feature' if validation service is unavailable (disabled in `modules.cfg'). It is originally suggested by David Turner, cf. - http://lists.gnu.org/archive/html/freetype-devel/2005-11/msg00078.html + https://lists.gnu.org/archive/html/freetype-devel/2005-11/msg00078.html * src/base/ftgxval.c (FT_TrueTypeGX_Validate): Return FT_Err_Unimplemented_Feature if TrueTypeGX validation service is diff --git a/ChangeLog.24 b/ChangeLog.24 index e33b8f5e9..fb05e7533 100644 --- a/ChangeLog.24 +++ b/ChangeLog.24 @@ -1977,7 +1977,7 @@ Most of the code is based on the ClearType whitepaper written by Greg Hitchcock - http://www.microsoft.com/typography/cleartype/truetypecleartype.aspx + https://www.microsoft.com/typography/cleartype/truetypecleartype.aspx which gives a detailed overview of the necessary changes to the Microsoft rasterizer so that older fonts are supported. However, a @@ -2103,7 +2103,7 @@ NEC FA family dated in 1996 have different checksum. Reported by Johnson Y. Yan ; see - http://lists.gnu.org/archive/html/freetype-devel/2012-06/msg00023.html + https://lists.gnu.org/archive/html/freetype-devel/2012-06/msg00023.html * src/truetype/ttobjs.c (tt_check_trickyness_sfnt_ids): 4 sets of fpgm & prep table checksums for FA-Gothic, FA-Minchou, @@ -2117,7 +2117,7 @@ Problem reported by jola ; see - http://lists.gnu.org/archive/html/freetype-devel/2012-05/msg00036.html + https://lists.gnu.org/archive/html/freetype-devel/2012-05/msg00036.html * src/raster/ftraster.c (SMulDiv_No_Round): New macro. (Line_Up): Use it. @@ -2603,7 +2603,7 @@ See discussion starting at - http://lists.gnu.org/archive/html/freetype-devel/2012-01/msg00037.html + https://lists.gnu.org/archive/html/freetype-devel/2012-01/msg00037.html * src/smooth/ftgrays.c: s/TBand/gray_TBand/. * src/raster/ftraster.c: s/TBand/black_TBand/. @@ -2616,7 +2616,7 @@ `outline.flags' so that this information is preserved. See discussion starting at - http://lists.gnu.org/archive/html/freetype-devel/2012-02/msg00046.html + https://lists.gnu.org/archive/html/freetype-devel/2012-02/msg00046.html 2012-02-11 Werner Lemberg @@ -2677,7 +2677,7 @@ [raccess] Modify for PIC build. Based on the patch provided by Erik Dahlstrom , - http://lists.gnu.org/archive/html/freetype-devel/2012-01/msg00010.html + https://lists.gnu.org/archive/html/freetype-devel/2012-01/msg00010.html Also `raccess_guess_table[]' and `raccess_rule_by_darwin_vfs()' are renamed with `ft_' suffixes. @@ -3127,7 +3127,7 @@ According to - http://www.gnu.org/prep/maintain/html_node/Copyright-Notices.html + https://www.gnu.org/prep/maintain/html_node/Copyright-Notices.html this should be mentioned explicitly. @@ -3456,7 +3456,7 @@ See - http://lists.gnu.org/archive/html/freetype-devel/2011-07/msg00049.html + https://lists.gnu.org/archive/html/freetype-devel/2011-07/msg00049.html for some comparison images. @@ -3556,7 +3556,7 @@ See - http://lists.gnu.org/archive/html/freetype-devel/2011-07/msg00001.html + https://lists.gnu.org/archive/html/freetype-devel/2011-07/msg00001.html for example documents. The FreeType stroker now produces results very similar to that produced by GhostScript and Distiller for these @@ -4005,9 +4005,9 @@ aligned, bluezones for CJK Ideographs are calculated from sample glyphs. At present, vertical bluezones (bluezones to align vertical stems) are disabled by default. For detail, see - http://lists.gnu.org/archive/html/freetype-devel/2011-04/msg00070.html - http://lists.gnu.org/archive/html/freetype-devel/2011-04/msg00092.html - http://lists.gnu.org/archive/html/freetype-devel/2011-05/msg00001.html + https://lists.gnu.org/archive/html/freetype-devel/2011-04/msg00070.html + https://lists.gnu.org/archive/html/freetype-devel/2011-04/msg00092.html + https://lists.gnu.org/archive/html/freetype-devel/2011-05/msg00001.html * include/freetype/internal/fttrace.h: New trace component `afcjk'. * src/autofit/afcjk.h (AF_CJK{Blue,Axis,Metric}Rec): Add CJK version @@ -4075,8 +4075,8 @@ the TrueType font header. Some bad PDF generators write wrong values. For details see examples and benchmark tests of the latency by recalculation: - http://lists.gnu.org/archive/html/freetype-devel/2011-04/msg00091.html - http://lists.gnu.org/archive/html/freetype-devel/2011-04/msg00096.html + https://lists.gnu.org/archive/html/freetype-devel/2011-04/msg00091.html + https://lists.gnu.org/archive/html/freetype-devel/2011-04/msg00096.html 2011-04-30 suzuki toshiya @@ -4109,7 +4109,7 @@ Because some PDF generators mangle the family name badly, the trickyness check by the checksum should be invoked always. For sample PDF, see - http://lists.gnu.org/archive/html/freetype-devel/2011-04/msg00073.html + https://lists.gnu.org/archive/html/freetype-devel/2011-04/msg00073.html * src/truetype/ttobjs.c (tt_check_trickyness): Even when tt_check_trickyness_family() finds no trickyness, @@ -4146,8 +4146,8 @@ When there are too many stems to preserve their gaps in the rasterization of CJK Ideographs at a low resolution, blur the stems instead of showing clumped stems. See - http://lists.gnu.org/archive/html/freetype-devel/2011-02/msg00011.html - http://lists.gnu.org/archive/html/freetype-devel/2011-04/msg00046.html + https://lists.gnu.org/archive/html/freetype-devel/2011-02/msg00011.html + https://lists.gnu.org/archive/html/freetype-devel/2011-04/msg00046.html for details. * src/autofit/afcjk.c (af_cjk_hint_edges): Store the position of @@ -4343,7 +4343,7 @@ [cache] Fix an off-by-one bug in `FTC_Manager_RemoveFaceID'. Found by , see detail in - http://lists.gnu.org/archive/html/freetype/2011-01/msg00023.html + https://lists.gnu.org/archive/html/freetype/2011-01/msg00023.html * src/cache/ftccache.c (FTC_Cache_RemoveFaceID): Check the node buckets[cache->p + cache->mask] too. @@ -4464,7 +4464,7 @@ Johnson Y. Yan. The bug report by Qt developers is considered too. - http://bugreports.qt.nokia.com/browse/QTBUG-6521 + https://bugreports.qt.io/browse/QTBUG-6521 2011-01-15 Werner Lemberg @@ -4923,7 +4923,7 @@ Partially undo change from 2010-10-15 by using ONE_PIXEL/4; this has been tested with demo images sent to the mailing list. See - http://lists.gnu.org/archive/html/freetype-devel/2010-10/msg00055.html + https://lists.gnu.org/archive/html/freetype-devel/2010-10/msg00055.html and later mails in this thread. @@ -4943,7 +4943,7 @@ Problem reported by Tom Bishop ; see thread starting with - http://lists.gnu.org/archive/html/freetype/2010-10/msg00049.html + https://lists.gnu.org/archive/html/freetype/2010-10/msg00049.html * src/raster/ftraster.c (Line_Up): Replace FMulDiv with SMulDiv since the involved multiplication exceeds 32 bits. @@ -5007,7 +5007,7 @@ normal clients. For the history of these macros, see the investigation: - http://lists.gnu.org/archive/html/freetype/2010-10/msg00022.html + https://lists.gnu.org/archive/html/freetype/2010-10/msg00022.html 2010-10-24 suzuki toshiya @@ -5054,7 +5054,7 @@ by Darwin VFS are skipped. It reduces the warnings of the deprecated resource fork access method by recent Darwin kernel. Fix MacPorts ticket #18859: - http://trac.macports.org/ticket/18859 + https://trac.macports.org/ticket/18859 * src/base/ftobjs.c (load_face_in_embedded_rfork): When `FT_Stream_New' returns FT_Err_Cannot_Open_Stream, it @@ -5182,7 +5182,7 @@ [smooth] Fix splitting of cubics for negative values. Reported by RĂłbert MĂĄrki ; see - http://lists.gnu.org/archive/html/freetype/2010-09/msg00019.html. + https://lists.gnu.org/archive/html/freetype/2010-09/msg00019.html. * src/smooth/ftgrays.c (gray_render_cubic): Fix thinko. @@ -5349,7 +5349,7 @@ Ignore the environmental setting of LIBTOOL. Patch is suggested by Adrian Bunk, to prevent unexpected reflection of environmental LIBTOOL. See: - http://savannah.nongnu.org/patch/?7290 + https://savannah.nongnu.org/patch/?7290 * builds/unix/unix-cc.in: LIBTOOL is unconditionally set to $(FT_LIBTOOL_DIR)/libtool. FT_LIBTOOL_DIR is set to $(BUILD_DIR) @@ -5406,8 +5406,8 @@ for nameless fonts is safer for PDFs including embedded Chinese fonts. Written by David Bevan, see: - http://lists.gnu.org/archive/html/freetype-devel/2010-08/msg00021.html - http://lists.freedesktop.org/archives/poppler/2010-August/006310.html + https://lists.gnu.org/archive/html/freetype-devel/2010-08/msg00021.html + https://lists.freedesktop.org/archives/poppler/2010-August/006310.html * src/truetype/ttobjs.c (tt_check_trickyness): If a NULL pointer by nameless font is given, TRUE is returned to enable hinting. @@ -5968,7 +5968,7 @@ * src/smooth/ftgrays.c (gray_render_cubic): Fix algorithm. The previous version was too aggressive, as demonstrated in - http://lists.gnu.org/archive/html/freetype-devel/2010-06/msg00020.html. + https://lists.gnu.org/archive/html/freetype-devel/2010-06/msg00020.html. 2010-06-24 Werner Lemberg @@ -6065,7 +6065,7 @@ simplified algorithm to find out whether the spline can be replaced with two straight lines. See this thread for more: - http://lists.gnu.org/archive/html/freetype-devel/2010-06/msg00000.html + https://lists.gnu.org/archive/html/freetype-devel/2010-06/msg00000.html 2010-06-09 Werner Lemberg @@ -6220,7 +6220,7 @@ Add new function `FT_Library_SetLcdFilterWeights'. This is based on code written by Lifter - . It fixes + . It fixes FreeDesktop bug #27386. * src/base/ftlcdfil.c (FT_Library_SetLcdFilterWeights): New diff --git a/ChangeLog.25 b/ChangeLog.25 index f3e5cc1ac..5482b0520 100644 --- a/ChangeLog.25 +++ b/ChangeLog.25 @@ -112,8 +112,8 @@ Original patch is designed by Werner Lemberg. Extra part for otvalid and gxvalid are added by suzuki toshiya, see discussion: - http://lists.nongnu.org/archive/html/freetype-devel/2014-12/msg00002.html - http://lists.nongnu.org/archive/html/freetype-devel/2014-12/msg00007.html + https://lists.nongnu.org/archive/html/freetype-devel/2014-12/msg00002.html + https://lists.nongnu.org/archive/html/freetype-devel/2014-12/msg00007.html * include/internal/ftvalid.h: Introduce FT_THROW() in FT_INVALID_(). * src/gxvalid/gxvcommn.h: Ditto. @@ -144,7 +144,7 @@ for Borland's bug tracker entry. Reported by Yuliana Zigangirova , - http://lists.gnu.org/archive/html/freetype-devel/2014-04/msg00001.html. + https://lists.gnu.org/archive/html/freetype-devel/2014-04/msg00001.html. * include/internal/ftvalid.h (FT_ValidatorRec), src/smooth/ftgrays.c (gray_TWorker_): Move `ft_jmp_buf' field to be the first element. @@ -2669,8 +2669,8 @@ with Carbon framework is incompatible with that by FreeType 2 without Carbon framework.) Found by Khaled Hosny and Hin-Tak Leung. - http://lists.gnu.org/archive/html/freetype-devel/2013-02/msg00035.html - http://lists.gnu.org/archive/html/freetype-devel/2013-12/msg00027.html + https://lists.gnu.org/archive/html/freetype-devel/2013-02/msg00035.html + https://lists.gnu.org/archive/html/freetype-devel/2013-12/msg00027.html * src/base/ftrfork.c (FT_Raccess_Get_DataOffsets): Add a switch `sort_by_res_id' to control the fragmented resource ordering. @@ -3181,7 +3181,7 @@ Problem reported by Hin-Tak Leung ; see - http://lists.nongnu.org/archive/html/freetype-devel/2013-08/msg00005.html + https://lists.nongnu.org/archive/html/freetype-devel/2013-08/msg00005.html for details. @@ -3556,7 +3556,7 @@ Suggested by Akira Tagoh, see - http://lists.gnu.org/archive/html/freetype/2013-09/msg00030.html + https://lists.gnu.org/archive/html/freetype/2013-09/msg00030.html * src/bdf/bdfdrivr.c (BDF_Face_Init): Return `Invalid_Argument' error if the font could be opened but non-zero `face_index' is diff --git a/ChangeLog.26 b/ChangeLog.26 index c174b6d4c..b76f9eb60 100644 --- a/ChangeLog.26 +++ b/ChangeLog.26 @@ -663,7 +663,7 @@ The previous fix for #46372 misunderstood a composite glyph referring same component twice as a recursive reference. See the discussion - http://lists.gnu.org/archive/html/freetype/2016-05/msg00000.html + https://lists.gnu.org/archive/html/freetype/2016-05/msg00000.html Thanks to Khaled Hosny for finding this issue. @@ -788,7 +788,7 @@ proper blue zones can't be defined. However, there is already a proposal submitted to Unicode; see - http://www.unicode.org/L2/L2016/16034-n4707-georgian.pdf + https://www.unicode.org/L2/L2016/16034-n4707-georgian.pdf Additionally, due to historical reasons, Unicode treats Khutsuri as the same script as Mkhedruli, and so does OpenType. However, since @@ -2478,7 +2478,7 @@ Problem reported by David Capello ; see - http://lists.nongnu.org/archive/html/freetype-devel/2015-10/msg00108.html + https://lists.nongnu.org/archive/html/freetype-devel/2015-10/msg00108.html for details. @@ -3813,7 +3813,7 @@ See - http://lists.nongnu.org/archive/html/freetype-devel/2015-07/msg00008.html + https://lists.nongnu.org/archive/html/freetype-devel/2015-07/msg00008.html for a rationale. @@ -3932,7 +3932,7 @@ This change is a result of a discussion thread on freetype-devel - http://lists.nongnu.org/archive/html/freetype-devel/2015-06/msg00041.html + https://lists.nongnu.org/archive/html/freetype-devel/2015-06/msg00041.html Re-introduce the `freetype2' subdirectory for all FreeType header files after installation, and rename the `freetype2' subdirectory in @@ -4114,7 +4114,7 @@ Problem reported by Grissiom ; in - http://lists.nongnu.org/archive/html/freetype/2015-05/msg00013.html + https://lists.nongnu.org/archive/html/freetype/2015-05/msg00013.html there is an example code to trigger the bug. @@ -4292,7 +4292,7 @@ This follows the OpenType 1.7 specification. See - http://tug.org/pipermail/tex-live/2015-April/036634.html + https://tug.org/pipermail/tex-live/2015-April/036634.html for a discussion. diff --git a/README b/README index 35324b0a7..501183e87 100644 --- a/README +++ b/README @@ -1,7 +1,7 @@ FreeType 2.8.1 ============== - Homepage: http://www.freetype.org + Homepage: https://www.freetype.org FreeType is a freely available software library to render fonts. @@ -20,7 +20,7 @@ documentation is available as a separate package from our sites. Go to - http://download.savannah.gnu.org/releases/freetype/ + https://download.savannah.gnu.org/releases/freetype/ and download one of the following files. @@ -30,7 +30,7 @@ To view the documentation online, go to - http://www.freetype.org/freetype2/documentation.html + https://www.freetype.org/freetype2/documentation.html Mailing Lists @@ -46,7 +46,7 @@ The lists are moderated; see - http://www.freetype.org/contact.html + https://www.freetype.org/contact.html how to subscribe. diff --git a/builds/unix/freetype2.in b/builds/unix/freetype2.in index c4dfda4ab..2d759ecf8 100644 --- a/builds/unix/freetype2.in +++ b/builds/unix/freetype2.in @@ -4,7 +4,7 @@ libdir=%libdir% includedir=%includedir% Name: FreeType 2 -URL: http://freetype.org +URL: https://freetype.org Description: A free, high-quality, and portable font engine. Version: %ft_version% Requires: diff --git a/devel/ftoption.h b/devel/ftoption.h index 21af1cd63..4b6969888 100644 --- a/devel/ftoption.h +++ b/devel/ftoption.h @@ -627,7 +627,7 @@ FT_BEGIN_HEADER /* This option requires TT_CONFIG_OPTION_BYTECODE_INTERPRETER to be */ /* defined. */ /* */ - /* [1] http://www.microsoft.com/typography/cleartype/truetypecleartype.aspx */ + /* [1] https://www.microsoft.com/typography/cleartype/truetypecleartype.aspx */ /* */ /* #define TT_CONFIG_OPTION_SUBPIXEL_HINTING 1 */ /* #define TT_CONFIG_OPTION_SUBPIXEL_HINTING 2 */ @@ -647,7 +647,7 @@ FT_BEGIN_HEADER /* composite flags array which can be used to disambiguate, but old */ /* fonts will not have them. */ /* */ - /* http://www.microsoft.com/typography/otspec/glyf.htm */ + /* https://www.microsoft.com/typography/otspec/glyf.htm */ /* https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6glyf.html */ /* */ #undef TT_CONFIG_OPTION_COMPONENT_OFFSET_SCALED diff --git a/docs/CHANGES b/docs/CHANGES index d81c40f8d..a9e450f9d 100644 --- a/docs/CHANGES +++ b/docs/CHANGES @@ -226,7 +226,7 @@ CHANGES BETWEEN 2.7 and 2.7.1 write caused by a heap-based buffer overflow related to the CFF fonts. - http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2016-10328 + https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2016-10328 III. MISCELLANEOUS @@ -741,7 +741,7 @@ CHANGES BETWEEN 2.5.3 and 2.5.4 I. IMPORTANT BUG FIXES - A variant of vulnerability CVE-2014-2240 was identified - (cf. http://savannah.nongnu.org/bugs/?43661) and fixed in the + (cf. https://savannah.nongnu.org/bugs/?43661) and fixed in the new CFF driver. All users should upgrade. - The new auto-hinter code using HarfBuzz crashed for some invalid @@ -812,7 +812,7 @@ CHANGES BETWEEN 2.5.2 and 2.5.3 I. IMPORTANT BUG FIXES - A vulnerability (CVE-2014-2240) was identified and fixed in the - new CFF driver (cf. http://savannah.nongnu.org/bugs/?41697). + new CFF driver (cf. https://savannah.nongnu.org/bugs/?41697). All users should upgrade. - More bug fixes related to correct positioning of composite @@ -1184,7 +1184,7 @@ CHANGES BETWEEN 2.4.10 and 2.4.11 - Subpixel hinting support has been contributed by Infinality, based on Greg Hitchcock's whitepaper at - http://www.microsoft.com/typography/cleartype/truetypecleartype.aspx + https://www.microsoft.com/typography/cleartype/truetypecleartype.aspx Originally, it was a separate patch available from @@ -2054,7 +2054,7 @@ CHANGES BETWEEN 2.3.0 and 2.2.1 of the library, mainly due to patent issues. For more information see: - http://lists.gnu.org/archive/html/freetype/2006-09/msg00064.html + https://lists.gnu.org/archive/html/freetype/2006-09/msg00064.html A new configuration macro FT_CONFIG_OPTION_SUBPIXEL_RENDERING has been introduced in `ftoption.h'; manually define it in this @@ -2157,7 +2157,7 @@ CHANGES BETWEEN 2.2 and 2.1.10 We provide patches for most of those rogue clients. See the following page for more information: - http://www.freetype.org/freetype2/patches/rogue-patches.html + https://www.freetype.org/freetype2/patches/rogue-patches.html Note that, as a convenience to our Unix desktop users, version 2.2 is *binary* compatible with FreeType 2.1.7, which means that @@ -2269,7 +2269,7 @@ CHANGES BETWEEN 2.2 and 2.1.10 - Rudimentary support for Adobe's new `SING Glyphlet' format. See - http://www.adobe.com/products/indesign/sing_gaiji.html + https://www.adobe.com/content/dam/acom/en/devnet/font/pdfs/5148.SING_Tutorial.pdf for more information. @@ -2946,7 +2946,7 @@ CHANGES BETWEEN 2.1.3 and 2.1.2 quality since many nasty defaults have been suppressed. Please visit the web page: - http://www.freetype.org/hinting/smooth-hinting.html + https://www.freetype.org/hinting/smooth-hinting.html for additional details on this topic. @@ -3205,7 +3205,7 @@ CHANGES BETWEEN 2.1.0 and 2.0.9 - The FreeType 2 redesign has begun. More information can be found at this URL: - http://www.freetype.org/freetype2/redesign.html + https://www.freetype.org/freetype2/redesign.html The following internal changes have been performed within the sources of this release: @@ -3796,13 +3796,7 @@ CHANGES BETWEEN 2.0.2 and 2.0.1 For more information, see section I of the following document: - http://www.freetype.org/ - freetype2/docs/tutorial/step1.html - - or - - http://freetype.sourceforge.net/ - freetype2/docs/tutorial/step1.html + https://www.freetype.org/freetype2/docs/tutorial/step1.html - Many, many comments have been added to the public source file in order to automatically generate the API Reference through the @@ -3811,7 +3805,7 @@ CHANGES BETWEEN 2.0.2 and 2.0.1 The latter has been updated to support the grouping of sections in chapters and better index sort. See: - http://www.freetype.org/freetype2/docs/reference/ft2-toc.html + https://www.freetype.org/freetype2/docs/reference/ft2-toc.html III. CHANGES TO THE BUILD PROCESS diff --git a/docs/FTL.TXT b/docs/FTL.TXT index 433ab060e..c406d150f 100644 --- a/docs/FTL.TXT +++ b/docs/FTL.TXT @@ -163,7 +163,7 @@ Legal Terms Our home page can be found at - http://www.freetype.org + https://www.freetype.org --- end of FTL.TXT --- diff --git a/docs/formats.txt b/docs/formats.txt index 1c494f063..23550a82f 100644 --- a/docs/formats.txt +++ b/docs/formats.txt @@ -155,10 +155,11 @@ which isn't supported yet please send a mail too. [1] Support should be rather simple since this is identical to `CFF' but in a PS wrapper. -[2] Official PFR specification: +[2] Official PFR specification is no longer available, but archive.org + has arvchived it: - http://www.bitstream.com/categories/developer/truedoc/pfrspec.html - http://www.bitstream.com/categories/developer/truedoc/pfrspec1.2.pdf + https://web.archive.org/web/20091014062300/http://www.bitstream.com/font_rendering/products/truedoc/pfrspec.html + https://web.archive.org/web/20081115152605/http://www.bitstream.com/font_rendering/pdfs/pfrspec1.3.pdf The syntax of the auxiliary data is not defined there, but is partially defined in MHP 1.0.3 (also called ETSI TS 101812 V1.3.1) @@ -167,8 +168,6 @@ which isn't supported yet please send a mail too. http://www.etsi.org/ http://webapp.etsi.org/workprogram/Report_WorkItem.asp?WKI_ID=18799 - (free registration required). - [3] Support is rudimentary currently; some tables or data are not loaded yet. @@ -184,11 +183,11 @@ which isn't supported yet please send a mail too. George Williams deduced the font format from the X11 sources and documented it for his FontForge font editor: - http://fontforge.github.io/pcf-format.html + https://fontforge.github.io/pcf-format.html [5] This is from MS Windows 3; see Microsoft's Knowledge Base article at - http://support.microsoft.com/kb/65123 + https://support.microsoft.com/kb/65123 ------------------------------------------------------------------------ diff --git a/include/freetype/config/ftoption.h b/include/freetype/config/ftoption.h index fbee57352..6f1d93fd8 100644 --- a/include/freetype/config/ftoption.h +++ b/include/freetype/config/ftoption.h @@ -652,7 +652,7 @@ FT_BEGIN_HEADER /* This option requires TT_CONFIG_OPTION_BYTECODE_INTERPRETER to be */ /* defined. */ /* */ - /* [1] http://www.microsoft.com/typography/cleartype/truetypecleartype.aspx */ + /* [1] https://www.microsoft.com/typography/cleartype/truetypecleartype.aspx */ /* */ /* #define TT_CONFIG_OPTION_SUBPIXEL_HINTING 1 */ #define TT_CONFIG_OPTION_SUBPIXEL_HINTING 2 @@ -672,7 +672,7 @@ FT_BEGIN_HEADER /* composite flags array which can be used to disambiguate, but old */ /* fonts will not have them. */ /* */ - /* http://www.microsoft.com/typography/otspec/glyf.htm */ + /* https://www.microsoft.com/typography/otspec/glyf.htm */ /* https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6glyf.html */ /* */ #undef TT_CONFIG_OPTION_COMPONENT_OFFSET_SCALED diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h index b4e6627ea..96a8dcc64 100644 --- a/include/freetype/freetype.h +++ b/include/freetype/freetype.h @@ -651,7 +651,7 @@ FT_BEGIN_HEADER /* FT_ENCODING_MS_SYMBOL :: */ /* Microsoft Symbol encoding, used to encode mathematical symbols */ /* and wingdings. For more information, see */ - /* `http://www.microsoft.com/typography/otspec/recom.htm', */ + /* `https://www.microsoft.com/typography/otspec/recom.htm', */ /* `http://www.kostis.net/charsets/symbol.htm', and */ /* `http://www.kostis.net/charsets/wingding.htm'. */ /* */ @@ -660,7 +660,7 @@ FT_BEGIN_HEADER /* */ /* FT_ENCODING_SJIS :: */ /* Shift JIS encoding for Japanese. More info at */ - /* `http://en.wikipedia.org/wiki/Shift_JIS'. See note on */ + /* `https://en.wikipedia.org/wiki/Shift_JIS'. See note on */ /* multi-byte encodings below. */ /* */ /* FT_ENCODING_PRC :: */ @@ -676,7 +676,7 @@ FT_BEGIN_HEADER /* Corresponds to the Korean encoding system known as Extended */ /* Wansung (MS Windows code page 949). */ /* For more information see */ - /* `http://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WindowsBestFit/bestfit949.txt'. */ + /* `https://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WindowsBestFit/bestfit949.txt'. */ /* */ /* FT_ENCODING_JOHAB :: */ /* The Korean standard character set (KS~C 5601-1992), which */ @@ -752,7 +752,7 @@ FT_BEGIN_HEADER /* @FT_Get_CMap_Language_ID to query the Mac language ID that may */ /* be needed to be able to distinguish Apple encoding variants. See */ /* */ - /* http://www.unicode.org/Public/MAPPINGS/VENDORS/APPLE/Readme.txt */ + /* https://www.unicode.org/Public/MAPPINGS/VENDORS/APPLE/Readme.txt */ /* */ /* to get an idea how to do that. Basically, if the language ID */ /* is~0, don't use it, otherwise subtract 1 from the language ID. */ @@ -3557,7 +3557,7 @@ FT_BEGIN_HEADER /* retrieve it. FreeType follows Adobe TechNote #5902, `Generating */ /* PostScript Names for Fonts Using OpenType Font Variations'. */ /* */ - /* http://wwwimages.adobe.com/content/dam/Adobe/en/devnet/font/pdfs/5902.AdobePSNameGeneration.html */ + /* https://download.macromedia.com/pub/developer/opentype/tech-notes/5902.AdobePSNameGeneration.html */ /* */ /* [Since 2.8.2] Special PostScript names for named instances are */ /* only returned if the named instance is set with */ @@ -3995,7 +3995,7 @@ FT_BEGIN_HEADER /* and subsetting restrictions associated with a font. */ /* */ /* See */ - /* http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/FontPolicies.pdf */ + /* https://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/FontPolicies.pdf */ /* for more details. */ /* */ /* */ @@ -4095,9 +4095,9 @@ FT_BEGIN_HEADER /* Sequences' (IVS), collected in the `Ideographic Variation */ /* Database' (IVD). */ /* */ - /* http://unicode.org/Public/UCD/latest/ucd/StandardizedVariants.txt */ - /* http://unicode.org/reports/tr37/ */ - /* http://unicode.org/ivd/ */ + /* https://unicode.org/Public/UCD/latest/ucd/StandardizedVariants.txt */ + /* https://unicode.org/reports/tr37/ */ + /* https://unicode.org/ivd/ */ /* */ /* To date (January 2017), the character with the most ideographic */ /* variations is U+9089, having 32 such IVS. */ diff --git a/include/freetype/ftttdrv.h b/include/freetype/ftttdrv.h index f97c70a2b..d65d39d19 100644 --- a/include/freetype/ftttdrv.h +++ b/include/freetype/ftttdrv.h @@ -116,7 +116,7 @@ FT_BEGIN_HEADER * minimize hinting techniques that were problematic with the extra * resolution of ClearType; see * http://www.beatstamm.com/typography/RTRCh4.htm#Sec1 and - * http://www.microsoft.com/typography/cleartype/truetypecleartype.aspx. + * https://www.microsoft.com/typography/cleartype/truetypecleartype.aspx. * This technique is not to be confused with ClearType compatible * widths. ClearType backward compatibility has no direct impact on * changing advance widths, but there might be an indirect impact on @@ -155,7 +155,7 @@ FT_BEGIN_HEADER * * Details on subpixel hinting and some of the necessary tweaks can be * found in Greg Hitchcock's whitepaper at - * `http://www.microsoft.com/typography/cleartype/truetypecleartype.aspx'. + * `https://www.microsoft.com/typography/cleartype/truetypecleartype.aspx'. * Note that FreeType currently doesn't really `subpixel hint' (6x1, 6x2, * or 6x5 supersampling) like discussed in the paper. Depending on the * chosen interpreter, it simply ignores instructions on vertical stems diff --git a/include/freetype/internal/tttypes.h b/include/freetype/internal/tttypes.h index 3bc6c9893..b8a189d9a 100644 --- a/include/freetype/internal/tttypes.h +++ b/include/freetype/internal/tttypes.h @@ -148,7 +148,7 @@ FT_BEGIN_HEADER /* */ /* See */ /* */ - /* http://www.w3.org/TR/WOFF/#WOFFHeader */ + /* https://www.w3.org/TR/WOFF/#WOFFHeader */ /* */ typedef struct WOFF_HeaderRec_ { diff --git a/include/freetype/ttnameid.h b/include/freetype/ttnameid.h index 494d67718..b4193009e 100644 --- a/include/freetype/ttnameid.h +++ b/include/freetype/ttnameid.h @@ -437,7 +437,7 @@ FT_BEGIN_HEADER * * The canonical source for Microsoft's IDs is * - * http://www.microsoft.com/globaldev/reference/lcid-all.mspx , + * https://www.microsoft.com/globaldev/reference/lcid-all.mspx , * * however, we only provide macros for language identifiers present in * the OpenType specification: Microsoft has abandoned the concept of diff --git a/src/autofit/afcjk.c b/src/autofit/afcjk.c index 897533d14..2973b098e 100644 --- a/src/autofit/afcjk.c +++ b/src/autofit/afcjk.c @@ -16,9 +16,9 @@ /***************************************************************************/ /* - * The algorithm is based on akito's autohint patch, available here: + * The algorithm is based on akito's autohint patch, archived at * - * http://www.kde.gr.jp/~akito/patch/freetype2/ + * https://web.archive.org/web/20051219160454/http://www.kde.gr.jp:80/~akito/patch/freetype2/2.1.7/ * */ diff --git a/src/autofit/afhints.h b/src/autofit/afhints.h index 16638b103..b88c655f8 100644 --- a/src/autofit/afhints.h +++ b/src/autofit/afhints.h @@ -62,7 +62,7 @@ FT_BEGIN_HEADER * * by David Turner and Werner Lemberg * - * http://www.tug.org/TUGboat/Articles/tb24-3/lemberg.pdf + * https://www.tug.org/TUGboat/Articles/tb24-3/lemberg.pdf * * with appropriate updates. * diff --git a/src/base/ftbitmap.c b/src/base/ftbitmap.c index e567a0453..2a2a9dbfb 100644 --- a/src/base/ftbitmap.c +++ b/src/base/ftbitmap.c @@ -444,7 +444,7 @@ * A gamma of 2.2 is fair to assume. And then, we need to * undo the premultiplication too. * - * http://accessibility.kde.org/hsl-adjusted.php + * https://accessibility.kde.org/hsl-adjusted.php * * We do the computation with integers only, applying a gamma of 2.0. * We guarantee 32-bit arithmetic to avoid overflow but the resulting diff --git a/src/bdf/README b/src/bdf/README index b761aba2b..996ac2d2a 100644 --- a/src/bdf/README +++ b/src/bdf/README @@ -13,7 +13,7 @@ This code implements a BDF driver for the FreeType library, following the Adobe Specification V 2.2. The specification of the BDF font format is available from Adobe's web site: - http://partners.adobe.com/public/developer/en/font/5005.BDF_Spec.pdf + https://www.adobe.com/content/dam/acom/en/devnet/font/pdfs/5005.BDF_Spec.pdf Many good bitmap fonts in bdf format come with XFree86 (www.XFree86.org). They do not define vertical metrics, because the X Consortium BDF diff --git a/src/gxvalid/README b/src/gxvalid/README index 200f66cb1..5d292461d 100644 --- a/src/gxvalid/README +++ b/src/gxvalid/README @@ -287,11 +287,11 @@ gxvalid: TrueType GX validator 4-5. invalid feature number (117/183) ------------------------------------- - The GX/AAT extension can include 255 different layout features, but - popular layout features are predefined (see - http://developer.apple.com/fonts/Registry/index.html). Some fonts - include feature numbers which are incompatible with the predefined - feature registry. + The GX/AAT extension can include 255 different layout features, + but popular layout features are predefined (see + https://developer.apple.com/fonts/TrueType-Reference-Manual/RM09/AppendixF.html). + Some fonts include feature numbers which are incompatible with the + predefined feature registry. In our survey, there are 140 fonts including `feat' table. diff --git a/src/gxvalid/gxvfgen.c b/src/gxvalid/gxvfgen.c index 8cc08cd9c..42ff690b3 100644 --- a/src/gxvalid/gxvfgen.c +++ b/src/gxvalid/gxvfgen.c @@ -21,7 +21,7 @@ /* gxfeatreg.c */ /* */ /* Database of font features pre-defined by Apple Computer, Inc. */ -/* http://developer.apple.com/fonts/Registry/ */ +/* https://developer.apple.com/fonts/TrueType-Reference-Manual/RM09/AppendixF.html */ /* (body). */ /* */ /* Copyright 2003 by */ diff --git a/src/psaux/pshints.c b/src/psaux/pshints.c index 93e1587da..94f18c731 100644 --- a/src/psaux/pshints.c +++ b/src/psaux/pshints.c @@ -1202,7 +1202,7 @@ * second segment. * Let `w 'be the zero-based vector from `u1' to `v1'. * `perp' is the `perpendicular dot product'; see - * http://mathworld.wolfram.com/PerpDotProduct.html. + * https://mathworld.wolfram.com/PerpDotProduct.html. * `s' is the parameter for the parametric line for the first segment * (`u'). * diff --git a/src/sfnt/sfobjs.c b/src/sfnt/sfobjs.c index 1764807c6..dd37389f2 100644 --- a/src/sfnt/sfobjs.c +++ b/src/sfnt/sfobjs.c @@ -1684,9 +1684,9 @@ (FT_Short)( face->vertical_info ? face->vertical.advance_Height_Max : root->height ); - /* See http://www.microsoft.com/OpenType/OTSpec/post.htm -- */ - /* Adjust underline position from top edge to centre of */ - /* stroke to convert TrueType meaning to FreeType meaning. */ + /* See https://www.microsoft.com/typography/otspec/post.htm -- */ + /* Adjust underline position from top edge to centre of */ + /* stroke to convert TrueType meaning to FreeType meaning. */ root->underline_position = face->postscript.underlinePosition - face->postscript.underlineThickness / 2; root->underline_thickness = face->postscript.underlineThickness; diff --git a/src/smooth/ftgrays.c b/src/smooth/ftgrays.c index 3b3dcb31e..6a230a6f4 100644 --- a/src/smooth/ftgrays.c +++ b/src/smooth/ftgrays.c @@ -370,7 +370,7 @@ typedef ptrdiff_t FT_PtrDist; /* optimize a division and modulo operation on the same parameters */ /* into a single call to `__aeabi_idivmod'. See */ /* */ - /* http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43721 */ + /* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43721 */ #undef FT_DIV_MOD #define FT_DIV_MOD( type, dividend, divisor, quotient, remainder ) \ FT_BEGIN_STMNT \ diff --git a/src/tools/docmaker/sources.py b/src/tools/docmaker/sources.py index 06407e164..b7633134c 100644 --- a/src/tools/docmaker/sources.py +++ b/src/tools/docmaker/sources.py @@ -171,7 +171,7 @@ re_bold = re.compile( r"\*((?:\w|-)(?:\w|'|-)*)\*(.*)" ) # *bold* # # This regular expression code to identify an URL has been taken from # -# http://mail.python.org/pipermail/tutor/2002-September/017228.html +# https://mail.python.org/pipermail/tutor/2002-September/017228.html # # (with slight modifications). # diff --git a/src/tools/docmaker/tohtml.py b/src/tools/docmaker/tohtml.py index 012b55e49..bbed87d01 100644 --- a/src/tools/docmaker/tohtml.py +++ b/src/tools/docmaker/tohtml.py @@ -25,7 +25,7 @@ import time # The following strings define the HTML header used by all generated pages. html_header_1 = """\ +"https://www.w3.org/TR/html4/loose.dtd"> diff --git a/src/tools/ftfuzzer/README b/src/tools/ftfuzzer/README index 20336ae2e..a41f96866 100644 --- a/src/tools/ftfuzzer/README +++ b/src/tools/ftfuzzer/README @@ -6,7 +6,7 @@ ftfuzzer.cc ----------- This file contains a target function for FreeType fuzzing. It can be -used with libFuzzer (http://llvm.org/docs/LibFuzzer.html) or +used with libFuzzer (https://llvm.org/docs/LibFuzzer.html) or potentially any other similar fuzzer. Usage: @@ -20,7 +20,7 @@ Usage: -fsanitize=address,signed-integer-overflow,shift You also need the header files from the `libarchive' library - (http://www.libarchive.org/) for handling tar files (see file + (https://www.libarchive.org/) for handling tar files (see file `ftmutator.cc' below for more). 2. Link with `libFuzzer' (it contains `main') and `libarchive'. diff --git a/src/tools/glnames.py b/src/tools/glnames.py index 3270eebb3..1d8d524a5 100644 --- a/src/tools/glnames.py +++ b/src/tools/glnames.py @@ -151,7 +151,7 @@ mac_standard_names = \ # The list of standard `SID' glyph names. For the official list, # see Annex A of document at # -# http://partners.adobe.com/public/developer/en/font/5176.CFF.pdf . +# https://www.adobe.com/content/dam/acom/en/devnet/font/pdfs/5176.CFF.pdf . # sid_standard_names = \ [ diff --git a/src/type1/t1objs.c b/src/type1/t1objs.c index c6bae004a..9e78f29f0 100644 --- a/src/type1/t1objs.c +++ b/src/type1/t1objs.c @@ -380,7 +380,7 @@ /* simplistic and might get some things wrong. For a full-featured */ /* algorithm you might have a look at the whitepaper given at */ /* */ - /* http://blogs.msdn.com/text/archive/2007/04/23/wpf-font-selection-model.aspx */ + /* https://blogs.msdn.com/text/archive/2007/04/23/wpf-font-selection-model.aspx */ /* get style name -- be careful, some broken fonts only */ /* have a `/FontName' dictionary entry! */ From 71fecc539e135d2f5a0295e433693f8090811e26 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Tue, 5 Dec 2017 12:06:29 +0100 Subject: [PATCH 351/470] Improve tracing messages by using singular and plural forms. * src/*/*.c: Implement it. --- ChangeLog | 6 ++++++ src/cff/cffdrivr.c | 12 ++++++++---- src/cff/cffload.c | 4 +++- src/cff/cffparse.c | 4 +++- src/pcf/pcfread.c | 6 ++++-- src/pfr/pfrgload.c | 10 +++++++--- src/sfnt/ttsbit.c | 5 +++-- src/smooth/ftgrays.c | 7 +++++-- src/truetype/ttgxvar.c | 26 ++++++++++++++++++-------- src/truetype/ttinterp.c | 4 +++- 10 files changed, 60 insertions(+), 24 deletions(-) diff --git a/ChangeLog b/ChangeLog index fbb6d3b0f..f1b606700 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2017-12-05 Werner Lemberg + + Improve tracing messages by using singular and plural forms. + + * src/*/*.c: Implement it. + 2017-12-04 Werner Lemberg [truetype] Allow shared points in `cvar' table (#52532). diff --git a/src/cff/cffdrivr.c b/src/cff/cffdrivr.c index cf630a8a1..d0856919d 100644 --- a/src/cff/cffdrivr.c +++ b/src/cff/cffdrivr.c @@ -240,8 +240,10 @@ &dummy, &ah ); - FT_TRACE5(( " idx %d: advance height %d font units\n", - start + nn, ah )); + FT_TRACE5(( " idx %d: advance height %d font unit%s\n", + start + nn, + ah, + ah == 1 ? "" : "s" )); advances[nn] = ah; } } @@ -269,8 +271,10 @@ &dummy, &aw ); - FT_TRACE5(( " idx %d: advance width %d font units\n", - start + nn, aw )); + FT_TRACE5(( " idx %d: advance width %d font unit%s\n", + start + nn, + aw, + aw == 1 ? "" : "s" )); advances[nn] = aw; } } diff --git a/src/cff/cffload.c b/src/cff/cffload.c index e8479d48f..76e0cdd7c 100644 --- a/src/cff/cffload.c +++ b/src/cff/cffload.c @@ -1297,7 +1297,9 @@ if ( numOperands > count ) { - FT_TRACE4(( " cff_blend_doBlend: Stack underflow %d args\n", count )); + FT_TRACE4(( " cff_blend_doBlend: Stack underflow %d argument%s\n", + count, + count == 1 ? "" : "s" )); error = FT_THROW( Stack_Underflow ); goto Exit; diff --git a/src/cff/cffparse.c b/src/cff/cffparse.c index e4e2bcd0b..325948e59 100644 --- a/src/cff/cffparse.c +++ b/src/cff/cffparse.c @@ -949,7 +949,9 @@ goto Exit; } - FT_TRACE4(( " %d values blended\n", numBlends )); + FT_TRACE4(( " %d value%s blended\n", + numBlends, + numBlends == 1 ? "" : "s" )); error = cff_blend_doBlend( subFont, parser, numBlends ); diff --git a/src/pcf/pcfread.c b/src/pcf/pcfread.c index da216b05f..537da0dc7 100644 --- a/src/pcf/pcfread.c +++ b/src/pcf/pcfread.c @@ -840,7 +840,7 @@ THE SOFTWARE. FT_TRACE4(( "pcf_get_bitmaps:\n" " format: 0x%lX\n" " (%s, %s,\n" - " padding=%d bits, scanning=%d bits)\n", + " padding=%d bit%s, scanning=%d bit%s)\n", format, PCF_BYTE_ORDER( format ) == MSBFirst ? "most significant byte first" @@ -849,7 +849,9 @@ THE SOFTWARE. ? "most significant bit first" : "least significant bit first", 8 << PCF_GLYPH_PAD_INDEX( format ), - 8 << PCF_SCAN_UNIT_INDEX( format ) )); + ( 8 << PCF_GLYPH_PAD_INDEX( format ) ) == 1 ? "" : "s", + 8 << PCF_SCAN_UNIT_INDEX( format ), + ( 8 << PCF_SCAN_UNIT_INDEX( format ) ) == 1 ? "" : "s" )); if ( !PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) ) return FT_THROW( Invalid_File_Format ); diff --git a/src/pfr/pfrgload.c b/src/pfr/pfrgload.c index 93f5fc709..98efb9ed0 100644 --- a/src/pfr/pfrgload.c +++ b/src/pfr/pfrgload.c @@ -756,8 +756,10 @@ count = glyph->num_subs - old_count; - FT_TRACE4(( "compound glyph with %d elements (offset %lu):\n", - count, offset )); + FT_TRACE4(( "compound glyph with %d element%s (offset %lu):\n", + count, + count == 1 ? "" : "s", + offset )); /* now, load each individual glyph */ for ( n = 0; n < count; n++ ) @@ -810,7 +812,9 @@ /* proceed to next sub-glyph */ } - FT_TRACE4(( "end compound glyph with %d elements\n", count )); + FT_TRACE4(( "end compound glyph with %d element%s\n", + count, + count == 1 ? "" : "s" )); } else { diff --git a/src/sfnt/ttsbit.c b/src/sfnt/ttsbit.c index f41847b0a..c55c4990b 100644 --- a/src/sfnt/ttsbit.c +++ b/src/sfnt/ttsbit.c @@ -1007,8 +1007,9 @@ goto Fail; } - FT_TRACE3(( "tt_sbit_decoder_load_compound: loading %d components\n", - num_components )); + FT_TRACE3(( "tt_sbit_decoder_load_compound: loading %d component%s\n", + num_components, + num_components == 1 ? "" : "s" )); for ( nn = 0; nn < num_components; nn++ ) { diff --git a/src/smooth/ftgrays.c b/src/smooth/ftgrays.c index 6a230a6f4..d43dd457d 100644 --- a/src/smooth/ftgrays.c +++ b/src/smooth/ftgrays.c @@ -1718,8 +1718,11 @@ typedef ptrdiff_t FT_PtrDist; if ( !ras.invalid ) gray_record_cell( RAS_VAR ); - FT_TRACE7(( "band [%d..%d]: %d cells\n", - ras.min_ey, ras.max_ey, ras.num_cells )); + FT_TRACE7(( "band [%d..%d]: %d cell%s\n", + ras.min_ey, + ras.max_ey, + ras.num_cells, + ras.num_cells == 1 ? "" : "s" )); } else { diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c index 4ff16570f..9aa4825b3 100644 --- a/src/truetype/ttgxvar.c +++ b/src/truetype/ttgxvar.c @@ -1043,10 +1043,11 @@ outerIndex, innerIndex ); - FT_TRACE5(( "%s value %d adjusted by %d units (%s)\n", + FT_TRACE5(( "%s value %d adjusted by %d unit%s (%s)\n", vertical ? "vertical height" : "horizontal width", *avalue, delta, + delta == 1 ? "" : "s", vertical ? "VVAR" : "HVAR" )); *avalue += delta; @@ -1333,13 +1334,15 @@ if ( p ) { - FT_TRACE5(( "value %c%c%c%c (%d units) adjusted by %d units (MVAR)\n", + FT_TRACE5(( "value %c%c%c%c (%d unit%s) adjusted by %d unit%s (MVAR)\n", (FT_Char)( value->tag >> 24 ), (FT_Char)( value->tag >> 16 ), (FT_Char)( value->tag >> 8 ), (FT_Char)( value->tag ), value->unmodified, - delta )); + value->unmodified == 1 ? "" : "s", + delta, + delta == 1 ? "" : "s" )); /* since we handle both signed and unsigned values as FT_Short, */ /* ensure proper overflow arithmetic */ @@ -1499,8 +1502,10 @@ blend->gv_glyphcnt = gvar_head.glyphCount; offsetToData = gvar_start + gvar_head.offsetToData; - FT_TRACE5(( "gvar: there are %d shared coordinates:\n", - blend->tuplecount )); + FT_TRACE5(( "gvar: there %s %d shared coordinate%s:\n", + blend->tuplecount == 1 ? "is" : "are", + blend->tuplecount, + blend->tuplecount == 1 ? "" : "s" )); if ( FT_NEW_ARRAY( blend->glyphoffsets, blend->gv_glyphcnt + 1 ) ) goto Exit; @@ -3027,7 +3032,10 @@ FT_Stream_SeekSet( stream, here ); } - FT_TRACE5(( "cvar: there are %d tuples:\n", tupleCount & 0xFFF )); + FT_TRACE5(( "cvar: there %s %d tuple%s:\n", + ( tupleCount & 0xFFF ) == 1 ? "is" : "are", + tupleCount & 0xFFF, + ( tupleCount & 0xFFF ) == 1 ? "" : "s" )); for ( i = 0; i < ( tupleCount & 0xFFF ); i++ ) { @@ -3517,8 +3525,10 @@ FT_Stream_SeekSet( stream, here ); } - FT_TRACE5(( "gvar: there are %d tuples:\n", - tupleCount & GX_TC_TUPLE_COUNT_MASK )); + FT_TRACE5(( "gvar: there %s %d tuple%s:\n", + ( tupleCount & GX_TC_TUPLE_COUNT_MASK ) == 1 ? "is" : "are", + tupleCount & GX_TC_TUPLE_COUNT_MASK, + ( tupleCount & GX_TC_TUPLE_COUNT_MASK ) == 1 ? "" : "s" )); for ( j = 0; j < n_points; j++ ) points_org[j] = outline->points[j]; diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c index 2bb43ec06..bb45655e4 100644 --- a/src/truetype/ttinterp.c +++ b/src/truetype/ttinterp.c @@ -8486,7 +8486,9 @@ } while ( !exc->instruction_trap ); LNo_Error_: - FT_TRACE4(( " %d instructions executed\n", ins_counter )); + FT_TRACE4(( " %d instruction%s executed\n", + ins_counter == 1 ? "" : "s", + ins_counter )); return FT_Err_Ok; LErrorCodeOverflow_: From ed7f091323d0de6e45c657f66d616681fbf8d30f Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Wed, 6 Dec 2017 23:15:54 +0100 Subject: [PATCH 352/470] New header file `ftparams.h' that collects all parameter tags. * include/freetype/config/ftheader.h (FT_PARAMETER_TAGS_H): New macro. (FT_TRUETYPE_UNPATENTED_H, FT_UNPATENTED_HINTING_H): Define it to `ftparams.h'. * include/freetype/ftautoh.h, include/freetype/ftcffdrv.h, include/freetype/ftincrem.h, include/freetype/ftlcdfil.h, include/freetype/ftsnames.h, include/freetype/ftt1drv.h: Include FT_PARAMETER_TAGS_H. Move FT_PARAM_TAG_XXX definitions to... * include/freetype/ftparams.h: ...this new file. * include/freetype/ttunpat.h: Remove. No longer needed. --- ChangeLog | 18 +++ include/freetype/config/ftheader.h | 5 +- include/freetype/freetype.h | 15 ++- include/freetype/ftautoh.h | 25 +--- include/freetype/ftcffdrv.h | 20 +-- include/freetype/ftchapters.h | 1 + include/freetype/ftincrem.h | 13 +- include/freetype/ftlcdfil.h | 21 +-- include/freetype/ftparams.h | 206 +++++++++++++++++++++++++++++ include/freetype/ftsnames.h | 48 +------ include/freetype/ftt1drv.h | 16 +-- include/freetype/ttunpat.h | 63 --------- 12 files changed, 242 insertions(+), 209 deletions(-) create mode 100644 include/freetype/ftparams.h delete mode 100644 include/freetype/ttunpat.h diff --git a/ChangeLog b/ChangeLog index f1b606700..ef16ae1a7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,21 @@ +2017-12-06 Werner Lemberg + + New header file `ftparams.h' that collects all parameter tags. + + * include/freetype/config/ftheader.h (FT_PARAMETER_TAGS_H): New + macro. + (FT_TRUETYPE_UNPATENTED_H, FT_UNPATENTED_HINTING_H): Define it to + `ftparams.h'. + + * include/freetype/ftautoh.h, include/freetype/ftcffdrv.h, + include/freetype/ftincrem.h, include/freetype/ftlcdfil.h, + include/freetype/ftsnames.h, include/freetype/ftt1drv.h: Include + FT_PARAMETER_TAGS_H. + Move FT_PARAM_TAG_XXX definitions to... + * include/freetype/ftparams.h: ...this new file. + + * include/freetype/ttunpat.h: Remove. No longer needed. + 2017-12-05 Werner Lemberg Improve tracing messages by using singular and plural forms. diff --git a/include/freetype/config/ftheader.h b/include/freetype/config/ftheader.h index ce3b7eeb6..2c2258f1e 100644 --- a/include/freetype/config/ftheader.h +++ b/include/freetype/config/ftheader.h @@ -781,7 +781,7 @@ * @description: * Deprecated. */ -#define FT_UNPATENTED_HINTING_H +#define FT_UNPATENTED_HINTING_H /************************************************************************* @@ -823,6 +823,7 @@ /* */ #define FT_ERROR_DEFINITIONS_H +#define FT_PARAMETER_TAGS_H /* The internals of the cache sub-system are no longer exposed. We */ @@ -840,7 +841,7 @@ #define FT_INCREMENTAL_H -#define FT_TRUETYPE_UNPATENTED_H +#define FT_TRUETYPE_UNPATENTED_H /* diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h index 96a8dcc64..fb46fbd39 100644 --- a/include/freetype/freetype.h +++ b/include/freetype/freetype.h @@ -3795,17 +3795,18 @@ FT_BEGIN_HEADER * Note that only a subset of the available properties can be * controlled. * - * * Stem darkening (@FT_PARAM_TAG_STEM_DARKENING, corresponding to the - * property `no-stem-darkening' provided by the `autofit' and `cff' - * modules; see @no-stem-darkening[autofit] and + * * @FT_PARAM_TAG_STEM_DARKENING (stem darkening, corresponding to the + * property `no-stem-darkening' provided by the `autofit', `cff', + * `type1', and `t1cid' modules; see @no-stem-darkening[autofit] and * @no-stem-darkening[cff]). * - * * LCD filter weights (@FT_PARAM_TAG_LCD_FILTER_WEIGHTS, corresponding + * * @FT_PARAM_TAG_LCD_FILTER_WEIGHTS (LCD filter weights, corresponding * to function @FT_Library_SetLcdFilterWeights). * - * * Seed value for the CFF `random' operator - * (@FT_PARAM_TAG_RANDOM_SEED, corresponding to the `random-seed' - * property provided by the `cff' module; see @random-seed). + * * @FT_PARAM_TAG_RANDOM_SEED (seed value for the CFF, Type~1, and CID + * `random' operator, corresponding to the `random-seed' property + * provided by the `cff', `type1', and `t1cid' modules; see + * @random-seed). * * Pass NULL as `data' in @FT_Parameter for a given tag to reset the * option and use the library or module default again. diff --git a/include/freetype/ftautoh.h b/include/freetype/ftautoh.h index 60fadea4b..878e4589a 100644 --- a/include/freetype/ftautoh.h +++ b/include/freetype/ftautoh.h @@ -21,6 +21,7 @@ #include #include FT_FREETYPE_H +#include FT_PARAMETER_TAGS_H #ifdef FREETYPE_H #error "freetype.h of FreeType 1 has been loaded!" @@ -501,30 +502,6 @@ FT_BEGIN_HEADER */ - /************************************************************************** - * - * @constant: - * FT_PARAM_TAG_STEM_DARKENING - * - * @description: - * An @FT_Parameter tag to be used with @FT_Face_Properties. The - * corresponding Boolean argument specifies whether to apply stem - * darkening, overriding the global default values or the values set up - * with @FT_Property_Set (see @no-stem-darkening[autofit] and - * @no-stem-darkening[cff]). - * - * This is a passive setting that only takes effect if the font driver - * or autohinter honors it, which the CFF driver always does, but the - * autohinter only in `light' hinting mode (as of version 2.7.0). - * - * @since: - * 2.8 - * - */ -#define FT_PARAM_TAG_STEM_DARKENING \ - FT_MAKE_TAG( 'd', 'a', 'r', 'k' ) - - /************************************************************************** * * @property: diff --git a/include/freetype/ftcffdrv.h b/include/freetype/ftcffdrv.h index f1e9452bf..51acf4a00 100644 --- a/include/freetype/ftcffdrv.h +++ b/include/freetype/ftcffdrv.h @@ -21,6 +21,7 @@ #include #include FT_FREETYPE_H +#include FT_PARAMETER_TAGS_H #ifdef FREETYPE_H #error "freetype.h of FreeType 1 has been loaded!" @@ -309,25 +310,6 @@ FT_BEGIN_HEADER */ - /************************************************************************** - * - * @constant: - * FT_PARAM_TAG_RANDOM_SEED - * - * @description: - * An @FT_Parameter tag to be used with @FT_Face_Properties. The - * corresponding 32bit signed integer argument overrides the CFF - * module's random seed value with a face-specific one; see - * @random-seed. - * - * @since: - * 2.8 - * - */ -#define FT_PARAM_TAG_RANDOM_SEED \ - FT_MAKE_TAG( 's', 'e', 'e', 'd' ) - - /* */ diff --git a/include/freetype/ftchapters.h b/include/freetype/ftchapters.h index a0a121b0a..75747cd23 100644 --- a/include/freetype/ftchapters.h +++ b/include/freetype/ftchapters.h @@ -60,6 +60,7 @@ /* pfr_fonts */ /* winfnt_fonts */ /* font_formats */ +/* parameter_tags */ /* gasp_table */ /* */ /***************************************************************************/ diff --git a/include/freetype/ftincrem.h b/include/freetype/ftincrem.h index f6ae2baed..0204b25a2 100644 --- a/include/freetype/ftincrem.h +++ b/include/freetype/ftincrem.h @@ -21,6 +21,7 @@ #include #include FT_FREETYPE_H +#include FT_PARAMETER_TAGS_H #ifdef FREETYPE_H #error "freetype.h of FreeType 1 has been loaded!" @@ -331,18 +332,6 @@ FT_BEGIN_HEADER typedef FT_Incremental_InterfaceRec* FT_Incremental_Interface; - /*************************************************************************** - * - * @constant: - * FT_PARAM_TAG_INCREMENTAL - * - * @description: - * A constant used as the tag of @FT_Parameter structures to indicate - * an incremental loading object to be used by FreeType. - * - */ -#define FT_PARAM_TAG_INCREMENTAL FT_MAKE_TAG( 'i', 'n', 'c', 'r' ) - /* */ diff --git a/include/freetype/ftlcdfil.h b/include/freetype/ftlcdfil.h index df1d7ccfa..37a930523 100644 --- a/include/freetype/ftlcdfil.h +++ b/include/freetype/ftlcdfil.h @@ -22,6 +22,7 @@ #include #include FT_FREETYPE_H +#include FT_PARAMETER_TAGS_H #ifdef FREETYPE_H #error "freetype.h of FreeType 1 has been loaded!" @@ -280,26 +281,6 @@ FT_BEGIN_HEADER unsigned char *weights ); - /************************************************************************** - * - * @constant: - * FT_PARAM_TAG_LCD_FILTER_WEIGHTS - * - * @description: - * An @FT_Parameter tag to be used with @FT_Face_Properties. The - * corresponding argument specifies the five LCD filter weights for a - * given face (if using @FT_LOAD_TARGET_LCD, for example), overriding - * the global default values or the values set up with - * @FT_Library_SetLcdFilterWeights. - * - * @since: - * 2.8 - * - */ -#define FT_PARAM_TAG_LCD_FILTER_WEIGHTS \ - FT_MAKE_TAG( 'l', 'c', 'd', 'f' ) - - /* * @type: * FT_LcdFiveTapFilter diff --git a/include/freetype/ftparams.h b/include/freetype/ftparams.h new file mode 100644 index 000000000..992b35026 --- /dev/null +++ b/include/freetype/ftparams.h @@ -0,0 +1,206 @@ +/***************************************************************************/ +/* */ +/* ftparams.h */ +/* */ +/* FreeType API for possible FT_Parameter tags (specification only). */ +/* */ +/* Copyright 2017 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef FTPARAMS_H_ +#define FTPARAMS_H_ + +#include +#include FT_FREETYPE_H + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + + /************************************************************************** + * + * @section: + * parameter_tags + * + * @title: + * Parameter Tags + * + * @abstract: + * Macros for driver property and font loading parameter tags. + * + * @description: + * This section contains macros for the @FT_Parameter structure that are + * used with various functions to activate some special functionality or + * different behaviour of various components of FreeType. + * + */ + + + /*************************************************************************** + * + * @constant: + * FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_FAMILY + * + * @description: + * A tag for @FT_Parameter to make @FT_Open_Face ignore typographic + * family names in the `name' table (introduced in OpenType version + * 1.4). Use this for backward compatibility with legacy systems that + * have a four-faces-per-family restriction. + * + * @since: + * 2.8 + * + */ +#define FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_FAMILY \ + FT_MAKE_TAG( 'i', 'g', 'p', 'f' ) + + + /* this constant is deprecated */ +#define FT_PARAM_TAG_IGNORE_PREFERRED_FAMILY \ + FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_FAMILY + + + /*************************************************************************** + * + * @constant: + * FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_SUBFAMILY + * + * @description: + * A tag for @FT_Parameter to make @FT_Open_Face ignore typographic + * subfamily names in the `name' table (introduced in OpenType version + * 1.4). Use this for backward compatibility with legacy systems that + * have a four-faces-per-family restriction. + * + * @since: + * 2.8 + * + */ +#define FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_SUBFAMILY \ + FT_MAKE_TAG( 'i', 'g', 'p', 's' ) + + + /* this constant is deprecated */ +#define FT_PARAM_TAG_IGNORE_PREFERRED_SUBFAMILY \ + FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_SUBFAMILY + + + /*************************************************************************** + * + * @constant: + * FT_PARAM_TAG_INCREMENTAL + * + * @description: + * An @FT_Parameter tag to be used with @FT_Open_Face to indicate + * incremental glyph loading. + * + */ +#define FT_PARAM_TAG_INCREMENTAL \ + FT_MAKE_TAG( 'i', 'n', 'c', 'r' ) + + + /************************************************************************** + * + * @constant: + * FT_PARAM_TAG_LCD_FILTER_WEIGHTS + * + * @description: + * An @FT_Parameter tag to be used with @FT_Face_Properties. The + * corresponding argument specifies the five LCD filter weights for a + * given face (if using @FT_LOAD_TARGET_LCD, for example), overriding + * the global default values or the values set up with + * @FT_Library_SetLcdFilterWeights. + * + * @since: + * 2.8 + * + */ +#define FT_PARAM_TAG_LCD_FILTER_WEIGHTS \ + FT_MAKE_TAG( 'l', 'c', 'd', 'f' ) + + + /************************************************************************** + * + * @constant: + * FT_PARAM_TAG_RANDOM_SEED + * + * @description: + * An @FT_Parameter tag to be used with @FT_Face_Properties. The + * corresponding 32bit signed integer argument overrides the font + * driver's random seed value with a face-specific one; see + * @random-seed. + * + * @since: + * 2.8 + * + */ +#define FT_PARAM_TAG_RANDOM_SEED \ + FT_MAKE_TAG( 's', 'e', 'e', 'd' ) + + + /************************************************************************** + * + * @constant: + * FT_PARAM_TAG_STEM_DARKENING + * + * @description: + * An @FT_Parameter tag to be used with @FT_Face_Properties. The + * corresponding Boolean argument specifies whether to apply stem + * darkening, overriding the global default values or the values set up + * with @FT_Property_Set (see @no-stem-darkening[autofit] and + * @no-stem-darkening[cff]). + * + * This is a passive setting that only takes effect if the font driver + * or autohinter honors it, which the CFF, Type~1, and CID drivers + * always do, but the autohinter only in `light' hinting mode (as of + * version 2.8.2). + * + * @since: + * 2.8 + * + */ +#define FT_PARAM_TAG_STEM_DARKENING \ + FT_MAKE_TAG( 'd', 'a', 'r', 'k' ) + + + /*************************************************************************** + * + * @constant: + * FT_PARAM_TAG_UNPATENTED_HINTING + * + * @description: + * Deprecated, no effect. + * + * Previously: A constant used as the tag of an @FT_Parameter structure to + * indicate that unpatented methods only should be used by the TrueType + * bytecode interpreter for a typeface opened by @FT_Open_Face. + * + */ +#define FT_PARAM_TAG_UNPATENTED_HINTING \ + FT_MAKE_TAG( 'u', 'n', 'p', 'a' ) + + + /* */ + + +FT_END_HEADER + + +#endif /* FTPARAMS_H_ */ + + +/* END */ diff --git a/include/freetype/ftsnames.h b/include/freetype/ftsnames.h index d524ad74c..fc1d5a91f 100644 --- a/include/freetype/ftsnames.h +++ b/include/freetype/ftsnames.h @@ -25,6 +25,7 @@ #include #include FT_FREETYPE_H +#include FT_PARAMETER_TAGS_H #ifdef FREETYPE_H #error "freetype.h of FreeType 1 has been loaded!" @@ -241,53 +242,6 @@ FT_BEGIN_HEADER FT_SfntLangTag *alangTag ); - /*************************************************************************** - * - * @constant: - * FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_FAMILY - * - * @description: - * A tag for @FT_Parameter to make @FT_Open_Face ignore typographic - * family names in the `name' table (introduced in OpenType version - * 1.4). Use this for backward compatibility with legacy systems that - * have a four-faces-per-family restriction. - * - * @since: - * 2.8 - * - */ -#define FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_FAMILY \ - FT_MAKE_TAG( 'i', 'g', 'p', 'f' ) - - - /* this constant is deprecated */ -#define FT_PARAM_TAG_IGNORE_PREFERRED_FAMILY \ - FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_FAMILY - - - /*************************************************************************** - * - * @constant: - * FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_SUBFAMILY - * - * @description: - * A tag for @FT_Parameter to make @FT_Open_Face ignore typographic - * subfamily names in the `name' table (introduced in OpenType version - * 1.4). Use this for backward compatibility with legacy systems that - * have a four-faces-per-family restriction. - * - * @since: - * 2.8 - * - */ -#define FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_SUBFAMILY \ - FT_MAKE_TAG( 'i', 'g', 'p', 's' ) - - - /* this constant is deprecated */ -#define FT_PARAM_TAG_IGNORE_PREFERRED_SUBFAMILY \ - FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_SUBFAMILY - /* */ diff --git a/include/freetype/ftt1drv.h b/include/freetype/ftt1drv.h index e082f6b4a..a8e6b0808 100644 --- a/include/freetype/ftt1drv.h +++ b/include/freetype/ftt1drv.h @@ -21,6 +21,7 @@ #include #include FT_FREETYPE_H +#include FT_PARAMETER_TAGS_H #ifdef FREETYPE_H #error "freetype.h of FreeType 1 has been loaded!" @@ -96,21 +97,6 @@ FT_BEGIN_HEADER #define FT_T1_HINTING_ADOBE 1 - /************************************************************************** - * - * @constant: - * FT_PARAM_TAG_RANDOM_SEED - * - * @description: - * An @FT_Parameter tag to be used with @FT_Face_Properties. The - * corresponding 32bit signed integer argument overrides the CFF - * module's random seed value with a face-specific one; see - * @random-seed. - * - */ -#define FT_PARAM_TAG_RANDOM_SEED \ - FT_MAKE_TAG( 's', 'e', 'e', 'd' ) - /* */ diff --git a/include/freetype/ttunpat.h b/include/freetype/ttunpat.h deleted file mode 100644 index f5e417089..000000000 --- a/include/freetype/ttunpat.h +++ /dev/null @@ -1,63 +0,0 @@ -/***************************************************************************/ -/* */ -/* ttunpat.h */ -/* */ -/* Definitions for the unpatented TrueType hinting system. */ -/* Obsolete, retained for backward compatibility. */ -/* */ -/* Copyright 2003-2017 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* Written by Graham Asher */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef TTUNPAT_H_ -#define TTUNPAT_H_ - - -#include -#include FT_FREETYPE_H - -#ifdef FREETYPE_H -#error "freetype.h of FreeType 1 has been loaded!" -#error "Please fix the directory search order for header files" -#error "so that freetype.h of FreeType 2 is found first." -#endif - - -FT_BEGIN_HEADER - - - /*************************************************************************** - * - * @constant: - * FT_PARAM_TAG_UNPATENTED_HINTING - * - * @description: - * Deprecated. - * - * Previously: A constant used as the tag of an @FT_Parameter structure to - * indicate that unpatented methods only should be used by the TrueType - * bytecode interpreter for a typeface opened by @FT_Open_Face. - * - */ -#define FT_PARAM_TAG_UNPATENTED_HINTING FT_MAKE_TAG( 'u', 'n', 'p', 'a' ) - - /* */ - - -FT_END_HEADER - - -#endif /* TTUNPAT_H_ */ - - -/* END */ From b85ff5641739303f4426293e24cc81f4d33dbb54 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Wed, 6 Dec 2017 23:17:23 +0100 Subject: [PATCH 353/470] * builds/symbian/bld.inf: Updated. --- ChangeLog | 4 ++++ builds/symbian/bld.inf | 10 ++++++++-- builds/symbian/freetype.mmp | 10 +++++----- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index ef16ae1a7..af8a078e4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2017-12-06 Werner Lemberg + + * builds/symbian/bld.inf: Updated. + 2017-12-06 Werner Lemberg New header file `ftparams.h' that collects all parameter tags. diff --git a/builds/symbian/bld.inf b/builds/symbian/bld.inf index 8087202c2..276839d82 100644 --- a/builds/symbian/bld.inf +++ b/builds/symbian/bld.inf @@ -25,10 +25,14 @@ PRJ_EXPORTS ../../include/freetype/config/ftoption.h config/ftoption.h ../../include/freetype/config/ftstdlib.h config/ftstdlib.h ../../include/freetype/freetype.h freetype.h +../../include/freetype/ftadvanc.h ftadvanc.h +../../include/freetype/ftautoh.h ftautoh.h ../../include/freetype/ftbbox.h ftbbox.h ../../include/freetype/ftbdf.h ftbdf.h ../../include/freetype/ftbitmap.h ftbitmap.h +../../include/freetype/ftbzip2.h ftbzip2.h ../../include/freetype/ftcache.h ftcache.h +../../include/freetype/ftcffdrv.h ftcffdrv.h ../../include/freetype/ftcid.h ftcid.h ../../include/freetype/fterrdef.h fterrdef.h ../../include/freetype/fterrors.h fterrors.h @@ -37,7 +41,6 @@ PRJ_EXPORTS ../../include/freetype/ftglyph.h ftglyph.h ../../include/freetype/ftgxval.h ftgxval.h ../../include/freetype/ftgzip.h ftgzip.h -../../include/freetype/ftbzip2.h ftbzip2.h ../../include/freetype/ftimage.h ftimage.h ../../include/freetype/ftincrem.h ftincrem.h ../../include/freetype/ftlcdfil.h ftlcdfil.h @@ -49,6 +52,8 @@ PRJ_EXPORTS ../../include/freetype/ftmoderr.h ftmoderr.h ../../include/freetype/ftotval.h ftotval.h ../../include/freetype/ftoutln.h ftoutln.h +../../include/freetype/ftparams.h ftparams.h +../../include/freetype/ftpcfdrv.h ftpcfdrv.h ../../include/freetype/ftpfr.h ftpfr.h ../../include/freetype/ftrender.h ftrender.h ../../include/freetype/ftsizes.h ftsizes.h @@ -56,11 +61,12 @@ PRJ_EXPORTS ../../include/freetype/ftstroke.h ftstroke.h ../../include/freetype/ftsynth.h ftsynth.h ../../include/freetype/ftsystem.h ftsystem.h +../../include/freetype/ftt1drv.h ftt1drv.h ../../include/freetype/fttrigon.h fttrigon.h +../../include/freetype/ftttdrv.h ftttdrv.h ../../include/freetype/fttypes.h fttypes.h ../../include/freetype/ftwinfnt.h ftwinfnt.h ../../include/freetype/t1tables.h t1tables.h ../../include/freetype/ttnameid.h ttnameid.h ../../include/freetype/tttables.h tttables.h ../../include/freetype/tttags.h tttags.h -../../include/freetype/ttunpat.h ttunpat.h diff --git a/builds/symbian/freetype.mmp b/builds/symbian/freetype.mmp index 6fe73332d..cc69aca4e 100644 --- a/builds/symbian/freetype.mmp +++ b/builds/symbian/freetype.mmp @@ -49,6 +49,10 @@ sourcepath ..\..\src\bdf source bdf.c +sourcepath ..\..\src\bzip2 + +source ftbzip2.c + sourcepath ..\..\src\cache source ftcache.c @@ -65,10 +69,6 @@ sourcepath ..\..\src\gzip source ftgzip.c -sourcepath ..\..\src\bzip2 - -source ftbzip2.c - sourcepath ..\..\src\lzw source ftlzw.c @@ -126,12 +126,12 @@ systeminclude ..\..\include systeminclude \epoc32\include\stdapis userinclude ..\..\src\autofit userinclude ..\..\src\bdf +userinclude ..\..\src\bzip2 userinclude ..\..\src\cache userinclude ..\..\src\cff userinclude ..\..\src\cid userinclude ..\..\src\gxvalid userinclude ..\..\src\gzip -userinclude ..\..\src\bzip2 userinclude ..\..\src\lzw userinclude ..\..\src\otvalid userinclude ..\..\src\pcf From 7ec1345d1342c256576b98274f6d169369c340bb Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Thu, 7 Dec 2017 14:21:39 +0100 Subject: [PATCH 354/470] * include/freetype/config/ftheader.h: Some clean-up. This commit removes documentation of deprecated macros and does some minor streamlining. --- ChangeLog | 7 +++ include/freetype/config/ftheader.h | 96 +++++------------------------- 2 files changed, 23 insertions(+), 80 deletions(-) diff --git a/ChangeLog b/ChangeLog index af8a078e4..0270d98ad 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2017-12-07 Werner Lemberg + + * include/freetype/config/ftheader.h: Some clean-up. + + This commit removes documentation of deprecated macros and does some + minor streamlining. + 2017-12-06 Werner Lemberg * builds/symbian/bld.inf: Updated. diff --git a/include/freetype/config/ftheader.h b/include/freetype/config/ftheader.h index 2c2258f1e..acf6b744d 100644 --- a/include/freetype/config/ftheader.h +++ b/include/freetype/config/ftheader.h @@ -567,63 +567,6 @@ #define FT_CACHE_H - /************************************************************************* - * - * @macro: - * FT_CACHE_IMAGE_H - * - * @description: - * A macro used in #include statements to name the file containing the - * `glyph image' API of the FreeType~2 cache sub-system. - * - * It is used to define a cache for @FT_Glyph elements. You can also - * use the API defined in @FT_CACHE_SMALL_BITMAPS_H if you only need to - * store small glyph bitmaps, as it will use less memory. - * - * This macro is deprecated. Simply include @FT_CACHE_H to have all - * glyph image-related cache declarations. - * - */ -#define FT_CACHE_IMAGE_H FT_CACHE_H - - - /************************************************************************* - * - * @macro: - * FT_CACHE_SMALL_BITMAPS_H - * - * @description: - * A macro used in #include statements to name the file containing the - * `small bitmaps' API of the FreeType~2 cache sub-system. - * - * It is used to define a cache for small glyph bitmaps in a relatively - * memory-efficient way. You can also use the API defined in - * @FT_CACHE_IMAGE_H if you want to cache arbitrary glyph images, - * including scalable outlines. - * - * This macro is deprecated. Simply include @FT_CACHE_H to have all - * small bitmaps-related cache declarations. - * - */ -#define FT_CACHE_SMALL_BITMAPS_H FT_CACHE_H - - - /************************************************************************* - * - * @macro: - * FT_CACHE_CHARMAP_H - * - * @description: - * A macro used in #include statements to name the file containing the - * `charmap' API of the FreeType~2 cache sub-system. - * - * This macro is deprecated. Simply include @FT_CACHE_H to have all - * charmap-based cache declarations. - * - */ -#define FT_CACHE_CHARMAP_H FT_CACHE_H - - /************************************************************************* * * @macro: @@ -773,17 +716,6 @@ #define FT_LCD_FILTER_H - /************************************************************************* - * - * @macro: - * FT_UNPATENTED_HINTING_H - * - * @description: - * Deprecated. - */ -#define FT_UNPATENTED_HINTING_H - - /************************************************************************* * * @macro: @@ -822,26 +754,30 @@ /* */ + /* These header files don't need to be included by the user. */ #define FT_ERROR_DEFINITIONS_H #define FT_PARAMETER_TAGS_H + /* Deprecated macros. */ +#define FT_UNPATENTED_HINTING_H +#define FT_TRUETYPE_UNPATENTED_H + + /* FT_CACHE_H is the only header file needed for the cache subsystem. */ +#define FT_CACHE_IMAGE_H FT_CACHE_H +#define FT_CACHE_SMALL_BITMAPS_H FT_CACHE_H +#define FT_CACHE_CHARMAP_H FT_CACHE_H /* The internals of the cache sub-system are no longer exposed. We */ /* default to FT_CACHE_H at the moment just in case, but we know of */ /* no rogue client that uses them. */ /* */ -#define FT_CACHE_MANAGER_H -#define FT_CACHE_INTERNAL_MRU_H -#define FT_CACHE_INTERNAL_MANAGER_H -#define FT_CACHE_INTERNAL_CACHE_H -#define FT_CACHE_INTERNAL_GLYPH_H -#define FT_CACHE_INTERNAL_IMAGE_H -#define FT_CACHE_INTERNAL_SBITS_H - - -#define FT_INCREMENTAL_H - -#define FT_TRUETYPE_UNPATENTED_H +#define FT_CACHE_MANAGER_H FT_CACHE_H +#define FT_CACHE_INTERNAL_MRU_H FT_CACHE_H +#define FT_CACHE_INTERNAL_MANAGER_H FT_CACHE_H +#define FT_CACHE_INTERNAL_CACHE_H FT_CACHE_H +#define FT_CACHE_INTERNAL_GLYPH_H FT_CACHE_H +#define FT_CACHE_INTERNAL_IMAGE_H FT_CACHE_H +#define FT_CACHE_INTERNAL_SBITS_H FT_CACHE_H /* From 63b91548e03dee826065c0077de6457b3b7d91c5 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Thu, 7 Dec 2017 14:33:44 +0100 Subject: [PATCH 355/470] Fix `make multi'. * include/freetype/internal/fttrace.h: Remove unused tracing macros. s/pshalgo2/pshalgo/. Add `trace_cffdecode'. * src/pshinter/pshalgo.c (FT_COMPONENT): Updated. * src/cff/cffload.c: Include FT_INTERNAL_POSTSCRIPT_AUX_H. * src/cff/cffobjs.c: Include FT_SERVICE_METRICS_VARIATIONS_H and FT_SERVICE_CFF_TABLE_LOAD_H. * src/cid/cidriver.c: Include FT_INTERNAL_POSTSCRIPT_AUX_H. * src/psaux/cffdecode.c: Include FT_FREETYPE_H and FT_INTERNAL_DEBUG_H. (FT_COMPONENT): Define. * src/psaux/cffdecode.h: Include FT_INTERNAL_POSTSCRIPT_AUX_H. * src/psaux/psauxmod.h: Include FT_INTERNAL_POSTSCRIPT_AUX_H. Declare `cff_builder_funcs' and `ps_builder_funcs'. * src/psaux/psft.c: Include `psobjs.h' and `cffdecode.h'. * src/psaux/psobjs.c : Include `psauxmod.h'. --- ChangeLog | 24 ++++++++++++++++++++++++ include/freetype/internal/fttrace.h | 6 ++---- src/cff/cffload.c | 1 + src/cff/cffobjs.c | 2 ++ src/cid/cidriver.c | 2 ++ src/psaux/cffdecode.c | 13 +++++++++++++ src/psaux/cffdecode.h | 1 + src/psaux/psauxmod.h | 6 ++++++ src/psaux/psft.c | 2 ++ src/psaux/psobjs.c | 1 + src/pshinter/pshalgo.c | 2 +- 11 files changed, 55 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0270d98ad..fd026472c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,27 @@ +2017-12-07 Werner Lemberg + + Fix `make multi'. + + * include/freetype/internal/fttrace.h: Remove unused tracing macros. + s/pshalgo2/pshalgo/. + Add `trace_cffdecode'. + * src/pshinter/pshalgo.c (FT_COMPONENT): Updated. + + * src/cff/cffload.c: Include FT_INTERNAL_POSTSCRIPT_AUX_H. + * src/cff/cffobjs.c: Include FT_SERVICE_METRICS_VARIATIONS_H and + FT_SERVICE_CFF_TABLE_LOAD_H. + + * src/cid/cidriver.c: Include FT_INTERNAL_POSTSCRIPT_AUX_H. + + * src/psaux/cffdecode.c: Include FT_FREETYPE_H and + FT_INTERNAL_DEBUG_H. + (FT_COMPONENT): Define. + * src/psaux/cffdecode.h: Include FT_INTERNAL_POSTSCRIPT_AUX_H. + * src/psaux/psauxmod.h: Include FT_INTERNAL_POSTSCRIPT_AUX_H. + Declare `cff_builder_funcs' and `ps_builder_funcs'. + * src/psaux/psft.c: Include `psobjs.h' and `cffdecode.h'. + * src/psaux/psobjs.c : Include `psauxmod.h'. + 2017-12-07 Werner Lemberg * include/freetype/config/ftheader.h: Some clean-up. diff --git a/include/freetype/internal/fttrace.h b/include/freetype/internal/fttrace.h index caf5fc946..9a922f1ce 100644 --- a/include/freetype/internal/fttrace.h +++ b/include/freetype/internal/fttrace.h @@ -66,20 +66,19 @@ FT_TRACE_DEF( ttgxvar ) /* TrueType GX var handler (ttgxvar.c) */ FT_TRACE_DEF( t1afm ) FT_TRACE_DEF( t1driver ) FT_TRACE_DEF( t1gload ) -FT_TRACE_DEF( t1hint ) FT_TRACE_DEF( t1load ) FT_TRACE_DEF( t1objs ) FT_TRACE_DEF( t1parse ) /* PostScript helper module `psaux' */ FT_TRACE_DEF( t1decode ) +FT_TRACE_DEF( cffdecode ) FT_TRACE_DEF( psobjs ) FT_TRACE_DEF( psconv ) /* PostScript hinting module `pshinter' */ FT_TRACE_DEF( pshrec ) -FT_TRACE_DEF( pshalgo1 ) -FT_TRACE_DEF( pshalgo2 ) +FT_TRACE_DEF( pshalgo ) /* Type 2 driver components */ FT_TRACE_DEF( cffdriver ) @@ -96,7 +95,6 @@ FT_TRACE_DEF( cf2interp ) FT_TRACE_DEF( t42 ) /* CID driver components */ -FT_TRACE_DEF( cidafm ) FT_TRACE_DEF( ciddriver ) FT_TRACE_DEF( cidgload ) FT_TRACE_DEF( cidload ) diff --git a/src/cff/cffload.c b/src/cff/cffload.c index 76e0cdd7c..975f67bee 100644 --- a/src/cff/cffload.c +++ b/src/cff/cffload.c @@ -22,6 +22,7 @@ #include FT_INTERNAL_STREAM_H #include FT_TRUETYPE_TAGS_H #include FT_TYPE1_TABLES_H +#include FT_INTERNAL_POSTSCRIPT_AUX_H #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT #include FT_MULTIPLE_MASTERS_H diff --git a/src/cff/cffobjs.c b/src/cff/cffobjs.c index 983fd2e71..8f26278a8 100644 --- a/src/cff/cffobjs.c +++ b/src/cff/cffobjs.c @@ -30,6 +30,7 @@ #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT #include FT_MULTIPLE_MASTERS_H #include FT_SERVICE_MULTIPLE_MASTERS_H +#include FT_SERVICE_METRICS_VARIATIONS_H #endif #include FT_INTERNAL_CFF_OBJECTS_TYPES_H @@ -41,6 +42,7 @@ #include "cfferrs.h" #include FT_INTERNAL_POSTSCRIPT_AUX_H +#include FT_SERVICE_CFF_TABLE_LOAD_H /*************************************************************************/ diff --git a/src/cid/cidriver.c b/src/cid/cidriver.c index 2ee2707f3..94bf858d3 100644 --- a/src/cid/cidriver.c +++ b/src/cid/cidriver.c @@ -30,6 +30,8 @@ #include FT_SERVICE_PROPERTIES_H #include FT_TYPE1_DRIVER_H +#include FT_INTERNAL_POSTSCRIPT_AUX_H + /*************************************************************************/ /* */ diff --git a/src/psaux/cffdecode.c b/src/psaux/cffdecode.c index 6c4800652..3e18c77a4 100644 --- a/src/psaux/cffdecode.c +++ b/src/psaux/cffdecode.c @@ -17,6 +17,8 @@ #include +#include FT_FREETYPE_H +#include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_SERVICE_H #include FT_SERVICE_CFF_TABLE_LOAD_H @@ -25,6 +27,17 @@ #include "psauxerr.h" + + /*************************************************************************/ + /* */ + /* The macro FT_COMPONENT is used in trace mode. It is an implicit */ + /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */ + /* messages during execution. */ + /* */ +#undef FT_COMPONENT +#define FT_COMPONENT trace_cffdecode + + #ifdef CFF_CONFIG_OPTION_OLD_ENGINE typedef enum CFF_Operator_ diff --git a/src/psaux/cffdecode.h b/src/psaux/cffdecode.h index 15dfa8d62..b05b6fcee 100644 --- a/src/psaux/cffdecode.h +++ b/src/psaux/cffdecode.h @@ -21,6 +21,7 @@ #include +#include FT_INTERNAL_POSTSCRIPT_AUX_H FT_BEGIN_HEADER diff --git a/src/psaux/psauxmod.h b/src/psaux/psauxmod.h index 926f37eba..bc1551e9a 100644 --- a/src/psaux/psauxmod.h +++ b/src/psaux/psauxmod.h @@ -23,6 +23,8 @@ #include #include FT_MODULE_H +#include FT_INTERNAL_POSTSCRIPT_AUX_H + FT_BEGIN_HEADER @@ -31,6 +33,10 @@ FT_BEGIN_HEADER #endif + const CFF_Builder_FuncsRec cff_builder_funcs; + const PS_Builder_FuncsRec ps_builder_funcs; + + FT_EXPORT_VAR( const FT_Module_Class ) psaux_driver_class; diff --git a/src/psaux/psft.c b/src/psaux/psft.c index bd5f831f4..1f750174a 100644 --- a/src/psaux/psft.c +++ b/src/psaux/psft.c @@ -41,6 +41,8 @@ #include "psfont.h" #include "pserror.h" +#include "psobjs.h" +#include "cffdecode.h" #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT #include FT_MULTIPLE_MASTERS_H diff --git a/src/psaux/psobjs.c b/src/psaux/psobjs.c index ee5819903..2b70a2eb6 100644 --- a/src/psaux/psobjs.c +++ b/src/psaux/psobjs.c @@ -27,6 +27,7 @@ #include "psconv.h" #include "psauxerr.h" +#include "psauxmod.h" /*************************************************************************/ diff --git a/src/pshinter/pshalgo.c b/src/pshinter/pshalgo.c index 9ad1a3a02..8e11aed39 100644 --- a/src/pshinter/pshalgo.c +++ b/src/pshinter/pshalgo.c @@ -26,7 +26,7 @@ #undef FT_COMPONENT -#define FT_COMPONENT trace_pshalgo2 +#define FT_COMPONENT trace_pshalgo #ifdef DEBUG_HINTER From d21f995aea766ad1b414575558082f408b939e2f Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Thu, 7 Dec 2017 14:49:03 +0100 Subject: [PATCH 356/470] Fix C++ compilation. * src/psaux/psauxmod.h: Use FT_CALLBACK_TABLE macro where necessary. * src/smooth/ftsmooth.c (ft_smooth_render_generic): Fix warning. --- ChangeLog | 8 ++++++++ src/psaux/psauxmod.h | 3 +++ src/smooth/ftsmooth.c | 2 +- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index fd026472c..bc39aca5b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2017-12-07 Werner Lemberg + + Fix C++ compilation. + + * src/psaux/psauxmod.h: Use FT_CALLBACK_TABLE macro where necessary. + + * src/smooth/ftsmooth.c (ft_smooth_render_generic): Fix warning. + 2017-12-07 Werner Lemberg Fix `make multi'. diff --git a/src/psaux/psauxmod.h b/src/psaux/psauxmod.h index bc1551e9a..2d851c893 100644 --- a/src/psaux/psauxmod.h +++ b/src/psaux/psauxmod.h @@ -33,7 +33,10 @@ FT_BEGIN_HEADER #endif + FT_CALLBACK_TABLE const CFF_Builder_FuncsRec cff_builder_funcs; + + FT_CALLBACK_TABLE const PS_Builder_FuncsRec ps_builder_funcs; diff --git a/src/smooth/ftsmooth.c b/src/smooth/ftsmooth.c index 82627462e..bccc54bbb 100644 --- a/src/smooth/ftsmooth.c +++ b/src/smooth/ftsmooth.c @@ -228,7 +228,7 @@ if ( hmul ) /* lcd */ { FT_Byte* line; - FT_Byte* temp; + FT_Byte* temp = NULL; FT_UInt i, j; unsigned int height = bitmap->rows; From c3cbb440afc45a1b7ef0501eda41e2f4edd9061e Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Thu, 7 Dec 2017 16:26:36 +0100 Subject: [PATCH 357/470] Use ASCII only in public header files (#50858). --- include/freetype/ftbbox.h | 2 +- include/freetype/ftglyph.h | 4 ++-- include/freetype/ftimage.h | 20 ++++++++++---------- include/freetype/ftoutln.h | 6 +++--- include/freetype/ftstroke.h | 10 +++++----- include/freetype/ftwinfnt.h | 2 +- 6 files changed, 22 insertions(+), 22 deletions(-) diff --git a/include/freetype/ftbbox.h b/include/freetype/ftbbox.h index f03bdc1e1..afd99030a 100644 --- a/include/freetype/ftbbox.h +++ b/include/freetype/ftbbox.h @@ -61,7 +61,7 @@ FT_BEGIN_HEADER /* Compute the exact bounding box of an outline. This is slower */ /* than computing the control box. However, it uses an advanced */ /* algorithm that returns _very_ quickly when the two boxes */ - /* coincide. Otherwise, the outline Bézier arcs are traversed to */ + /* coincide. Otherwise, the outline Bezier arcs are traversed to */ /* extract their extrema. */ /* */ /* */ diff --git a/include/freetype/ftglyph.h b/include/freetype/ftglyph.h index db1a2c8ba..ae527d5a6 100644 --- a/include/freetype/ftglyph.h +++ b/include/freetype/ftglyph.h @@ -347,10 +347,10 @@ FT_BEGIN_HEADER /* */ /* */ /* Return a glyph's `control box'. The control box encloses all the */ - /* outline's points, including Bézier control points. Though it */ + /* outline's points, including Bezier control points. Though it */ /* coincides with the exact bounding box for most glyphs, it can be */ /* slightly larger in some situations (like when rotating an outline */ - /* that contains Bézier outside arcs). */ + /* that contains Bezier outside arcs). */ /* */ /* Computing the control box is very fast, while getting the bounding */ /* box can take much more time as it needs to walk over all segments */ diff --git a/include/freetype/ftimage.h b/include/freetype/ftimage.h index 968460895..7c41ef45f 100644 --- a/include/freetype/ftimage.h +++ b/include/freetype/ftimage.h @@ -301,11 +301,11 @@ FT_BEGIN_HEADER /* each outline point's type. */ /* */ /* If bit~0 is unset, the point is `off' the curve, */ - /* i.e., a Bézier control point, while it is `on' if */ + /* i.e., a Bezier control point, while it is `on' if */ /* set. */ /* */ /* Bit~1 is meaningful for `off' points only. If set, */ - /* it indicates a third-order Bézier arc control point; */ + /* it indicates a third-order Bezier arc control point; */ /* and a second-order control point if unset. */ /* */ /* If bit~2 is set, bits 5-7 contain the drop-out mode */ @@ -532,7 +532,7 @@ FT_BEGIN_HEADER /* 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 */ + /* A `conic to' is emitted to indicate a second-order Bezier arc in */ /* the outline. */ /* */ /* */ @@ -564,12 +564,12 @@ FT_BEGIN_HEADER /* A function pointer type used to describe the signature of a `cubic */ /* 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 Bezier arc. */ /* */ /* */ - /* control1 :: A pointer to the first Bézier control point. */ + /* control1 :: A pointer to the first Bezier control point. */ /* */ - /* control2 :: A pointer to the second Bézier control point. */ + /* control2 :: A pointer to the second Bezier control point. */ /* */ /* to :: A pointer to the target end point. */ /* */ @@ -595,16 +595,16 @@ FT_BEGIN_HEADER /* */ /* */ /* 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 Beziers. */ /* */ /* */ /* move_to :: The `move to' emitter. */ /* */ /* line_to :: The segment emitter. */ /* */ - /* conic_to :: The second-order Bézier arc emitter. */ + /* conic_to :: The second-order Bezier arc emitter. */ /* */ - /* cubic_to :: The third-order Bézier arc emitter. */ + /* cubic_to :: The third-order Bezier arc emitter. */ /* */ /* shift :: The shift that is applied to coordinates before they */ /* are sent to the emitter. */ @@ -701,7 +701,7 @@ FT_BEGIN_HEADER /* */ /* FT_GLYPH_FORMAT_OUTLINE :: */ /* The glyph image is a vectorial outline made of line segments */ - /* and Bézier arcs; it can be described as an @FT_Outline; you */ + /* and Bezier arcs; it can be described as an @FT_Outline; you */ /* generally want to access the `outline' field of the */ /* @FT_GlyphSlotRec structure to read it. */ /* */ diff --git a/include/freetype/ftoutln.h b/include/freetype/ftoutln.h index 56f56a960..5af750948 100644 --- a/include/freetype/ftoutln.h +++ b/include/freetype/ftoutln.h @@ -89,7 +89,7 @@ FT_BEGIN_HEADER /* */ /* */ /* Walk over an outline's structure to decompose it into individual */ - /* segments and Bézier arcs. This function also emits `move to' */ + /* segments and Bezier arcs. This function also emits `move to' */ /* operations to indicate the start of new contours in the outline. */ /* */ /* */ @@ -232,10 +232,10 @@ FT_BEGIN_HEADER /* */ /* */ /* Return an outline's `control box'. The control box encloses all */ - /* the outline's points, including Bézier control points. Though it */ + /* the outline's points, including Bezier control points. Though it */ /* coincides with the exact bounding box for most glyphs, it can be */ /* slightly larger in some situations (like when rotating an outline */ - /* that contains Bézier outside arcs). */ + /* that contains Bezier outside arcs). */ /* */ /* Computing the control box is very fast, while getting the bounding */ /* box can take much more time as it needs to walk over all segments */ diff --git a/include/freetype/ftstroke.h b/include/freetype/ftstroke.h index 4a20667c5..55f0b82fd 100644 --- a/include/freetype/ftstroke.h +++ b/include/freetype/ftstroke.h @@ -466,7 +466,7 @@ FT_BEGIN_HEADER * FT_Stroker_ConicTo * * @description: - * `Draw' a single quadratic Bézier in the stroker's current sub-path, + * `Draw' a single quadratic Bezier in the stroker's current sub-path, * from the last position. * * @input: @@ -474,7 +474,7 @@ FT_BEGIN_HEADER * The target stroker handle. * * control :: - * A pointer to a Bézier control point. + * A pointer to a Bezier control point. * * to :: * A pointer to the destination point. @@ -498,7 +498,7 @@ FT_BEGIN_HEADER * FT_Stroker_CubicTo * * @description: - * `Draw' a single cubic Bézier in the stroker's current sub-path, + * `Draw' a single cubic Bezier in the stroker's current sub-path, * from the last position. * * @input: @@ -506,10 +506,10 @@ FT_BEGIN_HEADER * The target stroker handle. * * control1 :: - * A pointer to the first Bézier control point. + * A pointer to the first Bezier control point. * * control2 :: - * A pointer to second Bézier control point. + * A pointer to second Bezier control point. * * to :: * A pointer to the destination point. diff --git a/include/freetype/ftwinfnt.h b/include/freetype/ftwinfnt.h index 1eeef6c8b..449c952d3 100644 --- a/include/freetype/ftwinfnt.h +++ b/include/freetype/ftwinfnt.h @@ -78,7 +78,7 @@ FT_BEGIN_HEADER * Mac Roman encoding. * * FT_WinFNT_ID_OEM :: - * From Michael Pöttgen : + * From Michael Poettgen : * * The `Windows Font Mapping' article says that FT_WinFNT_ID_OEM * is used for the charset of vector fonts, like `modern.fon', From 430e9c375a3f77578abfc61c962f757a9308acc4 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Thu, 7 Dec 2017 19:27:29 +0100 Subject: [PATCH 358/470] .mailmap: Add Ewald. --- .mailmap | 1 + 1 file changed, 1 insertion(+) diff --git a/.mailmap b/.mailmap index 233b65704..c406e23a4 100644 --- a/.mailmap +++ b/.mailmap @@ -6,3 +6,4 @@ Suzuki, Toshiya (鈴木俊哉) sssa Suzuki, Toshiya (鈴木俊哉) suzuki toshiya Ben Wagner Bungeman +Ewald Hew (Hew Yih Shiuan 丘毅宣) From 99df4919fda69e02f3253f6d843903120404a994 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Fri, 8 Dec 2017 09:48:18 +0100 Subject: [PATCH 359/470] Fix `make setup dos' (#52622). * builds/detect.mk (dos_setup): Properly escape literal `>' character. --- ChangeLog | 7 +++++++ builds/detect.mk | 5 ++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index bc39aca5b..4f4e2eef5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2017-12-08 Werner Lemberg + + Fix `make setup dos' (#52622). + + * builds/detect.mk (dos_setup): Properly escape literal `>' + character. + 2017-12-07 Werner Lemberg Fix C++ compilation. diff --git a/builds/detect.mk b/builds/detect.mk index 4ed478e43..e5100a60f 100644 --- a/builds/detect.mk +++ b/builds/detect.mk @@ -131,6 +131,9 @@ std_setup: # Special case for Dos, Windows, OS/2, where echo "" doesn't work correctly! # +# For `cmd.exe', we have to escape (unquoted) special characters like `>' as +# `^>', and we use 0xFF as a replacement character for a protected space. +# dos_setup: @type builds$(SEP)newline @echo $(PROJECT_TITLE) build system -- automatic system detection @@ -146,7 +149,7 @@ dos_setup: @echo '$(CONFIG_MK)' from this directory then read the INSTALL file for help. @type builds$(SEP)newline @echo Otherwise, simply type 'make' again to build the library. - @echo or 'make refdoc' to build the API reference (this needs python >= 2.6). + @echo or 'make refdoc' to build the API reference (this needs python ^>= 2.6). @type builds$(SEP)newline @$(COPY) $(subst /,$(SEP),$(CONFIG_RULES) $(CONFIG_MK)) > nul From e1090c608b72dcfc1899c33974acd056e120aa53 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Fri, 8 Dec 2017 09:54:36 +0100 Subject: [PATCH 360/470] Fix access to uninitalized memory (#52613). Also reported as https://bugs.chromium.org/p/chromium/issues/detail?id=791317 * src/base/ftbitmap.c (ft_bitmap_assure_buffer): If increasing the bitmap size needs a larger bitmap buffer, assure that the new memory areas are initialized also. --- ChangeLog | 12 ++++++++++++ src/base/ftbitmap.c | 43 +++++++++++++++++++++++++++++++++++-------- 2 files changed, 47 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4f4e2eef5..1d59ec974 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2017-12-08 Werner Lemberg + + Fix access to uninitalized memory (#52613). + + Also reported as + + https://bugs.chromium.org/p/chromium/issues/detail?id=791317 + + * src/base/ftbitmap.c (ft_bitmap_assure_buffer): If increasing the + bitmap size needs a larger bitmap buffer, assure that the new memory + areas are initialized also. + 2017-12-08 Werner Lemberg Fix `make setup dos' (#52622). diff --git a/src/base/ftbitmap.c b/src/base/ftbitmap.c index 2a2a9dbfb..f7bd2705c 100644 --- a/src/base/ftbitmap.c +++ b/src/base/ftbitmap.c @@ -235,21 +235,48 @@ { FT_UInt len = ( width * bpp + 7 ) >> 3; + unsigned char* in = bitmap->buffer; + unsigned char* out = buffer; - for ( i = 0; i < bitmap->rows; i++ ) - FT_MEM_COPY( buffer + (FT_UInt)new_pitch * ( ypixels + i ), - bitmap->buffer + (FT_UInt)pitch * i, - len ); + unsigned char* limit = bitmap->buffer + pitch * bitmap->rows; + int delta = new_pitch - pitch; + + + FT_MEM_ZERO( out, new_pitch * ypixels ); + out += new_pitch * ypixels; + + while ( in < limit ) + { + FT_MEM_COPY( out, in, len ); + in += pitch; + out += pitch; + + FT_MEM_ZERO( out, delta ); + out += delta; + } } else { FT_UInt len = ( width * bpp + 7 ) >> 3; + unsigned char* in = bitmap->buffer; + unsigned char* out = buffer; + + unsigned char* limit = bitmap->buffer + pitch * bitmap->rows; + int delta = new_pitch - pitch; + + + while ( in < limit ) + { + FT_MEM_COPY( out, in, len ); + in += pitch; + out += pitch; + + FT_MEM_ZERO( out, delta ); + out += delta; + } - for ( i = 0; i < bitmap->rows; i++ ) - FT_MEM_COPY( buffer + (FT_UInt)new_pitch * i, - bitmap->buffer + (FT_UInt)pitch * i, - len ); + FT_MEM_ZERO( out, new_pitch * ypixels ); } FT_FREE( bitmap->buffer ); From bef8de2a85616b7b7e90a712189a6f133a4c1b7b Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Fri, 8 Dec 2017 10:02:12 +0100 Subject: [PATCH 361/470] Move `ftdriver.h' to `ftdrv.h'. * include/freetype/internal/ftdriver.h: Renamed to... * include/freetype/internal/ftdrv.h: ... this name. * include/freetype/internal/internal.h (FT_INTERNAL_DRIVER_H): Updated. --- ChangeLog | 10 ++++++++++ include/freetype/internal/{ftdriver.h => ftdrv.h} | 10 +++++----- include/freetype/internal/internal.h | 2 +- 3 files changed, 16 insertions(+), 6 deletions(-) rename include/freetype/internal/{ftdriver.h => ftdrv.h} (99%) diff --git a/ChangeLog b/ChangeLog index 1d59ec974..dd95e61e5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2017-12-08 Werner Lemberg + + Move `ftdriver.h' to `ftdrv.h'. + + * include/freetype/internal/ftdriver.h: Renamed to... + * include/freetype/internal/ftdrv.h: ... this name. + + * include/freetype/internal/internal.h (FT_INTERNAL_DRIVER_H): + Updated. + 2017-12-08 Werner Lemberg Fix access to uninitalized memory (#52613). diff --git a/include/freetype/internal/ftdriver.h b/include/freetype/internal/ftdrv.h similarity index 99% rename from include/freetype/internal/ftdriver.h rename to include/freetype/internal/ftdrv.h index e82fa8d41..fd8f1c7a7 100644 --- a/include/freetype/internal/ftdriver.h +++ b/include/freetype/internal/ftdrv.h @@ -1,8 +1,8 @@ /***************************************************************************/ /* */ -/* ftdriver.h */ +/* ftdrv.h */ /* */ -/* FreeType font driver interface (specification). */ +/* FreeType internal font driver interface (specification). */ /* */ /* Copyright 1996-2017 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ @@ -16,8 +16,8 @@ /***************************************************************************/ -#ifndef FTDRIVER_H_ -#define FTDRIVER_H_ +#ifndef FTDRV_H_ +#define FTDRV_H_ #include @@ -394,7 +394,7 @@ FT_BEGIN_HEADER FT_END_HEADER -#endif /* FTDRIVER_H_ */ +#endif /* FTDRV_H_ */ /* END */ diff --git a/include/freetype/internal/internal.h b/include/freetype/internal/internal.h index 23f84b435..45ae44740 100644 --- a/include/freetype/internal/internal.h +++ b/include/freetype/internal/internal.h @@ -31,7 +31,7 @@ #define FT_INTERNAL_DEBUG_H #define FT_INTERNAL_CALC_H #define FT_INTERNAL_HASH_H -#define FT_INTERNAL_DRIVER_H +#define FT_INTERNAL_DRIVER_H #define FT_INTERNAL_TRACE_H #define FT_INTERNAL_GLYPH_LOADER_H #define FT_INTERNAL_SFNT_H From 98ba0c4a37cc8223b513efb4f2a5df4f25ec0756 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Fri, 8 Dec 2017 18:38:41 +0100 Subject: [PATCH 362/470] New `ftdriver.h' file, covering all driver modules. This reduces redundancy and increases synergy; it also reduces the number of header files. * include/freetype/config/ftheader.h (FT_DRIVER_H): New macro. (FT_AUTOHINTER_H, FT_CFF_DRIVER_H, FT_TRUETYPE_DRIVER_H, FT_PCF_DRIVER_H, FT_TYPE1_DRIVER_H): Make them aliases to FT_DRIVER_H. * include/freetype/ftautoh.h, include/freetype/ftcffdrv.h, include/freetype/ftpcfdrv.h, include/freetype/ftt1drv.h, include/freetype/ftttdrv.h: Replaced with... * include/freetype/ftdriver.h: ...this new file. (FT_CFF_HINTING_ADOBE, FT_T1_HINTING_ADOBE): Renamed to... (FT_HINTING_ADOBE): ... this new macro. (FT_CFF_HINTING_FREETYPE, FT_T1_HINTING_FREETYPE): Renamed to... (FT_HINTING_FREETYPE): ... this new macro. * src/*/*: Updated accordingly. --- ChangeLog | 23 + include/freetype/config/ftheader.h | 38 +- include/freetype/freetype.h | 3 +- include/freetype/ftautoh.h | 535 ------------ include/freetype/ftcffdrv.h | 322 -------- include/freetype/ftdriver.h | 1219 ++++++++++++++++++++++++++++ include/freetype/ftparams.h | 3 +- include/freetype/ftpcfdrv.h | 107 --- include/freetype/ftt1drv.h | 109 --- include/freetype/ftttdrv.h | 331 -------- src/autofit/afmodule.c | 2 +- src/base/ftobjs.c | 6 +- src/cff/cffdrivr.c | 10 +- src/cff/cffgload.c | 4 +- src/cff/cffobjs.c | 6 +- src/cid/cidgload.c | 4 +- src/cid/cidobjs.c | 6 +- src/cid/cidriver.c | 10 +- src/pcf/pcfdrivr.c | 2 +- src/psaux/psobjs.c | 9 +- src/tools/ftfuzzer/ftfuzzer.cc | 5 +- src/truetype/ttdriver.c | 2 +- src/truetype/ttgload.c | 2 +- src/truetype/ttinterp.c | 2 +- src/truetype/ttobjs.c | 2 +- src/truetype/ttsubpix.c | 2 +- src/type1/t1driver.c | 10 +- src/type1/t1gload.c | 6 +- src/type1/t1objs.c | 6 +- 29 files changed, 1313 insertions(+), 1473 deletions(-) delete mode 100644 include/freetype/ftautoh.h delete mode 100644 include/freetype/ftcffdrv.h create mode 100644 include/freetype/ftdriver.h delete mode 100644 include/freetype/ftpcfdrv.h delete mode 100644 include/freetype/ftt1drv.h delete mode 100644 include/freetype/ftttdrv.h diff --git a/ChangeLog b/ChangeLog index dd95e61e5..49491308c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,26 @@ +2017-12-08 Werner Lemberg + + New `ftdriver.h' file, covering all driver modules. + + This reduces redundancy and increases synergy; it also reduces the + number of header files. + + * include/freetype/config/ftheader.h (FT_DRIVER_H): New macro. + (FT_AUTOHINTER_H, FT_CFF_DRIVER_H, FT_TRUETYPE_DRIVER_H, + FT_PCF_DRIVER_H, FT_TYPE1_DRIVER_H): Make them aliases to + FT_DRIVER_H. + + * include/freetype/ftautoh.h, include/freetype/ftcffdrv.h, + include/freetype/ftpcfdrv.h, include/freetype/ftt1drv.h, + include/freetype/ftttdrv.h: Replaced with... + * include/freetype/ftdriver.h: ...this new file. + (FT_CFF_HINTING_ADOBE, FT_T1_HINTING_ADOBE): Renamed to... + (FT_HINTING_ADOBE): ... this new macro. + (FT_CFF_HINTING_FREETYPE, FT_T1_HINTING_FREETYPE): Renamed to... + (FT_HINTING_FREETYPE): ... this new macro. + + * src/*/*: Updated accordingly. + 2017-12-08 Werner Lemberg Move `ftdriver.h' to `ftdrv.h'. diff --git a/include/freetype/config/ftheader.h b/include/freetype/config/ftheader.h index acf6b744d..58f168ea2 100644 --- a/include/freetype/config/ftheader.h +++ b/include/freetype/config/ftheader.h @@ -318,66 +318,74 @@ /************************************************************************* * * @macro: - * FT_AUTOHINTER_H + * FT_DRIVER_H * * @description: * A macro used in #include statements to name the file containing - * structures and macros related to the auto-hinting module. + * structures and macros related to the driver modules. * */ -#define FT_AUTOHINTER_H +#define FT_DRIVER_H /************************************************************************* * * @macro: - * FT_CFF_DRIVER_H + * FT_AUTOHINTER_H * * @description: * A macro used in #include statements to name the file containing - * structures and macros related to the CFF driver module. + * structures and macros related to the auto-hinting module. + * + * Deprecated since version 2.8.2; use @FT_DRIVER_H instead. * */ -#define FT_CFF_DRIVER_H +#define FT_AUTOHINTER_H FT_DRIVER_H /************************************************************************* * * @macro: - * FT_TRUETYPE_DRIVER_H + * FT_CFF_DRIVER_H * * @description: * A macro used in #include statements to name the file containing - * structures and macros related to the TrueType driver module. + * structures and macros related to the CFF driver module. + * + * Deprecated since version 2.8.2; use @FT_DRIVER_H instead. * */ -#define FT_TRUETYPE_DRIVER_H +#define FT_CFF_DRIVER_H FT_DRIVER_H /************************************************************************* * * @macro: - * FT_PCF_DRIVER_H + * FT_TRUETYPE_DRIVER_H * * @description: * A macro used in #include statements to name the file containing - * structures and macros related to the PCF driver module. + * structures and macros related to the TrueType driver module. + * + * Deprecated since version 2.8.2; use @FT_DRIVER_H instead. * */ -#define FT_PCF_DRIVER_H +#define FT_TRUETYPE_DRIVER_H FT_DRIVER_H /************************************************************************* * * @macro: - * FT_TYPE1_DRIVER_H + * FT_PCF_DRIVER_H * * @description: * A macro used in #include statements to name the file containing - * structures and macros related to the Type~1 driver module. + * structures and macros related to the PCF driver module. + * + * Deprecated since version 2.8.2; use @FT_DRIVER_H instead. * */ -#define FT_TYPE1_DRIVER_H +#define FT_PCF_DRIVER_H FT_DRIVER_H /************************************************************************* diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h index fb46fbd39..2f1833879 100644 --- a/include/freetype/freetype.h +++ b/include/freetype/freetype.h @@ -3797,8 +3797,7 @@ FT_BEGIN_HEADER * * * @FT_PARAM_TAG_STEM_DARKENING (stem darkening, corresponding to the * property `no-stem-darkening' provided by the `autofit', `cff', - * `type1', and `t1cid' modules; see @no-stem-darkening[autofit] and - * @no-stem-darkening[cff]). + * `type1', and `t1cid' modules; see @no-stem-darkening). * * * @FT_PARAM_TAG_LCD_FILTER_WEIGHTS (LCD filter weights, corresponding * to function @FT_Library_SetLcdFilterWeights). diff --git a/include/freetype/ftautoh.h b/include/freetype/ftautoh.h deleted file mode 100644 index 878e4589a..000000000 --- a/include/freetype/ftautoh.h +++ /dev/null @@ -1,535 +0,0 @@ -/***************************************************************************/ -/* */ -/* ftautoh.h */ -/* */ -/* FreeType API for controlling the auto-hinter (specification only). */ -/* */ -/* Copyright 2012-2017 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef FTAUTOH_H_ -#define FTAUTOH_H_ - -#include -#include FT_FREETYPE_H -#include FT_PARAMETER_TAGS_H - -#ifdef FREETYPE_H -#error "freetype.h of FreeType 1 has been loaded!" -#error "Please fix the directory search order for header files" -#error "so that freetype.h of FreeType 2 is found first." -#endif - - -FT_BEGIN_HEADER - - - /************************************************************************** - * - * @section: - * auto_hinter - * - * @title: - * The auto-hinter - * - * @abstract: - * Controlling the auto-hinting module. - * - * @description: - * While FreeType's auto-hinter doesn't expose API functions by itself, - * it is possible to control its behaviour with @FT_Property_Set and - * @FT_Property_Get. The following lists the available properties - * together with the necessary macros and structures. - * - * Note that the auto-hinter's module name is `autofitter' for - * historical reasons. - * - */ - - - /************************************************************************** - * - * @property: - * glyph-to-script-map - * - * @description: - * *Experimental* *only* - * - * The auto-hinter provides various script modules to hint glyphs. - * Examples of supported scripts are Latin or CJK. Before a glyph is - * auto-hinted, the Unicode character map of the font gets examined, and - * the script is then determined based on Unicode character ranges, see - * below. - * - * OpenType fonts, however, often provide much more glyphs than - * character codes (small caps, superscripts, ligatures, swashes, etc.), - * to be controlled by so-called `features'. Handling OpenType features - * can be quite complicated and thus needs a separate library on top of - * FreeType. - * - * The mapping between glyph indices and scripts (in the auto-hinter - * sense, see the @FT_AUTOHINTER_SCRIPT_XXX values) is stored as an - * array with `num_glyphs' elements, as found in the font's @FT_Face - * structure. The `glyph-to-script-map' property returns a pointer to - * this array, which can be modified as needed. Note that the - * modification should happen before the first glyph gets processed by - * the auto-hinter so that the global analysis of the font shapes - * actually uses the modified mapping. - * - * The following example code demonstrates how to access it (omitting - * the error handling). - * - * { - * FT_Library library; - * FT_Face face; - * FT_Prop_GlyphToScriptMap prop; - * - * - * FT_Init_FreeType( &library ); - * FT_New_Face( library, "foo.ttf", 0, &face ); - * - * prop.face = face; - * - * FT_Property_Get( library, "autofitter", - * "glyph-to-script-map", &prop ); - * - * // adjust `prop.map' as needed right here - * - * FT_Load_Glyph( face, ..., FT_LOAD_FORCE_AUTOHINT ); - * } - * - * @since: - * 2.4.11 - * - */ - - - /************************************************************************** - * - * @enum: - * FT_AUTOHINTER_SCRIPT_XXX - * - * @description: - * *Experimental* *only* - * - * A list of constants used for the @glyph-to-script-map property to - * specify the script submodule the auto-hinter should use for hinting a - * particular glyph. - * - * @values: - * FT_AUTOHINTER_SCRIPT_NONE :: - * Don't auto-hint this glyph. - * - * FT_AUTOHINTER_SCRIPT_LATIN :: - * Apply the latin auto-hinter. For the auto-hinter, `latin' is a - * very broad term, including Cyrillic and Greek also since characters - * from those scripts share the same design constraints. - * - * By default, characters from the following Unicode ranges are - * assigned to this submodule. - * - * { - * U+0020 - U+007F // Basic Latin (no control characters) - * U+00A0 - U+00FF // Latin-1 Supplement (no control characters) - * U+0100 - U+017F // Latin Extended-A - * U+0180 - U+024F // Latin Extended-B - * U+0250 - U+02AF // IPA Extensions - * U+02B0 - U+02FF // Spacing Modifier Letters - * U+0300 - U+036F // Combining Diacritical Marks - * U+0370 - U+03FF // Greek and Coptic - * U+0400 - U+04FF // Cyrillic - * U+0500 - U+052F // Cyrillic Supplement - * U+1D00 - U+1D7F // Phonetic Extensions - * U+1D80 - U+1DBF // Phonetic Extensions Supplement - * U+1DC0 - U+1DFF // Combining Diacritical Marks Supplement - * U+1E00 - U+1EFF // Latin Extended Additional - * U+1F00 - U+1FFF // Greek Extended - * U+2000 - U+206F // General Punctuation - * U+2070 - U+209F // Superscripts and Subscripts - * U+20A0 - U+20CF // Currency Symbols - * U+2150 - U+218F // Number Forms - * U+2460 - U+24FF // Enclosed Alphanumerics - * U+2C60 - U+2C7F // Latin Extended-C - * U+2DE0 - U+2DFF // Cyrillic Extended-A - * U+2E00 - U+2E7F // Supplemental Punctuation - * U+A640 - U+A69F // Cyrillic Extended-B - * U+A720 - U+A7FF // Latin Extended-D - * U+FB00 - U+FB06 // Alphab. Present. Forms (Latin Ligatures) - * U+1D400 - U+1D7FF // Mathematical Alphanumeric Symbols - * U+1F100 - U+1F1FF // Enclosed Alphanumeric Supplement - * } - * - * FT_AUTOHINTER_SCRIPT_CJK :: - * Apply the CJK auto-hinter, covering Chinese, Japanese, Korean, old - * Vietnamese, and some other scripts. - * - * By default, characters from the following Unicode ranges are - * assigned to this submodule. - * - * { - * U+1100 - U+11FF // Hangul Jamo - * U+2E80 - U+2EFF // CJK Radicals Supplement - * U+2F00 - U+2FDF // Kangxi Radicals - * U+2FF0 - U+2FFF // Ideographic Description Characters - * U+3000 - U+303F // CJK Symbols and Punctuation - * U+3040 - U+309F // Hiragana - * U+30A0 - U+30FF // Katakana - * U+3100 - U+312F // Bopomofo - * U+3130 - U+318F // Hangul Compatibility Jamo - * U+3190 - U+319F // Kanbun - * U+31A0 - U+31BF // Bopomofo Extended - * U+31C0 - U+31EF // CJK Strokes - * U+31F0 - U+31FF // Katakana Phonetic Extensions - * U+3200 - U+32FF // Enclosed CJK Letters and Months - * U+3300 - U+33FF // CJK Compatibility - * U+3400 - U+4DBF // CJK Unified Ideographs Extension A - * U+4DC0 - U+4DFF // Yijing Hexagram Symbols - * U+4E00 - U+9FFF // CJK Unified Ideographs - * U+A960 - U+A97F // Hangul Jamo Extended-A - * U+AC00 - U+D7AF // Hangul Syllables - * U+D7B0 - U+D7FF // Hangul Jamo Extended-B - * U+F900 - U+FAFF // CJK Compatibility Ideographs - * U+FE10 - U+FE1F // Vertical forms - * U+FE30 - U+FE4F // CJK Compatibility Forms - * U+FF00 - U+FFEF // Halfwidth and Fullwidth Forms - * U+1B000 - U+1B0FF // Kana Supplement - * U+1D300 - U+1D35F // Tai Xuan Hing Symbols - * U+1F200 - U+1F2FF // Enclosed Ideographic Supplement - * U+20000 - U+2A6DF // CJK Unified Ideographs Extension B - * U+2A700 - U+2B73F // CJK Unified Ideographs Extension C - * U+2B740 - U+2B81F // CJK Unified Ideographs Extension D - * U+2F800 - U+2FA1F // CJK Compatibility Ideographs Supplement - * } - * - * FT_AUTOHINTER_SCRIPT_INDIC :: - * Apply the indic auto-hinter, covering all major scripts from the - * Indian sub-continent and some other related scripts like Thai, Lao, - * or Tibetan. - * - * By default, characters from the following Unicode ranges are - * assigned to this submodule. - * - * { - * U+0900 - U+0DFF // Indic Range - * U+0F00 - U+0FFF // Tibetan - * U+1900 - U+194F // Limbu - * U+1B80 - U+1BBF // Sundanese - * U+A800 - U+A82F // Syloti Nagri - * U+ABC0 - U+ABFF // Meetei Mayek - * U+11800 - U+118DF // Sharada - * } - * - * Note that currently Indic support is rudimentary only, missing blue - * zone support. - * - * @since: - * 2.4.11 - * - */ -#define FT_AUTOHINTER_SCRIPT_NONE 0 -#define FT_AUTOHINTER_SCRIPT_LATIN 1 -#define FT_AUTOHINTER_SCRIPT_CJK 2 -#define FT_AUTOHINTER_SCRIPT_INDIC 3 - - - /************************************************************************** - * - * @struct: - * FT_Prop_GlyphToScriptMap - * - * @description: - * *Experimental* *only* - * - * The data exchange structure for the @glyph-to-script-map property. - * - * @since: - * 2.4.11 - * - */ - typedef struct FT_Prop_GlyphToScriptMap_ - { - FT_Face face; - FT_UShort* map; - - } FT_Prop_GlyphToScriptMap; - - - /************************************************************************** - * - * @property: - * fallback-script - * - * @description: - * *Experimental* *only* - * - * If no auto-hinter script module can be assigned to a glyph, a - * fallback script gets assigned to it (see also the - * @glyph-to-script-map property). By default, this is - * @FT_AUTOHINTER_SCRIPT_CJK. Using the `fallback-script' property, - * this fallback value can be changed. - * - * { - * FT_Library library; - * FT_UInt fallback_script = FT_AUTOHINTER_SCRIPT_NONE; - * - * - * FT_Init_FreeType( &library ); - * - * FT_Property_Set( library, "autofitter", - * "fallback-script", &fallback_script ); - * } - * - * @note: - * This property can be used with @FT_Property_Get also. - * - * It's important to use the right timing for changing this value: The - * creation of the glyph-to-script map that eventually uses the - * fallback script value gets triggered either by setting or reading a - * face-specific property like @glyph-to-script-map, or by auto-hinting - * any glyph from that face. In particular, if you have already created - * an @FT_Face structure but not loaded any glyph (using the - * auto-hinter), a change of the fallback script will affect this face. - * - * @since: - * 2.4.11 - * - */ - - - /************************************************************************** - * - * @property: - * default-script - * - * @description: - * *Experimental* *only* - * - * If FreeType gets compiled with FT_CONFIG_OPTION_USE_HARFBUZZ to make - * the HarfBuzz library access OpenType features for getting better - * glyph coverages, this property sets the (auto-fitter) script to be - * used for the default (OpenType) script data of a font's GSUB table. - * Features for the default script are intended for all scripts not - * explicitly handled in GSUB; an example is a `dlig' feature, - * containing the combination of the characters `T', `E', and `L' to - * form a `TEL' ligature. - * - * By default, this is @FT_AUTOHINTER_SCRIPT_LATIN. Using the - * `default-script' property, this default value can be changed. - * - * { - * FT_Library library; - * FT_UInt default_script = FT_AUTOHINTER_SCRIPT_NONE; - * - * - * FT_Init_FreeType( &library ); - * - * FT_Property_Set( library, "autofitter", - * "default-script", &default_script ); - * } - * - * @note: - * This property can be used with @FT_Property_Get also. - * - * It's important to use the right timing for changing this value: The - * creation of the glyph-to-script map that eventually uses the - * default script value gets triggered either by setting or reading a - * face-specific property like @glyph-to-script-map, or by auto-hinting - * any glyph from that face. In particular, if you have already created - * an @FT_Face structure but not loaded any glyph (using the - * auto-hinter), a change of the default script will affect this face. - * - */ - - - /************************************************************************** - * - * @property: - * increase-x-height - * - * @description: - * For ppem values in the range 6~<= ppem <= `increase-x-height', round - * up the font's x~height much more often than normally. If the value - * is set to~0, which is the default, this feature is switched off. Use - * this property to improve the legibility of small font sizes if - * necessary. - * - * { - * FT_Library library; - * FT_Face face; - * FT_Prop_IncreaseXHeight prop; - * - * - * FT_Init_FreeType( &library ); - * FT_New_Face( library, "foo.ttf", 0, &face ); - * FT_Set_Char_Size( face, 10 * 64, 0, 72, 0 ); - * - * prop.face = face; - * prop.limit = 14; - * - * FT_Property_Set( library, "autofitter", - * "increase-x-height", &prop ); - * } - * - * @note: - * This property can be used with @FT_Property_Get also. - * - * Set this value right after calling @FT_Set_Char_Size, but before - * loading any glyph (using the auto-hinter). - * - * @since: - * 2.4.11 - * - */ - - - /************************************************************************** - * - * @struct: - * FT_Prop_IncreaseXHeight - * - * @description: - * The data exchange structure for the @increase-x-height property. - * - */ - typedef struct FT_Prop_IncreaseXHeight_ - { - FT_Face face; - FT_UInt limit; - - } FT_Prop_IncreaseXHeight; - - - /************************************************************************** - * - * @property: - * warping - * - * @description: - * *Experimental* *only* - * - * If FreeType gets compiled with option AF_CONFIG_OPTION_USE_WARPER to - * activate the warp hinting code in the auto-hinter, this property - * switches warping on and off. - * - * Warping only works in `normal' auto-hinting mode replacing it. - * The idea of the code is to slightly scale and shift a glyph along - * the non-hinted dimension (which is usually the horizontal axis) so - * that as much of its segments are aligned (more or less) to the grid. - * To find out a glyph's optimal scaling and shifting value, various - * parameter combinations are tried and scored. - * - * By default, warping is off. The example below shows how to switch on - * warping (omitting the error handling). - * - * { - * FT_Library library; - * FT_Bool warping = 1; - * - * - * FT_Init_FreeType( &library ); - * - * FT_Property_Set( library, "autofitter", - * "warping", &warping ); - * } - * - * @note: - * This property can be used with @FT_Property_Get also. - * - * This property can be set via the `FREETYPE_PROPERTIES' environment - * variable (using values 1 and 0 for `on' and `off', respectively). - * - * The warping code can also change advance widths. Have a look at the - * `lsb_delta' and `rsb_delta' fields in the @FT_GlyphSlotRec structure - * for details on improving inter-glyph distances while rendering. - * - * Since warping is a global property of the auto-hinter it is best to - * change its value before rendering any face. Otherwise, you should - * reload all faces that get auto-hinted in `normal' hinting mode. - * - */ - - - /************************************************************************** - * - * @property: - * no-stem-darkening[autofit] - * - * @description: - * *Experimental* *only*, *requires* *linear* *alpha* *blending* *and* - * *gamma* *correction* - * - * Stem darkening emboldens glyphs at smaller sizes to make them more - * readable on common low-DPI screens when using linear alpha blending - * and gamma correction, see @FT_Render_Glyph. When not using linear - * alpha blending and gamma correction, glyphs will appear heavy and - * fuzzy! - * - * Gamma correction essentially lightens fonts since shades of grey are - * shifted to higher pixel values (=~higher brightness) to match the - * original intention to the reality of our screens. The side-effect is - * that glyphs `thin out'. Mac OS~X and Adobe's proprietary font - * rendering library implement a counter-measure: stem darkening at - * smaller sizes where shades of gray dominate. By emboldening a glyph - * slightly in relation to its pixel size, individual pixels get higher - * coverage of filled-in outlines and are therefore `blacker'. This - * counteracts the `thinning out' of glyphs, making text remain readable - * at smaller sizes. All glyphs that pass through the auto-hinter will - * be emboldened unless this property is set to TRUE. - * - * See the description of the CFF driver for algorithmic details. Total - * consistency with the CFF driver is currently not achieved because the - * emboldening method differs and glyphs must be scaled down on the - * Y-axis to keep outline points inside their precomputed blue zones. - * The smaller the size (especially 9ppem and down), the higher the loss - * of emboldening versus the CFF driver. - * - * This property can be set via the `FREETYPE_PROPERTIES' environment - * variable similar to the CFF driver. It can also be set per face - * using @FT_Face_Properties with @FT_PARAM_TAG_STEM_DARKENING. - * - * @since: - * 2.6.2 - * - */ - - - /************************************************************************** - * - * @property: - * darkening-parameters[autofit] - * - * @description: - * *Experimental* *only* - * - * See the description of the CFF driver for details. This - * implementation appropriates the - * CFF_CONFIG_OPTION_DARKENING_PARAMETER_* #defines for consistency. - * Note the differences described in @no-stem-darkening[autofit]. - * - * This property can be set via the `FREETYPE_PROPERTIES' environment - * variable similar to the CFF driver. - * - * @since: - * 2.6.2 - * - */ - - - /* */ - - -FT_END_HEADER - -#endif /* FTAUTOH_H_ */ - - -/* END */ diff --git a/include/freetype/ftcffdrv.h b/include/freetype/ftcffdrv.h deleted file mode 100644 index 51acf4a00..000000000 --- a/include/freetype/ftcffdrv.h +++ /dev/null @@ -1,322 +0,0 @@ -/***************************************************************************/ -/* */ -/* ftcffdrv.h */ -/* */ -/* FreeType API for controlling the CFF driver (specification only). */ -/* */ -/* Copyright 2013-2017 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef FTCFFDRV_H_ -#define FTCFFDRV_H_ - -#include -#include FT_FREETYPE_H -#include FT_PARAMETER_TAGS_H - -#ifdef FREETYPE_H -#error "freetype.h of FreeType 1 has been loaded!" -#error "Please fix the directory search order for header files" -#error "so that freetype.h of FreeType 2 is found first." -#endif - - -FT_BEGIN_HEADER - - - /************************************************************************** - * - * @section: - * cff_driver - * - * @title: - * The CFF driver - * - * @abstract: - * Controlling the CFF driver module. - * - * @description: - * While FreeType's CFF driver doesn't expose API functions by itself, - * it is possible to control its behaviour with @FT_Property_Set and - * @FT_Property_Get. The list below gives the available properties - * together with the necessary macros and structures. - * - * The CFF driver's module name is `cff'. - * - * *Hinting* *and* *antialiasing* *principles* *of* *the* *new* *engine* - * - * The rasterizer is positioning horizontal features (e.g., ascender - * height & x-height, or crossbars) on the pixel grid and minimizing the - * amount of antialiasing applied to them, while placing vertical - * features (vertical stems) on the pixel grid without hinting, thus - * representing the stem position and weight accurately. Sometimes the - * vertical stems may be only partially black. In this context, - * `antialiasing' means that stems are not positioned exactly on pixel - * borders, causing a fuzzy appearance. - * - * There are two principles behind this approach. - * - * 1) No hinting in the horizontal direction: Unlike `superhinted' - * TrueType, which changes glyph widths to accommodate regular - * inter-glyph spacing, Adobe's approach is `faithful to the design' in - * representing both the glyph width and the inter-glyph spacing - * designed for the font. This makes the screen display as close as it - * can be to the result one would get with infinite resolution, while - * preserving what is considered the key characteristics of each glyph. - * Note that the distances between unhinted and grid-fitted positions at - * small sizes are comparable to kerning values and thus would be - * noticeable (and distracting) while reading if hinting were applied. - * - * One of the reasons to not hint horizontally is antialiasing for LCD - * screens: The pixel geometry of modern displays supplies three - * vertical sub-pixels as the eye moves horizontally across each visible - * pixel. On devices where we can be certain this characteristic is - * present a rasterizer can take advantage of the sub-pixels to add - * increments of weight. In Western writing systems this turns out to - * be the more critical direction anyway; the weights and spacing of - * vertical stems (see above) are central to Armenian, Cyrillic, Greek, - * and Latin type designs. Even when the rasterizer uses greyscale - * antialiasing instead of color (a necessary compromise when one - * doesn't know the screen characteristics), the unhinted vertical - * features preserve the design's weight and spacing much better than - * aliased type would. - * - * 2) Alignment in the vertical direction: Weights and spacing along the - * y~axis are less critical; what is much more important is the visual - * alignment of related features (like cap-height and x-height). The - * sense of alignment for these is enhanced by the sharpness of grid-fit - * edges, while the cruder vertical resolution (full pixels instead of - * 1/3 pixels) is less of a problem. - * - * On the technical side, horizontal alignment zones for ascender, - * x-height, and other important height values (traditionally called - * `blue zones') as defined in the font are positioned independently, - * each being rounded to the nearest pixel edge, taking care of - * overshoot suppression at small sizes, stem darkening, and scaling. - * - * Hstems (this is, hint values defined in the font to help align - * horizontal features) that fall within a blue zone are said to be - * `captured' and are aligned to that zone. Uncaptured stems are moved - * in one of four ways, top edge up or down, bottom edge up or down. - * Unless there are conflicting hstems, the smallest movement is taken - * to minimize distortion. - * - * @order: - * hinting-engine[cff] - * no-stem-darkening[cff] - * darkening-parameters[cff] - * random-seed - * - */ - - - /************************************************************************** - * - * @property: - * hinting-engine[cff] - * - * @description: - * Thanks to Adobe, which contributed a new hinting (and parsing) - * engine, an application can select between `freetype' and `adobe' if - * compiled with CFF_CONFIG_OPTION_OLD_ENGINE. If this configuration - * macro isn't defined, `hinting-engine' does nothing. - * - * The default engine is `freetype' if CFF_CONFIG_OPTION_OLD_ENGINE is - * defined, and `adobe' otherwise. - * - * The following example code demonstrates how to select Adobe's hinting - * engine (omitting the error handling). - * - * { - * FT_Library library; - * FT_UInt hinting_engine = FT_CFF_HINTING_ADOBE; - * - * - * FT_Init_FreeType( &library ); - * - * FT_Property_Set( library, "cff", - * "hinting-engine", &hinting_engine ); - * } - * - * @note: - * This property can be used with @FT_Property_Get also. - * - * This property can be set via the `FREETYPE_PROPERTIES' environment - * variable (using values `adobe' or `freetype'). - * - * @since: - * 2.4.12 - */ - - - /************************************************************************** - * - * @enum: - * FT_CFF_HINTING_XXX - * - * @description: - * A list of constants used for the @hinting-engine[cff] property to - * select the hinting engine for CFF fonts. - * - * @values: - * FT_CFF_HINTING_FREETYPE :: - * Use the old FreeType hinting engine. - * - * FT_CFF_HINTING_ADOBE :: - * Use the hinting engine contributed by Adobe. - * - * @since: - * 2.4.12 - * - */ -#define FT_CFF_HINTING_FREETYPE 0 -#define FT_CFF_HINTING_ADOBE 1 - - - /************************************************************************** - * - * @property: - * no-stem-darkening[cff] - * - * @description: - * By default, the Adobe CFF engine darkens stems at smaller sizes, - * regardless of hinting, to enhance contrast. This feature requires - * a rendering system with proper gamma correction. Setting this - * property, stem darkening gets switched off. - * - * Note that stem darkening is never applied if @FT_LOAD_NO_SCALE is set. - * - * { - * FT_Library library; - * FT_Bool no_stem_darkening = TRUE; - * - * - * FT_Init_FreeType( &library ); - * - * FT_Property_Set( library, "cff", - * "no-stem-darkening", &no_stem_darkening ); - * } - * - * @note: - * This property can be used with @FT_Property_Get also. - * - * This property can be set via the `FREETYPE_PROPERTIES' environment - * variable (using values 1 and 0 for `on' and `off', respectively). - * It can also be set per face using @FT_Face_Properties with - * @FT_PARAM_TAG_STEM_DARKENING. - * - * @since: - * 2.4.12 - * - */ - - - /************************************************************************** - * - * @property: - * darkening-parameters[cff] - * - * @description: - * By default, the Adobe CFF engine darkens stems as follows (if the - * `no-stem-darkening' property isn't set): - * - * { - * stem width <= 0.5px: darkening amount = 0.4px - * stem width = 1px: darkening amount = 0.275px - * stem width = 1.667px: darkening amount = 0.275px - * stem width >= 2.333px: darkening amount = 0px - * } - * - * and piecewise linear in-between. At configuration time, these four - * control points can be set with the macro - * `CFF_CONFIG_OPTION_DARKENING_PARAMETERS'. At runtime, the control - * points can be changed using the `darkening-parameters' property, as - * the following example demonstrates. - * - * { - * FT_Library library; - * FT_Int darken_params[8] = { 500, 300, // x1, y1 - * 1000, 200, // x2, y2 - * 1500, 100, // x3, y3 - * 2000, 0 }; // x4, y4 - * - * - * FT_Init_FreeType( &library ); - * - * FT_Property_Set( library, "cff", - * "darkening-parameters", darken_params ); - * } - * - * The x~values give the stem width, and the y~values the darkening - * amount. The unit is 1000th of pixels. All coordinate values must be - * positive; the x~values must be monotonically increasing; the - * y~values must be monotonically decreasing and smaller than or - * equal to 500 (corresponding to half a pixel); the slope of each - * linear piece must be shallower than -1 (e.g., -.4). - * - * @note: - * This property can be used with @FT_Property_Get also. - * - * This property can be set via the `FREETYPE_PROPERTIES' environment - * variable, using eight comma-separated integers without spaces. Here - * the above example, using `\' to break the line for readability. - * - * { - * FREETYPE_PROPERTIES=\ - * cff:darkening-parameters=500,300,1000,200,1500,100,2000,0 - * } - * - * @since: - * 2.5.1 - * - */ - - - /************************************************************************** - * - * @property: - * random-seed - * - * @description: - * By default, the seed value for the CFF `random' operator is set to a - * random value. However, mainly for debugging purposes, it is often - * necessary to use a known value as a seed so that the pseudo-random - * number sequences generated by `random' are repeatable. - * - * The `random-seed' property does that. Its argument is a signed 32bit - * integer; if the value is zero or negative, the seed given by the - * `intitialRandomSeed' private DICT operator in a CFF file gets used - * (or a default value if there is no such operator). If the value is - * positive, use it instead of `initialRandomSeed', which is - * consequently ignored. - * - * @note: - * This property can be set via the `FREETYPE_PROPERTIES' environment - * variable. It can also be set per face using @FT_Face_Properties with - * @FT_PARAM_TAG_RANDOM_SEED. - * - * @since: - * 2.8 - * - */ - - - /* */ - - -FT_END_HEADER - - -#endif /* FTCFFDRV_H_ */ - - -/* END */ diff --git a/include/freetype/ftdriver.h b/include/freetype/ftdriver.h new file mode 100644 index 000000000..4d8854d63 --- /dev/null +++ b/include/freetype/ftdriver.h @@ -0,0 +1,1219 @@ +/***************************************************************************/ +/* */ +/* ftdriver.h */ +/* */ +/* FreeType API for controlling driver modules (specification only). */ +/* */ +/* Copyright 2017 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef FTDRIVER_H_ +#define FTDRIVER_H_ + +#include +#include FT_FREETYPE_H +#include FT_PARAMETER_TAGS_H + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + + /************************************************************************** + * + * @section: + * auto_hinter + * + * @title: + * The auto-hinter + * + * @abstract: + * Controlling the auto-hinting module. + * + * @description: + * While FreeType's auto-hinter doesn't expose API functions by itself, + * it is possible to control its behaviour with @FT_Property_Set and + * @FT_Property_Get. The following lists the available properties + * together with the necessary macros and structures. + * + * Note that the auto-hinter's module name is `autofitter' for + * historical reasons. + * + * Available properties are @increase-x-height, @no-stem-darkening + * (experimental), @darkening-parameters (experimental), @warping + * (experimental), @glyph-to-script-map (experimental), @fallback-script + * (experimental), and @default-script (experimental), as documented in + * the @properties section. + * + */ + + + /************************************************************************** + * + * @section: + * cff_driver + * + * @title: + * The CFF driver + * + * @abstract: + * Controlling the CFF driver module. + * + * @description: + * While FreeType's CFF driver doesn't expose API functions by itself, + * it is possible to control its behaviour with @FT_Property_Set and + * @FT_Property_Get. + * + * The CFF driver's module name is `cff'. + * + * Available properties are @hinting-engine, @no-stem-darkening, + * @darkening-parameters, and @random-seed, as documented in the + * @properties section. + * + * + * *Hinting* *and* *antialiasing* *principles* *of* *the* *new* *engine* + * + * The rasterizer is positioning horizontal features (e.g., ascender + * height & x-height, or crossbars) on the pixel grid and minimizing the + * amount of antialiasing applied to them, while placing vertical + * features (vertical stems) on the pixel grid without hinting, thus + * representing the stem position and weight accurately. Sometimes the + * vertical stems may be only partially black. In this context, + * `antialiasing' means that stems are not positioned exactly on pixel + * borders, causing a fuzzy appearance. + * + * There are two principles behind this approach. + * + * 1) No hinting in the horizontal direction: Unlike `superhinted' + * TrueType, which changes glyph widths to accommodate regular + * inter-glyph spacing, Adobe's approach is `faithful to the design' in + * representing both the glyph width and the inter-glyph spacing + * designed for the font. This makes the screen display as close as it + * can be to the result one would get with infinite resolution, while + * preserving what is considered the key characteristics of each glyph. + * Note that the distances between unhinted and grid-fitted positions at + * small sizes are comparable to kerning values and thus would be + * noticeable (and distracting) while reading if hinting were applied. + * + * One of the reasons to not hint horizontally is antialiasing for LCD + * screens: The pixel geometry of modern displays supplies three + * vertical sub-pixels as the eye moves horizontally across each visible + * pixel. On devices where we can be certain this characteristic is + * present a rasterizer can take advantage of the sub-pixels to add + * increments of weight. In Western writing systems this turns out to + * be the more critical direction anyway; the weights and spacing of + * vertical stems (see above) are central to Armenian, Cyrillic, Greek, + * and Latin type designs. Even when the rasterizer uses greyscale + * antialiasing instead of color (a necessary compromise when one + * doesn't know the screen characteristics), the unhinted vertical + * features preserve the design's weight and spacing much better than + * aliased type would. + * + * 2) Alignment in the vertical direction: Weights and spacing along the + * y~axis are less critical; what is much more important is the visual + * alignment of related features (like cap-height and x-height). The + * sense of alignment for these is enhanced by the sharpness of grid-fit + * edges, while the cruder vertical resolution (full pixels instead of + * 1/3 pixels) is less of a problem. + * + * On the technical side, horizontal alignment zones for ascender, + * x-height, and other important height values (traditionally called + * `blue zones') as defined in the font are positioned independently, + * each being rounded to the nearest pixel edge, taking care of + * overshoot suppression at small sizes, stem darkening, and scaling. + * + * Hstems (this is, hint values defined in the font to help align + * horizontal features) that fall within a blue zone are said to be + * `captured' and are aligned to that zone. Uncaptured stems are moved + * in one of four ways, top edge up or down, bottom edge up or down. + * Unless there are conflicting hstems, the smallest movement is taken + * to minimize distortion. + * + */ + + + /************************************************************************** + * + * @section: + * pcf_driver + * + * @title: + * The PCF driver + * + * @abstract: + * Controlling the PCF driver module. + * + * @description: + * While FreeType's PCF driver doesn't expose API functions by itself, + * it is possible to control its behaviour with @FT_Property_Set and + * @FT_Property_Get. Right now, there is a single property + * @no-long-family-names available if FreeType is compiled with + * PCF_CONFIG_OPTION_LONG_FAMILY_NAMES. + * + * The PCF driver's module name is `pcf'. + * + */ + + + /************************************************************************** + * + * @section: + * t1_cid_driver + * + * @title: + * The Type~1 and CID drivers + * + * @abstract: + * Controlling the Type~1 and CID driver modules. + * + * @description: + * It is possible to control the behaviour of FreeType's Type~1 and + * Type~1 CID drivers with @FT_Property_Set and @FT_Property_Get. + * + * Behind the scenes, both drivers use the Adobe CFF engine for hinting; + * however, the used properties must be specified separately. + * + * The Type~1 driver's module name is `type1'; the CID driver's module + * name is `t1cid'. + * + * Available properties are @hinting-engine, @no-stem-darkening, + * @darkening-parameters, and @random-seed, as documented in the + * @properties section. + * + * Please see the @cff_driver section for more details on the new + * hinting engine. + * + */ + + + /************************************************************************** + * + * @section: + * tt_driver + * + * @title: + * The TrueType driver + * + * @abstract: + * Controlling the TrueType driver module. + * + * @description: + * While FreeType's TrueType driver doesn't expose API functions by + * itself, it is possible to control its behaviour with @FT_Property_Set + * and @FT_Property_Get. The following lists the available properties + * together with the necessary macros and structures. + * + * The TrueType driver's module name is `truetype'. + * + * A single property @interpreter-version is available, as documented in + * the @properties section. + * + * We start with a list of definitions, kindly provided by Greg + * Hitchcock. + * + * _Bi-Level_ _Rendering_ + * + * Monochromatic rendering, exclusively used in the early days of + * TrueType by both Apple and Microsoft. Microsoft's GDI interface + * supported hinting of the right-side bearing point, such that the + * advance width could be non-linear. Most often this was done to + * achieve some level of glyph symmetry. To enable reasonable + * performance (e.g., not having to run hinting on all glyphs just to + * get the widths) there was a bit in the head table indicating if the + * side bearing was hinted, and additional tables, `hdmx' and `LTSH', to + * cache hinting widths across multiple sizes and device aspect ratios. + * + * _Font_ _Smoothing_ + * + * Microsoft's GDI implementation of anti-aliasing. Not traditional + * anti-aliasing as the outlines were hinted before the sampling. The + * widths matched the bi-level rendering. + * + * _ClearType_ _Rendering_ + * + * Technique that uses physical subpixels to improve rendering on LCD + * (and other) displays. Because of the higher resolution, many methods + * of improving symmetry in glyphs through hinting the right-side + * bearing were no longer necessary. This lead to what GDI calls + * `natural widths' ClearType, see + * http://www.beatstamm.com/typography/RTRCh4.htm#Sec21. Since hinting + * has extra resolution, most non-linearity went away, but it is still + * possible for hints to change the advance widths in this mode. + * + * _ClearType_ _Compatible_ _Widths_ + * + * One of the earliest challenges with ClearType was allowing the + * implementation in GDI to be selected without requiring all UI and + * documents to reflow. To address this, a compatible method of + * rendering ClearType was added where the font hints are executed once + * to determine the width in bi-level rendering, and then re-run in + * ClearType, with the difference in widths being absorbed in the font + * hints for ClearType (mostly in the white space of hints); see + * http://www.beatstamm.com/typography/RTRCh4.htm#Sec20. Somewhat by + * definition, compatible width ClearType allows for non-linear widths, + * but only when the bi-level version has non-linear widths. + * + * _ClearType_ _Subpixel_ _Positioning_ + * + * One of the nice benefits of ClearType is the ability to more crisply + * display fractional widths; unfortunately, the GDI model of integer + * bitmaps did not support this. However, the WPF and Direct Write + * frameworks do support fractional widths. DWrite calls this `natural + * mode', not to be confused with GDI's `natural widths'. Subpixel + * positioning, in the current implementation of Direct Write, + * unfortunately does not support hinted advance widths, see + * http://www.beatstamm.com/typography/RTRCh4.htm#Sec22. Note that the + * TrueType interpreter fully allows the advance width to be adjusted in + * this mode, just the DWrite client will ignore those changes. + * + * _ClearType_ _Backward_ _Compatibility_ + * + * This is a set of exceptions made in the TrueType interpreter to + * minimize hinting techniques that were problematic with the extra + * resolution of ClearType; see + * http://www.beatstamm.com/typography/RTRCh4.htm#Sec1 and + * https://www.microsoft.com/typography/cleartype/truetypecleartype.aspx. + * This technique is not to be confused with ClearType compatible + * widths. ClearType backward compatibility has no direct impact on + * changing advance widths, but there might be an indirect impact on + * disabling some deltas. This could be worked around in backward + * compatibility mode. + * + * _Native_ _ClearType_ _Mode_ + * + * (Not to be confused with `natural widths'.) This mode removes all + * the exceptions in the TrueType interpreter when running with + * ClearType. Any issues on widths would still apply, though. + * + */ + + + /************************************************************************** + * + * @section: + * properties + * + * @title: + * Driver properties + * + * @abstract: + * Controlling driver modules. + * + * @description: + * Driver modules can be controlled by setting and unsetting properties, + * using the functions @FT_Property_Set and @FT_Property_Get. This + * section documents the available properties, together with auxiliary + * macros and structures. + * + */ + + + /************************************************************************** + * + * @enum: + * FT_HINTING_XXX + * + * @description: + * A list of constants used for the @hinting-engine property to + * select the hinting engine for CFF, Type~1, and CID fonts. + * + * @values: + * FT_HINTING_FREETYPE :: + * Use the old FreeType hinting engine. + * + * FT_HINTING_ADOBE :: + * Use the hinting engine contributed by Adobe. + * + * @since: + * 2.8.2 + * + */ +#define FT_HINTING_FREETYPE 0 +#define FT_HINTING_ADOBE 1 + + /* these constants (introduced in 2.4.12) are deprecated */ +#define FT_CFF_HINTING_FREETYPE FT_HINTING_FREETYPE +#define FT_CFF_HINTING_ADOBE FT_HINTING_ADOBE + + + /************************************************************************** + * + * @property: + * hinting-engine + * + * @description: + * Thanks to Adobe, which contributed a new hinting (and parsing) + * engine, an application can select between `freetype' and `adobe' if + * compiled with CFF_CONFIG_OPTION_OLD_ENGINE. If this configuration + * macro isn't defined, `hinting-engine' does nothing. + * + * The same holds for the Type~1 and CID modules if compiled with + * T1_CONFIG_OPTION_OLD_ENGINE. + * + * For the `cff' module, the default engine is `freetype' if + * CFF_CONFIG_OPTION_OLD_ENGINE is defined, and `adobe' otherwise. + * + * For both the `type1' and `t1cid' modules, the default engine is + * `freetype' if T1_CONFIG_OPTION_OLD_ENGINE is defined, and `adobe' + * otherwise. + * + * The following example code demonstrates how to select Adobe's hinting + * engine for the `cff' module (omitting the error handling). + * + * { + * FT_Library library; + * FT_UInt hinting_engine = FT_CFF_HINTING_ADOBE; + * + * + * FT_Init_FreeType( &library ); + * + * FT_Property_Set( library, "cff", + * "hinting-engine", &hinting_engine ); + * } + * + * @note: + * This property can be used with @FT_Property_Get also. + * + * This property can be set via the `FREETYPE_PROPERTIES' environment + * variable (using values `adobe' or `freetype'). + * + * @since: + * 2.4.12 (for `cff' module) + * + * 2.8.2 (for `type1' and `t1cid' modules) + * + */ + + + /************************************************************************** + * + * @property: + * no-stem-darkening + * + * @description: + * All glyphs that pass through the auto-hinter will be emboldened + * unless this property is set to TRUE. The same is true for the CFF, + * Type~1, and CID font modules if the `Adobe' engine is selected (which + * is the default). + * + * Stem darkening emboldens glyphs at smaller sizes to make them more + * readable on common low-DPI screens when using linear alpha blending + * and gamma correction, see @FT_Render_Glyph. When not using linear + * alpha blending and gamma correction, glyphs will appear heavy and + * fuzzy! + * + * Gamma correction essentially lightens fonts since shades of grey are + * shifted to higher pixel values (=~higher brightness) to match the + * original intention to the reality of our screens. The side-effect is + * that glyphs `thin out'. Mac OS~X and Adobe's proprietary font + * rendering library implement a counter-measure: stem darkening at + * smaller sizes where shades of gray dominate. By emboldening a glyph + * slightly in relation to its pixel size, individual pixels get higher + * coverage of filled-in outlines and are therefore `blacker'. This + * counteracts the `thinning out' of glyphs, making text remain readable + * at smaller sizes. + * + * By default, the Adobe engines for CFF, Type~1, and CID fonts darken + * stems at smaller sizes, regardless of hinting, to enhance contrast. + * Setting this property, stem darkening gets switched off. + * + * For the auto-hinter, stem-darkening is experimental currently and + * thus switched off by default (this is, `no-stem-darkening' is set to + * TRUE by default). Total consistency with the CFF driver is not + * achieved right now because the emboldening method differs and glyphs + * must be scaled down on the Y-axis to keep outline points inside their + * precomputed blue zones. The smaller the size (especially 9ppem and + * down), the higher the loss of emboldening versus the CFF driver. + * + * Note that stem darkening is never applied if @FT_LOAD_NO_SCALE is + * set. + * + * { + * FT_Library library; + * FT_Bool no_stem_darkening = TRUE; + * + * + * FT_Init_FreeType( &library ); + * + * FT_Property_Set( library, "cff", + * "no-stem-darkening", &no_stem_darkening ); + * } + * + * @note: + * This property can be used with @FT_Property_Get also. + * + * This property can be set via the `FREETYPE_PROPERTIES' environment + * variable (using values 1 and 0 for `on' and `off', respectively). + * It can also be set per face using @FT_Face_Properties with + * @FT_PARAM_TAG_STEM_DARKENING. + * + * @since: + * 2.4.12 (for `cff' module) + * + * 2.6.2 (for `autofitter' module) + * + * 2.8.2 (for `type1' and `t1cid' modules) + * + */ + + + /************************************************************************** + * + * @property: + * darkening-parameters + * + * @description: + * By default, the Adobe hinting engine, as used by the CFF, Type~1, and + * CID font drivers, darkens stems as follows (if the + * `no-stem-darkening' property isn't set): + * + * { + * stem width <= 0.5px: darkening amount = 0.4px + * stem width = 1px: darkening amount = 0.275px + * stem width = 1.667px: darkening amount = 0.275px + * stem width >= 2.333px: darkening amount = 0px + * } + * + * and piecewise linear in-between. At configuration time, these four + * control points can be set with the macro + * `CFF_CONFIG_OPTION_DARKENING_PARAMETERS'; the CFF, Type~1, and CID + * drivers share these values. At runtime, the control points can be + * changed using the `darkening-parameters' property, as the following + * example demonstrates for the Type~1 driver. + * + * { + * FT_Library library; + * FT_Int darken_params[8] = { 500, 300, // x1, y1 + * 1000, 200, // x2, y2 + * 1500, 100, // x3, y3 + * 2000, 0 }; // x4, y4 + * + * + * FT_Init_FreeType( &library ); + * + * FT_Property_Set( library, "type1", + * "darkening-parameters", darken_params ); + * } + * + * The x~values give the stem width, and the y~values the darkening + * amount. The unit is 1000th of pixels. All coordinate values must be + * positive; the x~values must be monotonically increasing; the + * y~values must be monotonically decreasing and smaller than or + * equal to 500 (corresponding to half a pixel); the slope of each + * linear piece must be shallower than -1 (e.g., -.4). + * + * The auto-hinter provides this property, too, as an experimental + * feature. See @no-stem-darkening for more. + * + * @note: + * This property can be used with @FT_Property_Get also. + * + * This property can be set via the `FREETYPE_PROPERTIES' environment + * variable, using eight comma-separated integers without spaces. Here + * the above example, using `\' to break the line for readability. + * + * { + * FREETYPE_PROPERTIES=\ + * type1:darkening-parameters=500,300,1000,200,1500,100,2000,0 + * } + * + * @since: + * 2.5.1 (for `cff' module) + * + * 2.6.2 (for `autofitter' module) + * + * 2.8.2 (for `type1' and `t1cid' modules) + * + */ + + + /************************************************************************** + * + * @property: + * random-seed + * + * @description: + * By default, the seed value for the CFF `random' operator and the + * similar `0 28 callothersubr pop' command for the Type~1 and CID + * drivers is set to a random value. However, mainly for debugging + * purposes, it is often necessary to use a known value as a seed so + * that the pseudo-random number sequences generated by `random' are + * repeatable. + * + * The `random-seed' property does that. Its argument is a signed 32bit + * integer; if the value is zero or negative, the seed given by the + * `intitialRandomSeed' private DICT operator in a CFF file gets used + * (or a default value if there is no such operator). If the value is + * positive, use it instead of `initialRandomSeed', which is + * consequently ignored. + * + * @note: + * This property can be set via the `FREETYPE_PROPERTIES' environment + * variable. It can also be set per face using @FT_Face_Properties with + * @FT_PARAM_TAG_RANDOM_SEED. + * + * @since: + * 2.8 (for `cff' module) + * + * 2.8.2 (for `type1' and `t1cid' modules) + * + */ + + + /************************************************************************** + * + * @property: + * no-long-family-names + * + * @description: + * If PCF_CONFIG_OPTION_LONG_FAMILY_NAMES is active while compiling + * FreeType, the PCF driver constructs long family names. + * + * There are many PCF fonts just called `Fixed' which look completely + * different, and which have nothing to do with each other. When + * selecting `Fixed' in KDE or Gnome one gets results that appear rather + * random, the style changes often if one changes the size and one + * cannot select some fonts at all. The improve this situation, the PCF + * module prepends the foundry name (plus a space) to the family name. + * It also checks whether there are `wide' characters; all put together, + * family names like `Sony Fixed' or `Misc Fixed Wide' are constructed. + * + * If `no-long-family-names' is set, this feature gets switched off. + * + * { + * FT_Library library; + * FT_Bool no_long_family_names = TRUE; + * + * + * FT_Init_FreeType( &library ); + * + * FT_Property_Set( library, "pcf", + * "no-long-family-names", + * &no_long_family_names ); + * } + * + * @note: + * This property can be used with @FT_Property_Get also. + * + * This property can be set via the `FREETYPE_PROPERTIES' environment + * variable (using values 1 and 0 for `on' and `off', respectively). + * + * @since: + * 2.8 + */ + + + /************************************************************************** + * + * @enum: + * TT_INTERPRETER_VERSION_XXX + * + * @description: + * A list of constants used for the @interpreter-version property to + * select the hinting engine for Truetype fonts. + * + * The numeric value in the constant names represents the version + * number as returned by the `GETINFO' bytecode instruction. + * + * @values: + * TT_INTERPRETER_VERSION_35 :: + * Version~35 corresponds to MS rasterizer v.1.7 as used e.g. in + * Windows~98; only grayscale and B/W rasterizing is supported. + * + * TT_INTERPRETER_VERSION_38 :: + * Version~38 corresponds to MS rasterizer v.1.9; it is roughly + * equivalent to the hinting provided by DirectWrite ClearType (as can + * be found, for example, in the Internet Explorer~9 running on + * Windows~7). It is used in FreeType to select the `Infinality' + * subpixel hinting code. The code may be removed in a future + * version. + * + * TT_INTERPRETER_VERSION_40 :: + * Version~40 corresponds to MS rasterizer v.2.1; it is roughly + * equivalent to the hinting provided by DirectWrite ClearType (as can + * be found, for example, in Microsoft's Edge Browser on Windows~10). + * It is used in FreeType to select the `minimal' subpixel hinting + * code, a stripped-down and higher performance version of the + * `Infinality' code. + * + * @note: + * This property controls the behaviour of the bytecode interpreter + * and thus how outlines get hinted. It does *not* control how glyph + * get rasterized! In particular, it does not control subpixel color + * filtering. + * + * If FreeType has not been compiled with the configuration option + * TT_CONFIG_OPTION_SUBPIXEL_HINTING, selecting version~38 or~40 causes + * an `FT_Err_Unimplemented_Feature' error. + * + * Depending on the graphics framework, Microsoft uses different + * bytecode and rendering engines. As a consequence, the version + * numbers returned by a call to the `GETINFO' bytecode instruction are + * more convoluted than desired. + * + * Here are two tables that try to shed some light on the possible + * values for the MS rasterizer engine, together with the additional + * features introduced by it. + * + * { + * GETINFO framework version feature + * ------------------------------------------------------------------- + * 3 GDI (Win 3.1), v1.0 16-bit, first version + * TrueImage + * 33 GDI (Win NT 3.1), v1.5 32-bit + * HP Laserjet + * 34 GDI (Win 95) v1.6 font smoothing, + * new SCANTYPE opcode + * 35 GDI (Win 98/2000) v1.7 (UN)SCALED_COMPONENT_OFFSET + * bits in composite glyphs + * 36 MGDI (Win CE 2) v1.6+ classic ClearType + * 37 GDI (XP and later), v1.8 ClearType + * GDI+ old (before Vista) + * 38 GDI+ old (Vista, Win 7), v1.9 subpixel ClearType, + * WPF Y-direction ClearType, + * additional error checking + * 39 DWrite (before Win 8) v2.0 subpixel ClearType flags + * in GETINFO opcode, + * bug fixes + * 40 GDI+ (after Win 7), v2.1 Y-direction ClearType flag + * DWrite (Win 8) in GETINFO opcode, + * Gray ClearType + * } + * + * The `version' field gives a rough orientation only, since some + * applications provided certain features much earlier (as an example, + * Microsoft Reader used subpixel and Y-direction ClearType already in + * Windows 2000). Similarly, updates to a given framework might include + * improved hinting support. + * + * { + * version sampling rendering comment + * x y x y + * -------------------------------------------------------------- + * v1.0 normal normal B/W B/W bi-level + * v1.6 high high gray gray grayscale + * v1.8 high normal color-filter B/W (GDI) ClearType + * v1.9 high high color-filter gray Color ClearType + * v2.1 high normal gray B/W Gray ClearType + * v2.1 high high gray gray Gray ClearType + * } + * + * Color and Gray ClearType are the two available variants of + * `Y-direction ClearType', meaning grayscale rasterization along the + * Y-direction; the name used in the TrueType specification for this + * feature is `symmetric smoothing'. `Classic ClearType' is the + * original algorithm used before introducing a modified version in + * Win~XP. Another name for v1.6's grayscale rendering is `font + * smoothing', and `Color ClearType' is sometimes also called `DWrite + * ClearType'. To differentiate between today's Color ClearType and the + * earlier ClearType variant with B/W rendering along the vertical axis, + * the latter is sometimes called `GDI ClearType'. + * + * `Normal' and `high' sampling describe the (virtual) resolution to + * access the rasterized outline after the hinting process. `Normal' + * means 1 sample per grid line (i.e., B/W). In the current Microsoft + * implementation, `high' means an extra virtual resolution of 16x16 (or + * 16x1) grid lines per pixel for bytecode instructions like `MIRP'. + * After hinting, these 16 grid lines are mapped to 6x5 (or 6x1) grid + * lines for color filtering if Color ClearType is activated. + * + * Note that `Gray ClearType' is essentially the same as v1.6's + * grayscale rendering. However, the GETINFO instruction handles it + * differently: v1.6 returns bit~12 (hinting for grayscale), while v2.1 + * returns bits~13 (hinting for ClearType), 18 (symmetrical smoothing), + * and~19 (Gray ClearType). Also, this mode respects bits 2 and~3 for + * the version~1 gasp table exclusively (like Color ClearType), while + * v1.6 only respects the values of version~0 (bits 0 and~1). + * + * Keep in mind that the features of the above interpreter versions + * might not map exactly to FreeType features or behavior because it is + * a fundamentally different library with different internals. + * + */ +#define TT_INTERPRETER_VERSION_35 35 +#define TT_INTERPRETER_VERSION_38 38 +#define TT_INTERPRETER_VERSION_40 40 + + + /************************************************************************** + * + * @property: + * interpreter-version + * + * @description: + * Currently, three versions are available, two representing the + * bytecode interpreter with subpixel hinting support (old `Infinality' + * code and new stripped-down and higher performance `minimal' code) and + * one without, respectively. The default is subpixel support if + * TT_CONFIG_OPTION_SUBPIXEL_HINTING is defined, and no subpixel support + * otherwise (since it isn't available then). + * + * If subpixel hinting is on, many TrueType bytecode instructions behave + * differently compared to B/W or grayscale rendering (except if `native + * ClearType' is selected by the font). Microsoft's main idea is to + * render at a much increased horizontal resolution, then sampling down + * the created output to subpixel precision. However, many older fonts + * are not suited to this and must be specially taken care of by + * applying (hardcoded) tweaks in Microsoft's interpreter. + * + * Details on subpixel hinting and some of the necessary tweaks can be + * found in Greg Hitchcock's whitepaper at + * `https://www.microsoft.com/typography/cleartype/truetypecleartype.aspx'. + * Note that FreeType currently doesn't really `subpixel hint' (6x1, 6x2, + * or 6x5 supersampling) like discussed in the paper. Depending on the + * chosen interpreter, it simply ignores instructions on vertical stems + * to arrive at very similar results. + * + * The following example code demonstrates how to deactivate subpixel + * hinting (omitting the error handling). + * + * { + * FT_Library library; + * FT_Face face; + * FT_UInt interpreter_version = TT_INTERPRETER_VERSION_35; + * + * + * FT_Init_FreeType( &library ); + * + * FT_Property_Set( library, "truetype", + * "interpreter-version", + * &interpreter_version ); + * } + * + * @note: + * This property can be used with @FT_Property_Get also. + * + * This property can be set via the `FREETYPE_PROPERTIES' environment + * variable (using values `35', `38', or `40'). + * + * @since: + * 2.5 + */ + + + /************************************************************************** + * + * @property: + * glyph-to-script-map + * + * @description: + * *Experimental* *only* + * + * The auto-hinter provides various script modules to hint glyphs. + * Examples of supported scripts are Latin or CJK. Before a glyph is + * auto-hinted, the Unicode character map of the font gets examined, and + * the script is then determined based on Unicode character ranges, see + * below. + * + * OpenType fonts, however, often provide much more glyphs than + * character codes (small caps, superscripts, ligatures, swashes, etc.), + * to be controlled by so-called `features'. Handling OpenType features + * can be quite complicated and thus needs a separate library on top of + * FreeType. + * + * The mapping between glyph indices and scripts (in the auto-hinter + * sense, see the @FT_AUTOHINTER_SCRIPT_XXX values) is stored as an + * array with `num_glyphs' elements, as found in the font's @FT_Face + * structure. The `glyph-to-script-map' property returns a pointer to + * this array, which can be modified as needed. Note that the + * modification should happen before the first glyph gets processed by + * the auto-hinter so that the global analysis of the font shapes + * actually uses the modified mapping. + * + * The following example code demonstrates how to access it (omitting + * the error handling). + * + * { + * FT_Library library; + * FT_Face face; + * FT_Prop_GlyphToScriptMap prop; + * + * + * FT_Init_FreeType( &library ); + * FT_New_Face( library, "foo.ttf", 0, &face ); + * + * prop.face = face; + * + * FT_Property_Get( library, "autofitter", + * "glyph-to-script-map", &prop ); + * + * // adjust `prop.map' as needed right here + * + * FT_Load_Glyph( face, ..., FT_LOAD_FORCE_AUTOHINT ); + * } + * + * @since: + * 2.4.11 + * + */ + + + /************************************************************************** + * + * @enum: + * FT_AUTOHINTER_SCRIPT_XXX + * + * @description: + * *Experimental* *only* + * + * A list of constants used for the @glyph-to-script-map property to + * specify the script submodule the auto-hinter should use for hinting a + * particular glyph. + * + * @values: + * FT_AUTOHINTER_SCRIPT_NONE :: + * Don't auto-hint this glyph. + * + * FT_AUTOHINTER_SCRIPT_LATIN :: + * Apply the latin auto-hinter. For the auto-hinter, `latin' is a + * very broad term, including Cyrillic and Greek also since characters + * from those scripts share the same design constraints. + * + * By default, characters from the following Unicode ranges are + * assigned to this submodule. + * + * { + * U+0020 - U+007F // Basic Latin (no control characters) + * U+00A0 - U+00FF // Latin-1 Supplement (no control characters) + * U+0100 - U+017F // Latin Extended-A + * U+0180 - U+024F // Latin Extended-B + * U+0250 - U+02AF // IPA Extensions + * U+02B0 - U+02FF // Spacing Modifier Letters + * U+0300 - U+036F // Combining Diacritical Marks + * U+0370 - U+03FF // Greek and Coptic + * U+0400 - U+04FF // Cyrillic + * U+0500 - U+052F // Cyrillic Supplement + * U+1D00 - U+1D7F // Phonetic Extensions + * U+1D80 - U+1DBF // Phonetic Extensions Supplement + * U+1DC0 - U+1DFF // Combining Diacritical Marks Supplement + * U+1E00 - U+1EFF // Latin Extended Additional + * U+1F00 - U+1FFF // Greek Extended + * U+2000 - U+206F // General Punctuation + * U+2070 - U+209F // Superscripts and Subscripts + * U+20A0 - U+20CF // Currency Symbols + * U+2150 - U+218F // Number Forms + * U+2460 - U+24FF // Enclosed Alphanumerics + * U+2C60 - U+2C7F // Latin Extended-C + * U+2DE0 - U+2DFF // Cyrillic Extended-A + * U+2E00 - U+2E7F // Supplemental Punctuation + * U+A640 - U+A69F // Cyrillic Extended-B + * U+A720 - U+A7FF // Latin Extended-D + * U+FB00 - U+FB06 // Alphab. Present. Forms (Latin Ligatures) + * U+1D400 - U+1D7FF // Mathematical Alphanumeric Symbols + * U+1F100 - U+1F1FF // Enclosed Alphanumeric Supplement + * } + * + * FT_AUTOHINTER_SCRIPT_CJK :: + * Apply the CJK auto-hinter, covering Chinese, Japanese, Korean, old + * Vietnamese, and some other scripts. + * + * By default, characters from the following Unicode ranges are + * assigned to this submodule. + * + * { + * U+1100 - U+11FF // Hangul Jamo + * U+2E80 - U+2EFF // CJK Radicals Supplement + * U+2F00 - U+2FDF // Kangxi Radicals + * U+2FF0 - U+2FFF // Ideographic Description Characters + * U+3000 - U+303F // CJK Symbols and Punctuation + * U+3040 - U+309F // Hiragana + * U+30A0 - U+30FF // Katakana + * U+3100 - U+312F // Bopomofo + * U+3130 - U+318F // Hangul Compatibility Jamo + * U+3190 - U+319F // Kanbun + * U+31A0 - U+31BF // Bopomofo Extended + * U+31C0 - U+31EF // CJK Strokes + * U+31F0 - U+31FF // Katakana Phonetic Extensions + * U+3200 - U+32FF // Enclosed CJK Letters and Months + * U+3300 - U+33FF // CJK Compatibility + * U+3400 - U+4DBF // CJK Unified Ideographs Extension A + * U+4DC0 - U+4DFF // Yijing Hexagram Symbols + * U+4E00 - U+9FFF // CJK Unified Ideographs + * U+A960 - U+A97F // Hangul Jamo Extended-A + * U+AC00 - U+D7AF // Hangul Syllables + * U+D7B0 - U+D7FF // Hangul Jamo Extended-B + * U+F900 - U+FAFF // CJK Compatibility Ideographs + * U+FE10 - U+FE1F // Vertical forms + * U+FE30 - U+FE4F // CJK Compatibility Forms + * U+FF00 - U+FFEF // Halfwidth and Fullwidth Forms + * U+1B000 - U+1B0FF // Kana Supplement + * U+1D300 - U+1D35F // Tai Xuan Hing Symbols + * U+1F200 - U+1F2FF // Enclosed Ideographic Supplement + * U+20000 - U+2A6DF // CJK Unified Ideographs Extension B + * U+2A700 - U+2B73F // CJK Unified Ideographs Extension C + * U+2B740 - U+2B81F // CJK Unified Ideographs Extension D + * U+2F800 - U+2FA1F // CJK Compatibility Ideographs Supplement + * } + * + * FT_AUTOHINTER_SCRIPT_INDIC :: + * Apply the indic auto-hinter, covering all major scripts from the + * Indian sub-continent and some other related scripts like Thai, Lao, + * or Tibetan. + * + * By default, characters from the following Unicode ranges are + * assigned to this submodule. + * + * { + * U+0900 - U+0DFF // Indic Range + * U+0F00 - U+0FFF // Tibetan + * U+1900 - U+194F // Limbu + * U+1B80 - U+1BBF // Sundanese + * U+A800 - U+A82F // Syloti Nagri + * U+ABC0 - U+ABFF // Meetei Mayek + * U+11800 - U+118DF // Sharada + * } + * + * Note that currently Indic support is rudimentary only, missing blue + * zone support. + * + * @since: + * 2.4.11 + * + */ +#define FT_AUTOHINTER_SCRIPT_NONE 0 +#define FT_AUTOHINTER_SCRIPT_LATIN 1 +#define FT_AUTOHINTER_SCRIPT_CJK 2 +#define FT_AUTOHINTER_SCRIPT_INDIC 3 + + + /************************************************************************** + * + * @struct: + * FT_Prop_GlyphToScriptMap + * + * @description: + * *Experimental* *only* + * + * The data exchange structure for the @glyph-to-script-map property. + * + * @since: + * 2.4.11 + * + */ + typedef struct FT_Prop_GlyphToScriptMap_ + { + FT_Face face; + FT_UShort* map; + + } FT_Prop_GlyphToScriptMap; + + + /************************************************************************** + * + * @property: + * fallback-script + * + * @description: + * *Experimental* *only* + * + * If no auto-hinter script module can be assigned to a glyph, a + * fallback script gets assigned to it (see also the + * @glyph-to-script-map property). By default, this is + * @FT_AUTOHINTER_SCRIPT_CJK. Using the `fallback-script' property, + * this fallback value can be changed. + * + * { + * FT_Library library; + * FT_UInt fallback_script = FT_AUTOHINTER_SCRIPT_NONE; + * + * + * FT_Init_FreeType( &library ); + * + * FT_Property_Set( library, "autofitter", + * "fallback-script", &fallback_script ); + * } + * + * @note: + * This property can be used with @FT_Property_Get also. + * + * It's important to use the right timing for changing this value: The + * creation of the glyph-to-script map that eventually uses the + * fallback script value gets triggered either by setting or reading a + * face-specific property like @glyph-to-script-map, or by auto-hinting + * any glyph from that face. In particular, if you have already created + * an @FT_Face structure but not loaded any glyph (using the + * auto-hinter), a change of the fallback script will affect this face. + * + * @since: + * 2.4.11 + * + */ + + + /************************************************************************** + * + * @property: + * default-script + * + * @description: + * *Experimental* *only* + * + * If FreeType gets compiled with FT_CONFIG_OPTION_USE_HARFBUZZ to make + * the HarfBuzz library access OpenType features for getting better + * glyph coverages, this property sets the (auto-fitter) script to be + * used for the default (OpenType) script data of a font's GSUB table. + * Features for the default script are intended for all scripts not + * explicitly handled in GSUB; an example is a `dlig' feature, + * containing the combination of the characters `T', `E', and `L' to + * form a `TEL' ligature. + * + * By default, this is @FT_AUTOHINTER_SCRIPT_LATIN. Using the + * `default-script' property, this default value can be changed. + * + * { + * FT_Library library; + * FT_UInt default_script = FT_AUTOHINTER_SCRIPT_NONE; + * + * + * FT_Init_FreeType( &library ); + * + * FT_Property_Set( library, "autofitter", + * "default-script", &default_script ); + * } + * + * @note: + * This property can be used with @FT_Property_Get also. + * + * It's important to use the right timing for changing this value: The + * creation of the glyph-to-script map that eventually uses the + * default script value gets triggered either by setting or reading a + * face-specific property like @glyph-to-script-map, or by auto-hinting + * any glyph from that face. In particular, if you have already created + * an @FT_Face structure but not loaded any glyph (using the + * auto-hinter), a change of the default script will affect this face. + * + */ + + + /************************************************************************** + * + * @property: + * increase-x-height + * + * @description: + * For ppem values in the range 6~<= ppem <= `increase-x-height', round + * up the font's x~height much more often than normally. If the value + * is set to~0, which is the default, this feature is switched off. Use + * this property to improve the legibility of small font sizes if + * necessary. + * + * { + * FT_Library library; + * FT_Face face; + * FT_Prop_IncreaseXHeight prop; + * + * + * FT_Init_FreeType( &library ); + * FT_New_Face( library, "foo.ttf", 0, &face ); + * FT_Set_Char_Size( face, 10 * 64, 0, 72, 0 ); + * + * prop.face = face; + * prop.limit = 14; + * + * FT_Property_Set( library, "autofitter", + * "increase-x-height", &prop ); + * } + * + * @note: + * This property can be used with @FT_Property_Get also. + * + * Set this value right after calling @FT_Set_Char_Size, but before + * loading any glyph (using the auto-hinter). + * + * @since: + * 2.4.11 + * + */ + + + /************************************************************************** + * + * @struct: + * FT_Prop_IncreaseXHeight + * + * @description: + * The data exchange structure for the @increase-x-height property. + * + */ + typedef struct FT_Prop_IncreaseXHeight_ + { + FT_Face face; + FT_UInt limit; + + } FT_Prop_IncreaseXHeight; + + + /************************************************************************** + * + * @property: + * warping + * + * @description: + * *Experimental* *only* + * + * If FreeType gets compiled with option AF_CONFIG_OPTION_USE_WARPER to + * activate the warp hinting code in the auto-hinter, this property + * switches warping on and off. + * + * Warping only works in `normal' auto-hinting mode replacing it. + * The idea of the code is to slightly scale and shift a glyph along + * the non-hinted dimension (which is usually the horizontal axis) so + * that as much of its segments are aligned (more or less) to the grid. + * To find out a glyph's optimal scaling and shifting value, various + * parameter combinations are tried and scored. + * + * By default, warping is off. The example below shows how to switch on + * warping (omitting the error handling). + * + * { + * FT_Library library; + * FT_Bool warping = 1; + * + * + * FT_Init_FreeType( &library ); + * + * FT_Property_Set( library, "autofitter", + * "warping", &warping ); + * } + * + * @note: + * This property can be used with @FT_Property_Get also. + * + * This property can be set via the `FREETYPE_PROPERTIES' environment + * variable (using values 1 and 0 for `on' and `off', respectively). + * + * The warping code can also change advance widths. Have a look at the + * `lsb_delta' and `rsb_delta' fields in the @FT_GlyphSlotRec structure + * for details on improving inter-glyph distances while rendering. + * + * Since warping is a global property of the auto-hinter it is best to + * change its value before rendering any face. Otherwise, you should + * reload all faces that get auto-hinted in `normal' hinting mode. + * + */ + + + /* */ + + +FT_END_HEADER + + +#endif /* FTDRIVER_H_ */ + + +/* END */ diff --git a/include/freetype/ftparams.h b/include/freetype/ftparams.h index 992b35026..9f92daef9 100644 --- a/include/freetype/ftparams.h +++ b/include/freetype/ftparams.h @@ -161,8 +161,7 @@ FT_BEGIN_HEADER * An @FT_Parameter tag to be used with @FT_Face_Properties. The * corresponding Boolean argument specifies whether to apply stem * darkening, overriding the global default values or the values set up - * with @FT_Property_Set (see @no-stem-darkening[autofit] and - * @no-stem-darkening[cff]). + * with @FT_Property_Set (see @no-stem-darkening). * * This is a passive setting that only takes effect if the font driver * or autohinter honors it, which the CFF, Type~1, and CID drivers diff --git a/include/freetype/ftpcfdrv.h b/include/freetype/ftpcfdrv.h deleted file mode 100644 index 7f602991c..000000000 --- a/include/freetype/ftpcfdrv.h +++ /dev/null @@ -1,107 +0,0 @@ -/***************************************************************************/ -/* */ -/* ftpcfdrv.h */ -/* */ -/* FreeType API for controlling the PCF driver (specification only). */ -/* */ -/* Copyright 2017 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef FTPCFDRV_H_ -#define FTPCFDRV_H_ - -#include -#include FT_FREETYPE_H - -#ifdef FREETYPE_H -#error "freetype.h of FreeType 1 has been loaded!" -#error "Please fix the directory search order for header files" -#error "so that freetype.h of FreeType 2 is found first." -#endif - - -FT_BEGIN_HEADER - - - /************************************************************************** - * - * @section: - * pcf_driver - * - * @title: - * The PCF driver - * - * @abstract: - * Controlling the PCF driver module. - * - * @description: - * While FreeType's PCF driver doesn't expose API functions by itself, - * it is possible to control its behaviour with @FT_Property_Set and - * @FT_Property_Get. Right now, there is a single property - * `no-long-family-names' available if FreeType is compiled with - * PCF_CONFIG_OPTION_LONG_FAMILY_NAMES. - * - * The PCF driver's module name is `pcf'. - * - */ - - - /************************************************************************** - * - * @property: - * no-long-family-names - * - * @description: - * If PCF_CONFIG_OPTION_LONG_FAMILY_NAMES is active while compiling - * FreeType, the PCF driver constructs long family names. - * - * There are many PCF fonts just called `Fixed' which look completely - * different, and which have nothing to do with each other. When - * selecting `Fixed' in KDE or Gnome one gets results that appear rather - * random, the style changes often if one changes the size and one - * cannot select some fonts at all. The improve this situation, the PCF - * module prepends the foundry name (plus a space) to the family name. - * It also checks whether there are `wide' characters; all put together, - * family names like `Sony Fixed' or `Misc Fixed Wide' are constructed. - * - * If `no-long-family-names' is set, this feature gets switched off. - * - * { - * FT_Library library; - * FT_Bool no_long_family_names = TRUE; - * - * - * FT_Init_FreeType( &library ); - * - * FT_Property_Set( library, "pcf", - * "no-long-family-names", - * &no_long_family_names ); - * } - * - * @note: - * This property can be used with @FT_Property_Get also. - * - * This property can be set via the `FREETYPE_PROPERTIES' environment - * variable (using values 1 and 0 for `on' and `off', respectively). - * - * @since: - * 2.8 - */ - - -FT_END_HEADER - - -#endif /* FTPCFDRV_H_ */ - - -/* END */ diff --git a/include/freetype/ftt1drv.h b/include/freetype/ftt1drv.h deleted file mode 100644 index a8e6b0808..000000000 --- a/include/freetype/ftt1drv.h +++ /dev/null @@ -1,109 +0,0 @@ -/***************************************************************************/ -/* */ -/* ftt1drv.h */ -/* */ -/* FreeType API for controlling the Type 1 driver (specification only). */ -/* */ -/* Copyright 2017 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef FTT1DRV_H_ -#define FTT1DRV_H_ - -#include -#include FT_FREETYPE_H -#include FT_PARAMETER_TAGS_H - -#ifdef FREETYPE_H -#error "freetype.h of FreeType 1 has been loaded!" -#error "Please fix the directory search order for header files" -#error "so that freetype.h of FreeType 2 is found first." -#endif - - -FT_BEGIN_HEADER - - - /************************************************************************** - * - * @property: - * hinting-engine[type1] - * - * @description: - * Thanks to Adobe, which contributed a new hinting (and parsing) - * engine, an application can select between `freetype' and `adobe' if - * compiled with T1_CONFIG_OPTION_OLD_ENGINE. If this configuration - * macro isn't defined, `hinting-engine' does nothing. - * - * The default engine is `freetype' if T1_CONFIG_OPTION_OLD_ENGINE is - * defined, and `adobe' otherwise. - * - * The following example code demonstrates how to select Adobe's hinting - * engine (omitting the error handling). - * - * { - * FT_Library library; - * FT_UInt hinting_engine = FT_T1_HINTING_ADOBE; - * - * - * FT_Init_FreeType( &library ); - * - * FT_Property_Set( library, "type1", - * "hinting-engine", &hinting_engine ); - * } - * - * @note: - * This property can be used with @FT_Property_Get also. - * - * This property can be set via the `FREETYPE_PROPERTIES' environment - * variable (using values `adobe' or `freetype'). - * - * @since: - * 2.8.2 - * - */ - - - /************************************************************************** - * - * @enum: - * FT_T1_HINTING_XXX - * - * @description: - * A list of constants used for the @hinting-engine[type1] property to - * select the hinting engine for Type 1 fonts. - * - * @values: - * FT_T1_HINTING_FREETYPE :: - * Use the old FreeType hinting engine. - * - * FT_T1_HINTING_ADOBE :: - * Use the hinting engine contributed by Adobe. - * - * @since: - * 2.8.2 - * - */ -#define FT_T1_HINTING_FREETYPE 0 -#define FT_T1_HINTING_ADOBE 1 - - - /* */ - - -FT_END_HEADER - - -#endif /* FTT1DRV_H_ */ - - -/* END */ diff --git a/include/freetype/ftttdrv.h b/include/freetype/ftttdrv.h deleted file mode 100644 index d65d39d19..000000000 --- a/include/freetype/ftttdrv.h +++ /dev/null @@ -1,331 +0,0 @@ -/***************************************************************************/ -/* */ -/* ftttdrv.h */ -/* */ -/* FreeType API for controlling the TrueType driver */ -/* (specification only). */ -/* */ -/* Copyright 2013-2017 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef FTTTDRV_H_ -#define FTTTDRV_H_ - -#include -#include FT_FREETYPE_H - -#ifdef FREETYPE_H -#error "freetype.h of FreeType 1 has been loaded!" -#error "Please fix the directory search order for header files" -#error "so that freetype.h of FreeType 2 is found first." -#endif - - -FT_BEGIN_HEADER - - - /************************************************************************** - * - * @section: - * tt_driver - * - * @title: - * The TrueType driver - * - * @abstract: - * Controlling the TrueType driver module. - * - * @description: - * While FreeType's TrueType driver doesn't expose API functions by - * itself, it is possible to control its behaviour with @FT_Property_Set - * and @FT_Property_Get. The following lists the available properties - * together with the necessary macros and structures. - * - * The TrueType driver's module name is `truetype'. - * - * We start with a list of definitions, kindly provided by Greg - * Hitchcock. - * - * _Bi-Level_ _Rendering_ - * - * Monochromatic rendering, exclusively used in the early days of - * TrueType by both Apple and Microsoft. Microsoft's GDI interface - * supported hinting of the right-side bearing point, such that the - * advance width could be non-linear. Most often this was done to - * achieve some level of glyph symmetry. To enable reasonable - * performance (e.g., not having to run hinting on all glyphs just to - * get the widths) there was a bit in the head table indicating if the - * side bearing was hinted, and additional tables, `hdmx' and `LTSH', to - * cache hinting widths across multiple sizes and device aspect ratios. - * - * _Font_ _Smoothing_ - * - * Microsoft's GDI implementation of anti-aliasing. Not traditional - * anti-aliasing as the outlines were hinted before the sampling. The - * widths matched the bi-level rendering. - * - * _ClearType_ _Rendering_ - * - * Technique that uses physical subpixels to improve rendering on LCD - * (and other) displays. Because of the higher resolution, many methods - * of improving symmetry in glyphs through hinting the right-side - * bearing were no longer necessary. This lead to what GDI calls - * `natural widths' ClearType, see - * http://www.beatstamm.com/typography/RTRCh4.htm#Sec21. Since hinting - * has extra resolution, most non-linearity went away, but it is still - * possible for hints to change the advance widths in this mode. - * - * _ClearType_ _Compatible_ _Widths_ - * - * One of the earliest challenges with ClearType was allowing the - * implementation in GDI to be selected without requiring all UI and - * documents to reflow. To address this, a compatible method of - * rendering ClearType was added where the font hints are executed once - * to determine the width in bi-level rendering, and then re-run in - * ClearType, with the difference in widths being absorbed in the font - * hints for ClearType (mostly in the white space of hints); see - * http://www.beatstamm.com/typography/RTRCh4.htm#Sec20. Somewhat by - * definition, compatible width ClearType allows for non-linear widths, - * but only when the bi-level version has non-linear widths. - * - * _ClearType_ _Subpixel_ _Positioning_ - * - * One of the nice benefits of ClearType is the ability to more crisply - * display fractional widths; unfortunately, the GDI model of integer - * bitmaps did not support this. However, the WPF and Direct Write - * frameworks do support fractional widths. DWrite calls this `natural - * mode', not to be confused with GDI's `natural widths'. Subpixel - * positioning, in the current implementation of Direct Write, - * unfortunately does not support hinted advance widths, see - * http://www.beatstamm.com/typography/RTRCh4.htm#Sec22. Note that the - * TrueType interpreter fully allows the advance width to be adjusted in - * this mode, just the DWrite client will ignore those changes. - * - * _ClearType_ _Backward_ _Compatibility_ - * - * This is a set of exceptions made in the TrueType interpreter to - * minimize hinting techniques that were problematic with the extra - * resolution of ClearType; see - * http://www.beatstamm.com/typography/RTRCh4.htm#Sec1 and - * https://www.microsoft.com/typography/cleartype/truetypecleartype.aspx. - * This technique is not to be confused with ClearType compatible - * widths. ClearType backward compatibility has no direct impact on - * changing advance widths, but there might be an indirect impact on - * disabling some deltas. This could be worked around in backward - * compatibility mode. - * - * _Native_ _ClearType_ _Mode_ - * - * (Not to be confused with `natural widths'.) This mode removes all - * the exceptions in the TrueType interpreter when running with - * ClearType. Any issues on widths would still apply, though. - * - */ - - - /************************************************************************** - * - * @property: - * interpreter-version - * - * @description: - * Currently, three versions are available, two representing the - * bytecode interpreter with subpixel hinting support (old `Infinality' - * code and new stripped-down and higher performance `minimal' code) and - * one without, respectively. The default is subpixel support if - * TT_CONFIG_OPTION_SUBPIXEL_HINTING is defined, and no subpixel support - * otherwise (since it isn't available then). - * - * If subpixel hinting is on, many TrueType bytecode instructions behave - * differently compared to B/W or grayscale rendering (except if `native - * ClearType' is selected by the font). Microsoft's main idea is to - * render at a much increased horizontal resolution, then sampling down - * the created output to subpixel precision. However, many older fonts - * are not suited to this and must be specially taken care of by - * applying (hardcoded) tweaks in Microsoft's interpreter. - * - * Details on subpixel hinting and some of the necessary tweaks can be - * found in Greg Hitchcock's whitepaper at - * `https://www.microsoft.com/typography/cleartype/truetypecleartype.aspx'. - * Note that FreeType currently doesn't really `subpixel hint' (6x1, 6x2, - * or 6x5 supersampling) like discussed in the paper. Depending on the - * chosen interpreter, it simply ignores instructions on vertical stems - * to arrive at very similar results. - * - * The following example code demonstrates how to deactivate subpixel - * hinting (omitting the error handling). - * - * { - * FT_Library library; - * FT_Face face; - * FT_UInt interpreter_version = TT_INTERPRETER_VERSION_35; - * - * - * FT_Init_FreeType( &library ); - * - * FT_Property_Set( library, "truetype", - * "interpreter-version", - * &interpreter_version ); - * } - * - * @note: - * This property can be used with @FT_Property_Get also. - * - * This property can be set via the `FREETYPE_PROPERTIES' environment - * variable (using values `35', `38', or `40'). - * - * @since: - * 2.5 - */ - - - /************************************************************************** - * - * @enum: - * TT_INTERPRETER_VERSION_XXX - * - * @description: - * A list of constants used for the @interpreter-version property to - * select the hinting engine for Truetype fonts. - * - * The numeric value in the constant names represents the version - * number as returned by the `GETINFO' bytecode instruction. - * - * @values: - * TT_INTERPRETER_VERSION_35 :: - * Version~35 corresponds to MS rasterizer v.1.7 as used e.g. in - * Windows~98; only grayscale and B/W rasterizing is supported. - * - * TT_INTERPRETER_VERSION_38 :: - * Version~38 corresponds to MS rasterizer v.1.9; it is roughly - * equivalent to the hinting provided by DirectWrite ClearType (as can - * be found, for example, in the Internet Explorer~9 running on - * Windows~7). It is used in FreeType to select the `Infinality' - * subpixel hinting code. The code may be removed in a future - * version. - * - * TT_INTERPRETER_VERSION_40 :: - * Version~40 corresponds to MS rasterizer v.2.1; it is roughly - * equivalent to the hinting provided by DirectWrite ClearType (as can - * be found, for example, in Microsoft's Edge Browser on Windows~10). - * It is used in FreeType to select the `minimal' subpixel hinting - * code, a stripped-down and higher performance version of the - * `Infinality' code. - * - * @note: - * This property controls the behaviour of the bytecode interpreter - * and thus how outlines get hinted. It does *not* control how glyph - * get rasterized! In particular, it does not control subpixel color - * filtering. - * - * If FreeType has not been compiled with the configuration option - * TT_CONFIG_OPTION_SUBPIXEL_HINTING, selecting version~38 or~40 causes - * an `FT_Err_Unimplemented_Feature' error. - * - * Depending on the graphics framework, Microsoft uses different - * bytecode and rendering engines. As a consequence, the version - * numbers returned by a call to the `GETINFO' bytecode instruction are - * more convoluted than desired. - * - * Here are two tables that try to shed some light on the possible - * values for the MS rasterizer engine, together with the additional - * features introduced by it. - * - * { - * GETINFO framework version feature - * ------------------------------------------------------------------- - * 3 GDI (Win 3.1), v1.0 16-bit, first version - * TrueImage - * 33 GDI (Win NT 3.1), v1.5 32-bit - * HP Laserjet - * 34 GDI (Win 95) v1.6 font smoothing, - * new SCANTYPE opcode - * 35 GDI (Win 98/2000) v1.7 (UN)SCALED_COMPONENT_OFFSET - * bits in composite glyphs - * 36 MGDI (Win CE 2) v1.6+ classic ClearType - * 37 GDI (XP and later), v1.8 ClearType - * GDI+ old (before Vista) - * 38 GDI+ old (Vista, Win 7), v1.9 subpixel ClearType, - * WPF Y-direction ClearType, - * additional error checking - * 39 DWrite (before Win 8) v2.0 subpixel ClearType flags - * in GETINFO opcode, - * bug fixes - * 40 GDI+ (after Win 7), v2.1 Y-direction ClearType flag - * DWrite (Win 8) in GETINFO opcode, - * Gray ClearType - * } - * - * The `version' field gives a rough orientation only, since some - * applications provided certain features much earlier (as an example, - * Microsoft Reader used subpixel and Y-direction ClearType already in - * Windows 2000). Similarly, updates to a given framework might include - * improved hinting support. - * - * { - * version sampling rendering comment - * x y x y - * -------------------------------------------------------------- - * v1.0 normal normal B/W B/W bi-level - * v1.6 high high gray gray grayscale - * v1.8 high normal color-filter B/W (GDI) ClearType - * v1.9 high high color-filter gray Color ClearType - * v2.1 high normal gray B/W Gray ClearType - * v2.1 high high gray gray Gray ClearType - * } - * - * Color and Gray ClearType are the two available variants of - * `Y-direction ClearType', meaning grayscale rasterization along the - * Y-direction; the name used in the TrueType specification for this - * feature is `symmetric smoothing'. `Classic ClearType' is the - * original algorithm used before introducing a modified version in - * Win~XP. Another name for v1.6's grayscale rendering is `font - * smoothing', and `Color ClearType' is sometimes also called `DWrite - * ClearType'. To differentiate between today's Color ClearType and the - * earlier ClearType variant with B/W rendering along the vertical axis, - * the latter is sometimes called `GDI ClearType'. - * - * `Normal' and `high' sampling describe the (virtual) resolution to - * access the rasterized outline after the hinting process. `Normal' - * means 1 sample per grid line (i.e., B/W). In the current Microsoft - * implementation, `high' means an extra virtual resolution of 16x16 (or - * 16x1) grid lines per pixel for bytecode instructions like `MIRP'. - * After hinting, these 16 grid lines are mapped to 6x5 (or 6x1) grid - * lines for color filtering if Color ClearType is activated. - * - * Note that `Gray ClearType' is essentially the same as v1.6's - * grayscale rendering. However, the GETINFO instruction handles it - * differently: v1.6 returns bit~12 (hinting for grayscale), while v2.1 - * returns bits~13 (hinting for ClearType), 18 (symmetrical smoothing), - * and~19 (Gray ClearType). Also, this mode respects bits 2 and~3 for - * the version~1 gasp table exclusively (like Color ClearType), while - * v1.6 only respects the values of version~0 (bits 0 and~1). - * - * Keep in mind that the features of the above interpreter versions - * might not map exactly to FreeType features or behavior because it is - * a fundamentally different library with different internals. - * - */ -#define TT_INTERPRETER_VERSION_35 35 -#define TT_INTERPRETER_VERSION_38 38 -#define TT_INTERPRETER_VERSION_40 40 - - /* */ - - -FT_END_HEADER - - -#endif /* FTTTDRV_H_ */ - - -/* END */ diff --git a/src/autofit/afmodule.c b/src/autofit/afmodule.c index 9d7ba224d..666146750 100644 --- a/src/autofit/afmodule.c +++ b/src/autofit/afmodule.c @@ -56,7 +56,7 @@ #include FT_INTERNAL_OBJECTS_H #include FT_INTERNAL_DEBUG_H -#include FT_AUTOHINTER_H +#include FT_DRIVER_H #include FT_SERVICE_PROPERTIES_H diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c index ccf526f23..1d36860e7 100644 --- a/src/base/ftobjs.c +++ b/src/base/ftobjs.c @@ -41,9 +41,7 @@ #include FT_SERVICE_KERNING_H #include FT_SERVICE_TRUETYPE_ENGINE_H -#include FT_AUTOHINTER_H -#include FT_CFF_DRIVER_H -#include FT_TYPE1_DRIVER_H +#include FT_DRIVER_H #ifdef FT_CONFIG_OPTION_MAC_FONTS #include "ftbase.h" @@ -849,7 +847,7 @@ /* we use `strstr' to catch both `Type 1' and `CID Type 1' */ is_light_type1 = ft_strstr( FT_Get_Font_Format( face ), "Type 1" ) != NULL && - ((PS_Driver)driver)->hinting_engine == FT_T1_HINTING_ADOBE; + ((PS_Driver)driver)->hinting_engine == FT_HINTING_ADOBE; /* the check for `num_locations' assures that we actually */ /* test for instructions in a TTF and not in a CFF-based OTF */ diff --git a/src/cff/cffdrivr.c b/src/cff/cffdrivr.c index d0856919d..cc661a48e 100644 --- a/src/cff/cffdrivr.c +++ b/src/cff/cffdrivr.c @@ -46,7 +46,7 @@ #include FT_SERVICE_FONT_FORMAT_H #include FT_SERVICE_GLYPH_DICT_H #include FT_SERVICE_PROPERTIES_H -#include FT_CFF_DRIVER_H +#include FT_DRIVER_H /*************************************************************************/ @@ -905,10 +905,10 @@ if ( !ft_strcmp( s, "adobe" ) ) - driver->hinting_engine = FT_CFF_HINTING_ADOBE; + driver->hinting_engine = FT_HINTING_ADOBE; #ifdef CFF_CONFIG_OPTION_OLD_ENGINE else if ( !ft_strcmp( s, "freetype" ) ) - driver->hinting_engine = FT_CFF_HINTING_FREETYPE; + driver->hinting_engine = FT_HINTING_FREETYPE; #endif else return FT_THROW( Invalid_Argument ); @@ -919,9 +919,9 @@ FT_UInt* hinting_engine = (FT_UInt*)value; - if ( *hinting_engine == FT_CFF_HINTING_ADOBE + if ( *hinting_engine == FT_HINTING_ADOBE #ifdef CFF_CONFIG_OPTION_OLD_ENGINE - || *hinting_engine == FT_CFF_HINTING_FREETYPE + || *hinting_engine == FT_HINTING_FREETYPE #endif ) driver->hinting_engine = *hinting_engine; diff --git a/src/cff/cffgload.c b/src/cff/cffgload.c index 5429460cc..64179af2e 100644 --- a/src/cff/cffgload.c +++ b/src/cff/cffgload.c @@ -23,7 +23,7 @@ #include FT_INTERNAL_CALC_H #include FT_INTERNAL_POSTSCRIPT_AUX_H #include FT_OUTLINE_H -#include FT_CFF_DRIVER_H +#include FT_DRIVER_H #include "cffload.h" #include "cffgload.h" @@ -428,7 +428,7 @@ #ifdef CFF_CONFIG_OPTION_OLD_ENGINE /* choose which CFF renderer to use */ - if ( driver->hinting_engine == FT_CFF_HINTING_FREETYPE ) + if ( driver->hinting_engine == FT_HINTING_FREETYPE ) error = decoder_funcs->parse_charstrings_old( &decoder, charstring, charstring_len, diff --git a/src/cff/cffobjs.c b/src/cff/cffobjs.c index 8f26278a8..d4b6e5941 100644 --- a/src/cff/cffobjs.c +++ b/src/cff/cffobjs.c @@ -25,7 +25,7 @@ #include FT_TRUETYPE_IDS_H #include FT_TRUETYPE_TAGS_H #include FT_INTERNAL_SFNT_H -#include FT_CFF_DRIVER_H +#include FT_DRIVER_H #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT #include FT_MULTIPLE_MASTERS_H @@ -1164,9 +1164,9 @@ /* set default property values, cf. `ftcffdrv.h' */ #ifdef CFF_CONFIG_OPTION_OLD_ENGINE - driver->hinting_engine = FT_CFF_HINTING_FREETYPE; + driver->hinting_engine = FT_HINTING_FREETYPE; #else - driver->hinting_engine = FT_CFF_HINTING_ADOBE; + driver->hinting_engine = FT_HINTING_ADOBE; #endif driver->no_stem_darkening = TRUE; diff --git a/src/cid/cidgload.c b/src/cid/cidgload.c index 086e88997..76aa09556 100644 --- a/src/cid/cidgload.c +++ b/src/cid/cidgload.c @@ -26,7 +26,7 @@ #include FT_INTERNAL_POSTSCRIPT_AUX_H #include FT_INTERNAL_CFF_TYPES_H -#include FT_TYPE1_DRIVER_H +#include FT_DRIVER_H #include "ciderrs.h" @@ -178,7 +178,7 @@ /* choose which renderer to use */ #ifdef T1_CONFIG_OPTION_OLD_ENGINE if ( ( (PS_Driver)FT_FACE_DRIVER( face ) )->hinting_engine == - FT_T1_HINTING_FREETYPE || + FT_HINTING_FREETYPE || decoder->builder.metrics_only ) error = psaux->t1_decoder_funcs->parse_charstrings_old( decoder, diff --git a/src/cid/cidobjs.c b/src/cid/cidobjs.c index 4f4cf4697..ed1dca265 100644 --- a/src/cid/cidobjs.c +++ b/src/cid/cidobjs.c @@ -26,7 +26,7 @@ #include FT_SERVICE_POSTSCRIPT_CMAPS_H #include FT_INTERNAL_POSTSCRIPT_AUX_H #include FT_INTERNAL_POSTSCRIPT_HINTS_H -#include FT_TYPE1_DRIVER_H +#include FT_DRIVER_H #include "ciderrs.h" @@ -473,9 +473,9 @@ /* set default property values, cf. `ftt1drv.h' */ #ifdef T1_CONFIG_OPTION_OLD_ENGINE - driver->hinting_engine = FT_T1_HINTING_FREETYPE; + driver->hinting_engine = FT_HINTING_FREETYPE; #else - driver->hinting_engine = FT_T1_HINTING_ADOBE; + driver->hinting_engine = FT_HINTING_ADOBE; #endif driver->no_stem_darkening = TRUE; diff --git a/src/cid/cidriver.c b/src/cid/cidriver.c index 94bf858d3..485e1247c 100644 --- a/src/cid/cidriver.c +++ b/src/cid/cidriver.c @@ -28,7 +28,7 @@ #include FT_SERVICE_POSTSCRIPT_INFO_H #include FT_SERVICE_CID_H #include FT_SERVICE_PROPERTIES_H -#include FT_TYPE1_DRIVER_H +#include FT_DRIVER_H #include FT_INTERNAL_POSTSCRIPT_AUX_H @@ -260,10 +260,10 @@ if ( !ft_strcmp( s, "adobe" ) ) - driver->hinting_engine = FT_T1_HINTING_ADOBE; + driver->hinting_engine = FT_HINTING_ADOBE; #ifdef T1_CONFIG_OPTION_OLD_ENGINE else if ( !ft_strcmp( s, "freetype" ) ) - driver->hinting_engine = FT_T1_HINTING_FREETYPE; + driver->hinting_engine = FT_HINTING_FREETYPE; #endif else return FT_THROW( Invalid_Argument ); @@ -274,9 +274,9 @@ FT_UInt* hinting_engine = (FT_UInt*)value; - if ( *hinting_engine == FT_T1_HINTING_ADOBE + if ( *hinting_engine == FT_HINTING_ADOBE #ifdef T1_CONFIG_OPTION_OLD_ENGINE - || *hinting_engine == FT_T1_HINTING_FREETYPE + || *hinting_engine == FT_HINTING_FREETYPE #endif ) driver->hinting_engine = *hinting_engine; diff --git a/src/pcf/pcfdrivr.c b/src/pcf/pcfdrivr.c index 169f75e95..0119d9485 100644 --- a/src/pcf/pcfdrivr.c +++ b/src/pcf/pcfdrivr.c @@ -50,7 +50,7 @@ THE SOFTWARE. #include FT_SERVICE_BDF_H #include FT_SERVICE_FONT_FORMAT_H #include FT_SERVICE_PROPERTIES_H -#include FT_PCF_DRIVER_H +#include FT_DRIVER_H /*************************************************************************/ diff --git a/src/psaux/psobjs.c b/src/psaux/psobjs.c index 2b70a2eb6..e871cb8be 100644 --- a/src/psaux/psobjs.c +++ b/src/psaux/psobjs.c @@ -20,8 +20,7 @@ #include FT_INTERNAL_POSTSCRIPT_AUX_H #include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_CALC_H -#include FT_CFF_DRIVER_H -#include FT_TYPE1_DRIVER_H +#include FT_DRIVER_H #include "psobjs.h" #include "psconv.h" @@ -1894,7 +1893,7 @@ PS_Driver driver = (PS_Driver)FT_FACE_DRIVER( builder->face ); - if ( driver->hinting_engine == FT_CFF_HINTING_FREETYPE ) + if ( driver->hinting_engine == FT_HINTING_FREETYPE ) { point->x = x >> 16; point->y = y >> 16; @@ -2170,7 +2169,7 @@ if ( !builder->is_t1 && - driver->hinting_engine == FT_CFF_HINTING_FREETYPE ) + driver->hinting_engine == FT_HINTING_FREETYPE ) { point->x = x >> 16; point->y = y >> 16; @@ -2182,7 +2181,7 @@ PS_Driver driver = (PS_Driver)FT_FACE_DRIVER( builder->face ); #endif if ( builder->is_t1 && - driver->hinting_engine == FT_T1_HINTING_FREETYPE ) + driver->hinting_engine == FT_HINTING_FREETYPE ) { point->x = FIXED_TO_INT( x ); point->y = FIXED_TO_INT( y ); diff --git a/src/tools/ftfuzzer/ftfuzzer.cc b/src/tools/ftfuzzer/ftfuzzer.cc index 4da0c2bf2..1382adaf9 100644 --- a/src/tools/ftfuzzer/ftfuzzer.cc +++ b/src/tools/ftfuzzer/ftfuzzer.cc @@ -43,8 +43,7 @@ #include FT_OUTLINE_H #include FT_BBOX_H #include FT_MODULE_H -#include FT_CFF_DRIVER_H -#include FT_TRUETYPE_DRIVER_H +#include FT_DRIVER_H #include FT_MULTIPLE_MASTERS_H @@ -61,7 +60,7 @@ return; // try to activate Adobe's CFF engine; it might not be the default - unsigned int cff_hinting_engine = FT_CFF_HINTING_ADOBE; + unsigned int cff_hinting_engine = FT_HINTING_ADOBE; FT_Property_Set( library, "cff", "hinting-engine", &cff_hinting_engine ); diff --git a/src/truetype/ttdriver.c b/src/truetype/ttdriver.c index ba05cefb3..a1d1cfdfe 100644 --- a/src/truetype/ttdriver.c +++ b/src/truetype/ttdriver.c @@ -31,7 +31,7 @@ #include FT_SERVICE_TRUETYPE_ENGINE_H #include FT_SERVICE_TRUETYPE_GLYF_H #include FT_SERVICE_PROPERTIES_H -#include FT_TRUETYPE_DRIVER_H +#include FT_DRIVER_H #include "ttdriver.h" #include "ttgload.h" diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c index dfdeb9eb6..917aa62aa 100644 --- a/src/truetype/ttgload.c +++ b/src/truetype/ttgload.c @@ -24,7 +24,7 @@ #include FT_INTERNAL_SFNT_H #include FT_TRUETYPE_TAGS_H #include FT_OUTLINE_H -#include FT_TRUETYPE_DRIVER_H +#include FT_DRIVER_H #include FT_LIST_H #include "ttgload.h" diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c index bb45655e4..db5aaa32c 100644 --- a/src/truetype/ttinterp.c +++ b/src/truetype/ttinterp.c @@ -25,7 +25,7 @@ #include FT_INTERNAL_CALC_H #include FT_TRIGONOMETRY_H #include FT_SYSTEM_H -#include FT_TRUETYPE_DRIVER_H +#include FT_DRIVER_H #include FT_MULTIPLE_MASTERS_H #include "ttinterp.h" diff --git a/src/truetype/ttobjs.c b/src/truetype/ttobjs.c index 1726b0eb8..f2334f313 100644 --- a/src/truetype/ttobjs.c +++ b/src/truetype/ttobjs.c @@ -21,7 +21,7 @@ #include FT_INTERNAL_STREAM_H #include FT_TRUETYPE_TAGS_H #include FT_INTERNAL_SFNT_H -#include FT_TRUETYPE_DRIVER_H +#include FT_DRIVER_H #include "ttgload.h" #include "ttpload.h" diff --git a/src/truetype/ttsubpix.c b/src/truetype/ttsubpix.c index 1c8cf0110..02058751a 100644 --- a/src/truetype/ttsubpix.c +++ b/src/truetype/ttsubpix.c @@ -22,7 +22,7 @@ #include FT_INTERNAL_SFNT_H #include FT_TRUETYPE_TAGS_H #include FT_OUTLINE_H -#include FT_TRUETYPE_DRIVER_H +#include FT_DRIVER_H #include "ttsubpix.h" diff --git a/src/type1/t1driver.c b/src/type1/t1driver.c index c9559329b..63df1c49b 100644 --- a/src/type1/t1driver.c +++ b/src/type1/t1driver.c @@ -30,7 +30,7 @@ #include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_STREAM_H #include FT_INTERNAL_HASH_H -#include FT_TYPE1_DRIVER_H +#include FT_DRIVER_H #include FT_SERVICE_MULTIPLE_MASTERS_H #include FT_SERVICE_GLYPH_DICT_H @@ -705,10 +705,10 @@ if ( !ft_strcmp( s, "adobe" ) ) - driver->hinting_engine = FT_T1_HINTING_ADOBE; + driver->hinting_engine = FT_HINTING_ADOBE; #ifdef T1_CONFIG_OPTION_OLD_ENGINE else if ( !ft_strcmp( s, "freetype" ) ) - driver->hinting_engine = FT_T1_HINTING_FREETYPE; + driver->hinting_engine = FT_HINTING_FREETYPE; #endif else return FT_THROW( Invalid_Argument ); @@ -719,9 +719,9 @@ FT_UInt* hinting_engine = (FT_UInt*)value; - if ( *hinting_engine == FT_T1_HINTING_ADOBE + if ( *hinting_engine == FT_HINTING_ADOBE #ifdef T1_CONFIG_OPTION_OLD_ENGINE - || *hinting_engine == FT_T1_HINTING_FREETYPE + || *hinting_engine == FT_HINTING_FREETYPE #endif ) driver->hinting_engine = *hinting_engine; diff --git a/src/type1/t1gload.c b/src/type1/t1gload.c index e50d7a5f6..5bda3a537 100644 --- a/src/type1/t1gload.c +++ b/src/type1/t1gload.c @@ -24,7 +24,7 @@ #include FT_OUTLINE_H #include FT_INTERNAL_POSTSCRIPT_AUX_H #include FT_INTERNAL_CFF_TYPES_H -#include FT_TYPE1_DRIVER_H +#include FT_DRIVER_H #include "t1errors.h" @@ -86,8 +86,8 @@ { /* choose which renderer to use */ #ifdef T1_CONFIG_OPTION_OLD_ENGINE - if ( driver->hinting_engine == FT_T1_HINTING_FREETYPE || - decoder->builder.metrics_only ) + if ( driver->hinting_engine == FT_HINTING_FREETYPE || + decoder->builder.metrics_only ) error = decoder_funcs->parse_charstrings_old( decoder, (FT_Byte*)char_string->pointer, diff --git a/src/type1/t1objs.c b/src/type1/t1objs.c index 9e78f29f0..c00b322b1 100644 --- a/src/type1/t1objs.c +++ b/src/type1/t1objs.c @@ -21,7 +21,7 @@ #include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_STREAM_H #include FT_TRUETYPE_IDS_H -#include FT_TYPE1_DRIVER_H +#include FT_DRIVER_H #include "t1gload.h" #include "t1load.h" @@ -588,9 +588,9 @@ /* set default property values, cf. `ftt1drv.h' */ #ifdef T1_CONFIG_OPTION_OLD_ENGINE - driver->hinting_engine = FT_T1_HINTING_FREETYPE; + driver->hinting_engine = FT_HINTING_FREETYPE; #else - driver->hinting_engine = FT_T1_HINTING_ADOBE; + driver->hinting_engine = FT_HINTING_ADOBE; #endif driver->no_stem_darkening = TRUE; From ea68f1c8d3e2815e2ca22ff83de1fdd26d07af49 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Fri, 8 Dec 2017 20:15:15 +0100 Subject: [PATCH 363/470] [docmaker] Fix code section parsing. Stuff like { } confused the parser, which incorrectly treated `' as a markup tag. * src/tools/docmaker/content.py (ContentProcessor::process_content): Apply `re_markup_tags' only outside of code sections. --- ChangeLog | 16 ++++++++++++++++ src/tools/docmaker/content.py | 31 ++++++++++++++++++++++++------- 2 files changed, 40 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 49491308c..ee8663b50 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2017-12-08 Werner Lemberg + + [docmaker] Fix code section parsing. + + Stuff like + + { + + } + + confused the parser, which incorrectly treated `' as a markup + tag. + + * src/tools/docmaker/content.py (ContentProcessor::process_content): + Apply `re_markup_tags' only outside of code sections. + 2017-12-08 Werner Lemberg New `ftdriver.h' file, covering all driver modules. diff --git a/src/tools/docmaker/content.py b/src/tools/docmaker/content.py index 283d81518..d432febc5 100644 --- a/src/tools/docmaker/content.py +++ b/src/tools/docmaker/content.py @@ -453,15 +453,32 @@ class ContentProcessor: markup_lines = [] first = 1 + margin = -1 + in_code = 0 + for line in content: - found = None - for t in re_markup_tags: - m = t.match( line ) + if in_code: + m = re_code_end.match( line ) + if m and len( m.group( 1 ) ) <= margin: + in_code = 0 + margin = -1 + else: + m = re_code_start.match( line ) if m: - found = string.lower( m.group( 1 ) ) - prefix = len( m.group( 0 ) ) - line = " " * prefix + line[prefix:] # remove markup from line - break + in_code = 1 + margin = len( m.group( 1 ) ) + + found = None + + if not in_code: + for t in re_markup_tags: + m = t.match( line ) + if m: + found = string.lower( m.group( 1 ) ) + prefix = len( m.group( 0 ) ) + # remove markup from line + line = " " * prefix + line[prefix:] + break # is it the start of a new markup section ? if found: From 81dea493212077fb8b869940cc1582900917ac32 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Fri, 8 Dec 2017 20:32:23 +0100 Subject: [PATCH 364/470] Documentation fixes for the last few commits. --- include/freetype/config/ftoption.h | 13 ++++++------- include/freetype/ftcache.h | 15 --------------- include/freetype/ftchapters.h | 4 +++- include/freetype/ftdriver.h | 2 +- include/freetype/ftmodapi.h | 18 ++++++++---------- 5 files changed, 18 insertions(+), 34 deletions(-) diff --git a/include/freetype/config/ftoption.h b/include/freetype/config/ftoption.h index 6f1d93fd8..06f3d50bb 100644 --- a/include/freetype/config/ftoption.h +++ b/include/freetype/config/ftoption.h @@ -80,14 +80,12 @@ FT_BEGIN_HEADER /* If you enable this configuration option, FreeType recognizes an */ /* environment variable called `FREETYPE_PROPERTIES', which can be used */ /* to control the various font drivers and modules. The controllable */ - /* properties are listed in the section `Controlling FreeType Modules' */ - /* in the reference's table of contents; currently there are properties */ - /* for the auto-hinter (file `ftautoh.h'), CFF (file `ftcffdrv.h'), */ - /* TrueType (file `ftttdrv.h'), and PCF (file `ftpcfdrv.h'). */ + /* properties are listed in the section @properties. */ /* */ /* `FREETYPE_PROPERTIES' has the following syntax form (broken here into */ /* multiple lines for better readability). */ /* */ + /* { */ /* */ /* ':' */ /* '=' */ @@ -95,6 +93,7 @@ FT_BEGIN_HEADER /* ':' */ /* '=' */ /* ... */ + /* } */ /* */ /* Example: */ /* */ @@ -794,8 +793,8 @@ FT_BEGIN_HEADER /* possible to set up the default values of the four control points that */ /* define the stem darkening behaviour of the (new) CFF engine. For */ /* more details please read the documentation of the */ - /* `darkening-parameters' property of the cff driver module (file */ - /* `ftcffdrv.h'), which allows the control at run-time. */ + /* `darkening-parameters' property (file `ftdriver.h'), which allows the */ + /* control at run-time. */ /* */ /* Do *not* undefine these macros! */ /* */ @@ -883,7 +882,7 @@ FT_BEGIN_HEADER /* */ /* This experimental option is active only if the rendering mode is */ /* FT_RENDER_MODE_LIGHT; you can switch warping on and off with the */ - /* `warping' property of the auto-hinter (see file `ftautoh.h' for more */ + /* `warping' property of the auto-hinter (see file `ftdriver.h' for more */ /* information; by default it is switched off). */ /* */ #define AF_CONFIG_OPTION_USE_WARPER diff --git a/include/freetype/ftcache.h b/include/freetype/ftcache.h index 5ff3ccf40..0fd6118b2 100644 --- a/include/freetype/ftcache.h +++ b/include/freetype/ftcache.h @@ -540,13 +540,6 @@ FT_BEGIN_HEADER FTC_FaceID face_id ); - /*************************************************************************/ - /* */ - /*

    */ - /* cache_subsystem */ - /* */ - /*************************************************************************/ - /************************************************************************* * * @type: @@ -623,14 +616,6 @@ FT_BEGIN_HEADER FT_UInt32 char_code ); - /*************************************************************************/ - /* */ - /*
    */ - /* cache_subsystem */ - /* */ - /*************************************************************************/ - - /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ diff --git a/include/freetype/ftchapters.h b/include/freetype/ftchapters.h index 75747cd23..51257bb7c 100644 --- a/include/freetype/ftchapters.h +++ b/include/freetype/ftchapters.h @@ -60,7 +60,6 @@ /* pfr_fonts */ /* winfnt_fonts */ /* font_formats */ -/* parameter_tags */ /* gasp_table */ /* */ /***************************************************************************/ @@ -77,8 +76,11 @@ /* */ /* auto_hinter */ /* cff_driver */ +/* t1_cid_driver */ /* tt_driver */ /* pcf_driver */ +/* properties */ +/* parameter_tags */ /* */ /***************************************************************************/ diff --git a/include/freetype/ftdriver.h b/include/freetype/ftdriver.h index 4d8854d63..063ceec31 100644 --- a/include/freetype/ftdriver.h +++ b/include/freetype/ftdriver.h @@ -175,7 +175,7 @@ FT_BEGIN_HEADER * t1_cid_driver * * @title: - * The Type~1 and CID drivers + * The Type 1 and CID drivers * * @abstract: * Controlling the Type~1 and CID driver modules. diff --git a/include/freetype/ftmodapi.h b/include/freetype/ftmodapi.h index 9c901329a..d62fafbee 100644 --- a/include/freetype/ftmodapi.h +++ b/include/freetype/ftmodapi.h @@ -323,16 +323,15 @@ FT_BEGIN_HEADER * The module name. * * property_name :: - * The property name. Properties are described in the `Synopsis' - * subsection of the module's documentation. + * The property name. Properties are described in section + * @properties. * * Note that only a few modules have properties. * * value :: * A generic pointer to a variable or structure that gives the new * value of the property. The exact definition of `value' is - * dependent on the property; see the `Synopsis' subsection of the - * module's documentation. + * dependent on the property; see section @properties. * * @return: * FreeType error code. 0~means success. @@ -390,15 +389,14 @@ FT_BEGIN_HEADER * The module name. * * property_name :: - * The property name. Properties are described in the `Synopsis' - * subsection of the module's documentation. + * The property name. Properties are described in section + * @properties. * * @inout: * value :: * A generic pointer to a variable or structure that gives the * value of the property. The exact definition of `value' is - * dependent on the property; see the `Synopsis' subsection of the - * module's documentation. + * dependent on the property; see section @properties. * * @return: * FreeType error code. 0~means success. @@ -446,8 +444,8 @@ FT_BEGIN_HEADER /* */ /* If compilation option FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES is */ /* set, this function reads the `FREETYPE_PROPERTIES' environment */ - /* variable to control driver properties. See sections @auto_hinter, */ - /* @cff_driver, @pcf_driver, and @tt_driver for more. */ + /* variable to control driver properties. See section @properties */ + /* for more. */ /* */ /* If the compilation option is not set, this function does nothing. */ /* */ From 286b0c9f3335a39fa64435e49f63a3d28b21f3d5 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sat, 9 Dec 2017 09:41:45 +0100 Subject: [PATCH 365/470] Fix `make setup dos', second try (#52622). * builds/detect.mk (dos_setup): Don't use literal `>' character at all. Mixing the different escaping rules from make, dos, and windows is too fragile. --- ChangeLog | 8 ++++++++ builds/detect.mk | 6 +++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index ee8663b50..15cd2f83e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2017-12-08 Werner Lemberg + + Fix `make setup dos', second try (#52622). + + * builds/detect.mk (dos_setup): Don't use literal `>' character at + all. Mixing the different escaping rules from make, dos, and + windows is too fragile. + 2017-12-08 Werner Lemberg [docmaker] Fix code section parsing. diff --git a/builds/detect.mk b/builds/detect.mk index e5100a60f..34814f113 100644 --- a/builds/detect.mk +++ b/builds/detect.mk @@ -131,8 +131,8 @@ std_setup: # Special case for Dos, Windows, OS/2, where echo "" doesn't work correctly! # -# For `cmd.exe', we have to escape (unquoted) special characters like `>' as -# `^>', and we use 0xFF as a replacement character for a protected space. +# For `cmd.exe', we use 0xFF as a replacement character for a protected +# space. # dos_setup: @type builds$(SEP)newline @@ -149,7 +149,7 @@ dos_setup: @echo '$(CONFIG_MK)' from this directory then read the INSTALL file for help. @type builds$(SEP)newline @echo Otherwise, simply type 'make' again to build the library. - @echo or 'make refdoc' to build the API reference (this needs python ^>= 2.6). + @echo or 'make refdoc' to build the API reference (this needs at least python 2.6). @type builds$(SEP)newline @$(COPY) $(subst /,$(SEP),$(CONFIG_RULES) $(CONFIG_MK)) > nul From a998d48401fbf8872265e5460cadfe4c8daca4ba Mon Sep 17 00:00:00 2001 From: Azzuro Date: Sat, 9 Dec 2017 14:22:35 +0100 Subject: [PATCH 366/470] * builds/windows/vc2010/freetype.vcxproj: Adjust output directory. This allows builds with different configurations in parallel. --- ChangeLog | 6 ++++++ builds/windows/vc2010/freetype.vcxproj | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 15cd2f83e..1331ad0e7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2017-12-08 Azzuro + + * builds/windows/vc2010/freetype.vcxproj: Adjust output directory. + + This allows builds with different configurations in parallel. + 2017-12-08 Werner Lemberg Fix `make setup dos', second try (#52622). diff --git a/builds/windows/vc2010/freetype.vcxproj b/builds/windows/vc2010/freetype.vcxproj index 93e755acc..173b276dc 100644 --- a/builds/windows/vc2010/freetype.vcxproj +++ b/builds/windows/vc2010/freetype.vcxproj @@ -109,7 +109,7 @@ - ..\..\..\objs\$(Platform)\ + ..\..\..\objs\$(Platform)\$(Configuration)\ ..\..\..\objs\$(Platform)\$(Configuration)\ AllRules.ruleset From 2c048a8a622e9f44f255aa3316026f124ac9ecbc Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Mon, 11 Dec 2017 19:24:30 +0100 Subject: [PATCH 367/470] Fix compiler warning (#52640). * src/base/ftbitmap.c (ft_bitmap_assure_buffer): Remove unused variable. --- ChangeLog | 7 +++++++ src/base/ftbitmap.c | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 1331ad0e7..adbff556d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2017-12-11 Werner Lemberg + + Fix compiler warning (#52640). + + * src/base/ftbitmap.c (ft_bitmap_assure_buffer): Remove unused + variable. + 2017-12-08 Azzuro * builds/windows/vc2010/freetype.vcxproj: Adjust output directory. diff --git a/src/base/ftbitmap.c b/src/base/ftbitmap.c index f7bd2705c..5ad21a3f4 100644 --- a/src/base/ftbitmap.c +++ b/src/base/ftbitmap.c @@ -156,7 +156,7 @@ int pitch; int new_pitch; FT_UInt bpp; - FT_UInt i, width, height; + FT_UInt width, height; unsigned char* buffer = NULL; From d019097bd20319023ed4e7241973016098387992 Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Sat, 16 Dec 2017 22:00:40 -0500 Subject: [PATCH 368/470] * builds/windows/vc2010/freetype.vcxproj: AfterBuild copy. * objs/.gitignore: Ignore almost everything. --- ChangeLog | 5 +++++ builds/windows/vc2010/freetype.vcxproj | 3 +++ objs/.gitignore | 18 +++--------------- 3 files changed, 11 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index adbff556d..78be02a1d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2017-12-16 Alexei Podtelezhnikov + + * builds/windows/vc2010/freetype.vcxproj: AfterBuild copy. + * objs/.gitignore: Ignore almost everything. + 2017-12-11 Werner Lemberg Fix compiler warning (#52640). diff --git a/builds/windows/vc2010/freetype.vcxproj b/builds/windows/vc2010/freetype.vcxproj index 173b276dc..9e9368918 100644 --- a/builds/windows/vc2010/freetype.vcxproj +++ b/builds/windows/vc2010/freetype.vcxproj @@ -438,4 +438,7 @@ + + + diff --git a/objs/.gitignore b/objs/.gitignore index 21b67f6ab..f8476208f 100644 --- a/objs/.gitignore +++ b/objs/.gitignore @@ -1,15 +1,3 @@ -apinames -freetype.def -freetype.lib -ftexport.sym -ftmodule.h -ftoption.h -libfreetype.la -.libs -*.lo -*.o -*.a -debug*/ -release*/ -win32/ -win64/ +* +!README +!.gitignore From 7d3dfcd4a5255a7b00bcf0dbabb85b245bedb581 Mon Sep 17 00:00:00 2001 From: Jonathan Kew Date: Sun, 17 Dec 2017 08:19:51 +0100 Subject: [PATCH 369/470] Fix incorrect advance width scaling (#52683). * src/base/ftadvance.c (FT_Get_Advances): Always respect the FT_LOAD_NO_SCALE flag if present. --- ChangeLog | 7 +++++++ src/base/ftadvanc.c | 14 +++++++++----- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 78be02a1d..82830adfc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2017-12-17 Jonathan Kew + + Fix incorrect advance width scaling (#52683). + + * src/base/ftadvance.c (FT_Get_Advances): Always respect the + FT_LOAD_NO_SCALE flag if present. + 2017-12-16 Alexei Podtelezhnikov * builds/windows/vc2010/freetype.vcxproj: AfterBuild copy. diff --git a/src/base/ftadvanc.c b/src/base/ftadvanc.c index 1557607fc..d066142be 100644 --- a/src/base/ftadvanc.c +++ b/src/base/ftadvanc.c @@ -116,9 +116,12 @@ FT_Int32 flags, FT_Fixed *padvances ) { + FT_Error error = FT_Err_Ok; + FT_Face_GetAdvancesFunc func; - FT_UInt num, end, nn; - FT_Error error = FT_Err_Ok; + + FT_UInt num, end, nn; + FT_Int factor; if ( !face ) @@ -152,16 +155,17 @@ return FT_THROW( Unimplemented_Feature ); flags |= (FT_UInt32)FT_LOAD_ADVANCE_ONLY; + factor = ( flags & FT_LOAD_NO_SCALE ) ? 1 : 1024; for ( nn = 0; nn < count; nn++ ) { error = FT_Load_Glyph( face, start + nn, flags ); if ( error ) break; - /* scale from 26.6 to 16.16 */ + /* scale from 26.6 to 16.16, unless NO_SCALE was requested */ padvances[nn] = ( flags & FT_LOAD_VERTICAL_LAYOUT ) - ? face->glyph->advance.y * 1024 - : face->glyph->advance.x * 1024; + ? face->glyph->advance.y * factor + : face->glyph->advance.x * factor; } return error; From 361af72eea8f3e72041c4278d5d5442389771330 Mon Sep 17 00:00:00 2001 From: Jonathan Kew Date: Sun, 17 Dec 2017 15:07:02 +0100 Subject: [PATCH 370/470] [truetype] Correctly handle variation font phantom points (#52683). * src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Fix phantom point indices. --- ChangeLog | 7 +++++++ src/truetype/ttgxvar.c | 22 +++++++++++----------- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 82830adfc..52a56cbc5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2017-12-17 Jonathan Kew + + [truetype] Correctly handle variation font phantom points (#52683). + + * src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Fix phantom + point indices. + 2017-12-17 Jonathan Kew Fix incorrect advance width scaling (#52683). diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c index 9aa4825b3..f490c369d 100644 --- a/src/truetype/ttgxvar.c +++ b/src/truetype/ttgxvar.c @@ -3630,7 +3630,7 @@ FT_Pos delta_y = FT_MulFix( deltas_y[j], apply ); - if ( j < n_points - 3 ) + if ( j < n_points - 4 ) { outline->points[j].x += delta_x; outline->points[j].y += delta_y; @@ -3640,25 +3640,25 @@ /* To avoid double adjustment of advance width or height, */ /* adjust phantom points only if there is no HVAR or VVAR */ /* support, respectively. */ - if ( j == ( n_points - 3 ) && - !( face->variation_support & - TT_FACE_FLAG_VAR_HADVANCE ) ) + if ( j == ( n_points - 4 ) && + !( face->variation_support & + TT_FACE_FLAG_VAR_LSB ) ) + outline->points[j].x += delta_x; + + else if ( j == ( n_points - 3 ) && + !( face->variation_support & + TT_FACE_FLAG_VAR_HADVANCE ) ) outline->points[j].x += delta_x; else if ( j == ( n_points - 2 ) && !( face->variation_support & - TT_FACE_FLAG_VAR_LSB ) ) - outline->points[j].x += delta_x; + TT_FACE_FLAG_VAR_TSB ) ) + outline->points[j].y += delta_y; else if ( j == ( n_points - 1 ) && !( face->variation_support & TT_FACE_FLAG_VAR_VADVANCE ) ) outline->points[j].y += delta_y; - - else if ( j == ( n_points - 0 ) && - !( face->variation_support & - TT_FACE_FLAG_VAR_TSB ) ) - outline->points[j].y += delta_y; } #ifdef FT_DEBUG_LEVEL_TRACE From e7935f29103596751ffda3ee7adea04a0c47050f Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Mon, 18 Dec 2017 07:29:57 +0100 Subject: [PATCH 371/470] [truetype] Don't apply HVAR and VVAR deltas twice (#52683). * src/truetype/ttgload.c (TT_Process_Simple_Glyph): Always adjust `pp1' to `pp4', except if we have an HVAR and/or VVAR table. * src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Handle alternative code branch identically w.r.t. presence of an HVAR and/or VVAR table. --- ChangeLog | 11 +++++++++++ src/truetype/ttgload.c | 13 +++++++++++++ src/truetype/ttgxvar.c | 32 ++++++++++++++++++++++++++++++-- 3 files changed, 54 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 52a56cbc5..013216edc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2017-12-18 Werner Lemberg + + [truetype] Don't apply HVAR and VVAR deltas twice (#52683). + + * src/truetype/ttgload.c (TT_Process_Simple_Glyph): Always adjust + `pp1' to `pp4', except if we have an HVAR and/or VVAR table. + + * src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Handle + alternative code branch identically w.r.t. presence of an HVAR + and/or VVAR table. + 2017-12-17 Jonathan Kew [truetype] Correctly handle variation font phantom points (#52683). diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c index 917aa62aa..4b5af854d 100644 --- a/src/truetype/ttgload.c +++ b/src/truetype/ttgload.c @@ -1037,9 +1037,22 @@ vec->x = FT_MulFix( vec->x, x_scale ); vec->y = FT_MulFix( vec->y, y_scale ); } + } +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT + /* if we have a HVAR table, `pp1' and/or `pp2' are already adjusted */ + if ( !( loader->face->variation_support & TT_FACE_FLAG_VAR_HADVANCE ) ) +#endif + { loader->pp1 = outline->points[n_points - 4]; loader->pp2 = outline->points[n_points - 3]; + } + +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT + /* if we have a VVAR table, `pp3' and/or `pp4' are already adjusted */ + if ( !( loader->face->variation_support & TT_FACE_FLAG_VAR_VADVANCE ) ) +#endif + { loader->pp3 = outline->points[n_points - 2]; loader->pp4 = outline->points[n_points - 1]; } diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c index f490c369d..0d4872f4a 100644 --- a/src/truetype/ttgxvar.c +++ b/src/truetype/ttgxvar.c @@ -3725,8 +3725,36 @@ FT_Pos delta_y = points_out[j].y - points_org[j].y; - outline->points[j].x += delta_x; - outline->points[j].y += delta_y; + if ( j < n_points - 4 ) + { + outline->points[j].x += delta_x; + outline->points[j].y += delta_y; + } + else + { + /* To avoid double adjustment of advance width or height, */ + /* adjust phantom points only if there is no HVAR or VVAR */ + /* support, respectively. */ + if ( j == ( n_points - 4 ) && + !( face->variation_support & + TT_FACE_FLAG_VAR_LSB ) ) + outline->points[j].x += delta_x; + + else if ( j == ( n_points - 3 ) && + !( face->variation_support & + TT_FACE_FLAG_VAR_HADVANCE ) ) + outline->points[j].x += delta_x; + + else if ( j == ( n_points - 2 ) && + !( face->variation_support & + TT_FACE_FLAG_VAR_TSB ) ) + outline->points[j].y += delta_y; + + else if ( j == ( n_points - 1 ) && + !( face->variation_support & + TT_FACE_FLAG_VAR_VADVANCE ) ) + outline->points[j].y += delta_y; + } #ifdef FT_DEBUG_LEVEL_TRACE if ( delta_x || delta_y ) From d062c54ce7f2c2bb98906f866755d214c4a73735 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Mon, 18 Dec 2017 09:41:17 +0100 Subject: [PATCH 372/470] [truetype] Fix previous commit. * src/truetype/ttgload.c (TT_Process_Simple_Glyph): Correctly handle unhinted phantom points, which must be properly scaled. --- ChangeLog | 7 +++++++ src/truetype/ttgload.c | 9 ++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 013216edc..9cdb5e531 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2017-12-18 Werner Lemberg + + [truetype] Fix previous commit. + + * src/truetype/ttgload.c (TT_Process_Simple_Glyph): Correctly handle + unhinted phantom points, which must be properly scaled. + 2017-12-18 Werner Lemberg [truetype] Don't apply HVAR and VVAR deltas twice (#52683). diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c index 4b5af854d..01f2f26fe 100644 --- a/src/truetype/ttgload.c +++ b/src/truetype/ttgload.c @@ -801,7 +801,7 @@ { FT_TRACE1(( "TT_Hint_Glyph: too long instructions" )); FT_TRACE1(( " (0x%lx byte) is truncated\n", - loader->glyph->control_len )); + loader->glyph->control_len )); } n_ins = loader->glyph->control_len; @@ -1041,7 +1041,8 @@ #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT /* if we have a HVAR table, `pp1' and/or `pp2' are already adjusted */ - if ( !( loader->face->variation_support & TT_FACE_FLAG_VAR_HADVANCE ) ) + if ( !( loader->face->variation_support & TT_FACE_FLAG_VAR_HADVANCE ) || + !IS_HINTED( loader->load_flags ) ) #endif { loader->pp1 = outline->points[n_points - 4]; @@ -1050,7 +1051,8 @@ #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT /* if we have a VVAR table, `pp3' and/or `pp4' are already adjusted */ - if ( !( loader->face->variation_support & TT_FACE_FLAG_VAR_VADVANCE ) ) + if ( !( loader->face->variation_support & TT_FACE_FLAG_VAR_VADVANCE ) || + !IS_HINTED( loader->load_flags ) ) #endif { loader->pp3 = outline->points[n_points - 2]; @@ -1418,6 +1420,7 @@ TT_Driver driver = (TT_Driver)FT_FACE_DRIVER( loader->face ); #endif + #ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY if ( driver->interpreter_version == TT_INTERPRETER_VERSION_38 ) { From 2fe272aca62ff925f1f29d81268f2c4629f250da Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Mon, 18 Dec 2017 19:40:07 +0100 Subject: [PATCH 373/470] * src/truetype/ttgxvar.c (tt_face_vary_cvt): Add size guard (#52688). --- ChangeLog | 4 ++++ src/truetype/ttgxvar.c | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 9cdb5e531..2ef631b72 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2017-12-18 Werner Lemberg + + * src/truetype/ttgxvar.c (tt_face_vary_cvt): Add size guard (#52688). + 2017-12-18 Werner Lemberg [truetype] Fix previous commit. diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c index 0d4872f4a..221f57206 100644 --- a/src/truetype/ttgxvar.c +++ b/src/truetype/ttgxvar.c @@ -3110,7 +3110,10 @@ table_len, point_count == 0 ? face->cvt_size : point_count ); - if ( !points || !deltas ) + + if ( !points || + !deltas || + ( localpoints == ALL_POINTS && point_count != face->cvt_size ) ) ; /* failure, ignore it */ else if ( localpoints == ALL_POINTS ) From 068a7a03aa1943c59dfd490773156cb9245879db Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Mon, 18 Dec 2017 20:34:05 +0100 Subject: [PATCH 374/470] * src/*/*: Only use `ft_' and `FT_' variants of stdc library stuff. --- ChangeLog | 4 ++++ src/base/ftdbgmem.c | 8 ++++---- src/base/ftdebug.c | 2 +- src/bdf/bdfdrivr.c | 2 +- src/bdf/bdflib.c | 12 ++++++------ src/cff/cffload.c | 14 +++++++------- src/cff/cffobjs.c | 6 +++--- src/sfnt/pngshim.c | 6 +++--- src/truetype/ttgload.c | 2 +- src/truetype/ttsubpix.c | 24 ++++++++++++------------ 10 files changed, 42 insertions(+), 38 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2ef631b72..dc9b6856c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2017-12-18 Werner Lemberg + + * src/*/*: Only use `ft_' and `FT_' variants of stdc library stuff. + 2017-12-18 Werner Lemberg * src/truetype/ttgxvar.c (tt_face_vary_cvt): Add size guard (#52688). diff --git a/src/base/ftdbgmem.c b/src/base/ftdbgmem.c index 242246bfd..560b41e95 100644 --- a/src/base/ftdbgmem.c +++ b/src/base/ftdbgmem.c @@ -826,7 +826,7 @@ FT_Int result = 0; - if ( getenv( "FT2_DEBUG_MEMORY" ) ) + if ( ft_getenv( "FT2_DEBUG_MEMORY" ) ) { table = ft_mem_table_new( memory ); if ( table ) @@ -839,7 +839,7 @@ memory->realloc = ft_mem_debug_realloc; memory->free = ft_mem_debug_free; - p = getenv( "FT2_ALLOC_TOTAL_MAX" ); + p = ft_getenv( "FT2_ALLOC_TOTAL_MAX" ); if ( p ) { FT_Long total_max = ft_strtol( p, NULL, 10 ); @@ -852,7 +852,7 @@ } } - p = getenv( "FT2_ALLOC_COUNT_MAX" ); + p = ft_getenv( "FT2_ALLOC_COUNT_MAX" ); if ( p ) { FT_Long total_count = ft_strtol( p, NULL, 10 ); @@ -865,7 +865,7 @@ } } - p = getenv( "FT2_KEEP_ALIVE" ); + p = ft_getenv( "FT2_KEEP_ALIVE" ); if ( p ) { FT_Long keep_alive = ft_strtol( p, NULL, 10 ); diff --git a/src/base/ftdebug.c b/src/base/ftdebug.c index 20c617089..dbcf585c2 100644 --- a/src/base/ftdebug.c +++ b/src/base/ftdebug.c @@ -161,7 +161,7 @@ FT_BASE_DEF( void ) ft_debug_init( void ) { - const char* ft2_debug = getenv( "FT2_DEBUG" ); + const char* ft2_debug = ft_getenv( "FT2_DEBUG" ); if ( ft2_debug ) diff --git a/src/bdf/bdfdrivr.c b/src/bdf/bdfdrivr.c index fb7781000..ca937f89c 100644 --- a/src/bdf/bdfdrivr.c +++ b/src/bdf/bdfdrivr.c @@ -813,7 +813,7 @@ THE SOFTWARE. bitmap->rows = glyph.bbx.height; bitmap->width = glyph.bbx.width; - if ( glyph.bpr > INT_MAX ) + if ( glyph.bpr > FT_INT_MAX ) FT_TRACE1(( "BDF_Glyph_Load: too large pitch %d is truncated\n", glyph.bpr )); bitmap->pitch = (int)glyph.bpr; /* same as FT_Bitmap.pitch */ diff --git a/src/bdf/bdflib.c b/src/bdf/bdflib.c index bf10887fd..2f5c99d54 100644 --- a/src/bdf/bdflib.c +++ b/src/bdf/bdflib.c @@ -705,11 +705,11 @@ for ( v = 0; sbitset( ddigits, *s ); s++ ) { - if ( v < ( ULONG_MAX - 9 ) / 10 ) + if ( v < ( FT_ULONG_MAX - 9 ) / 10 ) v = v * 10 + a2i[(int)*s]; else { - v = ULONG_MAX; + v = FT_ULONG_MAX; break; } } @@ -738,11 +738,11 @@ for ( v = 0; sbitset( ddigits, *s ); s++ ) { - if ( v < ( LONG_MAX - 9 ) / 10 ) + if ( v < ( FT_LONG_MAX - 9 ) / 10 ) v = v * 10 + a2i[(int)*s]; else { - v = LONG_MAX; + v = FT_LONG_MAX; break; } } @@ -763,11 +763,11 @@ for ( v = 0; sbitset( ddigits, *s ); s++ ) { - if ( v < ( USHRT_MAX - 9 ) / 10 ) + if ( v < ( FT_USHORT_MAX - 9 ) / 10 ) v = (unsigned short)( v * 10 + a2i[(int)*s] ); else { - v = USHRT_MAX; + v = FT_USHORT_MAX; break; } } diff --git a/src/cff/cffload.c b/src/cff/cffload.c index 975f67bee..937438e3d 100644 --- a/src/cff/cffload.c +++ b/src/cff/cffload.c @@ -1556,13 +1556,13 @@ FT_UInt lenNDV, FT_Fixed* NDV ) { - if ( !blend->builtBV || - blend->lastVsindex != vsindex || - blend->lenNDV != lenNDV || - ( lenNDV && - memcmp( NDV, - blend->lastNDV, - lenNDV * sizeof ( *NDV ) ) != 0 ) ) + if ( !blend->builtBV || + blend->lastVsindex != vsindex || + blend->lenNDV != lenNDV || + ( lenNDV && + ft_memcmp( NDV, + blend->lastNDV, + lenNDV * sizeof ( *NDV ) ) != 0 ) ) { /* need to build blend vector */ return TRUE; diff --git a/src/cff/cffobjs.c b/src/cff/cffobjs.c index d4b6e5941..b70e3b5cc 100644 --- a/src/cff/cffobjs.c +++ b/src/cff/cffobjs.c @@ -413,7 +413,7 @@ remove_subset_prefix( FT_String* name ) { FT_Int32 idx = 0; - FT_Int32 length = (FT_Int32)strlen( name ) + 1; + FT_Int32 length = (FT_Int32)ft_strlen( name ) + 1; FT_Bool continue_search = 1; @@ -450,8 +450,8 @@ FT_Int32 family_name_length, style_name_length; - family_name_length = (FT_Int32)strlen( family_name ); - style_name_length = (FT_Int32)strlen( style_name ); + family_name_length = (FT_Int32)ft_strlen( family_name ); + style_name_length = (FT_Int32)ft_strlen( style_name ); if ( family_name_length > style_name_length ) { diff --git a/src/sfnt/pngshim.c b/src/sfnt/pngshim.c index 4c0d00705..fdc6b2aa4 100644 --- a/src/sfnt/pngshim.c +++ b/src/sfnt/pngshim.c @@ -103,7 +103,7 @@ v82 m0 = { 1, 0, 3, 2, 5, 4, 7, 6 }; - memcpy( &s, base, 16 ); /* RGBA RGBA RGBA RGBA */ + ft_memcpy( &s, base, 16 ); /* RGBA RGBA RGBA RGBA */ s0 = s & n0xFF; /* R B R B R B R B */ s1 = s >> n8; /* G A G A G A G A */ @@ -119,7 +119,7 @@ s1 = ( s1 + ( s1 >> n8 ) ) >> n8; s = s0 | ( s1 << n8 ); - memcpy( base, &s, 16 ); + ft_memcpy( base, &s, 16 ); } } #endif /* use `vector_size' */ @@ -237,7 +237,7 @@ return; } - memcpy( data, stream->cursor, length ); + ft_memcpy( data, stream->cursor, length ); FT_FRAME_EXIT(); } diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c index 01f2f26fe..f960ce600 100644 --- a/src/truetype/ttgload.c +++ b/src/truetype/ttgload.c @@ -1774,7 +1774,7 @@ /* clear the nodes filled by sibling chains */ node = ft_list_get_node_at( &loader->composites, recurse_count ); for ( node2 = node; node2; node2 = node2->next ) - node2->data = (void*)ULONG_MAX; + node2->data = (void*)FT_ULONG_MAX; /* check whether we already have a composite glyph with this index */ if ( FT_List_Find( &loader->composites, diff --git a/src/truetype/ttsubpix.c b/src/truetype/ttsubpix.c index 02058751a..3f473f850 100644 --- a/src/truetype/ttsubpix.c +++ b/src/truetype/ttsubpix.c @@ -753,24 +753,24 @@ /* Does font name match rule family? */ - if ( strcmp( detected_font_name, rule_font_name ) == 0 ) + if ( ft_strcmp( detected_font_name, rule_font_name ) == 0 ) return TRUE; /* Is font name a wildcard ""? */ - if ( strcmp( rule_font_name, "" ) == 0 ) + if ( ft_strcmp( rule_font_name, "" ) == 0 ) return TRUE; /* Is font name contained in a class list? */ for ( i = 0; i < FAMILY_CLASS_RULES_SIZE; i++ ) { - if ( strcmp( FAMILY_CLASS_Rules[i].name, rule_font_name ) == 0 ) + if ( ft_strcmp( FAMILY_CLASS_Rules[i].name, rule_font_name ) == 0 ) { for ( j = 0; j < SPH_MAX_CLASS_MEMBERS; j++ ) { - if ( strcmp( FAMILY_CLASS_Rules[i].member[j], "" ) == 0 ) + if ( ft_strcmp( FAMILY_CLASS_Rules[i].member[j], "" ) == 0 ) continue; - if ( strcmp( FAMILY_CLASS_Rules[i].member[j], - detected_font_name ) == 0 ) + if ( ft_strcmp( FAMILY_CLASS_Rules[i].member[j], + detected_font_name ) == 0 ) return TRUE; } } @@ -788,24 +788,24 @@ /* Does font style match rule style? */ - if ( strcmp( detected_font_style, rule_font_style ) == 0 ) + if ( ft_strcmp( detected_font_style, rule_font_style ) == 0 ) return TRUE; /* Is font style a wildcard ""? */ - if ( strcmp( rule_font_style, "" ) == 0 ) + if ( ft_strcmp( rule_font_style, "" ) == 0 ) return TRUE; /* Is font style contained in a class list? */ for ( i = 0; i < STYLE_CLASS_RULES_SIZE; i++ ) { - if ( strcmp( STYLE_CLASS_Rules[i].name, rule_font_style ) == 0 ) + if ( ft_strcmp( STYLE_CLASS_Rules[i].name, rule_font_style ) == 0 ) { for ( j = 0; j < SPH_MAX_CLASS_MEMBERS; j++ ) { - if ( strcmp( STYLE_CLASS_Rules[i].member[j], "" ) == 0 ) + if ( ft_strcmp( STYLE_CLASS_Rules[i].member[j], "" ) == 0 ) continue; - if ( strcmp( STYLE_CLASS_Rules[i].member[j], - detected_font_style ) == 0 ) + if ( ft_strcmp( STYLE_CLASS_Rules[i].member[j], + detected_font_style ) == 0 ) return TRUE; } } From bdab6578af27719a613488d46acc5d69653943f8 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Mon, 18 Dec 2017 20:45:17 +0100 Subject: [PATCH 375/470] [truetype] Minor code beautification. * src/truetype/ttgxvar.c (ft_var_to_normalized): Trace number of design coordinates. Simplify code. --- ChangeLog | 8 ++++++++ src/truetype/ttgxvar.c | 8 +++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index dc9b6856c..c0920a0ca 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2017-12-18 Matthias Clasen + + [truetype] Minor code beautification. + + * src/truetype/ttgxvar.c (ft_var_to_normalized): Trace number of + design coordinates. + Simplify code. + 2017-12-18 Werner Lemberg * src/*/*: Only use `ft_' and `FT_' variants of stdc library stuff. diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c index 221f57206..529c35b2f 100644 --- a/src/truetype/ttgxvar.c +++ b/src/truetype/ttgxvar.c @@ -1733,7 +1733,9 @@ /* based on the [min,def,max] values for the axis to be [-1,0,1]. */ /* Then, if there's an `avar' table, we renormalize this range. */ - FT_TRACE5(( "design coordinates:\n" )); + FT_TRACE5(( "%d design coordinate%s:\n", + num_coords, + num_coords == 1 ? "" : "s" )); a = mmvar->axis; for ( i = 0; i < num_coords; i++, a++ ) @@ -1758,10 +1760,10 @@ } if ( coord < a->def ) - normalized[i] = -FT_DivFix( coords[i] - a->def, + normalized[i] = -FT_DivFix( coord - a->def, a->minimum - a->def ); else if ( coord > a->def ) - normalized[i] = FT_DivFix( coords[i] - a->def, + normalized[i] = FT_DivFix( coord - a->def, a->maximum - a->def ); else normalized[i] = 0; From 2df73b397d5150986758c00f90db7b989dba5a33 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Mon, 18 Dec 2017 23:32:32 +0100 Subject: [PATCH 376/470] [sfnt] Fix charmap type 2 iterator (#52646). The subsetted demo font of the report that exhibits the bug has a very unusual type 2 cmap for Unicode(!): It contains only two sub-headers, one for one-byte characters (covering the range 0x20 to 0xFA), and a second one for higher byte 0x01 (just for character code U+0131). Before this commit, the iterator wasn't able to correctly handle a sub-header for higher byte 0x01. * src/sfnt/ttcmap.c (tt_cmap2_char_next): Fix character increment for outer loop. --- ChangeLog | 16 ++++++++++++++++ src/sfnt/ttcmap.c | 14 ++++++++++++-- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index c0920a0ca..da6f77b96 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2017-12-18 Werner Lemberg + + [sfnt] Fix charmap type 2 iterator (#52646). + + The subsetted demo font of the report that exhibits the bug has a + very unusual type 2 cmap for Unicode(!): It contains only two + sub-headers, one for one-byte characters (covering the range 0x20 to + 0xFA), and a second one for higher byte 0x01 (just for character + code U+0131). + + Before this commit, the iterator wasn't able to correctly handle a + sub-header for higher byte 0x01. + + * src/sfnt/ttcmap.c (tt_cmap2_char_next): Fix character increment + for outer loop. + 2017-12-18 Matthias Clasen [truetype] Minor code beautification. diff --git a/src/sfnt/ttcmap.c b/src/sfnt/ttcmap.c index b995e5c05..f6c02f907 100644 --- a/src/sfnt/ttcmap.c +++ b/src/sfnt/ttcmap.c @@ -547,9 +547,19 @@ } } - /* jump to next sub-header, i.e. higher byte value */ + /* If `charcode' is <= 0xFF, retry with `charcode + 1'. If */ + /* `charcode' is 0x100 after the loop, do nothing since we have */ + /* just reached the first sub-header for two-byte character codes. */ + /* */ + /* For all other cases, we jump to the next sub-header and adjust */ + /* `charcode' accordingly. */ Next_SubHeader: - charcode = FT_PAD_FLOOR( charcode, 256 ) + 256; + if ( charcode <= 0xFF ) + charcode++; + else if ( charcode == 0x100 ) + ; + else + charcode = FT_PAD_FLOOR( charcode, 0x100 ) + 0x100; } Exit: From 0579d545af5e533b3eb15eff1467ebb1433e345f Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Mon, 18 Dec 2017 23:45:58 +0100 Subject: [PATCH 377/470] Update incorrect ChangeLog entry. --- ChangeLog | 4 ++-- src/truetype/ttgxvar.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index da6f77b96..080f03e9d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -16,11 +16,11 @@ 2017-12-18 Matthias Clasen - [truetype] Minor code beautification. + [truetype] Fix clamping, minor tracing code beautification. * src/truetype/ttgxvar.c (ft_var_to_normalized): Trace number of design coordinates. - Simplify code. + Use clamped value. 2017-12-18 Werner Lemberg diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c index 529c35b2f..8230419c7 100644 --- a/src/truetype/ttgxvar.c +++ b/src/truetype/ttgxvar.c @@ -1753,7 +1753,7 @@ a->minimum / 65536.0, a->maximum / 65536.0 )); - if ( coord > a->maximum) + if ( coord > a->maximum ) coord = a->maximum; else coord = a->minimum; From 08cd62deedefe217f2ea50e392923ce8b5bc7ac7 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Wed, 20 Dec 2017 22:06:19 +0100 Subject: [PATCH 378/470] Speed up FT_Set_Var_{Design,Blend}_Coordinates if curr == new. We exit early if the current design or blend coordinates are identical to the new ones. * src/truetype/ttgxvar.c (tt_set_mm_blend, TT_Set_Var_Design): Implement it, returning internal error code -1 if there will be no variation change. * src/type1/t1load.c (t1_set_mm_blend): Ditto. * src/base/ftmm.c (FT_Set_Var_Design_Coordinates, FT_Set_MM_Blend_Coordinates, FT_Set_Var_Blend_Coordinates): Updated. --- ChangeLog | 16 +++++ include/freetype/internal/services/svmm.h | 4 ++ src/base/ftmm.c | 12 ++++ src/truetype/ttgxvar.c | 73 +++++++++++++++++++---- src/type1/t1load.c | 12 +++- 5 files changed, 105 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 080f03e9d..e19cb50f1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2017-12-20 Werner Lemberg + + Speed up FT_Set_Var_{Design,Blend}_Coordinates if curr == new. + + We exit early if the current design or blend coordinates are + identical to the new ones. + + * src/truetype/ttgxvar.c (tt_set_mm_blend, TT_Set_Var_Design): + Implement it, returning internal error code -1 if there will be no + variation change. + + * src/type1/t1load.c (t1_set_mm_blend): Ditto. + + * src/base/ftmm.c (FT_Set_Var_Design_Coordinates, + FT_Set_MM_Blend_Coordinates, FT_Set_Var_Blend_Coordinates): Updated. + 2017-12-18 Werner Lemberg [sfnt] Fix charmap type 2 iterator (#52646). diff --git a/include/freetype/internal/services/svmm.h b/include/freetype/internal/services/svmm.h index a934f9452..a92ae345b 100644 --- a/include/freetype/internal/services/svmm.h +++ b/include/freetype/internal/services/svmm.h @@ -48,11 +48,15 @@ FT_BEGIN_HEADER FT_UInt num_coords, FT_Long* coords ); + /* use return value -1 to indicate that the new coordinates */ + /* are equal to the current ones; no changes are thus needed */ typedef FT_Error (*FT_Set_Var_Design_Func)( FT_Face face, FT_UInt num_coords, FT_Fixed* coords ); + /* use return value -1 to indicate that the new coordinates */ + /* are equal to the current ones; no changes are thus needed */ typedef FT_Error (*FT_Set_MM_Blend_Func)( FT_Face face, FT_UInt num_coords, diff --git a/src/base/ftmm.c b/src/base/ftmm.c index e0131ece3..6a42df6e9 100644 --- a/src/base/ftmm.c +++ b/src/base/ftmm.c @@ -203,6 +203,10 @@ error = FT_ERR( Invalid_Argument ); if ( service_mm->set_var_design ) error = service_mm->set_var_design( face, num_coords, coords ); + + /* internal error code -1 means `no change'; we can exit immediately */ + if ( error == -1 ) + return FT_Err_Ok; } if ( !error ) @@ -275,6 +279,10 @@ error = FT_ERR( Invalid_Argument ); if ( service_mm->set_mm_blend ) error = service_mm->set_mm_blend( face, num_coords, coords ); + + /* internal error code -1 means `no change'; we can exit immediately */ + if ( error == -1 ) + return FT_Err_Ok; } if ( !error ) @@ -322,6 +330,10 @@ error = FT_ERR( Invalid_Argument ); if ( service_mm->set_mm_blend ) error = service_mm->set_mm_blend( face, num_coords, coords ); + + /* internal error code -1 means `no change'; we can exit immediately */ + if ( error == -1 ) + return FT_Err_Ok; } if ( !error ) diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c index 8230419c7..2acd7e05b 100644 --- a/src/truetype/ttgxvar.c +++ b/src/truetype/ttgxvar.c @@ -2432,6 +2432,12 @@ } else { + FT_Bool have_diff = 0; + FT_UInt j; + FT_Fixed* c; + FT_Fixed* n; + + manageCvt = mcvt_retain; for ( i = 0; i < num_coords; i++ ) @@ -2439,10 +2445,34 @@ if ( blend->normalizedcoords[i] != coords[i] ) { manageCvt = mcvt_load; + have_diff = 1; break; } } + if ( FT_IS_NAMED_INSTANCE( FT_FACE( face ) ) ) + { + FT_UInt idx = (FT_UInt)face->root.face_index >> 16; + + + c = blend->normalizedcoords + i; + n = blend->normalized_stylecoords + idx * mmvar->num_axis + i; + for ( j = i; j < mmvar->num_axis; j++, n++, c++ ) + if ( *c != *n ) + have_diff = 1; + } + else + { + c = blend->normalizedcoords + i; + for ( j = i; j < mmvar->num_axis; j++, c++ ) + if ( *c != 0 ) + have_diff = 1; + } + + /* return value -1 indicates `no change' */ + if ( !have_diff ) + return -1; + for ( ; i < mmvar->num_axis; i++ ) { if ( blend->normalizedcoords[i] != 0 ) @@ -2664,8 +2694,11 @@ FT_Memory memory = face->root.memory; FT_Fixed* c; + FT_Fixed* n; FT_Fixed* normalized = NULL; + FT_Bool have_diff = 0; + if ( !face->blend ) { @@ -2690,25 +2723,35 @@ goto Exit; } - FT_MEM_COPY( blend->coords, - coords, - num_coords * sizeof ( FT_Fixed ) ); - - c = blend->coords + num_coords; + c = blend->coords; + n = coords; + for ( i = 0; i < num_coords; i++, n++, c++ ) + { + if ( *c != *n ) + { + *c = *n; + have_diff = 1; + } + } if ( FT_IS_NAMED_INSTANCE( FT_FACE( face ) ) ) { FT_UInt instance_index; FT_Var_Named_Style* named_style; - FT_Fixed* n; instance_index = (FT_UInt)face->root.face_index >> 16; named_style = mmvar->namedstyle + instance_index - 1; n = named_style->coords + num_coords; - for ( i = num_coords; i < mmvar->num_axis; i++, n++, c++ ) - *c = *n; + for ( ; i < mmvar->num_axis; i++, n++, c++ ) + { + if ( *c != *n ) + { + *c = *n; + have_diff = 1; + } + } } else { @@ -2716,10 +2759,20 @@ a = mmvar->axis + num_coords; - for ( i = num_coords; i < mmvar->num_axis; i++, a++, c++ ) - *c = a->def; + for ( ; i < mmvar->num_axis; i++, a++, c++ ) + { + if ( *c != a->def ) + { + *c = a->def; + have_diff = 1; + } + } } + /* return value -1 indicates `no change' */ + if ( !have_diff ) + return -1; + if ( FT_NEW_ARRAY( normalized, mmvar->num_axis ) ) goto Exit; diff --git a/src/type1/t1load.c b/src/type1/t1load.c index bdb986a01..70e7c68df 100644 --- a/src/type1/t1load.c +++ b/src/type1/t1load.c @@ -374,6 +374,8 @@ PS_Blend blend = face->blend; FT_UInt n, m; + FT_Bool have_diff = 0; + if ( !blend ) return FT_THROW( Invalid_Argument ); @@ -405,10 +407,16 @@ result = FT_MulFix( result, factor ); } - blend->weight_vector[n] = result; + + if ( blend->weight_vector[n] != result ) + { + blend->weight_vector[n] = result; + have_diff = 1; + } } - return FT_Err_Ok; + /* return value -1 indicates `no change' */ + return have_diff ? FT_Err_Ok : -1; } From a956e36c8d17d0e10bdb5b71cae12d1c5695c559 Mon Sep 17 00:00:00 2001 From: Ewald Hew Date: Mon, 25 Dec 2017 12:34:37 +0800 Subject: [PATCH 379/470] Move PostScript drivers' property handlers to `base' This reduces the amount of duplicated code across PostScript drivers. * src/cff/cffdrivr.c, src/cid/cidriver.c, src/type1/t1driver.c ({cff,cid,t1}_property_{get,set}): Moved to... * include/freetype/internal/ftpsprop.h: ...this new file. (ps_property_{get,set}): New functions to replace moved ones. * src/base/ftpsprop.c: Implement above functions. * include/freetype/internal/internal.h (FT_INTERNAL_POSTSCRIPT_PROPS_H): New macro. * src/cff/cffdrivr.c, src/cid/cidriver.c, src/type1/t1driver.c: Updated. * src/base/Jamfile, src/base/rules.mk, src/base/ftbase.c: Updated. --- include/freetype/internal/ftpsprop.h | 39 +++++ include/freetype/internal/internal.h | 1 + src/base/Jamfile | 1 + src/base/ftbase.c | 1 + src/base/ftpsprop.c | 249 +++++++++++++++++++++++++++ src/base/rules.mk | 1 + src/cff/cffdrivr.c | 225 +----------------------- src/cid/cidriver.c | 225 +----------------------- src/type1/t1driver.c | 225 +----------------------- 9 files changed, 301 insertions(+), 666 deletions(-) create mode 100644 include/freetype/internal/ftpsprop.h create mode 100644 src/base/ftpsprop.c diff --git a/include/freetype/internal/ftpsprop.h b/include/freetype/internal/ftpsprop.h new file mode 100644 index 000000000..97e313a94 --- /dev/null +++ b/include/freetype/internal/ftpsprop.h @@ -0,0 +1,39 @@ +/***************************************************************************/ +/* */ +/* ftpsprop.h */ +/* */ +/* Get and set properties of PostScript drivers (specification). */ +/* */ +/***************************************************************************/ + + +#ifndef FTPSPROP_H_ +#define FTPSPROP_H_ + + +#include +#include FT_FREETYPE_H + + +FT_BEGIN_HEADER + + + FT_Error + ps_property_set( FT_Module module, /* PS_Driver */ + const char* property_name, + const void* value, + FT_Bool value_is_string ); + + FT_Error + ps_property_get( FT_Module module, /* PS_Driver */ + const char* property_name, + const void* value ); + + +FT_END_HEADER + + +#endif /* FTPSPROP_H_ */ + + +/* END */ diff --git a/include/freetype/internal/internal.h b/include/freetype/internal/internal.h index 45ae44740..58e766d9f 100644 --- a/include/freetype/internal/internal.h +++ b/include/freetype/internal/internal.h @@ -44,6 +44,7 @@ #define FT_INTERNAL_POSTSCRIPT_AUX_H #define FT_INTERNAL_POSTSCRIPT_HINTS_H +#define FT_INTERNAL_POSTSCRIPT_PROPS_H #define FT_INTERNAL_AUTOHINT_H diff --git a/src/base/Jamfile b/src/base/Jamfile index 9e9a91b20..893c9fa6d 100644 --- a/src/base/Jamfile +++ b/src/base/Jamfile @@ -26,6 +26,7 @@ SubDir FT2_TOP $(FT2_SRC_DIR) base ; ftobjs ftoutln ftpic + ftpsprop ftrfork ftsnames ftstream diff --git a/src/base/ftbase.c b/src/base/ftbase.c index 55f735994..a6dd6f5b1 100644 --- a/src/base/ftbase.c +++ b/src/base/ftbase.c @@ -29,6 +29,7 @@ #include "ftobjs.c" #include "ftoutln.c" #include "ftpic.c" +#include "ftpsprop.c" #include "ftrfork.c" #include "ftsnames.c" #include "ftstream.c" diff --git a/src/base/ftpsprop.c b/src/base/ftpsprop.c new file mode 100644 index 000000000..a8bb050d9 --- /dev/null +++ b/src/base/ftpsprop.c @@ -0,0 +1,249 @@ +/***************************************************************************/ +/* */ +/* ftpsprop.c */ +/* */ +/* Get and set properties of PostScript drivers (body). */ +/* See `ftdriver.h' for available properties. */ +/* */ +/* Copyright */ +/***************************************************************************/ + + + + FT_Error + ps_property_set( FT_Module module, /* PS_Driver */ + const char* property_name, + const void* value, + FT_Bool value_is_string ) + { + FT_Error error = FT_Err_Ok; + PS_Driver driver = (PS_Driver)module; + +#ifndef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES + FT_UNUSED( value_is_string ); +#endif + + + if ( !ft_strcmp( property_name, "darkening-parameters" ) ) + { + FT_Int* darken_params; + FT_Int x1, y1, x2, y2, x3, y3, x4, y4; + +#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES + FT_Int dp[8]; + + + if ( value_is_string ) + { + const char* s = (const char*)value; + char* ep; + int i; + + + /* eight comma-separated numbers */ + for ( i = 0; i < 7; i++ ) + { + dp[i] = (FT_Int)ft_strtol( s, &ep, 10 ); + if ( *ep != ',' || s == ep ) + return FT_THROW( Invalid_Argument ); + + s = ep + 1; + } + + dp[7] = (FT_Int)ft_strtol( s, &ep, 10 ); + if ( !( *ep == '\0' || *ep == ' ' ) || s == ep ) + return FT_THROW( Invalid_Argument ); + + darken_params = dp; + } + else +#endif + darken_params = (FT_Int*)value; + + x1 = darken_params[0]; + y1 = darken_params[1]; + x2 = darken_params[2]; + y2 = darken_params[3]; + x3 = darken_params[4]; + y3 = darken_params[5]; + x4 = darken_params[6]; + y4 = darken_params[7]; + + if ( x1 < 0 || x2 < 0 || x3 < 0 || x4 < 0 || + y1 < 0 || y2 < 0 || y3 < 0 || y4 < 0 || + x1 > x2 || x2 > x3 || x3 > x4 || + y1 > 500 || y2 > 500 || y3 > 500 || y4 > 500 ) + return FT_THROW( Invalid_Argument ); + + driver->darken_params[0] = x1; + driver->darken_params[1] = y1; + driver->darken_params[2] = x2; + driver->darken_params[3] = y2; + driver->darken_params[4] = x3; + driver->darken_params[5] = y3; + driver->darken_params[6] = x4; + driver->darken_params[7] = y4; + + return error; + } + else if ( !ft_strcmp( property_name, "hinting-engine" ) ) + { +#if defined(CFF_CONFIG_OPTION_OLD_ENGINE) || defined(T1_CONFIG_OPTION_OLD_ENGINE) + const char* module_name = module->clazz->module_name; +#endif + + +#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES + if ( value_is_string ) + { + const char* s = (const char*)value; + + + if ( !ft_strcmp( s, "adobe" ) ) + driver->hinting_engine = FT_HINTING_ADOBE; +#ifdef CFF_CONFIG_OPTION_OLD_ENGINE + else if ( !ft_strcmp( module_name, "cff" ) && + !ft_strcmp( s, "freetype" ) ) + driver->hinting_engine = FT_HINTING_FREETYPE; +#endif +#ifdef T1_CONFIG_OPTION_OLD_ENGINE + else if ( ( !ft_strcmp( module_name, "type1" ) || + !ft_strcmp( module_name, "t1cid" ) ) && + !ft_strcmp( s, "freetype" ) ) + driver->hinting_engine = FT_HINTING_FREETYPE; +#endif + else + return FT_THROW( Invalid_Argument ); + } + else +#endif /* FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES */ + { + FT_UInt* hinting_engine = (FT_UInt*)value; + + + if ( *hinting_engine == FT_HINTING_ADOBE +#ifdef CFF_CONFIG_OPTION_OLD_ENGINE + || ( *hinting_engine == FT_HINTING_FREETYPE && + !ft_strcmp( module_name, "cff" ) ) +#endif +#ifdef T1_CONFIG_OPTION_OLD_ENGINE + || ( *hinting_engine == FT_HINTING_FREETYPE && + ( !ft_strcmp( module_name, "type1" ) || + !ft_strcmp( module_name, "t1cid" ) ) ) +#endif + ) + driver->hinting_engine = *hinting_engine; + else + error = FT_ERR( Unimplemented_Feature ); + + return error; + } + } + else if ( !ft_strcmp( property_name, "no-stem-darkening" ) ) + { +#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES + if ( value_is_string ) + { + const char* s = (const char*)value; + long nsd = ft_strtol( s, NULL, 10 ); + + + if ( !nsd ) + driver->no_stem_darkening = FALSE; + else + driver->no_stem_darkening = TRUE; + } + else +#endif + { + FT_Bool* no_stem_darkening = (FT_Bool*)value; + + + driver->no_stem_darkening = *no_stem_darkening; + } + + return error; + } + else if ( !ft_strcmp( property_name, "random-seed" ) ) + { + FT_Int32 random_seed; + + +#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES + if ( value_is_string ) + { + const char* s = (const char*)value; + + + random_seed = (FT_Int32)ft_strtol( s, NULL, 10 ); + } + else +#endif + random_seed = *(FT_Int32*)value; + + if ( random_seed < 0 ) + random_seed = 0; + + driver->random_seed = random_seed; + + return error; + } + + FT_TRACE0(( "ps_property_set: missing property `%s'\n", + property_name )); + return FT_THROW( Missing_Property ); + } + + + FT_Error + ps_property_get( FT_Module module, /* PS_Driver */ + const char* property_name, + const void* value ) + { + FT_Error error = FT_Err_Ok; + PS_Driver driver = (PS_Driver)module; + + + if ( !ft_strcmp( property_name, "darkening-parameters" ) ) + { + FT_Int* darken_params = driver->darken_params; + FT_Int* val = (FT_Int*)value; + + + val[0] = darken_params[0]; + val[1] = darken_params[1]; + val[2] = darken_params[2]; + val[3] = darken_params[3]; + val[4] = darken_params[4]; + val[5] = darken_params[5]; + val[6] = darken_params[6]; + val[7] = darken_params[7]; + + return error; + } + else if ( !ft_strcmp( property_name, "hinting-engine" ) ) + { + FT_UInt hinting_engine = driver->hinting_engine; + FT_UInt* val = (FT_UInt*)value; + + + *val = hinting_engine; + + return error; + } + else if ( !ft_strcmp( property_name, "no-stem-darkening" ) ) + { + FT_Bool no_stem_darkening = driver->no_stem_darkening; + FT_Bool* val = (FT_Bool*)value; + + + *val = no_stem_darkening; + + return error; + } + + FT_TRACE0(( "ps_property_get: missing property `%s'\n", + property_name )); + return FT_THROW( Missing_Property ); + } + diff --git a/src/base/rules.mk b/src/base/rules.mk index 2a1e93cb0..a81ddaaf3 100644 --- a/src/base/rules.mk +++ b/src/base/rules.mk @@ -45,6 +45,7 @@ BASE_SRC := $(BASE_DIR)/basepic.c \ $(BASE_DIR)/ftobjs.c \ $(BASE_DIR)/ftoutln.c \ $(BASE_DIR)/ftpic.c \ + $(BASE_DIR)/ftpsprop.c \ $(BASE_DIR)/ftrfork.c \ $(BASE_DIR)/ftsnames.c \ $(BASE_DIR)/ftstream.c \ diff --git a/src/cff/cffdrivr.c b/src/cff/cffdrivr.c index cc661a48e..b55b2ea0d 100644 --- a/src/cff/cffdrivr.c +++ b/src/cff/cffdrivr.c @@ -22,6 +22,7 @@ #include FT_INTERNAL_STREAM_H #include FT_INTERNAL_SFNT_H #include FT_INTERNAL_POSTSCRIPT_AUX_H +#include FT_INTERNAL_POSTSCRIPT_PROPS_H #include FT_SERVICE_CID_H #include FT_SERVICE_POSTSCRIPT_INFO_H #include FT_SERVICE_POSTSCRIPT_NAME_H @@ -820,231 +821,11 @@ * PROPERTY SERVICE * */ - static FT_Error - cff_property_set( FT_Module module, /* CFF_Driver */ - const char* property_name, - const void* value, - FT_Bool value_is_string ) - { - FT_Error error = FT_Err_Ok; - PS_Driver driver = (PS_Driver)module; - -#ifndef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES - FT_UNUSED( value_is_string ); -#endif - - - if ( !ft_strcmp( property_name, "darkening-parameters" ) ) - { - FT_Int* darken_params; - FT_Int x1, y1, x2, y2, x3, y3, x4, y4; - -#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES - FT_Int dp[8]; - - - if ( value_is_string ) - { - const char* s = (const char*)value; - char* ep; - int i; - - - /* eight comma-separated numbers */ - for ( i = 0; i < 7; i++ ) - { - dp[i] = (FT_Int)ft_strtol( s, &ep, 10 ); - if ( *ep != ',' || s == ep ) - return FT_THROW( Invalid_Argument ); - - s = ep + 1; - } - - dp[7] = (FT_Int)ft_strtol( s, &ep, 10 ); - if ( !( *ep == '\0' || *ep == ' ' ) || s == ep ) - return FT_THROW( Invalid_Argument ); - - darken_params = dp; - } - else -#endif - darken_params = (FT_Int*)value; - - x1 = darken_params[0]; - y1 = darken_params[1]; - x2 = darken_params[2]; - y2 = darken_params[3]; - x3 = darken_params[4]; - y3 = darken_params[5]; - x4 = darken_params[6]; - y4 = darken_params[7]; - - if ( x1 < 0 || x2 < 0 || x3 < 0 || x4 < 0 || - y1 < 0 || y2 < 0 || y3 < 0 || y4 < 0 || - x1 > x2 || x2 > x3 || x3 > x4 || - y1 > 500 || y2 > 500 || y3 > 500 || y4 > 500 ) - return FT_THROW( Invalid_Argument ); - - driver->darken_params[0] = x1; - driver->darken_params[1] = y1; - driver->darken_params[2] = x2; - driver->darken_params[3] = y2; - driver->darken_params[4] = x3; - driver->darken_params[5] = y3; - driver->darken_params[6] = x4; - driver->darken_params[7] = y4; - - return error; - } - else if ( !ft_strcmp( property_name, "hinting-engine" ) ) - { -#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES - if ( value_is_string ) - { - const char* s = (const char*)value; - - - if ( !ft_strcmp( s, "adobe" ) ) - driver->hinting_engine = FT_HINTING_ADOBE; -#ifdef CFF_CONFIG_OPTION_OLD_ENGINE - else if ( !ft_strcmp( s, "freetype" ) ) - driver->hinting_engine = FT_HINTING_FREETYPE; -#endif - else - return FT_THROW( Invalid_Argument ); - } - else -#endif - { - FT_UInt* hinting_engine = (FT_UInt*)value; - - - if ( *hinting_engine == FT_HINTING_ADOBE -#ifdef CFF_CONFIG_OPTION_OLD_ENGINE - || *hinting_engine == FT_HINTING_FREETYPE -#endif - ) - driver->hinting_engine = *hinting_engine; - else - error = FT_ERR( Unimplemented_Feature ); - - return error; - } - } - else if ( !ft_strcmp( property_name, "no-stem-darkening" ) ) - { -#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES - if ( value_is_string ) - { - const char* s = (const char*)value; - long nsd = ft_strtol( s, NULL, 10 ); - - - if ( !nsd ) - driver->no_stem_darkening = FALSE; - else - driver->no_stem_darkening = TRUE; - } - else -#endif - { - FT_Bool* no_stem_darkening = (FT_Bool*)value; - - - driver->no_stem_darkening = *no_stem_darkening; - } - - return error; - } - else if ( !ft_strcmp( property_name, "random-seed" ) ) - { - FT_Int32 random_seed; - - -#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES - if ( value_is_string ) - { - const char* s = (const char*)value; - - - random_seed = (FT_Int32)ft_strtol( s, NULL, 10 ); - } - else -#endif - random_seed = *(FT_Int32*)value; - - if ( random_seed < 0 ) - random_seed = 0; - - driver->random_seed = random_seed; - - return error; - } - - FT_TRACE0(( "cff_property_set: missing property `%s'\n", - property_name )); - return FT_THROW( Missing_Property ); - } - - - static FT_Error - cff_property_get( FT_Module module, /* CFF_Driver */ - const char* property_name, - const void* value ) - { - FT_Error error = FT_Err_Ok; - PS_Driver driver = (PS_Driver)module; - - - if ( !ft_strcmp( property_name, "darkening-parameters" ) ) - { - FT_Int* darken_params = driver->darken_params; - FT_Int* val = (FT_Int*)value; - - - val[0] = darken_params[0]; - val[1] = darken_params[1]; - val[2] = darken_params[2]; - val[3] = darken_params[3]; - val[4] = darken_params[4]; - val[5] = darken_params[5]; - val[6] = darken_params[6]; - val[7] = darken_params[7]; - - return error; - } - else if ( !ft_strcmp( property_name, "hinting-engine" ) ) - { - FT_UInt hinting_engine = driver->hinting_engine; - FT_UInt* val = (FT_UInt*)value; - - - *val = hinting_engine; - - return error; - } - else if ( !ft_strcmp( property_name, "no-stem-darkening" ) ) - { - FT_Bool no_stem_darkening = driver->no_stem_darkening; - FT_Bool* val = (FT_Bool*)value; - - - *val = no_stem_darkening; - - return error; - } - - FT_TRACE0(( "cff_property_get: missing property `%s'\n", - property_name )); - return FT_THROW( Missing_Property ); - } - - FT_DEFINE_SERVICE_PROPERTIESREC( cff_service_properties, - (FT_Properties_SetFunc)cff_property_set, /* set_property */ - (FT_Properties_GetFunc)cff_property_get ) /* get_property */ + (FT_Properties_SetFunc)ps_property_set, /* set_property */ + (FT_Properties_GetFunc)ps_property_get ) /* get_property */ #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT diff --git a/src/cid/cidriver.c b/src/cid/cidriver.c index 485e1247c..d665d12a8 100644 --- a/src/cid/cidriver.c +++ b/src/cid/cidriver.c @@ -20,6 +20,7 @@ #include "cidriver.h" #include "cidgload.h" #include FT_INTERNAL_DEBUG_H +#include FT_INTERNAL_POSTSCRIPT_PROPS_H #include "ciderrs.h" @@ -175,231 +176,11 @@ * PROPERTY SERVICE * */ - static FT_Error - cid_property_set( FT_Module module, /* PS_Driver */ - const char* property_name, - const void* value, - FT_Bool value_is_string ) - { - FT_Error error = FT_Err_Ok; - PS_Driver driver = (PS_Driver)module; - -#ifndef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES - FT_UNUSED( value_is_string ); -#endif - - - if ( !ft_strcmp( property_name, "darkening-parameters" ) ) - { - FT_Int* darken_params; - FT_Int x1, y1, x2, y2, x3, y3, x4, y4; - -#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES - FT_Int dp[8]; - - - if ( value_is_string ) - { - const char* s = (const char*)value; - char* ep; - int i; - - - /* eight comma-separated numbers */ - for ( i = 0; i < 7; i++ ) - { - dp[i] = (FT_Int)ft_strtol( s, &ep, 10 ); - if ( *ep != ',' || s == ep ) - return FT_THROW( Invalid_Argument ); - - s = ep + 1; - } - - dp[7] = (FT_Int)ft_strtol( s, &ep, 10 ); - if ( !( *ep == '\0' || *ep == ' ' ) || s == ep ) - return FT_THROW( Invalid_Argument ); - - darken_params = dp; - } - else -#endif - darken_params = (FT_Int*)value; - - x1 = darken_params[0]; - y1 = darken_params[1]; - x2 = darken_params[2]; - y2 = darken_params[3]; - x3 = darken_params[4]; - y3 = darken_params[5]; - x4 = darken_params[6]; - y4 = darken_params[7]; - - if ( x1 < 0 || x2 < 0 || x3 < 0 || x4 < 0 || - y1 < 0 || y2 < 0 || y3 < 0 || y4 < 0 || - x1 > x2 || x2 > x3 || x3 > x4 || - y1 > 500 || y2 > 500 || y3 > 500 || y4 > 500 ) - return FT_THROW( Invalid_Argument ); - - driver->darken_params[0] = x1; - driver->darken_params[1] = y1; - driver->darken_params[2] = x2; - driver->darken_params[3] = y2; - driver->darken_params[4] = x3; - driver->darken_params[5] = y3; - driver->darken_params[6] = x4; - driver->darken_params[7] = y4; - - return error; - } - else if ( !ft_strcmp( property_name, "hinting-engine" ) ) - { -#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES - if ( value_is_string ) - { - const char* s = (const char*)value; - - - if ( !ft_strcmp( s, "adobe" ) ) - driver->hinting_engine = FT_HINTING_ADOBE; -#ifdef T1_CONFIG_OPTION_OLD_ENGINE - else if ( !ft_strcmp( s, "freetype" ) ) - driver->hinting_engine = FT_HINTING_FREETYPE; -#endif - else - return FT_THROW( Invalid_Argument ); - } - else -#endif - { - FT_UInt* hinting_engine = (FT_UInt*)value; - - - if ( *hinting_engine == FT_HINTING_ADOBE -#ifdef T1_CONFIG_OPTION_OLD_ENGINE - || *hinting_engine == FT_HINTING_FREETYPE -#endif - ) - driver->hinting_engine = *hinting_engine; - else - error = FT_ERR( Unimplemented_Feature ); - - return error; - } - } - else if ( !ft_strcmp( property_name, "no-stem-darkening" ) ) - { -#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES - if ( value_is_string ) - { - const char* s = (const char*)value; - long nsd = ft_strtol( s, NULL, 10 ); - - - if ( !nsd ) - driver->no_stem_darkening = FALSE; - else - driver->no_stem_darkening = TRUE; - } - else -#endif - { - FT_Bool* no_stem_darkening = (FT_Bool*)value; - - - driver->no_stem_darkening = *no_stem_darkening; - } - - return error; - } - else if ( !ft_strcmp( property_name, "random-seed" ) ) - { - FT_Int32 random_seed; - - -#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES - if ( value_is_string ) - { - const char* s = (const char*)value; - - - random_seed = (FT_Int32)ft_strtol( s, NULL, 10 ); - } - else -#endif - random_seed = *(FT_Int32*)value; - - if ( random_seed < 0 ) - random_seed = 0; - - driver->random_seed = random_seed; - - return error; - } - - FT_TRACE0(( "cid_property_set: missing property `%s'\n", - property_name )); - return FT_THROW( Missing_Property ); - } - - - static FT_Error - cid_property_get( FT_Module module, /* PS_Driver */ - const char* property_name, - const void* value ) - { - FT_Error error = FT_Err_Ok; - PS_Driver driver = (PS_Driver)module; - - - if ( !ft_strcmp( property_name, "darkening-parameters" ) ) - { - FT_Int* darken_params = driver->darken_params; - FT_Int* val = (FT_Int*)value; - - - val[0] = darken_params[0]; - val[1] = darken_params[1]; - val[2] = darken_params[2]; - val[3] = darken_params[3]; - val[4] = darken_params[4]; - val[5] = darken_params[5]; - val[6] = darken_params[6]; - val[7] = darken_params[7]; - - return error; - } - else if ( !ft_strcmp( property_name, "hinting-engine" ) ) - { - FT_UInt hinting_engine = driver->hinting_engine; - FT_UInt* val = (FT_UInt*)value; - - - *val = hinting_engine; - - return error; - } - else if ( !ft_strcmp( property_name, "no-stem-darkening" ) ) - { - FT_Bool no_stem_darkening = driver->no_stem_darkening; - FT_Bool* val = (FT_Bool*)value; - - - *val = no_stem_darkening; - - return error; - } - - FT_TRACE0(( "cid_property_get: missing property `%s'\n", - property_name )); - return FT_THROW( Missing_Property ); - } - - FT_DEFINE_SERVICE_PROPERTIESREC( cid_service_properties, - (FT_Properties_SetFunc)cid_property_set, /* set_property */ - (FT_Properties_GetFunc)cid_property_get ) /* get_property */ + (FT_Properties_SetFunc)ps_property_set, /* set_property */ + (FT_Properties_GetFunc)ps_property_get ) /* get_property */ /* diff --git a/src/type1/t1driver.c b/src/type1/t1driver.c index 63df1c49b..f354ac1b8 100644 --- a/src/type1/t1driver.c +++ b/src/type1/t1driver.c @@ -30,6 +30,7 @@ #include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_STREAM_H #include FT_INTERNAL_HASH_H +#include FT_INTERNAL_POSTSCRIPT_PROPS_H #include FT_DRIVER_H #include FT_SERVICE_MULTIPLE_MASTERS_H @@ -620,231 +621,11 @@ * PROPERTY SERVICE * */ - static FT_Error - t1_property_set( FT_Module module, /* PS_Driver */ - const char* property_name, - const void* value, - FT_Bool value_is_string ) - { - FT_Error error = FT_Err_Ok; - PS_Driver driver = (PS_Driver)module; - -#ifndef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES - FT_UNUSED( value_is_string ); -#endif - - - if ( !ft_strcmp( property_name, "darkening-parameters" ) ) - { - FT_Int* darken_params; - FT_Int x1, y1, x2, y2, x3, y3, x4, y4; - -#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES - FT_Int dp[8]; - - - if ( value_is_string ) - { - const char* s = (const char*)value; - char* ep; - int i; - - - /* eight comma-separated numbers */ - for ( i = 0; i < 7; i++ ) - { - dp[i] = (FT_Int)ft_strtol( s, &ep, 10 ); - if ( *ep != ',' || s == ep ) - return FT_THROW( Invalid_Argument ); - - s = ep + 1; - } - - dp[7] = (FT_Int)ft_strtol( s, &ep, 10 ); - if ( !( *ep == '\0' || *ep == ' ' ) || s == ep ) - return FT_THROW( Invalid_Argument ); - - darken_params = dp; - } - else -#endif - darken_params = (FT_Int*)value; - - x1 = darken_params[0]; - y1 = darken_params[1]; - x2 = darken_params[2]; - y2 = darken_params[3]; - x3 = darken_params[4]; - y3 = darken_params[5]; - x4 = darken_params[6]; - y4 = darken_params[7]; - - if ( x1 < 0 || x2 < 0 || x3 < 0 || x4 < 0 || - y1 < 0 || y2 < 0 || y3 < 0 || y4 < 0 || - x1 > x2 || x2 > x3 || x3 > x4 || - y1 > 500 || y2 > 500 || y3 > 500 || y4 > 500 ) - return FT_THROW( Invalid_Argument ); - - driver->darken_params[0] = x1; - driver->darken_params[1] = y1; - driver->darken_params[2] = x2; - driver->darken_params[3] = y2; - driver->darken_params[4] = x3; - driver->darken_params[5] = y3; - driver->darken_params[6] = x4; - driver->darken_params[7] = y4; - - return error; - } - else if ( !ft_strcmp( property_name, "hinting-engine" ) ) - { -#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES - if ( value_is_string ) - { - const char* s = (const char*)value; - - - if ( !ft_strcmp( s, "adobe" ) ) - driver->hinting_engine = FT_HINTING_ADOBE; -#ifdef T1_CONFIG_OPTION_OLD_ENGINE - else if ( !ft_strcmp( s, "freetype" ) ) - driver->hinting_engine = FT_HINTING_FREETYPE; -#endif - else - return FT_THROW( Invalid_Argument ); - } - else -#endif - { - FT_UInt* hinting_engine = (FT_UInt*)value; - - - if ( *hinting_engine == FT_HINTING_ADOBE -#ifdef T1_CONFIG_OPTION_OLD_ENGINE - || *hinting_engine == FT_HINTING_FREETYPE -#endif - ) - driver->hinting_engine = *hinting_engine; - else - error = FT_ERR( Unimplemented_Feature ); - - return error; - } - } - else if ( !ft_strcmp( property_name, "no-stem-darkening" ) ) - { -#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES - if ( value_is_string ) - { - const char* s = (const char*)value; - long nsd = ft_strtol( s, NULL, 10 ); - - - if ( !nsd ) - driver->no_stem_darkening = FALSE; - else - driver->no_stem_darkening = TRUE; - } - else -#endif - { - FT_Bool* no_stem_darkening = (FT_Bool*)value; - - - driver->no_stem_darkening = *no_stem_darkening; - } - - return error; - } - else if ( !ft_strcmp( property_name, "random-seed" ) ) - { - FT_Int32 random_seed; - - -#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES - if ( value_is_string ) - { - const char* s = (const char*)value; - - - random_seed = (FT_Int32)ft_strtol( s, NULL, 10 ); - } - else -#endif - random_seed = *(FT_Int32*)value; - - if ( random_seed < 0 ) - random_seed = 0; - - driver->random_seed = random_seed; - - return error; - } - - FT_TRACE0(( "t1_property_set: missing property `%s'\n", - property_name )); - return FT_THROW( Missing_Property ); - } - - - static FT_Error - t1_property_get( FT_Module module, /* PS_Driver */ - const char* property_name, - const void* value ) - { - FT_Error error = FT_Err_Ok; - PS_Driver driver = (PS_Driver)module; - - - if ( !ft_strcmp( property_name, "darkening-parameters" ) ) - { - FT_Int* darken_params = driver->darken_params; - FT_Int* val = (FT_Int*)value; - - - val[0] = darken_params[0]; - val[1] = darken_params[1]; - val[2] = darken_params[2]; - val[3] = darken_params[3]; - val[4] = darken_params[4]; - val[5] = darken_params[5]; - val[6] = darken_params[6]; - val[7] = darken_params[7]; - - return error; - } - else if ( !ft_strcmp( property_name, "hinting-engine" ) ) - { - FT_UInt hinting_engine = driver->hinting_engine; - FT_UInt* val = (FT_UInt*)value; - - - *val = hinting_engine; - - return error; - } - else if ( !ft_strcmp( property_name, "no-stem-darkening" ) ) - { - FT_Bool no_stem_darkening = driver->no_stem_darkening; - FT_Bool* val = (FT_Bool*)value; - - - *val = no_stem_darkening; - - return error; - } - - FT_TRACE0(( "t1_property_get: missing property `%s'\n", - property_name )); - return FT_THROW( Missing_Property ); - } - - FT_DEFINE_SERVICE_PROPERTIESREC( t1_service_properties, - (FT_Properties_SetFunc)t1_property_set, /* set_property */ - (FT_Properties_GetFunc)t1_property_get ) /* get_property */ + (FT_Properties_SetFunc)ps_property_set, /* set_property */ + (FT_Properties_GetFunc)ps_property_get ) /* get_property */ /* From dd6330d74b1d781ef62a070c0b612bf8b6fddbfe Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Wed, 27 Dec 2017 08:06:47 +0100 Subject: [PATCH 380/470] Add missing ChangeLog entry, copyright notices, whitespace, formatting. --- ChangeLog | 23 ++++++++++++++++++++++ include/freetype/internal/ftpsprop.h | 9 +++++++++ src/base/ftpsprop.c | 29 +++++++++++++++++++++++----- src/cff/cffdrivr.c | 1 + src/cid/cidriver.c | 1 + src/type1/t1driver.c | 1 + 6 files changed, 59 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index e19cb50f1..f644b5326 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,26 @@ +2017-12-25 Ewald Hew + + Move PostScript drivers' property handlers to `base'. + + This reduces the amount of duplicated code across PostScript + drivers. + + * src/cff/cffdrivr.c, src/cid/cidriver.c, src/type1/t1driver.c + ({cff,cid,t1}_property_{get,set}): Moved to... + * include/freetype/internal/ftpsprop.h: ...this new file. + (ps_property_{get,set}): New functions to replace moved ones. + + * src/base/ftpsprop.c: New file that implements above functions. + + * include/freetype/internal/internal.h + (FT_INTERNAL_POSTSCRIPT_PROPS_H): New macro. + + * src/cff/cffdrivr.c, src/cid/cidriver.c, src/type1/t1driver.c: + Updated. + + * src/base/Jamfile, src/base/rules.mk (BASE_SRC), src/base/ftbase.c: + Updated. + 2017-12-20 Werner Lemberg Speed up FT_Set_Var_{Design,Blend}_Coordinates if curr == new. diff --git a/include/freetype/internal/ftpsprop.h b/include/freetype/internal/ftpsprop.h index 97e313a94..cbd287469 100644 --- a/include/freetype/internal/ftpsprop.h +++ b/include/freetype/internal/ftpsprop.h @@ -4,6 +4,15 @@ /* */ /* Get and set properties of PostScript drivers (specification). */ /* */ +/* Copyright 2017 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ /***************************************************************************/ diff --git a/src/base/ftpsprop.c b/src/base/ftpsprop.c index a8bb050d9..b146eaba0 100644 --- a/src/base/ftpsprop.c +++ b/src/base/ftpsprop.c @@ -5,7 +5,15 @@ /* Get and set properties of PostScript drivers (body). */ /* See `ftdriver.h' for available properties. */ /* */ -/* Copyright */ +/* Copyright 2017 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ /***************************************************************************/ @@ -86,9 +94,11 @@ return error; } + else if ( !ft_strcmp( property_name, "hinting-engine" ) ) { -#if defined(CFF_CONFIG_OPTION_OLD_ENGINE) || defined(T1_CONFIG_OPTION_OLD_ENGINE) +#if defined( CFF_CONFIG_OPTION_OLD_ENGINE ) || \ + defined( T1_CONFIG_OPTION_OLD_ENGINE ) const char* module_name = module->clazz->module_name; #endif @@ -101,17 +111,20 @@ if ( !ft_strcmp( s, "adobe" ) ) driver->hinting_engine = FT_HINTING_ADOBE; + #ifdef CFF_CONFIG_OPTION_OLD_ENGINE else if ( !ft_strcmp( module_name, "cff" ) && - !ft_strcmp( s, "freetype" ) ) + !ft_strcmp( s, "freetype" ) ) driver->hinting_engine = FT_HINTING_FREETYPE; #endif + #ifdef T1_CONFIG_OPTION_OLD_ENGINE else if ( ( !ft_strcmp( module_name, "type1" ) || !ft_strcmp( module_name, "t1cid" ) ) && - !ft_strcmp( s, "freetype" ) ) + !ft_strcmp( s, "freetype" ) ) driver->hinting_engine = FT_HINTING_FREETYPE; #endif + else return FT_THROW( Invalid_Argument ); } @@ -124,7 +137,7 @@ if ( *hinting_engine == FT_HINTING_ADOBE #ifdef CFF_CONFIG_OPTION_OLD_ENGINE || ( *hinting_engine == FT_HINTING_FREETYPE && - !ft_strcmp( module_name, "cff" ) ) + !ft_strcmp( module_name, "cff" ) ) #endif #ifdef T1_CONFIG_OPTION_OLD_ENGINE || ( *hinting_engine == FT_HINTING_FREETYPE && @@ -139,6 +152,7 @@ return error; } } + else if ( !ft_strcmp( property_name, "no-stem-darkening" ) ) { #ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES @@ -164,6 +178,7 @@ return error; } + else if ( !ft_strcmp( property_name, "random-seed" ) ) { FT_Int32 random_seed; @@ -221,6 +236,7 @@ return error; } + else if ( !ft_strcmp( property_name, "hinting-engine" ) ) { FT_UInt hinting_engine = driver->hinting_engine; @@ -231,6 +247,7 @@ return error; } + else if ( !ft_strcmp( property_name, "no-stem-darkening" ) ) { FT_Bool no_stem_darkening = driver->no_stem_darkening; @@ -247,3 +264,5 @@ return FT_THROW( Missing_Property ); } + +/* END */ diff --git a/src/cff/cffdrivr.c b/src/cff/cffdrivr.c index b55b2ea0d..4236c801c 100644 --- a/src/cff/cffdrivr.c +++ b/src/cff/cffdrivr.c @@ -821,6 +821,7 @@ * PROPERTY SERVICE * */ + FT_DEFINE_SERVICE_PROPERTIESREC( cff_service_properties, diff --git a/src/cid/cidriver.c b/src/cid/cidriver.c index d665d12a8..464ff49ab 100644 --- a/src/cid/cidriver.c +++ b/src/cid/cidriver.c @@ -176,6 +176,7 @@ * PROPERTY SERVICE * */ + FT_DEFINE_SERVICE_PROPERTIESREC( cid_service_properties, diff --git a/src/type1/t1driver.c b/src/type1/t1driver.c index f354ac1b8..57a91ae92 100644 --- a/src/type1/t1driver.c +++ b/src/type1/t1driver.c @@ -621,6 +621,7 @@ * PROPERTY SERVICE * */ + FT_DEFINE_SERVICE_PROPERTIESREC( t1_service_properties, From 1063690174cbd6752a280e0881016ccd0134b466 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Wed, 27 Dec 2017 08:11:14 +0100 Subject: [PATCH 381/470] Provide support for intra-module callback functions. This is needed especially for `make multi' with C++. * include/freetype/config/ftconfig.h (FT_BASE_CALLBACK, FT_BASE_CALLBACK_DEF): New macros. --- ChangeLog | 9 ++++++++ include/freetype/config/ftconfig.h | 35 +++++++++++++++++++++++++++++- 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index f644b5326..f9a4693fc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2017-12-27 Werner Lemberg + + Provide support for intra-module callback functions. + + This is needed especially for `make multi' with C++. + + * include/freetype/config/ftconfig.h (FT_BASE_CALLBACK, + FT_BASE_CALLBACK_DEF): New macros. + 2017-12-25 Ewald Hew Move PostScript drivers' property handlers to `base'. diff --git a/include/freetype/config/ftconfig.h b/include/freetype/config/ftconfig.h index 6967b5fb7..4a444ba5b 100644 --- a/include/freetype/config/ftconfig.h +++ b/include/freetype/config/ftconfig.h @@ -365,6 +365,14 @@ FT_BEGIN_HEADER #endif + /* Use FT_LOCAL and FT_LOCAL_DEF to declare and define, respectively, */ + /* a function that gets used only within the scope of a module. */ + /* Normally, both the header and source code files for such a */ + /* function are within a single module directory. */ + /* */ + /* Intra-module arrays should be tagged with FT_LOCAL_ARRAY and */ + /* FT_LOCAL_ARRAY_DEF. */ + /* */ #ifdef FT_MAKE_OPTION_SINGLE_OBJECT #define FT_LOCAL( x ) static x @@ -386,6 +394,12 @@ FT_BEGIN_HEADER #define FT_LOCAL_ARRAY_DEF( x ) const x + /* Use FT_BASE and FT_BASE_DEF to declare and define, respectively, */ + /* functions that are used in more than a single module. In the */ + /* current setup this implies that the declaration is in a header */ + /* file in the `include/freetype/internal' directory, and the */ + /* function body is in a file in `src/base'. */ + /* */ #ifndef FT_BASE #ifdef __cplusplus @@ -437,6 +451,8 @@ FT_BEGIN_HEADER /* You can provide your own implementation of FT_EXPORT and */ /* FT_EXPORT_DEF here if you want. */ /* */ + /* To export a variable, use FT_EXPORT_VAR. */ + /* */ #ifndef FT_EXPORT #if defined( _DLL ) @@ -473,6 +489,7 @@ FT_BEGIN_HEADER #endif /* !FT_EXPORT_VAR */ + /* The following macros are needed to compile the library with a */ /* C++ compiler and with 16bit compilers. */ /* */ @@ -484,7 +501,13 @@ FT_BEGIN_HEADER /* functions which are accessed by (global) function pointers. */ /* */ /* */ - /* FT_CALLBACK_DEF is used to _define_ a callback function. */ + /* FT_CALLBACK_DEF is used to _define_ a callback function, */ + /* located in the same source code file as the structure that uses */ + /* it. */ + /* */ + /* FT_BASE_CALLBACK and FT_BASE_CALLBACK_DEF are used to declare */ + /* and define a callback function, respectively, in a similar way */ + /* as FT_BASE and FT_BASE_DEF work. */ /* */ /* FT_CALLBACK_TABLE is used to _declare_ a constant variable that */ /* contains pointers to callback functions. */ @@ -504,6 +527,16 @@ FT_BEGIN_HEADER #endif #endif /* FT_CALLBACK_DEF */ +#ifndef FT_BASE_CALLBACK +#ifdef __cplusplus +#define FT_BASE_CALLBACK( x ) extern "C" x +#define FT_BASE_CALLBACK_DEF( x ) extern "C" x +#else +#define FT_BASE_CALLBACK( x ) extern x +#define FT_BASE_CALLBACK_DEF( x ) x +#endif +#endif /* FT_BASE_CALLBACK */ + #ifndef FT_CALLBACK_TABLE #ifdef __cplusplus #define FT_CALLBACK_TABLE extern "C" From 3cc88e2e44f1db959bb0146d798d261f104846d1 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Wed, 27 Dec 2017 08:19:09 +0100 Subject: [PATCH 382/470] Fixes for `make multi'. * include/freetype/internal/ftpsprop.h: Use `FT_BASE_CALLBACK'. (ps_property_get): Harmonize declaration with corresponding function typedef. * include/freety[e/internal/fttrace.h: Add `trace_psprops'. * src/base/ftpsprop.c: Include necessary header files. (FT_COMPONENT): Define. (ps_property_set): Tag with `FT_BASE_CALLBACK_DEF'. (ps_property_get): Tag with `FT_BASE_CALLBACK_DEF'. Harmonize declaration with corresponding function typedef. --- ChangeLog | 16 ++++++++++++++++ include/freetype/internal/ftpsprop.h | 6 +++--- include/freetype/internal/fttrace.h | 1 + src/base/ftpsprop.c | 22 +++++++++++++++++++--- 4 files changed, 39 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index f9a4693fc..a2ff9ff45 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2017-12-27 Werner Lemberg + + Fixes for `make multi'. + + * include/freetype/internal/ftpsprop.h: Use `FT_BASE_CALLBACK'. + (ps_property_get): Harmonize declaration with corresponding + function typedef. + + * include/freety[e/internal/fttrace.h: Add `trace_psprops'. + + * src/base/ftpsprop.c: Include necessary header files. + (FT_COMPONENT): Define. + (ps_property_set): Tag with `FT_BASE_CALLBACK_DEF'. + (ps_property_get): Tag with `FT_BASE_CALLBACK_DEF'. + Harmonize declaration with corresponding function typedef. + 2017-12-27 Werner Lemberg Provide support for intra-module callback functions. diff --git a/include/freetype/internal/ftpsprop.h b/include/freetype/internal/ftpsprop.h index cbd287469..cb818dfd4 100644 --- a/include/freetype/internal/ftpsprop.h +++ b/include/freetype/internal/ftpsprop.h @@ -27,16 +27,16 @@ FT_BEGIN_HEADER - FT_Error + FT_BASE_CALLBACK( FT_Error ) ps_property_set( FT_Module module, /* PS_Driver */ const char* property_name, const void* value, FT_Bool value_is_string ); - FT_Error + FT_BASE_CALLBACK( FT_Error ) ps_property_get( FT_Module module, /* PS_Driver */ const char* property_name, - const void* value ); + void* value ); FT_END_HEADER diff --git a/include/freetype/internal/fttrace.h b/include/freetype/internal/fttrace.h index 9a922f1ce..cc52e089c 100644 --- a/include/freetype/internal/fttrace.h +++ b/include/freetype/internal/fttrace.h @@ -39,6 +39,7 @@ FT_TRACE_DEF( mm ) /* MM interface (ftmm.c) */ FT_TRACE_DEF( raccess ) /* resource fork accessor (ftrfork.c) */ FT_TRACE_DEF( synth ) /* bold/slant synthesizer (ftsynth.c) */ FT_TRACE_DEF( bitmap ) /* bitmap checksum (ftobjs.c) */ +FT_TRACE_DEF( psprops ) /* PS driver properties (ftpsprop.c) */ /* Cache sub-system */ FT_TRACE_DEF( cache ) /* cache sub-system (ftcache.c, etc.) */ diff --git a/src/base/ftpsprop.c b/src/base/ftpsprop.c index b146eaba0..790127bb1 100644 --- a/src/base/ftpsprop.c +++ b/src/base/ftpsprop.c @@ -17,8 +17,24 @@ /***************************************************************************/ +#include +#include FT_DRIVER_H +#include FT_INTERNAL_DEBUG_H +#include FT_INTERNAL_POSTSCRIPT_AUX_H +#include FT_INTERNAL_OBJECTS_H - FT_Error + + /*************************************************************************/ + /* */ + /* The macro FT_COMPONENT is used in trace mode. It is an implicit */ + /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */ + /* messages during execution. */ + /* */ +#undef FT_COMPONENT +#define FT_COMPONENT trace_psprops + + + FT_BASE_CALLBACK_DEF( FT_Error ) ps_property_set( FT_Module module, /* PS_Driver */ const char* property_name, const void* value, @@ -210,10 +226,10 @@ } - FT_Error + FT_BASE_CALLBACK_DEF( FT_Error ) ps_property_get( FT_Module module, /* PS_Driver */ const char* property_name, - const void* value ) + void* value ) { FT_Error error = FT_Err_Ok; PS_Driver driver = (PS_Driver)module; From 14cd07343721cec1b657322f75603f984733b677 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Wed, 27 Dec 2017 08:59:46 +0100 Subject: [PATCH 383/470] Fix compiler warnings. * src/base/ftbitmap.c (ft_bitmap_assure_buffer): Make `pitch' and `new_pitch' unsigned. * src/base/ftpsprop.c: Include FT_INTERNAL_POSTSCRIPT_PROPS_H. --- ChangeLog | 9 +++++++++ src/base/ftbitmap.c | 30 ++++++++++++++---------------- src/base/ftpsprop.c | 1 + 3 files changed, 24 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index a2ff9ff45..b01d7cf62 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2017-12-27 Werner Lemberg + + Fix compiler warnings. + + * src/base/ftbitmap.c (ft_bitmap_assure_buffer): Make `pitch' and + `new_pitch' unsigned. + + * src/base/ftpsprop.c: Include FT_INTERNAL_POSTSCRIPT_PROPS_H. + 2017-12-27 Werner Lemberg Fixes for `make multi'. diff --git a/src/base/ftbitmap.c b/src/base/ftbitmap.c index 5ad21a3f4..9079081d4 100644 --- a/src/base/ftbitmap.c +++ b/src/base/ftbitmap.c @@ -153,8 +153,8 @@ FT_UInt ypixels ) { FT_Error error; - int pitch; - int new_pitch; + unsigned int pitch; + unsigned int new_pitch; FT_UInt bpp; FT_UInt width, height; unsigned char* buffer = NULL; @@ -162,29 +162,27 @@ width = bitmap->width; height = bitmap->rows; - pitch = bitmap->pitch; - if ( pitch < 0 ) - pitch = -pitch; + pitch = (unsigned int)FT_ABS( bitmap->pitch ); switch ( bitmap->pixel_mode ) { case FT_PIXEL_MODE_MONO: bpp = 1; - new_pitch = (int)( ( width + xpixels + 7 ) >> 3 ); + new_pitch = ( width + xpixels + 7 ) >> 3; break; case FT_PIXEL_MODE_GRAY2: bpp = 2; - new_pitch = (int)( ( width + xpixels + 3 ) >> 2 ); + new_pitch = ( width + xpixels + 3 ) >> 2; break; case FT_PIXEL_MODE_GRAY4: bpp = 4; - new_pitch = (int)( ( width + xpixels + 1 ) >> 1 ); + new_pitch = ( width + xpixels + 1 ) >> 1; break; case FT_PIXEL_MODE_GRAY: case FT_PIXEL_MODE_LCD: case FT_PIXEL_MODE_LCD_V: bpp = 8; - new_pitch = (int)( width + xpixels ); + new_pitch = width + xpixels; break; default: return FT_THROW( Invalid_Glyph_Format ); @@ -194,7 +192,7 @@ if ( ypixels == 0 && new_pitch <= pitch ) { /* zero the padding */ - FT_UInt bit_width = (FT_UInt)pitch * 8; + FT_UInt bit_width = pitch * 8; FT_UInt bit_last = ( width + xpixels ) * bpp; @@ -239,7 +237,7 @@ unsigned char* out = buffer; unsigned char* limit = bitmap->buffer + pitch * bitmap->rows; - int delta = new_pitch - pitch; + unsigned int delta = new_pitch - pitch; FT_MEM_ZERO( out, new_pitch * ypixels ); @@ -263,7 +261,7 @@ unsigned char* out = buffer; unsigned char* limit = bitmap->buffer + pitch * bitmap->rows; - int delta = new_pitch - pitch; + unsigned int delta = new_pitch - pitch; while ( in < limit ) @@ -282,11 +280,11 @@ FT_FREE( bitmap->buffer ); bitmap->buffer = buffer; - if ( bitmap->pitch < 0 ) - new_pitch = -new_pitch; - /* set pitch only, width and height are left untouched */ - bitmap->pitch = new_pitch; + if ( bitmap->pitch < 0 ) + bitmap->pitch = -(int)new_pitch; + else + bitmap->pitch = (int)new_pitch; return FT_Err_Ok; } diff --git a/src/base/ftpsprop.c b/src/base/ftpsprop.c index 790127bb1..1eace3eb6 100644 --- a/src/base/ftpsprop.c +++ b/src/base/ftpsprop.c @@ -22,6 +22,7 @@ #include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_POSTSCRIPT_AUX_H #include FT_INTERNAL_OBJECTS_H +#include FT_INTERNAL_POSTSCRIPT_PROPS_H /*************************************************************************/ From 4f983ab9d02d1a8db6ae8dc5a84c4a507a7c572e Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Thu, 28 Dec 2017 21:55:01 +0100 Subject: [PATCH 384/470] * builds/unix/ftconfig.in: Synchronize with main `ftconfig.h' file. Reported by Nikolaus. --- ChangeLog | 6 ++++ builds/unix/ftconfig.in | 63 ++++++++++++++++++++++++++++++++++++++++- 2 files changed, 68 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index b01d7cf62..c505b66fd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2017-12-28 Werner Lemberg + + * builds/unix/ftconfig.in: Synchronize with main `ftconfig.h' file. + + Reported by Nikolaus. + 2017-12-27 Werner Lemberg Fix compiler warnings. diff --git a/builds/unix/ftconfig.in b/builds/unix/ftconfig.in index abd101de9..711b63a42 100644 --- a/builds/unix/ftconfig.in +++ b/builds/unix/ftconfig.in @@ -397,6 +397,14 @@ FT_BEGIN_HEADER #endif + /* Use FT_LOCAL and FT_LOCAL_DEF to declare and define, respectively, */ + /* a function that gets used only within the scope of a module. */ + /* Normally, both the header and source code files for such a */ + /* function are within a single module directory. */ + /* */ + /* Intra-module arrays should be tagged with FT_LOCAL_ARRAY and */ + /* FT_LOCAL_ARRAY_DEF. */ + /* */ #ifdef FT_MAKE_OPTION_SINGLE_OBJECT #define FT_LOCAL( x ) static x @@ -418,6 +426,12 @@ FT_BEGIN_HEADER #define FT_LOCAL_ARRAY_DEF( x ) const x + /* Use FT_BASE and FT_BASE_DEF to declare and define, respectively, */ + /* functions that are used in more than a single module. In the */ + /* current setup this implies that the declaration is in a header */ + /* file in the `include/freetype/internal' directory, and the */ + /* function body is in a file in `src/base'. */ + /* */ #ifndef FT_BASE #ifdef __cplusplus @@ -440,6 +454,37 @@ FT_BEGIN_HEADER #endif /* !FT_BASE_DEF */ + /* When compiling FreeType as a DLL, some systems/compilers need a */ + /* special attribute in front OR after the return type of function */ + /* declarations. */ + /* */ + /* Two macros are used within the FreeType source code to define */ + /* exported library functions: FT_EXPORT and FT_EXPORT_DEF. */ + /* */ + /* FT_EXPORT( return_type ) */ + /* */ + /* is used in a function declaration, as in */ + /* */ + /* FT_EXPORT( FT_Error ) */ + /* FT_Init_FreeType( FT_Library* alibrary ); */ + /* */ + /* */ + /* FT_EXPORT_DEF( return_type ) */ + /* */ + /* is used in a function definition, as in */ + /* */ + /* FT_EXPORT_DEF( FT_Error ) */ + /* FT_Init_FreeType( FT_Library* alibrary ) */ + /* { */ + /* ... some code ... */ + /* return FT_Err_Ok; */ + /* } */ + /* */ + /* You can provide your own implementation of FT_EXPORT and */ + /* FT_EXPORT_DEF here if you want. */ + /* */ + /* To export a variable, use FT_EXPORT_VAR. */ + /* */ #ifndef FT_EXPORT #ifdef __cplusplus @@ -483,7 +528,13 @@ FT_BEGIN_HEADER /* functions which are accessed by (global) function pointers. */ /* */ /* */ - /* FT_CALLBACK_DEF is used to _define_ a callback function. */ + /* FT_CALLBACK_DEF is used to _define_ a callback function, */ + /* located in the same source code file as the structure that uses */ + /* it. */ + /* */ + /* FT_BASE_CALLBACK and FT_BASE_CALLBACK_DEF are used to declare */ + /* and define a callback function, respectively, in a similar way */ + /* as FT_BASE and FT_BASE_DEF work. */ /* */ /* FT_CALLBACK_TABLE is used to _declare_ a constant variable that */ /* contains pointers to callback functions. */ @@ -503,6 +554,16 @@ FT_BEGIN_HEADER #endif #endif /* FT_CALLBACK_DEF */ +#ifndef FT_BASE_CALLBACK +#ifdef __cplusplus +#define FT_BASE_CALLBACK( x ) extern "C" x +#define FT_BASE_CALLBACK_DEF( x ) extern "C" x +#else +#define FT_BASE_CALLBACK( x ) extern x +#define FT_BASE_CALLBACK_DEF( x ) x +#endif +#endif /* FT_BASE_CALLBACK */ + #ifndef FT_CALLBACK_TABLE #ifdef __cplusplus #define FT_CALLBACK_TABLE extern "C" From ff5c9928bd1b2f3abfee838828568b06bf9739c6 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sat, 30 Dec 2017 01:46:52 +0100 Subject: [PATCH 385/470] * builds/vms/ftconfig.h: Synchronize with unix `ftconfig.in' file. --- ChangeLog | 4 ++ builds/vms/ftconfig.h | 90 ++++++++++++++++++++++++++++++++++++++----- 2 files changed, 85 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index c505b66fd..ec4da769e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2017-12-30 Werner Lemberg + + * builds/vms/ftconfig.h: Synchronize with unix `ftconfig.in' file. + 2017-12-28 Werner Lemberg * builds/unix/ftconfig.in: Synchronize with main `ftconfig.h' file. diff --git a/builds/vms/ftconfig.h b/builds/vms/ftconfig.h index f8ac2ecbe..0f4c613a5 100644 --- a/builds/vms/ftconfig.h +++ b/builds/vms/ftconfig.h @@ -33,6 +33,7 @@ /* */ /*************************************************************************/ + #ifndef FTCONFIG_H_ #define FTCONFIG_H_ @@ -209,12 +210,12 @@ FT_BEGIN_HEADER #endif -#if FT_SIZEOF_INT == (32 / FT_CHAR_BIT) +#if FT_SIZEOF_INT == 4 typedef signed int FT_Int32; typedef unsigned int FT_UInt32; -#elif FT_SIZEOF_LONG == (32 / FT_CHAR_BIT) +#elif FT_SIZEOF_LONG == 4 typedef signed long FT_Int32; typedef unsigned long FT_UInt32; @@ -225,12 +226,12 @@ FT_BEGIN_HEADER /* look up an integer type that is at least 32 bits */ -#if FT_SIZEOF_INT >= (32 / FT_CHAR_BIT) +#if FT_SIZEOF_INT >= 4 typedef int FT_Fast; typedef unsigned int FT_UFast; -#elif FT_SIZEOF_LONG >= (32 / FT_CHAR_BIT) +#elif FT_SIZEOF_LONG >= 4 typedef long FT_Fast; typedef unsigned long FT_UFast; @@ -238,15 +239,25 @@ FT_BEGIN_HEADER #endif - /* determine whether we have a 64-bit int type for platforms without */ - /* Autoconf */ -#if FT_SIZEOF_LONG == (64 / FT_CHAR_BIT) + /* determine whether we have a 64-bit int type */ + /* (mostly for environments without `autoconf') */ +#if FT_SIZEOF_LONG == 8 /* FT_LONG64 must be defined if a 64-bit type is available */ #define FT_LONG64 #define FT_INT64 long #define FT_UINT64 unsigned long + /* we handle the LLP64 scheme separately for GCC and clang, */ + /* suppressing the `long long' warning */ +#elif ( FT_SIZEOF_LONG == 4 ) && \ + defined( HAVE_LONG_LONG_INT ) && \ + defined( __GNUC__ ) +#pragma GCC diagnostic ignored "-Wlong-long" +#define FT_LONG64 +#define FT_INT64 long long int +#define FT_UINT64 unsigned long long int + /*************************************************************************/ /* */ /* A 64-bit data type may create compilation problems if you compile */ @@ -298,7 +309,7 @@ FT_BEGIN_HEADER #endif /* __STDC_VERSION__ >= 199901L */ -#endif /* FT_SIZEOF_LONG == (64 / FT_CHAR_BIT) */ +#endif /* FT_SIZEOF_LONG == 8 */ #ifdef FT_LONG64 typedef FT_INT64 FT_Int64; @@ -338,6 +349,14 @@ FT_BEGIN_HEADER #endif + /* Use FT_LOCAL and FT_LOCAL_DEF to declare and define, respectively, */ + /* a function that gets used only within the scope of a module. */ + /* Normally, both the header and source code files for such a */ + /* function are within a single module directory. */ + /* */ + /* Intra-module arrays should be tagged with FT_LOCAL_ARRAY and */ + /* FT_LOCAL_ARRAY_DEF. */ + /* */ #ifdef FT_MAKE_OPTION_SINGLE_OBJECT #define FT_LOCAL( x ) static x @@ -359,6 +378,12 @@ FT_BEGIN_HEADER #define FT_LOCAL_ARRAY_DEF( x ) const x + /* Use FT_BASE and FT_BASE_DEF to declare and define, respectively, */ + /* functions that are used in more than a single module. In the */ + /* current setup this implies that the declaration is in a header */ + /* file in the `include/freetype/internal' directory, and the */ + /* function body is in a file in `src/base'. */ + /* */ #ifndef FT_BASE #ifdef __cplusplus @@ -381,6 +406,37 @@ FT_BEGIN_HEADER #endif /* !FT_BASE_DEF */ + /* When compiling FreeType as a DLL, some systems/compilers need a */ + /* special attribute in front OR after the return type of function */ + /* declarations. */ + /* */ + /* Two macros are used within the FreeType source code to define */ + /* exported library functions: FT_EXPORT and FT_EXPORT_DEF. */ + /* */ + /* FT_EXPORT( return_type ) */ + /* */ + /* is used in a function declaration, as in */ + /* */ + /* FT_EXPORT( FT_Error ) */ + /* FT_Init_FreeType( FT_Library* alibrary ); */ + /* */ + /* */ + /* FT_EXPORT_DEF( return_type ) */ + /* */ + /* is used in a function definition, as in */ + /* */ + /* FT_EXPORT_DEF( FT_Error ) */ + /* FT_Init_FreeType( FT_Library* alibrary ) */ + /* { */ + /* ... some code ... */ + /* return FT_Err_Ok; */ + /* } */ + /* */ + /* You can provide your own implementation of FT_EXPORT and */ + /* FT_EXPORT_DEF here if you want. */ + /* */ + /* To export a variable, use FT_EXPORT_VAR. */ + /* */ #ifndef FT_EXPORT #ifdef __cplusplus @@ -424,7 +480,13 @@ FT_BEGIN_HEADER /* functions which are accessed by (global) function pointers. */ /* */ /* */ - /* FT_CALLBACK_DEF is used to _define_ a callback function. */ + /* FT_CALLBACK_DEF is used to _define_ a callback function, */ + /* located in the same source code file as the structure that uses */ + /* it. */ + /* */ + /* FT_BASE_CALLBACK and FT_BASE_CALLBACK_DEF are used to declare */ + /* and define a callback function, respectively, in a similar way */ + /* as FT_BASE and FT_BASE_DEF work. */ /* */ /* FT_CALLBACK_TABLE is used to _declare_ a constant variable that */ /* contains pointers to callback functions. */ @@ -444,6 +506,16 @@ FT_BEGIN_HEADER #endif #endif /* FT_CALLBACK_DEF */ +#ifndef FT_BASE_CALLBACK +#ifdef __cplusplus +#define FT_BASE_CALLBACK( x ) extern "C" x +#define FT_BASE_CALLBACK_DEF( x ) extern "C" x +#else +#define FT_BASE_CALLBACK( x ) extern x +#define FT_BASE_CALLBACK_DEF( x ) x +#endif +#endif /* FT_BASE_CALLBACK */ + #ifndef FT_CALLBACK_TABLE #ifdef __cplusplus #define FT_CALLBACK_TABLE extern "C" From 8470cee8aa2e582e4cad3d3e6c0f7a18bdfdb87c Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sat, 30 Dec 2017 20:50:50 +0100 Subject: [PATCH 386/470] Updated `CHANGES' file. --- docs/CHANGES | 74 +++++++++++++++++++++++++++++++++++++ docs/formats.txt | 4 +- include/freetype/ftdriver.h | 6 +++ 3 files changed, 82 insertions(+), 2 deletions(-) diff --git a/docs/CHANGES b/docs/CHANGES index a9e450f9d..4f8b9d48f 100644 --- a/docs/CHANGES +++ b/docs/CHANGES @@ -1,4 +1,78 @@ +CHANGES BETWEEN 2.8.1 and 2.8.2 + + I. IMPORTANT BUG FIXES + + - Advance width values of variation fonts were often wrong. + + - More fixes for variation font support; you should update to this + version if you want to support them. + + + II. IMPORTANT CHANGES + + - As a GSoC project, Ewald Hew extended the new (Adobe) CFF engine + to handle Type 1 fonts also, thus greatly improving the + rendering of this format. This is the new default. The old + engine is still available if the configuration macro + `T1_CONFIG_OPTION_OLD_ENGINE' gets defined; using the + `hinting-engine' property of the `type1' driver module you can + then switch between the two engines. + + - A new function, `FT_Set_Named_Instance', can be used to set or + change the current named instance. + + - Starting with this FreeType version, resetting variation + coordinates will return to the currently selected named + instance. Previously, FreeType returned to the base font (i.e., + no instance set). + + + III. MISCELLANEOUS + + - The `face_flags' field of the `FT_Face' structure has a new bit, + `FT_FACE_FLAG_VARIATION', which is set if a variation font has + been altered with `FT_Set_MM_Design_Coordinates', + `FT_Set_Var_Design_Coordinates', or + `FT_Set_Var_Blend_Coordinates'. + + - If the current face is a named instance, the new macro + `FT_IS_NAMED_INSTANCE' returns true. + + - `FT_IS_VARIATION' is a new macro that returns true whenever a + face object has been altered by `FT_Set_MM_Design_Coordinates', + `FT_Set_Var_Design_Coordinates', or + `FT_Set_Var_Blend_Coordinates'. + + - Changing the design coordinates of a variation font with + `FT_Set_Var_Design_Coordinates' or + `FT_Set_Var_Blend_Coordinates' does not influence the named + instance index value (only `FT_Set_Named_Instance' does that). + + - Special PostScript names for named instances are only returned + if the named instance is set with `FT_Set_Named_Instance' (and + the font has corresponding entries in its `fvar' table). If + `FT_IS_VARIATION' returns true, the algorithmically derived + PostScript name is provided, not looking up special entries for + named instances. + + - On platforms using the `configure' script, the installed + `ftoption.h' file now correctly reflects configuration options + like `--with-harfbuzz'. + + - Better support to build FreeType as a DLL on Windows using + Visual C. + + - All data specific to driver modules is now collected in a single + file, `FT_DRIVER_H'. Consequently, the macros + `FT_AUTOHINTER_H', `FT_CFF_DRIVER_H', `FT_TRUETYPE_DRIVER_H', + and `FT_PCF_DRIVER_H' still work but are deprecated. + + - Some fuzzer fixes to better reject malformed fonts. + + +====================================================================== + CHANGES BETWEEN 2.8 and 2.8.1 I. IMPORTANT BUG FIXES diff --git a/docs/formats.txt b/docs/formats.txt index 23550a82f..4461e3870 100644 --- a/docs/formats.txt +++ b/docs/formats.txt @@ -155,8 +155,8 @@ which isn't supported yet please send a mail too. [1] Support should be rather simple since this is identical to `CFF' but in a PS wrapper. -[2] Official PFR specification is no longer available, but archive.org - has arvchived it: +[2] The official PFR specification is no longer available, but + archive.org has archived it: https://web.archive.org/web/20091014062300/http://www.bitstream.com/font_rendering/products/truedoc/pfrspec.html https://web.archive.org/web/20081115152605/http://www.bitstream.com/font_rendering/pdfs/pfrspec1.3.pdf diff --git a/include/freetype/ftdriver.h b/include/freetype/ftdriver.h index 063ceec31..03fc0a18e 100644 --- a/include/freetype/ftdriver.h +++ b/include/freetype/ftdriver.h @@ -1096,6 +1096,9 @@ FT_BEGIN_HEADER * an @FT_Face structure but not loaded any glyph (using the * auto-hinter), a change of the default script will affect this face. * + * @since: + * 2.5.3 + * */ @@ -1204,6 +1207,9 @@ FT_BEGIN_HEADER * change its value before rendering any face. Otherwise, you should * reload all faces that get auto-hinted in `normal' hinting mode. * + * @since: + * 2.6 + * */ From 7f82c6db84cde06dc9561c70a14823461acc6e2b Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sun, 31 Dec 2017 08:00:16 +0100 Subject: [PATCH 387/470] Update Visual C 2010 project files. Problem reported by Hin-Tak. * builds/windows/vc2010/freetype.vcxproj: Add files `ftbdf.c' and `ftcid.c'. Sort entries. * builds/windows/vc2010/freetype.vcxproj.filter: Ditto. Fix members of `FT_MODULE' group. --- ChangeLog | 12 +++ builds/windows/vc2010/freetype.vcxproj | 32 +++---- .../windows/vc2010/freetype.vcxproj.filters | 88 ++++++++++--------- 3 files changed, 76 insertions(+), 56 deletions(-) diff --git a/ChangeLog b/ChangeLog index ec4da769e..56309c9f2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2017-12-31 Werner Lemberg + + Update Visual C 2010 project files. + + Problem reported by Hin-Tak. + + * builds/windows/vc2010/freetype.vcxproj: Add files `ftbdf.c' and + `ftcid.c'. + Sort entries. + * builds/windows/vc2010/freetype.vcxproj.filter: Ditto. + Fix members of `FT_MODULE' group. + 2017-12-30 Werner Lemberg * builds/vms/ftconfig.h: Synchronize with unix `ftconfig.in' file. diff --git a/builds/windows/vc2010/freetype.vcxproj b/builds/windows/vc2010/freetype.vcxproj index 9e9368918..8eb5b9a83 100644 --- a/builds/windows/vc2010/freetype.vcxproj +++ b/builds/windows/vc2010/freetype.vcxproj @@ -393,31 +393,33 @@ - - + + - + + - + - - - - - - + + + + + - - - - + + + + + + @@ -425,9 +427,9 @@ + - diff --git a/builds/windows/vc2010/freetype.vcxproj.filters b/builds/windows/vc2010/freetype.vcxproj.filters index 0e947f4ba..0be176b57 100644 --- a/builds/windows/vc2010/freetype.vcxproj.filters +++ b/builds/windows/vc2010/freetype.vcxproj.filters @@ -17,118 +17,124 @@ Source Files - + Source Files - + Source Files - + Source Files - + Source Files Source Files - + Source Files - + Source Files - + Source Files - + Source Files - + Source Files - + Source Files - + Source Files - + Source Files - + + Source Files + + + Source Files + + Source Files Source Files - - Source Files\FT_MODULES + + Source Files - - Source Files\FT_MODULES + + Source Files - - Source Files\FT_MODULES + + Source Files - - Source Files\FT_MODULES + + Source Files - - Source Files\FT_MODULES + + Source Files - + Source Files\FT_MODULES - + Source Files\FT_MODULES - + Source Files\FT_MODULES - + Source Files\FT_MODULES - + Source Files\FT_MODULES - + Source Files\FT_MODULES - + Source Files\FT_MODULES - + Source Files\FT_MODULES - + Source Files\FT_MODULES - + Source Files\FT_MODULES - + Source Files\FT_MODULES - + Source Files\FT_MODULES - + Source Files\FT_MODULES - + Source Files\FT_MODULES - + Source Files\FT_MODULES - + Source Files\FT_MODULES - + Source Files\FT_MODULES - + Source Files\FT_MODULES From 0268bf35f0d0e773317824648350f04249eb89c7 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sun, 31 Dec 2017 08:21:08 +0100 Subject: [PATCH 388/470] Synchronize other Windows project files. * builds/windows/*: Add missing files. --- ChangeLog | 6 ++++++ builds/windows/vc2005/freetype.vcproj | 4 ++++ builds/windows/vc2008/freetype.vcproj | 8 ++++++++ builds/windows/visualc/freetype.dsp | 12 ++++++++++++ builds/windows/visualc/freetype.vcproj | 8 ++++++++ builds/windows/visualce/freetype.dsp | 12 ++++++++++++ builds/windows/visualce/freetype.vcproj | 8 ++++++++ 7 files changed, 58 insertions(+) diff --git a/ChangeLog b/ChangeLog index 56309c9f2..5942a16ce 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2017-12-31 Werner Lemberg + + Synchronize other Windows project files. + + * builds/windows/*: Add missing files. + 2017-12-31 Werner Lemberg Update Visual C 2010 project files. diff --git a/builds/windows/vc2005/freetype.vcproj b/builds/windows/vc2005/freetype.vcproj index 099c527b2..d5de15249 100644 --- a/builds/windows/vc2005/freetype.vcproj +++ b/builds/windows/vc2005/freetype.vcproj @@ -344,8 +344,12 @@ + + + + diff --git a/builds/windows/vc2008/freetype.vcproj b/builds/windows/vc2008/freetype.vcproj index 5b505dab9..2a92ac36e 100644 --- a/builds/windows/vc2008/freetype.vcproj +++ b/builds/windows/vc2008/freetype.vcproj @@ -1236,6 +1236,14 @@ RelativePath="..\..\..\src\base\ftbbox.c" > + + + + diff --git a/builds/windows/visualc/freetype.dsp b/builds/windows/visualc/freetype.dsp index 1a613128f..c14ce11f5 100644 --- a/builds/windows/visualc/freetype.dsp +++ b/builds/windows/visualc/freetype.dsp @@ -226,10 +226,22 @@ SOURCE=..\..\..\src\base\ftbitmap.c # End Source File # Begin Source File +SOURCE=..\..\..\src\base\ftcid.c +# End Source File +# Begin Source File + SOURCE=..\..\..\src\base\ftfntfmt.c # End Source File # Begin Source File +SOURCE=..\..\..\src\base\ftlcdfil.c +# End Source File +# Begin Source File + +SOURCE=..\..\..\src\base\ftpatent.c +# End Source File +# Begin Source File + SOURCE=..\..\..\src\base\ftfstype.c # End Source File # Begin Source File diff --git a/builds/windows/visualc/freetype.vcproj b/builds/windows/visualc/freetype.vcproj index 67b147e47..1533e6029 100644 --- a/builds/windows/visualc/freetype.vcproj +++ b/builds/windows/visualc/freetype.vcproj @@ -1235,6 +1235,14 @@ RelativePath="..\..\..\src\base\ftbbox.c" > + + + + diff --git a/builds/windows/visualce/freetype.dsp b/builds/windows/visualce/freetype.dsp index 1a613128f..4e77f5fd8 100644 --- a/builds/windows/visualce/freetype.dsp +++ b/builds/windows/visualce/freetype.dsp @@ -226,6 +226,10 @@ SOURCE=..\..\..\src\base\ftbitmap.c # End Source File # Begin Source File +SOURCE=..\..\..\src\base\ftcid.c +# End Source File +# Begin Source File + SOURCE=..\..\..\src\base\ftfntfmt.c # End Source File # Begin Source File @@ -267,6 +271,10 @@ SOURCE=..\..\..\src\base\ftinit.c # End Source File # Begin Source File +SOURCE=..\..\..\src\base\ftlcdfil.c +# End Source File +# Begin Source File + SOURCE=..\..\..\src\lzw\ftlzw.c # End Source File # Begin Source File @@ -280,6 +288,10 @@ SOURCE=..\..\..\src\base\ftotval.c # End Source File # Begin Source File +SOURCE=..\..\..\src\base\ftpatent.c +# End Source File +# Begin Source File + SOURCE=..\..\..\src\base\ftpfr.c # End Source File # Begin Source File diff --git a/builds/windows/visualce/freetype.vcproj b/builds/windows/visualce/freetype.vcproj index 90084b40b..d29763530 100644 --- a/builds/windows/visualce/freetype.vcproj +++ b/builds/windows/visualce/freetype.vcproj @@ -8261,6 +8261,14 @@ RelativePath="..\..\..\src\base\ftbbox.c" > + + + + From 3f090c6843dea837d1054e994e9ba18fefb75a62 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sun, 31 Dec 2017 10:32:08 +0100 Subject: [PATCH 389/470] * src/sfnt/ttcmap.c (tt_cmap2_char_next): Fix endless loop. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=4838 --- ChangeLog | 8 ++++++++ src/sfnt/ttcmap.c | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/ChangeLog b/ChangeLog index 5942a16ce..74351bcd4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2017-12-31 Werner Lemberg + + * src/sfnt/ttcmap.c (tt_cmap2_char_next): Fix endless loop. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=4838 + 2017-12-31 Werner Lemberg Synchronize other Windows project files. diff --git a/src/sfnt/ttcmap.c b/src/sfnt/ttcmap.c index f6c02f907..45414d1ae 100644 --- a/src/sfnt/ttcmap.c +++ b/src/sfnt/ttcmap.c @@ -518,7 +518,11 @@ if ( offset == 0 ) + { + if ( charcode == 0x100 ) + goto Exit; /* this happens only for a malformed cmap */ goto Next_SubHeader; + } if ( char_lo < start ) { From a9a5aa573e8f7e13e1ec6cadf54c18b018ff8e02 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sun, 31 Dec 2017 11:16:36 +0100 Subject: [PATCH 390/470] Update `CHANGES' file with demo program news. --- docs/CHANGES | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/docs/CHANGES b/docs/CHANGES index 4f8b9d48f..d990ee14b 100644 --- a/docs/CHANGES +++ b/docs/CHANGES @@ -70,6 +70,18 @@ CHANGES BETWEEN 2.8.1 and 2.8.2 - Some fuzzer fixes to better reject malformed fonts. + - The `ftbench' demo program has a new test for opening a new face + and loading some glyphs. + + - The `ftbench' demo program has a new option `-j' to specify the + last glyph index to be used in the tests. + + - The `ftgrid' demo program has a new option `-n' to suppress + display of named instances of variation fonts. + + - The `ttdebug' demo program can now show a stack trace (key `K') + and switch between hexadecimal and decimal display of integers + (key `I'). ====================================================================== From 0a0c22569deab933df21127e75db5c81f724f292 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Tue, 2 Jan 2018 09:33:57 +0100 Subject: [PATCH 391/470] Update copyright year. --- CMakeLists.txt | 2 +- ChangeLog | 2 +- ChangeLog.20 | 2 +- ChangeLog.21 | 2 +- ChangeLog.22 | 2 +- ChangeLog.23 | 2 +- ChangeLog.24 | 2 +- ChangeLog.25 | 2 +- ChangeLog.26 | 2 +- ChangeLog.27 | 2 +- Jamfile | 2 +- Jamrules | 2 +- Makefile | 2 +- README | 2 +- README.git | 2 +- autogen.sh | 2 +- builds/amiga/README | 2 +- builds/amiga/include/config/ftconfig.h | 2 +- builds/amiga/include/config/ftmodule.h | 2 +- builds/amiga/makefile | 2 +- builds/amiga/makefile.os4 | 2 +- builds/amiga/smakefile | 2 +- builds/amiga/src/base/ftdebug.c | 2 +- builds/amiga/src/base/ftsystem.c | 2 +- builds/ansi/ansi-def.mk | 2 +- builds/ansi/ansi.mk | 2 +- builds/beos/beos-def.mk | 2 +- builds/beos/beos.mk | 2 +- builds/beos/detect.mk | 2 +- builds/cmake/iOS.cmake | 2 +- builds/cmake/testbuild.sh | 2 +- builds/compiler/ansi-cc.mk | 2 +- builds/compiler/bcc-dev.mk | 2 +- builds/compiler/bcc.mk | 2 +- builds/compiler/emx.mk | 2 +- builds/compiler/gcc-dev.mk | 2 +- builds/compiler/gcc.mk | 2 +- builds/compiler/intelc.mk | 2 +- builds/compiler/unix-lcc.mk | 2 +- builds/compiler/visualage.mk | 2 +- builds/compiler/visualc.mk | 2 +- builds/compiler/watcom.mk | 2 +- builds/compiler/win-lcc.mk | 2 +- builds/detect.mk | 2 +- builds/dos/detect.mk | 2 +- builds/dos/dos-def.mk | 2 +- builds/dos/dos-emx.mk | 2 +- builds/dos/dos-gcc.mk | 2 +- builds/dos/dos-wat.mk | 2 +- builds/exports.mk | 2 +- builds/freetype.mk | 2 +- builds/link_dos.mk | 2 +- builds/link_std.mk | 2 +- builds/mac/ftmac.c | 2 +- builds/modules.mk | 2 +- builds/os2/detect.mk | 2 +- builds/os2/os2-def.mk | 2 +- builds/os2/os2-dev.mk | 2 +- builds/os2/os2-gcc.mk | 2 +- builds/symbian/bld.inf | 2 +- builds/symbian/freetype.mmp | 2 +- builds/toplevel.mk | 2 +- builds/unix/configure.raw | 2 +- builds/unix/detect.mk | 2 +- builds/unix/freetype-config.in | 2 +- builds/unix/freetype2.m4 | 2 +- builds/unix/ft-munmap.m4 | 2 +- builds/unix/ftconfig.in | 2 +- builds/unix/ftsystem.c | 2 +- builds/unix/install.mk | 2 +- builds/unix/unix-cc.in | 2 +- builds/unix/unix-def.in | 2 +- builds/unix/unix-dev.mk | 2 +- builds/unix/unix-lcc.mk | 2 +- builds/unix/unix.mk | 2 +- builds/unix/unixddef.mk | 2 +- builds/vms/ftconfig.h | 2 +- builds/vms/ftsystem.c | 2 +- builds/wince/ftdebug.c | 2 +- builds/windows/detect.mk | 2 +- builds/windows/ftdebug.c | 2 +- builds/windows/w32-bcc.mk | 2 +- builds/windows/w32-bccd.mk | 2 +- builds/windows/w32-dev.mk | 2 +- builds/windows/w32-gcc.mk | 2 +- builds/windows/w32-icc.mk | 2 +- builds/windows/w32-intl.mk | 2 +- builds/windows/w32-lcc.mk | 2 +- builds/windows/w32-mingw32.mk | 2 +- builds/windows/w32-vcc.mk | 2 +- builds/windows/w32-wat.mk | 2 +- builds/windows/win32-def.mk | 2 +- configure | 2 +- devel/ft2build.h | 2 +- devel/ftoption.h | 2 +- docs/CHANGES | 2 +- docs/CUSTOMIZE | 2 +- docs/DEBUG | 2 +- docs/INSTALL | 2 +- docs/INSTALL.ANY | 2 +- docs/INSTALL.CROSS | 2 +- docs/INSTALL.GNU | 2 +- docs/INSTALL.UNIX | 2 +- docs/INSTALL.VMS | 2 +- docs/TODO | 2 +- docs/VERSIONS.TXT | 2 +- docs/formats.txt | 2 +- docs/raster.txt | 2 +- docs/release | 2 +- include/freetype/config/ftconfig.h | 2 +- include/freetype/config/ftheader.h | 2 +- include/freetype/config/ftoption.h | 2 +- include/freetype/config/ftstdlib.h | 2 +- include/freetype/freetype.h | 2 +- include/freetype/ftadvanc.h | 2 +- include/freetype/ftbbox.h | 2 +- include/freetype/ftbdf.h | 2 +- include/freetype/ftbitmap.h | 2 +- include/freetype/ftbzip2.h | 2 +- include/freetype/ftcache.h | 2 +- include/freetype/ftcid.h | 2 +- include/freetype/ftdriver.h | 2 +- include/freetype/fterrdef.h | 2 +- include/freetype/fterrors.h | 2 +- include/freetype/ftfntfmt.h | 2 +- include/freetype/ftgasp.h | 2 +- include/freetype/ftglyph.h | 2 +- include/freetype/ftgxval.h | 2 +- include/freetype/ftgzip.h | 2 +- include/freetype/ftimage.h | 2 +- include/freetype/ftincrem.h | 2 +- include/freetype/ftlcdfil.h | 2 +- include/freetype/ftlist.h | 2 +- include/freetype/ftlzw.h | 2 +- include/freetype/ftmac.h | 2 +- include/freetype/ftmm.h | 2 +- include/freetype/ftmodapi.h | 2 +- include/freetype/ftmoderr.h | 2 +- include/freetype/ftotval.h | 2 +- include/freetype/ftoutln.h | 2 +- include/freetype/ftparams.h | 2 +- include/freetype/ftpfr.h | 2 +- include/freetype/ftrender.h | 2 +- include/freetype/ftsizes.h | 2 +- include/freetype/ftsnames.h | 2 +- include/freetype/ftstroke.h | 2 +- include/freetype/ftsynth.h | 2 +- include/freetype/ftsystem.h | 2 +- include/freetype/fttrigon.h | 2 +- include/freetype/fttypes.h | 2 +- include/freetype/ftwinfnt.h | 2 +- include/freetype/internal/autohint.h | 2 +- include/freetype/internal/cffotypes.h | 2 +- include/freetype/internal/cfftypes.h | 2 +- include/freetype/internal/ftcalc.h | 2 +- include/freetype/internal/ftdebug.h | 2 +- include/freetype/internal/ftdrv.h | 2 +- include/freetype/internal/ftgloadr.h | 2 +- include/freetype/internal/ftmemory.h | 2 +- include/freetype/internal/ftobjs.h | 2 +- include/freetype/internal/ftpic.h | 2 +- include/freetype/internal/ftpsprop.h | 2 +- include/freetype/internal/ftrfork.h | 2 +- include/freetype/internal/ftserv.h | 2 +- include/freetype/internal/ftstream.h | 2 +- include/freetype/internal/fttrace.h | 2 +- include/freetype/internal/ftvalid.h | 2 +- include/freetype/internal/internal.h | 2 +- include/freetype/internal/psaux.h | 2 +- include/freetype/internal/pshints.h | 2 +- include/freetype/internal/services/svbdf.h | 2 +- include/freetype/internal/services/svcfftl.h | 2 +- include/freetype/internal/services/svcid.h | 2 +- include/freetype/internal/services/svfntfmt.h | 2 +- include/freetype/internal/services/svgldict.h | 2 +- include/freetype/internal/services/svgxval.h | 2 +- include/freetype/internal/services/svkern.h | 2 +- include/freetype/internal/services/svmetric.h | 2 +- include/freetype/internal/services/svmm.h | 2 +- include/freetype/internal/services/svotval.h | 2 +- include/freetype/internal/services/svpfr.h | 2 +- include/freetype/internal/services/svpostnm.h | 2 +- include/freetype/internal/services/svprop.h | 2 +- include/freetype/internal/services/svpscmap.h | 2 +- include/freetype/internal/services/svpsinfo.h | 2 +- include/freetype/internal/services/svsfnt.h | 2 +- include/freetype/internal/services/svttcmap.h | 2 +- include/freetype/internal/services/svtteng.h | 2 +- include/freetype/internal/services/svttglyf.h | 2 +- include/freetype/internal/services/svwinfnt.h | 2 +- include/freetype/internal/sfnt.h | 2 +- include/freetype/internal/t1types.h | 2 +- include/freetype/internal/tttypes.h | 2 +- include/freetype/t1tables.h | 2 +- include/freetype/ttnameid.h | 2 +- include/freetype/tttables.h | 2 +- include/freetype/tttags.h | 2 +- include/ft2build.h | 2 +- modules.cfg | 2 +- src/Jamfile | 2 +- src/autofit/Jamfile | 2 +- src/autofit/afangles.c | 2 +- src/autofit/afblue.c | 2 +- src/autofit/afblue.cin | 2 +- src/autofit/afblue.dat | 2 +- src/autofit/afblue.h | 2 +- src/autofit/afblue.hin | 2 +- src/autofit/afcjk.c | 2 +- src/autofit/afcjk.h | 2 +- src/autofit/afcover.h | 2 +- src/autofit/afdummy.c | 2 +- src/autofit/afdummy.h | 2 +- src/autofit/aferrors.h | 2 +- src/autofit/afglobal.c | 2 +- src/autofit/afglobal.h | 2 +- src/autofit/afhints.c | 2 +- src/autofit/afhints.h | 2 +- src/autofit/afindic.c | 2 +- src/autofit/afindic.h | 2 +- src/autofit/aflatin.c | 2 +- src/autofit/aflatin.h | 2 +- src/autofit/aflatin2.c | 2 +- src/autofit/aflatin2.h | 2 +- src/autofit/afloader.c | 2 +- src/autofit/afloader.h | 2 +- src/autofit/afmodule.c | 2 +- src/autofit/afmodule.h | 2 +- src/autofit/afpic.c | 2 +- src/autofit/afpic.h | 2 +- src/autofit/afranges.c | 2 +- src/autofit/afranges.h | 2 +- src/autofit/afscript.h | 2 +- src/autofit/afshaper.c | 2 +- src/autofit/afshaper.h | 2 +- src/autofit/afstyles.h | 2 +- src/autofit/aftypes.h | 2 +- src/autofit/afwarp.c | 2 +- src/autofit/afwarp.h | 2 +- src/autofit/afwrtsys.h | 2 +- src/autofit/autofit.c | 2 +- src/autofit/module.mk | 2 +- src/autofit/rules.mk | 2 +- src/base/Jamfile | 2 +- src/base/basepic.c | 2 +- src/base/basepic.h | 2 +- src/base/ftadvanc.c | 2 +- src/base/ftapi.c | 2 +- src/base/ftbase.c | 2 +- src/base/ftbase.h | 2 +- src/base/ftbbox.c | 2 +- src/base/ftbdf.c | 2 +- src/base/ftbitmap.c | 2 +- src/base/ftcalc.c | 2 +- src/base/ftcid.c | 2 +- src/base/ftdbgmem.c | 2 +- src/base/ftdebug.c | 2 +- src/base/ftfntfmt.c | 2 +- src/base/ftfstype.c | 2 +- src/base/ftgasp.c | 2 +- src/base/ftgloadr.c | 2 +- src/base/ftglyph.c | 2 +- src/base/ftgxval.c | 2 +- src/base/ftinit.c | 2 +- src/base/ftlcdfil.c | 2 +- src/base/ftmac.c | 2 +- src/base/ftmm.c | 2 +- src/base/ftobjs.c | 2 +- src/base/ftotval.c | 2 +- src/base/ftoutln.c | 2 +- src/base/ftpatent.c | 2 +- src/base/ftpfr.c | 2 +- src/base/ftpic.c | 2 +- src/base/ftpsprop.c | 2 +- src/base/ftrfork.c | 2 +- src/base/ftsnames.c | 2 +- src/base/ftstream.c | 2 +- src/base/ftstroke.c | 2 +- src/base/ftsynth.c | 2 +- src/base/ftsystem.c | 2 +- src/base/fttrigon.c | 2 +- src/base/fttype1.c | 2 +- src/base/ftutil.c | 2 +- src/base/ftwinfnt.c | 2 +- src/base/rules.mk | 2 +- src/bdf/Jamfile | 2 +- src/bzip2/Jamfile | 2 +- src/bzip2/ftbzip2.c | 2 +- src/bzip2/rules.mk | 2 +- src/cache/Jamfile | 2 +- src/cache/ftcache.c | 2 +- src/cache/ftcbasic.c | 2 +- src/cache/ftccache.c | 2 +- src/cache/ftccache.h | 2 +- src/cache/ftccback.h | 2 +- src/cache/ftccmap.c | 2 +- src/cache/ftcerror.h | 2 +- src/cache/ftcglyph.c | 2 +- src/cache/ftcglyph.h | 2 +- src/cache/ftcimage.c | 2 +- src/cache/ftcimage.h | 2 +- src/cache/ftcmanag.c | 2 +- src/cache/ftcmanag.h | 2 +- src/cache/ftcmru.c | 2 +- src/cache/ftcmru.h | 2 +- src/cache/ftcsbits.c | 2 +- src/cache/ftcsbits.h | 2 +- src/cache/rules.mk | 2 +- src/cff/Jamfile | 2 +- src/cff/cff.c | 2 +- src/cff/cffcmap.c | 2 +- src/cff/cffcmap.h | 2 +- src/cff/cffdrivr.c | 2 +- src/cff/cffdrivr.h | 2 +- src/cff/cfferrs.h | 2 +- src/cff/cffgload.c | 2 +- src/cff/cffgload.h | 2 +- src/cff/cffload.c | 2 +- src/cff/cffload.h | 2 +- src/cff/cffobjs.c | 2 +- src/cff/cffobjs.h | 2 +- src/cff/cffparse.c | 2 +- src/cff/cffparse.h | 2 +- src/cff/cffpic.c | 2 +- src/cff/cffpic.h | 2 +- src/cff/cfftoken.h | 2 +- src/cff/module.mk | 2 +- src/cff/rules.mk | 2 +- src/cid/Jamfile | 2 +- src/cid/ciderrs.h | 2 +- src/cid/cidgload.c | 2 +- src/cid/cidgload.h | 2 +- src/cid/cidload.c | 2 +- src/cid/cidload.h | 2 +- src/cid/cidobjs.c | 2 +- src/cid/cidobjs.h | 2 +- src/cid/cidparse.c | 2 +- src/cid/cidparse.h | 2 +- src/cid/cidriver.c | 2 +- src/cid/cidriver.h | 2 +- src/cid/cidtoken.h | 2 +- src/cid/module.mk | 2 +- src/cid/rules.mk | 2 +- src/cid/type1cid.c | 2 +- src/gxvalid/Jamfile | 2 +- src/gxvalid/README | 2 +- src/gxvalid/gxvalid.c | 2 +- src/gxvalid/gxvalid.h | 2 +- src/gxvalid/gxvbsln.c | 2 +- src/gxvalid/gxvcommn.c | 2 +- src/gxvalid/gxvcommn.h | 2 +- src/gxvalid/gxverror.h | 2 +- src/gxvalid/gxvfeat.c | 2 +- src/gxvalid/gxvfeat.h | 2 +- src/gxvalid/gxvfgen.c | 2 +- src/gxvalid/gxvjust.c | 2 +- src/gxvalid/gxvkern.c | 2 +- src/gxvalid/gxvlcar.c | 2 +- src/gxvalid/gxvmod.c | 2 +- src/gxvalid/gxvmod.h | 2 +- src/gxvalid/gxvmort.c | 2 +- src/gxvalid/gxvmort.h | 2 +- src/gxvalid/gxvmort0.c | 2 +- src/gxvalid/gxvmort1.c | 2 +- src/gxvalid/gxvmort2.c | 2 +- src/gxvalid/gxvmort4.c | 2 +- src/gxvalid/gxvmort5.c | 2 +- src/gxvalid/gxvmorx.c | 2 +- src/gxvalid/gxvmorx.h | 2 +- src/gxvalid/gxvmorx0.c | 2 +- src/gxvalid/gxvmorx1.c | 2 +- src/gxvalid/gxvmorx2.c | 2 +- src/gxvalid/gxvmorx4.c | 2 +- src/gxvalid/gxvmorx5.c | 2 +- src/gxvalid/gxvopbd.c | 2 +- src/gxvalid/gxvprop.c | 2 +- src/gxvalid/gxvtrak.c | 2 +- src/gxvalid/module.mk | 2 +- src/gxvalid/rules.mk | 2 +- src/gzip/Jamfile | 2 +- src/gzip/ftgzip.c | 2 +- src/gzip/rules.mk | 2 +- src/lzw/Jamfile | 2 +- src/lzw/ftlzw.c | 2 +- src/lzw/ftzopen.c | 2 +- src/lzw/ftzopen.h | 2 +- src/lzw/rules.mk | 2 +- src/otvalid/Jamfile | 2 +- src/otvalid/module.mk | 2 +- src/otvalid/otvalid.c | 2 +- src/otvalid/otvalid.h | 2 +- src/otvalid/otvbase.c | 2 +- src/otvalid/otvcommn.c | 2 +- src/otvalid/otvcommn.h | 2 +- src/otvalid/otverror.h | 2 +- src/otvalid/otvgdef.c | 2 +- src/otvalid/otvgpos.c | 2 +- src/otvalid/otvgpos.h | 2 +- src/otvalid/otvgsub.c | 2 +- src/otvalid/otvjstf.c | 2 +- src/otvalid/otvmath.c | 2 +- src/otvalid/otvmod.c | 2 +- src/otvalid/otvmod.h | 2 +- src/otvalid/rules.mk | 2 +- src/pcf/Jamfile | 2 +- src/pfr/Jamfile | 2 +- src/pfr/module.mk | 2 +- src/pfr/pfr.c | 2 +- src/pfr/pfrcmap.c | 2 +- src/pfr/pfrcmap.h | 2 +- src/pfr/pfrdrivr.c | 2 +- src/pfr/pfrdrivr.h | 2 +- src/pfr/pfrerror.h | 2 +- src/pfr/pfrgload.c | 2 +- src/pfr/pfrgload.h | 2 +- src/pfr/pfrload.c | 2 +- src/pfr/pfrload.h | 2 +- src/pfr/pfrobjs.c | 2 +- src/pfr/pfrobjs.h | 2 +- src/pfr/pfrsbit.c | 2 +- src/pfr/pfrsbit.h | 2 +- src/pfr/pfrtypes.h | 2 +- src/pfr/rules.mk | 2 +- src/psaux/Jamfile | 2 +- src/psaux/afmparse.c | 2 +- src/psaux/afmparse.h | 2 +- src/psaux/cffdecode.c | 2 +- src/psaux/cffdecode.h | 2 +- src/psaux/module.mk | 2 +- src/psaux/psaux.c | 2 +- src/psaux/psauxerr.h | 2 +- src/psaux/psauxmod.c | 2 +- src/psaux/psauxmod.h | 2 +- src/psaux/psconv.c | 2 +- src/psaux/psconv.h | 2 +- src/psaux/psobjs.c | 2 +- src/psaux/psobjs.h | 2 +- src/psaux/rules.mk | 2 +- src/psaux/t1cmap.c | 2 +- src/psaux/t1cmap.h | 2 +- src/psaux/t1decode.c | 2 +- src/psaux/t1decode.h | 2 +- src/pshinter/Jamfile | 2 +- src/pshinter/module.mk | 2 +- src/pshinter/pshalgo.c | 2 +- src/pshinter/pshalgo.h | 2 +- src/pshinter/pshglob.c | 2 +- src/pshinter/pshglob.h | 2 +- src/pshinter/pshinter.c | 2 +- src/pshinter/pshmod.c | 2 +- src/pshinter/pshmod.h | 2 +- src/pshinter/pshnterr.h | 2 +- src/pshinter/pshpic.c | 2 +- src/pshinter/pshpic.h | 2 +- src/pshinter/pshrec.c | 2 +- src/pshinter/pshrec.h | 2 +- src/pshinter/rules.mk | 2 +- src/psnames/Jamfile | 2 +- src/psnames/module.mk | 2 +- src/psnames/psmodule.c | 2 +- src/psnames/psmodule.h | 2 +- src/psnames/psnamerr.h | 2 +- src/psnames/psnames.c | 2 +- src/psnames/pspic.c | 2 +- src/psnames/pspic.h | 2 +- src/psnames/pstables.h | 2 +- src/psnames/rules.mk | 2 +- src/raster/Jamfile | 2 +- src/raster/ftmisc.h | 2 +- src/raster/ftraster.c | 2 +- src/raster/ftraster.h | 2 +- src/raster/ftrend1.c | 2 +- src/raster/ftrend1.h | 2 +- src/raster/module.mk | 2 +- src/raster/raster.c | 2 +- src/raster/rasterrs.h | 2 +- src/raster/rastpic.c | 2 +- src/raster/rastpic.h | 2 +- src/raster/rules.mk | 2 +- src/sfnt/Jamfile | 2 +- src/sfnt/module.mk | 2 +- src/sfnt/pngshim.c | 2 +- src/sfnt/pngshim.h | 2 +- src/sfnt/rules.mk | 2 +- src/sfnt/sfdriver.c | 2 +- src/sfnt/sfdriver.h | 2 +- src/sfnt/sferrors.h | 2 +- src/sfnt/sfnt.c | 2 +- src/sfnt/sfntpic.c | 2 +- src/sfnt/sfntpic.h | 2 +- src/sfnt/sfobjs.c | 2 +- src/sfnt/sfobjs.h | 2 +- src/sfnt/ttbdf.c | 2 +- src/sfnt/ttbdf.h | 2 +- src/sfnt/ttcmap.c | 2 +- src/sfnt/ttcmap.h | 2 +- src/sfnt/ttcmapc.h | 2 +- src/sfnt/ttkern.c | 2 +- src/sfnt/ttkern.h | 2 +- src/sfnt/ttload.c | 2 +- src/sfnt/ttload.h | 2 +- src/sfnt/ttmtx.c | 2 +- src/sfnt/ttmtx.h | 2 +- src/sfnt/ttpost.c | 2 +- src/sfnt/ttpost.h | 2 +- src/sfnt/ttsbit.c | 2 +- src/sfnt/ttsbit.h | 2 +- src/smooth/Jamfile | 2 +- src/smooth/ftgrays.c | 2 +- src/smooth/ftgrays.h | 2 +- src/smooth/ftsmerrs.h | 2 +- src/smooth/ftsmooth.c | 2 +- src/smooth/ftsmooth.h | 2 +- src/smooth/ftspic.c | 2 +- src/smooth/ftspic.h | 2 +- src/smooth/module.mk | 2 +- src/smooth/rules.mk | 2 +- src/smooth/smooth.c | 2 +- src/tools/afblue.pl | 2 +- src/tools/docmaker/content.py | 2 +- src/tools/docmaker/docmaker.py | 2 +- src/tools/docmaker/formatter.py | 2 +- src/tools/docmaker/sources.py | 2 +- src/tools/docmaker/tohtml.py | 2 +- src/tools/docmaker/utils.py | 2 +- src/tools/ftfuzzer/README | 2 +- src/tools/ftfuzzer/ftfuzzer.cc | 2 +- src/tools/ftfuzzer/ftmutator.cc | 2 +- src/tools/ftfuzzer/rasterfuzzer.cc | 2 +- src/tools/ftfuzzer/runinput.cc | 2 +- src/tools/glnames.py | 4 ++-- src/tools/update-copyright-year | 2 +- src/truetype/Jamfile | 2 +- src/truetype/module.mk | 2 +- src/truetype/rules.mk | 2 +- src/truetype/truetype.c | 2 +- src/truetype/ttdriver.c | 2 +- src/truetype/ttdriver.h | 2 +- src/truetype/tterrors.h | 2 +- src/truetype/ttgload.c | 2 +- src/truetype/ttgload.h | 2 +- src/truetype/ttgxvar.c | 2 +- src/truetype/ttgxvar.h | 2 +- src/truetype/ttinterp.c | 2 +- src/truetype/ttinterp.h | 2 +- src/truetype/ttobjs.c | 2 +- src/truetype/ttobjs.h | 2 +- src/truetype/ttpic.c | 2 +- src/truetype/ttpic.h | 2 +- src/truetype/ttpload.c | 2 +- src/truetype/ttpload.h | 2 +- src/truetype/ttsubpix.c | 2 +- src/truetype/ttsubpix.h | 2 +- src/type1/Jamfile | 2 +- src/type1/module.mk | 2 +- src/type1/rules.mk | 2 +- src/type1/t1afm.c | 2 +- src/type1/t1afm.h | 2 +- src/type1/t1driver.c | 2 +- src/type1/t1driver.h | 2 +- src/type1/t1errors.h | 2 +- src/type1/t1gload.c | 2 +- src/type1/t1gload.h | 2 +- src/type1/t1load.c | 2 +- src/type1/t1load.h | 2 +- src/type1/t1objs.c | 2 +- src/type1/t1objs.h | 2 +- src/type1/t1parse.c | 2 +- src/type1/t1parse.h | 2 +- src/type1/t1tokens.h | 2 +- src/type1/type1.c | 2 +- src/type42/Jamfile | 2 +- src/type42/module.mk | 2 +- src/type42/rules.mk | 2 +- src/type42/t42drivr.c | 2 +- src/type42/t42drivr.h | 2 +- src/type42/t42error.h | 2 +- src/type42/t42objs.c | 2 +- src/type42/t42objs.h | 2 +- src/type42/t42parse.c | 2 +- src/type42/t42parse.h | 2 +- src/type42/t42types.h | 2 +- src/type42/type42.c | 2 +- src/winfonts/Jamfile | 2 +- src/winfonts/fnterrs.h | 2 +- src/winfonts/module.mk | 2 +- src/winfonts/rules.mk | 2 +- src/winfonts/winfnt.c | 2 +- src/winfonts/winfnt.h | 2 +- vms_make.com | 2 +- 589 files changed, 590 insertions(+), 590 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 16715490d..7bb5df652 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ # CMakeLists.txt # -# Copyright 2013-2017 by +# Copyright 2013-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # Written originally by John Cary diff --git a/ChangeLog b/ChangeLog index 74351bcd4..57058eaf3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4822,7 +4822,7 @@ ---------------------------------------------------------------------------- -Copyright 2016-2017 by +Copyright 2016-2018 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, modified, diff --git a/ChangeLog.20 b/ChangeLog.20 index 11376e863..63e3116bd 100644 --- a/ChangeLog.20 +++ b/ChangeLog.20 @@ -2597,7 +2597,7 @@ ---------------------------------------------------------------------------- -Copyright 2000-2017 by +Copyright 2000-2018 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, modified, diff --git a/ChangeLog.21 b/ChangeLog.21 index eff9f799d..01883f111 100644 --- a/ChangeLog.21 +++ b/ChangeLog.21 @@ -9422,7 +9422,7 @@ ---------------------------------------------------------------------------- -Copyright 2002-2017 by +Copyright 2002-2018 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, modified, diff --git a/ChangeLog.22 b/ChangeLog.22 index d0876138c..4517c3224 100644 --- a/ChangeLog.22 +++ b/ChangeLog.22 @@ -2821,7 +2821,7 @@ ---------------------------------------------------------------------------- -Copyright 2005-2017 by +Copyright 2005-2018 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, modified, diff --git a/ChangeLog.23 b/ChangeLog.23 index dab356db9..85253f112 100644 --- a/ChangeLog.23 +++ b/ChangeLog.23 @@ -7932,7 +7932,7 @@ ---------------------------------------------------------------------------- -Copyright 2006-2017 by +Copyright 2006-2018 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, modified, diff --git a/ChangeLog.24 b/ChangeLog.24 index fb05e7533..7661aee19 100644 --- a/ChangeLog.24 +++ b/ChangeLog.24 @@ -6344,7 +6344,7 @@ ---------------------------------------------------------------------------- -Copyright 2010-2017 by +Copyright 2010-2018 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, modified, diff --git a/ChangeLog.25 b/ChangeLog.25 index 5482b0520..59cf2bfed 100644 --- a/ChangeLog.25 +++ b/ChangeLog.25 @@ -5145,7 +5145,7 @@ ---------------------------------------------------------------------------- -Copyright 2013-2017 by +Copyright 2013-2018 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, modified, diff --git a/ChangeLog.26 b/ChangeLog.26 index b76f9eb60..ea89e91ab 100644 --- a/ChangeLog.26 +++ b/ChangeLog.26 @@ -5695,7 +5695,7 @@ ---------------------------------------------------------------------------- -Copyright 2015-2017 by +Copyright 2015-2018 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, modified, diff --git a/ChangeLog.27 b/ChangeLog.27 index e61d55135..0e82b2fb3 100644 --- a/ChangeLog.27 +++ b/ChangeLog.27 @@ -2090,7 +2090,7 @@ ---------------------------------------------------------------------------- -Copyright 2016-2017 by +Copyright 2016-2018 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, modified, diff --git a/Jamfile b/Jamfile index aa3d9f0db..20724f7f5 100644 --- a/Jamfile +++ b/Jamfile @@ -1,6 +1,6 @@ # FreeType 2 top Jamfile. # -# Copyright 2001-2017 by +# Copyright 2001-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/Jamrules b/Jamrules index 0047e5399..bdd04bcca 100644 --- a/Jamrules +++ b/Jamrules @@ -1,6 +1,6 @@ # FreeType 2 JamRules. # -# Copyright 2001-2017 by +# Copyright 2001-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/Makefile b/Makefile index 1c4145840..0c7ee0eef 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/README b/README index 501183e87..14e925d55 100644 --- a/README +++ b/README @@ -71,7 +71,7 @@ ---------------------------------------------------------------------- -Copyright 2006-2017 by +Copyright 2006-2018 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, diff --git a/README.git b/README.git index 06f778b48..a3d7fc0cd 100644 --- a/README.git +++ b/README.git @@ -37,7 +37,7 @@ repository. ---------------------------------------------------------------------- -Copyright 2005-2017 by +Copyright 2005-2018 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, diff --git a/autogen.sh b/autogen.sh index 31c1534bc..ab90e6417 100755 --- a/autogen.sh +++ b/autogen.sh @@ -1,6 +1,6 @@ #!/bin/sh -# Copyright 2005-2017 by +# Copyright 2005-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/amiga/README b/builds/amiga/README index fb44116ed..29e97d667 100644 --- a/builds/amiga/README +++ b/builds/amiga/README @@ -1,7 +1,7 @@ README for the builds/amiga subdirectory. -Copyright 2005-2017 by +Copyright 2005-2018 by Werner Lemberg and Detlef Würkner. This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/amiga/include/config/ftconfig.h b/builds/amiga/include/config/ftconfig.h index 9434841e6..0217e0ed1 100644 --- a/builds/amiga/include/config/ftconfig.h +++ b/builds/amiga/include/config/ftconfig.h @@ -4,7 +4,7 @@ /* */ /* Amiga-specific configuration file (specification only). */ /* */ -/* Copyright 2005-2017 by */ +/* Copyright 2005-2018 by */ /* Werner Lemberg and Detlef Würkner. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/builds/amiga/include/config/ftmodule.h b/builds/amiga/include/config/ftmodule.h index 38ea4c900..f8baab566 100644 --- a/builds/amiga/include/config/ftmodule.h +++ b/builds/amiga/include/config/ftmodule.h @@ -4,7 +4,7 @@ /* */ /* Amiga-specific FreeType module selection. */ /* */ -/* Copyright 2005-2017 by */ +/* Copyright 2005-2018 by */ /* Werner Lemberg and Detlef Würkner. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/builds/amiga/makefile b/builds/amiga/makefile index e467f9ab6..636743860 100644 --- a/builds/amiga/makefile +++ b/builds/amiga/makefile @@ -5,7 +5,7 @@ # -# Copyright 2005-2017 by +# Copyright 2005-2018 by # Werner Lemberg and Detlef Würkner. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/amiga/makefile.os4 b/builds/amiga/makefile.os4 index 82ee86449..c07e18149 100644 --- a/builds/amiga/makefile.os4 +++ b/builds/amiga/makefile.os4 @@ -4,7 +4,7 @@ # -# Copyright 2005-2017 by +# Copyright 2005-2018 by # Werner Lemberg and Detlef Würkner. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/amiga/smakefile b/builds/amiga/smakefile index 08e0a3892..29a31e47b 100644 --- a/builds/amiga/smakefile +++ b/builds/amiga/smakefile @@ -3,7 +3,7 @@ # -# Copyright 2005-2017 by +# Copyright 2005-2018 by # Werner Lemberg and Detlef Würkner. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/amiga/src/base/ftdebug.c b/builds/amiga/src/base/ftdebug.c index 1a897cf2d..f3ba48c93 100644 --- a/builds/amiga/src/base/ftdebug.c +++ b/builds/amiga/src/base/ftdebug.c @@ -4,7 +4,7 @@ /* */ /* Debugging and logging component for amiga (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, Werner Lemberg and Detlef Würkner. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/builds/amiga/src/base/ftsystem.c b/builds/amiga/src/base/ftsystem.c index c3960d96a..babaeeb68 100644 --- a/builds/amiga/src/base/ftsystem.c +++ b/builds/amiga/src/base/ftsystem.c @@ -4,7 +4,7 @@ /* */ /* Amiga-specific FreeType low-level system interface (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, Werner Lemberg and Detlef Würkner. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/builds/ansi/ansi-def.mk b/builds/ansi/ansi-def.mk index d3c0f282a..1484f9629 100644 --- a/builds/ansi/ansi-def.mk +++ b/builds/ansi/ansi-def.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/ansi/ansi.mk b/builds/ansi/ansi.mk index b33e8cec5..c06732c83 100644 --- a/builds/ansi/ansi.mk +++ b/builds/ansi/ansi.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/beos/beos-def.mk b/builds/beos/beos-def.mk index fa6f236dd..89c54ddd5 100644 --- a/builds/beos/beos-def.mk +++ b/builds/beos/beos-def.mk @@ -5,7 +5,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/beos/beos.mk b/builds/beos/beos.mk index 181efe440..619ceaff4 100644 --- a/builds/beos/beos.mk +++ b/builds/beos/beos.mk @@ -2,7 +2,7 @@ # FreeType 2 configuration rules for a BeOS system # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/beos/detect.mk b/builds/beos/detect.mk index 30f6d10d4..82f62059b 100644 --- a/builds/beos/detect.mk +++ b/builds/beos/detect.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/cmake/iOS.cmake b/builds/cmake/iOS.cmake index 5717e6a7b..c6da70c0c 100644 --- a/builds/cmake/iOS.cmake +++ b/builds/cmake/iOS.cmake @@ -1,6 +1,6 @@ # iOS.cmake # -# Copyright 2014-2017 by +# Copyright 2014-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # Written by David Wimsey diff --git a/builds/cmake/testbuild.sh b/builds/cmake/testbuild.sh index 34aded722..1fa3a1869 100755 --- a/builds/cmake/testbuild.sh +++ b/builds/cmake/testbuild.sh @@ -1,6 +1,6 @@ #!/bin/sh -e -# Copyright 2015-2017 by +# Copyright 2015-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/compiler/ansi-cc.mk b/builds/compiler/ansi-cc.mk index d61964110..99fe8cb58 100644 --- a/builds/compiler/ansi-cc.mk +++ b/builds/compiler/ansi-cc.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/compiler/bcc-dev.mk b/builds/compiler/bcc-dev.mk index 9b43fd1d9..8d67fa1a5 100644 --- a/builds/compiler/bcc-dev.mk +++ b/builds/compiler/bcc-dev.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/compiler/bcc.mk b/builds/compiler/bcc.mk index 82e38294f..02d483336 100644 --- a/builds/compiler/bcc.mk +++ b/builds/compiler/bcc.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/compiler/emx.mk b/builds/compiler/emx.mk index a25e4bc1f..2926b1179 100644 --- a/builds/compiler/emx.mk +++ b/builds/compiler/emx.mk @@ -3,7 +3,7 @@ # -# Copyright 2003-2017 by +# Copyright 2003-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/compiler/gcc-dev.mk b/builds/compiler/gcc-dev.mk index 8994fa290..48d284898 100644 --- a/builds/compiler/gcc-dev.mk +++ b/builds/compiler/gcc-dev.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/compiler/gcc.mk b/builds/compiler/gcc.mk index 3465038c9..9c772394a 100644 --- a/builds/compiler/gcc.mk +++ b/builds/compiler/gcc.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/compiler/intelc.mk b/builds/compiler/intelc.mk index 287db441c..e9236d34b 100644 --- a/builds/compiler/intelc.mk +++ b/builds/compiler/intelc.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/compiler/unix-lcc.mk b/builds/compiler/unix-lcc.mk index 560c61bf3..09fffeb67 100644 --- a/builds/compiler/unix-lcc.mk +++ b/builds/compiler/unix-lcc.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/compiler/visualage.mk b/builds/compiler/visualage.mk index 2aa4fbe83..10299da62 100644 --- a/builds/compiler/visualage.mk +++ b/builds/compiler/visualage.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/compiler/visualc.mk b/builds/compiler/visualc.mk index e86ecc5f6..74f498b61 100644 --- a/builds/compiler/visualc.mk +++ b/builds/compiler/visualc.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/compiler/watcom.mk b/builds/compiler/watcom.mk index 62a481184..e455922f0 100644 --- a/builds/compiler/watcom.mk +++ b/builds/compiler/watcom.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/compiler/win-lcc.mk b/builds/compiler/win-lcc.mk index 91b429e0e..1356c1ca8 100644 --- a/builds/compiler/win-lcc.mk +++ b/builds/compiler/win-lcc.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/detect.mk b/builds/detect.mk index 34814f113..771fc31a8 100644 --- a/builds/detect.mk +++ b/builds/detect.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/dos/detect.mk b/builds/dos/detect.mk index 85c48df9e..55b0e76ec 100644 --- a/builds/dos/detect.mk +++ b/builds/dos/detect.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/dos/dos-def.mk b/builds/dos/dos-def.mk index a6c2f225f..cb1154dc8 100644 --- a/builds/dos/dos-def.mk +++ b/builds/dos/dos-def.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/dos/dos-emx.mk b/builds/dos/dos-emx.mk index 85de03778..dedcc3fc1 100644 --- a/builds/dos/dos-emx.mk +++ b/builds/dos/dos-emx.mk @@ -3,7 +3,7 @@ # -# Copyright 2003-2017 by +# Copyright 2003-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/dos/dos-gcc.mk b/builds/dos/dos-gcc.mk index e38acfbea..53099ab41 100644 --- a/builds/dos/dos-gcc.mk +++ b/builds/dos/dos-gcc.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/dos/dos-wat.mk b/builds/dos/dos-wat.mk index ddb4876b7..1bd00e73e 100644 --- a/builds/dos/dos-wat.mk +++ b/builds/dos/dos-wat.mk @@ -3,7 +3,7 @@ # -# Copyright 2003-2017 by +# Copyright 2003-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/exports.mk b/builds/exports.mk index 10b79d355..59fe31a4b 100644 --- a/builds/exports.mk +++ b/builds/exports.mk @@ -3,7 +3,7 @@ # -# Copyright 2005-2017 by +# Copyright 2005-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/freetype.mk b/builds/freetype.mk index d9dbf7996..f2e7e608e 100644 --- a/builds/freetype.mk +++ b/builds/freetype.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/link_dos.mk b/builds/link_dos.mk index 3854e7072..3b0e8da58 100644 --- a/builds/link_dos.mk +++ b/builds/link_dos.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/link_std.mk b/builds/link_std.mk index 4cc2dc913..8ba5e64db 100644 --- a/builds/link_std.mk +++ b/builds/link_std.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/mac/ftmac.c b/builds/mac/ftmac.c index f5747a401..c45546cee 100644 --- a/builds/mac/ftmac.c +++ b/builds/mac/ftmac.c @@ -5,7 +5,7 @@ /* Mac FOND support. Written by just@letterror.com. */ /* Heavily Fixed by mpsuzuki, George Williams and Sean McBride */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* Just van Rossum, David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/builds/modules.mk b/builds/modules.mk index a89d5791b..e1edb17b8 100644 --- a/builds/modules.mk +++ b/builds/modules.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/os2/detect.mk b/builds/os2/detect.mk index 3ea68fb5e..2edb8d4c1 100644 --- a/builds/os2/detect.mk +++ b/builds/os2/detect.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/os2/os2-def.mk b/builds/os2/os2-def.mk index 2fe626345..7ad1ffbad 100644 --- a/builds/os2/os2-def.mk +++ b/builds/os2/os2-def.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/os2/os2-dev.mk b/builds/os2/os2-dev.mk index 842a289ab..505a754f7 100644 --- a/builds/os2/os2-dev.mk +++ b/builds/os2/os2-dev.mk @@ -5,7 +5,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/os2/os2-gcc.mk b/builds/os2/os2-gcc.mk index 4cdffba57..65026b101 100644 --- a/builds/os2/os2-gcc.mk +++ b/builds/os2/os2-gcc.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/symbian/bld.inf b/builds/symbian/bld.inf index 276839d82..9c6d8dca1 100644 --- a/builds/symbian/bld.inf +++ b/builds/symbian/bld.inf @@ -2,7 +2,7 @@ // FreeType 2 project for the symbian platform // -// Copyright 2008-2017 by +// Copyright 2008-2018 by // David Turner, Robert Wilhelm, and Werner Lemberg. // // This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/symbian/freetype.mmp b/builds/symbian/freetype.mmp index cc69aca4e..d3b95efbb 100644 --- a/builds/symbian/freetype.mmp +++ b/builds/symbian/freetype.mmp @@ -2,7 +2,7 @@ // FreeType 2 makefile for the symbian platform // -// Copyright 2008-2017 by +// Copyright 2008-2018 by // David Turner, Robert Wilhelm, and Werner Lemberg. // // This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/toplevel.mk b/builds/toplevel.mk index 7b1d03be3..f51ad16b9 100644 --- a/builds/toplevel.mk +++ b/builds/toplevel.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/unix/configure.raw b/builds/unix/configure.raw index 466c0ca00..126e0914b 100644 --- a/builds/unix/configure.raw +++ b/builds/unix/configure.raw @@ -2,7 +2,7 @@ # # Process this file with autoconf to produce a configure script. # -# Copyright 2001-2017 by +# Copyright 2001-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/unix/detect.mk b/builds/unix/detect.mk index a2cf0a72b..54daa0786 100644 --- a/builds/unix/detect.mk +++ b/builds/unix/detect.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/unix/freetype-config.in b/builds/unix/freetype-config.in index 2c1c160f8..2d5b90dc2 100644 --- a/builds/unix/freetype-config.in +++ b/builds/unix/freetype-config.in @@ -1,6 +1,6 @@ #! /bin/sh # -# Copyright 2000-2017 by +# Copyright 2000-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/unix/freetype2.m4 b/builds/unix/freetype2.m4 index 172212f10..af2e6590e 100644 --- a/builds/unix/freetype2.m4 +++ b/builds/unix/freetype2.m4 @@ -1,7 +1,7 @@ # Configure paths for FreeType2 # Marcelo Magallon 2001-10-26, based on gtk.m4 by Owen Taylor # -# Copyright 2001-2017 by +# Copyright 2001-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/unix/ft-munmap.m4 b/builds/unix/ft-munmap.m4 index 27dd7d50c..00eda4925 100644 --- a/builds/unix/ft-munmap.m4 +++ b/builds/unix/ft-munmap.m4 @@ -1,6 +1,6 @@ ## FreeType specific autoconf tests # -# Copyright 2002-2017 by +# Copyright 2002-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/unix/ftconfig.in b/builds/unix/ftconfig.in index 711b63a42..5159693e7 100644 --- a/builds/unix/ftconfig.in +++ b/builds/unix/ftconfig.in @@ -4,7 +4,7 @@ /* */ /* UNIX-specific configuration file (specification only). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/builds/unix/ftsystem.c b/builds/unix/ftsystem.c index 48a235ba3..8fdbeb0f6 100644 --- a/builds/unix/ftsystem.c +++ b/builds/unix/ftsystem.c @@ -4,7 +4,7 @@ /* */ /* Unix-specific FreeType low-level system interface (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/builds/unix/install.mk b/builds/unix/install.mk index 35d50aac5..50325ca5a 100644 --- a/builds/unix/install.mk +++ b/builds/unix/install.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/unix/unix-cc.in b/builds/unix/unix-cc.in index a967cee93..9b888c7d4 100644 --- a/builds/unix/unix-cc.in +++ b/builds/unix/unix-cc.in @@ -2,7 +2,7 @@ # FreeType 2 template for Unix-specific compiler definitions # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/unix/unix-def.in b/builds/unix/unix-def.in index 5de36efab..059a06159 100644 --- a/builds/unix/unix-def.in +++ b/builds/unix/unix-def.in @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/unix/unix-dev.mk b/builds/unix/unix-dev.mk index 92c06001b..5a516ad28 100644 --- a/builds/unix/unix-dev.mk +++ b/builds/unix/unix-dev.mk @@ -6,7 +6,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/unix/unix-lcc.mk b/builds/unix/unix-lcc.mk index 5122fdece..73a02d430 100644 --- a/builds/unix/unix-lcc.mk +++ b/builds/unix/unix-lcc.mk @@ -6,7 +6,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/unix/unix.mk b/builds/unix/unix.mk index 14d5c0cbb..acd54d3dd 100644 --- a/builds/unix/unix.mk +++ b/builds/unix/unix.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/unix/unixddef.mk b/builds/unix/unixddef.mk index 30f2307c0..a8da63a0a 100644 --- a/builds/unix/unixddef.mk +++ b/builds/unix/unixddef.mk @@ -4,7 +4,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/vms/ftconfig.h b/builds/vms/ftconfig.h index 0f4c613a5..fa4aa1198 100644 --- a/builds/vms/ftconfig.h +++ b/builds/vms/ftconfig.h @@ -4,7 +4,7 @@ /* */ /* VMS-specific configuration file (specification only). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/builds/vms/ftsystem.c b/builds/vms/ftsystem.c index d83e8ec6f..7d79f9a31 100644 --- a/builds/vms/ftsystem.c +++ b/builds/vms/ftsystem.c @@ -4,7 +4,7 @@ /* */ /* VMS-specific FreeType low-level system interface (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/builds/wince/ftdebug.c b/builds/wince/ftdebug.c index f516726c3..83c5f4479 100644 --- a/builds/wince/ftdebug.c +++ b/builds/wince/ftdebug.c @@ -4,7 +4,7 @@ /* */ /* Debugging and logging component for WinCE (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/builds/windows/detect.mk b/builds/windows/detect.mk index 2032934f5..b047e0215 100644 --- a/builds/windows/detect.mk +++ b/builds/windows/detect.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/windows/ftdebug.c b/builds/windows/ftdebug.c index 510768c12..ec70a0e80 100644 --- a/builds/windows/ftdebug.c +++ b/builds/windows/ftdebug.c @@ -4,7 +4,7 @@ /* */ /* Debugging and logging component for Win32 (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/builds/windows/w32-bcc.mk b/builds/windows/w32-bcc.mk index d8d33b10b..01aab1ce0 100644 --- a/builds/windows/w32-bcc.mk +++ b/builds/windows/w32-bcc.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/windows/w32-bccd.mk b/builds/windows/w32-bccd.mk index ea634e502..2c14d6c8c 100644 --- a/builds/windows/w32-bccd.mk +++ b/builds/windows/w32-bccd.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/windows/w32-dev.mk b/builds/windows/w32-dev.mk index c9b96e9b8..279d5f9a0 100644 --- a/builds/windows/w32-dev.mk +++ b/builds/windows/w32-dev.mk @@ -5,7 +5,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/windows/w32-gcc.mk b/builds/windows/w32-gcc.mk index 27a0a8f7d..9e3476b94 100644 --- a/builds/windows/w32-gcc.mk +++ b/builds/windows/w32-gcc.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/windows/w32-icc.mk b/builds/windows/w32-icc.mk index c4f3dbf6b..e695c1214 100644 --- a/builds/windows/w32-icc.mk +++ b/builds/windows/w32-icc.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/windows/w32-intl.mk b/builds/windows/w32-intl.mk index 4442bd314..1e36662d6 100644 --- a/builds/windows/w32-intl.mk +++ b/builds/windows/w32-intl.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/windows/w32-lcc.mk b/builds/windows/w32-lcc.mk index 0508fbb9b..5729d36c1 100644 --- a/builds/windows/w32-lcc.mk +++ b/builds/windows/w32-lcc.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/windows/w32-mingw32.mk b/builds/windows/w32-mingw32.mk index ae408239c..b3a210df2 100644 --- a/builds/windows/w32-mingw32.mk +++ b/builds/windows/w32-mingw32.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/windows/w32-vcc.mk b/builds/windows/w32-vcc.mk index 922fc60d1..342c8aa6d 100644 --- a/builds/windows/w32-vcc.mk +++ b/builds/windows/w32-vcc.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/windows/w32-wat.mk b/builds/windows/w32-wat.mk index 4d6138e71..37ecc8880 100644 --- a/builds/windows/w32-wat.mk +++ b/builds/windows/w32-wat.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/windows/win32-def.mk b/builds/windows/win32-def.mk index c9bebdbb0..f83d444ff 100644 --- a/builds/windows/win32-def.mk +++ b/builds/windows/win32-def.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/configure b/configure index 68dbd9919..8ee0d4029 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright 2002-2017 by +# Copyright 2002-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/devel/ft2build.h b/devel/ft2build.h index c805cf989..1d17141b2 100644 --- a/devel/ft2build.h +++ b/devel/ft2build.h @@ -4,7 +4,7 @@ /* */ /* FreeType 2 build and setup macros (development version). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/devel/ftoption.h b/devel/ftoption.h index 4b6969888..1b4619eb0 100644 --- a/devel/ftoption.h +++ b/devel/ftoption.h @@ -4,7 +4,7 @@ /* */ /* User-selectable configuration macros (specification only). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/docs/CHANGES b/docs/CHANGES index d990ee14b..b9e3d4767 100644 --- a/docs/CHANGES +++ b/docs/CHANGES @@ -4966,7 +4966,7 @@ Extensions support: ------------------------------------------------------------------------ -Copyright 2000-2017 by +Copyright 2000-2018 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, diff --git a/docs/CUSTOMIZE b/docs/CUSTOMIZE index 6d1587e09..916be3275 100644 --- a/docs/CUSTOMIZE +++ b/docs/CUSTOMIZE @@ -139,7 +139,7 @@ IV. Overriding default configuration and module headers ---------------------------------------------------------------------- -Copyright 2003-2017 by +Copyright 2003-2018 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, diff --git a/docs/DEBUG b/docs/DEBUG index e5e9390c7..751eaf028 100644 --- a/docs/DEBUG +++ b/docs/DEBUG @@ -191,7 +191,7 @@ behaviour of FreeType at runtime. ------------------------------------------------------------------------ -Copyright 2002-2017 by +Copyright 2002-2018 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, diff --git a/docs/INSTALL b/docs/INSTALL index d6ec0d83b..fc24ea1aa 100644 --- a/docs/INSTALL +++ b/docs/INSTALL @@ -77,7 +77,7 @@ II. Custom builds of the library ---------------------------------------------------------------------- -Copyright 2000-2017 by +Copyright 2000-2018 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, diff --git a/docs/INSTALL.ANY b/docs/INSTALL.ANY index 30b957859..47d080f28 100644 --- a/docs/INSTALL.ANY +++ b/docs/INSTALL.ANY @@ -143,7 +143,7 @@ II. Support for flat-directory compilation ---------------------------------------------------------------------- -Copyright 2003-2017 by +Copyright 2003-2018 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, diff --git a/docs/INSTALL.CROSS b/docs/INSTALL.CROSS index 1a837aeee..e8977a12a 100644 --- a/docs/INSTALL.CROSS +++ b/docs/INSTALL.CROSS @@ -163,7 +163,7 @@ procedure. ---------------------------------------------------------------------- -Copyright 2006-2017 by +Copyright 2006-2018 by suzuki toshiya, David Turner, Robert Wilhelm, and Werner Lemberg. diff --git a/docs/INSTALL.GNU b/docs/INSTALL.GNU index 79b53d842..52645f1f7 100644 --- a/docs/INSTALL.GNU +++ b/docs/INSTALL.GNU @@ -148,7 +148,7 @@ instructions in the file `INSTALL.UNIX' instead. ---------------------------------------------------------------------- -Copyright 2003-2017 by +Copyright 2003-2018 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, diff --git a/docs/INSTALL.UNIX b/docs/INSTALL.UNIX index 8b620da68..bb57836a6 100644 --- a/docs/INSTALL.UNIX +++ b/docs/INSTALL.UNIX @@ -105,7 +105,7 @@ or MSys on Win32: ---------------------------------------------------------------------- -Copyright 2003-2017 by +Copyright 2003-2018 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, diff --git a/docs/INSTALL.VMS b/docs/INSTALL.VMS index 6ba48d39b..c1d30e06e 100644 --- a/docs/INSTALL.VMS +++ b/docs/INSTALL.VMS @@ -49,7 +49,7 @@ V7.2-1. ------------------------------------------------------------------------ -Copyright 2000-2017 by +Copyright 2000-2018 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, diff --git a/docs/TODO b/docs/TODO index c4304b323..1a443a2ed 100644 --- a/docs/TODO +++ b/docs/TODO @@ -27,7 +27,7 @@ Other bugs have been registered at the savannah bugzilla of FreeType. ------------------------------------------------------------------------ -Copyright 2001-2017 by +Copyright 2001-2018 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, diff --git a/docs/VERSIONS.TXT b/docs/VERSIONS.TXT index eac4fc816..de4bca977 100644 --- a/docs/VERSIONS.TXT +++ b/docs/VERSIONS.TXT @@ -112,7 +112,7 @@ other release numbers. ------------------------------------------------------------------------ -Copyright 2002-2017 by +Copyright 2002-2018 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, diff --git a/docs/formats.txt b/docs/formats.txt index 4461e3870..75aba92e3 100644 --- a/docs/formats.txt +++ b/docs/formats.txt @@ -191,7 +191,7 @@ which isn't supported yet please send a mail too. ------------------------------------------------------------------------ -Copyright 2004-2017 by +Copyright 2004-2018 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, diff --git a/docs/raster.txt b/docs/raster.txt index bd3fd00f3..8ef466ef9 100644 --- a/docs/raster.txt +++ b/docs/raster.txt @@ -618,7 +618,7 @@ II. Rendering Technology ------------------------------------------------------------------------ -Copyright 2003-2017 by +Copyright 2003-2018 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, diff --git a/docs/release b/docs/release index f07b067c3..44b4cb100 100644 --- a/docs/release +++ b/docs/release @@ -189,7 +189,7 @@ How to prepare a new release ---------------------------------------------------------------------- -Copyright 2003-2017 by +Copyright 2003-2018 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, diff --git a/include/freetype/config/ftconfig.h b/include/freetype/config/ftconfig.h index 4a444ba5b..86dc44509 100644 --- a/include/freetype/config/ftconfig.h +++ b/include/freetype/config/ftconfig.h @@ -4,7 +4,7 @@ /* */ /* ANSI-specific configuration file (specification only). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/config/ftheader.h b/include/freetype/config/ftheader.h index 58f168ea2..214068a15 100644 --- a/include/freetype/config/ftheader.h +++ b/include/freetype/config/ftheader.h @@ -4,7 +4,7 @@ /* */ /* Build macros of the FreeType 2 library. */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/config/ftoption.h b/include/freetype/config/ftoption.h index 06f3d50bb..a5cb7fff2 100644 --- a/include/freetype/config/ftoption.h +++ b/include/freetype/config/ftoption.h @@ -4,7 +4,7 @@ /* */ /* User-selectable configuration macros (specification only). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/config/ftstdlib.h b/include/freetype/config/ftstdlib.h index 05a4845fd..42f9a06e4 100644 --- a/include/freetype/config/ftstdlib.h +++ b/include/freetype/config/ftstdlib.h @@ -5,7 +5,7 @@ /* ANSI-specific library and header configuration file (specification */ /* only). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h index 2f1833879..7648a6ea6 100644 --- a/include/freetype/freetype.h +++ b/include/freetype/freetype.h @@ -4,7 +4,7 @@ /* */ /* FreeType high-level API and common types (specification only). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/ftadvanc.h b/include/freetype/ftadvanc.h index dea96e0db..f78e8b1a9 100644 --- a/include/freetype/ftadvanc.h +++ b/include/freetype/ftadvanc.h @@ -4,7 +4,7 @@ /* */ /* Quick computation of advance widths (specification only). */ /* */ -/* Copyright 2008-2017 by */ +/* Copyright 2008-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/ftbbox.h b/include/freetype/ftbbox.h index afd99030a..f9eb70b13 100644 --- a/include/freetype/ftbbox.h +++ b/include/freetype/ftbbox.h @@ -4,7 +4,7 @@ /* */ /* FreeType exact bbox computation (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/ftbdf.h b/include/freetype/ftbdf.h index 3d3106bad..1b6dea658 100644 --- a/include/freetype/ftbdf.h +++ b/include/freetype/ftbdf.h @@ -4,7 +4,7 @@ /* */ /* FreeType API for accessing BDF-specific strings (specification). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/ftbitmap.h b/include/freetype/ftbitmap.h index bb778cc0d..a43187cad 100644 --- a/include/freetype/ftbitmap.h +++ b/include/freetype/ftbitmap.h @@ -4,7 +4,7 @@ /* */ /* FreeType utility functions for bitmaps (specification). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/ftbzip2.h b/include/freetype/ftbzip2.h index 9147a790a..6edfa031b 100644 --- a/include/freetype/ftbzip2.h +++ b/include/freetype/ftbzip2.h @@ -4,7 +4,7 @@ /* */ /* Bzip2-compressed stream support. */ /* */ -/* Copyright 2010-2017 by */ +/* Copyright 2010-2018 by */ /* Joel Klinghed. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/ftcache.h b/include/freetype/ftcache.h index 0fd6118b2..52d5f00e0 100644 --- a/include/freetype/ftcache.h +++ b/include/freetype/ftcache.h @@ -4,7 +4,7 @@ /* */ /* FreeType Cache subsystem (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/ftcid.h b/include/freetype/ftcid.h index fb9b0c24c..5e9100a67 100644 --- a/include/freetype/ftcid.h +++ b/include/freetype/ftcid.h @@ -4,7 +4,7 @@ /* */ /* FreeType API for accessing CID font information (specification). */ /* */ -/* Copyright 2007-2017 by */ +/* Copyright 2007-2018 by */ /* Dereg Clegg and Michael Toftdal. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/ftdriver.h b/include/freetype/ftdriver.h index 03fc0a18e..6d51bf896 100644 --- a/include/freetype/ftdriver.h +++ b/include/freetype/ftdriver.h @@ -4,7 +4,7 @@ /* */ /* FreeType API for controlling driver modules (specification only). */ /* */ -/* Copyright 2017 by */ +/* Copyright 2017-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/fterrdef.h b/include/freetype/fterrdef.h index 6a6dc85b8..8ffd346ca 100644 --- a/include/freetype/fterrdef.h +++ b/include/freetype/fterrdef.h @@ -4,7 +4,7 @@ /* */ /* FreeType error codes (specification). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/fterrors.h b/include/freetype/fterrors.h index ae382c419..f6ee5c24e 100644 --- a/include/freetype/fterrors.h +++ b/include/freetype/fterrors.h @@ -4,7 +4,7 @@ /* */ /* FreeType error code handling (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/ftfntfmt.h b/include/freetype/ftfntfmt.h index 337758328..cc86efac2 100644 --- a/include/freetype/ftfntfmt.h +++ b/include/freetype/ftfntfmt.h @@ -4,7 +4,7 @@ /* */ /* Support functions for font formats. */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/ftgasp.h b/include/freetype/ftgasp.h index ce18d6478..9b54fc86a 100644 --- a/include/freetype/ftgasp.h +++ b/include/freetype/ftgasp.h @@ -4,7 +4,7 @@ /* */ /* Access of TrueType's `gasp' table (specification). */ /* */ -/* Copyright 2007-2017 by */ +/* Copyright 2007-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/ftglyph.h b/include/freetype/ftglyph.h index ae527d5a6..5f3fc009c 100644 --- a/include/freetype/ftglyph.h +++ b/include/freetype/ftglyph.h @@ -4,7 +4,7 @@ /* */ /* FreeType convenience functions to handle glyphs (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/ftgxval.h b/include/freetype/ftgxval.h index 97c493c96..8382d5995 100644 --- a/include/freetype/ftgxval.h +++ b/include/freetype/ftgxval.h @@ -4,7 +4,7 @@ /* */ /* FreeType API for validating TrueTypeGX/AAT tables (specification). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* Masatake YAMATO, Redhat K.K, */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/include/freetype/ftgzip.h b/include/freetype/ftgzip.h index ba5482768..db033da0e 100644 --- a/include/freetype/ftgzip.h +++ b/include/freetype/ftgzip.h @@ -4,7 +4,7 @@ /* */ /* Gzip-compressed stream support. */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/ftimage.h b/include/freetype/ftimage.h index 7c41ef45f..79ede1959 100644 --- a/include/freetype/ftimage.h +++ b/include/freetype/ftimage.h @@ -5,7 +5,7 @@ /* FreeType glyph image formats and default raster interface */ /* (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/ftincrem.h b/include/freetype/ftincrem.h index 0204b25a2..44619f941 100644 --- a/include/freetype/ftincrem.h +++ b/include/freetype/ftincrem.h @@ -4,7 +4,7 @@ /* */ /* FreeType incremental loading (specification). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/ftlcdfil.h b/include/freetype/ftlcdfil.h index 37a930523..7dce4e4ea 100644 --- a/include/freetype/ftlcdfil.h +++ b/include/freetype/ftlcdfil.h @@ -5,7 +5,7 @@ /* FreeType API for color filtering of subpixel bitmap glyphs */ /* (specification). */ /* */ -/* Copyright 2006-2017 by */ +/* Copyright 2006-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/ftlist.h b/include/freetype/ftlist.h index 5309cb18b..117473b96 100644 --- a/include/freetype/ftlist.h +++ b/include/freetype/ftlist.h @@ -4,7 +4,7 @@ /* */ /* Generic list support for FreeType (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/ftlzw.h b/include/freetype/ftlzw.h index a82c95e7c..1615912d6 100644 --- a/include/freetype/ftlzw.h +++ b/include/freetype/ftlzw.h @@ -4,7 +4,7 @@ /* */ /* LZW-compressed stream support. */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/ftmac.h b/include/freetype/ftmac.h index a1656eec0..c1e497ca2 100644 --- a/include/freetype/ftmac.h +++ b/include/freetype/ftmac.h @@ -4,7 +4,7 @@ /* */ /* Additional Mac-specific API. */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* Just van Rossum, David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/ftmm.h b/include/freetype/ftmm.h index 49da79606..8502b88af 100644 --- a/include/freetype/ftmm.h +++ b/include/freetype/ftmm.h @@ -4,7 +4,7 @@ /* */ /* FreeType Multiple Master font interface (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/ftmodapi.h b/include/freetype/ftmodapi.h index d62fafbee..a6eb876eb 100644 --- a/include/freetype/ftmodapi.h +++ b/include/freetype/ftmodapi.h @@ -4,7 +4,7 @@ /* */ /* FreeType modules public interface (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/ftmoderr.h b/include/freetype/ftmoderr.h index 7f608375e..e0fc1312b 100644 --- a/include/freetype/ftmoderr.h +++ b/include/freetype/ftmoderr.h @@ -4,7 +4,7 @@ /* */ /* FreeType module error offsets (specification). */ /* */ -/* Copyright 2001-2017 by */ +/* Copyright 2001-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/ftotval.h b/include/freetype/ftotval.h index b5d27cfe7..26731c2b9 100644 --- a/include/freetype/ftotval.h +++ b/include/freetype/ftotval.h @@ -4,7 +4,7 @@ /* */ /* FreeType API for validating OpenType tables (specification). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/ftoutln.h b/include/freetype/ftoutln.h index 5af750948..e9818b3bd 100644 --- a/include/freetype/ftoutln.h +++ b/include/freetype/ftoutln.h @@ -5,7 +5,7 @@ /* Support for the FT_Outline type used to store glyph shapes of */ /* most scalable font formats (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/ftparams.h b/include/freetype/ftparams.h index 9f92daef9..5bafe9397 100644 --- a/include/freetype/ftparams.h +++ b/include/freetype/ftparams.h @@ -4,7 +4,7 @@ /* */ /* FreeType API for possible FT_Parameter tags (specification only). */ /* */ -/* Copyright 2017 by */ +/* Copyright 2017-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/ftpfr.h b/include/freetype/ftpfr.h index f2a6ae934..ce60eb4a8 100644 --- a/include/freetype/ftpfr.h +++ b/include/freetype/ftpfr.h @@ -4,7 +4,7 @@ /* */ /* FreeType API for accessing PFR-specific data (specification only). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/ftrender.h b/include/freetype/ftrender.h index ff05a9fc7..fa8ad22b9 100644 --- a/include/freetype/ftrender.h +++ b/include/freetype/ftrender.h @@ -4,7 +4,7 @@ /* */ /* FreeType renderer modules public interface (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/ftsizes.h b/include/freetype/ftsizes.h index 2f3958a85..72cb08bf2 100644 --- a/include/freetype/ftsizes.h +++ b/include/freetype/ftsizes.h @@ -4,7 +4,7 @@ /* */ /* FreeType size objects management (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/ftsnames.h b/include/freetype/ftsnames.h index fc1d5a91f..8eb8d70ff 100644 --- a/include/freetype/ftsnames.h +++ b/include/freetype/ftsnames.h @@ -7,7 +7,7 @@ /* */ /* This is _not_ used to retrieve glyph names! */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/ftstroke.h b/include/freetype/ftstroke.h index 55f0b82fd..44b6fbe19 100644 --- a/include/freetype/ftstroke.h +++ b/include/freetype/ftstroke.h @@ -4,7 +4,7 @@ /* */ /* FreeType path stroker (specification). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/ftsynth.h b/include/freetype/ftsynth.h index 1863fa238..ff9fb43d9 100644 --- a/include/freetype/ftsynth.h +++ b/include/freetype/ftsynth.h @@ -5,7 +5,7 @@ /* FreeType synthesizing code for emboldening and slanting */ /* (specification). */ /* */ -/* Copyright 2000-2017 by */ +/* Copyright 2000-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/ftsystem.h b/include/freetype/ftsystem.h index 1aa4762ad..f6b1629ef 100644 --- a/include/freetype/ftsystem.h +++ b/include/freetype/ftsystem.h @@ -4,7 +4,7 @@ /* */ /* FreeType low-level system interface definition (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/fttrigon.h b/include/freetype/fttrigon.h index 89f035067..2e3f3f1f7 100644 --- a/include/freetype/fttrigon.h +++ b/include/freetype/fttrigon.h @@ -4,7 +4,7 @@ /* */ /* FreeType trigonometric functions (specification). */ /* */ -/* Copyright 2001-2017 by */ +/* Copyright 2001-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/fttypes.h b/include/freetype/fttypes.h index 8f904cea4..f638c2e54 100644 --- a/include/freetype/fttypes.h +++ b/include/freetype/fttypes.h @@ -4,7 +4,7 @@ /* */ /* FreeType simple types definitions (specification only). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/ftwinfnt.h b/include/freetype/ftwinfnt.h index 449c952d3..461c65b77 100644 --- a/include/freetype/ftwinfnt.h +++ b/include/freetype/ftwinfnt.h @@ -4,7 +4,7 @@ /* */ /* FreeType API for accessing Windows fnt-specific data. */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/internal/autohint.h b/include/freetype/internal/autohint.h index bae83e738..f4d308f68 100644 --- a/include/freetype/internal/autohint.h +++ b/include/freetype/internal/autohint.h @@ -4,7 +4,7 @@ /* */ /* High-level `autohint' module-specific interface (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/internal/cffotypes.h b/include/freetype/internal/cffotypes.h index 6fd1e1c7a..57e7591d4 100644 --- a/include/freetype/internal/cffotypes.h +++ b/include/freetype/internal/cffotypes.h @@ -4,7 +4,7 @@ /* */ /* Basic OpenType/CFF object type definitions (specification). */ /* */ -/* Copyright 2017 by */ +/* Copyright 2017-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/internal/cfftypes.h b/include/freetype/internal/cfftypes.h index 0b9dbdf8d..12d614be3 100644 --- a/include/freetype/internal/cfftypes.h +++ b/include/freetype/internal/cfftypes.h @@ -5,7 +5,7 @@ /* Basic OpenType/CFF type definitions and interface (specification */ /* only). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/internal/ftcalc.h b/include/freetype/internal/ftcalc.h index 8b35f03d8..818a81235 100644 --- a/include/freetype/internal/ftcalc.h +++ b/include/freetype/internal/ftcalc.h @@ -4,7 +4,7 @@ /* */ /* Arithmetic computations (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/internal/ftdebug.h b/include/freetype/internal/ftdebug.h index 5dcd2b174..292a4eedb 100644 --- a/include/freetype/internal/ftdebug.h +++ b/include/freetype/internal/ftdebug.h @@ -4,7 +4,7 @@ /* */ /* Debugging and logging component (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/internal/ftdrv.h b/include/freetype/internal/ftdrv.h index fd8f1c7a7..58dd35a93 100644 --- a/include/freetype/internal/ftdrv.h +++ b/include/freetype/internal/ftdrv.h @@ -4,7 +4,7 @@ /* */ /* FreeType internal font driver interface (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/internal/ftgloadr.h b/include/freetype/internal/ftgloadr.h index f41c3df55..a002fdbfc 100644 --- a/include/freetype/internal/ftgloadr.h +++ b/include/freetype/internal/ftgloadr.h @@ -4,7 +4,7 @@ /* */ /* The FreeType glyph loader (specification). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/internal/ftmemory.h b/include/freetype/internal/ftmemory.h index 7a5459f39..054eaec31 100644 --- a/include/freetype/internal/ftmemory.h +++ b/include/freetype/internal/ftmemory.h @@ -4,7 +4,7 @@ /* */ /* The FreeType memory management macros (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/internal/ftobjs.h b/include/freetype/internal/ftobjs.h index 538f48353..45e55bf0b 100644 --- a/include/freetype/internal/ftobjs.h +++ b/include/freetype/internal/ftobjs.h @@ -4,7 +4,7 @@ /* */ /* The FreeType private base classes (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/internal/ftpic.h b/include/freetype/internal/ftpic.h index 0d43ed20f..5214f0598 100644 --- a/include/freetype/internal/ftpic.h +++ b/include/freetype/internal/ftpic.h @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services (declaration). */ /* */ -/* Copyright 2009-2017 by */ +/* Copyright 2009-2018 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/internal/ftpsprop.h b/include/freetype/internal/ftpsprop.h index cb818dfd4..abbb62862 100644 --- a/include/freetype/internal/ftpsprop.h +++ b/include/freetype/internal/ftpsprop.h @@ -4,7 +4,7 @@ /* */ /* Get and set properties of PostScript drivers (specification). */ /* */ -/* Copyright 2017 by */ +/* Copyright 2017-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/internal/ftrfork.h b/include/freetype/internal/ftrfork.h index 25a44a448..1aca48a0e 100644 --- a/include/freetype/internal/ftrfork.h +++ b/include/freetype/internal/ftrfork.h @@ -4,7 +4,7 @@ /* */ /* Embedded resource forks accessor (specification). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* Masatake YAMATO and Redhat K.K. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/internal/ftserv.h b/include/freetype/internal/ftserv.h index e91d8a7ba..e01c1679b 100644 --- a/include/freetype/internal/ftserv.h +++ b/include/freetype/internal/ftserv.h @@ -4,7 +4,7 @@ /* */ /* The FreeType services (specification only). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/internal/ftstream.h b/include/freetype/internal/ftstream.h index 8acc1bec5..f90002fe7 100644 --- a/include/freetype/internal/ftstream.h +++ b/include/freetype/internal/ftstream.h @@ -4,7 +4,7 @@ /* */ /* Stream handling (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/internal/fttrace.h b/include/freetype/internal/fttrace.h index cc52e089c..8092e41fd 100644 --- a/include/freetype/internal/fttrace.h +++ b/include/freetype/internal/fttrace.h @@ -4,7 +4,7 @@ /* */ /* Tracing handling (specification only). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/internal/ftvalid.h b/include/freetype/internal/ftvalid.h index df6f7c577..cad47a556 100644 --- a/include/freetype/internal/ftvalid.h +++ b/include/freetype/internal/ftvalid.h @@ -4,7 +4,7 @@ /* */ /* FreeType validation support (specification). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/internal/internal.h b/include/freetype/internal/internal.h index 58e766d9f..8f546e443 100644 --- a/include/freetype/internal/internal.h +++ b/include/freetype/internal/internal.h @@ -4,7 +4,7 @@ /* */ /* Internal header files (specification only). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/internal/psaux.h b/include/freetype/internal/psaux.h index 80c4465f4..f77380d25 100644 --- a/include/freetype/internal/psaux.h +++ b/include/freetype/internal/psaux.h @@ -5,7 +5,7 @@ /* Auxiliary functions and data structures related to PostScript fonts */ /* (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/internal/pshints.h b/include/freetype/internal/pshints.h index 49116eb44..d29314ec2 100644 --- a/include/freetype/internal/pshints.h +++ b/include/freetype/internal/pshints.h @@ -6,7 +6,7 @@ /* recorders (specification only). These are used to support native */ /* T1/T2 hints in the `type1', `cid', and `cff' font drivers. */ /* */ -/* Copyright 2001-2017 by */ +/* Copyright 2001-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/internal/services/svbdf.h b/include/freetype/internal/services/svbdf.h index eeebf67da..4a9ec2007 100644 --- a/include/freetype/internal/services/svbdf.h +++ b/include/freetype/internal/services/svbdf.h @@ -4,7 +4,7 @@ /* */ /* The FreeType BDF services (specification). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/internal/services/svcfftl.h b/include/freetype/internal/services/svcfftl.h index 851bcde3a..db623e684 100644 --- a/include/freetype/internal/services/svcfftl.h +++ b/include/freetype/internal/services/svcfftl.h @@ -4,7 +4,7 @@ /* */ /* The FreeType CFF tables loader service (specification). */ /* */ -/* Copyright 2017 by */ +/* Copyright 2017-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/internal/services/svcid.h b/include/freetype/internal/services/svcid.h index cce94d8df..cb59ac6a2 100644 --- a/include/freetype/internal/services/svcid.h +++ b/include/freetype/internal/services/svcid.h @@ -4,7 +4,7 @@ /* */ /* The FreeType CID font services (specification). */ /* */ -/* Copyright 2007-2017 by */ +/* Copyright 2007-2018 by */ /* Derek Clegg and Michael Toftdal. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/internal/services/svfntfmt.h b/include/freetype/internal/services/svfntfmt.h index 376d9255b..3b732be1a 100644 --- a/include/freetype/internal/services/svfntfmt.h +++ b/include/freetype/internal/services/svfntfmt.h @@ -4,7 +4,7 @@ /* */ /* The FreeType font format service (specification only). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/internal/services/svgldict.h b/include/freetype/internal/services/svgldict.h index 3371c6b86..f1a68e311 100644 --- a/include/freetype/internal/services/svgldict.h +++ b/include/freetype/internal/services/svgldict.h @@ -4,7 +4,7 @@ /* */ /* The FreeType glyph dictionary services (specification). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/internal/services/svgxval.h b/include/freetype/internal/services/svgxval.h index 71bfa97af..ed79ebeaa 100644 --- a/include/freetype/internal/services/svgxval.h +++ b/include/freetype/internal/services/svgxval.h @@ -4,7 +4,7 @@ /* */ /* FreeType API for validating TrueTypeGX/AAT tables (specification). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/include/freetype/internal/services/svkern.h b/include/freetype/internal/services/svkern.h index b8344e96e..c7e8f6ef2 100644 --- a/include/freetype/internal/services/svkern.h +++ b/include/freetype/internal/services/svkern.h @@ -4,7 +4,7 @@ /* */ /* The FreeType Kerning service (specification). */ /* */ -/* Copyright 2006-2017 by */ +/* Copyright 2006-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/internal/services/svmetric.h b/include/freetype/internal/services/svmetric.h index 1f7d5ddd0..abaacddbb 100644 --- a/include/freetype/internal/services/svmetric.h +++ b/include/freetype/internal/services/svmetric.h @@ -4,7 +4,7 @@ /* */ /* The FreeType services for metrics variations (specification). */ /* */ -/* Copyright 2016-2017 by */ +/* Copyright 2016-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/internal/services/svmm.h b/include/freetype/internal/services/svmm.h index a92ae345b..bcbb38e2c 100644 --- a/include/freetype/internal/services/svmm.h +++ b/include/freetype/internal/services/svmm.h @@ -4,7 +4,7 @@ /* */ /* The FreeType Multiple Masters and GX var services (specification). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/internal/services/svotval.h b/include/freetype/internal/services/svotval.h index ac84abee4..31294296a 100644 --- a/include/freetype/internal/services/svotval.h +++ b/include/freetype/internal/services/svotval.h @@ -4,7 +4,7 @@ /* */ /* The FreeType OpenType validation service (specification). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/internal/services/svpfr.h b/include/freetype/internal/services/svpfr.h index c9a182fe3..e65d57e91 100644 --- a/include/freetype/internal/services/svpfr.h +++ b/include/freetype/internal/services/svpfr.h @@ -4,7 +4,7 @@ /* */ /* Internal PFR service functions (specification). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/internal/services/svpostnm.h b/include/freetype/internal/services/svpostnm.h index 022cdec19..4a49d8b05 100644 --- a/include/freetype/internal/services/svpostnm.h +++ b/include/freetype/internal/services/svpostnm.h @@ -4,7 +4,7 @@ /* */ /* The FreeType PostScript name services (specification). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/internal/services/svprop.h b/include/freetype/internal/services/svprop.h index eb2d4eed1..adc0bcf43 100644 --- a/include/freetype/internal/services/svprop.h +++ b/include/freetype/internal/services/svprop.h @@ -4,7 +4,7 @@ /* */ /* The FreeType property service (specification). */ /* */ -/* Copyright 2012-2017 by */ +/* Copyright 2012-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/internal/services/svpscmap.h b/include/freetype/internal/services/svpscmap.h index b32122e5d..5589575b9 100644 --- a/include/freetype/internal/services/svpscmap.h +++ b/include/freetype/internal/services/svpscmap.h @@ -4,7 +4,7 @@ /* */ /* The FreeType PostScript charmap service (specification). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/internal/services/svpsinfo.h b/include/freetype/internal/services/svpsinfo.h index 0220ce529..408f406df 100644 --- a/include/freetype/internal/services/svpsinfo.h +++ b/include/freetype/internal/services/svpsinfo.h @@ -4,7 +4,7 @@ /* */ /* The FreeType PostScript info service (specification). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/internal/services/svsfnt.h b/include/freetype/internal/services/svsfnt.h index 49d18e43e..e8b37bc47 100644 --- a/include/freetype/internal/services/svsfnt.h +++ b/include/freetype/internal/services/svsfnt.h @@ -4,7 +4,7 @@ /* */ /* The FreeType SFNT table loading service (specification). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/internal/services/svttcmap.h b/include/freetype/internal/services/svttcmap.h index 30f7feec7..cd0e6fda6 100644 --- a/include/freetype/internal/services/svttcmap.h +++ b/include/freetype/internal/services/svttcmap.h @@ -4,7 +4,7 @@ /* */ /* The FreeType TrueType/sfnt cmap extra information service. */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* Masatake YAMATO, Redhat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/include/freetype/internal/services/svtteng.h b/include/freetype/internal/services/svtteng.h index e4b368ad4..92e3c541f 100644 --- a/include/freetype/internal/services/svtteng.h +++ b/include/freetype/internal/services/svtteng.h @@ -4,7 +4,7 @@ /* */ /* The FreeType TrueType engine query service (specification). */ /* */ -/* Copyright 2006-2017 by */ +/* Copyright 2006-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/internal/services/svttglyf.h b/include/freetype/internal/services/svttglyf.h index b7793059f..16fac1ca1 100644 --- a/include/freetype/internal/services/svttglyf.h +++ b/include/freetype/internal/services/svttglyf.h @@ -4,7 +4,7 @@ /* */ /* The FreeType TrueType glyph service. */ /* */ -/* Copyright 2007-2017 by */ +/* Copyright 2007-2018 by */ /* David Turner. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/internal/services/svwinfnt.h b/include/freetype/internal/services/svwinfnt.h index c94b7e107..80d481cbd 100644 --- a/include/freetype/internal/services/svwinfnt.h +++ b/include/freetype/internal/services/svwinfnt.h @@ -4,7 +4,7 @@ /* */ /* The FreeType Windows FNT/FONT service (specification). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/internal/sfnt.h b/include/freetype/internal/sfnt.h index b8667a003..fb1e327ae 100644 --- a/include/freetype/internal/sfnt.h +++ b/include/freetype/internal/sfnt.h @@ -4,7 +4,7 @@ /* */ /* High-level `sfnt' driver interface (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/internal/t1types.h b/include/freetype/internal/t1types.h index b2e35d42d..2118e3367 100644 --- a/include/freetype/internal/t1types.h +++ b/include/freetype/internal/t1types.h @@ -5,7 +5,7 @@ /* Basic Type1/Type2 type definitions and interface (specification */ /* only). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/internal/tttypes.h b/include/freetype/internal/tttypes.h index b8a189d9a..10dd336a8 100644 --- a/include/freetype/internal/tttypes.h +++ b/include/freetype/internal/tttypes.h @@ -5,7 +5,7 @@ /* Basic SFNT/TrueType type definitions and interface (specification */ /* only). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/t1tables.h b/include/freetype/t1tables.h index 940b4a06b..3503c2616 100644 --- a/include/freetype/t1tables.h +++ b/include/freetype/t1tables.h @@ -5,7 +5,7 @@ /* Basic Type 1/Type 2 tables definitions and interface (specification */ /* only). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/ttnameid.h b/include/freetype/ttnameid.h index b4193009e..8605183dc 100644 --- a/include/freetype/ttnameid.h +++ b/include/freetype/ttnameid.h @@ -4,7 +4,7 @@ /* */ /* TrueType name ID definitions (specification only). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/tttables.h b/include/freetype/tttables.h index 58312044c..ce6a61779 100644 --- a/include/freetype/tttables.h +++ b/include/freetype/tttables.h @@ -5,7 +5,7 @@ /* Basic SFNT/TrueType tables definitions and interface */ /* (specification only). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/tttags.h b/include/freetype/tttags.h index b7d3bac0f..e5cee68a1 100644 --- a/include/freetype/tttags.h +++ b/include/freetype/tttags.h @@ -4,7 +4,7 @@ /* */ /* Tags for TrueType and OpenType tables (specification only). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/ft2build.h b/include/ft2build.h index e7d808f3f..e7ce99bc9 100644 --- a/include/ft2build.h +++ b/include/ft2build.h @@ -4,7 +4,7 @@ /* */ /* FreeType 2 build and setup macros. */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/modules.cfg b/modules.cfg index 56a2340e5..6ce0f3edb 100644 --- a/modules.cfg +++ b/modules.cfg @@ -1,6 +1,6 @@ # modules.cfg # -# Copyright 2005-2017 by +# Copyright 2005-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/Jamfile b/src/Jamfile index c0bc02249..562480c94 100644 --- a/src/Jamfile +++ b/src/Jamfile @@ -1,6 +1,6 @@ # FreeType 2 src Jamfile # -# Copyright 2001-2017 by +# Copyright 2001-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/autofit/Jamfile b/src/autofit/Jamfile index 9a3dc8a4f..01b866ec6 100644 --- a/src/autofit/Jamfile +++ b/src/autofit/Jamfile @@ -1,6 +1,6 @@ # FreeType 2 src/autofit Jamfile # -# Copyright 2003-2017 by +# Copyright 2003-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/autofit/afangles.c b/src/autofit/afangles.c index ccdae8413..c65a3ae23 100644 --- a/src/autofit/afangles.c +++ b/src/autofit/afangles.c @@ -5,7 +5,7 @@ /* Routines used to compute vector angles with limited accuracy */ /* and very high speed. It also contains sorting routines (body). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/autofit/afblue.c b/src/autofit/afblue.c index fedeacf79..61ab7957f 100644 --- a/src/autofit/afblue.c +++ b/src/autofit/afblue.c @@ -7,7 +7,7 @@ /* */ /* Auto-fitter data for blue strings (body). */ /* */ -/* Copyright 2013-2017 by */ +/* Copyright 2013-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/autofit/afblue.cin b/src/autofit/afblue.cin index f9080c54d..4913e2eb6 100644 --- a/src/autofit/afblue.cin +++ b/src/autofit/afblue.cin @@ -4,7 +4,7 @@ /* */ /* Auto-fitter data for blue strings (body). */ /* */ -/* Copyright 2013-2017 by */ +/* Copyright 2013-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/autofit/afblue.dat b/src/autofit/afblue.dat index f62eb82a1..d3cc4284b 100644 --- a/src/autofit/afblue.dat +++ b/src/autofit/afblue.dat @@ -2,7 +2,7 @@ // // Auto-fitter data for blue strings. // -// Copyright 2013-2017 by +// Copyright 2013-2018 by // David Turner, Robert Wilhelm, and Werner Lemberg. // // This file is part of the FreeType project, and may only be used, diff --git a/src/autofit/afblue.h b/src/autofit/afblue.h index 99ef51cd4..56b591aa8 100644 --- a/src/autofit/afblue.h +++ b/src/autofit/afblue.h @@ -7,7 +7,7 @@ /* */ /* Auto-fitter data for blue strings (specification). */ /* */ -/* Copyright 2013-2017 by */ +/* Copyright 2013-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/autofit/afblue.hin b/src/autofit/afblue.hin index 268bcbc53..682147cb3 100644 --- a/src/autofit/afblue.hin +++ b/src/autofit/afblue.hin @@ -4,7 +4,7 @@ /* */ /* Auto-fitter data for blue strings (specification). */ /* */ -/* Copyright 2013-2017 by */ +/* Copyright 2013-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/autofit/afcjk.c b/src/autofit/afcjk.c index 2973b098e..21b6bffa3 100644 --- a/src/autofit/afcjk.c +++ b/src/autofit/afcjk.c @@ -4,7 +4,7 @@ /* */ /* Auto-fitter hinting routines for CJK writing system (body). */ /* */ -/* Copyright 2006-2017 by */ +/* Copyright 2006-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/autofit/afcjk.h b/src/autofit/afcjk.h index 84f892f90..d229c0c9c 100644 --- a/src/autofit/afcjk.h +++ b/src/autofit/afcjk.h @@ -4,7 +4,7 @@ /* */ /* Auto-fitter hinting routines for CJK writing system (specification). */ /* */ -/* Copyright 2006-2017 by */ +/* Copyright 2006-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/autofit/afcover.h b/src/autofit/afcover.h index 1b18c666a..6eeb8fc9f 100644 --- a/src/autofit/afcover.h +++ b/src/autofit/afcover.h @@ -4,7 +4,7 @@ /* */ /* Auto-fitter coverages (specification only). */ /* */ -/* Copyright 2013-2017 by */ +/* Copyright 2013-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/autofit/afdummy.c b/src/autofit/afdummy.c index 61c32db5b..f30c517cb 100644 --- a/src/autofit/afdummy.c +++ b/src/autofit/afdummy.c @@ -5,7 +5,7 @@ /* Auto-fitter dummy routines to be used if no hinting should be */ /* performed (body). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/autofit/afdummy.h b/src/autofit/afdummy.h index ebaa7d76e..b382acd92 100644 --- a/src/autofit/afdummy.h +++ b/src/autofit/afdummy.h @@ -5,7 +5,7 @@ /* Auto-fitter dummy routines to be used if no hinting should be */ /* performed (specification). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/autofit/aferrors.h b/src/autofit/aferrors.h index dde182f3c..e5de54360 100644 --- a/src/autofit/aferrors.h +++ b/src/autofit/aferrors.h @@ -4,7 +4,7 @@ /* */ /* Autofitter error codes (specification only). */ /* */ -/* Copyright 2005-2017 by */ +/* Copyright 2005-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/autofit/afglobal.c b/src/autofit/afglobal.c index 85bef001f..3d09c53e8 100644 --- a/src/autofit/afglobal.c +++ b/src/autofit/afglobal.c @@ -4,7 +4,7 @@ /* */ /* Auto-fitter routines to compute global hinting values (body). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/autofit/afglobal.h b/src/autofit/afglobal.h index de6142ea2..489ed46d9 100644 --- a/src/autofit/afglobal.h +++ b/src/autofit/afglobal.h @@ -5,7 +5,7 @@ /* Auto-fitter routines to compute global hinting values */ /* (specification). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/autofit/afhints.c b/src/autofit/afhints.c index 5b70c6d3a..0666dbc8e 100644 --- a/src/autofit/afhints.c +++ b/src/autofit/afhints.c @@ -4,7 +4,7 @@ /* */ /* Auto-fitter hinting routines (body). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/autofit/afhints.h b/src/autofit/afhints.h index b88c655f8..3326ebc44 100644 --- a/src/autofit/afhints.h +++ b/src/autofit/afhints.h @@ -4,7 +4,7 @@ /* */ /* Auto-fitter hinting routines (specification). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/autofit/afindic.c b/src/autofit/afindic.c index 23be46ed5..dfbea5f34 100644 --- a/src/autofit/afindic.c +++ b/src/autofit/afindic.c @@ -4,7 +4,7 @@ /* */ /* Auto-fitter hinting routines for Indic writing system (body). */ /* */ -/* Copyright 2007-2017 by */ +/* Copyright 2007-2018 by */ /* Rahul Bhalerao , . */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/autofit/afindic.h b/src/autofit/afindic.h index ec9e26316..5688738e6 100644 --- a/src/autofit/afindic.h +++ b/src/autofit/afindic.h @@ -5,7 +5,7 @@ /* Auto-fitter hinting routines for Indic writing system */ /* (specification). */ /* */ -/* Copyright 2007-2017 by */ +/* Copyright 2007-2018 by */ /* Rahul Bhalerao , . */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/autofit/aflatin.c b/src/autofit/aflatin.c index 02b3b8bbd..9f1b54056 100644 --- a/src/autofit/aflatin.c +++ b/src/autofit/aflatin.c @@ -4,7 +4,7 @@ /* */ /* Auto-fitter hinting routines for latin writing system (body). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/autofit/aflatin.h b/src/autofit/aflatin.h index d80e125dd..432cccce4 100644 --- a/src/autofit/aflatin.h +++ b/src/autofit/aflatin.h @@ -5,7 +5,7 @@ /* Auto-fitter hinting routines for latin writing system */ /* (specification). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/autofit/aflatin2.c b/src/autofit/aflatin2.c index fb4244511..5c7137811 100644 --- a/src/autofit/aflatin2.c +++ b/src/autofit/aflatin2.c @@ -9,7 +9,7 @@ /* */ /* Auto-fitter hinting routines for latin writing system (body). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/autofit/aflatin2.h b/src/autofit/aflatin2.h index 2d0b154f5..0129dc707 100644 --- a/src/autofit/aflatin2.h +++ b/src/autofit/aflatin2.h @@ -10,7 +10,7 @@ /* Auto-fitter hinting routines for latin writing system */ /* (specification). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/autofit/afloader.c b/src/autofit/afloader.c index 067ebd17f..a55550b33 100644 --- a/src/autofit/afloader.c +++ b/src/autofit/afloader.c @@ -4,7 +4,7 @@ /* */ /* Auto-fitter glyph loading routines (body). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/autofit/afloader.h b/src/autofit/afloader.h index 2578abed1..d4d72d158 100644 --- a/src/autofit/afloader.h +++ b/src/autofit/afloader.h @@ -4,7 +4,7 @@ /* */ /* Auto-fitter glyph loading routines (specification). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/autofit/afmodule.c b/src/autofit/afmodule.c index 666146750..dcaa17a27 100644 --- a/src/autofit/afmodule.c +++ b/src/autofit/afmodule.c @@ -4,7 +4,7 @@ /* */ /* Auto-fitter module implementation (body). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/autofit/afmodule.h b/src/autofit/afmodule.h index 0571d14d5..56f64eaf2 100644 --- a/src/autofit/afmodule.h +++ b/src/autofit/afmodule.h @@ -4,7 +4,7 @@ /* */ /* Auto-fitter module implementation (specification). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/autofit/afpic.c b/src/autofit/afpic.c index 3125e03e2..d48d016a0 100644 --- a/src/autofit/afpic.c +++ b/src/autofit/afpic.c @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for autofit module. */ /* */ -/* Copyright 2009-2017 by */ +/* Copyright 2009-2018 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/autofit/afpic.h b/src/autofit/afpic.h index 8cd339212..0c7345678 100644 --- a/src/autofit/afpic.h +++ b/src/autofit/afpic.h @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for autofit module. */ /* */ -/* Copyright 2009-2017 by */ +/* Copyright 2009-2018 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/autofit/afranges.c b/src/autofit/afranges.c index 7f37eea1e..1355c5e7c 100644 --- a/src/autofit/afranges.c +++ b/src/autofit/afranges.c @@ -4,7 +4,7 @@ /* */ /* Auto-fitter Unicode script ranges (body). */ /* */ -/* Copyright 2013-2017 by */ +/* Copyright 2013-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/autofit/afranges.h b/src/autofit/afranges.h index 72d9eaad2..ba3b5e7cc 100644 --- a/src/autofit/afranges.h +++ b/src/autofit/afranges.h @@ -4,7 +4,7 @@ /* */ /* Auto-fitter Unicode script ranges (specification). */ /* */ -/* Copyright 2013-2017 by */ +/* Copyright 2013-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/autofit/afscript.h b/src/autofit/afscript.h index cb815dbb4..6ac193f6a 100644 --- a/src/autofit/afscript.h +++ b/src/autofit/afscript.h @@ -4,7 +4,7 @@ /* */ /* Auto-fitter scripts (specification only). */ /* */ -/* Copyright 2013-2017 by */ +/* Copyright 2013-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/autofit/afshaper.c b/src/autofit/afshaper.c index 8ee9ba1a6..f30828173 100644 --- a/src/autofit/afshaper.c +++ b/src/autofit/afshaper.c @@ -4,7 +4,7 @@ /* */ /* HarfBuzz interface for accessing OpenType features (body). */ /* */ -/* Copyright 2013-2017 by */ +/* Copyright 2013-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/autofit/afshaper.h b/src/autofit/afshaper.h index 9185d1900..7efd9f6a4 100644 --- a/src/autofit/afshaper.h +++ b/src/autofit/afshaper.h @@ -4,7 +4,7 @@ /* */ /* HarfBuzz interface for accessing OpenType features (specification). */ /* */ -/* Copyright 2013-2017 by */ +/* Copyright 2013-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/autofit/afstyles.h b/src/autofit/afstyles.h index 281559eea..e2688b3fc 100644 --- a/src/autofit/afstyles.h +++ b/src/autofit/afstyles.h @@ -4,7 +4,7 @@ /* */ /* Auto-fitter styles (specification only). */ /* */ -/* Copyright 2013-2017 by */ +/* Copyright 2013-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/autofit/aftypes.h b/src/autofit/aftypes.h index 718dab70b..a50013439 100644 --- a/src/autofit/aftypes.h +++ b/src/autofit/aftypes.h @@ -4,7 +4,7 @@ /* */ /* Auto-fitter types (specification only). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/autofit/afwarp.c b/src/autofit/afwarp.c index f99aa6d98..2a75ea7b3 100644 --- a/src/autofit/afwarp.c +++ b/src/autofit/afwarp.c @@ -4,7 +4,7 @@ /* */ /* Auto-fitter warping algorithm (body). */ /* */ -/* Copyright 2006-2017 by */ +/* Copyright 2006-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/autofit/afwarp.h b/src/autofit/afwarp.h index 2e85cbd85..520b1be90 100644 --- a/src/autofit/afwarp.h +++ b/src/autofit/afwarp.h @@ -4,7 +4,7 @@ /* */ /* Auto-fitter warping algorithm (specification). */ /* */ -/* Copyright 2006-2017 by */ +/* Copyright 2006-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/autofit/afwrtsys.h b/src/autofit/afwrtsys.h index 86749a2a8..4675f3242 100644 --- a/src/autofit/afwrtsys.h +++ b/src/autofit/afwrtsys.h @@ -4,7 +4,7 @@ /* */ /* Auto-fitter writing systems (specification only). */ /* */ -/* Copyright 2013-2017 by */ +/* Copyright 2013-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/autofit/autofit.c b/src/autofit/autofit.c index bbedad7b5..c1605160a 100644 --- a/src/autofit/autofit.c +++ b/src/autofit/autofit.c @@ -4,7 +4,7 @@ /* */ /* Auto-fitter module (body). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/autofit/module.mk b/src/autofit/module.mk index c4e249b6f..ff05f83e7 100644 --- a/src/autofit/module.mk +++ b/src/autofit/module.mk @@ -3,7 +3,7 @@ # -# Copyright 2003-2017 by +# Copyright 2003-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/autofit/rules.mk b/src/autofit/rules.mk index ec4e1302d..75171b412 100644 --- a/src/autofit/rules.mk +++ b/src/autofit/rules.mk @@ -3,7 +3,7 @@ # -# Copyright 2003-2017 by +# Copyright 2003-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/base/Jamfile b/src/base/Jamfile index 893c9fa6d..2b47b8a24 100644 --- a/src/base/Jamfile +++ b/src/base/Jamfile @@ -1,6 +1,6 @@ # FreeType 2 src/base Jamfile # -# Copyright 2001-2017 by +# Copyright 2001-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/base/basepic.c b/src/base/basepic.c index 57fb8169a..bc8040644 100644 --- a/src/base/basepic.c +++ b/src/base/basepic.c @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for base. */ /* */ -/* Copyright 2009-2017 by */ +/* Copyright 2009-2018 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/base/basepic.h b/src/base/basepic.h index 258d4ce2b..492d1ede5 100644 --- a/src/base/basepic.h +++ b/src/base/basepic.h @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for base. */ /* */ -/* Copyright 2009-2017 by */ +/* Copyright 2009-2018 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/base/ftadvanc.c b/src/base/ftadvanc.c index d066142be..230c84d6a 100644 --- a/src/base/ftadvanc.c +++ b/src/base/ftadvanc.c @@ -4,7 +4,7 @@ /* */ /* Quick computation of advance widths (body). */ /* */ -/* Copyright 2008-2017 by */ +/* Copyright 2008-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/base/ftapi.c b/src/base/ftapi.c index 4262d37e3..32d6e95d1 100644 --- a/src/base/ftapi.c +++ b/src/base/ftapi.c @@ -4,7 +4,7 @@ /* */ /* The FreeType compatibility functions (body). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/base/ftbase.c b/src/base/ftbase.c index a6dd6f5b1..a1bdbaf6e 100644 --- a/src/base/ftbase.c +++ b/src/base/ftbase.c @@ -4,7 +4,7 @@ /* */ /* Single object library component (body only). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/base/ftbase.h b/src/base/ftbase.h index a4493cc06..7e8cfad95 100644 --- a/src/base/ftbase.h +++ b/src/base/ftbase.h @@ -4,7 +4,7 @@ /* */ /* Private functions used in the `base' module (specification). */ /* */ -/* Copyright 2008-2017 by */ +/* Copyright 2008-2018 by */ /* David Turner, Robert Wilhelm, Werner Lemberg, and suzuki toshiya. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/base/ftbbox.c b/src/base/ftbbox.c index 6e19da63c..151e85c97 100644 --- a/src/base/ftbbox.c +++ b/src/base/ftbbox.c @@ -4,7 +4,7 @@ /* */ /* FreeType bbox computation (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used */ diff --git a/src/base/ftbdf.c b/src/base/ftbdf.c index 40f0ca2bb..c4ea502fb 100644 --- a/src/base/ftbdf.c +++ b/src/base/ftbdf.c @@ -4,7 +4,7 @@ /* */ /* FreeType API for accessing BDF-specific strings (body). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/base/ftbitmap.c b/src/base/ftbitmap.c index 9079081d4..93efb0944 100644 --- a/src/base/ftbitmap.c +++ b/src/base/ftbitmap.c @@ -4,7 +4,7 @@ /* */ /* FreeType utility functions for bitmaps (body). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/base/ftcalc.c b/src/base/ftcalc.c index 00d63c6e6..f4ff45f8e 100644 --- a/src/base/ftcalc.c +++ b/src/base/ftcalc.c @@ -4,7 +4,7 @@ /* */ /* Arithmetic computations (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/base/ftcid.c b/src/base/ftcid.c index 398396b84..f5184649b 100644 --- a/src/base/ftcid.c +++ b/src/base/ftcid.c @@ -4,7 +4,7 @@ /* */ /* FreeType API for accessing CID font information. */ /* */ -/* Copyright 2007-2017 by */ +/* Copyright 2007-2018 by */ /* Derek Clegg and Michael Toftdal. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/base/ftdbgmem.c b/src/base/ftdbgmem.c index 560b41e95..c33d8acb4 100644 --- a/src/base/ftdbgmem.c +++ b/src/base/ftdbgmem.c @@ -4,7 +4,7 @@ /* */ /* Memory debugger (body). */ /* */ -/* Copyright 2001-2017 by */ +/* Copyright 2001-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/base/ftdebug.c b/src/base/ftdebug.c index dbcf585c2..fe2630910 100644 --- a/src/base/ftdebug.c +++ b/src/base/ftdebug.c @@ -4,7 +4,7 @@ /* */ /* Debugging and logging component (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/base/ftfntfmt.c b/src/base/ftfntfmt.c index dcbeba005..a2900ceb0 100644 --- a/src/base/ftfntfmt.c +++ b/src/base/ftfntfmt.c @@ -4,7 +4,7 @@ /* */ /* FreeType utility file for font formats (body). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/base/ftfstype.c b/src/base/ftfstype.c index cec4fb302..e6cdf6e2e 100644 --- a/src/base/ftfstype.c +++ b/src/base/ftfstype.c @@ -4,7 +4,7 @@ /* */ /* FreeType utility file to access FSType data (body). */ /* */ -/* Copyright 2008-2017 by */ +/* Copyright 2008-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/base/ftgasp.c b/src/base/ftgasp.c index 477b72558..4f80bba63 100644 --- a/src/base/ftgasp.c +++ b/src/base/ftgasp.c @@ -4,7 +4,7 @@ /* */ /* Access of TrueType's `gasp' table (body). */ /* */ -/* Copyright 2007-2017 by */ +/* Copyright 2007-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/base/ftgloadr.c b/src/base/ftgloadr.c index 8134003b4..47202496b 100644 --- a/src/base/ftgloadr.c +++ b/src/base/ftgloadr.c @@ -4,7 +4,7 @@ /* */ /* The FreeType glyph loader (body). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/base/ftglyph.c b/src/base/ftglyph.c index 3f78a8c36..6759aa25d 100644 --- a/src/base/ftglyph.c +++ b/src/base/ftglyph.c @@ -4,7 +4,7 @@ /* */ /* FreeType convenience functions to handle glyphs (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/base/ftgxval.c b/src/base/ftgxval.c index ff24d336d..19e2d6acb 100644 --- a/src/base/ftgxval.c +++ b/src/base/ftgxval.c @@ -4,7 +4,7 @@ /* */ /* FreeType API for validating TrueTypeGX/AAT tables (body). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* Masatake YAMATO, Redhat K.K, */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/src/base/ftinit.c b/src/base/ftinit.c index b3b08fa54..1fa472109 100644 --- a/src/base/ftinit.c +++ b/src/base/ftinit.c @@ -4,7 +4,7 @@ /* */ /* FreeType initialization layer (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/base/ftlcdfil.c b/src/base/ftlcdfil.c index 4971f93b4..5c38911a9 100644 --- a/src/base/ftlcdfil.c +++ b/src/base/ftlcdfil.c @@ -4,7 +4,7 @@ /* */ /* FreeType API for color filtering of subpixel bitmap glyphs (body). */ /* */ -/* Copyright 2006-2017 by */ +/* Copyright 2006-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/base/ftmac.c b/src/base/ftmac.c index 4e76585e5..fd4c0cc27 100644 --- a/src/base/ftmac.c +++ b/src/base/ftmac.c @@ -8,7 +8,7 @@ /* This file is for Mac OS X only; see builds/mac/ftoldmac.c for */ /* classic platforms built by MPW. */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* Just van Rossum, David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/base/ftmm.c b/src/base/ftmm.c index 6a42df6e9..c8b6d1361 100644 --- a/src/base/ftmm.c +++ b/src/base/ftmm.c @@ -4,7 +4,7 @@ /* */ /* Multiple Master font support (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c index 1d36860e7..8d07e35ae 100644 --- a/src/base/ftobjs.c +++ b/src/base/ftobjs.c @@ -4,7 +4,7 @@ /* */ /* The FreeType private base classes (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/base/ftotval.c b/src/base/ftotval.c index 5fa098691..a2944a795 100644 --- a/src/base/ftotval.c +++ b/src/base/ftotval.c @@ -4,7 +4,7 @@ /* */ /* FreeType API for validating OpenType tables (body). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/base/ftoutln.c b/src/base/ftoutln.c index cbbcb859a..9c29ade92 100644 --- a/src/base/ftoutln.c +++ b/src/base/ftoutln.c @@ -4,7 +4,7 @@ /* */ /* FreeType outline management (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/base/ftpatent.c b/src/base/ftpatent.c index 9900f99bf..e23ee2e3f 100644 --- a/src/base/ftpatent.c +++ b/src/base/ftpatent.c @@ -5,7 +5,7 @@ /* FreeType API for checking patented TrueType bytecode instructions */ /* (body). Obsolete, retained for backward compatibility. */ /* */ -/* Copyright 2007-2017 by */ +/* Copyright 2007-2018 by */ /* David Turner. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/base/ftpfr.c b/src/base/ftpfr.c index 5cc0b7072..bfe13520e 100644 --- a/src/base/ftpfr.c +++ b/src/base/ftpfr.c @@ -4,7 +4,7 @@ /* */ /* FreeType API for accessing PFR-specific data (body). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/base/ftpic.c b/src/base/ftpic.c index 0f84fddc9..1492e1809 100644 --- a/src/base/ftpic.c +++ b/src/base/ftpic.c @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services (body). */ /* */ -/* Copyright 2009-2017 by */ +/* Copyright 2009-2018 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/base/ftpsprop.c b/src/base/ftpsprop.c index 1eace3eb6..459b5e605 100644 --- a/src/base/ftpsprop.c +++ b/src/base/ftpsprop.c @@ -5,7 +5,7 @@ /* Get and set properties of PostScript drivers (body). */ /* See `ftdriver.h' for available properties. */ /* */ -/* Copyright 2017 by */ +/* Copyright 2017-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/base/ftrfork.c b/src/base/ftrfork.c index b86cf8c82..c3a2b9151 100644 --- a/src/base/ftrfork.c +++ b/src/base/ftrfork.c @@ -4,7 +4,7 @@ /* */ /* Embedded resource forks accessor (body). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* Masatake YAMATO and Redhat K.K. */ /* */ /* FT_Raccess_Get_HeaderInfo() and raccess_guess_darwin_hfsplus() are */ diff --git a/src/base/ftsnames.c b/src/base/ftsnames.c index 360945008..90ea1e2be 100644 --- a/src/base/ftsnames.c +++ b/src/base/ftsnames.c @@ -7,7 +7,7 @@ /* */ /* This is _not_ used to retrieve glyph names! */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/base/ftstream.c b/src/base/ftstream.c index a3f8c8b3c..18df7dcfe 100644 --- a/src/base/ftstream.c +++ b/src/base/ftstream.c @@ -4,7 +4,7 @@ /* */ /* I/O stream support (body). */ /* */ -/* Copyright 2000-2017 by */ +/* Copyright 2000-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/base/ftstroke.c b/src/base/ftstroke.c index d32de0d62..6ae181906 100644 --- a/src/base/ftstroke.c +++ b/src/base/ftstroke.c @@ -4,7 +4,7 @@ /* */ /* FreeType path stroker (body). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/base/ftsynth.c b/src/base/ftsynth.c index 5cf386f48..c28346707 100644 --- a/src/base/ftsynth.c +++ b/src/base/ftsynth.c @@ -4,7 +4,7 @@ /* */ /* FreeType synthesizing code for emboldening and slanting (body). */ /* */ -/* Copyright 2000-2017 by */ +/* Copyright 2000-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/base/ftsystem.c b/src/base/ftsystem.c index 324f949a4..6adebdb93 100644 --- a/src/base/ftsystem.c +++ b/src/base/ftsystem.c @@ -4,7 +4,7 @@ /* */ /* ANSI-specific FreeType low-level system interface (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/base/fttrigon.c b/src/base/fttrigon.c index 7a4d17c82..d6dd098c4 100644 --- a/src/base/fttrigon.c +++ b/src/base/fttrigon.c @@ -4,7 +4,7 @@ /* */ /* FreeType trigonometric functions (body). */ /* */ -/* Copyright 2001-2017 by */ +/* Copyright 2001-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/base/fttype1.c b/src/base/fttype1.c index 4d16a6371..aa8f8ccbb 100644 --- a/src/base/fttype1.c +++ b/src/base/fttype1.c @@ -4,7 +4,7 @@ /* */ /* FreeType utility file for PS names support (body). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/base/ftutil.c b/src/base/ftutil.c index 7bd5bee87..4de5f2c14 100644 --- a/src/base/ftutil.c +++ b/src/base/ftutil.c @@ -4,7 +4,7 @@ /* */ /* FreeType utility file for memory and list management (body). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/base/ftwinfnt.c b/src/base/ftwinfnt.c index 05baa02da..11bd28afb 100644 --- a/src/base/ftwinfnt.c +++ b/src/base/ftwinfnt.c @@ -4,7 +4,7 @@ /* */ /* FreeType API for accessing Windows FNT specific info (body). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/base/rules.mk b/src/base/rules.mk index a81ddaaf3..6491f5d8a 100644 --- a/src/base/rules.mk +++ b/src/base/rules.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/bdf/Jamfile b/src/bdf/Jamfile index f382b51db..d9e441c18 100644 --- a/src/bdf/Jamfile +++ b/src/bdf/Jamfile @@ -1,6 +1,6 @@ # FreeType 2 src/bdf Jamfile # -# Copyright 2002-2017 by +# Copyright 2002-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/bzip2/Jamfile b/src/bzip2/Jamfile index f369d4ace..3548eab59 100644 --- a/src/bzip2/Jamfile +++ b/src/bzip2/Jamfile @@ -1,6 +1,6 @@ # FreeType 2 src/bzip2 Jamfile # -# Copyright 2010-2017 by +# Copyright 2010-2018 by # Joel Klinghed # # based on `src/lzw/Jamfile' diff --git a/src/bzip2/ftbzip2.c b/src/bzip2/ftbzip2.c index 7fc71e707..16019485a 100644 --- a/src/bzip2/ftbzip2.c +++ b/src/bzip2/ftbzip2.c @@ -8,7 +8,7 @@ /* parse compressed PCF fonts, as found with many X11 server */ /* distributions. */ /* */ -/* Copyright 2010-2017 by */ +/* Copyright 2010-2018 by */ /* Joel Klinghed. */ /* */ /* based on `src/gzip/ftgzip.c' */ diff --git a/src/bzip2/rules.mk b/src/bzip2/rules.mk index f63ddc4d3..95954d752 100644 --- a/src/bzip2/rules.mk +++ b/src/bzip2/rules.mk @@ -2,7 +2,7 @@ # FreeType 2 BZIP2 support configuration rules # -# Copyright 2010-2017 by +# Copyright 2010-2018 by # Joel Klinghed. # # based on `src/lzw/rules.mk' diff --git a/src/cache/Jamfile b/src/cache/Jamfile index 0880af838..53f4c7b60 100644 --- a/src/cache/Jamfile +++ b/src/cache/Jamfile @@ -1,6 +1,6 @@ # FreeType 2 src/cache Jamfile # -# Copyright 2001-2017 by +# Copyright 2001-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/cache/ftcache.c b/src/cache/ftcache.c index 822618831..1b425af91 100644 --- a/src/cache/ftcache.c +++ b/src/cache/ftcache.c @@ -4,7 +4,7 @@ /* */ /* The FreeType Caching sub-system (body only). */ /* */ -/* Copyright 2000-2017 by */ +/* Copyright 2000-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/cache/ftcbasic.c b/src/cache/ftcbasic.c index e804776ab..994aa1228 100644 --- a/src/cache/ftcbasic.c +++ b/src/cache/ftcbasic.c @@ -4,7 +4,7 @@ /* */ /* The FreeType basic cache interface (body). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/cache/ftccache.c b/src/cache/ftccache.c index 37dc3abb1..12ec585a2 100644 --- a/src/cache/ftccache.c +++ b/src/cache/ftccache.c @@ -4,7 +4,7 @@ /* */ /* The FreeType internal cache interface (body). */ /* */ -/* Copyright 2000-2017 by */ +/* Copyright 2000-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/cache/ftccache.h b/src/cache/ftccache.h index d3c11ce08..859c547e4 100644 --- a/src/cache/ftccache.h +++ b/src/cache/ftccache.h @@ -4,7 +4,7 @@ /* */ /* FreeType internal cache interface (specification). */ /* */ -/* Copyright 2000-2017 by */ +/* Copyright 2000-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/cache/ftccback.h b/src/cache/ftccback.h index 2681e8c02..e51d8d6e5 100644 --- a/src/cache/ftccback.h +++ b/src/cache/ftccback.h @@ -4,7 +4,7 @@ /* */ /* Callback functions of the caching sub-system (specification only). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/cache/ftccmap.c b/src/cache/ftccmap.c index 2fa84979c..d20b0f48f 100644 --- a/src/cache/ftccmap.c +++ b/src/cache/ftccmap.c @@ -4,7 +4,7 @@ /* */ /* FreeType CharMap cache (body) */ /* */ -/* Copyright 2000-2017 by */ +/* Copyright 2000-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/cache/ftcerror.h b/src/cache/ftcerror.h index 84fe52f54..a26cd5935 100644 --- a/src/cache/ftcerror.h +++ b/src/cache/ftcerror.h @@ -4,7 +4,7 @@ /* */ /* Caching sub-system error codes (specification only). */ /* */ -/* Copyright 2001-2017 by */ +/* Copyright 2001-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/cache/ftcglyph.c b/src/cache/ftcglyph.c index d2468f2f4..782cc0ed0 100644 --- a/src/cache/ftcglyph.c +++ b/src/cache/ftcglyph.c @@ -4,7 +4,7 @@ /* */ /* FreeType Glyph Image (FT_Glyph) cache (body). */ /* */ -/* Copyright 2000-2017 by */ +/* Copyright 2000-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/cache/ftcglyph.h b/src/cache/ftcglyph.h index cab58ed31..23c24d223 100644 --- a/src/cache/ftcglyph.h +++ b/src/cache/ftcglyph.h @@ -4,7 +4,7 @@ /* */ /* FreeType abstract glyph cache (specification). */ /* */ -/* Copyright 2000-2017 by */ +/* Copyright 2000-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/cache/ftcimage.c b/src/cache/ftcimage.c index 359f818cc..77a100153 100644 --- a/src/cache/ftcimage.c +++ b/src/cache/ftcimage.c @@ -4,7 +4,7 @@ /* */ /* FreeType Image cache (body). */ /* */ -/* Copyright 2000-2017 by */ +/* Copyright 2000-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/cache/ftcimage.h b/src/cache/ftcimage.h index 14049af9d..24a221053 100644 --- a/src/cache/ftcimage.h +++ b/src/cache/ftcimage.h @@ -4,7 +4,7 @@ /* */ /* FreeType Generic Image cache (specification) */ /* */ -/* Copyright 2000-2017 by */ +/* Copyright 2000-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/cache/ftcmanag.c b/src/cache/ftcmanag.c index edec2b6b5..2bcd9df50 100644 --- a/src/cache/ftcmanag.c +++ b/src/cache/ftcmanag.c @@ -4,7 +4,7 @@ /* */ /* FreeType Cache Manager (body). */ /* */ -/* Copyright 2000-2017 by */ +/* Copyright 2000-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/cache/ftcmanag.h b/src/cache/ftcmanag.h index 556842e13..b4b475535 100644 --- a/src/cache/ftcmanag.h +++ b/src/cache/ftcmanag.h @@ -4,7 +4,7 @@ /* */ /* FreeType Cache Manager (specification). */ /* */ -/* Copyright 2000-2017 by */ +/* Copyright 2000-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/cache/ftcmru.c b/src/cache/ftcmru.c index e293269f2..1087be4d8 100644 --- a/src/cache/ftcmru.c +++ b/src/cache/ftcmru.c @@ -4,7 +4,7 @@ /* */ /* FreeType MRU support (body). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/cache/ftcmru.h b/src/cache/ftcmru.h index c4c330d55..82396b917 100644 --- a/src/cache/ftcmru.h +++ b/src/cache/ftcmru.h @@ -4,7 +4,7 @@ /* */ /* Simple MRU list-cache (specification). */ /* */ -/* Copyright 2000-2017 by */ +/* Copyright 2000-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/cache/ftcsbits.c b/src/cache/ftcsbits.c index 2f9336dec..018f1ecdb 100644 --- a/src/cache/ftcsbits.c +++ b/src/cache/ftcsbits.c @@ -4,7 +4,7 @@ /* */ /* FreeType sbits manager (body). */ /* */ -/* Copyright 2000-2017 by */ +/* Copyright 2000-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/cache/ftcsbits.h b/src/cache/ftcsbits.h index 1e15ce976..206a1bb3f 100644 --- a/src/cache/ftcsbits.h +++ b/src/cache/ftcsbits.h @@ -4,7 +4,7 @@ /* */ /* A small-bitmap cache (specification). */ /* */ -/* Copyright 2000-2017 by */ +/* Copyright 2000-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/cache/rules.mk b/src/cache/rules.mk index 620468950..558935976 100644 --- a/src/cache/rules.mk +++ b/src/cache/rules.mk @@ -3,7 +3,7 @@ # -# Copyright 2000-2017 by +# Copyright 2000-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/cff/Jamfile b/src/cff/Jamfile index f665a0b25..53c904fcf 100644 --- a/src/cff/Jamfile +++ b/src/cff/Jamfile @@ -1,6 +1,6 @@ # FreeType 2 src/cff Jamfile # -# Copyright 2001-2017 by +# Copyright 2001-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/cff/cff.c b/src/cff/cff.c index e9b3264b8..1a755d5da 100644 --- a/src/cff/cff.c +++ b/src/cff/cff.c @@ -4,7 +4,7 @@ /* */ /* FreeType OpenType driver component (body only). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/cff/cffcmap.c b/src/cff/cffcmap.c index 4adce7a54..e45ae1127 100644 --- a/src/cff/cffcmap.c +++ b/src/cff/cffcmap.c @@ -4,7 +4,7 @@ /* */ /* CFF character mapping table (cmap) support (body). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/cff/cffcmap.h b/src/cff/cffcmap.h index 227c91afb..856a43dd1 100644 --- a/src/cff/cffcmap.h +++ b/src/cff/cffcmap.h @@ -4,7 +4,7 @@ /* */ /* CFF character mapping table (cmap) support (specification). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/cff/cffdrivr.c b/src/cff/cffdrivr.c index 4236c801c..df896848d 100644 --- a/src/cff/cffdrivr.c +++ b/src/cff/cffdrivr.c @@ -4,7 +4,7 @@ /* */ /* OpenType font driver implementation (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/cff/cffdrivr.h b/src/cff/cffdrivr.h index 05381e66d..ad7c3ad70 100644 --- a/src/cff/cffdrivr.h +++ b/src/cff/cffdrivr.h @@ -4,7 +4,7 @@ /* */ /* High-level OpenType driver interface (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/cff/cfferrs.h b/src/cff/cfferrs.h index 40808c105..b2e1bfaf9 100644 --- a/src/cff/cfferrs.h +++ b/src/cff/cfferrs.h @@ -4,7 +4,7 @@ /* */ /* CFF error codes (specification only). */ /* */ -/* Copyright 2001-2017 by */ +/* Copyright 2001-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/cff/cffgload.c b/src/cff/cffgload.c index 64179af2e..c58471ce8 100644 --- a/src/cff/cffgload.c +++ b/src/cff/cffgload.c @@ -4,7 +4,7 @@ /* */ /* OpenType Glyph Loader (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/cff/cffgload.h b/src/cff/cffgload.h index ed291b87d..803f3974f 100644 --- a/src/cff/cffgload.h +++ b/src/cff/cffgload.h @@ -4,7 +4,7 @@ /* */ /* OpenType Glyph Loader (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/cff/cffload.c b/src/cff/cffload.c index 937438e3d..ba49793dc 100644 --- a/src/cff/cffload.c +++ b/src/cff/cffload.c @@ -4,7 +4,7 @@ /* */ /* OpenType and CFF data/program tables loader (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/cff/cffload.h b/src/cff/cffload.h index ef3c1bd86..14d14e211 100644 --- a/src/cff/cffload.h +++ b/src/cff/cffload.h @@ -4,7 +4,7 @@ /* */ /* OpenType & CFF data/program tables loader (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/cff/cffobjs.c b/src/cff/cffobjs.c index b70e3b5cc..a2d7aec65 100644 --- a/src/cff/cffobjs.c +++ b/src/cff/cffobjs.c @@ -4,7 +4,7 @@ /* */ /* OpenType objects manager (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/cff/cffobjs.h b/src/cff/cffobjs.h index 9f3dff3e5..616a25b3b 100644 --- a/src/cff/cffobjs.h +++ b/src/cff/cffobjs.h @@ -4,7 +4,7 @@ /* */ /* OpenType objects manager (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/cff/cffparse.c b/src/cff/cffparse.c index 325948e59..b9611cf54 100644 --- a/src/cff/cffparse.c +++ b/src/cff/cffparse.c @@ -4,7 +4,7 @@ /* */ /* CFF token stream parser (body) */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/cff/cffparse.h b/src/cff/cffparse.h index 961c26501..8a8caeca4 100644 --- a/src/cff/cffparse.h +++ b/src/cff/cffparse.h @@ -4,7 +4,7 @@ /* */ /* CFF token stream parser (specification) */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/cff/cffpic.c b/src/cff/cffpic.c index 4e9ba12b3..08b74c7cf 100644 --- a/src/cff/cffpic.c +++ b/src/cff/cffpic.c @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for cff module. */ /* */ -/* Copyright 2009-2017 by */ +/* Copyright 2009-2018 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/cff/cffpic.h b/src/cff/cffpic.h index a7e01973e..8ba4203a8 100644 --- a/src/cff/cffpic.h +++ b/src/cff/cffpic.h @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for cff module. */ /* */ -/* Copyright 2009-2017 by */ +/* Copyright 2009-2018 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/cff/cfftoken.h b/src/cff/cfftoken.h index 3222e933f..fec1ca20b 100644 --- a/src/cff/cfftoken.h +++ b/src/cff/cfftoken.h @@ -4,7 +4,7 @@ /* */ /* CFF token definitions (specification only). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/cff/module.mk b/src/cff/module.mk index 2975aeed8..8013d5dca 100644 --- a/src/cff/module.mk +++ b/src/cff/module.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/cff/rules.mk b/src/cff/rules.mk index 473b25c1d..bce672927 100644 --- a/src/cff/rules.mk +++ b/src/cff/rules.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/cid/Jamfile b/src/cid/Jamfile index 8d3ba6a47..1c232fda3 100644 --- a/src/cid/Jamfile +++ b/src/cid/Jamfile @@ -1,6 +1,6 @@ # FreeType 2 src/cid Jamfile # -# Copyright 2001-2017 by +# Copyright 2001-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/cid/ciderrs.h b/src/cid/ciderrs.h index 709dc8cd1..a5a86e3fc 100644 --- a/src/cid/ciderrs.h +++ b/src/cid/ciderrs.h @@ -4,7 +4,7 @@ /* */ /* CID error codes (specification only). */ /* */ -/* Copyright 2001-2017 by */ +/* Copyright 2001-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/cid/cidgload.c b/src/cid/cidgload.c index 76aa09556..d14f9a2cc 100644 --- a/src/cid/cidgload.c +++ b/src/cid/cidgload.c @@ -4,7 +4,7 @@ /* */ /* CID-keyed Type1 Glyph Loader (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/cid/cidgload.h b/src/cid/cidgload.h index 7f816b5bc..4811852ae 100644 --- a/src/cid/cidgload.h +++ b/src/cid/cidgload.h @@ -4,7 +4,7 @@ /* */ /* OpenType Glyph Loader (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/cid/cidload.c b/src/cid/cidload.c index ff0722110..27cd09b3c 100644 --- a/src/cid/cidload.c +++ b/src/cid/cidload.c @@ -4,7 +4,7 @@ /* */ /* CID-keyed Type1 font loader (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/cid/cidload.h b/src/cid/cidload.h index 45a0e6df2..3f8bd0862 100644 --- a/src/cid/cidload.h +++ b/src/cid/cidload.h @@ -4,7 +4,7 @@ /* */ /* CID-keyed Type1 font loader (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/cid/cidobjs.c b/src/cid/cidobjs.c index ed1dca265..77afe1c87 100644 --- a/src/cid/cidobjs.c +++ b/src/cid/cidobjs.c @@ -4,7 +4,7 @@ /* */ /* CID objects manager (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/cid/cidobjs.h b/src/cid/cidobjs.h index 8bcf886e1..0221f017d 100644 --- a/src/cid/cidobjs.h +++ b/src/cid/cidobjs.h @@ -4,7 +4,7 @@ /* */ /* CID objects manager (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/cid/cidparse.c b/src/cid/cidparse.c index 007609bbd..b1c7f3cb2 100644 --- a/src/cid/cidparse.c +++ b/src/cid/cidparse.c @@ -4,7 +4,7 @@ /* */ /* CID-keyed Type1 parser (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/cid/cidparse.h b/src/cid/cidparse.h index 20bebb942..61602f767 100644 --- a/src/cid/cidparse.h +++ b/src/cid/cidparse.h @@ -4,7 +4,7 @@ /* */ /* CID-keyed Type1 parser (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/cid/cidriver.c b/src/cid/cidriver.c index 464ff49ab..d9faf353e 100644 --- a/src/cid/cidriver.c +++ b/src/cid/cidriver.c @@ -4,7 +4,7 @@ /* */ /* CID driver interface (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/cid/cidriver.h b/src/cid/cidriver.h index 76640c57b..59d9ded90 100644 --- a/src/cid/cidriver.h +++ b/src/cid/cidriver.h @@ -4,7 +4,7 @@ /* */ /* High-level CID driver interface (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/cid/cidtoken.h b/src/cid/cidtoken.h index 653cc5586..b0e2dac6a 100644 --- a/src/cid/cidtoken.h +++ b/src/cid/cidtoken.h @@ -4,7 +4,7 @@ /* */ /* CID token definitions (specification only). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/cid/module.mk b/src/cid/module.mk index b30b8679b..9010e339a 100644 --- a/src/cid/module.mk +++ b/src/cid/module.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/cid/rules.mk b/src/cid/rules.mk index fcddd92ec..94333bda0 100644 --- a/src/cid/rules.mk +++ b/src/cid/rules.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/cid/type1cid.c b/src/cid/type1cid.c index 93e6f810d..61770e3f1 100644 --- a/src/cid/type1cid.c +++ b/src/cid/type1cid.c @@ -4,7 +4,7 @@ /* */ /* FreeType OpenType driver component (body only). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/gxvalid/Jamfile b/src/gxvalid/Jamfile index a120128ae..74f3c51ff 100644 --- a/src/gxvalid/Jamfile +++ b/src/gxvalid/Jamfile @@ -1,6 +1,6 @@ # FreeType 2 src/gxvalid Jamfile # -# Copyright 2005-2017 by +# Copyright 2005-2018 by # suzuki toshiya, Masatake YAMATO and Red Hat K.K. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/gxvalid/README b/src/gxvalid/README index 5d292461d..af8128e0e 100644 --- a/src/gxvalid/README +++ b/src/gxvalid/README @@ -518,7 +518,7 @@ gxvalid: TrueType GX validator ------------------------------------------------------------------------ -Copyright 2004-2017 by +Copyright 2004-2018 by suzuki toshiya, Masatake YAMATO, Red hat K.K., David Turner, Robert Wilhelm, and Werner Lemberg. diff --git a/src/gxvalid/gxvalid.c b/src/gxvalid/gxvalid.c index da485141d..d0577a247 100644 --- a/src/gxvalid/gxvalid.c +++ b/src/gxvalid/gxvalid.c @@ -4,7 +4,7 @@ /* */ /* FreeType validator for TrueTypeGX/AAT tables (body only). */ /* */ -/* Copyright 2005-2017 by */ +/* Copyright 2005-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/src/gxvalid/gxvalid.h b/src/gxvalid/gxvalid.h index 78116ef85..19f037998 100644 --- a/src/gxvalid/gxvalid.h +++ b/src/gxvalid/gxvalid.h @@ -4,7 +4,7 @@ /* */ /* TrueTypeGX/AAT table validation (specification only). */ /* */ -/* Copyright 2005-2017 by */ +/* Copyright 2005-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/src/gxvalid/gxvbsln.c b/src/gxvalid/gxvbsln.c index 81dff7304..c367d3848 100644 --- a/src/gxvalid/gxvbsln.c +++ b/src/gxvalid/gxvbsln.c @@ -4,7 +4,7 @@ /* */ /* TrueTypeGX/AAT bsln table validation (body). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/src/gxvalid/gxvcommn.c b/src/gxvalid/gxvcommn.c index db0a91ea7..b96601108 100644 --- a/src/gxvalid/gxvcommn.c +++ b/src/gxvalid/gxvcommn.c @@ -4,7 +4,7 @@ /* */ /* TrueTypeGX/AAT common tables validation (body). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/src/gxvalid/gxvcommn.h b/src/gxvalid/gxvcommn.h index 10b1c800f..8e4ff9caf 100644 --- a/src/gxvalid/gxvcommn.h +++ b/src/gxvalid/gxvcommn.h @@ -4,7 +4,7 @@ /* */ /* TrueTypeGX/AAT common tables validation (specification). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/src/gxvalid/gxverror.h b/src/gxvalid/gxverror.h index 80a2b8a26..d1151258a 100644 --- a/src/gxvalid/gxverror.h +++ b/src/gxvalid/gxverror.h @@ -4,7 +4,7 @@ /* */ /* TrueTypeGX/AAT validation module error codes (specification only). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/src/gxvalid/gxvfeat.c b/src/gxvalid/gxvfeat.c index 2e3ec6f9b..2c805d1d1 100644 --- a/src/gxvalid/gxvfeat.c +++ b/src/gxvalid/gxvfeat.c @@ -4,7 +4,7 @@ /* */ /* TrueTypeGX/AAT feat table validation (body). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/src/gxvalid/gxvfeat.h b/src/gxvalid/gxvfeat.h index 8c0e847eb..2d943806c 100644 --- a/src/gxvalid/gxvfeat.h +++ b/src/gxvalid/gxvfeat.h @@ -4,7 +4,7 @@ /* */ /* TrueTypeGX/AAT feat table validation (specification). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/src/gxvalid/gxvfgen.c b/src/gxvalid/gxvfgen.c index 42ff690b3..840c0f352 100644 --- a/src/gxvalid/gxvfgen.c +++ b/src/gxvalid/gxvfgen.c @@ -5,7 +5,7 @@ /* Generate feature registry data for gxv `feat' validator. */ /* This program is derived from gxfeatreg.c in gxlayout. */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* Masatake YAMATO and Redhat K.K. */ /* */ /* This file may only be used, */ diff --git a/src/gxvalid/gxvjust.c b/src/gxvalid/gxvjust.c index c8cfd83ea..00c429319 100644 --- a/src/gxvalid/gxvjust.c +++ b/src/gxvalid/gxvjust.c @@ -4,7 +4,7 @@ /* */ /* TrueTypeGX/AAT just table validation (body). */ /* */ -/* Copyright 2005-2017 by */ +/* Copyright 2005-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/src/gxvalid/gxvkern.c b/src/gxvalid/gxvkern.c index 9f9037387..9c0efd7a4 100644 --- a/src/gxvalid/gxvkern.c +++ b/src/gxvalid/gxvkern.c @@ -4,7 +4,7 @@ /* */ /* TrueTypeGX/AAT kern table validation (body). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/src/gxvalid/gxvlcar.c b/src/gxvalid/gxvlcar.c index 775d5229f..0f261a9ac 100644 --- a/src/gxvalid/gxvlcar.c +++ b/src/gxvalid/gxvlcar.c @@ -4,7 +4,7 @@ /* */ /* TrueTypeGX/AAT lcar table validation (body). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/src/gxvalid/gxvmod.c b/src/gxvalid/gxvmod.c index 84e9275ba..1a3c86292 100644 --- a/src/gxvalid/gxvmod.c +++ b/src/gxvalid/gxvmod.c @@ -4,7 +4,7 @@ /* */ /* FreeType's TrueTypeGX/AAT validation module implementation (body). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/src/gxvalid/gxvmod.h b/src/gxvalid/gxvmod.h index df25e60cb..745c62e10 100644 --- a/src/gxvalid/gxvmod.h +++ b/src/gxvalid/gxvmod.h @@ -5,7 +5,7 @@ /* FreeType's TrueTypeGX/AAT validation module implementation */ /* (specification). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/src/gxvalid/gxvmort.c b/src/gxvalid/gxvmort.c index 184a6317c..b361cb2b9 100644 --- a/src/gxvalid/gxvmort.c +++ b/src/gxvalid/gxvmort.c @@ -4,7 +4,7 @@ /* */ /* TrueTypeGX/AAT mort table validation (body). */ /* */ -/* Copyright 2005-2017 by */ +/* Copyright 2005-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/src/gxvalid/gxvmort.h b/src/gxvalid/gxvmort.h index d0543adcc..d8030645e 100644 --- a/src/gxvalid/gxvmort.h +++ b/src/gxvalid/gxvmort.h @@ -4,7 +4,7 @@ /* */ /* TrueTypeGX/AAT common definition for mort table (specification). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/src/gxvalid/gxvmort0.c b/src/gxvalid/gxvmort0.c index a75fad776..95cf53d5e 100644 --- a/src/gxvalid/gxvmort0.c +++ b/src/gxvalid/gxvmort0.c @@ -5,7 +5,7 @@ /* TrueTypeGX/AAT mort table validation */ /* body for type0 (Indic Script Rearrangement) subtable. */ /* */ -/* Copyright 2005-2017 by */ +/* Copyright 2005-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/src/gxvalid/gxvmort1.c b/src/gxvalid/gxvmort1.c index 361ef2262..a7683a17b 100644 --- a/src/gxvalid/gxvmort1.c +++ b/src/gxvalid/gxvmort1.c @@ -5,7 +5,7 @@ /* TrueTypeGX/AAT mort table validation */ /* body for type1 (Contextual Substitution) subtable. */ /* */ -/* Copyright 2005-2017 by */ +/* Copyright 2005-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/src/gxvalid/gxvmort2.c b/src/gxvalid/gxvmort2.c index c17e51e32..c23c2775a 100644 --- a/src/gxvalid/gxvmort2.c +++ b/src/gxvalid/gxvmort2.c @@ -5,7 +5,7 @@ /* TrueTypeGX/AAT mort table validation */ /* body for type2 (Ligature Substitution) subtable. */ /* */ -/* Copyright 2005-2017 by */ +/* Copyright 2005-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/src/gxvalid/gxvmort4.c b/src/gxvalid/gxvmort4.c index 041bab369..9d21a5fc2 100644 --- a/src/gxvalid/gxvmort4.c +++ b/src/gxvalid/gxvmort4.c @@ -5,7 +5,7 @@ /* TrueTypeGX/AAT mort table validation */ /* body for type4 (Non-Contextual Glyph Substitution) subtable. */ /* */ -/* Copyright 2005-2017 by */ +/* Copyright 2005-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/src/gxvalid/gxvmort5.c b/src/gxvalid/gxvmort5.c index 4751eceaa..42cb428aa 100644 --- a/src/gxvalid/gxvmort5.c +++ b/src/gxvalid/gxvmort5.c @@ -5,7 +5,7 @@ /* TrueTypeGX/AAT mort table validation */ /* body for type5 (Contextual Glyph Insertion) subtable. */ /* */ -/* Copyright 2005-2017 by */ +/* Copyright 2005-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/src/gxvalid/gxvmorx.c b/src/gxvalid/gxvmorx.c index 2bb4f3b8b..9fd6e6b97 100644 --- a/src/gxvalid/gxvmorx.c +++ b/src/gxvalid/gxvmorx.c @@ -4,7 +4,7 @@ /* */ /* TrueTypeGX/AAT morx table validation (body). */ /* */ -/* Copyright 2005-2017 by */ +/* Copyright 2005-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/src/gxvalid/gxvmorx.h b/src/gxvalid/gxvmorx.h index 20cec5867..6d9925e92 100644 --- a/src/gxvalid/gxvmorx.h +++ b/src/gxvalid/gxvmorx.h @@ -4,7 +4,7 @@ /* */ /* TrueTypeGX/AAT common definition for morx table (specification). */ /* */ -/* Copyright 2005-2017 by */ +/* Copyright 2005-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/src/gxvalid/gxvmorx0.c b/src/gxvalid/gxvmorx0.c index e0a0a9243..302261b7f 100644 --- a/src/gxvalid/gxvmorx0.c +++ b/src/gxvalid/gxvmorx0.c @@ -5,7 +5,7 @@ /* TrueTypeGX/AAT morx table validation */ /* body for type0 (Indic Script Rearrangement) subtable. */ /* */ -/* Copyright 2005-2017 by */ +/* Copyright 2005-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/src/gxvalid/gxvmorx1.c b/src/gxvalid/gxvmorx1.c index 9afebdbfa..890ca74b1 100644 --- a/src/gxvalid/gxvmorx1.c +++ b/src/gxvalid/gxvmorx1.c @@ -5,7 +5,7 @@ /* TrueTypeGX/AAT morx table validation */ /* body for type1 (Contextual Substitution) subtable. */ /* */ -/* Copyright 2005-2017 by */ +/* Copyright 2005-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/src/gxvalid/gxvmorx2.c b/src/gxvalid/gxvmorx2.c index 3a60cf68a..3135031d4 100644 --- a/src/gxvalid/gxvmorx2.c +++ b/src/gxvalid/gxvmorx2.c @@ -5,7 +5,7 @@ /* TrueTypeGX/AAT morx table validation */ /* body for type2 (Ligature Substitution) subtable. */ /* */ -/* Copyright 2005-2017 by */ +/* Copyright 2005-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/src/gxvalid/gxvmorx4.c b/src/gxvalid/gxvmorx4.c index 29555685a..1e2397b0c 100644 --- a/src/gxvalid/gxvmorx4.c +++ b/src/gxvalid/gxvmorx4.c @@ -5,7 +5,7 @@ /* TrueTypeGX/AAT morx table validation */ /* body for "morx" type4 (Non-Contextual Glyph Substitution) subtable. */ /* */ -/* Copyright 2005-2017 by */ +/* Copyright 2005-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/src/gxvalid/gxvmorx5.c b/src/gxvalid/gxvmorx5.c index 05c11417e..db4f9290c 100644 --- a/src/gxvalid/gxvmorx5.c +++ b/src/gxvalid/gxvmorx5.c @@ -5,7 +5,7 @@ /* TrueTypeGX/AAT morx table validation */ /* body for type5 (Contextual Glyph Insertion) subtable. */ /* */ -/* Copyright 2005-2017 by */ +/* Copyright 2005-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/src/gxvalid/gxvopbd.c b/src/gxvalid/gxvopbd.c index 11580d8b2..e2c167ea5 100644 --- a/src/gxvalid/gxvopbd.c +++ b/src/gxvalid/gxvopbd.c @@ -4,7 +4,7 @@ /* */ /* TrueTypeGX/AAT opbd table validation (body). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/src/gxvalid/gxvprop.c b/src/gxvalid/gxvprop.c index 7d398b7e6..a67b6bdd0 100644 --- a/src/gxvalid/gxvprop.c +++ b/src/gxvalid/gxvprop.c @@ -4,7 +4,7 @@ /* */ /* TrueTypeGX/AAT prop table validation (body). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/src/gxvalid/gxvtrak.c b/src/gxvalid/gxvtrak.c index dd4982556..d501b5014 100644 --- a/src/gxvalid/gxvtrak.c +++ b/src/gxvalid/gxvtrak.c @@ -4,7 +4,7 @@ /* */ /* TrueTypeGX/AAT trak table validation (body). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/src/gxvalid/module.mk b/src/gxvalid/module.mk index 7f87e1081..b64879dce 100644 --- a/src/gxvalid/module.mk +++ b/src/gxvalid/module.mk @@ -2,7 +2,7 @@ # FreeType 2 gxvalid module definition # -# Copyright 2004-2017 by +# Copyright 2004-2018 by # suzuki toshiya, Masatake YAMATO, Red Hat K.K., # David Turner, Robert Wilhelm, and Werner Lemberg. # diff --git a/src/gxvalid/rules.mk b/src/gxvalid/rules.mk index 10ec08c5b..3a17c030a 100644 --- a/src/gxvalid/rules.mk +++ b/src/gxvalid/rules.mk @@ -3,7 +3,7 @@ # -# Copyright 2004-2017 by +# Copyright 2004-2018 by # suzuki toshiya, Masatake YAMATO, Red Hat K.K., # David Turner, Robert Wilhelm, and Werner Lemberg. # diff --git a/src/gzip/Jamfile b/src/gzip/Jamfile index 170c13a4c..a7b4c8c95 100644 --- a/src/gzip/Jamfile +++ b/src/gzip/Jamfile @@ -1,6 +1,6 @@ # FreeType 2 src/gzip Jamfile # -# Copyright 2001-2017 by +# Copyright 2001-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/gzip/ftgzip.c b/src/gzip/ftgzip.c index c487786d9..f8011c2dd 100644 --- a/src/gzip/ftgzip.c +++ b/src/gzip/ftgzip.c @@ -8,7 +8,7 @@ /* parse compressed PCF fonts, as found with many X11 server */ /* distributions. */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/gzip/rules.mk b/src/gzip/rules.mk index bc7d5fa63..1a2e48beb 100644 --- a/src/gzip/rules.mk +++ b/src/gzip/rules.mk @@ -3,7 +3,7 @@ # -# Copyright 2002-2017 by +# Copyright 2002-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/lzw/Jamfile b/src/lzw/Jamfile index 8e61f080a..cb83aa4a5 100644 --- a/src/lzw/Jamfile +++ b/src/lzw/Jamfile @@ -1,6 +1,6 @@ # FreeType 2 src/lzw Jamfile # -# Copyright 2004-2017 by +# Copyright 2004-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/lzw/ftlzw.c b/src/lzw/ftlzw.c index 941f6cef4..cb46f93c6 100644 --- a/src/lzw/ftlzw.c +++ b/src/lzw/ftlzw.c @@ -8,7 +8,7 @@ /* be used to parse compressed PCF fonts, as found with many X11 server */ /* distributions. */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* Albert Chin-A-Young. */ /* */ /* based on code in `src/gzip/ftgzip.c' */ diff --git a/src/lzw/ftzopen.c b/src/lzw/ftzopen.c index 486c546c1..2b868ba9f 100644 --- a/src/lzw/ftzopen.c +++ b/src/lzw/ftzopen.c @@ -8,7 +8,7 @@ /* be used to parse compressed PCF fonts, as found with many X11 server */ /* distributions. */ /* */ -/* Copyright 2005-2017 by */ +/* Copyright 2005-2018 by */ /* David Turner. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/lzw/ftzopen.h b/src/lzw/ftzopen.h index a108862c0..4fd267eb9 100644 --- a/src/lzw/ftzopen.h +++ b/src/lzw/ftzopen.h @@ -8,7 +8,7 @@ /* be used to parse compressed PCF fonts, as found with many X11 server */ /* distributions. */ /* */ -/* Copyright 2005-2017 by */ +/* Copyright 2005-2018 by */ /* David Turner. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/lzw/rules.mk b/src/lzw/rules.mk index e7bf68a06..18933c41c 100644 --- a/src/lzw/rules.mk +++ b/src/lzw/rules.mk @@ -3,7 +3,7 @@ # -# Copyright 2004-2017 by +# Copyright 2004-2018 by # Albert Chin-A-Young. # # based on `src/lzw/rules.mk' diff --git a/src/otvalid/Jamfile b/src/otvalid/Jamfile index a755f2bcf..21b8e0cb0 100644 --- a/src/otvalid/Jamfile +++ b/src/otvalid/Jamfile @@ -1,6 +1,6 @@ # FreeType 2 src/otvalid Jamfile # -# Copyright 2004-2017 by +# Copyright 2004-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/otvalid/module.mk b/src/otvalid/module.mk index 5ee1265db..34f3dab32 100644 --- a/src/otvalid/module.mk +++ b/src/otvalid/module.mk @@ -3,7 +3,7 @@ # -# Copyright 2004-2017 by +# Copyright 2004-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/otvalid/otvalid.c b/src/otvalid/otvalid.c index 312751a1f..4423ca101 100644 --- a/src/otvalid/otvalid.c +++ b/src/otvalid/otvalid.c @@ -4,7 +4,7 @@ /* */ /* FreeType validator for OpenType tables (body only). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/otvalid/otvalid.h b/src/otvalid/otvalid.h index f2969cccc..d7801abae 100644 --- a/src/otvalid/otvalid.h +++ b/src/otvalid/otvalid.h @@ -4,7 +4,7 @@ /* */ /* OpenType table validation (specification only). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/otvalid/otvbase.c b/src/otvalid/otvbase.c index 48ae96173..a01d45c70 100644 --- a/src/otvalid/otvbase.c +++ b/src/otvalid/otvbase.c @@ -4,7 +4,7 @@ /* */ /* OpenType BASE table validation (body). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/otvalid/otvcommn.c b/src/otvalid/otvcommn.c index 0583620d3..0ccfb03c0 100644 --- a/src/otvalid/otvcommn.c +++ b/src/otvalid/otvcommn.c @@ -4,7 +4,7 @@ /* */ /* OpenType common tables validation (body). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/otvalid/otvcommn.h b/src/otvalid/otvcommn.h index 40a79851d..a392784cf 100644 --- a/src/otvalid/otvcommn.h +++ b/src/otvalid/otvcommn.h @@ -4,7 +4,7 @@ /* */ /* OpenType common tables validation (specification). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/otvalid/otverror.h b/src/otvalid/otverror.h index 699903987..2fcf42e38 100644 --- a/src/otvalid/otverror.h +++ b/src/otvalid/otverror.h @@ -4,7 +4,7 @@ /* */ /* OpenType validation module error codes (specification only). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/otvalid/otvgdef.c b/src/otvalid/otvgdef.c index 71f01a9c5..08f317154 100644 --- a/src/otvalid/otvgdef.c +++ b/src/otvalid/otvgdef.c @@ -4,7 +4,7 @@ /* */ /* OpenType GDEF table validation (body). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/otvalid/otvgpos.c b/src/otvalid/otvgpos.c index f185b4a0b..696b35cae 100644 --- a/src/otvalid/otvgpos.c +++ b/src/otvalid/otvgpos.c @@ -4,7 +4,7 @@ /* */ /* OpenType GPOS table validation (body). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/otvalid/otvgpos.h b/src/otvalid/otvgpos.h index 99b0ad391..95f9ac3ee 100644 --- a/src/otvalid/otvgpos.h +++ b/src/otvalid/otvgpos.h @@ -4,7 +4,7 @@ /* */ /* OpenType GPOS table validator (specification). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/otvalid/otvgsub.c b/src/otvalid/otvgsub.c index 3b58b6dec..d35ea67f3 100644 --- a/src/otvalid/otvgsub.c +++ b/src/otvalid/otvgsub.c @@ -4,7 +4,7 @@ /* */ /* OpenType GSUB table validation (body). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/otvalid/otvjstf.c b/src/otvalid/otvjstf.c index 57a38f95c..94d4af90f 100644 --- a/src/otvalid/otvjstf.c +++ b/src/otvalid/otvjstf.c @@ -4,7 +4,7 @@ /* */ /* OpenType JSTF table validation (body). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/otvalid/otvmath.c b/src/otvalid/otvmath.c index a14d36970..b9800f60a 100644 --- a/src/otvalid/otvmath.c +++ b/src/otvalid/otvmath.c @@ -4,7 +4,7 @@ /* */ /* OpenType MATH table validation (body). */ /* */ -/* Copyright 2007-2017 by */ +/* Copyright 2007-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* Written by George Williams. */ diff --git a/src/otvalid/otvmod.c b/src/otvalid/otvmod.c index 35ffc43d3..89ee449d1 100644 --- a/src/otvalid/otvmod.c +++ b/src/otvalid/otvmod.c @@ -4,7 +4,7 @@ /* */ /* FreeType's OpenType validation module implementation (body). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/otvalid/otvmod.h b/src/otvalid/otvmod.h index 30d401ddc..6917bccee 100644 --- a/src/otvalid/otvmod.h +++ b/src/otvalid/otvmod.h @@ -5,7 +5,7 @@ /* FreeType's OpenType validation module implementation */ /* (specification). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/otvalid/rules.mk b/src/otvalid/rules.mk index 10329a96e..d4fc72374 100644 --- a/src/otvalid/rules.mk +++ b/src/otvalid/rules.mk @@ -3,7 +3,7 @@ # -# Copyright 2004-2017 by +# Copyright 2004-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/pcf/Jamfile b/src/pcf/Jamfile index 794f27dfb..7b92b12dd 100644 --- a/src/pcf/Jamfile +++ b/src/pcf/Jamfile @@ -1,6 +1,6 @@ # FreeType 2 src/pcf Jamfile # -# Copyright 2001-2017 by +# Copyright 2001-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/pfr/Jamfile b/src/pfr/Jamfile index 178317162..cb55a7ee8 100644 --- a/src/pfr/Jamfile +++ b/src/pfr/Jamfile @@ -1,6 +1,6 @@ # FreeType 2 src/pfr Jamfile # -# Copyright 2002-2017 by +# Copyright 2002-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/pfr/module.mk b/src/pfr/module.mk index 7b84da970..27fec8e5f 100644 --- a/src/pfr/module.mk +++ b/src/pfr/module.mk @@ -3,7 +3,7 @@ # -# Copyright 2002-2017 by +# Copyright 2002-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/pfr/pfr.c b/src/pfr/pfr.c index 4f31f5d9b..1760882fc 100644 --- a/src/pfr/pfr.c +++ b/src/pfr/pfr.c @@ -4,7 +4,7 @@ /* */ /* FreeType PFR driver component. */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/pfr/pfrcmap.c b/src/pfr/pfrcmap.c index 1d6b15be4..60643780a 100644 --- a/src/pfr/pfrcmap.c +++ b/src/pfr/pfrcmap.c @@ -4,7 +4,7 @@ /* */ /* FreeType PFR cmap handling (body). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/pfr/pfrcmap.h b/src/pfr/pfrcmap.h index 957bf65b4..c70a0c83c 100644 --- a/src/pfr/pfrcmap.h +++ b/src/pfr/pfrcmap.h @@ -4,7 +4,7 @@ /* */ /* FreeType PFR cmap handling (specification). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/pfr/pfrdrivr.c b/src/pfr/pfrdrivr.c index 195cdb76a..6c7e50128 100644 --- a/src/pfr/pfrdrivr.c +++ b/src/pfr/pfrdrivr.c @@ -4,7 +4,7 @@ /* */ /* FreeType PFR driver interface (body). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/pfr/pfrdrivr.h b/src/pfr/pfrdrivr.h index b81d56017..cab852789 100644 --- a/src/pfr/pfrdrivr.h +++ b/src/pfr/pfrdrivr.h @@ -4,7 +4,7 @@ /* */ /* High-level Type PFR driver interface (specification). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/pfr/pfrerror.h b/src/pfr/pfrerror.h index ef044e32c..7027c818e 100644 --- a/src/pfr/pfrerror.h +++ b/src/pfr/pfrerror.h @@ -4,7 +4,7 @@ /* */ /* PFR error codes (specification only). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/pfr/pfrgload.c b/src/pfr/pfrgload.c index 98efb9ed0..b7990196b 100644 --- a/src/pfr/pfrgload.c +++ b/src/pfr/pfrgload.c @@ -4,7 +4,7 @@ /* */ /* FreeType PFR glyph loader (body). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/pfr/pfrgload.h b/src/pfr/pfrgload.h index 661232387..01f48d770 100644 --- a/src/pfr/pfrgload.h +++ b/src/pfr/pfrgload.h @@ -4,7 +4,7 @@ /* */ /* FreeType PFR glyph loader (specification). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/pfr/pfrload.c b/src/pfr/pfrload.c index 4f8416582..2776da462 100644 --- a/src/pfr/pfrload.c +++ b/src/pfr/pfrload.c @@ -4,7 +4,7 @@ /* */ /* FreeType PFR loader (body). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/pfr/pfrload.h b/src/pfr/pfrload.h index f9475ae06..36e809a76 100644 --- a/src/pfr/pfrload.h +++ b/src/pfr/pfrload.h @@ -4,7 +4,7 @@ /* */ /* FreeType PFR loader (specification). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/pfr/pfrobjs.c b/src/pfr/pfrobjs.c index 514af8050..737b97b5f 100644 --- a/src/pfr/pfrobjs.c +++ b/src/pfr/pfrobjs.c @@ -4,7 +4,7 @@ /* */ /* FreeType PFR object methods (body). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/pfr/pfrobjs.h b/src/pfr/pfrobjs.h index d6ad6562d..59c709f58 100644 --- a/src/pfr/pfrobjs.h +++ b/src/pfr/pfrobjs.h @@ -4,7 +4,7 @@ /* */ /* FreeType PFR object methods (specification). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/pfr/pfrsbit.c b/src/pfr/pfrsbit.c index 54e7d0e6c..ba909ddca 100644 --- a/src/pfr/pfrsbit.c +++ b/src/pfr/pfrsbit.c @@ -4,7 +4,7 @@ /* */ /* FreeType PFR bitmap loader (body). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/pfr/pfrsbit.h b/src/pfr/pfrsbit.h index fc270f50a..07b27bc06 100644 --- a/src/pfr/pfrsbit.h +++ b/src/pfr/pfrsbit.h @@ -4,7 +4,7 @@ /* */ /* FreeType PFR bitmap loader (specification). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/pfr/pfrtypes.h b/src/pfr/pfrtypes.h index c3d542c20..058d6aadc 100644 --- a/src/pfr/pfrtypes.h +++ b/src/pfr/pfrtypes.h @@ -4,7 +4,7 @@ /* */ /* FreeType PFR data structures (specification only). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/pfr/rules.mk b/src/pfr/rules.mk index 9940f6228..3acb79569 100644 --- a/src/pfr/rules.mk +++ b/src/pfr/rules.mk @@ -3,7 +3,7 @@ # -# Copyright 2002-2017 by +# Copyright 2002-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/psaux/Jamfile b/src/psaux/Jamfile index 0e5944d69..a231d5974 100644 --- a/src/psaux/Jamfile +++ b/src/psaux/Jamfile @@ -1,6 +1,6 @@ # FreeType 2 src/psaux Jamfile # -# Copyright 2001-2017 by +# Copyright 2001-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/psaux/afmparse.c b/src/psaux/afmparse.c index ff2cc8cf0..0c33d5949 100644 --- a/src/psaux/afmparse.c +++ b/src/psaux/afmparse.c @@ -4,7 +4,7 @@ /* */ /* AFM parser (body). */ /* */ -/* Copyright 2006-2017 by */ +/* Copyright 2006-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/psaux/afmparse.h b/src/psaux/afmparse.h index cd2beb780..86f852a24 100644 --- a/src/psaux/afmparse.h +++ b/src/psaux/afmparse.h @@ -4,7 +4,7 @@ /* */ /* AFM parser (specification). */ /* */ -/* Copyright 2006-2017 by */ +/* Copyright 2006-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/psaux/cffdecode.c b/src/psaux/cffdecode.c index 3e18c77a4..80d622c0e 100644 --- a/src/psaux/cffdecode.c +++ b/src/psaux/cffdecode.c @@ -4,7 +4,7 @@ /* */ /* PostScript CFF (Type 2) decoding routines (body). */ /* */ -/* Copyright 2017 by */ +/* Copyright 2017-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/psaux/cffdecode.h b/src/psaux/cffdecode.h index b05b6fcee..0d4f5fef6 100644 --- a/src/psaux/cffdecode.h +++ b/src/psaux/cffdecode.h @@ -4,7 +4,7 @@ /* */ /* PostScript CFF (Type 2) decoding routines (specification). */ /* */ -/* Copyright 2017 by */ +/* Copyright 2017-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/psaux/module.mk b/src/psaux/module.mk index c70a22716..6584d075a 100644 --- a/src/psaux/module.mk +++ b/src/psaux/module.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/psaux/psaux.c b/src/psaux/psaux.c index e30c9b084..fb447fcdb 100644 --- a/src/psaux/psaux.c +++ b/src/psaux/psaux.c @@ -4,7 +4,7 @@ /* */ /* FreeType auxiliary PostScript driver component (body only). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/psaux/psauxerr.h b/src/psaux/psauxerr.h index 1d7ac6001..cc33fd2ee 100644 --- a/src/psaux/psauxerr.h +++ b/src/psaux/psauxerr.h @@ -4,7 +4,7 @@ /* */ /* PS auxiliary module error codes (specification only). */ /* */ -/* Copyright 2001-2017 by */ +/* Copyright 2001-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/psaux/psauxmod.c b/src/psaux/psauxmod.c index 52f9e9999..ee497085c 100644 --- a/src/psaux/psauxmod.c +++ b/src/psaux/psauxmod.c @@ -4,7 +4,7 @@ /* */ /* FreeType auxiliary PostScript module implementation (body). */ /* */ -/* Copyright 2000-2017 by */ +/* Copyright 2000-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/psaux/psauxmod.h b/src/psaux/psauxmod.h index 2d851c893..f30978f02 100644 --- a/src/psaux/psauxmod.h +++ b/src/psaux/psauxmod.h @@ -4,7 +4,7 @@ /* */ /* FreeType auxiliary PostScript module implementation (specification). */ /* */ -/* Copyright 2000-2017 by */ +/* Copyright 2000-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/psaux/psconv.c b/src/psaux/psconv.c index d125b0834..a03385000 100644 --- a/src/psaux/psconv.c +++ b/src/psaux/psconv.c @@ -4,7 +4,7 @@ /* */ /* Some convenience conversions (body). */ /* */ -/* Copyright 2006-2017 by */ +/* Copyright 2006-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/psaux/psconv.h b/src/psaux/psconv.h index cab254ac5..d643ffcfc 100644 --- a/src/psaux/psconv.h +++ b/src/psaux/psconv.h @@ -4,7 +4,7 @@ /* */ /* Some convenience conversions (specification). */ /* */ -/* Copyright 2006-2017 by */ +/* Copyright 2006-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/psaux/psobjs.c b/src/psaux/psobjs.c index e871cb8be..f54bc7e41 100644 --- a/src/psaux/psobjs.c +++ b/src/psaux/psobjs.c @@ -4,7 +4,7 @@ /* */ /* Auxiliary functions for PostScript fonts (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/psaux/psobjs.h b/src/psaux/psobjs.h index 08fd4fc7f..8e0fe5fa4 100644 --- a/src/psaux/psobjs.h +++ b/src/psaux/psobjs.h @@ -4,7 +4,7 @@ /* */ /* Auxiliary functions for PostScript fonts (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/psaux/rules.mk b/src/psaux/rules.mk index 266d446f8..a87bfe968 100644 --- a/src/psaux/rules.mk +++ b/src/psaux/rules.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/psaux/t1cmap.c b/src/psaux/t1cmap.c index 45b713eb7..112a7892b 100644 --- a/src/psaux/t1cmap.c +++ b/src/psaux/t1cmap.c @@ -4,7 +4,7 @@ /* */ /* Type 1 character map support (body). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/psaux/t1cmap.h b/src/psaux/t1cmap.h index 7870245a3..4308e31d2 100644 --- a/src/psaux/t1cmap.h +++ b/src/psaux/t1cmap.h @@ -4,7 +4,7 @@ /* */ /* Type 1 character map support (specification). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/psaux/t1decode.c b/src/psaux/t1decode.c index 03183c8e0..6ad145661 100644 --- a/src/psaux/t1decode.c +++ b/src/psaux/t1decode.c @@ -4,7 +4,7 @@ /* */ /* PostScript Type 1 decoding routines (body). */ /* */ -/* Copyright 2000-2017 by */ +/* Copyright 2000-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/psaux/t1decode.h b/src/psaux/t1decode.h index 879f8f999..1d9718d67 100644 --- a/src/psaux/t1decode.h +++ b/src/psaux/t1decode.h @@ -4,7 +4,7 @@ /* */ /* PostScript Type 1 decoding routines (specification). */ /* */ -/* Copyright 2000-2017 by */ +/* Copyright 2000-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/pshinter/Jamfile b/src/pshinter/Jamfile index 2b65271cc..3f5f0ae40 100644 --- a/src/pshinter/Jamfile +++ b/src/pshinter/Jamfile @@ -1,6 +1,6 @@ # FreeType 2 src/pshinter Jamfile # -# Copyright 2001-2017 by +# Copyright 2001-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/pshinter/module.mk b/src/pshinter/module.mk index 77e35c4c1..06707be3b 100644 --- a/src/pshinter/module.mk +++ b/src/pshinter/module.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/pshinter/pshalgo.c b/src/pshinter/pshalgo.c index 8e11aed39..b98077c62 100644 --- a/src/pshinter/pshalgo.c +++ b/src/pshinter/pshalgo.c @@ -4,7 +4,7 @@ /* */ /* PostScript hinting algorithm (body). */ /* */ -/* Copyright 2001-2017 by */ +/* Copyright 2001-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used */ diff --git a/src/pshinter/pshalgo.h b/src/pshinter/pshalgo.h index 62e97d152..c50683fbe 100644 --- a/src/pshinter/pshalgo.h +++ b/src/pshinter/pshalgo.h @@ -4,7 +4,7 @@ /* */ /* PostScript hinting algorithm (specification). */ /* */ -/* Copyright 2001-2017 by */ +/* Copyright 2001-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/pshinter/pshglob.c b/src/pshinter/pshglob.c index c68770c73..29f328d0e 100644 --- a/src/pshinter/pshglob.c +++ b/src/pshinter/pshglob.c @@ -5,7 +5,7 @@ /* PostScript hinter global hinting management (body). */ /* Inspired by the new auto-hinter module. */ /* */ -/* Copyright 2001-2017 by */ +/* Copyright 2001-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used */ diff --git a/src/pshinter/pshglob.h b/src/pshinter/pshglob.h index 8801cbada..cf80bf40e 100644 --- a/src/pshinter/pshglob.h +++ b/src/pshinter/pshglob.h @@ -4,7 +4,7 @@ /* */ /* PostScript hinter global hinting management. */ /* */ -/* Copyright 2001-2017 by */ +/* Copyright 2001-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/pshinter/pshinter.c b/src/pshinter/pshinter.c index 13e07e148..0eedac452 100644 --- a/src/pshinter/pshinter.c +++ b/src/pshinter/pshinter.c @@ -4,7 +4,7 @@ /* */ /* FreeType PostScript Hinting module */ /* */ -/* Copyright 2001-2017 by */ +/* Copyright 2001-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/pshinter/pshmod.c b/src/pshinter/pshmod.c index 860dc0ae8..0b8f6f99b 100644 --- a/src/pshinter/pshmod.c +++ b/src/pshinter/pshmod.c @@ -4,7 +4,7 @@ /* */ /* FreeType PostScript hinter module implementation (body). */ /* */ -/* Copyright 2001-2017 by */ +/* Copyright 2001-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/pshinter/pshmod.h b/src/pshinter/pshmod.h index 1d2b40fa1..556de2fbc 100644 --- a/src/pshinter/pshmod.h +++ b/src/pshinter/pshmod.h @@ -4,7 +4,7 @@ /* */ /* PostScript hinter module interface (specification). */ /* */ -/* Copyright 2001-2017 by */ +/* Copyright 2001-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/pshinter/pshnterr.h b/src/pshinter/pshnterr.h index 73d144e34..b9d02d295 100644 --- a/src/pshinter/pshnterr.h +++ b/src/pshinter/pshnterr.h @@ -4,7 +4,7 @@ /* */ /* PS Hinter error codes (specification only). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/pshinter/pshpic.c b/src/pshinter/pshpic.c index c0d3a64f2..465ad3188 100644 --- a/src/pshinter/pshpic.c +++ b/src/pshinter/pshpic.c @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for pshinter module. */ /* */ -/* Copyright 2009-2017 by */ +/* Copyright 2009-2018 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/pshinter/pshpic.h b/src/pshinter/pshpic.h index 8d9a01c9c..4469ba87c 100644 --- a/src/pshinter/pshpic.h +++ b/src/pshinter/pshpic.h @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for pshinter module. */ /* */ -/* Copyright 2009-2017 by */ +/* Copyright 2009-2018 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/pshinter/pshrec.c b/src/pshinter/pshrec.c index fff6d3425..6648d13d6 100644 --- a/src/pshinter/pshrec.c +++ b/src/pshinter/pshrec.c @@ -4,7 +4,7 @@ /* */ /* FreeType PostScript hints recorder (body). */ /* */ -/* Copyright 2001-2017 by */ +/* Copyright 2001-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/pshinter/pshrec.h b/src/pshinter/pshrec.h index e10bc2b12..7e3dfe0d5 100644 --- a/src/pshinter/pshrec.h +++ b/src/pshinter/pshrec.h @@ -4,7 +4,7 @@ /* */ /* Postscript (Type1/Type2) hints recorder (specification). */ /* */ -/* Copyright 2001-2017 by */ +/* Copyright 2001-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/pshinter/rules.mk b/src/pshinter/rules.mk index 2be640438..966690efc 100644 --- a/src/pshinter/rules.mk +++ b/src/pshinter/rules.mk @@ -3,7 +3,7 @@ # -# Copyright 2001-2017 by +# Copyright 2001-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/psnames/Jamfile b/src/psnames/Jamfile index 5a6e2c0bd..a0fd37397 100644 --- a/src/psnames/Jamfile +++ b/src/psnames/Jamfile @@ -1,6 +1,6 @@ # FreeType 2 src/psnames Jamfile # -# Copyright 2001-2017 by +# Copyright 2001-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/psnames/module.mk b/src/psnames/module.mk index ddd22960c..410f48a19 100644 --- a/src/psnames/module.mk +++ b/src/psnames/module.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/psnames/psmodule.c b/src/psnames/psmodule.c index 44ba9ec6a..8929ebe75 100644 --- a/src/psnames/psmodule.c +++ b/src/psnames/psmodule.c @@ -4,7 +4,7 @@ /* */ /* PSNames module implementation (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/psnames/psmodule.h b/src/psnames/psmodule.h index 6983b7923..3e94f8b43 100644 --- a/src/psnames/psmodule.h +++ b/src/psnames/psmodule.h @@ -4,7 +4,7 @@ /* */ /* High-level PSNames module interface (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/psnames/psnamerr.h b/src/psnames/psnamerr.h index f90bf5ea4..14eb76c99 100644 --- a/src/psnames/psnamerr.h +++ b/src/psnames/psnamerr.h @@ -4,7 +4,7 @@ /* */ /* PS names module error codes (specification only). */ /* */ -/* Copyright 2001-2017 by */ +/* Copyright 2001-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/psnames/psnames.c b/src/psnames/psnames.c index 22466d623..febb80d59 100644 --- a/src/psnames/psnames.c +++ b/src/psnames/psnames.c @@ -4,7 +4,7 @@ /* */ /* FreeType PSNames module component (body only). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/psnames/pspic.c b/src/psnames/pspic.c index 8b9003439..85a06f360 100644 --- a/src/psnames/pspic.c +++ b/src/psnames/pspic.c @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for psnames module. */ /* */ -/* Copyright 2009-2017 by */ +/* Copyright 2009-2018 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/psnames/pspic.h b/src/psnames/pspic.h index 14497e73f..889780cc0 100644 --- a/src/psnames/pspic.h +++ b/src/psnames/pspic.h @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for psnames module. */ /* */ -/* Copyright 2009-2017 by */ +/* Copyright 2009-2018 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/psnames/pstables.h b/src/psnames/pstables.h index 2a2b717d8..79545ee03 100644 --- a/src/psnames/pstables.h +++ b/src/psnames/pstables.h @@ -4,7 +4,7 @@ /* */ /* PostScript glyph names. */ /* */ -/* Copyright 2005-2017 by */ +/* Copyright 2005-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/psnames/rules.mk b/src/psnames/rules.mk index 69fa73220..4d629d841 100644 --- a/src/psnames/rules.mk +++ b/src/psnames/rules.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/raster/Jamfile b/src/raster/Jamfile index c9f3d6c63..838e7ef57 100644 --- a/src/raster/Jamfile +++ b/src/raster/Jamfile @@ -1,6 +1,6 @@ # FreeType 2 src/raster Jamfile # -# Copyright 2001-2017 by +# Copyright 2001-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/raster/ftmisc.h b/src/raster/ftmisc.h index d1e6627ab..7e4011907 100644 --- a/src/raster/ftmisc.h +++ b/src/raster/ftmisc.h @@ -5,7 +5,7 @@ /* Miscellaneous macros for stand-alone rasterizer (specification */ /* only). */ /* */ -/* Copyright 2005-2017 by */ +/* Copyright 2005-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used */ diff --git a/src/raster/ftraster.c b/src/raster/ftraster.c index c5643f633..4354730d5 100644 --- a/src/raster/ftraster.c +++ b/src/raster/ftraster.c @@ -4,7 +4,7 @@ /* */ /* The FreeType glyph rasterizer (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/raster/ftraster.h b/src/raster/ftraster.h index 6b3050cb3..40b5d6d32 100644 --- a/src/raster/ftraster.h +++ b/src/raster/ftraster.h @@ -4,7 +4,7 @@ /* */ /* The FreeType glyph rasterizer (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used */ diff --git a/src/raster/ftrend1.c b/src/raster/ftrend1.c index ede49167e..a7ce9731d 100644 --- a/src/raster/ftrend1.c +++ b/src/raster/ftrend1.c @@ -4,7 +4,7 @@ /* */ /* The FreeType glyph rasterizer interface (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/raster/ftrend1.h b/src/raster/ftrend1.h index cff702d14..2abdf2d70 100644 --- a/src/raster/ftrend1.h +++ b/src/raster/ftrend1.h @@ -4,7 +4,7 @@ /* */ /* The FreeType glyph rasterizer interface (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/raster/module.mk b/src/raster/module.mk index aad39cb56..b115f416b 100644 --- a/src/raster/module.mk +++ b/src/raster/module.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/raster/raster.c b/src/raster/raster.c index 46a6690b1..76edd21e1 100644 --- a/src/raster/raster.c +++ b/src/raster/raster.c @@ -4,7 +4,7 @@ /* */ /* FreeType monochrome rasterer module component (body only). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/raster/rasterrs.h b/src/raster/rasterrs.h index 0d646908a..22a3e1534 100644 --- a/src/raster/rasterrs.h +++ b/src/raster/rasterrs.h @@ -4,7 +4,7 @@ /* */ /* monochrome renderer error codes (specification only). */ /* */ -/* Copyright 2001-2017 by */ +/* Copyright 2001-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/raster/rastpic.c b/src/raster/rastpic.c index 7085339b7..1dc8981b8 100644 --- a/src/raster/rastpic.c +++ b/src/raster/rastpic.c @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for raster module. */ /* */ -/* Copyright 2009-2017 by */ +/* Copyright 2009-2018 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/raster/rastpic.h b/src/raster/rastpic.h index dcd691310..6d0877c42 100644 --- a/src/raster/rastpic.h +++ b/src/raster/rastpic.h @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for raster module. */ /* */ -/* Copyright 2009-2017 by */ +/* Copyright 2009-2018 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/raster/rules.mk b/src/raster/rules.mk index 0462c9317..9aef1f0ba 100644 --- a/src/raster/rules.mk +++ b/src/raster/rules.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/sfnt/Jamfile b/src/sfnt/Jamfile index 5971b251c..57977fc96 100644 --- a/src/sfnt/Jamfile +++ b/src/sfnt/Jamfile @@ -1,6 +1,6 @@ # FreeType 2 src/sfnt Jamfile # -# Copyright 2001-2017 by +# Copyright 2001-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/sfnt/module.mk b/src/sfnt/module.mk index 81dea17de..51ca67e78 100644 --- a/src/sfnt/module.mk +++ b/src/sfnt/module.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/sfnt/pngshim.c b/src/sfnt/pngshim.c index fdc6b2aa4..16020266a 100644 --- a/src/sfnt/pngshim.c +++ b/src/sfnt/pngshim.c @@ -4,7 +4,7 @@ /* */ /* PNG Bitmap glyph support. */ /* */ -/* Copyright 2013-2017 by */ +/* Copyright 2013-2018 by */ /* Google, Inc. */ /* Written by Stuart Gill and Behdad Esfahbod. */ /* */ diff --git a/src/sfnt/pngshim.h b/src/sfnt/pngshim.h index 344eceac1..194238c3a 100644 --- a/src/sfnt/pngshim.h +++ b/src/sfnt/pngshim.h @@ -4,7 +4,7 @@ /* */ /* PNG Bitmap glyph support. */ /* */ -/* Copyright 2013-2017 by */ +/* Copyright 2013-2018 by */ /* Google, Inc. */ /* Written by Stuart Gill and Behdad Esfahbod. */ /* */ diff --git a/src/sfnt/rules.mk b/src/sfnt/rules.mk index 230d56c94..83acc66a8 100644 --- a/src/sfnt/rules.mk +++ b/src/sfnt/rules.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/sfnt/sfdriver.c b/src/sfnt/sfdriver.c index 293306717..303e1ca9f 100644 --- a/src/sfnt/sfdriver.c +++ b/src/sfnt/sfdriver.c @@ -4,7 +4,7 @@ /* */ /* High-level SFNT driver interface (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/sfnt/sfdriver.h b/src/sfnt/sfdriver.h index 38710b60f..81c22d288 100644 --- a/src/sfnt/sfdriver.h +++ b/src/sfnt/sfdriver.h @@ -4,7 +4,7 @@ /* */ /* High-level SFNT driver interface (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/sfnt/sferrors.h b/src/sfnt/sferrors.h index 3cf73d725..74003d4b3 100644 --- a/src/sfnt/sferrors.h +++ b/src/sfnt/sferrors.h @@ -4,7 +4,7 @@ /* */ /* SFNT error codes (specification only). */ /* */ -/* Copyright 2001-2017 by */ +/* Copyright 2001-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/sfnt/sfnt.c b/src/sfnt/sfnt.c index 6cf8c9ef3..8b9a6b345 100644 --- a/src/sfnt/sfnt.c +++ b/src/sfnt/sfnt.c @@ -4,7 +4,7 @@ /* */ /* Single object library component. */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/sfnt/sfntpic.c b/src/sfnt/sfntpic.c index 8eadd601f..db2d816ce 100644 --- a/src/sfnt/sfntpic.c +++ b/src/sfnt/sfntpic.c @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for sfnt module. */ /* */ -/* Copyright 2009-2017 by */ +/* Copyright 2009-2018 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/sfnt/sfntpic.h b/src/sfnt/sfntpic.h index 3afb668db..8f43122d8 100644 --- a/src/sfnt/sfntpic.h +++ b/src/sfnt/sfntpic.h @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for sfnt module. */ /* */ -/* Copyright 2009-2017 by */ +/* Copyright 2009-2018 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/sfnt/sfobjs.c b/src/sfnt/sfobjs.c index dd37389f2..0c917030f 100644 --- a/src/sfnt/sfobjs.c +++ b/src/sfnt/sfobjs.c @@ -4,7 +4,7 @@ /* */ /* SFNT object management (base). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/sfnt/sfobjs.h b/src/sfnt/sfobjs.h index 705381459..1b8d1be5b 100644 --- a/src/sfnt/sfobjs.h +++ b/src/sfnt/sfobjs.h @@ -4,7 +4,7 @@ /* */ /* SFNT object management (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/sfnt/ttbdf.c b/src/sfnt/ttbdf.c index 2196e3791..534201f22 100644 --- a/src/sfnt/ttbdf.c +++ b/src/sfnt/ttbdf.c @@ -4,7 +4,7 @@ /* */ /* TrueType and OpenType embedded BDF properties (body). */ /* */ -/* Copyright 2005-2017 by */ +/* Copyright 2005-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/sfnt/ttbdf.h b/src/sfnt/ttbdf.h index 31d4ab16f..809a66300 100644 --- a/src/sfnt/ttbdf.h +++ b/src/sfnt/ttbdf.h @@ -4,7 +4,7 @@ /* */ /* TrueType and OpenType embedded BDF properties (specification). */ /* */ -/* Copyright 2005-2017 by */ +/* Copyright 2005-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/sfnt/ttcmap.c b/src/sfnt/ttcmap.c index 45414d1ae..8cc70f759 100644 --- a/src/sfnt/ttcmap.c +++ b/src/sfnt/ttcmap.c @@ -4,7 +4,7 @@ /* */ /* TrueType character mapping table (cmap) support (body). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/sfnt/ttcmap.h b/src/sfnt/ttcmap.h index f7de0437b..d264d99d2 100644 --- a/src/sfnt/ttcmap.h +++ b/src/sfnt/ttcmap.h @@ -4,7 +4,7 @@ /* */ /* TrueType character mapping table (cmap) support (specification). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/sfnt/ttcmapc.h b/src/sfnt/ttcmapc.h index 9a5e70825..4980e9dd3 100644 --- a/src/sfnt/ttcmapc.h +++ b/src/sfnt/ttcmapc.h @@ -4,7 +4,7 @@ /* */ /* TT CMAP classes definitions (specification only). */ /* */ -/* Copyright 2009-2017 by */ +/* Copyright 2009-2018 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/sfnt/ttkern.c b/src/sfnt/ttkern.c index 53d2436ae..68f15a201 100644 --- a/src/sfnt/ttkern.c +++ b/src/sfnt/ttkern.c @@ -5,7 +5,7 @@ /* Load the basic TrueType kerning table. This doesn't handle */ /* kerning data within the GPOS table at the moment. */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/sfnt/ttkern.h b/src/sfnt/ttkern.h index db1a30bdb..4e45d0964 100644 --- a/src/sfnt/ttkern.h +++ b/src/sfnt/ttkern.h @@ -5,7 +5,7 @@ /* Load the basic TrueType kerning table. This doesn't handle */ /* kerning data within the GPOS table at the moment. */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/sfnt/ttload.c b/src/sfnt/ttload.c index 23c8e7df9..a86a546c3 100644 --- a/src/sfnt/ttload.c +++ b/src/sfnt/ttload.c @@ -5,7 +5,7 @@ /* Load the basic TrueType tables, i.e., tables that can be either in */ /* TTF or OTF fonts (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/sfnt/ttload.h b/src/sfnt/ttload.h index 296da86ed..f94be8b7b 100644 --- a/src/sfnt/ttload.h +++ b/src/sfnt/ttload.h @@ -5,7 +5,7 @@ /* Load the basic TrueType tables, i.e., tables that can be either in */ /* TTF or OTF fonts (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/sfnt/ttmtx.c b/src/sfnt/ttmtx.c index 394c6db85..6ddda95b5 100644 --- a/src/sfnt/ttmtx.c +++ b/src/sfnt/ttmtx.c @@ -4,7 +4,7 @@ /* */ /* Load the metrics tables common to TTF and OTF fonts (body). */ /* */ -/* Copyright 2006-2017 by */ +/* Copyright 2006-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/sfnt/ttmtx.h b/src/sfnt/ttmtx.h index 2b93ab2f0..ab00acd79 100644 --- a/src/sfnt/ttmtx.h +++ b/src/sfnt/ttmtx.h @@ -4,7 +4,7 @@ /* */ /* Load the metrics tables common to TTF and OTF fonts (specification). */ /* */ -/* Copyright 2006-2017 by */ +/* Copyright 2006-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/sfnt/ttpost.c b/src/sfnt/ttpost.c index 69929c8d4..f14064999 100644 --- a/src/sfnt/ttpost.c +++ b/src/sfnt/ttpost.c @@ -5,7 +5,7 @@ /* PostScript name table processing for TrueType and OpenType fonts */ /* (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/sfnt/ttpost.h b/src/sfnt/ttpost.h index 722485e32..3bec07e44 100644 --- a/src/sfnt/ttpost.h +++ b/src/sfnt/ttpost.h @@ -5,7 +5,7 @@ /* PostScript name table processing for TrueType and OpenType fonts */ /* (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/sfnt/ttsbit.c b/src/sfnt/ttsbit.c index c55c4990b..53e61756d 100644 --- a/src/sfnt/ttsbit.c +++ b/src/sfnt/ttsbit.c @@ -4,7 +4,7 @@ /* */ /* TrueType and OpenType embedded bitmap support (body). */ /* */ -/* Copyright 2005-2017 by */ +/* Copyright 2005-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* Copyright 2013 by Google, Inc. */ diff --git a/src/sfnt/ttsbit.h b/src/sfnt/ttsbit.h index e859ddda4..ce2af3c16 100644 --- a/src/sfnt/ttsbit.h +++ b/src/sfnt/ttsbit.h @@ -4,7 +4,7 @@ /* */ /* TrueType and OpenType embedded bitmap support (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/smooth/Jamfile b/src/smooth/Jamfile index 4cd0769ee..9957d5e91 100644 --- a/src/smooth/Jamfile +++ b/src/smooth/Jamfile @@ -1,6 +1,6 @@ # FreeType 2 src/smooth Jamfile # -# Copyright 2001-2017 by +# Copyright 2001-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/smooth/ftgrays.c b/src/smooth/ftgrays.c index d43dd457d..6ce6f8644 100644 --- a/src/smooth/ftgrays.c +++ b/src/smooth/ftgrays.c @@ -4,7 +4,7 @@ /* */ /* A new `perfect' anti-aliasing renderer (body). */ /* */ -/* Copyright 2000-2017 by */ +/* Copyright 2000-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/smooth/ftgrays.h b/src/smooth/ftgrays.h index a5447da1a..9e11ca675 100644 --- a/src/smooth/ftgrays.h +++ b/src/smooth/ftgrays.h @@ -4,7 +4,7 @@ /* */ /* FreeType smooth renderer declaration */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/smooth/ftsmerrs.h b/src/smooth/ftsmerrs.h index a528c6183..226dc1b00 100644 --- a/src/smooth/ftsmerrs.h +++ b/src/smooth/ftsmerrs.h @@ -4,7 +4,7 @@ /* */ /* smooth renderer error codes (specification only). */ /* */ -/* Copyright 2001-2017 by */ +/* Copyright 2001-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/smooth/ftsmooth.c b/src/smooth/ftsmooth.c index bccc54bbb..ef176bdf1 100644 --- a/src/smooth/ftsmooth.c +++ b/src/smooth/ftsmooth.c @@ -4,7 +4,7 @@ /* */ /* Anti-aliasing renderer interface (body). */ /* */ -/* Copyright 2000-2017 by */ +/* Copyright 2000-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/smooth/ftsmooth.h b/src/smooth/ftsmooth.h index 6dfd65726..c76ffc503 100644 --- a/src/smooth/ftsmooth.h +++ b/src/smooth/ftsmooth.h @@ -4,7 +4,7 @@ /* */ /* Anti-aliasing renderer interface (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/smooth/ftspic.c b/src/smooth/ftspic.c index fb89be348..10f04cf4c 100644 --- a/src/smooth/ftspic.c +++ b/src/smooth/ftspic.c @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for smooth module. */ /* */ -/* Copyright 2009-2017 by */ +/* Copyright 2009-2018 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/smooth/ftspic.h b/src/smooth/ftspic.h index 9ddd1c790..80fb64cff 100644 --- a/src/smooth/ftspic.h +++ b/src/smooth/ftspic.h @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for smooth module. */ /* */ -/* Copyright 2009-2017 by */ +/* Copyright 2009-2018 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/smooth/module.mk b/src/smooth/module.mk index 804e9b138..5b8bc3be3 100644 --- a/src/smooth/module.mk +++ b/src/smooth/module.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/smooth/rules.mk b/src/smooth/rules.mk index dfdc9bc30..f30824a36 100644 --- a/src/smooth/rules.mk +++ b/src/smooth/rules.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/smooth/smooth.c b/src/smooth/smooth.c index e0460d9d4..5249a8931 100644 --- a/src/smooth/smooth.c +++ b/src/smooth/smooth.c @@ -4,7 +4,7 @@ /* */ /* FreeType anti-aliasing rasterer module component (body only). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/tools/afblue.pl b/src/tools/afblue.pl index 027b63041..7c6f1a7df 100644 --- a/src/tools/afblue.pl +++ b/src/tools/afblue.pl @@ -5,7 +5,7 @@ # # Process a blue zone character data file. # -# Copyright 2013-2017 by +# Copyright 2013-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, diff --git a/src/tools/docmaker/content.py b/src/tools/docmaker/content.py index d432febc5..c9969dbe5 100644 --- a/src/tools/docmaker/content.py +++ b/src/tools/docmaker/content.py @@ -3,7 +3,7 @@ # # Parse comment blocks to build content blocks (library file). # -# Copyright 2002-2017 by +# Copyright 2002-2018 by # David Turner. # # This file is part of the FreeType project, and may only be used, diff --git a/src/tools/docmaker/docmaker.py b/src/tools/docmaker/docmaker.py index 4e25ff0f8..253a4d35a 100644 --- a/src/tools/docmaker/docmaker.py +++ b/src/tools/docmaker/docmaker.py @@ -4,7 +4,7 @@ # # Convert source code markup to HTML documentation. # -# Copyright 2002-2017 by +# Copyright 2002-2018 by # David Turner. # # This file is part of the FreeType project, and may only be used, diff --git a/src/tools/docmaker/formatter.py b/src/tools/docmaker/formatter.py index 2745754f3..2708fd40d 100644 --- a/src/tools/docmaker/formatter.py +++ b/src/tools/docmaker/formatter.py @@ -3,7 +3,7 @@ # # Convert parsed content blocks to a structured document (library file). # -# Copyright 2002-2017 by +# Copyright 2002-2018 by # David Turner. # # This file is part of the FreeType project, and may only be used, diff --git a/src/tools/docmaker/sources.py b/src/tools/docmaker/sources.py index b7633134c..2cd5a3379 100644 --- a/src/tools/docmaker/sources.py +++ b/src/tools/docmaker/sources.py @@ -3,7 +3,7 @@ # # Convert source code comments to multi-line blocks (library file). # -# Copyright 2002-2017 by +# Copyright 2002-2018 by # David Turner. # # This file is part of the FreeType project, and may only be used, diff --git a/src/tools/docmaker/tohtml.py b/src/tools/docmaker/tohtml.py index bbed87d01..7f5ecda41 100644 --- a/src/tools/docmaker/tohtml.py +++ b/src/tools/docmaker/tohtml.py @@ -3,7 +3,7 @@ # # A sub-class container of the `Formatter' class to produce HTML. # -# Copyright 2002-2017 by +# Copyright 2002-2018 by # David Turner. # # This file is part of the FreeType project, and may only be used, diff --git a/src/tools/docmaker/utils.py b/src/tools/docmaker/utils.py index ba5b2e759..f40f1674a 100644 --- a/src/tools/docmaker/utils.py +++ b/src/tools/docmaker/utils.py @@ -3,7 +3,7 @@ # # Auxiliary functions for the `docmaker' tool (library file). # -# Copyright 2002-2017 by +# Copyright 2002-2018 by # David Turner. # # This file is part of the FreeType project, and may only be used, diff --git a/src/tools/ftfuzzer/README b/src/tools/ftfuzzer/README index a41f96866..09d8e9f32 100644 --- a/src/tools/ftfuzzer/README +++ b/src/tools/ftfuzzer/README @@ -68,7 +68,7 @@ a convenience `main' function. Link it with `ftfuzzer.cc', ---------------------------------------------------------------------- -Copyright 2015-2017 by +Copyright 2015-2018 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, diff --git a/src/tools/ftfuzzer/ftfuzzer.cc b/src/tools/ftfuzzer/ftfuzzer.cc index 1382adaf9..acf2bc982 100644 --- a/src/tools/ftfuzzer/ftfuzzer.cc +++ b/src/tools/ftfuzzer/ftfuzzer.cc @@ -2,7 +2,7 @@ // // A fuzzing function to test FreeType with libFuzzer. // -// Copyright 2015-2017 by +// Copyright 2015-2018 by // David Turner, Robert Wilhelm, and Werner Lemberg. // // This file is part of the FreeType project, and may only be used, diff --git a/src/tools/ftfuzzer/ftmutator.cc b/src/tools/ftfuzzer/ftmutator.cc index 22aa5a777..ae4b14040 100644 --- a/src/tools/ftfuzzer/ftmutator.cc +++ b/src/tools/ftfuzzer/ftmutator.cc @@ -2,7 +2,7 @@ // // A custom fuzzer mutator to test for FreeType with libFuzzer. // -// Copyright 2015-2017 by +// Copyright 2015-2018 by // David Turner, Robert Wilhelm, and Werner Lemberg. // // This file is part of the FreeType project, and may only be used, diff --git a/src/tools/ftfuzzer/rasterfuzzer.cc b/src/tools/ftfuzzer/rasterfuzzer.cc index ae9b1a56d..c69b95ea0 100644 --- a/src/tools/ftfuzzer/rasterfuzzer.cc +++ b/src/tools/ftfuzzer/rasterfuzzer.cc @@ -2,7 +2,7 @@ // // A fuzzing function to test FreeType's rasterizers with libFuzzer. // -// Copyright 2016-2017 by +// Copyright 2016-2018 by // David Turner, Robert Wilhelm, and Werner Lemberg. // // This file is part of the FreeType project, and may only be used, diff --git a/src/tools/ftfuzzer/runinput.cc b/src/tools/ftfuzzer/runinput.cc index 15261207e..2b02f5758 100644 --- a/src/tools/ftfuzzer/runinput.cc +++ b/src/tools/ftfuzzer/runinput.cc @@ -2,7 +2,7 @@ // // A `main' function for fuzzers like `ftfuzzer.cc'. // -// Copyright 2015-2017 by +// Copyright 2015-2018 by // David Turner, Robert Wilhelm, and Werner Lemberg. // // This file is part of the FreeType project, and may only be used, diff --git a/src/tools/glnames.py b/src/tools/glnames.py index 1d8d524a5..b048d2936 100644 --- a/src/tools/glnames.py +++ b/src/tools/glnames.py @@ -6,7 +6,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -5318,7 +5318,7 @@ def main(): write( "/* */\n" ) write( "/* PostScript glyph names. */\n" ) write( "/* */\n" ) - write( "/* Copyright 2005-2017 by */\n" ) + write( "/* Copyright 2005-2018 by */\n" ) write( "/* David Turner, Robert Wilhelm, and Werner Lemberg. */\n" ) write( "/* */\n" ) write( "/* This file is part of the FreeType project, and may only be used, */\n" ) diff --git a/src/tools/update-copyright-year b/src/tools/update-copyright-year index 4b04bfc99..934f11cf0 100755 --- a/src/tools/update-copyright-year +++ b/src/tools/update-copyright-year @@ -2,7 +2,7 @@ eval '(exit $?0)' && eval 'exec perl -wS -i "$0" ${1+"$@"}' & eval 'exec perl -wS -i "$0" $argv:q' if 0; -# Copyright 2015-2017 by +# Copyright 2015-2018 by # Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/truetype/Jamfile b/src/truetype/Jamfile index 22d406cd7..e321fba14 100644 --- a/src/truetype/Jamfile +++ b/src/truetype/Jamfile @@ -1,6 +1,6 @@ # FreeType 2 src/truetype Jamfile # -# Copyright 2001-2017 by +# Copyright 2001-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/truetype/module.mk b/src/truetype/module.mk index 563c584e2..16bc9c8b2 100644 --- a/src/truetype/module.mk +++ b/src/truetype/module.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/truetype/rules.mk b/src/truetype/rules.mk index ad3d00745..e16113f12 100644 --- a/src/truetype/rules.mk +++ b/src/truetype/rules.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/truetype/truetype.c b/src/truetype/truetype.c index 301b82ad1..484370975 100644 --- a/src/truetype/truetype.c +++ b/src/truetype/truetype.c @@ -4,7 +4,7 @@ /* */ /* FreeType TrueType driver component (body only). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/truetype/ttdriver.c b/src/truetype/ttdriver.c index a1d1cfdfe..820cafbb8 100644 --- a/src/truetype/ttdriver.c +++ b/src/truetype/ttdriver.c @@ -4,7 +4,7 @@ /* */ /* TrueType font driver implementation (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/truetype/ttdriver.h b/src/truetype/ttdriver.h index 3bcba7f74..707aa68ed 100644 --- a/src/truetype/ttdriver.h +++ b/src/truetype/ttdriver.h @@ -4,7 +4,7 @@ /* */ /* High-level TrueType driver interface (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/truetype/tterrors.h b/src/truetype/tterrors.h index a49f20515..88bca3a04 100644 --- a/src/truetype/tterrors.h +++ b/src/truetype/tterrors.h @@ -4,7 +4,7 @@ /* */ /* TrueType error codes (specification only). */ /* */ -/* Copyright 2001-2017 by */ +/* Copyright 2001-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c index f960ce600..b62f44013 100644 --- a/src/truetype/ttgload.c +++ b/src/truetype/ttgload.c @@ -4,7 +4,7 @@ /* */ /* TrueType Glyph Loader (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/truetype/ttgload.h b/src/truetype/ttgload.h index 1dd6c841d..d237cfd28 100644 --- a/src/truetype/ttgload.h +++ b/src/truetype/ttgload.h @@ -4,7 +4,7 @@ /* */ /* TrueType Glyph Loader (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c index 2acd7e05b..2bf7d184a 100644 --- a/src/truetype/ttgxvar.c +++ b/src/truetype/ttgxvar.c @@ -4,7 +4,7 @@ /* */ /* TrueType GX Font Variation loader */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* David Turner, Robert Wilhelm, Werner Lemberg, and George Williams. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/truetype/ttgxvar.h b/src/truetype/ttgxvar.h index bce66ee5c..a37bb9026 100644 --- a/src/truetype/ttgxvar.h +++ b/src/truetype/ttgxvar.h @@ -4,7 +4,7 @@ /* */ /* TrueType GX Font Variation loader (specification) */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* David Turner, Robert Wilhelm, Werner Lemberg and George Williams. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c index db5aaa32c..d855aaaa9 100644 --- a/src/truetype/ttinterp.c +++ b/src/truetype/ttinterp.c @@ -4,7 +4,7 @@ /* */ /* TrueType bytecode interpreter (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/truetype/ttinterp.h b/src/truetype/ttinterp.h index abbecfcee..2966439ea 100644 --- a/src/truetype/ttinterp.h +++ b/src/truetype/ttinterp.h @@ -4,7 +4,7 @@ /* */ /* TrueType bytecode interpreter (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/truetype/ttobjs.c b/src/truetype/ttobjs.c index f2334f313..bc8086f25 100644 --- a/src/truetype/ttobjs.c +++ b/src/truetype/ttobjs.c @@ -4,7 +4,7 @@ /* */ /* Objects manager (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/truetype/ttobjs.h b/src/truetype/ttobjs.h index cdacee75e..38fa30e4e 100644 --- a/src/truetype/ttobjs.h +++ b/src/truetype/ttobjs.h @@ -4,7 +4,7 @@ /* */ /* Objects manager (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/truetype/ttpic.c b/src/truetype/ttpic.c index 66bd7e193..cdbb80639 100644 --- a/src/truetype/ttpic.c +++ b/src/truetype/ttpic.c @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for truetype module. */ /* */ -/* Copyright 2009-2017 by */ +/* Copyright 2009-2018 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/truetype/ttpic.h b/src/truetype/ttpic.h index 1410cd73c..df878ae6f 100644 --- a/src/truetype/ttpic.h +++ b/src/truetype/ttpic.h @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for truetype module. */ /* */ -/* Copyright 2009-2017 by */ +/* Copyright 2009-2018 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/truetype/ttpload.c b/src/truetype/ttpload.c index bcf6b34f6..d9526ad08 100644 --- a/src/truetype/ttpload.c +++ b/src/truetype/ttpload.c @@ -4,7 +4,7 @@ /* */ /* TrueType-specific tables loader (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/truetype/ttpload.h b/src/truetype/ttpload.h index 79079f345..fa1252724 100644 --- a/src/truetype/ttpload.h +++ b/src/truetype/ttpload.h @@ -4,7 +4,7 @@ /* */ /* TrueType-specific tables loader (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/truetype/ttsubpix.c b/src/truetype/ttsubpix.c index 3f473f850..d94bcc8b5 100644 --- a/src/truetype/ttsubpix.c +++ b/src/truetype/ttsubpix.c @@ -4,7 +4,7 @@ /* */ /* TrueType Subpixel Hinting. */ /* */ -/* Copyright 2010-2017 by */ +/* Copyright 2010-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/truetype/ttsubpix.h b/src/truetype/ttsubpix.h index c68f97ff0..1070bb016 100644 --- a/src/truetype/ttsubpix.h +++ b/src/truetype/ttsubpix.h @@ -4,7 +4,7 @@ /* */ /* TrueType Subpixel Hinting. */ /* */ -/* Copyright 2010-2017 by */ +/* Copyright 2010-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/type1/Jamfile b/src/type1/Jamfile index 6c10a31a1..b94b7d0aa 100644 --- a/src/type1/Jamfile +++ b/src/type1/Jamfile @@ -1,6 +1,6 @@ # FreeType 2 src/type1 Jamfile # -# Copyright 2001-2017 by +# Copyright 2001-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/type1/module.mk b/src/type1/module.mk index f299d6fe8..3fea5cc16 100644 --- a/src/type1/module.mk +++ b/src/type1/module.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/type1/rules.mk b/src/type1/rules.mk index 97bef288f..cb1a14286 100644 --- a/src/type1/rules.mk +++ b/src/type1/rules.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/type1/t1afm.c b/src/type1/t1afm.c index 11a2646fc..61053d9a6 100644 --- a/src/type1/t1afm.c +++ b/src/type1/t1afm.c @@ -4,7 +4,7 @@ /* */ /* AFM support for Type 1 fonts (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/type1/t1afm.h b/src/type1/t1afm.h index 9f62cd013..cb8d302b4 100644 --- a/src/type1/t1afm.h +++ b/src/type1/t1afm.h @@ -4,7 +4,7 @@ /* */ /* AFM support for Type 1 fonts (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/type1/t1driver.c b/src/type1/t1driver.c index 57a91ae92..029b410b4 100644 --- a/src/type1/t1driver.c +++ b/src/type1/t1driver.c @@ -4,7 +4,7 @@ /* */ /* Type 1 driver interface (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/type1/t1driver.h b/src/type1/t1driver.h index 292786448..2b1507233 100644 --- a/src/type1/t1driver.h +++ b/src/type1/t1driver.h @@ -4,7 +4,7 @@ /* */ /* High-level Type 1 driver interface (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/type1/t1errors.h b/src/type1/t1errors.h index 492dbb4a4..9e0151b95 100644 --- a/src/type1/t1errors.h +++ b/src/type1/t1errors.h @@ -4,7 +4,7 @@ /* */ /* Type 1 error codes (specification only). */ /* */ -/* Copyright 2001-2017 by */ +/* Copyright 2001-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/type1/t1gload.c b/src/type1/t1gload.c index 5bda3a537..87d40e756 100644 --- a/src/type1/t1gload.c +++ b/src/type1/t1gload.c @@ -4,7 +4,7 @@ /* */ /* Type 1 Glyph Loader (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/type1/t1gload.h b/src/type1/t1gload.h index cc4d5e734..72ef76f6a 100644 --- a/src/type1/t1gload.h +++ b/src/type1/t1gload.h @@ -4,7 +4,7 @@ /* */ /* Type 1 Glyph Loader (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/type1/t1load.c b/src/type1/t1load.c index 70e7c68df..2b8d4893c 100644 --- a/src/type1/t1load.c +++ b/src/type1/t1load.c @@ -4,7 +4,7 @@ /* */ /* Type 1 font loader (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/type1/t1load.h b/src/type1/t1load.h index 492ba5add..03be3f7f9 100644 --- a/src/type1/t1load.h +++ b/src/type1/t1load.h @@ -4,7 +4,7 @@ /* */ /* Type 1 font loader (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/type1/t1objs.c b/src/type1/t1objs.c index c00b322b1..7333c4c95 100644 --- a/src/type1/t1objs.c +++ b/src/type1/t1objs.c @@ -4,7 +4,7 @@ /* */ /* Type 1 objects manager (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/type1/t1objs.h b/src/type1/t1objs.h index d009b394b..8298e036f 100644 --- a/src/type1/t1objs.h +++ b/src/type1/t1objs.h @@ -4,7 +4,7 @@ /* */ /* Type 1 objects manager (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/type1/t1parse.c b/src/type1/t1parse.c index 18dd26434..8e201e5ef 100644 --- a/src/type1/t1parse.c +++ b/src/type1/t1parse.c @@ -4,7 +4,7 @@ /* */ /* Type 1 parser (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/type1/t1parse.h b/src/type1/t1parse.h index 3396680d1..4ac82ae91 100644 --- a/src/type1/t1parse.h +++ b/src/type1/t1parse.h @@ -4,7 +4,7 @@ /* */ /* Type 1 parser (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/type1/t1tokens.h b/src/type1/t1tokens.h index ca0c55f90..43a65d88e 100644 --- a/src/type1/t1tokens.h +++ b/src/type1/t1tokens.h @@ -4,7 +4,7 @@ /* */ /* Type 1 tokenizer (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/type1/type1.c b/src/type1/type1.c index 81795376e..72eff59bf 100644 --- a/src/type1/type1.c +++ b/src/type1/type1.c @@ -4,7 +4,7 @@ /* */ /* FreeType Type 1 driver component (body only). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/type42/Jamfile b/src/type42/Jamfile index b826bbc46..b98de05a7 100644 --- a/src/type42/Jamfile +++ b/src/type42/Jamfile @@ -1,6 +1,6 @@ # FreeType 2 src/type42 Jamfile # -# Copyright 2002-2017 by +# Copyright 2002-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/type42/module.mk b/src/type42/module.mk index 2f5280680..3d4732bb6 100644 --- a/src/type42/module.mk +++ b/src/type42/module.mk @@ -3,7 +3,7 @@ # -# Copyright 2002-2017 by +# Copyright 2002-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/type42/rules.mk b/src/type42/rules.mk index d7e896501..9325d3898 100644 --- a/src/type42/rules.mk +++ b/src/type42/rules.mk @@ -3,7 +3,7 @@ # -# Copyright 2002-2017 by +# Copyright 2002-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/type42/t42drivr.c b/src/type42/t42drivr.c index 366cfb3a1..f579b2708 100644 --- a/src/type42/t42drivr.c +++ b/src/type42/t42drivr.c @@ -4,7 +4,7 @@ /* */ /* High-level Type 42 driver interface (body). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* Roberto Alameda. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/type42/t42drivr.h b/src/type42/t42drivr.h index 1ac4a0a1a..3667f3e06 100644 --- a/src/type42/t42drivr.h +++ b/src/type42/t42drivr.h @@ -4,7 +4,7 @@ /* */ /* High-level Type 42 driver interface (specification). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* Roberto Alameda. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/type42/t42error.h b/src/type42/t42error.h index fda92abf5..e3978a760 100644 --- a/src/type42/t42error.h +++ b/src/type42/t42error.h @@ -4,7 +4,7 @@ /* */ /* Type 42 error codes (specification only). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/type42/t42objs.c b/src/type42/t42objs.c index 1c4ebd768..66e5c4038 100644 --- a/src/type42/t42objs.c +++ b/src/type42/t42objs.c @@ -4,7 +4,7 @@ /* */ /* Type 42 objects manager (body). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* Roberto Alameda. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/type42/t42objs.h b/src/type42/t42objs.h index eb4c5bf69..3bad5135e 100644 --- a/src/type42/t42objs.h +++ b/src/type42/t42objs.h @@ -4,7 +4,7 @@ /* */ /* Type 42 objects manager (specification). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* Roberto Alameda. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/type42/t42parse.c b/src/type42/t42parse.c index e7c6770bd..4813d1f3f 100644 --- a/src/type42/t42parse.c +++ b/src/type42/t42parse.c @@ -4,7 +4,7 @@ /* */ /* Type 42 font parser (body). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* Roberto Alameda. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/type42/t42parse.h b/src/type42/t42parse.h index 7a68606f2..f35d23de6 100644 --- a/src/type42/t42parse.h +++ b/src/type42/t42parse.h @@ -4,7 +4,7 @@ /* */ /* Type 42 font parser (specification). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* Roberto Alameda. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/type42/t42types.h b/src/type42/t42types.h index 2306ab6c7..d0aa2de57 100644 --- a/src/type42/t42types.h +++ b/src/type42/t42types.h @@ -4,7 +4,7 @@ /* */ /* Type 42 font data types (specification only). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* Roberto Alameda. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/type42/type42.c b/src/type42/type42.c index ae8ac2678..6a89cfbed 100644 --- a/src/type42/type42.c +++ b/src/type42/type42.c @@ -4,7 +4,7 @@ /* */ /* FreeType Type 42 driver component. */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/winfonts/Jamfile b/src/winfonts/Jamfile index 52aa7f936..4385e3b39 100644 --- a/src/winfonts/Jamfile +++ b/src/winfonts/Jamfile @@ -1,6 +1,6 @@ # FreeType 2 src/winfonts Jamfile # -# Copyright 2001-2017 by +# Copyright 2001-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/winfonts/fnterrs.h b/src/winfonts/fnterrs.h index 4251021a7..3a86af5aa 100644 --- a/src/winfonts/fnterrs.h +++ b/src/winfonts/fnterrs.h @@ -4,7 +4,7 @@ /* */ /* Win FNT/FON error codes (specification only). */ /* */ -/* Copyright 2001-2017 by */ +/* Copyright 2001-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/winfonts/module.mk b/src/winfonts/module.mk index ffc53a19f..13f9077cf 100644 --- a/src/winfonts/module.mk +++ b/src/winfonts/module.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/winfonts/rules.mk b/src/winfonts/rules.mk index 73e825d9a..d694d1a77 100644 --- a/src/winfonts/rules.mk +++ b/src/winfonts/rules.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/winfonts/winfnt.c b/src/winfonts/winfnt.c index 4c4796231..36bd3148d 100644 --- a/src/winfonts/winfnt.c +++ b/src/winfonts/winfnt.c @@ -4,7 +4,7 @@ /* */ /* FreeType font driver for Windows FNT/FON files */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* Copyright 2003 Huw D M Davies for Codeweavers */ /* Copyright 2007 Dmitry Timoshkov for Codeweavers */ diff --git a/src/winfonts/winfnt.h b/src/winfonts/winfnt.h index 884b645a2..4885c9d74 100644 --- a/src/winfonts/winfnt.h +++ b/src/winfonts/winfnt.h @@ -4,7 +4,7 @@ /* */ /* FreeType font driver for Windows FNT/FON files */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* Copyright 2007 Dmitry Timoshkov for Codeweavers */ /* */ diff --git a/vms_make.com b/vms_make.com index db0dca611..6222c5e8e 100644 --- a/vms_make.com +++ b/vms_make.com @@ -1,6 +1,6 @@ $! make FreeType 2 under OpenVMS $! -$! Copyright 2003-2017 by +$! Copyright 2003-2018 by $! David Turner, Robert Wilhelm, and Werner Lemberg. $! $! This file is part of the FreeType project, and may only be used, modified, From ecfdfd4498d6c1313b3faaa9d7cf1917e4be98c5 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Wed, 3 Jan 2018 00:20:11 +0100 Subject: [PATCH 392/470] [truetype] Make blend/design coordinate round-tripping work. Behdad reported that setting blend coordinates, then getting design coordinates did incorrectly return the default instance's coordinates. * src/truetype/ttgxvar.c (tt_set_mm_blend): Fix it. --- ChangeLog | 10 ++++++++++ src/truetype/ttgxvar.c | 4 ++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 57058eaf3..7d6fce78c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2018-01-03 Werner Lemberg + + [truetype] Make blend/design coordinate round-tripping work. + + Behdad reported that setting blend coordinates, then getting design + coordinates did incorrectly return the default instance's + coordinates. + + * src/truetype/ttgxvar.c (tt_set_mm_blend): Fix it. + 2017-12-31 Werner Lemberg * src/sfnt/ttcmap.c (tt_cmap2_char_next): Fix endless loop. diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c index 2bf7d184a..5378852c6 100644 --- a/src/truetype/ttgxvar.c +++ b/src/truetype/ttgxvar.c @@ -2493,14 +2493,14 @@ coords, num_coords * sizeof ( FT_Fixed ) ); + face->doblend = TRUE; + if ( set_design_coords ) ft_var_to_design( face, all_design_coords ? blend->num_axis : num_coords, blend->normalizedcoords, blend->coords ); - face->doblend = TRUE; - if ( face->cvt ) { switch ( manageCvt ) From c94d042be61ce3a1cdcf281c473e674a76b117ba Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Tue, 2 Jan 2018 21:38:35 -0500 Subject: [PATCH 393/470] * include/freetype/config/ftconfig.h (FT_EXPORT, FT_EXPORT_DEF) [_MSC_VER]: Limit Visual C++ attributes. --- ChangeLog | 5 +++++ include/freetype/config/ftconfig.h | 17 +++++++++++------ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7d6fce78c..1a49bdd0d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2018-01-03 Alexei Podtelezhnikov + + * include/freetype/config/ftconfig.h (FT_EXPORT, FT_EXPORT_DEF) + [_MSC_VER]: Limit Visual C++ attributes. + 2018-01-03 Werner Lemberg [truetype] Make blend/design coordinate round-tripping work. diff --git a/include/freetype/config/ftconfig.h b/include/freetype/config/ftconfig.h index 86dc44509..f539e9a17 100644 --- a/include/freetype/config/ftconfig.h +++ b/include/freetype/config/ftconfig.h @@ -455,22 +455,27 @@ FT_BEGIN_HEADER /* */ #ifndef FT_EXPORT -#if defined( _DLL ) -#define FT_EXPORT( x ) __declspec( dllexport ) x -#elif defined( __cplusplus ) +#ifdef __cplusplus #define FT_EXPORT( x ) extern "C" x #else #define FT_EXPORT( x ) extern x #endif +#ifdef _MSC_VER +#undef FT_EXPORT +#ifdef _DLL +#define FT_EXPORT( x ) __declspec( dllexport ) x +#else +#define FT_EXPORT( x ) __declspec( dllimport ) x +#endif +#endif + #endif /* !FT_EXPORT */ #ifndef FT_EXPORT_DEF -#if defined( _DLL ) -#define FT_EXPORT_DEF( x ) __declspec( dllexport ) x -#elif defined( __cplusplus ) +#ifdef __cplusplus #define FT_EXPORT_DEF( x ) extern "C" x #else #define FT_EXPORT_DEF( x ) extern x From 20b3e34846f39a423108a8745f07682fd74dc25d Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Tue, 2 Jan 2018 22:12:09 -0500 Subject: [PATCH 394/470] Move internal LCD-related declarations. * include/freetype/ftlcdfil.h (ft_lcd_padding, ft_lcd_filter_fir): Move from here... * include/freetype/internal/ftobjs.h: ... to here. --- ChangeLog | 8 ++++++++ include/freetype/ftlcdfil.h | 21 --------------------- include/freetype/internal/ftobjs.h | 21 +++++++++++++++++++++ 3 files changed, 29 insertions(+), 21 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1a49bdd0d..759e5b371 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2018-01-03 Alexei Podtelezhnikov + + Move internal LCD-related declarations. + + * include/freetype/ftlcdfil.h (ft_lcd_padding, ft_lcd_filter_fir): + Move from here... + * include/freetype/internal/ftobjs.h: ... to here. + 2018-01-03 Alexei Podtelezhnikov * include/freetype/config/ftconfig.h (FT_EXPORT, FT_EXPORT_DEF) diff --git a/include/freetype/ftlcdfil.h b/include/freetype/ftlcdfil.h index 7dce4e4ea..2a27196cb 100644 --- a/include/freetype/ftlcdfil.h +++ b/include/freetype/ftlcdfil.h @@ -298,27 +298,6 @@ FT_BEGIN_HEADER typedef FT_Byte FT_LcdFiveTapFilter[FT_LCD_FILTER_FIVE_TAPS]; - FT_BASE( void ) - ft_lcd_padding( FT_Pos* Min, - FT_Pos* Max, - FT_GlyphSlot slot ); - -#ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING - - typedef void (*FT_Bitmap_LcdFilterFunc)( FT_Bitmap* bitmap, - FT_Render_Mode render_mode, - FT_Byte* weights ); - - - /* This is the default LCD filter, an in-place, 5-tap FIR filter. */ - FT_BASE( void ) - ft_lcd_filter_fir( FT_Bitmap* bitmap, - FT_Render_Mode mode, - FT_LcdFiveTapFilter weights ); - -#endif /* FT_CONFIG_OPTION_SUBPIXEL_RENDERING */ - - /* */ diff --git a/include/freetype/internal/ftobjs.h b/include/freetype/internal/ftobjs.h index 45e55bf0b..37c6baffe 100644 --- a/include/freetype/internal/ftobjs.h +++ b/include/freetype/internal/ftobjs.h @@ -312,6 +312,27 @@ FT_BEGIN_HEADER FT_CMap_Done( FT_CMap cmap ); + /* adds LCD padding to Min and Max boundaries */ + FT_BASE( void ) + ft_lcd_padding( FT_Pos* Min, + FT_Pos* Max, + FT_GlyphSlot slot ); + +#ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING + + typedef void (*FT_Bitmap_LcdFilterFunc)( FT_Bitmap* bitmap, + FT_Render_Mode render_mode, + FT_Byte* weights ); + + + /* This is the default LCD filter, an in-place, 5-tap FIR filter. */ + FT_BASE( void ) + ft_lcd_filter_fir( FT_Bitmap* bitmap, + FT_Render_Mode mode, + FT_LcdFiveTapFilter weights ); + +#endif /* FT_CONFIG_OPTION_SUBPIXEL_RENDERING */ + /*************************************************************************/ /* */ /* */ From 55d6abea5d734c47243a854e867444652c1b7aa1 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Wed, 3 Jan 2018 19:01:15 +0100 Subject: [PATCH 395/470] * src/truetype/ttgxvar.c (ft_var_to_design): Remove dead code. This is a better fix than the previous commit, which is now reverted. --- ChangeLog | 7 +++++++ src/truetype/ttgxvar.c | 16 ++++------------ 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 759e5b371..b62b173ce 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2018-01-03 Werner Lemberg + + * src/truetype/ttgxvar.c (ft_var_to_design): Remove dead code. + + This is a better fix than the previous commit, which is now + reverted. + 2018-01-03 Alexei Podtelezhnikov Move internal LCD-related declarations. diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c index 5378852c6..6f456cf8c 100644 --- a/src/truetype/ttgxvar.c +++ b/src/truetype/ttgxvar.c @@ -1829,16 +1829,8 @@ nc = blend->num_axis; } - if ( face->doblend ) - { - for ( i = 0; i < nc; i++ ) - design[i] = coords[i]; - } - else - { - for ( i = 0; i < nc; i++ ) - design[i] = 0; - } + for ( i = 0; i < nc; i++ ) + design[i] = coords[i]; for ( ; i < num_coords; i++ ) design[i] = 0; @@ -2493,14 +2485,14 @@ coords, num_coords * sizeof ( FT_Fixed ) ); - face->doblend = TRUE; - if ( set_design_coords ) ft_var_to_design( face, all_design_coords ? blend->num_axis : num_coords, blend->normalizedcoords, blend->coords ); + face->doblend = TRUE; + if ( face->cvt ) { switch ( manageCvt ) From 029c9b2391476285cb4b25b52360744c649305b0 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Wed, 3 Jan 2018 19:05:20 +0100 Subject: [PATCH 396/470] [truetype] Round offsets of glyph components only if hinting is on. * src/truetype/ttgload.c (TT_Process_Composite_Component): Implement it. --- ChangeLog | 7 +++++++ src/truetype/ttgload.c | 24 ++++++++++++++++++++++-- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index b62b173ce..1c61eaeca 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2018-01-03 Werner Lemberg + + [truetype] Round offsets of glyph components only if hinting is on. + + * src/truetype/ttgload.c (TT_Process_Composite_Component): Implement + it. + 2018-01-03 Werner Lemberg * src/truetype/ttgxvar.c (ft_var_to_design): Remove dead code. diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c index b62f44013..32ed34aba 100644 --- a/src/truetype/ttgload.c +++ b/src/truetype/ttgload.c @@ -1206,8 +1206,28 @@ if ( subglyph->flags & ROUND_XY_TO_GRID ) { - x = FT_PIX_ROUND( x ); - y = FT_PIX_ROUND( y ); + TT_Face face = loader->face; + TT_Driver driver = (TT_Driver)FT_FACE_DRIVER( face ); + + + if ( IS_HINTED( loader->load_flags ) ) + { + /* + * We round the horizontal offset only if there is hinting along + * the x axis; this corresponds to integer advance width values. + * + * Theoretically, a glyph's bytecode can toggle ClearType's + * `backward compatibility' mode, which would allow modification + * of the advance width. In reality, however, applications + * neither allow nor expect modified advance widths if sub-pixel + * rendering is active. + * + */ + if ( driver->interpreter_version == TT_INTERPRETER_VERSION_35 ) + x = FT_PIX_ROUND( x ); + + y = FT_PIX_ROUND( y ); + } } } } From b720070988ea80ca74d644cd7ab77f1f81c54a1e Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sat, 6 Jan 2018 08:39:30 +0100 Subject: [PATCH 397/470] Minor doc fixes. --- include/freetype/freetype.h | 4 ++-- include/freetype/ftoutln.h | 3 --- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h index 7648a6ea6..0eb9b1b93 100644 --- a/include/freetype/freetype.h +++ b/include/freetype/freetype.h @@ -1981,8 +1981,8 @@ FT_BEGIN_HEADER /* */ /* If compilation option FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES is */ /* set, this function reads the `FREETYPE_PROPERTIES' environment */ - /* variable to control driver properties. See sections @auto_hinter, */ - /* @cff_driver, @pcf_driver, and @tt_driver for more. */ + /* variable to control driver properties. See section @properties */ + /* for more. */ /* */ FT_EXPORT( FT_Error ) FT_Init_FreeType( FT_Library *alibrary ); diff --git a/include/freetype/ftoutln.h b/include/freetype/ftoutln.h index e9818b3bd..89389a49b 100644 --- a/include/freetype/ftoutln.h +++ b/include/freetype/ftoutln.h @@ -190,9 +190,6 @@ FT_BEGIN_HEADER /* If the outline's `owner' field is not set, only the outline */ /* descriptor will be released. */ /* */ - /* The reason why this function takes an `library' parameter is */ - /* simply to use ft_mem_free(). */ - /* */ FT_EXPORT( FT_Error ) FT_Outline_Done( FT_Library library, FT_Outline* outline ); From 3758aed7605aff97d6156937efde8ec51919caab Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sat, 6 Jan 2018 08:39:36 +0100 Subject: [PATCH 398/470] Add `FT_Done_MM_Var'. This is necessary in case the application's memory routines differ from FreeType. A typical example is a Python application on Windows that calls FreeType compiled as a DLL via the `ctypes' interface. * include/freetype/ftmm.h, src/base/ftmm.c (FT_Done_MM_Var): Declare and define. * docs/CHANGES: Updated. --- ChangeLog | 13 +++++++++++++ docs/CHANGES | 3 +++ include/freetype/ftmm.h | 22 +++++++++++++++++++++- src/base/ftmm.c | 19 +++++++++++++++++++ 4 files changed, 56 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 1c61eaeca..0ead1e5f1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2018-01-06 Werner Lemberg + + Add `FT_Done_MM_Var'. + + This is necessary in case the application's memory routines differ + from FreeType. A typical example is a Python application on Windows + that calls FreeType compiled as a DLL via the `ctypes' interface. + + * include/freetype/ftmm.h, src/base/ftmm.c (FT_Done_MM_Var): Declare + and define. + + * docs/CHANGES: Updated. + 2018-01-03 Werner Lemberg [truetype] Round offsets of glyph components only if hinting is on. diff --git a/docs/CHANGES b/docs/CHANGES index b9e3d4767..0a83aa2e7 100644 --- a/docs/CHANGES +++ b/docs/CHANGES @@ -56,6 +56,9 @@ CHANGES BETWEEN 2.8.1 and 2.8.2 PostScript name is provided, not looking up special entries for named instances. + - A new function `FT_Done_MM_Var' is provided to free the memory + returned in a call to `FT_Get_MM_Var'. + - On platforms using the `configure' script, the installed `ftoption.h' file now correctly reflects configuration options like `--with-harfbuzz'. diff --git a/include/freetype/ftmm.h b/include/freetype/ftmm.h index 8502b88af..7ba34bba5 100644 --- a/include/freetype/ftmm.h +++ b/include/freetype/ftmm.h @@ -286,7 +286,7 @@ FT_BEGIN_HEADER /* */ /* amaster :: The variation descriptor. */ /* Allocates a data structure, which the user must */ - /* deallocate with `free' after use. */ + /* deallocate with a call to @FT_Done_MM_Var after use. */ /* */ /* */ /* FreeType error code. 0~means success. */ @@ -296,6 +296,26 @@ FT_BEGIN_HEADER FT_MM_Var* *amaster ); + /*************************************************************************/ + /* */ + /* */ + /* FT_Done_MM_Var */ + /* */ + /* */ + /* Free the memory allocated by @FT_Get_MM_Var. */ + /* */ + /* */ + /* library :: A handle of the face's parent library object that was */ + /* used in the call to @FT_Get_MM_Var to create `amaster'. */ + /* */ + /* */ + /* FreeType error code. 0~means success. */ + /* */ + FT_EXPORT( FT_Error ) + FT_Done_MM_Var( FT_Library library, + FT_MM_Var *amaster ); + + /*************************************************************************/ /* */ /* */ diff --git a/src/base/ftmm.c b/src/base/ftmm.c index c8b6d1361..800441bca 100644 --- a/src/base/ftmm.c +++ b/src/base/ftmm.c @@ -145,6 +145,25 @@ } + /* documentation is in ftmm.h */ + + FT_EXPORT_DEF( FT_Error ) + FT_Done_MM_Var( FT_Library library, + FT_MM_Var* amaster ) + { + FT_Memory memory; + + + if ( !library ) + return FT_THROW( Invalid_Library_Handle ); + + memory = library->memory; + FT_FREE( amaster ); + + return FT_Err_Ok; + } + + /* documentation is in ftmm.h */ FT_EXPORT_DEF( FT_Error ) From 21bd9c2f8ce57b20204ef505e9a64f55350edec0 Mon Sep 17 00:00:00 2001 From: Ewald Hew Date: Sun, 7 Jan 2018 16:38:54 +0800 Subject: [PATCH 399/470] [psaux] Fix Type 1 glyphs with too many stem hints. According to the CFF specification, charstrings can have up to 96 stem hints. Due to hint replacement routines in Type 1 charstrings, some glyphs are rejected by the Adobe engine, which implements the above limit. This fix turns off hinting for such glyphs. * src/psaux/pshints.c (cf2_hintmap_build): Reset the error from calling `cf2_hintmask_setAll' on a problematic Type 1 charstring and turn off hinting. --- ChangeLog | 13 +++++++++++++ src/psaux/pshints.c | 8 ++++++++ 2 files changed, 21 insertions(+) diff --git a/ChangeLog b/ChangeLog index 0ead1e5f1..5edd30bbc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2018-01-07 Ewald Hew + + [psaux] Fix Type 1 glyphs with too many stem hints. + + According to the CFF specification, charstrings can have up to 96 stem + hints. Due to hint replacement routines in Type 1 charstrings, some + glyphs are rejected by the Adobe engine, which implements the above + limit. This fix turns off hinting for such glyphs. + + * src/psaux/pshints.c (cf2_hintmap_build): Reset the error from calling + `cf2_hintmask_setAll' on a problematic Type 1 charstring and turn off + hinting. + 2018-01-06 Werner Lemberg Add `FT_Done_MM_Var'. diff --git a/src/psaux/pshints.c b/src/psaux/pshints.c index 94f18c731..361519642 100644 --- a/src/psaux/pshints.c +++ b/src/psaux/pshints.c @@ -842,7 +842,15 @@ cf2_arrstack_size( hStemHintArray ) + cf2_arrstack_size( vStemHintArray ) ); if ( !cf2_hintmask_isValid( hintMask ) ) + { + if ( font->isT1 ) + { + /* no error, just continue unhinted */ + *hintMask->error = FT_Err_Ok; + hintmap->hinted = FALSE; + } return; /* too many stem hints */ + } } /* begin by clearing the map */ From 1d6773e6d999c37e7927c5d9cc48fb87d0dbf0cb Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sun, 7 Jan 2018 18:41:54 +0100 Subject: [PATCH 400/470] Add check for librt, needed for `ftbench' (#52824). * builds/unix/configure.raw: Call AC_USE_SYSTEM_EXTENSIONS. (LIB_CLOCK_GETTIME): Define; this will hold `-lrt' if necessary. * builds/unix/unix-cc.in (LIB_CLOCK_GETTIME): New variable. --- ChangeLog | 9 +++++++++ builds/unix/configure.raw | 15 +++++++++++++++ builds/unix/unix-cc.in | 3 ++- 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 5edd30bbc..cf55aa6c3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2018-01-07 Werner Lemberg + + Add check for librt, needed for `ftbench' (#52824). + + * builds/unix/configure.raw (LIB_CLOCK_GETTIME): Define; this will + hold `-lrt' if necessary. + + * builds/unix/unix-cc.in (LIB_CLOCK_GETTIME): New variable. + 2018-01-07 Ewald Hew [psaux] Fix Type 1 glyphs with too many stem hints. diff --git a/builds/unix/configure.raw b/builds/unix/configure.raw index 126e0914b..b5d11b2fb 100644 --- a/builds/unix/configure.raw +++ b/builds/unix/configure.raw @@ -509,6 +509,21 @@ if test x"$with_harfbuzz" = xyes -a "$have_harfbuzz" = no; then fi +# check for librt +# +# We need `clock_gettime' for the `ftbench' demo program. +# +# The code is modeled after gnulib's file `clock_time.m4', ignoring +# very old Solaris systems. + +LIB_CLOCK_GETTIME= +AC_SEARCH_LIBS([clock_gettime], + [rt], + [test "$ac_cv_search_clock_gettime" = "none required" \ + || LIB_CLOCK_GETTIME=$ac_cv_search_clock_gettime]) +AC_SUBST([LIB_CLOCK_GETTIME]) + + # Some options handling SDKs/archs in CFLAGS should be copied # to LDFLAGS. Apple TechNote 2137 recommends to include these # options in CFLAGS but not in LDFLAGS. diff --git a/builds/unix/unix-cc.in b/builds/unix/unix-cc.in index 9b888c7d4..a06246d63 100644 --- a/builds/unix/unix-cc.in +++ b/builds/unix/unix-cc.in @@ -93,7 +93,8 @@ CC := $(LIBTOOL) --mode=compile $(CCraw) # Linker flags. # -LDFLAGS := @LDFLAGS@ +LDFLAGS := @LDFLAGS@ +LIB_CLOCK_GETTIME := @LIB_CLOCK_GETTIME@ # for ftbench # export symbols From 9e7b24f29065f416556079a84bf28600f1f14779 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Mon, 8 Jan 2018 11:16:11 +0100 Subject: [PATCH 401/470] Next release will be 2.9. --- docs/CHANGES | 2 +- include/freetype/config/ftheader.h | 8 ++++---- include/freetype/freetype.h | 27 +++++++++++++-------------- include/freetype/ftdriver.h | 10 +++++----- include/freetype/ftmm.h | 12 ++++++------ include/freetype/ftparams.h | 2 +- include/freetype/internal/cfftypes.h | 2 +- 7 files changed, 31 insertions(+), 32 deletions(-) diff --git a/docs/CHANGES b/docs/CHANGES index 0a83aa2e7..9901e1094 100644 --- a/docs/CHANGES +++ b/docs/CHANGES @@ -1,5 +1,5 @@ -CHANGES BETWEEN 2.8.1 and 2.8.2 +CHANGES BETWEEN 2.8.1 and 2.9 I. IMPORTANT BUG FIXES diff --git a/include/freetype/config/ftheader.h b/include/freetype/config/ftheader.h index 214068a15..702f77cc4 100644 --- a/include/freetype/config/ftheader.h +++ b/include/freetype/config/ftheader.h @@ -337,7 +337,7 @@ * A macro used in #include statements to name the file containing * structures and macros related to the auto-hinting module. * - * Deprecated since version 2.8.2; use @FT_DRIVER_H instead. + * Deprecated since version 2.9; use @FT_DRIVER_H instead. * */ #define FT_AUTOHINTER_H FT_DRIVER_H @@ -352,7 +352,7 @@ * A macro used in #include statements to name the file containing * structures and macros related to the CFF driver module. * - * Deprecated since version 2.8.2; use @FT_DRIVER_H instead. + * Deprecated since version 2.9; use @FT_DRIVER_H instead. * */ #define FT_CFF_DRIVER_H FT_DRIVER_H @@ -367,7 +367,7 @@ * A macro used in #include statements to name the file containing * structures and macros related to the TrueType driver module. * - * Deprecated since version 2.8.2; use @FT_DRIVER_H instead. + * Deprecated since version 2.9; use @FT_DRIVER_H instead. * */ #define FT_TRUETYPE_DRIVER_H FT_DRIVER_H @@ -382,7 +382,7 @@ * A macro used in #include statements to name the file containing * structures and macros related to the PCF driver module. * - * Deprecated since version 2.8.2; use @FT_DRIVER_H instead. + * Deprecated since version 2.9; use @FT_DRIVER_H instead. * */ #define FT_PCF_DRIVER_H FT_DRIVER_H diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h index 0eb9b1b93..df30131f7 100644 --- a/include/freetype/freetype.h +++ b/include/freetype/freetype.h @@ -904,9 +904,8 @@ FT_BEGIN_HEADER /* Bit 31 is always zero (this is, */ /* `face_index' is always a positive value). */ /* */ - /* [Since 2.8.2] Changing the design */ - /* coordinates with */ - /* @FT_Set_Var_Design_Coordinates or */ + /* [Since 2.9] Changing the design coordinates */ + /* with @FT_Set_Var_Design_Coordinates or */ /* @FT_Set_Var_Blend_Coordinates does not */ /* influence the named instance index value */ /* (only @FT_Set_Named_Instance does that). */ @@ -1230,8 +1229,8 @@ FT_BEGIN_HEADER /* glyphs use @FT_LOAD_COLOR. */ /* */ /* FT_FACE_FLAG_VARIATION :: */ - /* [Since 2.8.2] Set if the current face (or named instance) has */ - /* been altered with @FT_Set_MM_Design_Coordinates, */ + /* [Since 2.9] Set if the current face (or named instance) has been */ + /* altered with @FT_Set_MM_Design_Coordinates, */ /* @FT_Set_Var_Design_Coordinates, or */ /* @FT_Set_Var_Blend_Coordinates. This flag is unset by a call to */ /* @FT_Set_Named_Instance. */ @@ -1413,7 +1412,7 @@ FT_BEGIN_HEADER * A macro that returns true whenever a face object is a named instance * of a GX or OpenType variation font. * - * [Since 2.8.2] Changing the design coordinates with + * [Since 2.9] Changing the design coordinates with * @FT_Set_Var_Design_Coordinates or @FT_Set_Var_Blend_Coordinates does * not influence the return value of this macro (only * @FT_Set_Named_Instance does that). @@ -1437,7 +1436,7 @@ FT_BEGIN_HEADER * @FT_Set_Var_Blend_Coordinates. * * @since: - * 2.8.2 + * 2.9 * */ #define FT_IS_VARIATION( face ) \ @@ -1830,7 +1829,7 @@ FT_BEGIN_HEADER /* If @FT_Load_Glyph is called with default flags (see */ /* @FT_LOAD_DEFAULT) the glyph image is loaded in the glyph slot in */ /* its native format (e.g., an outline glyph for TrueType and Type~1 */ - /* formats). [Since 2.8.2] The prospective bitmap metrics are */ + /* formats). [Since 2.9] The prospective bitmap metrics are */ /* calculated according to @FT_LOAD_TARGET_XXX and other flags even */ /* for the outline glyph, even if @FT_LOAD_RENDER is not set. */ /* */ @@ -3559,12 +3558,12 @@ FT_BEGIN_HEADER /* */ /* https://download.macromedia.com/pub/developer/opentype/tech-notes/5902.AdobePSNameGeneration.html */ /* */ - /* [Since 2.8.2] Special PostScript names for named instances are */ - /* only returned if the named instance is set with */ - /* @FT_Set_Named_Instance (and the font has corresponding entries in */ - /* its `fvar' table). If @FT_IS_VARIATION returns true, the */ - /* algorithmically derived PostScript name is provided, not looking */ - /* up special entries for named instances. */ + /* [Since 2.9] Special PostScript names for named instances are only */ + /* returned if the named instance is set with @FT_Set_Named_Instance */ + /* (and the font has corresponding entries in its `fvar' table). If */ + /* @FT_IS_VARIATION returns true, the algorithmically derived */ + /* PostScript name is provided, not looking up special entries for */ + /* named instances. */ /* */ FT_EXPORT( const char* ) FT_Get_Postscript_Name( FT_Face face ); diff --git a/include/freetype/ftdriver.h b/include/freetype/ftdriver.h index 6d51bf896..02d104dc3 100644 --- a/include/freetype/ftdriver.h +++ b/include/freetype/ftdriver.h @@ -339,7 +339,7 @@ FT_BEGIN_HEADER * Use the hinting engine contributed by Adobe. * * @since: - * 2.8.2 + * 2.9 * */ #define FT_HINTING_FREETYPE 0 @@ -394,7 +394,7 @@ FT_BEGIN_HEADER * @since: * 2.4.12 (for `cff' module) * - * 2.8.2 (for `type1' and `t1cid' modules) + * 2.9 (for `type1' and `t1cid' modules) * */ @@ -466,7 +466,7 @@ FT_BEGIN_HEADER * * 2.6.2 (for `autofitter' module) * - * 2.8.2 (for `type1' and `t1cid' modules) + * 2.9 (for `type1' and `t1cid' modules) * */ @@ -536,7 +536,7 @@ FT_BEGIN_HEADER * * 2.6.2 (for `autofitter' module) * - * 2.8.2 (for `type1' and `t1cid' modules) + * 2.9 (for `type1' and `t1cid' modules) * */ @@ -569,7 +569,7 @@ FT_BEGIN_HEADER * @since: * 2.8 (for `cff' module) * - * 2.8.2 (for `type1' and `t1cid' modules) + * 2.9 (for `type1' and `t1cid' modules) * */ diff --git a/include/freetype/ftmm.h b/include/freetype/ftmm.h index 7ba34bba5..9948102c1 100644 --- a/include/freetype/ftmm.h +++ b/include/freetype/ftmm.h @@ -346,7 +346,7 @@ FT_BEGIN_HEADER /* [Since 2.8.1] To reset all axes to the default values, call the */ /* function with `num_coords' set to zero and `coords' set to NULL. */ /* */ - /* [Since 2.8.2] If `num_coords' is larger than zero, this function */ + /* [Since 2.9] If `num_coords' is larger than zero, this function */ /* sets the @FT_FACE_FLAG_VARIATION bit in @FT_Face's `face_flags' */ /* field (i.e., @FT_IS_VARIATION will return true). If `num_coords' */ /* is zero, this bit flag gets unset. */ @@ -384,10 +384,10 @@ FT_BEGIN_HEADER /* */ /* [Since 2.8.1] To reset all axes to the default values, call the */ /* function with `num_coords' set to zero and `coords' set to NULL. */ - /* [Since 2.8.2] `Default values' means the currently selected named */ + /* [Since 2.9] `Default values' means the currently selected named */ /* instance (or the base font if no named instance is selected). */ /* */ - /* [Since 2.8.2] If `num_coords' is larger than zero, this function */ + /* [Since 2.9] If `num_coords' is larger than zero, this function */ /* sets the @FT_FACE_FLAG_VARIATION bit in @FT_Face's `face_flags' */ /* field (i.e., @FT_IS_VARIATION will return true). If `num_coords' */ /* is zero, this bit flag gets unset. */ @@ -462,10 +462,10 @@ FT_BEGIN_HEADER /* */ /* [Since 2.8.1] To reset all axes to the default values, call the */ /* function with `num_coords' set to zero and `coords' set to NULL. */ - /* [Since 2.8.2] `Default values' means the currently selected named */ + /* [Since 2.9] `Default values' means the currently selected named */ /* instance (or the base font if no named instance is selected). */ /* */ - /* [Since 2.8.2] If `num_coords' is larger than zero, this function */ + /* [Since 2.9] If `num_coords' is larger than zero, this function */ /* sets the @FT_FACE_FLAG_VARIATION bit in @FT_Face's `face_flags' */ /* field (i.e., @FT_IS_VARIATION will return true). If `num_coords' */ /* is zero, this bit flag gets unset. */ @@ -621,7 +621,7 @@ FT_BEGIN_HEADER /* function simply resets the current face to the default instance. */ /* */ /* */ - /* 2.8.2 */ + /* 2.9 */ /* */ FT_EXPORT( FT_Error ) FT_Set_Named_Instance( FT_Face face, diff --git a/include/freetype/ftparams.h b/include/freetype/ftparams.h index 5bafe9397..5a9006c50 100644 --- a/include/freetype/ftparams.h +++ b/include/freetype/ftparams.h @@ -166,7 +166,7 @@ FT_BEGIN_HEADER * This is a passive setting that only takes effect if the font driver * or autohinter honors it, which the CFF, Type~1, and CID drivers * always do, but the autohinter only in `light' hinting mode (as of - * version 2.8.2). + * version 2.9). * * @since: * 2.8 diff --git a/include/freetype/internal/cfftypes.h b/include/freetype/internal/cfftypes.h index 12d614be3..7c07e1a37 100644 --- a/include/freetype/internal/cfftypes.h +++ b/include/freetype/internal/cfftypes.h @@ -398,7 +398,7 @@ FT_BEGIN_HEADER /* since version 2.7.1 */ CFF_VStoreRec vstore; /* parsed vstore structure */ - /* since version 2.8.2 */ + /* since version 2.9 */ PS_FontExtraRec* font_extra; } CFF_FontRec; From 67a42aa8879697c2bd190d213f873f0e9712589f Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Mon, 8 Jan 2018 12:15:27 +0100 Subject: [PATCH 402/470] * Version 2.9 released. ======================= Tag sources with `VER-2-9'. * docs/VERSION.TXT: Add entry for version 2.9. * README, Jamfile (RefDoc), builds/windows/vc2005/freetype.vcproj, builds/windows/vc2005/index.html, builds/windows/vc2008/freetype.vcproj, builds/windows/vc2008/index.html, builds/windows/vc2010/freetype.vcxproj, builds/windows/vc2010/index.html, builds/windows/visualc/freetype.dsp, builds/windows/visualc/freetype.vcproj, builds/windows/visualc/index.html, builds/windows/visualce/freetype.dsp, builds/windows/visualce/freetype.vcproj, builds/windows/visualce/index.html, builds/windows/ftver.rc, builds/wince/vc2005-ce/freetype.vcproj, builds/wince/vc2005-ce/index.html, builds/wince/vc2008-ce/freetype.vcproj, builds/wince/vc2008-ce/index.html: s/2.8.1/2.9/, s/281/29/. * include/freetype/freetype.h (FREETYPE_MINOR): Set to 9. (FREETYPE_PATCH): Set to 0. * builds/unix/configure.raw (version_info): Set to 22:0:16. * CMakeLists.txt (VERSION_PATCH): Set to 1. --- CMakeLists.txt | 4 +- ChangeLog | 34 ++++++++++ Jamfile | 2 +- README | 10 +-- builds/unix/configure.raw | 2 +- builds/wince/vc2005-ce/freetype.vcproj | 76 +++++++++++----------- builds/wince/vc2005-ce/index.html | 10 +-- builds/wince/vc2008-ce/freetype.vcproj | 76 +++++++++++----------- builds/wince/vc2008-ce/index.html | 10 +-- builds/windows/ftver.rc | 4 +- builds/windows/vc2005/freetype.vcproj | 12 ++-- builds/windows/vc2005/index.html | 10 +-- builds/windows/vc2008/freetype.vcproj | 12 ++-- builds/windows/vc2008/index.html | 10 +-- builds/windows/vc2010/index.html | 14 ++--- builds/windows/visualc/freetype.dsp | 20 +++--- builds/windows/visualc/freetype.vcproj | 12 ++-- builds/windows/visualc/index.html | 10 +-- builds/windows/visualce/freetype.dsp | 20 +++--- builds/windows/visualce/freetype.vcproj | 84 ++++++++++++------------- builds/windows/visualce/index.html | 10 +-- docs/VERSIONS.TXT | 1 + docs/freetype-config.1 | 2 +- include/freetype/freetype.h | 4 +- 24 files changed, 242 insertions(+), 207 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7bb5df652..b0f86126b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -153,8 +153,8 @@ endif () set(VERSION_MAJOR "2") -set(VERSION_MINOR "8") -set(VERSION_PATCH "1") +set(VERSION_MINOR "9") +set(VERSION_PATCH "0") set(PROJECT_VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}) set(SHARED_LIBRARY_VERSION ${VERSION_MAJOR}.${VERSION_MINOR}) diff --git a/ChangeLog b/ChangeLog index cf55aa6c3..fa38730b7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,37 @@ +2018-01-08 Werner Lemberg + + * Version 2.9 released. + ======================= + + + Tag sources with `VER-2-9'. + + * docs/VERSION.TXT: Add entry for version 2.9. + + * README, Jamfile (RefDoc), builds/windows/vc2005/freetype.vcproj, + builds/windows/vc2005/index.html, + builds/windows/vc2008/freetype.vcproj, + builds/windows/vc2008/index.html, + builds/windows/vc2010/freetype.vcxproj, + builds/windows/vc2010/index.html, + builds/windows/visualc/freetype.dsp, + builds/windows/visualc/freetype.vcproj, + builds/windows/visualc/index.html, + builds/windows/visualce/freetype.dsp, + builds/windows/visualce/freetype.vcproj, + builds/windows/visualce/index.html, + builds/windows/ftver.rc, + builds/wince/vc2005-ce/freetype.vcproj, + builds/wince/vc2005-ce/index.html, + builds/wince/vc2008-ce/freetype.vcproj, + builds/wince/vc2008-ce/index.html: s/2.8.1/2.9/, s/281/29/. + + * include/freetype/freetype.h (FREETYPE_MINOR): Set to 9. + (FREETYPE_PATCH): Set to 0. + + * builds/unix/configure.raw (version_info): Set to 22:0:16. + * CMakeLists.txt (VERSION_PATCH): Set to 1. + 2018-01-07 Werner Lemberg Add check for librt, needed for `ftbench' (#52824). diff --git a/Jamfile b/Jamfile index 20724f7f5..a9eb39632 100644 --- a/Jamfile +++ b/Jamfile @@ -210,7 +210,7 @@ actions RefDoc { python $(FT2_SRC)/tools/docmaker/docmaker.py --prefix=ft2 - --title=FreeType-2.8.1 + --title=FreeType-2.9 --output=$(DOC_DIR) $(FT2_INCLUDE)/freetype/*.h $(FT2_INCLUDE)/freetype/config/*.h diff --git a/README b/README index 14e925d55..1e7ea97d4 100644 --- a/README +++ b/README @@ -1,5 +1,5 @@ - FreeType 2.8.1 - ============== + FreeType 2.9 + ============ Homepage: https://www.freetype.org @@ -24,9 +24,9 @@ and download one of the following files. - freetype-doc-2.8.1.tar.bz2 - freetype-doc-2.8.1.tar.gz - ftdoc281.zip + freetype-doc-2.9.tar.bz2 + freetype-doc-2.9.tar.gz + ftdoc29.zip To view the documentation online, go to diff --git a/builds/unix/configure.raw b/builds/unix/configure.raw index b5d11b2fb..20157b9be 100644 --- a/builds/unix/configure.raw +++ b/builds/unix/configure.raw @@ -17,7 +17,7 @@ AC_CONFIG_SRCDIR([ftconfig.in]) # Don't forget to update `docs/VERSIONS.TXT'! -version_info='21:0:15' +version_info='22:0:16' AC_SUBST([version_info]) ft_version=`echo $version_info | tr : .` AC_SUBST([ft_version]) diff --git a/builds/wince/vc2005-ce/freetype.vcproj b/builds/wince/vc2005-ce/freetype.vcproj index 880527946..215028a68 100644 --- a/builds/wince/vc2005-ce/freetype.vcproj +++ b/builds/wince/vc2005-ce/freetype.vcproj @@ -21,7 +21,7 @@ - + @@ -41,7 +41,7 @@ - + @@ -61,7 +61,7 @@ - + @@ -81,7 +81,7 @@ - + @@ -101,7 +101,7 @@ - + @@ -121,7 +121,7 @@ - + @@ -141,7 +141,7 @@ - + @@ -161,7 +161,7 @@ - + @@ -181,7 +181,7 @@ - + @@ -201,7 +201,7 @@ - + @@ -221,7 +221,7 @@ - + @@ -241,7 +241,7 @@ - + @@ -261,7 +261,7 @@ - + @@ -281,7 +281,7 @@ - + @@ -301,7 +301,7 @@ - + @@ -321,7 +321,7 @@ - + @@ -341,7 +341,7 @@ - + @@ -361,7 +361,7 @@ - + @@ -381,7 +381,7 @@ - + @@ -401,7 +401,7 @@ - + @@ -421,7 +421,7 @@ - + @@ -441,7 +441,7 @@ - + @@ -461,7 +461,7 @@ - + @@ -481,7 +481,7 @@ - + @@ -501,7 +501,7 @@ - + @@ -521,7 +521,7 @@ - + @@ -541,7 +541,7 @@ - + @@ -561,7 +561,7 @@ - + @@ -581,7 +581,7 @@ - + @@ -601,7 +601,7 @@ - + @@ -621,7 +621,7 @@ - + @@ -641,7 +641,7 @@ - + @@ -661,7 +661,7 @@ - + @@ -681,7 +681,7 @@ - + @@ -701,7 +701,7 @@ - + @@ -721,7 +721,7 @@ - + @@ -741,7 +741,7 @@ - + @@ -758,7 +758,7 @@ - + diff --git a/builds/wince/vc2005-ce/index.html b/builds/wince/vc2005-ce/index.html index 87fbc5adc..267241528 100644 --- a/builds/wince/vc2005-ce/index.html +++ b/builds/wince/vc2005-ce/index.html @@ -21,14 +21,14 @@ the following targets:
  • PPC/SP WM6 (Windows Mobile 6)
  • -It compiles the following libraries from the FreeType 2.8.1 sources:

    +It compiles the following libraries from the FreeType 2.9 sources:

      -    freetype281.lib     - release build; single threaded
      -    freetype281_D.lib   - debug build;   single threaded
      -    freetype281MT.lib   - release build; multi-threaded
      -    freetype281MT_D.lib - debug build;   multi-threaded
      + freetype29.lib - release build; single threaded + freetype29_D.lib - debug build; single threaded + freetype29MT.lib - release build; multi-threaded + freetype29MT_D.lib - debug build; multi-threaded

    Be sure to extract the files with the Windows (CR+LF) line endings. ZIP diff --git a/builds/wince/vc2008-ce/freetype.vcproj b/builds/wince/vc2008-ce/freetype.vcproj index 2616df8b4..9be85885a 100644 --- a/builds/wince/vc2008-ce/freetype.vcproj +++ b/builds/wince/vc2008-ce/freetype.vcproj @@ -88,7 +88,7 @@ /> PPC/SP WM6 (Windows Mobile 6) -It compiles the following libraries from the FreeType 2.8.1 sources:

    +It compiles the following libraries from the FreeType 2.9 sources:

      -    freetype281.lib     - release build; single threaded
      -    freetype281_D.lib   - debug build;   single threaded
      -    freetype281MT.lib   - release build; multi-threaded
      -    freetype281MT_D.lib - debug build;   multi-threaded
      + freetype29.lib - release build; single threaded + freetype29_D.lib - debug build; single threaded + freetype29MT.lib - release build; multi-threaded + freetype29MT_D.lib - debug build; multi-threaded

    Be sure to extract the files with the Windows (CR+LF) line endings. ZIP diff --git a/builds/windows/ftver.rc b/builds/windows/ftver.rc index 5dcd4a6ca..109310901 100644 --- a/builds/windows/ftver.rc +++ b/builds/windows/ftver.rc @@ -1,7 +1,7 @@ #include -#define FT_VERSION 2,8,1,0 -#define FT_VERSION_STR "2.8.1" +#define FT_VERSION 2,9,0,0 +#define FT_VERSION_STR "2.9.0" VS_VERSION_INFO VERSIONINFO FILEVERSION FT_VERSION diff --git a/builds/windows/vc2005/freetype.vcproj b/builds/windows/vc2005/freetype.vcproj index d5de15249..386d79d07 100644 --- a/builds/windows/vc2005/freetype.vcproj +++ b/builds/windows/vc2005/freetype.vcproj @@ -16,7 +16,7 @@ - + @@ -33,7 +33,7 @@ - + @@ -50,7 +50,7 @@ - + @@ -67,7 +67,7 @@ - + @@ -84,7 +84,7 @@ - + @@ -101,7 +101,7 @@ - + diff --git a/builds/windows/vc2005/index.html b/builds/windows/vc2005/index.html index 2a0014889..a25e67426 100644 --- a/builds/windows/vc2005/index.html +++ b/builds/windows/vc2005/index.html @@ -11,14 +11,14 @@

    This directory contains project files for Visual C++, named freetype.vcproj, and Visual Studio, called freetype.sln. It -compiles the following libraries from the FreeType 2.8.1 sources:

    +compiles the following libraries from the FreeType 2.9 sources:

      -    freetype281.lib     - release build; single threaded
      -    freetype281_D.lib   - debug build;   single threaded
      -    freetype281MT.lib   - release build; multi-threaded
      -    freetype281MT_D.lib - debug build;   multi-threaded
      + freetype29.lib - release build; single threaded + freetype29_D.lib - debug build; single threaded + freetype29MT.lib - release build; multi-threaded + freetype29MT_D.lib - debug build; multi-threaded

    Be sure to extract the files with the Windows (CR+LF) line endings. ZIP diff --git a/builds/windows/vc2008/freetype.vcproj b/builds/windows/vc2008/freetype.vcproj index 2a92ac36e..f2d1fe7bb 100644 --- a/builds/windows/vc2008/freetype.vcproj +++ b/builds/windows/vc2008/freetype.vcproj @@ -70,7 +70,7 @@ /> This directory contains project files for Visual C++, named freetype.vcproj, and Visual Studio, called freetype.sln. It -compiles the following libraries from the FreeType 2.8.1 sources:

    +compiles the following libraries from the FreeType 2.9 sources:

      -    freetype281.lib     - release build; single threaded
      -    freetype281_D.lib   - debug build;   single threaded
      -    freetype281MT.lib   - release build; multi-threaded
      -    freetype281MT_D.lib - debug build;   multi-threaded
      + freetype29.lib - release build; single threaded + freetype29_D.lib - debug build; single threaded + freetype29MT.lib - release build; multi-threaded + freetype29MT_D.lib - debug build; multi-threaded

    Be sure to extract the files with the Windows (CR+LF) line endings. ZIP diff --git a/builds/windows/vc2010/index.html b/builds/windows/vc2010/index.html index 8209e2427..7433ce835 100644 --- a/builds/windows/vc2010/index.html +++ b/builds/windows/vc2010/index.html @@ -12,16 +12,16 @@

    This directory contains a project file for Visual C++ (VS.NET 2010 or newer), named freetype.vcxproj, and Visual Studio, called freetype.sln. It compiles the following libraries from the -FreeType 2.8.1 sources:

    +FreeType 2.9 sources:

      -    freetype281.lib    - release build
      -    freetype281d.lib   - debug build
      -    freetype281ST.lib  - release build; single threaded
      -    freetype281STd.lib - debug build;   single threaded
      -    freetype281MT.lib  - release build; multi-threaded
      -    freetype281MTd.lib - debug build;   multi-threaded
      + freetype29.lib - release build + freetype29d.lib - debug build + freetype29ST.lib - release build; single threaded + freetype29STd.lib - debug build; single threaded + freetype29MT.lib - release build; multi-threaded + freetype29MTd.lib - debug build; multi-threaded

    Both Win32 and x64 builds are supported.

    diff --git a/builds/windows/visualc/freetype.dsp b/builds/windows/visualc/freetype.dsp index c14ce11f5..76d6e9125 100644 --- a/builds/windows/visualc/freetype.dsp +++ b/builds/windows/visualc/freetype.dsp @@ -54,7 +54,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LIB32=link.exe -lib # ADD BASE LIB32 /nologo -# ADD LIB32 /nologo /out:"..\..\..\objs\freetype281.lib" +# ADD LIB32 /nologo /out:"..\..\..\objs\freetype29.lib" !ELSEIF "$(CFG)" == "freetype - Win32 Debug" @@ -78,7 +78,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LIB32=link.exe -lib # ADD BASE LIB32 /nologo -# ADD LIB32 /nologo /out:"..\..\..\objs\freetype281_D.lib" +# ADD LIB32 /nologo /out:"..\..\..\objs\freetype29_D.lib" !ELSEIF "$(CFG)" == "freetype - Win32 Debug Multithreaded" @@ -102,8 +102,8 @@ BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LIB32=link.exe -lib -# ADD BASE LIB32 /nologo /out:"lib\freetype281_D.lib" -# ADD LIB32 /nologo /out:"..\..\..\objs\freetype281MT_D.lib" +# ADD BASE LIB32 /nologo /out:"lib\freetype29_D.lib" +# ADD LIB32 /nologo /out:"..\..\..\objs\freetype29MT_D.lib" !ELSEIF "$(CFG)" == "freetype - Win32 Release Multithreaded" @@ -126,8 +126,8 @@ BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LIB32=link.exe -lib -# ADD BASE LIB32 /nologo /out:"lib\freetype281.lib" -# ADD LIB32 /nologo /out:"..\..\..\objs\freetype281MT.lib" +# ADD BASE LIB32 /nologo /out:"lib\freetype29.lib" +# ADD LIB32 /nologo /out:"..\..\..\objs\freetype29MT.lib" !ELSEIF "$(CFG)" == "freetype - Win32 Release Singlethreaded" @@ -151,8 +151,8 @@ BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LIB32=link.exe -lib -# ADD BASE LIB32 /nologo /out:"..\..\..\objs\freetype281.lib" -# ADD LIB32 /out:"..\..\..\objs\freetype281ST.lib" +# ADD BASE LIB32 /nologo /out:"..\..\..\objs\freetype29.lib" +# ADD LIB32 /out:"..\..\..\objs\freetype29ST.lib" # SUBTRACT LIB32 /nologo !ELSEIF "$(CFG)" == "freetype - Win32 Debug Singlethreaded" @@ -177,8 +177,8 @@ BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LIB32=link.exe -lib -# ADD BASE LIB32 /nologo /out:"..\..\..\objs\freetype281_D.lib" -# ADD LIB32 /nologo /out:"..\..\..\objs\freetype281ST_D.lib" +# ADD BASE LIB32 /nologo /out:"..\..\..\objs\freetype29_D.lib" +# ADD LIB32 /nologo /out:"..\..\..\objs\freetype29ST_D.lib" !ENDIF diff --git a/builds/windows/visualc/freetype.vcproj b/builds/windows/visualc/freetype.vcproj index 1533e6029..6c0b7617d 100644 --- a/builds/windows/visualc/freetype.vcproj +++ b/builds/windows/visualc/freetype.vcproj @@ -69,7 +69,7 @@ /> This directory contains project files for Visual C++, named freetype.dsp, and Visual Studio, called freetype.sln. It -compiles the following libraries from the FreeType 2.8.1 sources:

    +compiles the following libraries from the FreeType 2.9 sources:

      -    freetype281.lib     - release build; single threaded
      -    freetype281_D.lib   - debug build;   single threaded
      -    freetype281MT.lib   - release build; multi-threaded
      -    freetype281MT_D.lib - debug build;   multi-threaded
      + freetype29.lib - release build; single threaded + freetype29_D.lib - debug build; single threaded + freetype29MT.lib - release build; multi-threaded + freetype29MT_D.lib - debug build; multi-threaded

    Be sure to extract the files with the Windows (CR+LF) line endings. ZIP diff --git a/builds/windows/visualce/freetype.dsp b/builds/windows/visualce/freetype.dsp index 4e77f5fd8..19d7c454f 100644 --- a/builds/windows/visualce/freetype.dsp +++ b/builds/windows/visualce/freetype.dsp @@ -54,7 +54,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LIB32=link.exe -lib # ADD BASE LIB32 /nologo -# ADD LIB32 /nologo /out:"..\..\..\objs\freetype281.lib" +# ADD LIB32 /nologo /out:"..\..\..\objs\freetype29.lib" !ELSEIF "$(CFG)" == "freetype - Win32 Debug" @@ -78,7 +78,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LIB32=link.exe -lib # ADD BASE LIB32 /nologo -# ADD LIB32 /nologo /out:"..\..\..\objs\freetype281_D.lib" +# ADD LIB32 /nologo /out:"..\..\..\objs\freetype29_D.lib" !ELSEIF "$(CFG)" == "freetype - Win32 Debug Multithreaded" @@ -102,8 +102,8 @@ BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LIB32=link.exe -lib -# ADD BASE LIB32 /nologo /out:"lib\freetype281_D.lib" -# ADD LIB32 /nologo /out:"..\..\..\objs\freetype281MT_D.lib" +# ADD BASE LIB32 /nologo /out:"lib\freetype29_D.lib" +# ADD LIB32 /nologo /out:"..\..\..\objs\freetype29MT_D.lib" !ELSEIF "$(CFG)" == "freetype - Win32 Release Multithreaded" @@ -126,8 +126,8 @@ BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LIB32=link.exe -lib -# ADD BASE LIB32 /nologo /out:"lib\freetype281.lib" -# ADD LIB32 /nologo /out:"..\..\..\objs\freetype281MT.lib" +# ADD BASE LIB32 /nologo /out:"lib\freetype29.lib" +# ADD LIB32 /nologo /out:"..\..\..\objs\freetype29MT.lib" !ELSEIF "$(CFG)" == "freetype - Win32 Release Singlethreaded" @@ -151,8 +151,8 @@ BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LIB32=link.exe -lib -# ADD BASE LIB32 /nologo /out:"..\..\..\objs\freetype281.lib" -# ADD LIB32 /out:"..\..\..\objs\freetype281ST.lib" +# ADD BASE LIB32 /nologo /out:"..\..\..\objs\freetype29.lib" +# ADD LIB32 /out:"..\..\..\objs\freetype29ST.lib" # SUBTRACT LIB32 /nologo !ELSEIF "$(CFG)" == "freetype - Win32 Debug Singlethreaded" @@ -177,8 +177,8 @@ BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LIB32=link.exe -lib -# ADD BASE LIB32 /nologo /out:"..\..\..\objs\freetype281_D.lib" -# ADD LIB32 /nologo /out:"..\..\..\objs\freetype281ST_D.lib" +# ADD BASE LIB32 /nologo /out:"..\..\..\objs\freetype29_D.lib" +# ADD LIB32 /nologo /out:"..\..\..\objs\freetype29ST_D.lib" !ENDIF diff --git a/builds/windows/visualce/freetype.vcproj b/builds/windows/visualce/freetype.vcproj index d29763530..d08cd8e44 100644 --- a/builds/windows/visualce/freetype.vcproj +++ b/builds/windows/visualce/freetype.vcproj @@ -87,7 +87,7 @@ /> PPC/SP WM6 (Windows Mobile 6) -It compiles the following libraries from the FreeType 2.8.1 sources:

    +It compiles the following libraries from the FreeType 2.9 sources:

      -    freetype281.lib     - release build; single threaded
      -    freetype281_D.lib   - debug build;   single threaded
      -    freetype281MT.lib   - release build; multi-threaded
      -    freetype281MT_D.lib - debug build;   multi-threaded
      + freetype29.lib - release build; single threaded + freetype29_D.lib - debug build; single threaded + freetype29MT.lib - release build; multi-threaded + freetype29MT_D.lib - debug build; multi-threaded

    Be sure to extract the files with the Windows (CR+LF) line endings. ZIP diff --git a/docs/VERSIONS.TXT b/docs/VERSIONS.TXT index de4bca977..b0d25b54f 100644 --- a/docs/VERSIONS.TXT +++ b/docs/VERSIONS.TXT @@ -52,6 +52,7 @@ on _most_ systems, but not all of them: release libtool so ------------------------------- + 2.9.0 22.0.16 6.16.0 2.8.1 21.0.15 6.15.0 2.8.0 20.0.14 6.14.0 2.7.1 19.0.13 6.13.0 diff --git a/docs/freetype-config.1 b/docs/freetype-config.1 index 0170b1168..e060dcbd1 100644 --- a/docs/freetype-config.1 +++ b/docs/freetype-config.1 @@ -1,4 +1,4 @@ -.TH FREETYPE-CONFIG 1 "September 2017" "FreeType 2.8.1" +.TH FREETYPE-CONFIG 1 "January 2018" "FreeType 2.9" . . .SH NAME diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h index df30131f7..eda95e2ab 100644 --- a/include/freetype/freetype.h +++ b/include/freetype/freetype.h @@ -4551,8 +4551,8 @@ FT_BEGIN_HEADER * */ #define FREETYPE_MAJOR 2 -#define FREETYPE_MINOR 8 -#define FREETYPE_PATCH 1 +#define FREETYPE_MINOR 9 +#define FREETYPE_PATCH 0 /*************************************************************************/ From 3f96c0bcc18a5d83536561d9e33604504069dd82 Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Tue, 9 Jan 2018 22:22:19 -0500 Subject: [PATCH 403/470] * builds/windows/vc2010/freetype.sln: Synchronize with the project. --- ChangeLog | 4 ++++ builds/windows/vc2010/freetype.sln | 36 ++++++++++-------------------- 2 files changed, 16 insertions(+), 24 deletions(-) diff --git a/ChangeLog b/ChangeLog index fa38730b7..134340189 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2018-01-09 Alexei Podtelezhnikov + + * builds/windows/vc2010/freetype.sln: Synchronize with the project. + 2018-01-08 Werner Lemberg * Version 2.9 released. diff --git a/builds/windows/vc2010/freetype.sln b/builds/windows/vc2010/freetype.sln index b209eddd2..8698207a9 100644 --- a/builds/windows/vc2010/freetype.sln +++ b/builds/windows/vc2010/freetype.sln @@ -6,42 +6,30 @@ Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 Debug|x64 = Debug|x64 - Debug Multithreaded|Win32 = Debug Multithreaded|Win32 - Debug Multithreaded|x64 = Debug Multithreaded|x64 - Debug Singlethreaded|Win32 = Debug Singlethreaded|Win32 - Debug Singlethreaded|x64 = Debug Singlethreaded|x64 + Debug Static|Win32 = Debug Static|Win32 + Debug Static|x64 = Debug Static|x64 Release|Win32 = Release|Win32 Release|x64 = Release|x64 - Release Multithreaded|Win32 = Release Multithreaded|Win32 - Release Multithreaded|x64 = Release Multithreaded|x64 - Release Singlethreaded|Win32 = Release Singlethreaded|Win32 - Release Singlethreaded|x64 = Release Singlethreaded|x64 + Release Static|Win32 = Release Static|Win32 + Release Static|x64 = Release Static|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug|Win32.ActiveCfg = Debug|Win32 {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug|Win32.Build.0 = Debug|Win32 {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug|x64.ActiveCfg = Debug|x64 {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug|x64.Build.0 = Debug|x64 - {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug Multithreaded|Win32.ActiveCfg = Debug Multithreaded|Win32 - {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug Multithreaded|Win32.Build.0 = Debug Multithreaded|Win32 - {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug Multithreaded|x64.ActiveCfg = Debug Multithreaded|x64 - {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug Multithreaded|x64.Build.0 = Debug Multithreaded|x64 - {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug Singlethreaded|Win32.ActiveCfg = Debug Singlethreaded|Win32 - {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug Singlethreaded|Win32.Build.0 = Debug Singlethreaded|Win32 - {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug Singlethreaded|x64.ActiveCfg = Debug Singlethreaded|x64 - {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug Singlethreaded|x64.Build.0 = Debug Singlethreaded|x64 + {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug Static|Win32.ActiveCfg = Debug Static|Win32 + {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug Static|Win32.Build.0 = Debug Static|Win32 + {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug Static|x64.ActiveCfg = Debug Static|x64 + {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug Static|x64.Build.0 = Debug Static|x64 {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release|Win32.ActiveCfg = Release|Win32 {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release|Win32.Build.0 = Release|Win32 {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release|x64.ActiveCfg = Release|x64 {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release|x64.Build.0 = Release|x64 - {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release Multithreaded|Win32.ActiveCfg = Release Multithreaded|Win32 - {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release Multithreaded|Win32.Build.0 = Release Multithreaded|Win32 - {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release Multithreaded|x64.ActiveCfg = Release Multithreaded|x64 - {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release Multithreaded|x64.Build.0 = Release Multithreaded|x64 - {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release Singlethreaded|Win32.ActiveCfg = Release Singlethreaded|Win32 - {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release Singlethreaded|Win32.Build.0 = Release Singlethreaded|Win32 - {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release Singlethreaded|x64.ActiveCfg = Release Singlethreaded|x64 - {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release Singlethreaded|x64.Build.0 = Release Singlethreaded|x64 + {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release Static|Win32.ActiveCfg = Release Static|Win32 + {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release Static|Win32.Build.0 = Release Static|Win32 + {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release Static|x64.ActiveCfg = Release Static|x64 + {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release Static|x64.Build.0 = Release Static|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE From cc2f3cdecff5a351e7e8961b9f2e389ab740231a Mon Sep 17 00:00:00 2001 From: Ewald Hew Date: Wed, 10 Jan 2018 13:24:56 +0800 Subject: [PATCH 404/470] [psaux] Correctly handle Flex features (#52846). * src/psaux/psintrp.c (cf2_interpT2CharString) : Do not move if doing Flex. --- ChangeLog | 7 +++++++ src/psaux/psintrp.c | 6 ++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 134340189..96359ee80 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2018-01-10 Ewald Hew + + [psaux] Correctly handle Flex features (#52846). + + * src/psaux/psintrp.c (cf2_interpT2CharString) : Do not move if doing Flex. + 2018-01-09 Alexei Podtelezhnikov * builds/windows/vc2010/freetype.sln: Synchronize with the project. diff --git a/src/psaux/psintrp.c b/src/psaux/psintrp.c index 5c0ee7849..da5a8dad1 100644 --- a/src/psaux/psintrp.c +++ b/src/psaux/psintrp.c @@ -852,7 +852,8 @@ curY = ADD_INT32( curY, cf2_stack_popFixed( opStack ) ); - cf2_glyphpath_moveTo( &glyphPath, curX, curY ); + if ( !decoder->flex_state ) + cf2_glyphpath_moveTo( &glyphPath, curX, curY ); break; @@ -2674,7 +2675,8 @@ curX = ADD_INT32( curX, cf2_stack_popFixed( opStack ) ); - cf2_glyphpath_moveTo( &glyphPath, curX, curY ); + if ( !decoder->flex_state ) + cf2_glyphpath_moveTo( &glyphPath, curX, curY ); break; From 707cd028b2b419a5491d444b128d8092afd9f201 Mon Sep 17 00:00:00 2001 From: Steve Robinson Date: Wed, 10 Jan 2018 07:48:39 +0100 Subject: [PATCH 405/470] * CMakeLists.txt [win32]: Suppress warnings for POSIX functions. --- CMakeLists.txt | 3 +++ ChangeLog | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index b0f86126b..83f26b94b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -162,6 +162,9 @@ set(SHARED_LIBRARY_VERSION ${VERSION_MAJOR}.${VERSION_MINOR}) # Compiler definitions for building the library add_definitions(-DFT2_BUILD_LIBRARY) +if (WIN32) + add_definitions(-D_CRT_SECURE_NO_WARNINGS) +endif () # Find dependencies diff --git a/ChangeLog b/ChangeLog index 96359ee80..4dd399e5d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2018-01-10 Steve Robinson + + * CMakeLists.txt [win32]: Suppress warnings for POSIX functions. + 2018-01-10 Ewald Hew [psaux] Correctly handle Flex features (#52846). From e8b38f899c792565de4bbb09b14f7962d441faee Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Fri, 12 Jan 2018 08:57:08 -0500 Subject: [PATCH 406/470] [build] Improve and document MSVC build. * include/freetype/config/ftconfig.h: Guard dllexport/dllimport attributes with _DLL and FT2_DLLIMPORT. * builds/windows/vc2010/index.html: Update documentation. --- ChangeLog | 8 ++++++ builds/windows/vc2010/index.html | 40 +++++++++++------------------- include/freetype/config/ftconfig.h | 5 ++-- 3 files changed, 25 insertions(+), 28 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4dd399e5d..ab6d4218b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2018-01-12 Alexei Podtelezhnikov + + [build] Improve and document MSVC build. + + * include/freetype/config/ftconfig.h: Guard dllexport/dllimport + attributes with _DLL and FT2_DLLIMPORT. + * builds/windows/vc2010/index.html: Update documentation. + 2018-01-10 Steve Robinson * CMakeLists.txt [win32]: Suppress warnings for POSIX functions. diff --git a/builds/windows/vc2010/index.html b/builds/windows/vc2010/index.html index 7433ce835..8677511dc 100644 --- a/builds/windows/vc2010/index.html +++ b/builds/windows/vc2010/index.html @@ -1,42 +1,26 @@

    - FreeType 2 Project Files for VS.NET 2010 or newer + FreeType 2 Project Files for Visual C++ 2010 or newer

    - FreeType 2 Project Files for VS.NET 2010 or newer + FreeType 2 Project Files for Visual C++ 2010 or newer

    -

    This directory contains a project file for Visual C++ (VS.NET 2010 -or newer), named freetype.vcxproj, and Visual Studio, called -freetype.sln. It compiles the following libraries from the -FreeType 2.9 sources:

    +

    This directory contains solution and project files for +Visual C++ 2010 or newer, named freetype.sln, +and freetype.vcxproj. It compiles the following libraries +from the FreeType 2.9 sources:

      -
      -    freetype29.lib    - release build
      -    freetype29d.lib   - debug build
      -    freetype29ST.lib  - release build; single threaded
      -    freetype29STd.lib - debug build;   single threaded
      -    freetype29MT.lib  - release build; multi-threaded
      -    freetype29MTd.lib - debug build;   multi-threaded
      +
    • freetype.dll using 'Release' or 'Debug' configurations
    • +
    • freetype.lib using 'Release Static' or 'Debug Static' configurations
    -

    Both Win32 and x64 builds are supported.

    - -

    Be sure to extract the files with the Windows (CR+LF) line endings. ZIP -archives are already stored this way, so no further action is required. If -you use some .tar.*z archives, be sure to configure your extracting -tool to convert the line endings. For example, with WinZip, you should activate the TAR -file smart CR/LF Conversion option. Alternatively, you may consider -using the unix2dos or u2d utilities that are floating -around, which specifically deal with this particular problem. - -

    Build directories are placed in the top-level objs\vc2010 -directory.

    +

    Both Win32 and x64 builds are supported. Build directories and target +files are placed in the top-level objs directory.

    Customization of the FreeType library is done by editing the ftoption.h header file in the top-level devel path. @@ -48,5 +32,9 @@ edit the freetype.users.props file in this directory. It also simplifies automated (command-line) builds using msbuild.

    +

    To link your executable with FreeType DLL, you may want to define +FT2_DLLIMPORT so that the imported functions are appropriately +attributed with dllimport.

    + diff --git a/include/freetype/config/ftconfig.h b/include/freetype/config/ftconfig.h index f539e9a17..009c70f18 100644 --- a/include/freetype/config/ftconfig.h +++ b/include/freetype/config/ftconfig.h @@ -462,10 +462,11 @@ FT_BEGIN_HEADER #endif #ifdef _MSC_VER +#if defined( FT2_BUILD_LIBRARY ) && defined( _DLL ) #undef FT_EXPORT -#ifdef _DLL #define FT_EXPORT( x ) __declspec( dllexport ) x -#else +#elif defined( FT2_DLLIMPORT ) +#undef FT_EXPORT #define FT_EXPORT( x ) __declspec( dllimport ) x #endif #endif From d2d1750e0802c1472419da1c73992eae92777d0f Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Fri, 12 Jan 2018 23:01:49 -0500 Subject: [PATCH 407/470] [build] Expand dllexport/dllimport to Cygwin/MinGW. * include/freetype/config/ftconfig.h: Respect DLL_EXPORT, s/_MSC_VER/_WIN32/. * builds/unix/ftconfig.in: Replicate here. * builds/vms/ftconfig.h: Replicate here. --- ChangeLog | 9 +++++++++ builds/unix/ftconfig.in | 11 +++++++++++ builds/vms/ftconfig.h | 11 +++++++++++ include/freetype/config/ftconfig.h | 5 +++-- 4 files changed, 34 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index ab6d4218b..6e1a0f30c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2018-01-12 Alexei Podtelezhnikov + + [build] Expand dllexport/dllimport to Cygwin/MinGW. + + * include/freetype/config/ftconfig.h: Respect DLL_EXPORT, + s/_MSC_VER/_WIN32/. + * builds/unix/ftconfig.in: Replicate here. + * builds/vms/ftconfig.h: Replicate here. + 2018-01-12 Alexei Podtelezhnikov [build] Improve and document MSVC build. diff --git a/builds/unix/ftconfig.in b/builds/unix/ftconfig.in index 5159693e7..ca9058834 100644 --- a/builds/unix/ftconfig.in +++ b/builds/unix/ftconfig.in @@ -493,6 +493,17 @@ FT_BEGIN_HEADER #define FT_EXPORT( x ) extern x #endif +#ifdef _WIN32 +#if defined( FT2_BUILD_LIBRARY ) && \ + ( defined( _DLL ) || defined( DLL_EXPORT ) ) +#undef FT_EXPORT +#define FT_EXPORT( x ) __declspec( dllexport ) x +#elif defined( FT2_DLLIMPORT ) +#undef FT_EXPORT +#define FT_EXPORT( x ) __declspec( dllimport ) x +#endif +#endif + #endif /* !FT_EXPORT */ diff --git a/builds/vms/ftconfig.h b/builds/vms/ftconfig.h index fa4aa1198..d87ea69c3 100644 --- a/builds/vms/ftconfig.h +++ b/builds/vms/ftconfig.h @@ -445,6 +445,17 @@ FT_BEGIN_HEADER #define FT_EXPORT( x ) extern x #endif +#ifdef _WIN32 +#if defined( FT2_BUILD_LIBRARY ) && \ + ( defined( _DLL ) || defined( DLL_EXPORT ) ) +#undef FT_EXPORT +#define FT_EXPORT( x ) __declspec( dllexport ) x +#elif defined( FT2_DLLIMPORT ) +#undef FT_EXPORT +#define FT_EXPORT( x ) __declspec( dllimport ) x +#endif +#endif + #endif /* !FT_EXPORT */ diff --git a/include/freetype/config/ftconfig.h b/include/freetype/config/ftconfig.h index 009c70f18..8ff143ea3 100644 --- a/include/freetype/config/ftconfig.h +++ b/include/freetype/config/ftconfig.h @@ -461,8 +461,9 @@ FT_BEGIN_HEADER #define FT_EXPORT( x ) extern x #endif -#ifdef _MSC_VER -#if defined( FT2_BUILD_LIBRARY ) && defined( _DLL ) +#ifdef _WIN32 +#if defined( FT2_BUILD_LIBRARY ) && \ + ( defined( _DLL ) || defined( DLL_EXPORT ) ) #undef FT_EXPORT #define FT_EXPORT( x ) __declspec( dllexport ) x #elif defined( FT2_DLLIMPORT ) From fd8000f0402d48fd22f774170c74d585a82d7508 Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Thu, 18 Jan 2018 03:58:34 -0500 Subject: [PATCH 408/470] [build] Move VERSIONINFO resource. * builds/windows/vc2010/freetype.vcxproj: Updated. * builds/windows/ftver.rc: Move file from here... * src/base/ftver.rc: ... to here. --- ChangeLog | 8 ++++++++ builds/windows/vc2010/freetype.vcxproj | 2 +- {builds/windows => src/base}/ftver.rc | 0 3 files changed, 9 insertions(+), 1 deletion(-) rename {builds/windows => src/base}/ftver.rc (100%) diff --git a/ChangeLog b/ChangeLog index 6e1a0f30c..0f034312b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2018-01-18 Alexei Podtelezhnikov + + [build] Move VERSIONINFO resource. + + * builds/windows/vc2010/freetype.vcxproj: Updated. + * builds/windows/ftver.rc: Move file from here... + * src/base/ftver.rc: ... to here. + 2018-01-12 Alexei Podtelezhnikov [build] Expand dllexport/dllimport to Cygwin/MinGW. diff --git a/builds/windows/vc2010/freetype.vcxproj b/builds/windows/vc2010/freetype.vcxproj index 8eb5b9a83..eaddcfde0 100644 --- a/builds/windows/vc2010/freetype.vcxproj +++ b/builds/windows/vc2010/freetype.vcxproj @@ -435,7 +435,7 @@ false - + diff --git a/builds/windows/ftver.rc b/src/base/ftver.rc similarity index 100% rename from builds/windows/ftver.rc rename to src/base/ftver.rc From 4b8ccc56d8b4971a4f0434f497d74c641402222d Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Thu, 18 Jan 2018 04:32:52 -0500 Subject: [PATCH 409/470] [build] Enable VERSIONINFO resource for Cygwin/MinGW. * builds/unix/configure.raw: Check for resource compiler. * builds/unix/unix-cc.in: Conditionally set up resource compiler. * builds/freetype.mk: Add conditional rule for `ftver.rc'. * src/base/ftver.rc: Copyright notice and year update. --- ChangeLog | 9 +++++++++ builds/freetype.mk | 16 ++++++++++++++++ builds/unix/configure.raw | 1 + builds/unix/unix-cc.in | 8 +++++++- src/base/ftver.rc | 20 +++++++++++++++++++- 5 files changed, 52 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0f034312b..526c4e0db 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2018-01-18 Alexei Podtelezhnikov + + [build] Enable VERSIONINFO resource for Cygwin/MinGW. + + * builds/unix/configure.raw: Check for resource compiler. + * builds/unix/unix-cc.in: Conditionally set up resource compiler. + * builds/freetype.mk: Add conditional rule for `ftver.rc'. + * src/base/ftver.rc: Copyright notice and year update. + 2018-01-18 Alexei Podtelezhnikov [build] Move VERSIONINFO resource. diff --git a/builds/freetype.mk b/builds/freetype.mk index f2e7e608e..447b4a352 100644 --- a/builds/freetype.mk +++ b/builds/freetype.mk @@ -248,6 +248,22 @@ $(FTINIT_OBJ): $(FTINIT_SRC) $(FREETYPE_H) $(FT_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<) +# ftver component +# +# The VERSIONINFO resource `ftver.rc' contains version and copyright +# to be compiled by windres and tagged into DLL usually. +# +ifneq ($(RC),) + FTVER_SRC := $(BASE_DIR)/ftver.rc + FTVER_OBJ := $(OBJ_DIR)/ftver.$O + + OBJECTS_LIST += $(FTVER_OBJ) + + $(FTVER_OBJ): $(FTVER_SRC) + $(RC) -o $@ $< +endif + + # All FreeType library objects. # OBJ_M := $(BASE_OBJ_M) $(BASE_EXT_OBJ) $(DRV_OBJS_M) diff --git a/builds/unix/configure.raw b/builds/unix/configure.raw index 20157b9be..d76c32452 100644 --- a/builds/unix/configure.raw +++ b/builds/unix/configure.raw @@ -37,6 +37,7 @@ AC_SUBST(EXEEXT) PKG_PROG_PKG_CONFIG([0.24]) LT_INIT(win32-dll) +LT_PROG_RC # checks for native programs to generate building tool diff --git a/builds/unix/unix-cc.in b/builds/unix/unix-cc.in index a06246d63..5675866ea 100644 --- a/builds/unix/unix-cc.in +++ b/builds/unix/unix-cc.in @@ -87,10 +87,16 @@ ANSIFLAGS := @XX_ANSIFLAGS@ # C compiler to use -- we use libtool! # -# CCraw := $(CC) CC := $(LIBTOOL) --mode=compile $(CCraw) +# Resource compiler to use on Cygwin/MinGW, usually windres. +# +RCraw := @RC@ +ifneq ($(RCraw),) + RC := $(LIBTOOL) --tag=RC --mode=compile $(RCraw) +endif + # Linker flags. # LDFLAGS := @LDFLAGS@ diff --git a/src/base/ftver.rc b/src/base/ftver.rc index 109310901..498e59929 100644 --- a/src/base/ftver.rc +++ b/src/base/ftver.rc @@ -1,3 +1,21 @@ +/***************************************************************************/ +/* */ +/* ftver.rc */ +/* */ +/* FreeType VERSIONINFO resource for Windows DLLs. */ +/* */ +/* Copyright 2018 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + #include #define FT_VERSION 2,9,0,0 @@ -27,7 +45,7 @@ BEGIN VALUE "FileVersion", FT_VERSION_STR VALUE "ProductName", "FreeType" VALUE "ProductVersion", FT_VERSION_STR - VALUE "LegalCopyright", "Š 2017 The FreeType Project www.freetype.org. All rights reserved." + VALUE "LegalCopyright", "Š 2018 The FreeType Project www.freetype.org. All rights reserved." VALUE "InternalName", "freetype" VALUE "OriginalFilename", FT_FILENAME END From 6ce6685659bab4aca0f0da66c5a7cb6f5190dc54 Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Thu, 18 Jan 2018 21:29:48 -0500 Subject: [PATCH 410/470] * src/base/ftver.rc: Fix mingw-w64 compilation. --- ChangeLog | 4 ++++ src/base/ftver.rc | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 526c4e0db..c9d5be107 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2018-01-18 Alexei Podtelezhnikov + + * src/base/ftver.rc: Fix mingw-w64 compilation. + 2018-01-18 Alexei Podtelezhnikov [build] Enable VERSIONINFO resource for Cygwin/MinGW. diff --git a/src/base/ftver.rc b/src/base/ftver.rc index 498e59929..cdff99f7f 100644 --- a/src/base/ftver.rc +++ b/src/base/ftver.rc @@ -16,7 +16,7 @@ /***************************************************************************/ -#include +#include #define FT_VERSION 2,9,0,0 #define FT_VERSION_STR "2.9.0" @@ -45,7 +45,7 @@ BEGIN VALUE "FileVersion", FT_VERSION_STR VALUE "ProductName", "FreeType" VALUE "ProductVersion", FT_VERSION_STR - VALUE "LegalCopyright", "Š 2018 The FreeType Project www.freetype.org. All rights reserved." + VALUE "LegalCopyright", "\251 2018 The FreeType Project www.freetype.org. All rights reserved." VALUE "InternalName", "freetype" VALUE "OriginalFilename", FT_FILENAME END From c6a965b4d312c5c034c6ae9562ee82a9ce8c8fae Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Sun, 21 Jan 2018 14:29:58 -0500 Subject: [PATCH 411/470] [unix] Call libtool to clean up. * builds/unix/install.mk (clean_project_unix, distclean_project_unix): Use libtool. * builds/freetype.mk: Minor. --- ChangeLog | 8 ++++++++ builds/freetype.mk | 7 +++---- builds/unix/install.mk | 8 +++----- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index c9d5be107..8b3b75ca3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2018-01-21 Alexei Podtelezhnikov + + [unix] Call libtool to clean up. + + * builds/unix/install.mk (clean_project_unix, distclean_project_unix): + Use libtool. + * builds/freetype.mk: Minor. + 2018-01-18 Alexei Podtelezhnikov * src/base/ftver.rc: Fix mingw-w64 compilation. diff --git a/builds/freetype.mk b/builds/freetype.mk index 447b4a352..6f68a0f65 100644 --- a/builds/freetype.mk +++ b/builds/freetype.mk @@ -345,10 +345,9 @@ remove_ftmodule_h: .PHONY: clean distclean -# The `config.mk' file must define `clean_freetype' and -# `distclean_freetype'. Implementations may use to relay these to either -# the `std' or `dos' versions from above, or simply provide their own -# implementation. +# The `config.mk' file must define `clean_project' and `distclean_project'. +# Implementations may use to relay these to either the `std' or `dos' +# versions from above, or simply provide their own implementation. # clean: clean_project distclean: distclean_project remove_config_mk remove_ftmodule_h diff --git a/builds/unix/install.mk b/builds/unix/install.mk index 50325ca5a..d89064e44 100644 --- a/builds/unix/install.mk +++ b/builds/unix/install.mk @@ -88,13 +88,11 @@ check: # Unix cleaning and distclean rules. # clean_project_unix: - -$(DELETE) $(BASE_OBJECTS) $(OBJ_M) $(OBJ_S) - -$(DELETE) $(patsubst %.$O,%.$(SO),$(BASE_OBJECTS) $(OBJ_M) $(OBJ_S)) \ - $(CLEAN) + -$(LIBTOOL) --mode=clean $(RM) $(OBJECTS_LIST) + -$(DELETE) $(CLEAN) distclean_project_unix: clean_project_unix - -$(DELETE) $(PROJECT_LIBRARY) - -$(DELDIR) $(OBJ_DIR)/.libs + -$(LIBTOOL) --mode=clean $(RM) $(PROJECT_LIBRARY) -$(DELETE) *.orig *~ core *.core $(DISTCLEAN) # EOF From b1e0209829d6def7b337700204e2adb75fb9282a Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Tue, 23 Jan 2018 22:29:45 -0500 Subject: [PATCH 412/470] [apinames] Anonymous version map for GNU linker. * src/tools/apinames.c (PROGRAM_VERSION): Set to 0.3. (OutputFormat): Add `OUTPUT_GNU_VERMAP'. (names_dump): Handle it. (usage): Updated. (main): Handle new command line flag `-wL'. --- ChangeLog | 10 ++++++++++ src/tools/apinames.c | 19 +++++++++++++++++-- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8b3b75ca3..20f195142 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2018-01-23 Alexei Podtelezhnikov + + [apinames] Anonymous version map for GNU linker. + + * src/tools/apinames.c (PROGRAM_VERSION): Set to 0.3. + (OutputFormat): Add `OUTPUT_GNU_VERMAP'. + (names_dump): Handle it. + (usage): Updated. + (main): Handle new command line flag `-wL'. + 2018-01-21 Alexei Podtelezhnikov [unix] Call libtool to clean up. diff --git a/src/tools/apinames.c b/src/tools/apinames.c index 73bc99de5..06c326043 100644 --- a/src/tools/apinames.c +++ b/src/tools/apinames.c @@ -22,7 +22,7 @@ #include #define PROGRAM_NAME "apinames" -#define PROGRAM_VERSION "0.2" +#define PROGRAM_VERSION "0.3" #define LINEBUFF_SIZE 1024 @@ -32,7 +32,8 @@ typedef enum OutputFormat_ OUTPUT_WINDOWS_DEF, /* output a Windows .DEF file for Visual C++ or Mingw */ OUTPUT_BORLAND_DEF, /* output a Windows .DEF file for Borland C++ */ OUTPUT_WATCOM_LBC, /* output a Watcom Linker Command File */ - OUTPUT_NETWARE_IMP /* output a NetWare ImportFile */ + OUTPUT_NETWARE_IMP, /* output a NetWare ImportFile */ + OUTPUT_GNU_VERMAP /* output a version map for GNU or Solaris linker */ } OutputFormat; @@ -198,6 +199,15 @@ names_dump( FILE* out, } break; + case OUTPUT_GNU_VERMAP: + { + fprintf( out, "{\n\tglobal:\n" ); + for ( nn = 0; nn < num_names; nn++ ) + fprintf( out, "\t\t%s;\n", the_names[nn].name ); + fprintf( out, "\tlocal:\n\t\t*;\n};\n" ); + } + break; + default: /* LIST */ for ( nn = 0; nn < num_names; nn++ ) fprintf( out, "%s\n", the_names[nn].name ); @@ -323,6 +333,7 @@ usage( void ) " -wB : output .DEF file for Borland C++\n" " -wW : output Watcom Linker Response File\n" " -wN : output NetWare Import File\n" + " -wL : output version map for GNU or Solaris linker\n" "\n"; fprintf( stderr, @@ -410,6 +421,10 @@ int main( int argc, const char* const* argv ) format = OUTPUT_NETWARE_IMP; break; + case 'L': + format = OUTPUT_GNU_VERMAP; + break; + case 0: break; From 994eb2b34934bc5face9f83b2d3b12cf7a9262ab Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Fri, 26 Jan 2018 23:17:43 +0100 Subject: [PATCH 413/470] [truetype] Fix multiple calls of `FT_Get_MM_Var' (#52955). * src/truetype/ttgxvar.c (TT_Get_MM_Var): Set `face->blend->num_axis' in case we have to initialize the `face->blend'. --- ChangeLog | 8 ++++++++ src/truetype/ttgxvar.c | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 20f195142..f62b67358 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2018-01-26 Ben Wagner + + [truetype] Fix multiple calls of `FT_Get_MM_Var' (#52955). + + * src/truetype/ttgxvar.c (TT_Get_MM_Var): Set + `face->blend->num_axis' in case we have to initialize the + `face->blend'. + 2018-01-23 Alexei Podtelezhnikov [apinames] Anonymous version map for GNU linker. diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c index 6f456cf8c..980086ce7 100644 --- a/src/truetype/ttgxvar.c +++ b/src/truetype/ttgxvar.c @@ -2048,7 +2048,8 @@ if ( FT_NEW( face->blend ) ) goto Exit; - num_axes = fvar_head.axisCount; + num_axes = fvar_head.axisCount; + face->blend->num_axis = num_axes; } else num_axes = face->blend->num_axis; From 50f693a78b0da3ee03cec04f48e8a0f0ea34a34d Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sat, 27 Jan 2018 09:33:17 +0100 Subject: [PATCH 414/470] [truetype] Beautify tracing of VF axis records. * src/truetype/ttgxvar.c (TT_Get_MM_Var): Show axis records in a table-like manner. --- ChangeLog | 7 +++++++ src/truetype/ttgxvar.c | 33 ++++++++++++++++++++++++--------- 2 files changed, 31 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index f62b67358..f62e3f946 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2018-01-27 Werner Lemberg + + [truetype] Beautify tracing of VF axis records. + + * src/truetype/ttgxvar.c (TT_Get_MM_Var): Show axis records in a + table-like manner. + 2018-01-26 Ben Wagner [truetype] Fix multiple calls of `FT_Get_MM_Var' (#52955). diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c index 980086ce7..d765184b6 100644 --- a/src/truetype/ttgxvar.c +++ b/src/truetype/ttgxvar.c @@ -2043,7 +2043,9 @@ FT_TRACE2(( "loaded\n" )); - FT_TRACE5(( "number of GX style axes: %d\n", fvar_head.axisCount )); + FT_TRACE5(( "%d variation ax%s\n", + fvar_head.axisCount, + fvar_head.axisCount == 1 ? "is" : "es" )); if ( FT_NEW( face->blend ) ) goto Exit; @@ -2143,6 +2145,10 @@ { GX_FVar_Axis axis_rec; +#ifdef FT_DEBUG_LEVEL_TRACE + int invalid = 0; +#endif + if ( FT_STREAM_READ_FIELDS( fvaraxis_fields, &axis_rec ) ) goto Exit; @@ -2163,22 +2169,31 @@ if ( a->minimum > a->def || a->def > a->maximum ) { - FT_TRACE2(( "TT_Get_MM_Var:" - " invalid \"%s\" axis record; disabling\n", - a->name )); - a->minimum = a->def; a->maximum = a->def; + +#ifdef FT_DEBUG_LEVEL_TRACE + invalid = 1; +#endif } - FT_TRACE5(( " \"%s\":" - " minimum=%.5f, default=%.5f, maximum=%.5f," - " flags=0x%04X\n", +#ifdef FT_DEBUG_LEVEL_TRACE + if ( i == 0 ) + FT_TRACE5(( " idx tag " + /* " XXX `XXXX'" */ + " minimum default maximum flags\n" )); + /* " XXXX.XXXXX XXXX.XXXXX XXXX.XXXXX 0xXXXX" */ + + FT_TRACE5(( " %3d `%s'" + " %10.5f %10.5f %10.5f 0x%04X%s\n", + i, a->name, a->minimum / 65536.0, a->def / 65536.0, a->maximum / 65536.0, - *axis_flags )); + *axis_flags, + invalid ? " (invalid, disabled)" : "" )); +#endif a++; axis_flags++; From 5f94c90f1971b01951fa25a76ba394f30eb15ddd Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sat, 27 Jan 2018 10:52:13 +0100 Subject: [PATCH 415/470] Fix comment. --- src/sfnt/ttpost.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sfnt/ttpost.c b/src/sfnt/ttpost.c index f14064999..6de99ef97 100644 --- a/src/sfnt/ttpost.c +++ b/src/sfnt/ttpost.c @@ -473,8 +473,8 @@ /* idx :: The glyph index. */ /* */ /* */ - /* PSname :: The address of a string pointer. Will be NULL in case */ - /* of error, otherwise it is a pointer to the glyph name. */ + /* PSname :: The address of a string pointer. Undefined in case of */ + /* error, otherwise it is a pointer to the glyph name. */ /* */ /* You must not modify the returned string! */ /* */ From ef48653023ea3e67bb4df3b5be1ef10089623abf Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sat, 27 Jan 2018 11:16:22 +0100 Subject: [PATCH 416/470] [truetype] Better trace VF instances. * src/truetype/ttgxvar.c (ft_var_to_normalized): Don't emit number of coordinates. (TT_Get_MM_Var): Trace instance indices names. (TT_Set_Var_Design): Updated. --- ChangeLog | 9 +++++++ src/truetype/ttgxvar.c | 55 ++++++++++++++++++++++++++++++++++++++---- 2 files changed, 59 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index f62e3f946..1777d2f59 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2018-01-27 Werner Lemberg + + [truetype] Better trace VF instances. + + * src/truetype/ttgxvar.c (ft_var_to_normalized): Don't emit number + of coordinates. + (TT_Get_MM_Var): Trace instance indices names. + (TT_Set_Var_Design): Updated. + 2018-01-27 Werner Lemberg [truetype] Beautify tracing of VF axis records. diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c index d765184b6..a6910e9a2 100644 --- a/src/truetype/ttgxvar.c +++ b/src/truetype/ttgxvar.c @@ -1733,17 +1733,13 @@ /* based on the [min,def,max] values for the axis to be [-1,0,1]. */ /* Then, if there's an `avar' table, we renormalize this range. */ - FT_TRACE5(( "%d design coordinate%s:\n", - num_coords, - num_coords == 1 ? "" : "s" )); - a = mmvar->axis; for ( i = 0; i < num_coords; i++, a++ ) { FT_Fixed coord = coords[i]; - FT_TRACE5(( " %.5f\n", coord / 65536.0 )); + FT_TRACE5(( " %d: %.5f\n", i, coord / 65536.0 )); if ( coord > a->maximum || coord < a->minimum ) { FT_TRACE1(( @@ -2218,6 +2214,10 @@ goto Exit; } + FT_TRACE5(( "%d instance%s\n", + fvar_head.instanceCount, + fvar_head.instanceCount == 1 ? "" : "s" )); + ns = mmvar->namedstyle; nsc = face->blend->normalized_stylecoords; for ( i = 0; i < fvar_head.instanceCount; i++, ns++ ) @@ -2240,6 +2240,49 @@ else ns->psid = 0xFFFF; +#ifdef FT_DEBUG_LEVEL_TRACE + { + SFNT_Service sfnt = (SFNT_Service)face->sfnt; + + FT_String* strname = NULL; + FT_String* psname = NULL; + + FT_ULong pos; + + + pos = FT_STREAM_POS(); + + if ( ns->strid != 0xFFFF ) + { + (void)sfnt->get_name( face, + (FT_UShort)ns->strid, + &strname ); + if ( strname && !ft_strcmp( strname, ".notdef" ) ) + strname = NULL; + } + + if ( ns->psid != 0xFFFF ) + { + (void)sfnt->get_name( face, + (FT_UShort)ns->psid, + &psname ); + if ( psname && !ft_strcmp( psname, ".notdef" ) ) + psname = NULL; + } + + (void)FT_STREAM_SEEK( pos ); + + FT_TRACE5(( " instance %d (%s%s%s, %s%s%s)\n", + i, + strname ? "name: `" : "", + strname ? strname : "unnamed", + strname ? "'" : "", + psname ? "PS name: `" : "", + psname ? psname : "no PS name", + psname ? "'" : "" )); + } +#endif /* FT_DEBUG_LEVEL_TRACE */ + ft_var_to_normalized( face, num_axes, ns->coords, nsc ); nsc += num_axes; @@ -2787,6 +2830,8 @@ if ( !face->blend->avar_loaded ) ft_var_load_avar( face ); + FT_TRACE5(( "TT_Set_Var_Design:\n" + " normalized design coordinates:\n" )); ft_var_to_normalized( face, num_coords, blend->coords, normalized ); error = tt_set_mm_blend( face, mmvar->num_axis, normalized, 0 ); From f438e069723c1e7a7a226e05f677a5e17e346a67 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sat, 27 Jan 2018 14:39:15 +0100 Subject: [PATCH 417/470] * src/truetype/ttgxvar.c (tt_set_mm_blend): Minor. --- ChangeLog | 4 ++++ src/truetype/ttgxvar.c | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1777d2f59..15ef4ae31 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2018-01-27 Werner Lemberg + + * src/truetype/ttgxvar.c (tt_set_mm_blend): Minor. + 2018-01-27 Werner Lemberg [truetype] Better trace VF instances. diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c index a6910e9a2..615a693aa 100644 --- a/src/truetype/ttgxvar.c +++ b/src/truetype/ttgxvar.c @@ -2440,11 +2440,12 @@ num_coords = mmvar->num_axis; } - FT_TRACE5(( "normalized design coordinates:\n" )); + FT_TRACE5(( "TT_Set_MM_Blend:" + " normalized design coordinates:\n" )); for ( i = 0; i < num_coords; i++ ) { - FT_TRACE5(( " %.5f\n", coords[i] / 65536.0 )); + FT_TRACE5(( " %.5f\n", coords[i] / 65536.0 )); if ( coords[i] < -0x00010000L || coords[i] > 0x00010000L ) { FT_TRACE1(( "TT_Set_MM_Blend: normalized design coordinate %.5f\n" From 29c759284e305ec428703c9a5831d0b1fc3497ef Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sat, 27 Jan 2018 14:43:43 +0100 Subject: [PATCH 418/470] * src/truetype/ttinterp.c (Ins_GETVARIATION): Avoid NULL reference. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=5736 --- ChangeLog | 8 ++++++++ src/truetype/ttinterp.c | 12 ++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 15ef4ae31..fff4a4141 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2018-01-27 Werner Lemberg + + * src/truetype/ttinterp.c (Ins_GETVARIATION): Avoid NULL reference. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=5736 + 2018-01-27 Werner Lemberg * src/truetype/ttgxvar.c (tt_set_mm_blend): Minor. diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c index d855aaaa9..551f14a2e 100644 --- a/src/truetype/ttinterp.c +++ b/src/truetype/ttinterp.c @@ -7532,8 +7532,16 @@ return; } - for ( i = 0; i < num_axes; i++ ) - args[i] = coords[i] >> 2; /* convert 16.16 to 2.14 format */ + if ( coords ) + { + for ( i = 0; i < num_axes; i++ ) + args[i] = coords[i] >> 2; /* convert 16.16 to 2.14 format */ + } + else + { + for ( i = 0; i < num_axes; i++ ) + args[i] = 0; + } } From 68dddcdcbe18a08d778026efc01b1369e35cbf6a Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sat, 27 Jan 2018 23:59:30 +0100 Subject: [PATCH 419/470] [truetype] Better protection against invalid VF data. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=5739 Bug introduced in commit 08cd62deedefe217f2ea50e392923ce8b5bc7ac7. * src/truetype/ttgxvar.c (TT_Set_Var_Design): Always initialize `normalizedcoords'. --- ChangeLog | 13 +++++++++++++ src/truetype/ttgxvar.c | 5 +++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index fff4a4141..0708e5e75 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2018-01-27 Werner Lemberg + + [truetype] Better protection against invalid VF data. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=5739 + + Bug introduced in commit 08cd62deedefe217f2ea50e392923ce8b5bc7ac7. + + * src/truetype/ttgxvar.c (TT_Set_Var_Design): Always initialize + `normalizedcoords'. + 2018-01-27 Werner Lemberg * src/truetype/ttinterp.c (Ins_GETVARIATION): Avoid NULL reference. diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c index 615a693aa..a2bfc88d7 100644 --- a/src/truetype/ttgxvar.c +++ b/src/truetype/ttgxvar.c @@ -2821,8 +2821,9 @@ } } - /* return value -1 indicates `no change' */ - if ( !have_diff ) + /* return value -1 indicates `no change'; */ + /* we can exit early if `normalizedcoords' is already computed */ + if ( blend->normalizedcoords && !have_diff ) return -1; if ( FT_NEW_ARRAY( normalized, mmvar->num_axis ) ) From 036bdc0c9a4fb55b4fe5a7276e97b70b95c8a260 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sun, 28 Jan 2018 00:05:46 +0100 Subject: [PATCH 420/470] [truetype] Minor typo. --- src/truetype/ttgxvar.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c index a2bfc88d7..b3e9ec7d9 100644 --- a/src/truetype/ttgxvar.c +++ b/src/truetype/ttgxvar.c @@ -2440,7 +2440,7 @@ num_coords = mmvar->num_axis; } - FT_TRACE5(( "TT_Set_MM_Blend:" + FT_TRACE5(( "TT_Set_MM_Blend:\n" " normalized design coordinates:\n" )); for ( i = 0; i < num_coords; i++ ) From f4a3255d450e18e4981074ef9a42a2318f9e7cbc Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Sun, 4 Feb 2018 00:09:02 -0500 Subject: [PATCH 421/470] [unix] Use -fvisibility=hidden. It is now widely recommended that ELF shared libraries hide symbols except those with explicit __attribute__((visibility("default"))). This is supported by all major compilers and should rather be an option in libtool. * builds/unix/configure.raw: Add -fvisibility=hidden to CFLAGS. * builds/unix/ftconfig.in, builds/vms/ftconfig.h, include/freetype/config/ftconfig.h (FT_EXPORT): Use visibility attribute. --- ChangeLog | 14 ++++++++++++++ builds/unix/configure.raw | 12 ++++++++++++ builds/unix/ftconfig.in | 29 ++++++++++++++++++----------- builds/vms/ftconfig.h | 29 ++++++++++++++++++----------- include/freetype/config/ftconfig.h | 29 ++++++++++++++++++----------- 5 files changed, 80 insertions(+), 33 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0708e5e75..71fd567b5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2018-02-04 Alexei Podtelezhnikov + + [unix] Use -fvisibility=hidden. + + It is now widely recommended that ELF shared libraries hide symbols + except those with explicit __attribute__((visibility("default"))). + This is supported by all major compilers and should rather be an + option in libtool. + + * builds/unix/configure.raw: Add -fvisibility=hidden to CFLAGS. + * builds/unix/ftconfig.in, builds/vms/ftconfig.h, + include/freetype/config/ftconfig.h (FT_EXPORT): Use visibility + attribute. + 2018-01-27 Werner Lemberg [truetype] Better protection against invalid VF data. diff --git a/builds/unix/configure.raw b/builds/unix/configure.raw index d76c32452..3d175834a 100644 --- a/builds/unix/configure.raw +++ b/builds/unix/configure.raw @@ -299,6 +299,18 @@ AC_SUBST([XX_CFLAGS]) AC_SUBST([XX_ANSIFLAGS]) +# It is recommended that shared libraries hide symbols except those with +# explicit __attribute__((visibility("default"))). +# +AC_MSG_CHECKING([for -fvisibility=hidden compiler flag]) +orig_CFLAGS="${CFLAGS}" +CFLAGS="${CFLAGS} -fvisibility=hidden" +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])], + AC_MSG_RESULT(yes), + CFLAGS="${orig_CFLAGS}" + AC_MSG_RESULT(no)) + + # All library tests below try `pkg-config' first. If that fails, a function # from the library is tested in the traditional autoconf way (zlib, bzip2), # or a config script is called (libpng). diff --git a/builds/unix/ftconfig.in b/builds/unix/ftconfig.in index ca9058834..b9c21da2c 100644 --- a/builds/unix/ftconfig.in +++ b/builds/unix/ftconfig.in @@ -454,9 +454,9 @@ FT_BEGIN_HEADER #endif /* !FT_BASE_DEF */ - /* When compiling FreeType as a DLL, some systems/compilers need a */ - /* special attribute in front OR after the return type of function */ - /* declarations. */ + /* When compiling FreeType as a DLL or DSO with hidden visibility */ + /* some systems/compilers need a special attribute in front OR after */ + /* the return type of function declarations. */ /* */ /* Two macros are used within the FreeType source code to define */ /* exported library functions: FT_EXPORT and FT_EXPORT_DEF. */ @@ -487,21 +487,28 @@ FT_BEGIN_HEADER /* */ #ifndef FT_EXPORT -#ifdef __cplusplus +#ifdef FT2_BUILD_LIBRARY + +#if defined( _WIN32 ) && ( defined( _DLL ) || defined( DLL_EXPORT ) ) +#define FT_EXPORT( x ) __declspec( dllexport ) x +#elif defined( __GNUC__ ) && __GNUC__ >= 4 +#define FT_EXPORT( x ) __attribute__(( visibility( "default" ) )) x +#elif defined( __cplusplus ) #define FT_EXPORT( x ) extern "C" x #else #define FT_EXPORT( x ) extern x #endif -#ifdef _WIN32 -#if defined( FT2_BUILD_LIBRARY ) && \ - ( defined( _DLL ) || defined( DLL_EXPORT ) ) -#undef FT_EXPORT -#define FT_EXPORT( x ) __declspec( dllexport ) x -#elif defined( FT2_DLLIMPORT ) -#undef FT_EXPORT +#else + +#if defined( FT2_DLLIMPORT ) #define FT_EXPORT( x ) __declspec( dllimport ) x +#elif defined( __cplusplus ) +#define FT_EXPORT( x ) extern "C" x +#else +#define FT_EXPORT( x ) extern x #endif + #endif #endif /* !FT_EXPORT */ diff --git a/builds/vms/ftconfig.h b/builds/vms/ftconfig.h index d87ea69c3..021e2c651 100644 --- a/builds/vms/ftconfig.h +++ b/builds/vms/ftconfig.h @@ -406,9 +406,9 @@ FT_BEGIN_HEADER #endif /* !FT_BASE_DEF */ - /* When compiling FreeType as a DLL, some systems/compilers need a */ - /* special attribute in front OR after the return type of function */ - /* declarations. */ + /* When compiling FreeType as a DLL or DSO with hidden visibility */ + /* some systems/compilers need a special attribute in front OR after */ + /* the return type of function declarations. */ /* */ /* Two macros are used within the FreeType source code to define */ /* exported library functions: FT_EXPORT and FT_EXPORT_DEF. */ @@ -439,21 +439,28 @@ FT_BEGIN_HEADER /* */ #ifndef FT_EXPORT -#ifdef __cplusplus +#ifdef FT2_BUILD_LIBRARY + +#if defined( _WIN32 ) && ( defined( _DLL ) || defined( DLL_EXPORT ) ) +#define FT_EXPORT( x ) __declspec( dllexport ) x +#elif defined( __GNUC__ ) && __GNUC__ >= 4 +#define FT_EXPORT( x ) __attribute__(( visibility( "default" ) )) x +#elif defined( __cplusplus ) #define FT_EXPORT( x ) extern "C" x #else #define FT_EXPORT( x ) extern x #endif -#ifdef _WIN32 -#if defined( FT2_BUILD_LIBRARY ) && \ - ( defined( _DLL ) || defined( DLL_EXPORT ) ) -#undef FT_EXPORT -#define FT_EXPORT( x ) __declspec( dllexport ) x -#elif defined( FT2_DLLIMPORT ) -#undef FT_EXPORT +#else + +#if defined( FT2_DLLIMPORT ) #define FT_EXPORT( x ) __declspec( dllimport ) x +#elif defined( __cplusplus ) +#define FT_EXPORT( x ) extern "C" x +#else +#define FT_EXPORT( x ) extern x #endif + #endif #endif /* !FT_EXPORT */ diff --git a/include/freetype/config/ftconfig.h b/include/freetype/config/ftconfig.h index 8ff143ea3..eedebf408 100644 --- a/include/freetype/config/ftconfig.h +++ b/include/freetype/config/ftconfig.h @@ -422,9 +422,9 @@ FT_BEGIN_HEADER #endif /* !FT_BASE_DEF */ - /* When compiling FreeType as a DLL, some systems/compilers need a */ - /* special attribute in front OR after the return type of function */ - /* declarations. */ + /* When compiling FreeType as a DLL or DSO with hidden visibility */ + /* some systems/compilers need a special attribute in front OR after */ + /* the return type of function declarations. */ /* */ /* Two macros are used within the FreeType source code to define */ /* exported library functions: FT_EXPORT and FT_EXPORT_DEF. */ @@ -455,21 +455,28 @@ FT_BEGIN_HEADER /* */ #ifndef FT_EXPORT -#ifdef __cplusplus +#ifdef FT2_BUILD_LIBRARY + +#if defined( _WIN32 ) && ( defined( _DLL ) || defined( DLL_EXPORT ) ) +#define FT_EXPORT( x ) __declspec( dllexport ) x +#elif defined( __GNUC__ ) && __GNUC__ >= 4 +#define FT_EXPORT( x ) __attribute__(( visibility( "default" ) )) x +#elif defined( __cplusplus ) #define FT_EXPORT( x ) extern "C" x #else #define FT_EXPORT( x ) extern x #endif -#ifdef _WIN32 -#if defined( FT2_BUILD_LIBRARY ) && \ - ( defined( _DLL ) || defined( DLL_EXPORT ) ) -#undef FT_EXPORT -#define FT_EXPORT( x ) __declspec( dllexport ) x -#elif defined( FT2_DLLIMPORT ) -#undef FT_EXPORT +#else + +#if defined( FT2_DLLIMPORT ) #define FT_EXPORT( x ) __declspec( dllimport ) x +#elif defined( __cplusplus ) +#define FT_EXPORT( x ) extern "C" x +#else +#define FT_EXPORT( x ) extern x #endif + #endif #endif /* !FT_EXPORT */ From 4a03f17449ae45f0dacf4de4694ccd6e5e1b24d1 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Tue, 6 Feb 2018 02:23:19 +0100 Subject: [PATCH 422/470] [truetype] Integer overflow issues. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=6027 * src/truetype/ttinterp.c (Ins_MSIRP, Ins_MIAP, Ins_MIRP): Use SUB_LONG; avoid FT_ABS. --- ChangeLog | 11 +++++++++++ src/truetype/ttinterp.c | 40 +++++++++++++++++++++++++++++++++------- 2 files changed, 44 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 71fd567b5..5051fa425 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2018-02-06 Werner Lemberg + + [truetype] Integer overflow issues. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=6027 + + * src/truetype/ttinterp.c (Ins_MSIRP, Ins_MIAP, Ins_MIRP): Use + SUB_LONG; avoid FT_ABS. + 2018-02-04 Alexei Podtelezhnikov [unix] Use -fvisibility=hidden. diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c index 551f14a2e..5c8ff4f3d 100644 --- a/src/truetype/ttinterp.c +++ b/src/truetype/ttinterp.c @@ -5782,6 +5782,7 @@ FT_F26Dot6 distance; #ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY FT_F26Dot6 control_value_cutin = 0; + FT_F26Dot6 delta; if ( SUBPIXEL_HINTING_INFINALITY ) @@ -5817,11 +5818,15 @@ distance = PROJECT( exc->zp1.cur + point, exc->zp0.cur + exc->GS.rp0 ); #ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY + delta = SUB_LONG( distance, args[1] ); + if ( delta < 0 ) + delta = NEG_LONG( delta ); + /* subpixel hinting - make MSIRP respect CVT cut-in; */ - if ( SUBPIXEL_HINTING_INFINALITY && - exc->ignore_x_mode && - exc->GS.freeVector.x != 0 && - FT_ABS( SUB_LONG( distance, args[1] ) ) >= control_value_cutin ) + if ( SUBPIXEL_HINTING_INFINALITY && + exc->ignore_x_mode && + exc->GS.freeVector.x != 0 && + delta >= control_value_cutin ) distance = args[1]; #endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */ @@ -5978,7 +5983,14 @@ if ( ( exc->opcode & 1 ) != 0 ) /* rounding and control cut-in flag */ { - if ( FT_ABS( distance - org_dist ) > control_value_cutin ) + FT_F26Dot6 delta; + + + delta = SUB_LONG( distance, org_dist ); + if ( delta < 0 ) + delta = NEG_LONG( delta ); + + if ( delta > control_value_cutin ) distance = org_dist; #ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY @@ -6259,6 +6271,9 @@ if ( exc->GS.gep0 == exc->GS.gep1 ) { + FT_F26Dot6 delta; + + /* XXX: According to Greg Hitchcock, the following wording is */ /* the right one: */ /* */ @@ -6271,7 +6286,11 @@ /* `ttinst2.doc', version 1.66, is thus incorrect since */ /* it implies `>=' instead of `>'. */ - if ( FT_ABS( cvt_dist - org_dist ) > control_value_cutin ) + delta = SUB_LONG( cvt_dist, org_dist ); + if ( delta < 0 ) + delta = NEG_LONG( delta ); + + if ( delta > control_value_cutin ) cvt_dist = org_dist; } @@ -6289,7 +6308,14 @@ exc->ignore_x_mode && exc->GS.gep0 == exc->GS.gep1 ) { - if ( FT_ABS( cvt_dist - org_dist ) > control_value_cutin ) + FT_F26Dot6 delta; + + + delta = SUB_LONG( cvt_dist, org_dist ); + if ( delta < 0 ) + delta = NEG_LONG( delta ); + + if ( delta > control_value_cutin ) cvt_dist = org_dist; } #endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */ From 63aaf89cecd752853b07a043e2a9db6a7686d558 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sat, 17 Feb 2018 10:34:47 +0100 Subject: [PATCH 423/470] s/sub-pixel/subpixel/. --- ChangeLog.21 | 2 +- ChangeLog.24 | 2 +- docs/CHANGES | 10 +++++----- include/freetype/freetype.h | 6 +++--- include/freetype/ftdriver.h | 4 ++-- include/freetype/ftpfr.h | 6 +++--- src/autofit/aftypes.h | 6 +++--- src/smooth/ftgrays.c | 2 +- src/truetype/ttgload.c | 2 +- 9 files changed, 20 insertions(+), 20 deletions(-) diff --git a/ChangeLog.21 b/ChangeLog.21 index 01883f111..1adc81783 100644 --- a/ChangeLog.21 +++ b/ChangeLog.21 @@ -6995,7 +6995,7 @@ 2002-09-08 David Turner - Various updates to correctly support sub-pixel rendering. + Various updates to correctly support subpixel rendering. * include/freetype/config/ftmodule.h: Add two renderers for LCD. diff --git a/ChangeLog.24 b/ChangeLog.24 index 7661aee19..44abc4060 100644 --- a/ChangeLog.24 +++ b/ChangeLog.24 @@ -744,7 +744,7 @@ 2013-01-16 David 'Digit' Turner - [truetype] Improve sub-pixel code. + [truetype] Improve subpixel code. This patches fixes many issues with the ttsubpix implementation. diff --git a/docs/CHANGES b/docs/CHANGES index 9901e1094..ce41a20b7 100644 --- a/docs/CHANGES +++ b/docs/CHANGES @@ -286,7 +286,7 @@ CHANGES BETWEEN 2.7.1 and 2.8 - FT_LOAD_TARGET_LCD is now a variant of FT_LOAD_TARGET_LIGHT; this should provide better rendering results. - - A mode to display light auto-hinting with sub-pixel positioning + - A mode to display light auto-hinting with subpixel positioning has been added to `ftdiff'. @@ -616,8 +616,8 @@ CHANGES BETWEEN 2.6.1 and 2.6.2 - The smooth renderer has been made faster. - - The `ftstring' demo program now supports sub-pixel rendering; - use key `l' to cycle through the LCD modes. + - The `ftstring' demo program now supports subpixel rendering; use + key `l' to cycle through the LCD modes. - The `ftstring' demo program now supports colour rendering; use the `space' key to cycle through various colour combinations. @@ -3055,12 +3055,12 @@ CHANGES BETWEEN 2.1.3 and 2.1.2 FT_LOAD_TARGET_MONO :: Hint and render for 1-bit displays. FT_LOAD_TARGET_LCD :: Hint and render for horizontal RGB or - BGR sub-pixel displays (like LCD + BGR subpixel displays (like LCD screens). THIS IS STILL EXPERIMENTAL! FT_LOAD_TARGET_LCD_V :: Same as FT_LOAD_TARGET_LCD, for - vertical sub-pixel displays (like + vertical subpixel displays (like rotated LCD screens). THIS IS STILL EXPERIMENTAL! diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h index eda95e2ab..449172949 100644 --- a/include/freetype/freetype.h +++ b/include/freetype/freetype.h @@ -3065,7 +3065,7 @@ FT_BEGIN_HEADER * * Advance widths are rounded to integer values; however, using the * `lsb_delta' and `rsb_delta' fields of @FT_GlyphSlotRec, it is - * possible to get fractional advance widths for sub-pixel positioning + * possible to get fractional advance widths for subpixel positioning * (which is recommended to use). * * If configuration option AF_CONFIG_OPTION_TT_SIZE_METRICS is active, @@ -3204,13 +3204,13 @@ FT_BEGIN_HEADER /* opacity). */ /* */ /* FT_RENDER_MODE_LCD :: */ - /* This mode corresponds to horizontal RGB and BGR sub-pixel */ + /* This mode corresponds to horizontal RGB and BGR subpixel */ /* displays like LCD screens. It produces 8-bit bitmaps that are */ /* 3~times the width of the original glyph outline in pixels, and */ /* which use the @FT_PIXEL_MODE_LCD mode. */ /* */ /* FT_RENDER_MODE_LCD_V :: */ - /* This mode corresponds to vertical RGB and BGR sub-pixel displays */ + /* This mode corresponds to vertical RGB and BGR subpixel displays */ /* (like PDA screens, rotated LCD displays, etc.). It produces */ /* 8-bit bitmaps that are 3~times the height of the original */ /* glyph outline in pixels and use the @FT_PIXEL_MODE_LCD_V mode. */ diff --git a/include/freetype/ftdriver.h b/include/freetype/ftdriver.h index 02d104dc3..e90475b2a 100644 --- a/include/freetype/ftdriver.h +++ b/include/freetype/ftdriver.h @@ -111,9 +111,9 @@ FT_BEGIN_HEADER * * One of the reasons to not hint horizontally is antialiasing for LCD * screens: The pixel geometry of modern displays supplies three - * vertical sub-pixels as the eye moves horizontally across each visible + * vertical subpixels as the eye moves horizontally across each visible * pixel. On devices where we can be certain this characteristic is - * present a rasterizer can take advantage of the sub-pixels to add + * present a rasterizer can take advantage of the subpixels to add * increments of weight. In Western writing systems this turns out to * be the more critical direction anyway; the weights and spacing of * vertical stems (see above) are central to Armenian, Cyrillic, Greek, diff --git a/include/freetype/ftpfr.h b/include/freetype/ftpfr.h index ce60eb4a8..a69cc482d 100644 --- a/include/freetype/ftpfr.h +++ b/include/freetype/ftpfr.h @@ -71,7 +71,7 @@ FT_BEGIN_HEADER * * ametrics_x_scale :: * A 16.16 fixed-point number used to scale distance expressed - * in metrics units to device sub-pixels. This is equivalent to + * in metrics units to device subpixels. This is equivalent to * `face->size->x_scale', but for metrics only. Optional (parameter * can be NULL). * @@ -123,7 +123,7 @@ FT_BEGIN_HEADER * mode, which always returns distances converted to outline units. * * You can use the value of the `x_scale' and `y_scale' parameters - * returned by @FT_Get_PFR_Metrics to scale these to device sub-pixels. + * returned by @FT_Get_PFR_Metrics to scale these to device subpixels. */ FT_EXPORT( FT_Error ) FT_Get_PFR_Kerning( FT_Face face, @@ -154,7 +154,7 @@ FT_BEGIN_HEADER * * @note: * You can use the `x_scale' or `y_scale' results of @FT_Get_PFR_Metrics - * to convert the advance to device sub-pixels (i.e., 1/64th of pixels). + * to convert the advance to device subpixels (i.e., 1/64th of pixels). */ FT_EXPORT( FT_Error ) FT_Get_PFR_Advance( FT_Face face, diff --git a/src/autofit/aftypes.h b/src/autofit/aftypes.h index a50013439..6bd8c895b 100644 --- a/src/autofit/aftypes.h +++ b/src/autofit/aftypes.h @@ -76,9 +76,9 @@ extern void* _af_debug_hints; typedef struct AF_WidthRec_ { - FT_Pos org; /* original position/width in font units */ - FT_Pos cur; /* current/scaled position/width in device sub-pixels */ - FT_Pos fit; /* current/fitted position/width in device sub-pixels */ + FT_Pos org; /* original position/width in font units */ + FT_Pos cur; /* current/scaled position/width in device subpixels */ + FT_Pos fit; /* current/fitted position/width in device subpixels */ } AF_WidthRec, *AF_Width; diff --git a/src/smooth/ftgrays.c b/src/smooth/ftgrays.c index 6ce6f8644..803a19e41 100644 --- a/src/smooth/ftgrays.c +++ b/src/smooth/ftgrays.c @@ -404,7 +404,7 @@ typedef ptrdiff_t FT_PtrDist; /* need to define them to "float" or "double" when experimenting with */ /* new algorithms */ - typedef long TPos; /* sub-pixel coordinate */ + typedef long TPos; /* subpixel coordinate */ typedef int TCoord; /* integer scanline/pixel coordinate */ typedef int TArea; /* cell areas, coordinate products */ diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c index 32ed34aba..df120fc09 100644 --- a/src/truetype/ttgload.c +++ b/src/truetype/ttgload.c @@ -1219,7 +1219,7 @@ * Theoretically, a glyph's bytecode can toggle ClearType's * `backward compatibility' mode, which would allow modification * of the advance width. In reality, however, applications - * neither allow nor expect modified advance widths if sub-pixel + * neither allow nor expect modified advance widths if subpixel * rendering is active. * */ From 9fbd0041ca1e3cd96ebd9e3ee1cf8797251198ed Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sat, 17 Feb 2018 10:37:10 +0100 Subject: [PATCH 424/470] Split off ChangeLog.28. --- ChangeLog | 3121 +------------------------------------------------ ChangeLog.28 | 3136 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 3137 insertions(+), 3120 deletions(-) create mode 100644 ChangeLog.28 diff --git a/ChangeLog b/ChangeLog index 5051fa425..e060cbdf7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1951,3129 +1951,10 @@ * build/windows/vc2010/freetype.vcxproj: Use MaxSpeed (/02) optimization for Release configuration throughout the project. -2017-09-16 Werner Lemberg - - * Version 2.8.1 released. - ========================= - - - Tag sources with `VER-2-8-1'. - - * docs/VERSION.TXT: Add entry for version 2.8.1. - * docs/CHANGES: Updated. - - * README, Jamfile (RefDoc), builds/windows/vc2005/freetype.vcproj, - builds/windows/vc2005/index.html, - builds/windows/vc2008/freetype.vcproj, - builds/windows/vc2008/index.html, - builds/windows/vc2010/freetype.vcxproj, - builds/windows/vc2010/index.html, - builds/windows/visualc/freetype.dsp, - builds/windows/visualc/freetype.vcproj, - builds/windows/visualc/index.html, - builds/windows/visualce/freetype.dsp, - builds/windows/visualce/freetype.vcproj, - builds/windows/visualce/index.html, - builds/wince/vc2005-ce/freetype.vcproj, - builds/wince/vc2005-ce/index.html, - builds/wince/vc2008-ce/freetype.vcproj, - builds/wince/vc2008-ce/index.html: s/2.8/2.8.1/, s/28/281/. - - * include/freetype/freetype.h (FREETYPE_PATCH): Set to 1. - - * builds/unix/configure.raw (version_info): Set to 21:0:15. - * CMakeLists.txt (VERSION_PATCH): Set to 1. - -2017-09-13 suzuki toshiya - - [sfnt] lowest gcc for vectors (e1d0249e) is changed to 4.7. - - __builtin_shuffle() was introduced in gcc-4.7. The lowest - gcc to enable vector operation is delayed from 4.6 to 4.7. - - * src/sfnt/pngshim.c (premultiply_data): Fix cpp-macro to - enable the vector operation, to change the lowest gcc version - from 4.6 to 4.7. - -2017-09-13 suzuki toshiya - - [cache] Fix a possible overflow by signed integer comparison. - - Improve the code by 5d3ff05615dda6d1325ed612381a17a0df04c975 , - issues are found by Behdad Esfahbod and Werner Lemberg. - - * src/cache/ftcbasic.c (FTC_ImageCache_Lookup): Replace - a subtraction to check higher bit by a bit operation, - and cpp-conditionalize for appropriate systems. Add better - documentation to the comment. - (FTC_ImageCache_LookupScaler): Ditto. - (FTC_SBitCache_Lookup): Ditto. - (FTC_SBitCache_LookupScaler): Ditto. - -2017-09-13 Werner Lemberg - - [autofit] Really fix #41334 (#52000). - - * src/autofit/aflatin.c (af_latin_hints_compute_segments): Set - `segment->delta' everywhere. - -2017-09-12 suzuki toshiya - - [autofit, sfnt] Fix for `make multi'. - - * src/autofit/afshaper.c: Include FT_ADVANCE_H, to use - FT_Get_Advance() in it. - * src/sfnt/ttcmap.c: Include FT_SERVICE_POSTSCRIPT_CMAPS_H - to use PS_Unicodes in it, also include `ttpost.h' to use - tt_face_get_ps_name() in it. - -2017-09-11 Azzuro - - [build] Improve builds with different MS Visual Studio versions. - - * builds/windows/vc2010/freetype.vcxproj: Switch platform toolset - according to the Visual Studio version. - -2017-09-11 Werner Lemberg - - * src/sfnt/ttkern.c (tt_face_load_kern): Reject format 2 tables. - - Reported by Behdad. - -2017-09-09 Werner Lemberg - - [autofit] Improve communication with ftgrid. - - * src/autofit/afhints.c (af_glyph_hints_get_segment_offset): - Provide values in font units. - -2017-09-08 suzuki toshiya - - [base] Remove a check for resource ID in the resource fork driver. - - LastResort.dfont has a marginal resource ID 0xFFFF for sfnt - resource. Inside Macintosh: More Macintosh Toolbox, `Resource IDs' - (1-46), tells that some IDs are reserved and should not be used. - FreeType2 just uses resource ID to sort the fragmented resource. - To accept the marginal fonts, the checking is removed. - - * src/base/ftrfork.c (FT_Raccess_Get_DataOffsets): Remove res_id - validity check, fix a trace message format. - -2017-09-08 suzuki toshiya - - [sfnt, truetype] Register the tags for marginal fonts. - - The first 32bit of standard TrueType variants is 0x00010000, - `OTTO', `ttcf', `true' or `typ1'. 2 marginal dfonts on legacy Mac - OS X, Keyboard.dfont and LastResort.dfont, have the sfnt resources - starting 0xA5 followed by `kbd' or `lst'. Considering the following - data could be parsed as conventional TrueType fonts, the header - checking is updated to allow these tags. It seems that recent Mac - OS X has already switched to normal TTF for these fonts. - - See the discussion at - http://u88.n24.queensu.ca/exiftool/forum/index.php?topic=3931.0 - - * include/freetype/tttags.h (TTAG_0xA5kbd, TTAG_0xA5lst): New header - tags for Keyboard.dfont and LastResort.dfont. - * src/sfnt/sfobjs.c (sfnt_open_font): Accept the sfnt resource - starts with TTAG_0xA5kbd or TTAG_0xA5lst. - * src/truetype/ttobjs.c (tt_face_init): Accept the face with the - format tag is TTAG_0xA5kbd or TTAG_0xA5lst. - -2017-09-05 Werner Lemberg - - Fix multiple calls of `FT_Bitmap_Convert'. - - The documentation of `FT_Bitmap_Convert' says that multiple calls do - proper reallocation of the target FT_Bitmap object. However, this - failed for the sequence - - non-empty bitmap - empty bitmap - non-empty bitmap - - Reason was that `FT_Bitmap_Convert' only reallocated the bitmap - buffer if it became too small; it didn't make the buffer smaller. - For an empty bitmap following a non-empty one, only the buffer - dimension got set to zero, without deallocation. If the next call - was a non-empty buffer again, an assertion in `ft_mem_qrealloc' was - triggered. - - * src/base/ftbitmap.c (FT_Bitmap_Convert): Always reallocate target - buffer to the correct size. - - * docs/CHANGES: Document it. - -2017-09-05 Werner Lemberg - - [bdf] Fix size and resolution handling. - - * src/bdf/bdfdrivr.c (BDF_Face_Init): Use `SIZE' values if - `POINT_SIZE', `RESOLUTION_X', or `RESOLUTION_Y' properties are - missing. - - * docs/CHANGES: Document it. - -2017-08-25 Alexei Podtelezhnikov - - Swap `ALLOC_MULT' arguments (#51833). - - * src/base/ftbitmap.c (ft_bitmap_assure_buffer): Updated. - * src/winfonts/winfnt.c (FNT_Load_Glyph): Updated. - * src/raster/ftrend1.c (ft_raster1_render): Updated. - -2017-08-23 Werner Lemberg - - [sfnt] Fix clang compilation (#51788). - - * src/sfnt/pngshim.c (premultiply_data): Use vectors instead of - scalars. - (vector_shuffle): New macro to take care of a different built-in - function name on clang. - -2017-08-22 Werner Lemberg - - [base] Don't zero out allocated memory twice (#51816). - - Patch applied from bug report. - - * src/base/ftutil.c (ft_mem_qrealloc): Use low-level allocation to - avoid unnecessary overhead. - -2017-08-22 Werner Lemberg - - [truetype] Integer overflow. - - Changes triggered by - - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3107 - - * src/truetype/ttinterp.c (Ins_MDRP, Ins_MIRP, Ins_ALIGNPTS): Use - NEG_LONG. - -2017-08-17 Alexei Podtelezhnikov - - [sfnt] Avoid synthetic unicode for symbol fonts with PUA. - - Reported as - - https://bugs.chromium.org/p/chromium/issues/detail?id=754574 - - * src/sfnt/sfobjs.c (sfnt_load_face): Check for FT_ENCODING_MS_SYMBOL. - -2017-08-16 Werner Lemberg - - * src/sfnt/pngshim.c (premultiply_data): Fix compiler warnings. - -2017-08-15 Behdad Esfahbod - - [sfnt] Speed up PNG image loading. - - This reduces the overhead of `premultiply_data' by 60%. - - * src/sfnt/pngshim.c (premultiply_data): Provide code which uses - gcc's (and clang's) `vector_byte' attribute to process 4 pixels at a - time. - -2017-08-11 Werner Lemberg - - [sfnt, truetype] Improve handling of missing sbits. - - Requested by Behdad. - - Modern bitmap-only SFNTs like `NotoColorEmoji.ttf' don't contain - entries in the bitmap strike(s) for empty glyphs. Instead, they - rely that a space glyph gets created from the font's metrics data. - This commit makes FreeType behave accordingly. - - * include/freetype/fterrdef.h (FT_Err_Missing_Bitmap): New error - code. - - * src/sfnt/ttsbit.c (tt_sbit_decoder_load_image): Change error codes - to make a distinction between a missing bitmap in a composite and a - simple missing bitmap. - - * src/truetype/ttgload.c (TT_Load_Glyph): For a missing bitmap (in a - bitmap-only font), synthesize an empty bitmap glyph if metrics are - available. - -2017-08-10 Werner Lemberg - - [base] Minor API improvement for default variation axis setting. - - * src/base/ftmm.c (FT_Set_MM_Design_Coordinates, - FT_Set_Var_Design_Coordinates, FT_Set_MM_Blend_Coordinates, - FT_Set_Var_Blend_Coordinates): Allow coords==NULL if num_coords==0. - - * docs/CHANGES: Updated. - -2017-08-08 Werner Lemberg - - [psnames] Really fix issue #49949. - - We now use a separate preprocessor macro to handle both definition - and declaration of the glyph name arrays. - - * src/psnames/psmodule.c (DEFINE_PS_TABLE_DATA): New macro. - - * src/tools/glnames.py (StringTable::dump, - StringTable::dump_sublist): Use `DEFINE_PS_TABLE_DATA'. - (dump_encoding): Ditto. - (main): Use `wb' mode for writing the output file, which works on - Windows also. - - * src/psnames/pstables.h: Regenerated. - -2017-08-08 Alexei Podtelezhnikov - - [smooth] Harmony LCD rendering. - - This is a new technology for LCD-optimized rendering. It capitalizes - on the fact that each color channel grid is shifted by a third of a - pixel. Therefore it is logical to render 3 separate monochrome - bitmaps shifting the outline by 1/3 pixel, and then combine them. - Importantly, the resulting output does not require additional LCD - filtering. - - * src/smooth/ftsmooth.c (ft_smooth_render_generic) - [!FT_CONFIG_OPTION_SUBPIXEL_RENDERING]: Implement new LCD-optimized - rendering. - - * include/freetype/ftlcdfil.h, include/freetype/freetype.h, - include/freetype/config/ftoption.h, devel/ftoption.h: Updated - documentation. - -2017-08-08 Alexei Podtelezhnikov - - * src/smooth/ftsmooth.c (ft_smooth_render_generic): Clean up. - -2017-08-08 Alexei Podtelezhnikov - - * src/sfnt/ttpost.c (format): Use otspec-compliant versions. - -2017-08-05 Werner Lemberg - - [truetype] Integer overflow. - - Reported as - - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2868 - - * src/truetype/ttinterp.c (Ins_ALIGNRP): Use NEG_LONG. - -2017-08-05 Werner Lemberg - - [base, truetype] New function `FT_Get_Var_Axis_Flags'. - - The reserved `flags' field got a value in OpenType version 1.8.2; - unfortunately, the public `FT_Var_Axis' structure misses the - corresponding element. Since we can't add a new field, we add an - access function. - - * src/base/ftmm.c (FT_Get_Var_Axis_Flags): New function. - - * include/freetype/ftmm.h (FT_VAR_AXIS_FLAG_HIDDEN): New macro. - Updated. - - * src/truetype/ttgxvar.c (TT_Get_MM_Var): Increase allocated memory - of `mmvar' to hold axis flags. - Fill the axis flags array. - - * docs/CHANGES: Updated. - -2017-08-03 Nikolaus Waxweiler - - [truetype] Fix metrics of B/W hinting in v40 mode. - - Phantom points are now saved outside v40 backwards compatibility - mode. This fixes the jumping glyphs when switching between v35 and - v40 monochrome mode. - - * src/truetype/ttgload.c (TT_Hint_Glyph): Fix inversed bool logic. - -2017-08-03 Nikolaus Waxweiler - - [truetype] Do not set any ClearType flags in v40 monochrome mode. - - This fixes weird behavior of instructions that resulted in rendering - differences between v35 and v40 in monochrome mode, e.g., in - `timesbi.ttf'. - - * src/truetype/ttinterp.c (Ins_GETINFO) - [TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL]: Check - `subpixel_hinting_lean'. - -2017-08-01 Werner Lemberg - - * src/truetype/ttgxvar.c (TT_Get_MM_Var): Fix thinko. - -2017-08-01 Behdad Esfahbod - - [truetype] Fix loading of named instances. - - * src/truetype/ttgxvar.c (TT_Get_MM_Var): Preserve file position - while loading the `avar' table. - -2017-08-01 Werner Lemberg - - [sfnt, truetype] Minor adjustments for OpenType 1.8.2. - - * src/sfnt/sfobjs.c (sfnt_load_face): The units per EM value has now - (tighter) limits. - - * src/truetype/ttgload.c (load_truetype_glyph): The new OpenType - version explicitly allows all negative values for the number of - contours if we have a composite glyph (this is for better backwards - compatibility I guess), but it still recommends value -1. - -2017-07-26 Werner Lemberg - - [cff] Integer overflow. - - Reported as - - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2738 - - * src/cff/cf2hints.c (cf2_glyphpath_computeOffset, - cf2_glyphpath_curveTo): Use ADD_INT32. - -2017-07-13 Werner Lemberg - - [base] Fix memory leak. - - Reported as - - https://bugs.chromium.org/p/chromium/issues/detail?id=738362 - - * src/base/ftglyph.c (FT_Get_Glyph): Do proper deallocation in case - of error. - -2017-07-12 Werner Lemberg - - [base] Integer overflow. - - Reported as - - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2573 - - * src/base/ftobjs.c (ft_glyphslot_grid_fit_metrics): Use - FT_PIX_CEIL_LONG and FT_PIX_ROUND_LONG. - -2017-07-12 Werner Lemberg - - * src/truetype/ttpload.c (tt_face_get_location): Off-by-one typo. - - Also improve tracing message. - - Problem reported as - - https://bugs.chromium.org/p/chromium/issues/detail?id=738919 - -2017-07-07 Werner Lemberg - - [cff] Integer overflow. - - Reported as - - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2517 - - * src/cff/cf2blues.c (cf2_blues_capture): Use SUB_INT32. - -2017-07-05 Werner Lemberg - - * src/sfnt/ttcmap.c (tt_cmap_unicode_class_rec): Fix warning. - -2017-07-05 Werner Lemberg - - * src/truetype/ttgxvar.c (FT_Stream_SeekSet): Fix warning (#51395). - -2017-07-04 Werner Lemberg - - [truetype] Prevent address overflow (#51365). - - * src/truetype/ttgxvar.c (FT_Stream_SeekSet): Add guard. - -2017-07-03 Alexei Podtelezhnikov - - * src/base/ftlcdfil.c (ft_lcd_filter_fir): Improve code. - -2017-07-03 Werner Lemberg - - [truetype] Integer overflow. - - Reported as - - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2455 - - * src/truetype/ttinterp.c (Ins_SCFS): Use SUB_LONG. - -2017-07-01 Alexei Podtelezhnikov - - * src/sfnt/sfobjs.c (sfnt_load_face): Ignore No_Unicode_Glyph_Name. - -2017-06-28 Ben Wagner - - Avoid Microsoft compiler warnings (#51331). - - While clang's sanitizer recommends a cast to unsigned for safe - negation (to handle -INT_MIN), both MSVC and Visualc emit warning - C4146 if an unsigned value gets negated. - - * include/freetype/internal/ftcalc.h (NEG_LONG, NEG_INT32), - src/base/ftcalc.c (FT_MOVE_SIGN): Replace negation with a - subtraction. - -2017-06-27 Werner Lemberg - - * src/cff/cffparse.c (do_fixed): Fix typo. - - Spotted by chris . - -2017-06-27 Werner Lemberg - - [truetype] Integer overflows. - - Reported as - - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2384 - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2391 - - * src/base/ftcalc.c (FT_MulDiv, FT_MulDiv_No_Round, FT_DivFix): Use - NEG_LONG. - - * src/truetype/ttinterp.c (Ins_SxVTL): Use NEG_LONG. - -2017-06-24 Werner Lemberg - - [truetype] Integer overflows. - - Reported as - - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2364 - - * src/truetype/ttinterp.c (Ins_ISECT): Use NEG_LONG. - -2017-06-22 Werner Lemberg - - [cff, truetype] Integer overflows. - - Reported as - - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2323 - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2328 - - * src/cff/cf2blues.c (cf2_blues_capture): Use ADD_INT32 and - SUB_INT32. - - * src/truetype/ttinterp.c (Ins_SDPVTL): Use SUB_LONG and NEG_LONG. - -2017-06-21 Alexei Podtelezhnikov - - [sfnt] Synthesize a Unicode charmap if one is missing. - - * src/sfnt/ttcmap.h (tt_cmap_unicode_class_rec): Declare it. - * src/sfnt/ttcmap.c (tt_get_glyph_name, tt_cmap_unicode_init, - tt_cmap_unicode_done, tt_cmap_unicode_char_index, - tt_cmap_unicode_char_next, tt_cmap_unicode_class_rec): Implement - synthetic Unicode charmap class. - (tt_get_cmap_info): Make sure the callback is available. - - * src/sfnt/sfobjs.c (sfnt_load_face) - [FT_CONFIG_OPTION_POSTSCRIPT_NAMES]: If Unicode charmap is missing, - synthesize one. - - * include/freetype/config/ftoption.h: Document it. - * devel/ftoption.h: Ditto. - -2017-06-20 Tony Theodore - - Fix pkg-config in freetype-config for cross-compiling (#51274). - - * builds/unix/unix-def.in (PKG_CONFIG): New variable. - (freetype-config): Use it in sed expression. - - * builds/unix/freetype-config.in: s/pkg-config/%PKG_CONFIG%/. - -2017-06-20 Werner Lemberg - - [cff, truetype] Integer overflows. - - Reported as - - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2300 - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2313 - - * src/cff/cf2hints.c (cf2_hintmap_adjustHints): Use ADD_INT32. - - * src/truetype/ttinterp.c (Ins_ABS): Avoid FT_ABS. - -2017-06-17 Alexei Podtelezhnikov - - [base, smooth] LCD filtering cleanups. - - * src/base/ftlcdfil.c (ft_lcd_filter_fir, _ft_lcd_filter_legacy): - Clean up, start filtering from the bottom-left origin. - - * src/smooth/ftsmooth.c (ft_smooth_render_generic): Updated. - -2017-06-16 Werner Lemberg - - [truetype] Integer overflows. - - Reported as - - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2270 - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2276 - - * src/truetype/ttinterp.c (Ins_MDRP, _iup_worker_interpolate): Use - ADD_LONG and SUB_LONG. - -2017-06-15 Werner Lemberg - - [bdf, cff] Integer overflows. - - Reported as - - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2244 - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2261 - - * src/bdf/bdfdrivr.c (BDF_Face_Init): Replace calls to FT_ABS with - direct code to avoid value negation. - - * src/cff/cf2blues.c (cf2_blues_capture): Use SUB_INT32 and - ADD_INT32. - -2017-06-13 Werner Lemberg - - * src/winfonts/winfnt.c (FNT_Face_Init): Don't set active encoding. - - FreeType only sets a default active encoding for Unicode. - -2017-06-13 Werner Lemberg - - [cff, truetype] Integer overflows. - - Reported as - - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2216 - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2218 - - * src/cff/cf2fixed.h (cf2_fixedAbs): Use NEG_INT32. - - * src/truetype/ttinterp.c (Ins_IP): Use SUB_LONG. - -2017-06-11 Werner Lemberg - - [cff] Integer overflows. - - Reported as - - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2200 - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2210 - - * src/cff/cf2hints.c (cf2_hintmap_insertHint): Use SUB_INT32 and - ADD_INT32. - - * src/cff/cf2intrp.c (cf2_interpT2CharString) : Use - ADD_INT32. - -2017-06-10 Werner Lemberg - - [truetype] Fix TT_Set_Var_Design. - - Reported by Nikolaus Waxweiler . - - * src/truetype/ttgxvar.c (TT_Set_Var_Design): Correctly handle the - case where we have less input coordinates than axes. - -2017-06-10 Werner Lemberg - - * src/base/ftcalc.c (FT_DivFix): Fix embarrassing typo. - - Bug introduced 2017-05-28. - -2017-06-09 Werner Lemberg - - [cff, truetype] Integer overflows. - - Reported as - - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2144 - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2151 - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2153 - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2173 - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2186 - - * src/cff/cf2blues.c (cf2_blues_init): Use SUB_INT32. - - * src/truetype/ttinterp.c (Round_None, Round_To_Grid, - Round_To_Half_Grid, Round_Down_To_Grid, Round_Up_To_Grid, - Round_To_Double_Grid, Round_Super, Round_Super_45): Use ADD_LONG, - SUB_LONG, NEG_LONG, FT_PIX_ROUND_LONG, FT_PIX_CEIL_LONG, - FT_PAD_ROUND_LONG - (Ins_SxVTL, Ins_MIRP): Use SUB_LONG. - (_iup_worker_shift): Use SUB_LONG and ADD_LONG. - -2017-06-09 Werner Lemberg - - Provide more macros for flooring, ceiling, and rounding. - - These versions don't produce run-time errors due to integer - overflow. - - * include/freetype/internal/ftobjs.h: Include FT_INTERNAL_CALC_H. - (FT_PAD_ROUND_LONG, FT_PAD_CEIL_LONG, FT_PIX_ROUND_LONG, - FT_PIX_CEIL_LONG): New macros. - (FT_PAD_ROUND_INT32, FT_PAD_CEIL_INT32, FT_PIX_ROUND_INT32, - FT_PIX_CEIL_INT32): New macros. - -2017-06-09 Werner Lemberg - - Remove unused macros. - - * include/freetype/internal/ftcalc.h (ADD_INT, SUB_INT, MUL_INT, - NEG_INT): Deleted. - -2017-06-09 Werner Lemberg - - */*: Remove `OVERFLOW_' prefix. - - This increases readability. - -2017-06-07 Werner Lemberg - - [cff, truetype] Integer overflows. - - Reported as - - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2133 - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2137 - - * src/cff/cf2hints.c (cf2_hint_init): Use OVERFLOW_SUB_INT32. - - * src/truetype/ttinterp.c (PROJECT, DUALPROJ): Use - OVERFLOW_SUB_LONG. - -2017-06-06 Werner Lemberg - - [cff] Integer overflows. - - Reported as - - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2109 - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2110 - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2122 - - * src/cff/cf2blues.c (cf2_blues_init): Use OVERFLOW_SUB_INT32. - - * src/cff/cf2hints.c (cf2_hintmap_map): Synchronize if-else - branches. - -2017-06-05 Werner Lemberg - - [cff] Integer overflow. - - Reported as - - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2089 - - * src/cff/cffload.c (cff_blend_doBlend): User OVERFLOW_ADD_INT32. - -2017-06-04 Werner Lemberg - - [cff, truetype] Integer overflows. - - Reported as - - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2075 - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2088 - - * src/cff/cf2font.c (cf2_font_setup): Use OVERFLOW_MUL_INT32. - - * src/truetype/ttinterp.c (Ins_ISECT): Use OVERFLOW_MUL_LONG, - OVERFLOW_ADD_LONG, and OVERFLOW_SUB_LONG. - -2017-06-03 Werner Lemberg - - [base, cff, truetype] Integer overflows. - - Reported as - - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2060 - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2062 - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2063 - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2068 - - * src/base/ftobjs.c (ft_glyphslot_grid_fit_metrics): Use - OVERFLOW_ADD_LONG and OVERFLOW_SUB_LONG. - - * src/cff/cf2blues.c (cf2_blues_capture), src/cff/cf2hints.c - (cf2_hintmap_adjustHints): Use OVERFLOW_SUB_INT32. - - * src/truetype/ttgload.c (compute_glyph_metrics): User - OVERFLOW_SUB_LONG. - - * src/truetype/ttinterp.c (Direct_Move, Direct_Move_Orig, - Direct_Move_X, Direct_Move_Y, Direct_Move_Orig_X, - Direct_Move_Orig_Y, Move_Zp2_Point, Ins_MSIRP): Use - OVERFLOW_ADD_LONG and OVERFLOW_SUB_LONG. - -2017-06-03 Werner Lemberg - - * builds/unix/freetype-config.in: Fix pkg-config test (#51162). - - Patch directly taken from bug report. - -2017-06-03 Werner Lemberg - - [bdf] Synchronize sanity checks with pcf driver. - - Reported as - - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2054 - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2058 - - * src/bdf/bdfdrivr.c (BDF_Face_Init): Check font ascent and descent. - Check AVERAGE_WIDTH, POINT_SIZE, PIXEL_SIZE, RESOLUTION_X, and - RESOLUTION_Y properties. - -2017-06-03 Werner Lemberg - - [cff, truetype] Integer overflows. - - Reported as - - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2047 - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2057 - - * src/cff/cf2hints.c (cf2_hintmap_map): Use OVERFLOW_SUB_INT32. - - * src/truetype/ttinterp.c (Ins_ADD): Use OVERFLOW_ADD_LONG. - (Ins_SUB): Use OVERFLOW_SUB_LONG. - (Ins_NEG): Use NEG_LONG. - -2017-06-03 Werner Lemberg - - ftcalc.h: Avoid left-shift of negative numbers. - - Reported as - - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2055 - - * include/freetype/internal/ftcalc.h (INT_TO_F26DOT6, - INT_TO_F2DOT14, INT_TO_FIXED, F2DOT14_TO_FIXED): Use multiplication. - -2017-06-02 Werner Lemberg - - [cff] Even more integer overflows. - - Reported as - - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2046 - - * src/cff/cf2intrp.c (cf2_doStems, cf2_interpT2CharString): Use - OVERFLOW_ADD_INT32. - -2017-06-02 Werner Lemberg - - [cff] More integer overflows. - - Reported as - - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2032 - - * src/cff/cf2blues.c (cf2_blues_init): Use OVERFLOW_SUB_INT32. - -2017-06-02 Werner Lemberg - - [bdf] Don't left-shift negative numbers. - - Reported as - - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2031 - - * src/bdf/bdfdrivr.c (BDF_Face_Init): Use multiplication. - -2017-06-02 Werner Lemberg - - [bdf] Fix integer scanning routines. - - Reported as - - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2029 - - * src/bdf/bdflib.c (_bdf_atoul, _bdf_atol, _bdf_atous, _bdf_atos): - Stop scanning if result would overflow. - -2017-06-02 Werner Lemberg - - [cff] Fix integer overflows. - - Reported as - - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2027 - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2028 - - * src/cff/cf2hints.c (cf2_hintmap_insertHint), src/cff/cf2intrp.c - (cf2_doFlex): Use OVERFLOW_ADD_INT32 and OVERFLOW_SUB_INT32. - -2017-06-01 Werner Lemberg - - [smooth] Some 32bit integer overflow run-time errors. - - * src/smooth/ftgrays.c [STANDALONE] (OVERFLOW_ADD_LONG, - OVERFLOW_SUB_LONG, OVERFLOW_MUL_LONG, NEG_LONG): New macros. - [!STANDALONE]: Include FT_INTERNAL_CALC_H. - (gray_render_cubic): Use those macros where appropriate. - -2017-06-01 Werner Lemberg - - * src/base/ftglyph.c (FT_Get_Glyph): Check `slot->advance'. - -2017-06-01 Werner Lemberg - - [psaux] 32bit integer overflow tun-time errors (#46149). - - * src/psaux/t1decode.c (t1_decoder_parse_charstrings): Use - OVERFLOW_ADD_LONG and OVERFLOW_SUB_LONG where appropriate. - -2017-06-01 Werner Lemberg - - * src/truetype/ttinterp.c (TT_RunIns): Adjust loop counter again. - - Problem reported by Marek KaĹĄĂ­k . - - The problematic font that exceeds the old limit is Padauk-Bold, - version 3.002, containing bytecode generated by a buggy version of - ttfautohint. - -2017-05-31 Werner Lemberg - - [cff] 32bit integer overflow run-time errors 2/2 (#46149). - - This commit handles the new engine. - - * include/freetype/internal/ftcalc.h (OVERFLOW_ADD_INT32, - OVERFLOW_SUB_INT32, OVERFLOW_MUL_INT32, NEG_INT, NEG_LONG, - NEG_INT32): New macros. - - * src/cff/cf2ft.c (cf2_getScaleAndHintFlag): Use OVERFLOW_ADD_INT32. - - * src/cff/cf2hints.c (cf2_getWindingMomentum, cf2_hint_init, - cf2_hintmap_map, cf2_glyphpath_hintPoint, - cf2_glyphpath_computeIntersection, cf2_glyphpath_computeOffset, - cf2_glyphpath_lineTo, cf2_glyphpath_curveTo): Use - OVERFLOW_ADD_INT32, OVERFLOW_SUB_INT32, OVERFLOW_MUL_INT32, and - NEG_INT32 where appropriate. - - * src/cff/cf2intrp.c (cf2_doFlex, cf2_doBlend, - cf2_interpT2CharString): Ditto. - Also add some other code where needed to avoid overflow. - -2017-05-30 Werner Lemberg - - [cff] 32bit integer overflow run-time errors 1/2 (#46149). - - This commit handles the old engine. - - * src/cff/cffgload.c: Include FT_INTERNAL_CALC_H. - (cff_decoder_parse_charstrings): Use OVERFLOW_ADD_LONG and - OVERFLOW_SUB_LONG where needed. - - * src/cff/cffparse.c: Include FT_INTERNAL_CALC_H. - (power_ten_limits): New static array. - (do_fixed): Use it to prevent multiplication overflow. - (cff_parser_run): Use OVERFLOW_ADD_LONG. - -2017-05-30 Werner Lemberg - - [psaux] Correctly handle sequences of multiple number signs. - - * src/psaux/psconv.c (PS_Conv_Strtol, PS_Conv_ToFixed): Return zero - if we encounter more than a single sign. - -2017-05-29 Werner Lemberg - - [pcf] 32bit integer overflow run-time errors (#46149). - - * src/pcf/pcfread.c (pcf_get_accel): Add sanity checks for - `fontAscent' and `fontDescent'. - (pcf_load_font): Add sanity checks for global height. - Add sanity checks for AVERAGE_WIDTH, POINT_SIZE, PIXEL_SIZE, - RESOLUTION_X, and RESOLUTION_Y properties. - -2017-05-29 Werner Lemberg - - Handle some integer overflow run-time errors (#46149, #48979). - - This commit (mainly for 32bit CPUs) is the first of a series of - similar commits to handle known integer overflows. Basically, all - of them are harmless, since they affect rendering of glyphs only, - not posing security threats. It is expected that fuzzying will show - up more overflows, to be fixed in due course. - - The idea is to mark places where overflows can occur, using macros - that simply cast to unsigned integers, because overflow arithmetic - is well defined in this case. Doing so suppresses run-time errors - of sanitizers without adding computational overhead. - - * include/freetype/internal/ftcalc.h (OVERFLOW_ADD_INT, - OVERFLOW_SUB_INT, OVERFLOW_MUL_INT, OVERFLOW_ADD_LONG, - OVERFLOW_SUB_LONG, OVERFLOW_MUL_LONG): New macros. - - * src/base/ftcalc.c (FT_RoundFix, FT_CeilFix, FT_Matrix_Multiply, - FT_Matrix_Multiply_Scaled, FT_Vector_Transform_Scaled, - ft_corner_orientation): Use new macros. - - * src/base/ftoutln.c (FT_Outline_Get_Orientation): Use new macros. - -2017-05-28 Werner Lemberg - - * include/freetype/internal/ftcalc.h (FLOAT_TO_FIXED): Remove. - - This macro is not used. - -2017-05-28 Werner Lemberg - - [cff] s/cf2_floatToFixed/cf2_doubleToFixed/. - - The new name better describes what the macro actually does; - additionally, we don't need a trailing `f' for literals (there was - only a single such instance in the code, but this caused a clang - warning because the macro itself uses `double' literals). - - * src/cff/cf2blues.c, src/cff/cf2blues.h, src/cff/cf2fixed.h, - src/cff/cf2font.c, src/cff/cf2hints.c: Updated. - -2017-05-28 Werner Lemberg - - Fix negation of INT_MIN and LONG_MIN (#46149). - - * src/base/ftcalc.c (FT_MOVE_SIGN): Add argument to pass unsigned - value, to be used as the result. - (FT_MulDiv, FT_MulDiv_No_Round, FT_DivFix, FT_MulFix, - FT_Vector_NormLen): Updated. - -2017-05-27 Werner Lemberg - - [truetype] Fix handling of design coordinates (#51127). - - * src/truetype/ttgxvar.c (tt_set_mm_blend): Compute all design - coordinates if we have to create the `blends->coord' array. - (TT_Get_MM_Blend, TT_Get_Var_Design): Select default instance - coordinates if no instance is selected yet. - -2017-05-24 Werner Lemberg - - [bdf, pcf] Support ISO646.1991-IRV character encoding (aka ASCII). - - Problem reported by Marek KaĹĄĂ­k , cf. - - https://bugzilla.redhat.com/show_bug.cgi?id=1451795 - - * src/bdf/bdfdrivr.c (BDF_Face_Init), src/pcf/pcfdrivr.c - (PCF_Face_Init): Implement it. - -2017-05-20 Nikolaus Waxweiler - - [truetype] Always use interpreter v35 for B/W rendering (#51051). - - * src/truetype/ttgload.c (tt_loader_init) - [TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL]: Adjust - `subpixel_hinting_lean', `grayscale_cleartype', and - `vertical_lcd_lean' accordingly. - - * src/truetype/ttinterp.c (Ins_GETINFO): Updated. - (TT_RunIns): Update `backward_compatibility' flag. - -2017-05-20 Alexei Podtelezhnikov - - [smooth] Implement minimal dynamic padding for LCD filtering. - - Extra bitmap padding for LCD filtering depends on the filter. The - default 5-tap filter needs 2 extra subpixels. The light 3-tap filter - needs only 1 extra subpixel. This space could be already available - due to rounding. In order to optimize the padding, we now expand - CBox for the given filter weights before rounding. - - This change breaks current Skia (and Firefox). - - * include/freetype/internal/ftobjs.h (FT_LibraryRec) - [FT_CONFIG_OPTION_SUBPIXEL_RENDERING]: Remove `lcd_extra' field. - - * src/base/ftlcdfil.c (FT_Library_SetLcdFilterWeights, - FT_Library_SetLcdFilter): Remove `lcd_extra' initializations. - - * src/smooth/ftsmooth.c (ft_smooth_render_generic): Implement dymanic - LCD padding. - -2017-05-15 Werner Lemberg - - [sfnt] Return proper scaling values for SBIX bitmaps. - - Problem reported by Hin-Tak Leung . - - * src/sfnt/ttsbit.c (tt_face_load_strike_metrics): Implement it. - -2017-05-15 Werner Lemberg - - [truetype] Fix error handling for embedded bitmaps. - - Problem reported by Hin-Tak Leung . - - * src/truetype/ttgload.c (TT_Load_Glyph) - [TT_CONFIG_OPTION_EMBEDDED_BITMAPS]: Handle error if font is not - scalable. - -2017-05-15 Alexei Podtelezhnikov - - [autofit] Make autohint warping NORMAL option. - - This moves warping option from LIGHT to NORMAL mode. This makes LIGHT - truly void of hinting in x-direction, with left side bearing never - changed and right side bearing only altered by advance rounding. - Therefore, LIGHT is now ready to return fractional advance. As a - NORMAL option, warping substitutes normal hinting. - - * src/autofit/afcjk.c (af_cjk_hints_apply): Updated. - * src/autofit/aflatin.c (af_latin_hints_apply): Updated. - * src/autofit/aflatin2.c (af_latin2_hints_apply): Updated. - - * src/autofit/afloader.c (af_loader_load_glyph): Handle warping - phantom points as normal. - -2017-05-14 Werner Lemberg - - Remove remnants of raster pool. - - * include/freetype/internal/ftobjs.h (FT_LibraryRec): Remove - `raster_pool' and `raster_pool_size' fields. - - * src/base/ftobjs.c (FT_New_Library), src/raster/ftrend1.c - (ft_raster1_init), src/smooth/ftsmooth.c (ft_smooth_init): Updated. - -2017-05-13 Werner Lemberg - - * Version 2.8 released. - ======================= - - - Tag sources with `VER-2-8'. - - * docs/VERSION.TXT: Add entry for version 2.8. - * docs/CHANGES: Updated. - - * README, Jamfile (RefDoc), builds/windows/vc2005/freetype.vcproj, - builds/windows/vc2005/index.html, - builds/windows/vc2008/freetype.vcproj, - builds/windows/vc2008/index.html, - builds/windows/vc2010/freetype.vcxproj, - builds/windows/vc2010/index.html, - builds/windows/visualc/freetype.dsp, - builds/windows/visualc/freetype.vcproj, - builds/windows/visualc/index.html, - builds/windows/visualce/freetype.dsp, - builds/windows/visualce/freetype.vcproj, - builds/windows/visualce/index.html, - builds/wince/vc2005-ce/freetype.vcproj, - builds/wince/vc2005-ce/index.html, - builds/wince/vc2008-ce/freetype.vcproj, - builds/wince/vc2008-ce/index.html: s/2.7.1/2.8/, s/271/28/. - - * include/freetype/freetype.h (FREETYPE_MINOR): Set to 8. - (FREETYPE_PATCH): Set to 0. - - * builds/unix/configure.raw (version_info): Set to 20:0:14. - * CMakeLists.txt (VERSION_MINOR): Set to 8. - (VERSION_PATCH): Set to 0. - -2017-05-12 Hin-Tak Leung - - Fix `FT_UINT_TO_POINTER' macro for Windows. - - * builds/unix/ftconfig.in, builds/vms/ftconfig.h, - include/freetype/config/ftconfig.h (FT_UINT_TO_POINTER) [_WIN64]: - Fix definition. - -2017-05-11 Sascha Brawer - Werner Lemberg - Werner Lemberg - Werner Lemberg - Werner Lemberg - Werner Lemberg - Werner Lemberg - Werner Lemberg - Werner Lemberg - Werner Lemberg - Werner Lemberg - - [truetype] Add tricky font `DFGirl-W6-WIN-BF' (from Dynalab). - - Reported by Roy Tam . - - * src/truetype/ttobjs.c (tt_check_trickyness_family): Implement it. - -2017-05-07 Roy Tam - Werner Lemberg - - [truetype] More tricky fonts (mainly from Dynalab). - - * src/truetype/ttobjs.c (tt_check_trickyness_family, - tt_check_trickyness_sfnt_ids): Add them. - -2017-05-07 Werner Lemberg - - [truetype] Add tricky font `DLCHayMedium' (from Dynalab). - - Reported by Roy Tam . - - * src/truetype/ttobjs.c (tt_check_trickyness_family): Implement it. - -2017-05-03 Werner Lemberg - - */*: s/backwards compatibility/backward compatibility/. - -2017-05-03 Sascha Brawer - Werner Lemberg - Werner Lemberg - - [autofit] Add blue-zone support for Sundanese script. - - This essentially moves the Sundanese script from the `Indic' hinter - to the `Latin' hinter. - - * src/autofit/afblue.dat: Add blue zone data for Sundanese. - - * src/autofit/afblue.c, src/autofit/afblue.h: Regenerated. - - * src/autofit/afscript.h: Add Sundanese standard character and move - data out of AF_CONFIG_OPTION_INDIC block. - - * src/autofit/afranges.c: Move Sundanese data out of - AF_CONFIG_OPTION_INDIC block. - - * src/autofit/afstyles.h: Update Sundanese data; in particular, use - AF_WRITING_SYSTEM_LATIN. - -2017-05-03 Sascha Brawer - Werner Lemberg - - [truetype] Make `IUP' gvar deltas do the same as Apple (#50832). - - When points are not touched by gvar interpolation deltas, FreeType - gave a slightly different result than Apple's CoreText. - - The OpenType working group will update the specification to document - the following behaviour: If the two points with deltas to the `left' - and `right' of the untouched point have the same coordinate, then - the inferred delta for the untouched point should be zero. - - * src/truetype/ttgxvar.c (tt_delta_interpolate): Implement new - behaviour. - -2017-05-02 Werner Lemberg - - [autofit] Remove `slight' auto-hint mode again. - - A poll on freetype-devel favoured changes directly applied to - `light'. - - * include/freetype/freetype.h (FT_LOAD_TARGET_SLIGHT, - FT_RENDER_MODE_SLIGHT): Removed. - - * src/autofit/afcjk.c (af_cjk_hints_init), src/autofit/aflatin.c - (af_latin_hints_init), src/autofit/aflatin2.c - (af_latin2_hints_init): Revert change from 2017-04-22. - - * src/autofit/afloader.c (af_loader_load_glyph) Remove references to - FT_RENDER_MODE_SLIGHT. - [AF_CONFIG_OPTION_TT_SIZE_METRICS]: Enable TrueType-like metrics - unconditionally. - - * src/base/ftadvanc.c (LOAD_ADVANCE_FAST_CHECK): Revert change from - 2017-04-22. - - * src/base/ftobjs.c (FT_Load_Glyph): Revert change from 2017-04-22. - - * src/pshinter/pshalgo.c (ps_hints_apply): Revert change from - 2017-04-22. - - * src/smooth/ftsmooth.c (ft_smooth_render): Revert change from - 2017-04-22. - - * docs/CHANGES: Updated. - -2017-04-30 Werner Lemberg - - [autofit] Fix metrics computation. - - Problem reported by Markus Trippelsdorf and - Nikolaus Waxweiler . - - * src/base/ftobjs.c (FT_Request_Size): Trigger recomputation of - auto-hinter metrics. Without this change, multiple size changing - calls for a single face fail. - -2017-04-29 Werner Lemberg - - * src/truetype/ttdriver.c (tt_size_request): Properly check `error'. - - Reported by Earnestly in - - https://lists.nongnu.org/archive/html/freetype/2017-04/msg00031.html - -2017-04-27 Werner Lemberg - - Introduce AF_CONFIG_OPTION_TT_SIZE_METRICS configuration option. - - * include/freetype/config/ftoption.h - (AF_CONFIG_OPTION_TT_SIZE_METRICS): New option, commented out by - default. - - * src/autofit/afloader.c (af_loader_load_glyph): Use - AF_CONFIG_OPTION_TT_SIZE_METRICS to guard the corresponding code. - -2017-04-26 Werner Lemberg - - * include/freetype/freetype.h (FT_Render_Mode): Fix order. - - This retains backward compatibility. - - Noted by Alexei. - -2017-04-22 Werner Lemberg - - [truetype] Do linear scaling for FT_LOAD_NO_HINTING (#50470). - - * src/truetype/ttobjs.h (TT_SizeRec): Add field `hinted_metrics' to - hold hinted metrics. - Make `metrics' a pointer so that `tt_glyph_load' can easily switch - between metrics. - - * src/truetype/ttdriver.c (tt_size_request): Updated. - (tt_glyph_load): Use top-level metrics if FT_LOAD_NO_HINTING is - used. - - * src/truetype/ttgload.c (TT_Hint_Glyph, TT_Process_Simple_Glyph, - TT_Process_Composite_Component, load_truetype_glyph, - compute_glyph_metrics, TT_Load_Glyph): Updated. - - * src/truetype/ttinterp.c (TT_Load_Context): Updated. - - * src/truetype/ttobjs.c (tt_size_reset): Updated. - - * src/truetype/ttsubpix.c (sph_set_tweaks): Updated. - -2017-04-22 Werner Lemberg - - Add new `slight' auto-hinting mode. - - This mode uses fractional advance widths and doesn't scale glyphs - horizontally, only applying vertical scaling and hinting. - - At the same time, the behaviour of the `light' auto-hinter gets - restored for backward compatibility: Both vertical and horizontal - scaling is again based on rounded metrics values (this was changed - in a commit from 2017-03-30 as a side effect). To be more precise, - the behaviour is restored for TrueType fonts only; for other font - formats like Type 1, this is a new feature of the `light' hinting - mode. - - * include/freetype/freetype.h (FT_LOAD_TARGET_SLIGHT): New macro. - (FT_RENDER_MODE_SLIGHT): New render mode. - - * include/freetype/internal/ftobjs.h (FT_Size_InternalRec): Add - `autohint_mode' and `autohint_metrics' fields. - - * src/autofit/afcjk.c (af_cjk_hints_init), src/autofit/aflatin.c - (af_latin_hints_init), src/autofit/aflatin2 (af_latin2_hints_init): - Updated. - - * src/autofit/afloader.c (af_loader_embolden_glyph_in_slot): Use - `autohint_metrics'. - (af_loader_load_glyph): s/internal/slot_internal/. - Initialize `autohint_metrics' and `autohint_mode' depending on - current auto-hint mode. - Use `autohint_metrics'. - Updated. - - * src/base/ftadvanc.c (LOAD_ADVANCE_FAST_CHECK): Updated. - - * src/base/ftobjs.c (FT_Load_Glyph): Updated. - (FT_New_Size): Allocate `internal' object. - - * src/pshinter/pshalgo.c (ps_hints_apply): Updated. - - * src/smooth/ftsmooth.c (ft_smooth_render): Updated. - -2017-04-22 Werner Lemberg - - Introduce `FT_Size_InternalRec' structure. - - We are going to extend this later on. - - * include/freetype/internal/ftobjs.h (FT_Size_InternalRec): New - structure with a single field `module_data'. - - * src/base/ftobjs.c (FT_New_Size): Allocate `internal' field of - `FT_Size' structure. - - * src/cff/cffgload.c (cff_builder_init, cff_decoder_prepare): Use - `size->internal->module_data' instead of `size->internal'. - - * src/cff/cffobjs.c (cff_size_done): Deallocate `module_data'. - (cff_size_init, cff_size_select, cff_size_request): Use - `size->internal->module_data' instead of `size->internal'. - - * src/cif/cidobjs.c (cid_size_done, cid_size_init, - cid_size_request): Use `size->internal->module_data' instead of - `size->internal'. - - * src/psaux/psobjs.c (t1_builder_ini): Use - `size->internal->module_data' instead of `size->internal'. - - * src/type1/t1objs.c (T1_Size_Done, T1_Size_Init, T1_Size_Request): - Use `size->internal->module_data' instead of `size->internal'. - -2017-04-21 Alexei Podtelezhnikov - - * src/smooth/ftsmooth.h: Remove unused guards and declaration. - -2017-04-16 Hin-Tak Leung - - Fix tracing messages. - - * src/base/ftobjs.c (FT_Face_GetCharVariantIndex, - FT_Face_GetCharVariantIsDefault, FT_Face_GetVariantsOfChar): Print - correct function name. - -2017-04-08 Sascha Brawer - Werner Lemberg - Werner Lemberg - Werner Lemberg - Werner Lemberg - - [autofit] Fix invalid character range description (#50745). - - Also reported as - - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=1034 - - * src/autofit/afranges.c (af_glag_nonbase_uniranges): Fix typo in - recent commit. - -2017-04-07 Werner Lemberg - - [ftfuzzer] Fix clang warnings. - - * src/tools/ftfuzzer/ftfuzzer.cc (LLVMFuzzerTestOneInput): Add - casts. - -2017-04-06 Sascha Brawer - Werner Lemberg - Werner Lemberg - Werner Lemberg - Werner Lemberg - Werner Lemberg - Werner Lemberg - - [autofit] Add support for Adlam script. - - * src/autofit/afblue.dat: Add blue zone data for Adlam. - * src/autofit/afblue.c, src/autofit/afblue.h: Regenerated. - - * src/autofit/afscript.h: Add Adlam standard characters. - - * src/autofit/afranges.c, src/autofit/afstyles.h: Add Adlam data. - -2017-04-06 Sascha Brawer - - [autofit] Add support for Ol Chiki script. - - * src/autofit/afblue.dat: Add blue zone data for Ol Chiki. - * src/autofit/afblue.c, src/autofit/afblue.h: Regenerated. - - * src/autofit/afscript.h: Add Ol Chiki standard character. - - * src/autofit/afranges.c, src/autofit/afstyles.h: Add Ol Chiki data. - -2017-04-03 Werner Lemberg - - [truetype] Avoid reexecution of `fpgm' and `prep' in case of error. - - Reported as - - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=981 - - * include/freetype/fterrdef.h (FT_Err_DEF_In_Glyf_Bytecode): New - error code. - - * src/truetype/ttinterp.c (Ins_FDEF, Ins_IDEF): Prohibit execution - of these two opcodes in `glyf' bytecode. - (TT_RunIns): Don't enforce reexecution of `fpgm' and `prep' bytecode - in case of error since function tables can no longer be modified - (due to the changes in `Ins_FDEF' and `Ins_IDEF'). This change can - enormously speed up handling of broken fonts. - -2017-04-02 Alexei Podtelezhnikov - - [autofit] Disable metrics adjustment for `FT_LOAD_TARGET_LCD'. - - * src/autofit/aflatin.c (af_latin_hints_init): Updated. - * src/autofit/aflatin2.c (af_latin2_hints_init): Ditto. - -2017-04-01 Werner Lemberg - - * src/truetype/ttgload.c: Include FT_CONFIG_CONFIG_H. - - Otherwise FT_UINT_TO_POINTER might not be defined. - - Problem reported by Alexei. - -2017-03-31 Alexei Podtelezhnikov - - [autofit] Disable stem adjustment for `FT_LOAD_TARGET_LCD'. - - * include/freetype/freetype.h (FT_LOAD_TARGET_LCD): Document it. - * src/autofit/afcjk.c (af_cjk_hints_init): Updated. - * src/autofit/aflatin.c (af_latin_hints_init): Ditto. - * src/autofit/aflatin2.c (af_latin2_hints_init): Ditto. - -2017-03-31 Werner Lemberg - - * src/cff/cffload.c (cff_font_load): Improve fix from 2017-01-04. - - Allow CFFs containing a single font to have an empty font name. - - Problem reported by 張俊芝 <418092625@qq.com> in - - https://lists.nongnu.org/archive/html/freetype-devel/2017-03/msg00074.html - -2017-03-30 Werner Lemberg - - * src/cff/cffparse.h (CFF2_DEFAULT_STACK): Set to 513 also. - - Requested by Dave Arnold. - -2017-03-30 Werner Lemberg - - [truetype] Fix HVAR and VVAR handling (#50678). - - * src/truetype/ttgxvar.c (tt_hvadvance_adjust): Handle - glyph indices larger than `mapCount' as described in the - specification. - -2017-03-30 Werner Lemberg - - [truetype] Allow linear scaling for unhinted rendering (#50470). - - * src/truetype/ttdriver.c (tt_size_request): Revert change from - 2011-07-16; the intended metrics fix seems now to be implemented in - a different way, making the patch unnecessary. Note that this - change was usually patched out by all major GNU/Linux distributions - due to heavy side effects. - - * src/truetype/ttgload.c (compute_glyph_metrics, TT_Load_Glyph): - Refer to the metrics of the `TT_Size' object. - -2017-03-29 Werner Lemberg - - [truetype] Fix thinko related to PS name of default named instance. - - * src/truetype/ttgxvar.c (TT_Get_MM_Var): `strid' and `psid' are - name ID values, not indices into the array of name entries. - -2017-03-27 Werner Lemberg - - [cid, truetype] Don't use `index' as a variable name. - - At least on FreeBSD there is a global declaration of `index' in file - `/usr/include/strings.h'. - - * src/cff/cf2intrp.c, src/truetype/ttgload.c: s/index/idx/ where - appropriate. - -2017-03-27 Wojciech Mamrak - - [sfnt] Minor improvement for handling kern tables. - - * src/sfnt/ttkern.c (tt_face_load_kern): Don't check for - cross-stream kerning tables since we reject format 2 tables later - on anyways. - Modify code for limit test... - (tt_face_get_kerning): ... to avoid a limit test here. - -2017-03-27 Werner Lemberg - - [pcf] Fix compiler warnings. - - Reported by Alexander Hedges . - - * src/pcf/pcfdrivr.c (pcf_property_set, pcf_property_get): Tag - `property_name' with `FT_UNUSED' where necessary. - -2017-03-26 Werner Lemberg - - * src/psaux/psobjs.c (t1_builder_close_contour): Add safety guard. - - Reported as - - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=941 - -2017-03-23 Werner Lemberg - - [psaux] Better protect `flex' handling. - - Reported as - - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=935 - - * src/psaux/t1decode.c (t1_decoder_parse_charstrings) - : Since there is not a single flex operator but a - series of subroutine calls, malformed fonts can call arbitrary other - operators after the start of a flex, possibly adding points. For - this reason we have to check the available number of points before - inserting a point. - -2017-03-23 Werner Lemberg - - [sfnt] Fix check for default named instance. - - * src/sfnt/sfobjs.c (sfnt_init_face): A `fixed' number needs four - bytes, not two... - -2017-03-23 Werner Lemberg - - Make MM fonts work (again). - - * src/base/ftmm.c (FT_Set_Var_Design_Coordinates, - FT_Set_MM_Blend_Coordinates, FT_Set_Var_Blend_Coordinates): Ignore - return value of `ft_face_get_mvar_service'; instead, check whether a - service is actually returned. - -2017-03-20 Werner Lemberg - - [truetype] Some variable renamings. - - Too much local variables holding different structures were called - `metrics'. - - * src/truetype/ttdriver.c (tt_size_select): s/metrics/size_metrics/. - - * src/truetype/ttgload.c (tt_get_metrics_incr_overrides, - compute_glyph_metrics): s/metrics/incr_metrics/. - (load_sbit_image): s/metrics/sbit_metrics/. - - * src/truetype/ttobjs.c (tt_size_run_fpgm): s/metrics/size_metrics/. - (tt_size_init_bytecode): s/metrics/tt_metrics/. - (tt_size_reset): s/metrics/size_metrics/. - -2017-03-20 Werner Lemberg - - [sfnt] Don't add instances to non-variation fonts. - - * src/sfnt/sfobjs.c (sfnt_init_face): Fix it. - -2017-03-20 Werner Lemberg - - * src/cff/cffgload.c (cff_builder_init): Add safety guard (#50578). - -2017-03-18 Werner Lemberg - - Introduce FT_UINT_TO_POINTER macro (#50560). - - We have to make a separate case for Windows 64's LLP64 data model. - - * builds/unix/ftconfig.in, builds/vms/ftconfig.h, - include/freetype/config/ftconfig.h (FT_UINT_TO_POINTER): New macro. - - * src/truetype/ttgload.c (load_truetype_glyph): Use it. - -2017-03-18 Werner Lemberg - - * src/truetype/ttinterp.c (TT_RunIns): Adjust loop counter (#50573). - - The problematic font that exceeds the old limit is Lato-Regular, - version 2.007, containing bytecode generated by a buggy version of - ttfautohint. - -2017-03-18 Werner Lemberg - - [truetype] Another limitation for bytecode loop count maximum. - - Reported as - - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=900 - - * src/truetype/ttinterp.c (TT_RunIns): Limit `loopcall_counter_max' - by number of glyphs also. - -2017-03-18 Werner Lemberg - - [ftfuzzer] Minor improvement. - - * src/tools/ftfuzzer/ftfuzzer.cc: Don't set intermediate axis if - bitmap strikes are active. - -2017-03-18 Werner Lemberg - - Improve `make multi'. - - * src/autofit/aflatin2.c: Guard file with FT_OPTION_AUTOFIT2. - - * src/base/ftmac.c: Guard more parts of the file with FT_MACINTOSH. - - * src/psaux/afmparse.c: Guard file with T1_CONFIG_OPTION_NO_AFM. - - * src/sfnt/pngshim.c: Guard file with - TT_CONFIG_OPTION_EMBEDDED_BITMAPS also. - - * src/sfnt/ttbdf.c: Avoid empty source file. - * src/sfnt/ttpost.c: Guard file with - TT_CONFIG_OPTION_POSTSCRIPT_NAMES. - * src/sfnt/ttsbit.c: Guard file with - TT_CONFIG_OPTION_EMBEDDED_BITMAPS. - - * src/truetype/ttgxvar.c, src/truetype/ttinterp.c: Avoid empty - source file. - - * src/truetype/ttsubpix.c: Guard file with - TT_USE_BYTECODE_INTERPRETER also. - - * src/type1/t1afm.c: Guard file with T1_CONFIG_OPTION_NO_AFM. - - * src/autofit/autofit.c, src/base/ftbase.c, src/cache/ftcache.c, - src/cff/cff.c, src/cid/type1cid.c, src/gxvalid/gxvalid.c, - src/pcf/pcf.c, src/pfr/pfr.c, src/psaux/psaux.c, - src/pshinter/pshinter.c, src/psnames/psnames.c, src/raster/raster.c, - src/sfnt/sfnt.c, src/smooth/smooth.c, src/truetype/truetype.c, - src/type1/type1.c, src/type42/type42.c: Remove conditionals; sort - entries. - -2017-03-17 Werner Lemberg - - Fixes for conditional compilation. - - * src/autofit/afcjk.c, src/autofit/afindic.c: Include `afcjk.h' - earlier. - - * src/sfnt/sfobjs.c (sfnt_init_face): Put `memory' variable into - TT_CONFIG_OPTION_GX_VAR_SUPPORT block. - (sfnt_done_face): Protect some code with - TT_CONFIG_OPTION_GX_VAR_SUPPORT. - - * src/sfnt/ttsbit.c (tt_face_load_sbix_image): Remove compiler - warning. - - * src/truetype/ttgload.c (TT_Load_Simple_Glyph): Put `tmp' variable - into TT_USE_BYTECODE_INTERPRETER block. - - (tt_loader_init): Put `error' variable into - TT_USE_BYTECODE_INTERPRETER block. - -2017-03-17 Werner Lemberg - - Fix preprocessor warning. - - * devel/ftoption.h, include/freetype/config/ftoption.h: Test whether - TT_CONFIG_OPTION_SUBPIXEL_HINTING is defined before checking its - value. - -2017-03-17 Werner Lemberg - - `make multi' fixes; compiler warnings. - - * src/base/ftsnames.c: Include FT_INTERNAL_DEBUG_H. - - * src/cff/cffobjs.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include - FT_MULTIPLE_MASTERS_H and FT_SERVICE_MULTIPLE_MASTERS_H. - - * src/sfnt/sfdriver.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include - FT_MULTIPLE_MASTERS_H and FT_SERVICE_MULTIPLE_MASTERS_H. - (get_win_string, get_apple_string): Initialize `result'. - -2017-03-17 Dave Arnold - - [cff] Fix potential bugs in default NDV for CFF2. - - * src/cff/cffload.c (cff_blend_build_vector): Explicitly build blend - vector when `lenNDV' is zero; don't rely on zero-init. - Save `lenNDV' as part of cache key even when `lenNDV' is zero. - -2017-03-17 Dave Arnold - - [cff] Fix CFF2 stack allocation. - - * src/cff/cffparse.c (cff_parser_init) add 1 for operator. - -2017-03-16 Werner Lemberg - - * src/truetype/ttgxvar.c (tt_done_blend): Free `vvar_table'. - - Reported as - - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=883 - -2017-03-15 Werner Lemberg - - Remove clang compiler warnings (#50548). - - * include/freetype/internal/tttypes.h (TT_FaceRec): Make - `var_postscript_prefix_len' unsigned. - - * src/autofit/afwarp.c (af_warper_compute_line_best): Remove - redundant assignment. - - * src/cff/cffload.c (cff_subfont_load): Add casts. - - * src/cff/cffparse.c (cff_parse_blend): Remove redundant assignment. - - * src/sfnt/sfdriver.c (fmix32, murmur_hash_3_128): Add `static' - keyword. - Add casts. - (fixed2float): Add cast. - (sfnt_get_var_ps_name): Make `p' always initialized. - Add casts. - - * src/truetype/ttgxvar.c (TT_Get_MM_Var): Add casts. - -2017-03-15 Werner Lemberg - - [ftfuzzer] Limit number of tested faces and instances. - - This is inspired by the discussion in and analysis of - - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=859 - - * src/tools/ftfuzzer/ftfuzzer.cc (LLVMFuzzerTestOneInput): Use only - up to 20 face indices. - Use only up to 20 instance indices. - -2017-03-15 Werner Lemberg - - * src/tools/ftfuzzer/ftfuzzer.cc: Improve readability; formatting. - -2017-03-14 Werner Lemberg - - [sfnt] Implement PS names for font instances [3/3]. - - Everything is guarded with TT_CONFIG_OPTION_GX_VAR_SUPPORT. - - * include/freetype/internal/tttypes.h (TT_FaceRec): New fields - `var_postscript_prefix' and `var_postscript_prefix_len'. - - * src/sfnt/sfdriver.c: Include FT_TRUETYPE_IDS_H. - (sfnt_is_alphanumeric): New wrapperfunction for `ft_isalnum'. - (get_win_string, get_apple_string): Remove `const' from return - value. - (MAX_VALUE_DESCRIPTOR_LEN, MAX_PS_NAME_LEN): New macros. - (hexdigits): New array. - (sfnt_get_var_ps_name): New function, implementing Adobe TechNote - 5902 to construct a PS name for a variation font instance. - (sfnt_get_ps_name): Call `sfnt_get_var_ps_name' for font instances. - - * src/sfnt/sfobjs.c (sfnt_done_face): Updated. - - * src/truetype/ttgxvar.c (tt_set_mm_blend): Reset - `face->postscript_name' to trigger recalculation for new instance - parameters. - -2017-03-14 Werner Lemberg - - [sfnt] Implement PS names for font instances [2/3]. - - * src/sfnt/sfdriver.c (fix2float) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: - New function to find the shortest representation of a 16.16 - fractional number. - -2017-03-14 Werner Lemberg - - [sfnt] Implement PS names for font instances [1/3]. - - Add 128bit MurmurHash 3 function. - - Everything is guarded with TT_CONFIG_OPTION_GX_VAR_SUPPORT. - - * src/sfnt/sfdriver.c (ROTL32): New macro. - (fmix32, murmur_hash_3_128): New functions. - -2017-03-13 Werner Lemberg - - [truetype] Ignore invalid MVAR tags. - - Reported as - - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=838 - - * src/truetype/ttgxvar.c (ft_var_load_mvar): Ignore value and emit - warning for invalid tags. - (tt_apply_mvar): Ignore invalid tags. - -2017-03-12 Werner Lemberg - - [truetype] Store and use design coordinates also. - - * include/freetype/internal/services/svmm.h (FT_Get_Var_Blend_Func): - Add `normalizedcoords' argument. - - * src/truetype/ttgxvar.h (GX_BlendRec): Add `coords' field to store - the design coordinates of the current instance. - Updated. - - * src/truetype/ttgxvar.c (TT_Set_MM_Blend): Move functionality to... - (tt_set_mm_blend): ... New function. - Convert data in `normalizedcoords' array to `coords' array on - demand. - (TT_Set_Var_Design): Store argument data in `coords' array. - (TT_Get_Var_Design): Get data from `coords' array. - (tt_get_var_blend): Updated. - (tt_done_blend): Updated. - - * src/cff/cffload.c, src/cff/cffload.h (cff_get_var_blend): Updated. - - * src/cff/cf2ft.c (cf2_getNormalizedVector): Updated. - - * src/cff/cffobjs.c (cff_face_init): Updated. - -2017-03-12 Werner Lemberg - - src/truetype/ttgxvar.[ch]: s/avar_checked/avar_loaded/. - -2017-03-08 Werner Lemberg - - [sfnt] Another fix for buggy variation fonts. - - Reported as - - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=759 - - * src/sfnt/sfobjs.c (sfnt_init_face): While setting number of - instances to zero for `CFF' fonts table, ensure that there is no - `CFF2' present also (which gets priority). - -2017-03-07 Werner Lemberg - - [sfnt] Improve handling for buggy variation fonts. - - Reported as - - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=738 - - * src/sfnt/sfobjs.c (sfnt_init_face): While setting number of - instances to zero for `CFF' fonts table, ensure that there is no - `glyf' table present also (which gets priority). - -2017-03-06 Werner Lemberg - - [sfnt, truetype] Always provide default instance. - - As documented in the OpenType specification, an entry for the - default instance may be omitted in the named instance table. In - particular this means that even if there is no named instance table - in the font we actually do have a named instance, namely the default - instance. - - For consistency, we always want the default instance in our list of - named instances. If it is missing, we try to synthesize it. - - * src/sfnt/sfobjs.c (sfnt_init_face): Check whether the default - instance is in the table of named instances. Otherwise adjust - number of instances. - - * src/truetype/ttgxvar.c: Include FT_TRUETYPE_IDS_H. - (TT_Get_MM_Var): Use `face->root.style_flags' as the number of named - instances. - Sythesize a named instance entry if necessary. - (tt_done_blend): Free `normalized_stylecoords'. - -2017-03-05 Werner Lemberg - - [sfnt] Remove redundant code. - - * src/sfnt/sfobjs.c (sfnt_init_face): Remove second test for - `num_instances', which will always succeed. - -2017-03-04 Werner Lemberg - - [sfnt] Add `get_name_id' service. - - * include/freetype/internal/sfnt.h (TT_Get_Name_ID_Func): New - typedef. - (SFNT_Interface): Add `get_name_id' field. - (FT_DEFINE_SFNT_INTERFACE): Updated. - - * src/sfnt/sfdriver.c (search_name_id): Rename to... - (sfnt_get_name_id): ... this. - (sfnt_get_ps_name, sfnt_interface): Updated. - -2017-03-04 Werner Lemberg - - [truetype] Make `TT_Set_MM_Blend' set named instance index. - - * src/truetype/ttgxvar.h (GX_Blend): New array - `normalized_stylecoords'. - - * src/truetype/ttgxvar.c (TT_Get_MM_Var): Allocate and fill - `normalized_stylecoords'. - (TT_Set_MM_Blend): Check instance tuple and adjust `face_index' - accordingly. - -2017-03-02 Werner Lemberg - - [truetype] Split off designer/normalized conversion routines. - - * src/truetype/ttgxvar.c (TT_Set_Var_Design): Split off conversion - code designer->normalized coordinates to... - (ft_var_to_normalized): ... New function. - (TT_Get_Var_Design): Split off conversion code normalized->designer - coordinates to... - (ft_var_to_design): ... New function. - -2017-02-28 Werner Lemberg - - [sfnt] Further generalize `sfnt_get_ps_name'; report invalid data. - - * src/sfnt/sfdriver.c (sfnt_ps_map): New array. - (sfnt_is_postscript): New function. - (char_type_func): New typedef. - (get_win_string, get_apple_string): Add argument to specify - character checking function. - Add argument whether argument checking failures should be reported. - Update callers. - (search_name_id): Fix return value. - -2017-02-23 Werner Lemberg - - [sfnt] Split off another bit of `sfnt_get_ps_name'. - - * src/sfnt/sfdriver.c (sfnt_get_ps_name): Split off some - functionality into... - (search_name_id): ... New function. - -2017-02-23 Werner Lemberg - - [sfnt] Modularize `sfnt_get_ps_name'. - - * src/sfnt/sfdriver.c (sfnt_get_ps_name): Split off some - functionality into... - (IS_WIN, IS_APPLE): ... New macros. - (get_win_string, get_apple_string): ... New functions. - -2017-02-23 Werner Lemberg - - [truetype] Minor improvement. - - * src/truetype/ttgload.c (TT_Process_Simple_Glyph, - load_truetype_glyph): Remove unnecessary tests. - -2017-02-23 Werner Lemberg - - * include/freetype/internal/tttypes.h (TT_Face): s/isCFF2/is_cff2/. - - For orthogonality with other structure field names. - - Update all users. - -2017-02-22 Alexei Podtelezhnikov - - * src/smooth/ftgrays.c (gray_hline): Improve code. - -2017-02-20 Dominik RĂśttsches - - Fix some `ttnameid.h' entries (#50313). - - * include/freetype/ttnameid.h: - s/TT_MS_LANGID_SPANISH_INTERNATIONAL_SORT/TT_MS_LANGID_SPANISH_SPAIN_INTERNATIONAL_SORT/, - s/TT_MS_LANGID_MONGOLIAN_MONGOLIA_MONGOLIA/TT_MS_LANGID_MONGOLIAN_MONGOLIA_MONGOLIAN/. - -2017-02-20 Werner Lemberg - - [cff] Finish support for `random' operator. - - * src/cff/cfftypes.h (CFF_SubFontRec): Add `random' field. - - * src/cff/cffobjs.c: Updated. - (cff_driver_init): Initialize random seed value. - - * src/cff/cffload.c (cff_random): New function. - (cff_subfont_load): Add `face' argument. - Update all callers. - Initialize random number generator with a proper seed value. - (cff_font_load): Add `face' argument. - Update all callers. - - * src/cff/cffload.h: Updated. - - * src/cff/cf2intrp.c (CF2_FIXME): Removed. - (cf2_interpT2CharString) : Implement opcode. - - * src/cff/cffgload.c (cff_decoder_parse_charstrings): Don't - initialize random seed value. - : Use new random seed framework. - -2017-02-20 Werner Lemberg - - [cff] Sanitize `initialRandomSeed'. - - * src/cff/cffload.c (cff_load_private_dict): Make - `initial_random_seed' value always positive. - -2017-02-20 Werner Lemberg - - [cff] Introduce `random-seed' property (2/2). - - * src/base/ftobjs.c: Include `FT_CFF_DRIVER_H'. - (open_face): Initialize `face->internal->random_seed'. - (FT_Face_Properties): Handle `FT_PARAM_TAG_RANDOM_SEED'. - - * src/cff/cffdrivr.c (cff_property_set): Handle `random-seed' - property. - -2017-02-20 Werner Lemberg - - [cff] Introduce `random-seed' property (1/2). - - We need this for support of the `random' operator. - - * include/freetype/ftcffdrv.h (FT_PARAM_TAG_RANDOM_SEED): New macro. - - * include/freetype/internal/ftobjs.h (FT_Face_InternalRec): New - field `random_seed'. - - * src/cff/cffobjs.h (CFF_DriverRec): New field `random_seed'. - -2017-02-17 Werner Lemberg - - Remove clang warnings. - - * src/autofit/aflatin.c (af_latin_sort_blue): Add missing `static' - keyword. - - * src/base/ftmm.c (FT_Set_Var_Design_Coordinates, - FT_Set_MM_Blend_Coordinates, FT_Set_Var_Blend_Coordinates): - Initialize some variables. - -2017-02-16 Nikolaus Waxweiler - Werner Lemberg - - Add face property for stem darkening. - - * include/freetype/ftautoh.h (FT_PARAM_TAG_STEM_DARKENING): New - macro. - - * include/freetype/internal/ftobjs.h (FT_Face_InternalRec): Add - `no_stem_darkening' field. - - * src/autofit/afloader.c (af_loader_load_glyph), - src/autofit/afmodule.c (af_property_set): Updated. - - * src/base/ftobjs.c: Include FT_AUTOHINTER_H. - (ft_open_face_internal): Updated. - (FT_Face_Properties): Handle FT_PARAM_TAG_STEM_DARKENING. - - * src/cff/cf2ft.c (cf2_decoder_parse_charstrings): Updated. - - * src/cff/cffdrivr.c (cff_property_set): Updated. - -2017-02-16 Nikolaus Waxweiler - Werner Lemberg - - Add face property for LCD filter weights. - - * include/freetype/ftlcdfil.h (FT_PARAM_TAG_LCD_FILTER_WEIGHTS, - FT_LCD_FILTER_FIVE_TAPS): New macros. - (FT_LcdFiveTapFilter): New typedef. - - * include/freetype/ftobjs.h (FT_Face_InternalRec) - [FT_CONFIG_OPTION_SUBPIXEL_RENDERING]: Add `lcd_weights' field. - (FT_Bitmap_LcdFilterFunc): Change third argument to weights array. - (ft_lcd_filter_fir): New prototype. - (FT_LibraryRec): Updated. - - * src/base/ftlcdfil.c (_ft_lcd_filter_fir): Renamed to... - (ft_lcd_filter_fir): ... this base function. - Updated. - (_ft_lcd_filter_legacy): Updated. - (FT_Library_SetLcdFilterWeights, FT_Library_SetLcdFilter): Updated. - - * src/base/ftobjs.c (ft_open_face_internal): Updated. - (FT_Face_Properties): Handle FT_PARAM_TAG_LCD_FILTER_WEIGHTS. - - * src/smooth/ftsmooth.c (ft_smooth_render_generic) - [FT_CONFIG_OPTION_SUBPIXEL_RENDERING]: Handle LCD weights from - `FT_Face_Internal'. - -2017-02-14 Nikolaus Waxweiler - Werner Lemberg - - Add new function `FT_Face_Properties'. - - This commit provides the framework, to be filled with something - useful in the next commits. - - * include/freetype/freetype.h (FT_Face_Properties): Declare. - - * src/base/ftobjs.c (FT_Face_Properties): New function. - -2017-02-13 Werner Lemberg - - [autofit] Prevent overlapping blue zones. - - Problem reported as - - https://github.com/google/fonts/issues/632 - - The font in question (Nunito) has values 705 and 713 for the - reference and overshoot values, respectively, of the first blue - zone. Blue zone 2, however, has value 710 for both the reference - and overshoot. At 12ppem, reference and overshoot of blue zone 0 - becomes 8px, while blue zone 2 becomes 9px. - - A peculiarity of this font is that the tops of isolated vertical - stems like `N' have a slight overshoot also. The auto-hinter tries - to find the nearest blue zone using the *original* coordinates. For - vertical stems, this is value 713. For normal horizontal tops like - in character `E', this is value 710. Since value 713 is mapped to - 8px but value 710 to 9px, `N' and similar characters are one pixel - higher than `E', which looks very bad. - - This commit sanitizes blue zones to avoid such a behaviour. - - * src/autofit/aflatin.c (af_latin_sort_blue): New function. - (af_latin_metrics_init_blues): Sort blue values and remove overlaps. - -2017-02-12 Alexei Podtelezhnikov - - * src/smooth/ftgrays.c (gray_sweep): Improve code. - -2017-02-06 Werner Lemberg - - [truetype] Implement `VVAR' table support. - - * src/truetype/ttgxvar.h (GX_HVarTable): Renamed to... - (GX_HVVarTable): ...This. - (GX_Blend): Add fields for `VVAR' table handling. - Other minor updates. - - * src/truetype/ttgxvar.c (ft_var_load_hvar): Renamed to... - (ft_var_load_hvvar): ...This. - Handle VVAR loading also (controlled by an additional parameter). - (tt_hadvance_adjust): Renamed to... - (tt_hvadvance_adjust): ...This. - Handle application of advance height also (controlled by an - additional parameter). - (tt_hadvance_adjust, tt_vadvance_adjust): Wrappers for - `tt_hvadvance_adjust'. - - * src/truetype/ttdriver.c (tt_service_metrics_variations): Updated. - -2017-02-05 Werner Lemberg - - [autofit] Use better blue zone characters for lowercase latin. - - The number of lowercase characters for computing the top flat blue - zone value was too small (in most cases only `x' and `z'). If one - of the two characters has a large serif, say, it can happen that - FreeType must select between two different values, having a 50% - chance to use the wrong one. As a result, rendering at larger PPEM - values could yield uneven lowercase glyph heights. - - Problem reported by Christoph Koeberlin . - - * src/autofit/afblue.dat (AF_BLUE_STRING_LATIN_SMALL): Replaced - with... - (AF_BLUE_STRING_LATIN_SMALL_TOP, AF_BLUE_STRING_LATIN_SMALL_BOTTOM): - ... New, extended sets. - (AF_BLUE_STRINGSET_LATN): Updated. - - * src/autofit/afblue.c, scr/autofit/afblue.h: Regenerated. - -2017-02-04 Werner Lemberg - - Make `freetype-config' a wrapper of `pkg-config' if possible. - - Based on ideas taken from - - http://pkgs.fedoraproject.org/cgit/rpms/freetype.git/tree/freetype-multilib.patch - http://pkgs.fedoraproject.org/cgit/rpms/freetype.git/tree/freetype-2.5.3-freetype-config-prefix.patch - - * builds/unix/freetype-config.in: Rewritten. Use `pkg-config' to - set output variables if program is available. - - * docs/CHANGES, docs/freetype-config.1: Updated. - -2017-02-04 Werner Lemberg - - * builds/unix/unix-def.in (freetype-config): Fix permissions. - -2017-02-03 Werner Lemberg - - * src/autofit/afglobal.c (af_face_globals_free): Erase useless code. - -2017-02-03 Werner Lemberg - - * include/freetype/ftgasp.h (FT_GASP_SYMMETRIC_GRIDFIT): Fix value. - - Reported by Behdad. - -2017-02-02 Werner Lemberg - - [truetype] Fix MVAR post-action handling. - - Reported as - - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=509 - - * src/truetype/ttobjs.c (tt_size_reset): Do nothing for CFF2. This - is important to make `tt_size_reset_iterator' (called in - `tt_apply_mvar') always work. - -2017-02-02 Werner Lemberg - - Make compilation with FT_CONFIG_OPTION_PIC work again. - - All code committed here is guarded with `FT_CONFIG_OPTION_PIC'. - - * include/freetype/internal/services/svmetric.h - (FT_DEFINE_SERVICE_METRICSVARIATIONSREC): Remove trailing semicolon. - - * src/autofit/aflatin.c (af_latin_hints_compute_edges, - af_latin_hint_edges): Provide `globals' variable. - - * src/autofit/afloader.c (af_loader_load_glyph): Remove shadowing - variable. - - * src/autofit/afmodule.c (AF_SCRIPT_CLASSES_GET, - AF_STYLE_CLASSES_GET): Redefine. - - * src/autofit/aftypes.h (AF_DEFINE_WRITING_SYSTEM_CLASS): Fix typo. - - * src/cff/cffparse.c (CFF_FIELD_BLEND): Provide it. - - * src/cff/cffpic.h (CffModulePIC): Fix typo. - -2017-01-31 Alexei Podtelezhnikov - - * src/smooth/ftgrays.c (gray_render_scanline): Improve code. - -2017-01-31 Werner Lemberg - - [cff] Provide metrics variation service interface (#50196). - - Only now I've got an OTF with an HVAR table for testing... - - The code in `ftmm.c' uses `FT_FACE_LOOKUP_SERVICE' to get the - metrics variations interface. However, this didn't work with - `FT_FACE_FIND_GLOBAL_SERVICE' used in `sfnt_init_face'. - - * src/cff/cffdrivr.c: Include FT_SERVICE_METRICS_VARIATIONS_H. - (cff_hadvance_adjust, cff_metrics_adjust): Wrapper functions for - metric service functions from the `truetype' module. - (cff_service_metrics_variations): New service. - (cff_services): Updated. - - * src/cff/cffpic.h (CFF_SERVICE_METRICS_VAR_GET): New macro. - [FT_CONFIG_OPTION_PIC]: Synchronize code. - - * src/sfnt/sfobjs.c (sfnt_init_face): Replace call to - FT_FACE_FIND_GLOBAL_SERVICE with `ft_module_get_service' to always - load the service from the `truetype' module. - -2017-01-31 Werner Lemberg - - Add framework to support services with 9 functions. - - * include/freetype/internal/ftserv.h (FT_DEFINE_SERVICEDESCREC9): - New macro. - -2017-01-31 Werner Lemberg - - [base] Fix error handing in MM functions. - - * src/base/ftmm.c (FT_Set_Var_Design_Coordinates, - FT_Set_MM_Blend_Coordinates, FT_Set_Var_Blend_Coordinates): - Implement it. - -2017-01-31 Werner Lemberg - - [truetype] Fix sanity check for `gvar' table (#50184). - - * src/truetype/ttgxvar.c (ft_var_load_gvar): There might be missing - variation data for some glyphs. - -2017-01-31 Werner Lemberg - - [autofit] Avoid uninitialized jumps (#50191). - - * src/autofit/afcjk.c (af_cjk_metrics_check_digits), - src/autofit/aflatin.c (af_latin_metrics_check_digits): Initialize - `advance'. - -2017-01-27 Werner Lemberg - - s/GB2312/PRC/. - - * include/freetype/freetype.h (FT_ENCODING_PRC): New enum value. - (FT_ENCODING_GB2312): Deprecated. - - * include/freetype/ttnameid.h (TT_MS_ID_PRC): New macro. - (TT_MS_ID_GB2312): Deprecated. - - * src/sfnt/sfobjs.c (sfnt_find_encoding): Updated. - - * docs/CHANGES: Updated. - -2017-01-26 Werner Lemberg - - [base] Add `FT_Get_Sfnt_LangTag' function. - - * include/freetype/ftsnames.h (FT_SfntLangTag): New structure. - (FT_Get_Sfnt_LangTag): New declaration. - - * src/base/ftsnames.c (FT_Get_Sfnt_LangTag): New function. - - * docs/CHANGES: Updated. - -2017-01-26 Werner Lemberg - - [sfnt] Support `name' table format 1. - - * include/freetype/internal/tttypes.h (TT_LangTagRec): New - structure. - (TT_NameTableRec): Add fields `numLangTagRecords' and `langTags'. - - * src/sfnt/ttload.c (tt_face_load_name): Add support for language - tags. - Reduce array size of name strings in case of invalid entries. - (tt_face_free_name): Updated. - - * docs/CHANGES: Updated. - -2017-01-25 Werner Lemberg - - [sfnt] s/TT_NameEntry/TT_Name/. - - * include/freetype/internal/tttypes.h (TT_NameEntryRec): Renamed - to... - (TT_NameRec): This. - (TT_NameTableRec): Updated. - - * src/base/ftsnames.c (FT_Get_Sfnt_Name): Updated. - - * src/sfnt/sfdriver.c (sfnt_get_ps_name): Updated. - - * src/sfnt/sfobjs.c (tt_name_entry_ascii_from_utf16, - tt_name_entry_ascii_from_other): Renamed to... - (tt_name_ascii_from_utf16, tt_name_entry_ascii_from_other): This, - respectively. - (TT_NameEntry_ConvertFunc): Renamed to... - (TT_Name_ConvertFunc): This. - (tt_face_get_name): Updated. - - * src/sfnt/ttload.c (tt_face_load_name, tt_face_free_name): - Updated. - -2017-01-24 Werner Lemberg - - [sfnt] Fix Postscript name service for symbol fonts. - - * src/sfnt/sfdriver.c (sfnt_get_ps_name): Accept PID/EID=3/0 - entries also. - -2017-01-24 Werner Lemberg - - [truetype] For OpenType 1.7: s/preferred/typographic/ (sub)family. - - * include/freetype/ftsnames.h - (FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_FAMILY, - FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_SUBFAMILY): New macros. - (FT_PARAM_TAG_IGNORE_PREFERRED_FAMILY, - FT_PARAM_TAG_IGNORE_PREFERRED_SUBFAMILY): Deprecated. - - * include/freetype/ttnameid.h (TT_NAME_ID_TYPOGRAPHIC_FAMILY, - TT_NAME_ID_TYPOGRAPHIC_SUBFAMILY): New macros. - (TT_NAME_ID_PREFERRED_FAMILY, TT_NAME_ID_PREFERRED_SUBFAMILY): - Deprecated. - - * src/sfnt/sfobjs.c (sfnt_load_face): Updated. - - * docs/CHANGES: Updated. - -2017-01-23 Werner Lemberg - - [base] Add `FT_Set_Default_Properties' (#49187). - - * include/freetype/ftmodapi.h: Add declaration. - - * src/base/ftinit.c (ft_set_default_properties): Renamed to... - (FT_Set_Default_Properties): ... this. - (FT_Init_FreeType): Updated. - - * docs/CHANGES: Updated. - -2017-01-23 Werner Lemberg - - [truetype] Minor updates for OpenType 1.8.1. - - * src/truetype/ttgxvar.h (GX_MVarTable): `axisCount' has been - removed from the specification; it is now reserved. - - * src/truetype/ttgxvar.c (ft_var_load_mvar): Updated. - (GX_FVar_Head): Remove `countSizePairs'; the corresponding data - field in the `MVAR' table is now reserved. - (fvar_fields): Updated. - -2017-01-23 Werner Lemberg - - [truetype] Avoid segfault for invalid variation data. - - * src/truetype/ttgxvar.c (ft_var_load_item_variation_store): Assure - `itemCount' is not zero. - - Reported as - - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=441 - -2017-01-20 Werner Lemberg - - * src/truetype/ttinterp.c (TT_RunIns): Adjust loop detector limits. - -2017-01-17 Werner Lemberg - - * include/freetype/ttnameid.h: Updated to OpenType 1.8.1. - - (TT_APPLE_ID_FULL_UNICODE): New macro. - - (TT_MS_LANGID_BOSNIAN_BOSNIA_HERZ_CYRILLIC, - TT_MS_LANGID_UPPER_SORBIAN_GERMANY, - TT_MS_LANGID_LOWER_SORBIAN_GERMANY, TT_MS_LANGID_IRISH_IRELAND, - TT_MS_LANGID_INUKTITUT_CANADA_LATIN, TT_MS_LANGID_BASHKIR_RUSSIA, - TT_MS_LANGID_LUXEMBOURGISH_LUXEMBOURG, - TT_MS_LANGID_GREENLANDIC_GREENLAND, TT_MS_LANGID_MAPUDUNGUN_CHILE, - TT_MS_LANGID_MOHAWK_MOHAWK, TT_MS_LANGID_BRETON_FRANCE, - TT_MS_LANGID_OCCITAN_FRANCE, TT_MS_LANGID_CORSICAN_FRANCE, - TT_MS_LANGID_ALSATIAN_FRANCE, TT_MS_LANGID_YAKUT_RUSSIA, - TT_MS_LANGID_KICHE_GUATEMALA, TT_MS_LANGID_KINYARWANDA_RWANDA, - TT_MS_LANGID_WOLOF_SENEGAL, TT_MS_LANGID_DARI_AFGHANISTAN): New - macros. - - (TT_MS_LANGID_SERBIAN_BOSNIA_HERZ_CYRILLIC): Fix value. - - (TT_MS_LANGID_GERMAN_LIECHTENSTEIN, TT_MS_LANGID_CATALAN_CATALAN, - TT_MS_LANGID_CHINESE_MACAO, TT_MS_LANGID_SPANISH_SPAIN_MODERN_SORT, - TT_MS_LANGID_KOREAN_KOREA, TT_MS_LANGID_ROMANSH_SWITZERLAND, - TT_MS_LANGID_SLOVENIAN_SLOVENIA, TT_MS_LANGID_BASQUE_BASQUE, - TT_MS_LANGID_SETSWANA_SOUTH_AFRICA, - TT_MS_LANGID_ISIXHOSA_SOUTH_AFRICA, - TT_MS_LANGID_ISIZULU_SOUTH_AFRICA, TT_MS_LANGID_KAZAKH_KAZAKHSTAN, - TT_MS_LANGID_KYRGYZ_KYRGYZSTAN, TT_MS_LANGID_KISWAHILI_KENYA, - TT_MS_LANGID_TATAR_RUSSIA, TT_MS_LANGID_ODIA_INDIA, - TT_MS_LANGID_MONGOLIAN_PRC, TT_MS_LANGID_TIBETAN_PRC, - TT_MS_LANGID_WELSH_UNITED_KINGDOM, TT_MS_LANGID_GALICIAN_GALICIAN, - TT_MS_LANGID_SINHALA_SRI_LANKA, TT_MS_LANGID_TAMAZIGHT_ALGERIA, - TT_MS_LANGID_SESOTHO_SA_LEBOA_SOUTH_AFRICA, TT_MS_LANGID_YI_PRC, - TT_MS_LANGID_UIGHUR_PRC): New aliases. - - Remove commented out code. - - (TT_NAME_ID_LIGHT_BACKGROUND, TT_NAME_ID_DARK_BACKGROUND, - TT_NAME_ID_VARIATIONS_PREFIX): New macros. - - (HAVE_LIMIT_ON_IDENTS): Remove macro (which was useless since many - years), use guarded long macros by default and define short versions - as aliases for the long ones. - -2017-01-15 Werner Lemberg - - * src/truetype/ttgxvar.c (tt_apply_var): Handle underline parameters - also. - -2017-01-11 Werner Lemberg - - * src/base/ftobjs.c (ft_open_face_internal): Improve tracing. - -2017-01-11 Werner Lemberg - - [truetype] Actually use metrics variation service. - - * src/base/ftmm.c: Include FT_SERVICE_METRICS_VARIATIONS_H. - (ft_face_get_mvar_service): New auxiliary function to look up - metrics variation service. - (FT_Set_Var_Design_Coordinates, FT_Set_MM_Blend_Coordinates, - FT_Set_Var_Blend_Coordinates): Call metrics variation service. - - * src/truetype/ttobjs.c (tt_face_init): Use metrics variations for - named instances. - -2017-01-11 Werner Lemberg - - [truetype] Provide metrics variation service. - - * include/freetype/internal/services/svmetric.h - (FT_Metrics_Adjust_Func): Reduce number of necessary parameters. - - * src/truetype/ttgxvar.c: Include FT_LIST_H. - (tt_size_reset_iterator): New auxiliary function for... - (tt_apply_var): New function. - - * src/truetype/ttgxvar.h: Updated. - - * src/truetype/ttdriver.c (tt_service_metrics_variations): Add - `tt_apply_mvar'. - - * include/freetype/internal/ftserv.h (FT_ServiceCache): Add metrics - variation service. - -2017-01-11 Werner Lemberg - - [truetype] Parse `MVAR' table. - - * src/truetype/ttgxvar.h (MVAR_TAG_XXX): New macros for MVAR tags. - (GX_Value, GX_MVarTable): New structures. - (GX_Blend): Add it. - - * src/truetype/ttgxvar.c (GX_VALUE_SIZE, GX_VALUE_CASE, - GX_GASP_CASE): New macros. - (ft_var_get_value_pointer): New auxiliary function to get a pointer - to a value from various SFNT tables already stored in `TT_Face'. - (ft_var_load_mvar): New function. - (TT_Get_MM_Var): Call it. - (tt_done_blend): Updated. - -2017-01-11 Werner Lemberg - - [truetype] More preparations for MVAR support. - - * src/truetype/ttobjs.c (tt_size_reset): Add argument to make - function only recompute ascender, descender, and height. - - * src/truetype/ttobjs.h: Updated. - - * src/truetype/ttdriver.c (tt_size_select, tt_size_request): - Updated. - -2017-01-09 Werner Lemberg - - [pcf] Disable long family names by default. - - * include/freetype/config/ftoption.h - (PCF_CONFIG_OPTION_LONG_FAMILY_NAMES): Comment out. - -2017-01-09 Werner Lemberg - - [pcf] Make long family names configurable. - - The change from 2016-09-29 was too radical (except for people using - the openSuSE GNU/Linux distribution). To ameliorate the situation, - PCF_CONFIG_OPTION_LONG_FAMILY_NAMES gets introduced which controls - the feature; if set, a new PCF property option - `no-long-family-names' can be used to switch this feature off. - - * include/freetype/config/ftoption.h, devel/ftoption.h - (PCF_CONFIG_OPTION_LONG_FAMILY_NAMES): New option. - - * include/freetype/ftpcfdrv.h: New header file (only containing - comments currently, used for building the documentation). - - * include/freetype/config/ftheader.h (FT_PCF_DRIVER_H): New macro. - - * src/pcf/pcf.h (PCF_Driver): Add `no_long_family_names' field. - - * src/pcf/pcfdrivr.c: Include FT_SERVICE_PROPERTIES_H and - FT_PCF_DRIVER_H. - (pcf_property_set, pcf_property_get): New functions. - (pcf_service_properties): New service. - (pcf_services): Updated. - (pcf_driver_init) [PCF_CONFIG_OPTION_LONG_FAMILY_NAMES]: Handle - `no_long_family_names'. - - * src/pcf/pcfread.c (pcf_load_font): Handle `no_long_family_names' - and PCF_CONFIG_OPTION_LONG_FAMILY_NAMES. - - * docs/CHANGES: Updated. - -2017-01-09 Werner Lemberg - - [pcf] Introduce a driver structure. - - To be filled later on with something useful. - - * src/pcf/pcf.h (PCF_Driver): New structure. - - * src/pcf/pcfdrivr.c (pcf_driver_init, pcf_driver_done): New dummy - functions. - (pcf_driver_class): Updated. - -2017-01-08 Werner Lemberg - - [truetype] Again some GX code shuffling. - - We need this later on for MVAR also. - - * src/truetype/ttgxvar.c (tt_hadvance_adjust): Split off computing - an item store variation delta into... - (ft_var_get_item_delta): ...new function. - -2017-01-08 Werner Lemberg - - [truetype] Adjust font variation flags for MVAR. - - * include/freetype/internal/tttypes.h (TT_FACE_FLAG_VAR_XXX): - Remove all flags related to MVAR; replace it with... - (TT_FACE_FLAG_VAR_MVAR): ...this new macro. - (TT_Face): Remove `mvar_support' field (which was still unused). - -2017-01-06 Werner Lemberg - - [truetype] More GX code shuffling. - - We need this later on for MVAR also. - - * src/truetype/ttgxvar.c (tt_done_blend): Split off handling of item - variation store into... - (ft_var_done_item_variation_store): ...new function. - -2017-01-06 Werner Lemberg - - [truetype] More generalization of GX stuff. - - We need this later on for MVAR also. - - * src/truetype/ttgxvar.c (ft_var_load_delta_set_index_mapping): Add - parameters for delta-set index mapping and item variation store. - (ft_var_load_item_variation_store): Add parameter for item variation - store. - s/hvarData/varData/. - Move allocation of `hvar_table' to... - (ft_var_load_hvar): ...this function. - Updated. - -2017-01-06 Werner Lemberg - - [truetype] Some GX structure renames for generalization. - - We need this later on for MVAR also. - - * src/truetype/ttgxvar.h (GX_HVarData): Renamed to... - (GX_ItemVarData): ...this. - (GX_HVarRegion): Renamed to... - (GX_VarRegion): ...this. - (GX_HVStore): Renamed to... - (GX_ItemVarStore): ...this. - (GX_WidthMap): Renamed to... - (GX_DeltaSetIdxMap): ...this. - - (GX_HVarTable): Updated. - - * src/truetype/ttgxvar.c: Updated. - -2017-01-06 Werner Lemberg - - [truetype] Code shuffling. - - * src/truetype/ttgxvar.c (ft_var_load_hvar): Split off loading of - item variation store and delta set index mapping into... - (ft_var_load_item_variation_store, - ft_var_load_delta_set_index_mapping): ...new functions. - -2017-01-06 Werner Lemberg - - [truetype] Add HVAR access without advance width map. - - * src/truetype/ttgxvar.c (ft_var_load_hvar): Handle case where - `offsetToAdvanceWidthMapping' is zero. - (tt_hadvance_adjust): Implement direct deltaSet access by glyph - index. - -2017-01-06 Werner Lemberg - - [pcf] Revise driver. - - This commit improves tracing and handling of malformed fonts. In - particular, the changes to `pcf_get_properties' fix - - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=379 - - * src/pcf/pcfread.c (tableNames): Use long names for better - readability. - (pcf_read_TOC): Allow at most 9 tables. - (pcf_get_properties): Allow at most 256 properties. - Limit strings array length to 256 * (65536 + 1) bytes. - Better tracing. - (pcf_get_metric): Trace metric data. - (pcf_get_metrics): Allow at most 65536 metrics. - Fix comparison of `metrics->ascent' and `metrics->descent' to avoid - potential overflow. - Better tracing. - (pcf_get_bitmaps): Allow at most 65536 bitmaps. - Better tracing. - (pcf_get_encodings, pcf_get_accel): Better tracing. - - * src/pcf/pcfdrivr.c (PCF_Glyph_Load): Don't trace `format' details. - These are now shown by `pcf_get_bitmaps'. - -2017-01-04 Werner Lemberg - - * src/pcf/pcfdrivr.c (PCF_Face_Init): Trace compression format. - -2017-01-04 Werner Lemberg - - [cff] More consistency checks for pure CFFs. - - Reported as - - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=378 - - * src/cff/cffload.c (cff_font_load): Check element number and size - of Name and Top DICT indices. - -2017-01-04 Werner Lemberg - - [cff, truetype] Minor tracing improvement. - - * src/cff/cffobjs.c (cff_face_init), src/truetype/ttobjs.c - (tt_face_init): Indent first tracing message from SFNT driver. - -2017-01-03 Werner Lemberg - - [truetype] Various minor fixes. - - * src/truetype/ttgload.c (TT_Load_Simple_Glyph): Check instruction - size only if we do native hinting. - (TT_Load_Glyph): Trace returned error code. - - * src/truetype/ttobjs.c (tt_size_run_fpgm, tt_size_run_prep): Trace - returned error code. - (tt_size_ready_bytecode): Don't run `prep' table if `fpgm' table is - invalid. - -2017-01-03 Werner Lemberg - - [sfnt] Don't fail if PCLT, EBLC (and similar tables) are invalid. - - These tables are optional. - - * src/sfnt/sfobjs.c (sfnt_load_face): Implement it. - -2017-01-03 Werner Lemberg - - * src/cff/cffparse.c (cff_parse_num): Simplify. - -2017-01-03 Werner Lemberg - - Various fixes for clang's undefined behaviour sanitizer. - - * src/cff/cffload.c (FT_fdot14ToFixed): Fix casting. - (cff_blend_doBlend): Don't left-shift negative numbers. - Handle 5-byte numbers byte by byte to avoid alignment issues. - - * src/cff/cffparse.c (cff_parse_num): Handle 5-byte numbers byte by - byte to avoid alignment issues. - - * src/cid/cidload (cid_read_subrs): Do nothing if we don't have any - subrs. - - * src/psaux/t1decode.c (t1_decode_parse_charstring): Fix tracing. - - * src/tools/glnames.py (main): Put `DEFINE_PSTABLES' guard around - definition of `ft_get_adobe_glyph_index'. - - * src/psnames/pstables.h: Regenerated. - - * src/psnames/psmodule.c: Include `pstables.h' twice to get both - declaration and definition. - - * src/truetype/ttgxvar.c (FT_fdot14ToFixed, FT_intToFixed): Fix - casting. - -2017-01-01 Werner Lemberg - - [cff] Handle multiple `blend' operators in a row correctly. - - Reported as - - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=368 - - * src/cff/cffload.c (cff_blend_doBlend): Adjust `parser->stack' - pointers into `subFont->blend_stack' after reallocation. - -2017-01-01 Werner Lemberg - - [sfnt] Return correct number of named instances for TTCs. - - Without this patch, requesting information for face index N returned - the data for face index N+1 (or index 0). - - * src/sfnt/sfobjs.c (sfnt_init_face): Correctly adjust `face_index' - for negative `face_instance_index' values. - -2016-12-31 Werner Lemberg - - */*: Use hex numbers for errors in tracing messages. - -2016-12-31 Werner Lemberg - - [truetype] Check axis count in HVAR table. - - Reported as - - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=362 - - * src/truetype/ttgxvar.c (ft_var_load_hvar): Check axis count. - (ft_var_load_avar): Fix tracing message. - ---------------------------------------------------------------------------- -Copyright 2016-2018 by +Copyright 2017-2018 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, modified, diff --git a/ChangeLog.28 b/ChangeLog.28 new file mode 100644 index 000000000..ca1ff3850 --- /dev/null +++ b/ChangeLog.28 @@ -0,0 +1,3136 @@ +2017-09-16 Werner Lemberg + + * Version 2.8.1 released. + ========================= + + + Tag sources with `VER-2-8-1'. + + * docs/VERSION.TXT: Add entry for version 2.8.1. + * docs/CHANGES: Updated. + + * README, Jamfile (RefDoc), builds/windows/vc2005/freetype.vcproj, + builds/windows/vc2005/index.html, + builds/windows/vc2008/freetype.vcproj, + builds/windows/vc2008/index.html, + builds/windows/vc2010/freetype.vcxproj, + builds/windows/vc2010/index.html, + builds/windows/visualc/freetype.dsp, + builds/windows/visualc/freetype.vcproj, + builds/windows/visualc/index.html, + builds/windows/visualce/freetype.dsp, + builds/windows/visualce/freetype.vcproj, + builds/windows/visualce/index.html, + builds/wince/vc2005-ce/freetype.vcproj, + builds/wince/vc2005-ce/index.html, + builds/wince/vc2008-ce/freetype.vcproj, + builds/wince/vc2008-ce/index.html: s/2.8/2.8.1/, s/28/281/. + + * include/freetype/freetype.h (FREETYPE_PATCH): Set to 1. + + * builds/unix/configure.raw (version_info): Set to 21:0:15. + * CMakeLists.txt (VERSION_PATCH): Set to 1. + +2017-09-13 suzuki toshiya + + [sfnt] lowest gcc for vectors (e1d0249e) is changed to 4.7. + + __builtin_shuffle() was introduced in gcc-4.7. The lowest + gcc to enable vector operation is delayed from 4.6 to 4.7. + + * src/sfnt/pngshim.c (premultiply_data): Fix cpp-macro to + enable the vector operation, to change the lowest gcc version + from 4.6 to 4.7. + +2017-09-13 suzuki toshiya + + [cache] Fix a possible overflow by signed integer comparison. + + Improve the code by 5d3ff05615dda6d1325ed612381a17a0df04c975 , + issues are found by Behdad Esfahbod and Werner Lemberg. + + * src/cache/ftcbasic.c (FTC_ImageCache_Lookup): Replace + a subtraction to check higher bit by a bit operation, + and cpp-conditionalize for appropriate systems. Add better + documentation to the comment. + (FTC_ImageCache_LookupScaler): Ditto. + (FTC_SBitCache_Lookup): Ditto. + (FTC_SBitCache_LookupScaler): Ditto. + +2017-09-13 Werner Lemberg + + [autofit] Really fix #41334 (#52000). + + * src/autofit/aflatin.c (af_latin_hints_compute_segments): Set + `segment->delta' everywhere. + +2017-09-12 suzuki toshiya + + [autofit, sfnt] Fix for `make multi'. + + * src/autofit/afshaper.c: Include FT_ADVANCE_H, to use + FT_Get_Advance() in it. + * src/sfnt/ttcmap.c: Include FT_SERVICE_POSTSCRIPT_CMAPS_H + to use PS_Unicodes in it, also include `ttpost.h' to use + tt_face_get_ps_name() in it. + +2017-09-11 Azzuro + + [build] Improve builds with different MS Visual Studio versions. + + * builds/windows/vc2010/freetype.vcxproj: Switch platform toolset + according to the Visual Studio version. + +2017-09-11 Werner Lemberg + + * src/sfnt/ttkern.c (tt_face_load_kern): Reject format 2 tables. + + Reported by Behdad. + +2017-09-09 Werner Lemberg + + [autofit] Improve communication with ftgrid. + + * src/autofit/afhints.c (af_glyph_hints_get_segment_offset): + Provide values in font units. + +2017-09-08 suzuki toshiya + + [base] Remove a check for resource ID in the resource fork driver. + + LastResort.dfont has a marginal resource ID 0xFFFF for sfnt + resource. Inside Macintosh: More Macintosh Toolbox, `Resource IDs' + (1-46), tells that some IDs are reserved and should not be used. + FreeType2 just uses resource ID to sort the fragmented resource. + To accept the marginal fonts, the checking is removed. + + * src/base/ftrfork.c (FT_Raccess_Get_DataOffsets): Remove res_id + validity check, fix a trace message format. + +2017-09-08 suzuki toshiya + + [sfnt, truetype] Register the tags for marginal fonts. + + The first 32bit of standard TrueType variants is 0x00010000, + `OTTO', `ttcf', `true' or `typ1'. 2 marginal dfonts on legacy Mac + OS X, Keyboard.dfont and LastResort.dfont, have the sfnt resources + starting 0xA5 followed by `kbd' or `lst'. Considering the following + data could be parsed as conventional TrueType fonts, the header + checking is updated to allow these tags. It seems that recent Mac + OS X has already switched to normal TTF for these fonts. + + See the discussion at + http://u88.n24.queensu.ca/exiftool/forum/index.php?topic=3931.0 + + * include/freetype/tttags.h (TTAG_0xA5kbd, TTAG_0xA5lst): New header + tags for Keyboard.dfont and LastResort.dfont. + * src/sfnt/sfobjs.c (sfnt_open_font): Accept the sfnt resource + starts with TTAG_0xA5kbd or TTAG_0xA5lst. + * src/truetype/ttobjs.c (tt_face_init): Accept the face with the + format tag is TTAG_0xA5kbd or TTAG_0xA5lst. + +2017-09-05 Werner Lemberg + + Fix multiple calls of `FT_Bitmap_Convert'. + + The documentation of `FT_Bitmap_Convert' says that multiple calls do + proper reallocation of the target FT_Bitmap object. However, this + failed for the sequence + + non-empty bitmap + empty bitmap + non-empty bitmap + + Reason was that `FT_Bitmap_Convert' only reallocated the bitmap + buffer if it became too small; it didn't make the buffer smaller. + For an empty bitmap following a non-empty one, only the buffer + dimension got set to zero, without deallocation. If the next call + was a non-empty buffer again, an assertion in `ft_mem_qrealloc' was + triggered. + + * src/base/ftbitmap.c (FT_Bitmap_Convert): Always reallocate target + buffer to the correct size. + + * docs/CHANGES: Document it. + +2017-09-05 Werner Lemberg + + [bdf] Fix size and resolution handling. + + * src/bdf/bdfdrivr.c (BDF_Face_Init): Use `SIZE' values if + `POINT_SIZE', `RESOLUTION_X', or `RESOLUTION_Y' properties are + missing. + + * docs/CHANGES: Document it. + +2017-08-25 Alexei Podtelezhnikov + + Swap `ALLOC_MULT' arguments (#51833). + + * src/base/ftbitmap.c (ft_bitmap_assure_buffer): Updated. + * src/winfonts/winfnt.c (FNT_Load_Glyph): Updated. + * src/raster/ftrend1.c (ft_raster1_render): Updated. + +2017-08-23 Werner Lemberg + + [sfnt] Fix clang compilation (#51788). + + * src/sfnt/pngshim.c (premultiply_data): Use vectors instead of + scalars. + (vector_shuffle): New macro to take care of a different built-in + function name on clang. + +2017-08-22 Werner Lemberg + + [base] Don't zero out allocated memory twice (#51816). + + Patch applied from bug report. + + * src/base/ftutil.c (ft_mem_qrealloc): Use low-level allocation to + avoid unnecessary overhead. + +2017-08-22 Werner Lemberg + + [truetype] Integer overflow. + + Changes triggered by + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3107 + + * src/truetype/ttinterp.c (Ins_MDRP, Ins_MIRP, Ins_ALIGNPTS): Use + NEG_LONG. + +2017-08-17 Alexei Podtelezhnikov + + [sfnt] Avoid synthetic unicode for symbol fonts with PUA. + + Reported as + + https://bugs.chromium.org/p/chromium/issues/detail?id=754574 + + * src/sfnt/sfobjs.c (sfnt_load_face): Check for FT_ENCODING_MS_SYMBOL. + +2017-08-16 Werner Lemberg + + * src/sfnt/pngshim.c (premultiply_data): Fix compiler warnings. + +2017-08-15 Behdad Esfahbod + + [sfnt] Speed up PNG image loading. + + This reduces the overhead of `premultiply_data' by 60%. + + * src/sfnt/pngshim.c (premultiply_data): Provide code which uses + gcc's (and clang's) `vector_byte' attribute to process 4 pixels at a + time. + +2017-08-11 Werner Lemberg + + [sfnt, truetype] Improve handling of missing sbits. + + Requested by Behdad. + + Modern bitmap-only SFNTs like `NotoColorEmoji.ttf' don't contain + entries in the bitmap strike(s) for empty glyphs. Instead, they + rely that a space glyph gets created from the font's metrics data. + This commit makes FreeType behave accordingly. + + * include/freetype/fterrdef.h (FT_Err_Missing_Bitmap): New error + code. + + * src/sfnt/ttsbit.c (tt_sbit_decoder_load_image): Change error codes + to make a distinction between a missing bitmap in a composite and a + simple missing bitmap. + + * src/truetype/ttgload.c (TT_Load_Glyph): For a missing bitmap (in a + bitmap-only font), synthesize an empty bitmap glyph if metrics are + available. + +2017-08-10 Werner Lemberg + + [base] Minor API improvement for default variation axis setting. + + * src/base/ftmm.c (FT_Set_MM_Design_Coordinates, + FT_Set_Var_Design_Coordinates, FT_Set_MM_Blend_Coordinates, + FT_Set_Var_Blend_Coordinates): Allow coords==NULL if num_coords==0. + + * docs/CHANGES: Updated. + +2017-08-08 Werner Lemberg + + [psnames] Really fix issue #49949. + + We now use a separate preprocessor macro to handle both definition + and declaration of the glyph name arrays. + + * src/psnames/psmodule.c (DEFINE_PS_TABLE_DATA): New macro. + + * src/tools/glnames.py (StringTable::dump, + StringTable::dump_sublist): Use `DEFINE_PS_TABLE_DATA'. + (dump_encoding): Ditto. + (main): Use `wb' mode for writing the output file, which works on + Windows also. + + * src/psnames/pstables.h: Regenerated. + +2017-08-08 Alexei Podtelezhnikov + + [smooth] Harmony LCD rendering. + + This is a new technology for LCD-optimized rendering. It capitalizes + on the fact that each color channel grid is shifted by a third of a + pixel. Therefore it is logical to render 3 separate monochrome + bitmaps shifting the outline by 1/3 pixel, and then combine them. + Importantly, the resulting output does not require additional LCD + filtering. + + * src/smooth/ftsmooth.c (ft_smooth_render_generic) + [!FT_CONFIG_OPTION_SUBPIXEL_RENDERING]: Implement new LCD-optimized + rendering. + + * include/freetype/ftlcdfil.h, include/freetype/freetype.h, + include/freetype/config/ftoption.h, devel/ftoption.h: Updated + documentation. + +2017-08-08 Alexei Podtelezhnikov + + * src/smooth/ftsmooth.c (ft_smooth_render_generic): Clean up. + +2017-08-08 Alexei Podtelezhnikov + + * src/sfnt/ttpost.c (format): Use otspec-compliant versions. + +2017-08-05 Werner Lemberg + + [truetype] Integer overflow. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2868 + + * src/truetype/ttinterp.c (Ins_ALIGNRP): Use NEG_LONG. + +2017-08-05 Werner Lemberg + + [base, truetype] New function `FT_Get_Var_Axis_Flags'. + + The reserved `flags' field got a value in OpenType version 1.8.2; + unfortunately, the public `FT_Var_Axis' structure misses the + corresponding element. Since we can't add a new field, we add an + access function. + + * src/base/ftmm.c (FT_Get_Var_Axis_Flags): New function. + + * include/freetype/ftmm.h (FT_VAR_AXIS_FLAG_HIDDEN): New macro. + Updated. + + * src/truetype/ttgxvar.c (TT_Get_MM_Var): Increase allocated memory + of `mmvar' to hold axis flags. + Fill the axis flags array. + + * docs/CHANGES: Updated. + +2017-08-03 Nikolaus Waxweiler + + [truetype] Fix metrics of B/W hinting in v40 mode. + + Phantom points are now saved outside v40 backwards compatibility + mode. This fixes the jumping glyphs when switching between v35 and + v40 monochrome mode. + + * src/truetype/ttgload.c (TT_Hint_Glyph): Fix inversed bool logic. + +2017-08-03 Nikolaus Waxweiler + + [truetype] Do not set any ClearType flags in v40 monochrome mode. + + This fixes weird behavior of instructions that resulted in rendering + differences between v35 and v40 in monochrome mode, e.g., in + `timesbi.ttf'. + + * src/truetype/ttinterp.c (Ins_GETINFO) + [TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL]: Check + `subpixel_hinting_lean'. + +2017-08-01 Werner Lemberg + + * src/truetype/ttgxvar.c (TT_Get_MM_Var): Fix thinko. + +2017-08-01 Behdad Esfahbod + + [truetype] Fix loading of named instances. + + * src/truetype/ttgxvar.c (TT_Get_MM_Var): Preserve file position + while loading the `avar' table. + +2017-08-01 Werner Lemberg + + [sfnt, truetype] Minor adjustments for OpenType 1.8.2. + + * src/sfnt/sfobjs.c (sfnt_load_face): The units per EM value has now + (tighter) limits. + + * src/truetype/ttgload.c (load_truetype_glyph): The new OpenType + version explicitly allows all negative values for the number of + contours if we have a composite glyph (this is for better backwards + compatibility I guess), but it still recommends value -1. + +2017-07-26 Werner Lemberg + + [cff] Integer overflow. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2738 + + * src/cff/cf2hints.c (cf2_glyphpath_computeOffset, + cf2_glyphpath_curveTo): Use ADD_INT32. + +2017-07-13 Werner Lemberg + + [base] Fix memory leak. + + Reported as + + https://bugs.chromium.org/p/chromium/issues/detail?id=738362 + + * src/base/ftglyph.c (FT_Get_Glyph): Do proper deallocation in case + of error. + +2017-07-12 Werner Lemberg + + [base] Integer overflow. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2573 + + * src/base/ftobjs.c (ft_glyphslot_grid_fit_metrics): Use + FT_PIX_CEIL_LONG and FT_PIX_ROUND_LONG. + +2017-07-12 Werner Lemberg + + * src/truetype/ttpload.c (tt_face_get_location): Off-by-one typo. + + Also improve tracing message. + + Problem reported as + + https://bugs.chromium.org/p/chromium/issues/detail?id=738919 + +2017-07-07 Werner Lemberg + + [cff] Integer overflow. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2517 + + * src/cff/cf2blues.c (cf2_blues_capture): Use SUB_INT32. + +2017-07-05 Werner Lemberg + + * src/sfnt/ttcmap.c (tt_cmap_unicode_class_rec): Fix warning. + +2017-07-05 Werner Lemberg + + * src/truetype/ttgxvar.c (FT_Stream_SeekSet): Fix warning (#51395). + +2017-07-04 Werner Lemberg + + [truetype] Prevent address overflow (#51365). + + * src/truetype/ttgxvar.c (FT_Stream_SeekSet): Add guard. + +2017-07-03 Alexei Podtelezhnikov + + * src/base/ftlcdfil.c (ft_lcd_filter_fir): Improve code. + +2017-07-03 Werner Lemberg + + [truetype] Integer overflow. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2455 + + * src/truetype/ttinterp.c (Ins_SCFS): Use SUB_LONG. + +2017-07-01 Alexei Podtelezhnikov + + * src/sfnt/sfobjs.c (sfnt_load_face): Ignore No_Unicode_Glyph_Name. + +2017-06-28 Ben Wagner + + Avoid Microsoft compiler warnings (#51331). + + While clang's sanitizer recommends a cast to unsigned for safe + negation (to handle -INT_MIN), both MSVC and Visualc emit warning + C4146 if an unsigned value gets negated. + + * include/freetype/internal/ftcalc.h (NEG_LONG, NEG_INT32), + src/base/ftcalc.c (FT_MOVE_SIGN): Replace negation with a + subtraction. + +2017-06-27 Werner Lemberg + + * src/cff/cffparse.c (do_fixed): Fix typo. + + Spotted by chris . + +2017-06-27 Werner Lemberg + + [truetype] Integer overflows. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2384 + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2391 + + * src/base/ftcalc.c (FT_MulDiv, FT_MulDiv_No_Round, FT_DivFix): Use + NEG_LONG. + + * src/truetype/ttinterp.c (Ins_SxVTL): Use NEG_LONG. + +2017-06-24 Werner Lemberg + + [truetype] Integer overflows. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2364 + + * src/truetype/ttinterp.c (Ins_ISECT): Use NEG_LONG. + +2017-06-22 Werner Lemberg + + [cff, truetype] Integer overflows. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2323 + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2328 + + * src/cff/cf2blues.c (cf2_blues_capture): Use ADD_INT32 and + SUB_INT32. + + * src/truetype/ttinterp.c (Ins_SDPVTL): Use SUB_LONG and NEG_LONG. + +2017-06-21 Alexei Podtelezhnikov + + [sfnt] Synthesize a Unicode charmap if one is missing. + + * src/sfnt/ttcmap.h (tt_cmap_unicode_class_rec): Declare it. + * src/sfnt/ttcmap.c (tt_get_glyph_name, tt_cmap_unicode_init, + tt_cmap_unicode_done, tt_cmap_unicode_char_index, + tt_cmap_unicode_char_next, tt_cmap_unicode_class_rec): Implement + synthetic Unicode charmap class. + (tt_get_cmap_info): Make sure the callback is available. + + * src/sfnt/sfobjs.c (sfnt_load_face) + [FT_CONFIG_OPTION_POSTSCRIPT_NAMES]: If Unicode charmap is missing, + synthesize one. + + * include/freetype/config/ftoption.h: Document it. + * devel/ftoption.h: Ditto. + +2017-06-20 Tony Theodore + + Fix pkg-config in freetype-config for cross-compiling (#51274). + + * builds/unix/unix-def.in (PKG_CONFIG): New variable. + (freetype-config): Use it in sed expression. + + * builds/unix/freetype-config.in: s/pkg-config/%PKG_CONFIG%/. + +2017-06-20 Werner Lemberg + + [cff, truetype] Integer overflows. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2300 + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2313 + + * src/cff/cf2hints.c (cf2_hintmap_adjustHints): Use ADD_INT32. + + * src/truetype/ttinterp.c (Ins_ABS): Avoid FT_ABS. + +2017-06-17 Alexei Podtelezhnikov + + [base, smooth] LCD filtering cleanups. + + * src/base/ftlcdfil.c (ft_lcd_filter_fir, _ft_lcd_filter_legacy): + Clean up, start filtering from the bottom-left origin. + + * src/smooth/ftsmooth.c (ft_smooth_render_generic): Updated. + +2017-06-16 Werner Lemberg + + [truetype] Integer overflows. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2270 + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2276 + + * src/truetype/ttinterp.c (Ins_MDRP, _iup_worker_interpolate): Use + ADD_LONG and SUB_LONG. + +2017-06-15 Werner Lemberg + + [bdf, cff] Integer overflows. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2244 + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2261 + + * src/bdf/bdfdrivr.c (BDF_Face_Init): Replace calls to FT_ABS with + direct code to avoid value negation. + + * src/cff/cf2blues.c (cf2_blues_capture): Use SUB_INT32 and + ADD_INT32. + +2017-06-13 Werner Lemberg + + * src/winfonts/winfnt.c (FNT_Face_Init): Don't set active encoding. + + FreeType only sets a default active encoding for Unicode. + +2017-06-13 Werner Lemberg + + [cff, truetype] Integer overflows. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2216 + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2218 + + * src/cff/cf2fixed.h (cf2_fixedAbs): Use NEG_INT32. + + * src/truetype/ttinterp.c (Ins_IP): Use SUB_LONG. + +2017-06-11 Werner Lemberg + + [cff] Integer overflows. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2200 + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2210 + + * src/cff/cf2hints.c (cf2_hintmap_insertHint): Use SUB_INT32 and + ADD_INT32. + + * src/cff/cf2intrp.c (cf2_interpT2CharString) : Use + ADD_INT32. + +2017-06-10 Werner Lemberg + + [truetype] Fix TT_Set_Var_Design. + + Reported by Nikolaus Waxweiler . + + * src/truetype/ttgxvar.c (TT_Set_Var_Design): Correctly handle the + case where we have less input coordinates than axes. + +2017-06-10 Werner Lemberg + + * src/base/ftcalc.c (FT_DivFix): Fix embarrassing typo. + + Bug introduced 2017-05-28. + +2017-06-09 Werner Lemberg + + [cff, truetype] Integer overflows. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2144 + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2151 + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2153 + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2173 + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2186 + + * src/cff/cf2blues.c (cf2_blues_init): Use SUB_INT32. + + * src/truetype/ttinterp.c (Round_None, Round_To_Grid, + Round_To_Half_Grid, Round_Down_To_Grid, Round_Up_To_Grid, + Round_To_Double_Grid, Round_Super, Round_Super_45): Use ADD_LONG, + SUB_LONG, NEG_LONG, FT_PIX_ROUND_LONG, FT_PIX_CEIL_LONG, + FT_PAD_ROUND_LONG + (Ins_SxVTL, Ins_MIRP): Use SUB_LONG. + (_iup_worker_shift): Use SUB_LONG and ADD_LONG. + +2017-06-09 Werner Lemberg + + Provide more macros for flooring, ceiling, and rounding. + + These versions don't produce run-time errors due to integer + overflow. + + * include/freetype/internal/ftobjs.h: Include FT_INTERNAL_CALC_H. + (FT_PAD_ROUND_LONG, FT_PAD_CEIL_LONG, FT_PIX_ROUND_LONG, + FT_PIX_CEIL_LONG): New macros. + (FT_PAD_ROUND_INT32, FT_PAD_CEIL_INT32, FT_PIX_ROUND_INT32, + FT_PIX_CEIL_INT32): New macros. + +2017-06-09 Werner Lemberg + + Remove unused macros. + + * include/freetype/internal/ftcalc.h (ADD_INT, SUB_INT, MUL_INT, + NEG_INT): Deleted. + +2017-06-09 Werner Lemberg + + */*: Remove `OVERFLOW_' prefix. + + This increases readability. + +2017-06-07 Werner Lemberg + + [cff, truetype] Integer overflows. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2133 + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2137 + + * src/cff/cf2hints.c (cf2_hint_init): Use OVERFLOW_SUB_INT32. + + * src/truetype/ttinterp.c (PROJECT, DUALPROJ): Use + OVERFLOW_SUB_LONG. + +2017-06-06 Werner Lemberg + + [cff] Integer overflows. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2109 + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2110 + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2122 + + * src/cff/cf2blues.c (cf2_blues_init): Use OVERFLOW_SUB_INT32. + + * src/cff/cf2hints.c (cf2_hintmap_map): Synchronize if-else + branches. + +2017-06-05 Werner Lemberg + + [cff] Integer overflow. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2089 + + * src/cff/cffload.c (cff_blend_doBlend): User OVERFLOW_ADD_INT32. + +2017-06-04 Werner Lemberg + + [cff, truetype] Integer overflows. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2075 + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2088 + + * src/cff/cf2font.c (cf2_font_setup): Use OVERFLOW_MUL_INT32. + + * src/truetype/ttinterp.c (Ins_ISECT): Use OVERFLOW_MUL_LONG, + OVERFLOW_ADD_LONG, and OVERFLOW_SUB_LONG. + +2017-06-03 Werner Lemberg + + [base, cff, truetype] Integer overflows. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2060 + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2062 + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2063 + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2068 + + * src/base/ftobjs.c (ft_glyphslot_grid_fit_metrics): Use + OVERFLOW_ADD_LONG and OVERFLOW_SUB_LONG. + + * src/cff/cf2blues.c (cf2_blues_capture), src/cff/cf2hints.c + (cf2_hintmap_adjustHints): Use OVERFLOW_SUB_INT32. + + * src/truetype/ttgload.c (compute_glyph_metrics): User + OVERFLOW_SUB_LONG. + + * src/truetype/ttinterp.c (Direct_Move, Direct_Move_Orig, + Direct_Move_X, Direct_Move_Y, Direct_Move_Orig_X, + Direct_Move_Orig_Y, Move_Zp2_Point, Ins_MSIRP): Use + OVERFLOW_ADD_LONG and OVERFLOW_SUB_LONG. + +2017-06-03 Werner Lemberg + + * builds/unix/freetype-config.in: Fix pkg-config test (#51162). + + Patch directly taken from bug report. + +2017-06-03 Werner Lemberg + + [bdf] Synchronize sanity checks with pcf driver. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2054 + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2058 + + * src/bdf/bdfdrivr.c (BDF_Face_Init): Check font ascent and descent. + Check AVERAGE_WIDTH, POINT_SIZE, PIXEL_SIZE, RESOLUTION_X, and + RESOLUTION_Y properties. + +2017-06-03 Werner Lemberg + + [cff, truetype] Integer overflows. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2047 + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2057 + + * src/cff/cf2hints.c (cf2_hintmap_map): Use OVERFLOW_SUB_INT32. + + * src/truetype/ttinterp.c (Ins_ADD): Use OVERFLOW_ADD_LONG. + (Ins_SUB): Use OVERFLOW_SUB_LONG. + (Ins_NEG): Use NEG_LONG. + +2017-06-03 Werner Lemberg + + ftcalc.h: Avoid left-shift of negative numbers. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2055 + + * include/freetype/internal/ftcalc.h (INT_TO_F26DOT6, + INT_TO_F2DOT14, INT_TO_FIXED, F2DOT14_TO_FIXED): Use multiplication. + +2017-06-02 Werner Lemberg + + [cff] Even more integer overflows. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2046 + + * src/cff/cf2intrp.c (cf2_doStems, cf2_interpT2CharString): Use + OVERFLOW_ADD_INT32. + +2017-06-02 Werner Lemberg + + [cff] More integer overflows. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2032 + + * src/cff/cf2blues.c (cf2_blues_init): Use OVERFLOW_SUB_INT32. + +2017-06-02 Werner Lemberg + + [bdf] Don't left-shift negative numbers. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2031 + + * src/bdf/bdfdrivr.c (BDF_Face_Init): Use multiplication. + +2017-06-02 Werner Lemberg + + [bdf] Fix integer scanning routines. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2029 + + * src/bdf/bdflib.c (_bdf_atoul, _bdf_atol, _bdf_atous, _bdf_atos): + Stop scanning if result would overflow. + +2017-06-02 Werner Lemberg + + [cff] Fix integer overflows. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2027 + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2028 + + * src/cff/cf2hints.c (cf2_hintmap_insertHint), src/cff/cf2intrp.c + (cf2_doFlex): Use OVERFLOW_ADD_INT32 and OVERFLOW_SUB_INT32. + +2017-06-01 Werner Lemberg + + [smooth] Some 32bit integer overflow run-time errors. + + * src/smooth/ftgrays.c [STANDALONE] (OVERFLOW_ADD_LONG, + OVERFLOW_SUB_LONG, OVERFLOW_MUL_LONG, NEG_LONG): New macros. + [!STANDALONE]: Include FT_INTERNAL_CALC_H. + (gray_render_cubic): Use those macros where appropriate. + +2017-06-01 Werner Lemberg + + * src/base/ftglyph.c (FT_Get_Glyph): Check `slot->advance'. + +2017-06-01 Werner Lemberg + + [psaux] 32bit integer overflow tun-time errors (#46149). + + * src/psaux/t1decode.c (t1_decoder_parse_charstrings): Use + OVERFLOW_ADD_LONG and OVERFLOW_SUB_LONG where appropriate. + +2017-06-01 Werner Lemberg + + * src/truetype/ttinterp.c (TT_RunIns): Adjust loop counter again. + + Problem reported by Marek KaĹĄĂ­k . + + The problematic font that exceeds the old limit is Padauk-Bold, + version 3.002, containing bytecode generated by a buggy version of + ttfautohint. + +2017-05-31 Werner Lemberg + + [cff] 32bit integer overflow run-time errors 2/2 (#46149). + + This commit handles the new engine. + + * include/freetype/internal/ftcalc.h (OVERFLOW_ADD_INT32, + OVERFLOW_SUB_INT32, OVERFLOW_MUL_INT32, NEG_INT, NEG_LONG, + NEG_INT32): New macros. + + * src/cff/cf2ft.c (cf2_getScaleAndHintFlag): Use OVERFLOW_ADD_INT32. + + * src/cff/cf2hints.c (cf2_getWindingMomentum, cf2_hint_init, + cf2_hintmap_map, cf2_glyphpath_hintPoint, + cf2_glyphpath_computeIntersection, cf2_glyphpath_computeOffset, + cf2_glyphpath_lineTo, cf2_glyphpath_curveTo): Use + OVERFLOW_ADD_INT32, OVERFLOW_SUB_INT32, OVERFLOW_MUL_INT32, and + NEG_INT32 where appropriate. + + * src/cff/cf2intrp.c (cf2_doFlex, cf2_doBlend, + cf2_interpT2CharString): Ditto. + Also add some other code where needed to avoid overflow. + +2017-05-30 Werner Lemberg + + [cff] 32bit integer overflow run-time errors 1/2 (#46149). + + This commit handles the old engine. + + * src/cff/cffgload.c: Include FT_INTERNAL_CALC_H. + (cff_decoder_parse_charstrings): Use OVERFLOW_ADD_LONG and + OVERFLOW_SUB_LONG where needed. + + * src/cff/cffparse.c: Include FT_INTERNAL_CALC_H. + (power_ten_limits): New static array. + (do_fixed): Use it to prevent multiplication overflow. + (cff_parser_run): Use OVERFLOW_ADD_LONG. + +2017-05-30 Werner Lemberg + + [psaux] Correctly handle sequences of multiple number signs. + + * src/psaux/psconv.c (PS_Conv_Strtol, PS_Conv_ToFixed): Return zero + if we encounter more than a single sign. + +2017-05-29 Werner Lemberg + + [pcf] 32bit integer overflow run-time errors (#46149). + + * src/pcf/pcfread.c (pcf_get_accel): Add sanity checks for + `fontAscent' and `fontDescent'. + (pcf_load_font): Add sanity checks for global height. + Add sanity checks for AVERAGE_WIDTH, POINT_SIZE, PIXEL_SIZE, + RESOLUTION_X, and RESOLUTION_Y properties. + +2017-05-29 Werner Lemberg + + Handle some integer overflow run-time errors (#46149, #48979). + + This commit (mainly for 32bit CPUs) is the first of a series of + similar commits to handle known integer overflows. Basically, all + of them are harmless, since they affect rendering of glyphs only, + not posing security threats. It is expected that fuzzying will show + up more overflows, to be fixed in due course. + + The idea is to mark places where overflows can occur, using macros + that simply cast to unsigned integers, because overflow arithmetic + is well defined in this case. Doing so suppresses run-time errors + of sanitizers without adding computational overhead. + + * include/freetype/internal/ftcalc.h (OVERFLOW_ADD_INT, + OVERFLOW_SUB_INT, OVERFLOW_MUL_INT, OVERFLOW_ADD_LONG, + OVERFLOW_SUB_LONG, OVERFLOW_MUL_LONG): New macros. + + * src/base/ftcalc.c (FT_RoundFix, FT_CeilFix, FT_Matrix_Multiply, + FT_Matrix_Multiply_Scaled, FT_Vector_Transform_Scaled, + ft_corner_orientation): Use new macros. + + * src/base/ftoutln.c (FT_Outline_Get_Orientation): Use new macros. + +2017-05-28 Werner Lemberg + + * include/freetype/internal/ftcalc.h (FLOAT_TO_FIXED): Remove. + + This macro is not used. + +2017-05-28 Werner Lemberg + + [cff] s/cf2_floatToFixed/cf2_doubleToFixed/. + + The new name better describes what the macro actually does; + additionally, we don't need a trailing `f' for literals (there was + only a single such instance in the code, but this caused a clang + warning because the macro itself uses `double' literals). + + * src/cff/cf2blues.c, src/cff/cf2blues.h, src/cff/cf2fixed.h, + src/cff/cf2font.c, src/cff/cf2hints.c: Updated. + +2017-05-28 Werner Lemberg + + Fix negation of INT_MIN and LONG_MIN (#46149). + + * src/base/ftcalc.c (FT_MOVE_SIGN): Add argument to pass unsigned + value, to be used as the result. + (FT_MulDiv, FT_MulDiv_No_Round, FT_DivFix, FT_MulFix, + FT_Vector_NormLen): Updated. + +2017-05-27 Werner Lemberg + + [truetype] Fix handling of design coordinates (#51127). + + * src/truetype/ttgxvar.c (tt_set_mm_blend): Compute all design + coordinates if we have to create the `blends->coord' array. + (TT_Get_MM_Blend, TT_Get_Var_Design): Select default instance + coordinates if no instance is selected yet. + +2017-05-24 Werner Lemberg + + [bdf, pcf] Support ISO646.1991-IRV character encoding (aka ASCII). + + Problem reported by Marek KaĹĄĂ­k , cf. + + https://bugzilla.redhat.com/show_bug.cgi?id=1451795 + + * src/bdf/bdfdrivr.c (BDF_Face_Init), src/pcf/pcfdrivr.c + (PCF_Face_Init): Implement it. + +2017-05-20 Nikolaus Waxweiler + + [truetype] Always use interpreter v35 for B/W rendering (#51051). + + * src/truetype/ttgload.c (tt_loader_init) + [TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL]: Adjust + `subpixel_hinting_lean', `grayscale_cleartype', and + `vertical_lcd_lean' accordingly. + + * src/truetype/ttinterp.c (Ins_GETINFO): Updated. + (TT_RunIns): Update `backward_compatibility' flag. + +2017-05-20 Alexei Podtelezhnikov + + [smooth] Implement minimal dynamic padding for LCD filtering. + + Extra bitmap padding for LCD filtering depends on the filter. The + default 5-tap filter needs 2 extra subpixels. The light 3-tap filter + needs only 1 extra subpixel. This space could be already available + due to rounding. In order to optimize the padding, we now expand + CBox for the given filter weights before rounding. + + This change breaks current Skia (and Firefox). + + * include/freetype/internal/ftobjs.h (FT_LibraryRec) + [FT_CONFIG_OPTION_SUBPIXEL_RENDERING]: Remove `lcd_extra' field. + + * src/base/ftlcdfil.c (FT_Library_SetLcdFilterWeights, + FT_Library_SetLcdFilter): Remove `lcd_extra' initializations. + + * src/smooth/ftsmooth.c (ft_smooth_render_generic): Implement dymanic + LCD padding. + +2017-05-15 Werner Lemberg + + [sfnt] Return proper scaling values for SBIX bitmaps. + + Problem reported by Hin-Tak Leung . + + * src/sfnt/ttsbit.c (tt_face_load_strike_metrics): Implement it. + +2017-05-15 Werner Lemberg + + [truetype] Fix error handling for embedded bitmaps. + + Problem reported by Hin-Tak Leung . + + * src/truetype/ttgload.c (TT_Load_Glyph) + [TT_CONFIG_OPTION_EMBEDDED_BITMAPS]: Handle error if font is not + scalable. + +2017-05-15 Alexei Podtelezhnikov + + [autofit] Make autohint warping NORMAL option. + + This moves warping option from LIGHT to NORMAL mode. This makes LIGHT + truly void of hinting in x-direction, with left side bearing never + changed and right side bearing only altered by advance rounding. + Therefore, LIGHT is now ready to return fractional advance. As a + NORMAL option, warping substitutes normal hinting. + + * src/autofit/afcjk.c (af_cjk_hints_apply): Updated. + * src/autofit/aflatin.c (af_latin_hints_apply): Updated. + * src/autofit/aflatin2.c (af_latin2_hints_apply): Updated. + + * src/autofit/afloader.c (af_loader_load_glyph): Handle warping + phantom points as normal. + +2017-05-14 Werner Lemberg + + Remove remnants of raster pool. + + * include/freetype/internal/ftobjs.h (FT_LibraryRec): Remove + `raster_pool' and `raster_pool_size' fields. + + * src/base/ftobjs.c (FT_New_Library), src/raster/ftrend1.c + (ft_raster1_init), src/smooth/ftsmooth.c (ft_smooth_init): Updated. + +2017-05-13 Werner Lemberg + + * Version 2.8 released. + ======================= + + + Tag sources with `VER-2-8'. + + * docs/VERSION.TXT: Add entry for version 2.8. + * docs/CHANGES: Updated. + + * README, Jamfile (RefDoc), builds/windows/vc2005/freetype.vcproj, + builds/windows/vc2005/index.html, + builds/windows/vc2008/freetype.vcproj, + builds/windows/vc2008/index.html, + builds/windows/vc2010/freetype.vcxproj, + builds/windows/vc2010/index.html, + builds/windows/visualc/freetype.dsp, + builds/windows/visualc/freetype.vcproj, + builds/windows/visualc/index.html, + builds/windows/visualce/freetype.dsp, + builds/windows/visualce/freetype.vcproj, + builds/windows/visualce/index.html, + builds/wince/vc2005-ce/freetype.vcproj, + builds/wince/vc2005-ce/index.html, + builds/wince/vc2008-ce/freetype.vcproj, + builds/wince/vc2008-ce/index.html: s/2.7.1/2.8/, s/271/28/. + + * include/freetype/freetype.h (FREETYPE_MINOR): Set to 8. + (FREETYPE_PATCH): Set to 0. + + * builds/unix/configure.raw (version_info): Set to 20:0:14. + * CMakeLists.txt (VERSION_MINOR): Set to 8. + (VERSION_PATCH): Set to 0. + +2017-05-12 Hin-Tak Leung + + Fix `FT_UINT_TO_POINTER' macro for Windows. + + * builds/unix/ftconfig.in, builds/vms/ftconfig.h, + include/freetype/config/ftconfig.h (FT_UINT_TO_POINTER) [_WIN64]: + Fix definition. + +2017-05-11 Sascha Brawer + Werner Lemberg + Werner Lemberg + Werner Lemberg + Werner Lemberg + Werner Lemberg + Werner Lemberg + Werner Lemberg + Werner Lemberg + Werner Lemberg + Werner Lemberg + + [truetype] Add tricky font `DFGirl-W6-WIN-BF' (from Dynalab). + + Reported by Roy Tam . + + * src/truetype/ttobjs.c (tt_check_trickyness_family): Implement it. + +2017-05-07 Roy Tam + Werner Lemberg + + [truetype] More tricky fonts (mainly from Dynalab). + + * src/truetype/ttobjs.c (tt_check_trickyness_family, + tt_check_trickyness_sfnt_ids): Add them. + +2017-05-07 Werner Lemberg + + [truetype] Add tricky font `DLCHayMedium' (from Dynalab). + + Reported by Roy Tam . + + * src/truetype/ttobjs.c (tt_check_trickyness_family): Implement it. + +2017-05-03 Werner Lemberg + + */*: s/backwards compatibility/backward compatibility/. + +2017-05-03 Sascha Brawer + Werner Lemberg + Werner Lemberg + + [autofit] Add blue-zone support for Sundanese script. + + This essentially moves the Sundanese script from the `Indic' hinter + to the `Latin' hinter. + + * src/autofit/afblue.dat: Add blue zone data for Sundanese. + + * src/autofit/afblue.c, src/autofit/afblue.h: Regenerated. + + * src/autofit/afscript.h: Add Sundanese standard character and move + data out of AF_CONFIG_OPTION_INDIC block. + + * src/autofit/afranges.c: Move Sundanese data out of + AF_CONFIG_OPTION_INDIC block. + + * src/autofit/afstyles.h: Update Sundanese data; in particular, use + AF_WRITING_SYSTEM_LATIN. + +2017-05-03 Sascha Brawer + Werner Lemberg + + [truetype] Make `IUP' gvar deltas do the same as Apple (#50832). + + When points are not touched by gvar interpolation deltas, FreeType + gave a slightly different result than Apple's CoreText. + + The OpenType working group will update the specification to document + the following behaviour: If the two points with deltas to the `left' + and `right' of the untouched point have the same coordinate, then + the inferred delta for the untouched point should be zero. + + * src/truetype/ttgxvar.c (tt_delta_interpolate): Implement new + behaviour. + +2017-05-02 Werner Lemberg + + [autofit] Remove `slight' auto-hint mode again. + + A poll on freetype-devel favoured changes directly applied to + `light'. + + * include/freetype/freetype.h (FT_LOAD_TARGET_SLIGHT, + FT_RENDER_MODE_SLIGHT): Removed. + + * src/autofit/afcjk.c (af_cjk_hints_init), src/autofit/aflatin.c + (af_latin_hints_init), src/autofit/aflatin2.c + (af_latin2_hints_init): Revert change from 2017-04-22. + + * src/autofit/afloader.c (af_loader_load_glyph) Remove references to + FT_RENDER_MODE_SLIGHT. + [AF_CONFIG_OPTION_TT_SIZE_METRICS]: Enable TrueType-like metrics + unconditionally. + + * src/base/ftadvanc.c (LOAD_ADVANCE_FAST_CHECK): Revert change from + 2017-04-22. + + * src/base/ftobjs.c (FT_Load_Glyph): Revert change from 2017-04-22. + + * src/pshinter/pshalgo.c (ps_hints_apply): Revert change from + 2017-04-22. + + * src/smooth/ftsmooth.c (ft_smooth_render): Revert change from + 2017-04-22. + + * docs/CHANGES: Updated. + +2017-04-30 Werner Lemberg + + [autofit] Fix metrics computation. + + Problem reported by Markus Trippelsdorf and + Nikolaus Waxweiler . + + * src/base/ftobjs.c (FT_Request_Size): Trigger recomputation of + auto-hinter metrics. Without this change, multiple size changing + calls for a single face fail. + +2017-04-29 Werner Lemberg + + * src/truetype/ttdriver.c (tt_size_request): Properly check `error'. + + Reported by Earnestly in + + https://lists.nongnu.org/archive/html/freetype/2017-04/msg00031.html + +2017-04-27 Werner Lemberg + + Introduce AF_CONFIG_OPTION_TT_SIZE_METRICS configuration option. + + * include/freetype/config/ftoption.h + (AF_CONFIG_OPTION_TT_SIZE_METRICS): New option, commented out by + default. + + * src/autofit/afloader.c (af_loader_load_glyph): Use + AF_CONFIG_OPTION_TT_SIZE_METRICS to guard the corresponding code. + +2017-04-26 Werner Lemberg + + * include/freetype/freetype.h (FT_Render_Mode): Fix order. + + This retains backward compatibility. + + Noted by Alexei. + +2017-04-22 Werner Lemberg + + [truetype] Do linear scaling for FT_LOAD_NO_HINTING (#50470). + + * src/truetype/ttobjs.h (TT_SizeRec): Add field `hinted_metrics' to + hold hinted metrics. + Make `metrics' a pointer so that `tt_glyph_load' can easily switch + between metrics. + + * src/truetype/ttdriver.c (tt_size_request): Updated. + (tt_glyph_load): Use top-level metrics if FT_LOAD_NO_HINTING is + used. + + * src/truetype/ttgload.c (TT_Hint_Glyph, TT_Process_Simple_Glyph, + TT_Process_Composite_Component, load_truetype_glyph, + compute_glyph_metrics, TT_Load_Glyph): Updated. + + * src/truetype/ttinterp.c (TT_Load_Context): Updated. + + * src/truetype/ttobjs.c (tt_size_reset): Updated. + + * src/truetype/ttsubpix.c (sph_set_tweaks): Updated. + +2017-04-22 Werner Lemberg + + Add new `slight' auto-hinting mode. + + This mode uses fractional advance widths and doesn't scale glyphs + horizontally, only applying vertical scaling and hinting. + + At the same time, the behaviour of the `light' auto-hinter gets + restored for backward compatibility: Both vertical and horizontal + scaling is again based on rounded metrics values (this was changed + in a commit from 2017-03-30 as a side effect). To be more precise, + the behaviour is restored for TrueType fonts only; for other font + formats like Type 1, this is a new feature of the `light' hinting + mode. + + * include/freetype/freetype.h (FT_LOAD_TARGET_SLIGHT): New macro. + (FT_RENDER_MODE_SLIGHT): New render mode. + + * include/freetype/internal/ftobjs.h (FT_Size_InternalRec): Add + `autohint_mode' and `autohint_metrics' fields. + + * src/autofit/afcjk.c (af_cjk_hints_init), src/autofit/aflatin.c + (af_latin_hints_init), src/autofit/aflatin2 (af_latin2_hints_init): + Updated. + + * src/autofit/afloader.c (af_loader_embolden_glyph_in_slot): Use + `autohint_metrics'. + (af_loader_load_glyph): s/internal/slot_internal/. + Initialize `autohint_metrics' and `autohint_mode' depending on + current auto-hint mode. + Use `autohint_metrics'. + Updated. + + * src/base/ftadvanc.c (LOAD_ADVANCE_FAST_CHECK): Updated. + + * src/base/ftobjs.c (FT_Load_Glyph): Updated. + (FT_New_Size): Allocate `internal' object. + + * src/pshinter/pshalgo.c (ps_hints_apply): Updated. + + * src/smooth/ftsmooth.c (ft_smooth_render): Updated. + +2017-04-22 Werner Lemberg + + Introduce `FT_Size_InternalRec' structure. + + We are going to extend this later on. + + * include/freetype/internal/ftobjs.h (FT_Size_InternalRec): New + structure with a single field `module_data'. + + * src/base/ftobjs.c (FT_New_Size): Allocate `internal' field of + `FT_Size' structure. + + * src/cff/cffgload.c (cff_builder_init, cff_decoder_prepare): Use + `size->internal->module_data' instead of `size->internal'. + + * src/cff/cffobjs.c (cff_size_done): Deallocate `module_data'. + (cff_size_init, cff_size_select, cff_size_request): Use + `size->internal->module_data' instead of `size->internal'. + + * src/cif/cidobjs.c (cid_size_done, cid_size_init, + cid_size_request): Use `size->internal->module_data' instead of + `size->internal'. + + * src/psaux/psobjs.c (t1_builder_ini): Use + `size->internal->module_data' instead of `size->internal'. + + * src/type1/t1objs.c (T1_Size_Done, T1_Size_Init, T1_Size_Request): + Use `size->internal->module_data' instead of `size->internal'. + +2017-04-21 Alexei Podtelezhnikov + + * src/smooth/ftsmooth.h: Remove unused guards and declaration. + +2017-04-16 Hin-Tak Leung + + Fix tracing messages. + + * src/base/ftobjs.c (FT_Face_GetCharVariantIndex, + FT_Face_GetCharVariantIsDefault, FT_Face_GetVariantsOfChar): Print + correct function name. + +2017-04-08 Sascha Brawer + Werner Lemberg + Werner Lemberg + Werner Lemberg + Werner Lemberg + + [autofit] Fix invalid character range description (#50745). + + Also reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=1034 + + * src/autofit/afranges.c (af_glag_nonbase_uniranges): Fix typo in + recent commit. + +2017-04-07 Werner Lemberg + + [ftfuzzer] Fix clang warnings. + + * src/tools/ftfuzzer/ftfuzzer.cc (LLVMFuzzerTestOneInput): Add + casts. + +2017-04-06 Sascha Brawer + Werner Lemberg + Werner Lemberg + Werner Lemberg + Werner Lemberg + Werner Lemberg + Werner Lemberg + + [autofit] Add support for Adlam script. + + * src/autofit/afblue.dat: Add blue zone data for Adlam. + * src/autofit/afblue.c, src/autofit/afblue.h: Regenerated. + + * src/autofit/afscript.h: Add Adlam standard characters. + + * src/autofit/afranges.c, src/autofit/afstyles.h: Add Adlam data. + +2017-04-06 Sascha Brawer + + [autofit] Add support for Ol Chiki script. + + * src/autofit/afblue.dat: Add blue zone data for Ol Chiki. + * src/autofit/afblue.c, src/autofit/afblue.h: Regenerated. + + * src/autofit/afscript.h: Add Ol Chiki standard character. + + * src/autofit/afranges.c, src/autofit/afstyles.h: Add Ol Chiki data. + +2017-04-03 Werner Lemberg + + [truetype] Avoid reexecution of `fpgm' and `prep' in case of error. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=981 + + * include/freetype/fterrdef.h (FT_Err_DEF_In_Glyf_Bytecode): New + error code. + + * src/truetype/ttinterp.c (Ins_FDEF, Ins_IDEF): Prohibit execution + of these two opcodes in `glyf' bytecode. + (TT_RunIns): Don't enforce reexecution of `fpgm' and `prep' bytecode + in case of error since function tables can no longer be modified + (due to the changes in `Ins_FDEF' and `Ins_IDEF'). This change can + enormously speed up handling of broken fonts. + +2017-04-02 Alexei Podtelezhnikov + + [autofit] Disable metrics adjustment for `FT_LOAD_TARGET_LCD'. + + * src/autofit/aflatin.c (af_latin_hints_init): Updated. + * src/autofit/aflatin2.c (af_latin2_hints_init): Ditto. + +2017-04-01 Werner Lemberg + + * src/truetype/ttgload.c: Include FT_CONFIG_CONFIG_H. + + Otherwise FT_UINT_TO_POINTER might not be defined. + + Problem reported by Alexei. + +2017-03-31 Alexei Podtelezhnikov + + [autofit] Disable stem adjustment for `FT_LOAD_TARGET_LCD'. + + * include/freetype/freetype.h (FT_LOAD_TARGET_LCD): Document it. + * src/autofit/afcjk.c (af_cjk_hints_init): Updated. + * src/autofit/aflatin.c (af_latin_hints_init): Ditto. + * src/autofit/aflatin2.c (af_latin2_hints_init): Ditto. + +2017-03-31 Werner Lemberg + + * src/cff/cffload.c (cff_font_load): Improve fix from 2017-01-04. + + Allow CFFs containing a single font to have an empty font name. + + Problem reported by 張俊芝 <418092625@qq.com> in + + https://lists.nongnu.org/archive/html/freetype-devel/2017-03/msg00074.html + +2017-03-30 Werner Lemberg + + * src/cff/cffparse.h (CFF2_DEFAULT_STACK): Set to 513 also. + + Requested by Dave Arnold. + +2017-03-30 Werner Lemberg + + [truetype] Fix HVAR and VVAR handling (#50678). + + * src/truetype/ttgxvar.c (tt_hvadvance_adjust): Handle + glyph indices larger than `mapCount' as described in the + specification. + +2017-03-30 Werner Lemberg + + [truetype] Allow linear scaling for unhinted rendering (#50470). + + * src/truetype/ttdriver.c (tt_size_request): Revert change from + 2011-07-16; the intended metrics fix seems now to be implemented in + a different way, making the patch unnecessary. Note that this + change was usually patched out by all major GNU/Linux distributions + due to heavy side effects. + + * src/truetype/ttgload.c (compute_glyph_metrics, TT_Load_Glyph): + Refer to the metrics of the `TT_Size' object. + +2017-03-29 Werner Lemberg + + [truetype] Fix thinko related to PS name of default named instance. + + * src/truetype/ttgxvar.c (TT_Get_MM_Var): `strid' and `psid' are + name ID values, not indices into the array of name entries. + +2017-03-27 Werner Lemberg + + [cid, truetype] Don't use `index' as a variable name. + + At least on FreeBSD there is a global declaration of `index' in file + `/usr/include/strings.h'. + + * src/cff/cf2intrp.c, src/truetype/ttgload.c: s/index/idx/ where + appropriate. + +2017-03-27 Wojciech Mamrak + + [sfnt] Minor improvement for handling kern tables. + + * src/sfnt/ttkern.c (tt_face_load_kern): Don't check for + cross-stream kerning tables since we reject format 2 tables later + on anyways. + Modify code for limit test... + (tt_face_get_kerning): ... to avoid a limit test here. + +2017-03-27 Werner Lemberg + + [pcf] Fix compiler warnings. + + Reported by Alexander Hedges . + + * src/pcf/pcfdrivr.c (pcf_property_set, pcf_property_get): Tag + `property_name' with `FT_UNUSED' where necessary. + +2017-03-26 Werner Lemberg + + * src/psaux/psobjs.c (t1_builder_close_contour): Add safety guard. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=941 + +2017-03-23 Werner Lemberg + + [psaux] Better protect `flex' handling. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=935 + + * src/psaux/t1decode.c (t1_decoder_parse_charstrings) + : Since there is not a single flex operator but a + series of subroutine calls, malformed fonts can call arbitrary other + operators after the start of a flex, possibly adding points. For + this reason we have to check the available number of points before + inserting a point. + +2017-03-23 Werner Lemberg + + [sfnt] Fix check for default named instance. + + * src/sfnt/sfobjs.c (sfnt_init_face): A `fixed' number needs four + bytes, not two... + +2017-03-23 Werner Lemberg + + Make MM fonts work (again). + + * src/base/ftmm.c (FT_Set_Var_Design_Coordinates, + FT_Set_MM_Blend_Coordinates, FT_Set_Var_Blend_Coordinates): Ignore + return value of `ft_face_get_mvar_service'; instead, check whether a + service is actually returned. + +2017-03-20 Werner Lemberg + + [truetype] Some variable renamings. + + Too much local variables holding different structures were called + `metrics'. + + * src/truetype/ttdriver.c (tt_size_select): s/metrics/size_metrics/. + + * src/truetype/ttgload.c (tt_get_metrics_incr_overrides, + compute_glyph_metrics): s/metrics/incr_metrics/. + (load_sbit_image): s/metrics/sbit_metrics/. + + * src/truetype/ttobjs.c (tt_size_run_fpgm): s/metrics/size_metrics/. + (tt_size_init_bytecode): s/metrics/tt_metrics/. + (tt_size_reset): s/metrics/size_metrics/. + +2017-03-20 Werner Lemberg + + [sfnt] Don't add instances to non-variation fonts. + + * src/sfnt/sfobjs.c (sfnt_init_face): Fix it. + +2017-03-20 Werner Lemberg + + * src/cff/cffgload.c (cff_builder_init): Add safety guard (#50578). + +2017-03-18 Werner Lemberg + + Introduce FT_UINT_TO_POINTER macro (#50560). + + We have to make a separate case for Windows 64's LLP64 data model. + + * builds/unix/ftconfig.in, builds/vms/ftconfig.h, + include/freetype/config/ftconfig.h (FT_UINT_TO_POINTER): New macro. + + * src/truetype/ttgload.c (load_truetype_glyph): Use it. + +2017-03-18 Werner Lemberg + + * src/truetype/ttinterp.c (TT_RunIns): Adjust loop counter (#50573). + + The problematic font that exceeds the old limit is Lato-Regular, + version 2.007, containing bytecode generated by a buggy version of + ttfautohint. + +2017-03-18 Werner Lemberg + + [truetype] Another limitation for bytecode loop count maximum. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=900 + + * src/truetype/ttinterp.c (TT_RunIns): Limit `loopcall_counter_max' + by number of glyphs also. + +2017-03-18 Werner Lemberg + + [ftfuzzer] Minor improvement. + + * src/tools/ftfuzzer/ftfuzzer.cc: Don't set intermediate axis if + bitmap strikes are active. + +2017-03-18 Werner Lemberg + + Improve `make multi'. + + * src/autofit/aflatin2.c: Guard file with FT_OPTION_AUTOFIT2. + + * src/base/ftmac.c: Guard more parts of the file with FT_MACINTOSH. + + * src/psaux/afmparse.c: Guard file with T1_CONFIG_OPTION_NO_AFM. + + * src/sfnt/pngshim.c: Guard file with + TT_CONFIG_OPTION_EMBEDDED_BITMAPS also. + + * src/sfnt/ttbdf.c: Avoid empty source file. + * src/sfnt/ttpost.c: Guard file with + TT_CONFIG_OPTION_POSTSCRIPT_NAMES. + * src/sfnt/ttsbit.c: Guard file with + TT_CONFIG_OPTION_EMBEDDED_BITMAPS. + + * src/truetype/ttgxvar.c, src/truetype/ttinterp.c: Avoid empty + source file. + + * src/truetype/ttsubpix.c: Guard file with + TT_USE_BYTECODE_INTERPRETER also. + + * src/type1/t1afm.c: Guard file with T1_CONFIG_OPTION_NO_AFM. + + * src/autofit/autofit.c, src/base/ftbase.c, src/cache/ftcache.c, + src/cff/cff.c, src/cid/type1cid.c, src/gxvalid/gxvalid.c, + src/pcf/pcf.c, src/pfr/pfr.c, src/psaux/psaux.c, + src/pshinter/pshinter.c, src/psnames/psnames.c, src/raster/raster.c, + src/sfnt/sfnt.c, src/smooth/smooth.c, src/truetype/truetype.c, + src/type1/type1.c, src/type42/type42.c: Remove conditionals; sort + entries. + +2017-03-17 Werner Lemberg + + Fixes for conditional compilation. + + * src/autofit/afcjk.c, src/autofit/afindic.c: Include `afcjk.h' + earlier. + + * src/sfnt/sfobjs.c (sfnt_init_face): Put `memory' variable into + TT_CONFIG_OPTION_GX_VAR_SUPPORT block. + (sfnt_done_face): Protect some code with + TT_CONFIG_OPTION_GX_VAR_SUPPORT. + + * src/sfnt/ttsbit.c (tt_face_load_sbix_image): Remove compiler + warning. + + * src/truetype/ttgload.c (TT_Load_Simple_Glyph): Put `tmp' variable + into TT_USE_BYTECODE_INTERPRETER block. + + (tt_loader_init): Put `error' variable into + TT_USE_BYTECODE_INTERPRETER block. + +2017-03-17 Werner Lemberg + + Fix preprocessor warning. + + * devel/ftoption.h, include/freetype/config/ftoption.h: Test whether + TT_CONFIG_OPTION_SUBPIXEL_HINTING is defined before checking its + value. + +2017-03-17 Werner Lemberg + + `make multi' fixes; compiler warnings. + + * src/base/ftsnames.c: Include FT_INTERNAL_DEBUG_H. + + * src/cff/cffobjs.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include + FT_MULTIPLE_MASTERS_H and FT_SERVICE_MULTIPLE_MASTERS_H. + + * src/sfnt/sfdriver.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include + FT_MULTIPLE_MASTERS_H and FT_SERVICE_MULTIPLE_MASTERS_H. + (get_win_string, get_apple_string): Initialize `result'. + +2017-03-17 Dave Arnold + + [cff] Fix potential bugs in default NDV for CFF2. + + * src/cff/cffload.c (cff_blend_build_vector): Explicitly build blend + vector when `lenNDV' is zero; don't rely on zero-init. + Save `lenNDV' as part of cache key even when `lenNDV' is zero. + +2017-03-17 Dave Arnold + + [cff] Fix CFF2 stack allocation. + + * src/cff/cffparse.c (cff_parser_init) add 1 for operator. + +2017-03-16 Werner Lemberg + + * src/truetype/ttgxvar.c (tt_done_blend): Free `vvar_table'. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=883 + +2017-03-15 Werner Lemberg + + Remove clang compiler warnings (#50548). + + * include/freetype/internal/tttypes.h (TT_FaceRec): Make + `var_postscript_prefix_len' unsigned. + + * src/autofit/afwarp.c (af_warper_compute_line_best): Remove + redundant assignment. + + * src/cff/cffload.c (cff_subfont_load): Add casts. + + * src/cff/cffparse.c (cff_parse_blend): Remove redundant assignment. + + * src/sfnt/sfdriver.c (fmix32, murmur_hash_3_128): Add `static' + keyword. + Add casts. + (fixed2float): Add cast. + (sfnt_get_var_ps_name): Make `p' always initialized. + Add casts. + + * src/truetype/ttgxvar.c (TT_Get_MM_Var): Add casts. + +2017-03-15 Werner Lemberg + + [ftfuzzer] Limit number of tested faces and instances. + + This is inspired by the discussion in and analysis of + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=859 + + * src/tools/ftfuzzer/ftfuzzer.cc (LLVMFuzzerTestOneInput): Use only + up to 20 face indices. + Use only up to 20 instance indices. + +2017-03-15 Werner Lemberg + + * src/tools/ftfuzzer/ftfuzzer.cc: Improve readability; formatting. + +2017-03-14 Werner Lemberg + + [sfnt] Implement PS names for font instances [3/3]. + + Everything is guarded with TT_CONFIG_OPTION_GX_VAR_SUPPORT. + + * include/freetype/internal/tttypes.h (TT_FaceRec): New fields + `var_postscript_prefix' and `var_postscript_prefix_len'. + + * src/sfnt/sfdriver.c: Include FT_TRUETYPE_IDS_H. + (sfnt_is_alphanumeric): New wrapperfunction for `ft_isalnum'. + (get_win_string, get_apple_string): Remove `const' from return + value. + (MAX_VALUE_DESCRIPTOR_LEN, MAX_PS_NAME_LEN): New macros. + (hexdigits): New array. + (sfnt_get_var_ps_name): New function, implementing Adobe TechNote + 5902 to construct a PS name for a variation font instance. + (sfnt_get_ps_name): Call `sfnt_get_var_ps_name' for font instances. + + * src/sfnt/sfobjs.c (sfnt_done_face): Updated. + + * src/truetype/ttgxvar.c (tt_set_mm_blend): Reset + `face->postscript_name' to trigger recalculation for new instance + parameters. + +2017-03-14 Werner Lemberg + + [sfnt] Implement PS names for font instances [2/3]. + + * src/sfnt/sfdriver.c (fix2float) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: + New function to find the shortest representation of a 16.16 + fractional number. + +2017-03-14 Werner Lemberg + + [sfnt] Implement PS names for font instances [1/3]. + + Add 128bit MurmurHash 3 function. + + Everything is guarded with TT_CONFIG_OPTION_GX_VAR_SUPPORT. + + * src/sfnt/sfdriver.c (ROTL32): New macro. + (fmix32, murmur_hash_3_128): New functions. + +2017-03-13 Werner Lemberg + + [truetype] Ignore invalid MVAR tags. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=838 + + * src/truetype/ttgxvar.c (ft_var_load_mvar): Ignore value and emit + warning for invalid tags. + (tt_apply_mvar): Ignore invalid tags. + +2017-03-12 Werner Lemberg + + [truetype] Store and use design coordinates also. + + * include/freetype/internal/services/svmm.h (FT_Get_Var_Blend_Func): + Add `normalizedcoords' argument. + + * src/truetype/ttgxvar.h (GX_BlendRec): Add `coords' field to store + the design coordinates of the current instance. + Updated. + + * src/truetype/ttgxvar.c (TT_Set_MM_Blend): Move functionality to... + (tt_set_mm_blend): ... New function. + Convert data in `normalizedcoords' array to `coords' array on + demand. + (TT_Set_Var_Design): Store argument data in `coords' array. + (TT_Get_Var_Design): Get data from `coords' array. + (tt_get_var_blend): Updated. + (tt_done_blend): Updated. + + * src/cff/cffload.c, src/cff/cffload.h (cff_get_var_blend): Updated. + + * src/cff/cf2ft.c (cf2_getNormalizedVector): Updated. + + * src/cff/cffobjs.c (cff_face_init): Updated. + +2017-03-12 Werner Lemberg + + src/truetype/ttgxvar.[ch]: s/avar_checked/avar_loaded/. + +2017-03-08 Werner Lemberg + + [sfnt] Another fix for buggy variation fonts. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=759 + + * src/sfnt/sfobjs.c (sfnt_init_face): While setting number of + instances to zero for `CFF' fonts table, ensure that there is no + `CFF2' present also (which gets priority). + +2017-03-07 Werner Lemberg + + [sfnt] Improve handling for buggy variation fonts. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=738 + + * src/sfnt/sfobjs.c (sfnt_init_face): While setting number of + instances to zero for `CFF' fonts table, ensure that there is no + `glyf' table present also (which gets priority). + +2017-03-06 Werner Lemberg + + [sfnt, truetype] Always provide default instance. + + As documented in the OpenType specification, an entry for the + default instance may be omitted in the named instance table. In + particular this means that even if there is no named instance table + in the font we actually do have a named instance, namely the default + instance. + + For consistency, we always want the default instance in our list of + named instances. If it is missing, we try to synthesize it. + + * src/sfnt/sfobjs.c (sfnt_init_face): Check whether the default + instance is in the table of named instances. Otherwise adjust + number of instances. + + * src/truetype/ttgxvar.c: Include FT_TRUETYPE_IDS_H. + (TT_Get_MM_Var): Use `face->root.style_flags' as the number of named + instances. + Sythesize a named instance entry if necessary. + (tt_done_blend): Free `normalized_stylecoords'. + +2017-03-05 Werner Lemberg + + [sfnt] Remove redundant code. + + * src/sfnt/sfobjs.c (sfnt_init_face): Remove second test for + `num_instances', which will always succeed. + +2017-03-04 Werner Lemberg + + [sfnt] Add `get_name_id' service. + + * include/freetype/internal/sfnt.h (TT_Get_Name_ID_Func): New + typedef. + (SFNT_Interface): Add `get_name_id' field. + (FT_DEFINE_SFNT_INTERFACE): Updated. + + * src/sfnt/sfdriver.c (search_name_id): Rename to... + (sfnt_get_name_id): ... this. + (sfnt_get_ps_name, sfnt_interface): Updated. + +2017-03-04 Werner Lemberg + + [truetype] Make `TT_Set_MM_Blend' set named instance index. + + * src/truetype/ttgxvar.h (GX_Blend): New array + `normalized_stylecoords'. + + * src/truetype/ttgxvar.c (TT_Get_MM_Var): Allocate and fill + `normalized_stylecoords'. + (TT_Set_MM_Blend): Check instance tuple and adjust `face_index' + accordingly. + +2017-03-02 Werner Lemberg + + [truetype] Split off designer/normalized conversion routines. + + * src/truetype/ttgxvar.c (TT_Set_Var_Design): Split off conversion + code designer->normalized coordinates to... + (ft_var_to_normalized): ... New function. + (TT_Get_Var_Design): Split off conversion code normalized->designer + coordinates to... + (ft_var_to_design): ... New function. + +2017-02-28 Werner Lemberg + + [sfnt] Further generalize `sfnt_get_ps_name'; report invalid data. + + * src/sfnt/sfdriver.c (sfnt_ps_map): New array. + (sfnt_is_postscript): New function. + (char_type_func): New typedef. + (get_win_string, get_apple_string): Add argument to specify + character checking function. + Add argument whether argument checking failures should be reported. + Update callers. + (search_name_id): Fix return value. + +2017-02-23 Werner Lemberg + + [sfnt] Split off another bit of `sfnt_get_ps_name'. + + * src/sfnt/sfdriver.c (sfnt_get_ps_name): Split off some + functionality into... + (search_name_id): ... New function. + +2017-02-23 Werner Lemberg + + [sfnt] Modularize `sfnt_get_ps_name'. + + * src/sfnt/sfdriver.c (sfnt_get_ps_name): Split off some + functionality into... + (IS_WIN, IS_APPLE): ... New macros. + (get_win_string, get_apple_string): ... New functions. + +2017-02-23 Werner Lemberg + + [truetype] Minor improvement. + + * src/truetype/ttgload.c (TT_Process_Simple_Glyph, + load_truetype_glyph): Remove unnecessary tests. + +2017-02-23 Werner Lemberg + + * include/freetype/internal/tttypes.h (TT_Face): s/isCFF2/is_cff2/. + + For orthogonality with other structure field names. + + Update all users. + +2017-02-22 Alexei Podtelezhnikov + + * src/smooth/ftgrays.c (gray_hline): Improve code. + +2017-02-20 Dominik RĂśttsches + + Fix some `ttnameid.h' entries (#50313). + + * include/freetype/ttnameid.h: + s/TT_MS_LANGID_SPANISH_INTERNATIONAL_SORT/TT_MS_LANGID_SPANISH_SPAIN_INTERNATIONAL_SORT/, + s/TT_MS_LANGID_MONGOLIAN_MONGOLIA_MONGOLIA/TT_MS_LANGID_MONGOLIAN_MONGOLIA_MONGOLIAN/. + +2017-02-20 Werner Lemberg + + [cff] Finish support for `random' operator. + + * src/cff/cfftypes.h (CFF_SubFontRec): Add `random' field. + + * src/cff/cffobjs.c: Updated. + (cff_driver_init): Initialize random seed value. + + * src/cff/cffload.c (cff_random): New function. + (cff_subfont_load): Add `face' argument. + Update all callers. + Initialize random number generator with a proper seed value. + (cff_font_load): Add `face' argument. + Update all callers. + + * src/cff/cffload.h: Updated. + + * src/cff/cf2intrp.c (CF2_FIXME): Removed. + (cf2_interpT2CharString) : Implement opcode. + + * src/cff/cffgload.c (cff_decoder_parse_charstrings): Don't + initialize random seed value. + : Use new random seed framework. + +2017-02-20 Werner Lemberg + + [cff] Sanitize `initialRandomSeed'. + + * src/cff/cffload.c (cff_load_private_dict): Make + `initial_random_seed' value always positive. + +2017-02-20 Werner Lemberg + + [cff] Introduce `random-seed' property (2/2). + + * src/base/ftobjs.c: Include `FT_CFF_DRIVER_H'. + (open_face): Initialize `face->internal->random_seed'. + (FT_Face_Properties): Handle `FT_PARAM_TAG_RANDOM_SEED'. + + * src/cff/cffdrivr.c (cff_property_set): Handle `random-seed' + property. + +2017-02-20 Werner Lemberg + + [cff] Introduce `random-seed' property (1/2). + + We need this for support of the `random' operator. + + * include/freetype/ftcffdrv.h (FT_PARAM_TAG_RANDOM_SEED): New macro. + + * include/freetype/internal/ftobjs.h (FT_Face_InternalRec): New + field `random_seed'. + + * src/cff/cffobjs.h (CFF_DriverRec): New field `random_seed'. + +2017-02-17 Werner Lemberg + + Remove clang warnings. + + * src/autofit/aflatin.c (af_latin_sort_blue): Add missing `static' + keyword. + + * src/base/ftmm.c (FT_Set_Var_Design_Coordinates, + FT_Set_MM_Blend_Coordinates, FT_Set_Var_Blend_Coordinates): + Initialize some variables. + +2017-02-16 Nikolaus Waxweiler + Werner Lemberg + + Add face property for stem darkening. + + * include/freetype/ftautoh.h (FT_PARAM_TAG_STEM_DARKENING): New + macro. + + * include/freetype/internal/ftobjs.h (FT_Face_InternalRec): Add + `no_stem_darkening' field. + + * src/autofit/afloader.c (af_loader_load_glyph), + src/autofit/afmodule.c (af_property_set): Updated. + + * src/base/ftobjs.c: Include FT_AUTOHINTER_H. + (ft_open_face_internal): Updated. + (FT_Face_Properties): Handle FT_PARAM_TAG_STEM_DARKENING. + + * src/cff/cf2ft.c (cf2_decoder_parse_charstrings): Updated. + + * src/cff/cffdrivr.c (cff_property_set): Updated. + +2017-02-16 Nikolaus Waxweiler + Werner Lemberg + + Add face property for LCD filter weights. + + * include/freetype/ftlcdfil.h (FT_PARAM_TAG_LCD_FILTER_WEIGHTS, + FT_LCD_FILTER_FIVE_TAPS): New macros. + (FT_LcdFiveTapFilter): New typedef. + + * include/freetype/ftobjs.h (FT_Face_InternalRec) + [FT_CONFIG_OPTION_SUBPIXEL_RENDERING]: Add `lcd_weights' field. + (FT_Bitmap_LcdFilterFunc): Change third argument to weights array. + (ft_lcd_filter_fir): New prototype. + (FT_LibraryRec): Updated. + + * src/base/ftlcdfil.c (_ft_lcd_filter_fir): Renamed to... + (ft_lcd_filter_fir): ... this base function. + Updated. + (_ft_lcd_filter_legacy): Updated. + (FT_Library_SetLcdFilterWeights, FT_Library_SetLcdFilter): Updated. + + * src/base/ftobjs.c (ft_open_face_internal): Updated. + (FT_Face_Properties): Handle FT_PARAM_TAG_LCD_FILTER_WEIGHTS. + + * src/smooth/ftsmooth.c (ft_smooth_render_generic) + [FT_CONFIG_OPTION_SUBPIXEL_RENDERING]: Handle LCD weights from + `FT_Face_Internal'. + +2017-02-14 Nikolaus Waxweiler + Werner Lemberg + + Add new function `FT_Face_Properties'. + + This commit provides the framework, to be filled with something + useful in the next commits. + + * include/freetype/freetype.h (FT_Face_Properties): Declare. + + * src/base/ftobjs.c (FT_Face_Properties): New function. + +2017-02-13 Werner Lemberg + + [autofit] Prevent overlapping blue zones. + + Problem reported as + + https://github.com/google/fonts/issues/632 + + The font in question (Nunito) has values 705 and 713 for the + reference and overshoot values, respectively, of the first blue + zone. Blue zone 2, however, has value 710 for both the reference + and overshoot. At 12ppem, reference and overshoot of blue zone 0 + becomes 8px, while blue zone 2 becomes 9px. + + A peculiarity of this font is that the tops of isolated vertical + stems like `N' have a slight overshoot also. The auto-hinter tries + to find the nearest blue zone using the *original* coordinates. For + vertical stems, this is value 713. For normal horizontal tops like + in character `E', this is value 710. Since value 713 is mapped to + 8px but value 710 to 9px, `N' and similar characters are one pixel + higher than `E', which looks very bad. + + This commit sanitizes blue zones to avoid such a behaviour. + + * src/autofit/aflatin.c (af_latin_sort_blue): New function. + (af_latin_metrics_init_blues): Sort blue values and remove overlaps. + +2017-02-12 Alexei Podtelezhnikov + + * src/smooth/ftgrays.c (gray_sweep): Improve code. + +2017-02-06 Werner Lemberg + + [truetype] Implement `VVAR' table support. + + * src/truetype/ttgxvar.h (GX_HVarTable): Renamed to... + (GX_HVVarTable): ...This. + (GX_Blend): Add fields for `VVAR' table handling. + Other minor updates. + + * src/truetype/ttgxvar.c (ft_var_load_hvar): Renamed to... + (ft_var_load_hvvar): ...This. + Handle VVAR loading also (controlled by an additional parameter). + (tt_hadvance_adjust): Renamed to... + (tt_hvadvance_adjust): ...This. + Handle application of advance height also (controlled by an + additional parameter). + (tt_hadvance_adjust, tt_vadvance_adjust): Wrappers for + `tt_hvadvance_adjust'. + + * src/truetype/ttdriver.c (tt_service_metrics_variations): Updated. + +2017-02-05 Werner Lemberg + + [autofit] Use better blue zone characters for lowercase latin. + + The number of lowercase characters for computing the top flat blue + zone value was too small (in most cases only `x' and `z'). If one + of the two characters has a large serif, say, it can happen that + FreeType must select between two different values, having a 50% + chance to use the wrong one. As a result, rendering at larger PPEM + values could yield uneven lowercase glyph heights. + + Problem reported by Christoph Koeberlin . + + * src/autofit/afblue.dat (AF_BLUE_STRING_LATIN_SMALL): Replaced + with... + (AF_BLUE_STRING_LATIN_SMALL_TOP, AF_BLUE_STRING_LATIN_SMALL_BOTTOM): + ... New, extended sets. + (AF_BLUE_STRINGSET_LATN): Updated. + + * src/autofit/afblue.c, scr/autofit/afblue.h: Regenerated. + +2017-02-04 Werner Lemberg + + Make `freetype-config' a wrapper of `pkg-config' if possible. + + Based on ideas taken from + + http://pkgs.fedoraproject.org/cgit/rpms/freetype.git/tree/freetype-multilib.patch + http://pkgs.fedoraproject.org/cgit/rpms/freetype.git/tree/freetype-2.5.3-freetype-config-prefix.patch + + * builds/unix/freetype-config.in: Rewritten. Use `pkg-config' to + set output variables if program is available. + + * docs/CHANGES, docs/freetype-config.1: Updated. + +2017-02-04 Werner Lemberg + + * builds/unix/unix-def.in (freetype-config): Fix permissions. + +2017-02-03 Werner Lemberg + + * src/autofit/afglobal.c (af_face_globals_free): Erase useless code. + +2017-02-03 Werner Lemberg + + * include/freetype/ftgasp.h (FT_GASP_SYMMETRIC_GRIDFIT): Fix value. + + Reported by Behdad. + +2017-02-02 Werner Lemberg + + [truetype] Fix MVAR post-action handling. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=509 + + * src/truetype/ttobjs.c (tt_size_reset): Do nothing for CFF2. This + is important to make `tt_size_reset_iterator' (called in + `tt_apply_mvar') always work. + +2017-02-02 Werner Lemberg + + Make compilation with FT_CONFIG_OPTION_PIC work again. + + All code committed here is guarded with `FT_CONFIG_OPTION_PIC'. + + * include/freetype/internal/services/svmetric.h + (FT_DEFINE_SERVICE_METRICSVARIATIONSREC): Remove trailing semicolon. + + * src/autofit/aflatin.c (af_latin_hints_compute_edges, + af_latin_hint_edges): Provide `globals' variable. + + * src/autofit/afloader.c (af_loader_load_glyph): Remove shadowing + variable. + + * src/autofit/afmodule.c (AF_SCRIPT_CLASSES_GET, + AF_STYLE_CLASSES_GET): Redefine. + + * src/autofit/aftypes.h (AF_DEFINE_WRITING_SYSTEM_CLASS): Fix typo. + + * src/cff/cffparse.c (CFF_FIELD_BLEND): Provide it. + + * src/cff/cffpic.h (CffModulePIC): Fix typo. + +2017-01-31 Alexei Podtelezhnikov + + * src/smooth/ftgrays.c (gray_render_scanline): Improve code. + +2017-01-31 Werner Lemberg + + [cff] Provide metrics variation service interface (#50196). + + Only now I've got an OTF with an HVAR table for testing... + + The code in `ftmm.c' uses `FT_FACE_LOOKUP_SERVICE' to get the + metrics variations interface. However, this didn't work with + `FT_FACE_FIND_GLOBAL_SERVICE' used in `sfnt_init_face'. + + * src/cff/cffdrivr.c: Include FT_SERVICE_METRICS_VARIATIONS_H. + (cff_hadvance_adjust, cff_metrics_adjust): Wrapper functions for + metric service functions from the `truetype' module. + (cff_service_metrics_variations): New service. + (cff_services): Updated. + + * src/cff/cffpic.h (CFF_SERVICE_METRICS_VAR_GET): New macro. + [FT_CONFIG_OPTION_PIC]: Synchronize code. + + * src/sfnt/sfobjs.c (sfnt_init_face): Replace call to + FT_FACE_FIND_GLOBAL_SERVICE with `ft_module_get_service' to always + load the service from the `truetype' module. + +2017-01-31 Werner Lemberg + + Add framework to support services with 9 functions. + + * include/freetype/internal/ftserv.h (FT_DEFINE_SERVICEDESCREC9): + New macro. + +2017-01-31 Werner Lemberg + + [base] Fix error handing in MM functions. + + * src/base/ftmm.c (FT_Set_Var_Design_Coordinates, + FT_Set_MM_Blend_Coordinates, FT_Set_Var_Blend_Coordinates): + Implement it. + +2017-01-31 Werner Lemberg + + [truetype] Fix sanity check for `gvar' table (#50184). + + * src/truetype/ttgxvar.c (ft_var_load_gvar): There might be missing + variation data for some glyphs. + +2017-01-31 Werner Lemberg + + [autofit] Avoid uninitialized jumps (#50191). + + * src/autofit/afcjk.c (af_cjk_metrics_check_digits), + src/autofit/aflatin.c (af_latin_metrics_check_digits): Initialize + `advance'. + +2017-01-27 Werner Lemberg + + s/GB2312/PRC/. + + * include/freetype/freetype.h (FT_ENCODING_PRC): New enum value. + (FT_ENCODING_GB2312): Deprecated. + + * include/freetype/ttnameid.h (TT_MS_ID_PRC): New macro. + (TT_MS_ID_GB2312): Deprecated. + + * src/sfnt/sfobjs.c (sfnt_find_encoding): Updated. + + * docs/CHANGES: Updated. + +2017-01-26 Werner Lemberg + + [base] Add `FT_Get_Sfnt_LangTag' function. + + * include/freetype/ftsnames.h (FT_SfntLangTag): New structure. + (FT_Get_Sfnt_LangTag): New declaration. + + * src/base/ftsnames.c (FT_Get_Sfnt_LangTag): New function. + + * docs/CHANGES: Updated. + +2017-01-26 Werner Lemberg + + [sfnt] Support `name' table format 1. + + * include/freetype/internal/tttypes.h (TT_LangTagRec): New + structure. + (TT_NameTableRec): Add fields `numLangTagRecords' and `langTags'. + + * src/sfnt/ttload.c (tt_face_load_name): Add support for language + tags. + Reduce array size of name strings in case of invalid entries. + (tt_face_free_name): Updated. + + * docs/CHANGES: Updated. + +2017-01-25 Werner Lemberg + + [sfnt] s/TT_NameEntry/TT_Name/. + + * include/freetype/internal/tttypes.h (TT_NameEntryRec): Renamed + to... + (TT_NameRec): This. + (TT_NameTableRec): Updated. + + * src/base/ftsnames.c (FT_Get_Sfnt_Name): Updated. + + * src/sfnt/sfdriver.c (sfnt_get_ps_name): Updated. + + * src/sfnt/sfobjs.c (tt_name_entry_ascii_from_utf16, + tt_name_entry_ascii_from_other): Renamed to... + (tt_name_ascii_from_utf16, tt_name_entry_ascii_from_other): This, + respectively. + (TT_NameEntry_ConvertFunc): Renamed to... + (TT_Name_ConvertFunc): This. + (tt_face_get_name): Updated. + + * src/sfnt/ttload.c (tt_face_load_name, tt_face_free_name): + Updated. + +2017-01-24 Werner Lemberg + + [sfnt] Fix Postscript name service for symbol fonts. + + * src/sfnt/sfdriver.c (sfnt_get_ps_name): Accept PID/EID=3/0 + entries also. + +2017-01-24 Werner Lemberg + + [truetype] For OpenType 1.7: s/preferred/typographic/ (sub)family. + + * include/freetype/ftsnames.h + (FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_FAMILY, + FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_SUBFAMILY): New macros. + (FT_PARAM_TAG_IGNORE_PREFERRED_FAMILY, + FT_PARAM_TAG_IGNORE_PREFERRED_SUBFAMILY): Deprecated. + + * include/freetype/ttnameid.h (TT_NAME_ID_TYPOGRAPHIC_FAMILY, + TT_NAME_ID_TYPOGRAPHIC_SUBFAMILY): New macros. + (TT_NAME_ID_PREFERRED_FAMILY, TT_NAME_ID_PREFERRED_SUBFAMILY): + Deprecated. + + * src/sfnt/sfobjs.c (sfnt_load_face): Updated. + + * docs/CHANGES: Updated. + +2017-01-23 Werner Lemberg + + [base] Add `FT_Set_Default_Properties' (#49187). + + * include/freetype/ftmodapi.h: Add declaration. + + * src/base/ftinit.c (ft_set_default_properties): Renamed to... + (FT_Set_Default_Properties): ... this. + (FT_Init_FreeType): Updated. + + * docs/CHANGES: Updated. + +2017-01-23 Werner Lemberg + + [truetype] Minor updates for OpenType 1.8.1. + + * src/truetype/ttgxvar.h (GX_MVarTable): `axisCount' has been + removed from the specification; it is now reserved. + + * src/truetype/ttgxvar.c (ft_var_load_mvar): Updated. + (GX_FVar_Head): Remove `countSizePairs'; the corresponding data + field in the `MVAR' table is now reserved. + (fvar_fields): Updated. + +2017-01-23 Werner Lemberg + + [truetype] Avoid segfault for invalid variation data. + + * src/truetype/ttgxvar.c (ft_var_load_item_variation_store): Assure + `itemCount' is not zero. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=441 + +2017-01-20 Werner Lemberg + + * src/truetype/ttinterp.c (TT_RunIns): Adjust loop detector limits. + +2017-01-17 Werner Lemberg + + * include/freetype/ttnameid.h: Updated to OpenType 1.8.1. + + (TT_APPLE_ID_FULL_UNICODE): New macro. + + (TT_MS_LANGID_BOSNIAN_BOSNIA_HERZ_CYRILLIC, + TT_MS_LANGID_UPPER_SORBIAN_GERMANY, + TT_MS_LANGID_LOWER_SORBIAN_GERMANY, TT_MS_LANGID_IRISH_IRELAND, + TT_MS_LANGID_INUKTITUT_CANADA_LATIN, TT_MS_LANGID_BASHKIR_RUSSIA, + TT_MS_LANGID_LUXEMBOURGISH_LUXEMBOURG, + TT_MS_LANGID_GREENLANDIC_GREENLAND, TT_MS_LANGID_MAPUDUNGUN_CHILE, + TT_MS_LANGID_MOHAWK_MOHAWK, TT_MS_LANGID_BRETON_FRANCE, + TT_MS_LANGID_OCCITAN_FRANCE, TT_MS_LANGID_CORSICAN_FRANCE, + TT_MS_LANGID_ALSATIAN_FRANCE, TT_MS_LANGID_YAKUT_RUSSIA, + TT_MS_LANGID_KICHE_GUATEMALA, TT_MS_LANGID_KINYARWANDA_RWANDA, + TT_MS_LANGID_WOLOF_SENEGAL, TT_MS_LANGID_DARI_AFGHANISTAN): New + macros. + + (TT_MS_LANGID_SERBIAN_BOSNIA_HERZ_CYRILLIC): Fix value. + + (TT_MS_LANGID_GERMAN_LIECHTENSTEIN, TT_MS_LANGID_CATALAN_CATALAN, + TT_MS_LANGID_CHINESE_MACAO, TT_MS_LANGID_SPANISH_SPAIN_MODERN_SORT, + TT_MS_LANGID_KOREAN_KOREA, TT_MS_LANGID_ROMANSH_SWITZERLAND, + TT_MS_LANGID_SLOVENIAN_SLOVENIA, TT_MS_LANGID_BASQUE_BASQUE, + TT_MS_LANGID_SETSWANA_SOUTH_AFRICA, + TT_MS_LANGID_ISIXHOSA_SOUTH_AFRICA, + TT_MS_LANGID_ISIZULU_SOUTH_AFRICA, TT_MS_LANGID_KAZAKH_KAZAKHSTAN, + TT_MS_LANGID_KYRGYZ_KYRGYZSTAN, TT_MS_LANGID_KISWAHILI_KENYA, + TT_MS_LANGID_TATAR_RUSSIA, TT_MS_LANGID_ODIA_INDIA, + TT_MS_LANGID_MONGOLIAN_PRC, TT_MS_LANGID_TIBETAN_PRC, + TT_MS_LANGID_WELSH_UNITED_KINGDOM, TT_MS_LANGID_GALICIAN_GALICIAN, + TT_MS_LANGID_SINHALA_SRI_LANKA, TT_MS_LANGID_TAMAZIGHT_ALGERIA, + TT_MS_LANGID_SESOTHO_SA_LEBOA_SOUTH_AFRICA, TT_MS_LANGID_YI_PRC, + TT_MS_LANGID_UIGHUR_PRC): New aliases. + + Remove commented out code. + + (TT_NAME_ID_LIGHT_BACKGROUND, TT_NAME_ID_DARK_BACKGROUND, + TT_NAME_ID_VARIATIONS_PREFIX): New macros. + + (HAVE_LIMIT_ON_IDENTS): Remove macro (which was useless since many + years), use guarded long macros by default and define short versions + as aliases for the long ones. + +2017-01-15 Werner Lemberg + + * src/truetype/ttgxvar.c (tt_apply_var): Handle underline parameters + also. + +2017-01-11 Werner Lemberg + + * src/base/ftobjs.c (ft_open_face_internal): Improve tracing. + +2017-01-11 Werner Lemberg + + [truetype] Actually use metrics variation service. + + * src/base/ftmm.c: Include FT_SERVICE_METRICS_VARIATIONS_H. + (ft_face_get_mvar_service): New auxiliary function to look up + metrics variation service. + (FT_Set_Var_Design_Coordinates, FT_Set_MM_Blend_Coordinates, + FT_Set_Var_Blend_Coordinates): Call metrics variation service. + + * src/truetype/ttobjs.c (tt_face_init): Use metrics variations for + named instances. + +2017-01-11 Werner Lemberg + + [truetype] Provide metrics variation service. + + * include/freetype/internal/services/svmetric.h + (FT_Metrics_Adjust_Func): Reduce number of necessary parameters. + + * src/truetype/ttgxvar.c: Include FT_LIST_H. + (tt_size_reset_iterator): New auxiliary function for... + (tt_apply_var): New function. + + * src/truetype/ttgxvar.h: Updated. + + * src/truetype/ttdriver.c (tt_service_metrics_variations): Add + `tt_apply_mvar'. + + * include/freetype/internal/ftserv.h (FT_ServiceCache): Add metrics + variation service. + +2017-01-11 Werner Lemberg + + [truetype] Parse `MVAR' table. + + * src/truetype/ttgxvar.h (MVAR_TAG_XXX): New macros for MVAR tags. + (GX_Value, GX_MVarTable): New structures. + (GX_Blend): Add it. + + * src/truetype/ttgxvar.c (GX_VALUE_SIZE, GX_VALUE_CASE, + GX_GASP_CASE): New macros. + (ft_var_get_value_pointer): New auxiliary function to get a pointer + to a value from various SFNT tables already stored in `TT_Face'. + (ft_var_load_mvar): New function. + (TT_Get_MM_Var): Call it. + (tt_done_blend): Updated. + +2017-01-11 Werner Lemberg + + [truetype] More preparations for MVAR support. + + * src/truetype/ttobjs.c (tt_size_reset): Add argument to make + function only recompute ascender, descender, and height. + + * src/truetype/ttobjs.h: Updated. + + * src/truetype/ttdriver.c (tt_size_select, tt_size_request): + Updated. + +2017-01-09 Werner Lemberg + + [pcf] Disable long family names by default. + + * include/freetype/config/ftoption.h + (PCF_CONFIG_OPTION_LONG_FAMILY_NAMES): Comment out. + +2017-01-09 Werner Lemberg + + [pcf] Make long family names configurable. + + The change from 2016-09-29 was too radical (except for people using + the openSuSE GNU/Linux distribution). To ameliorate the situation, + PCF_CONFIG_OPTION_LONG_FAMILY_NAMES gets introduced which controls + the feature; if set, a new PCF property option + `no-long-family-names' can be used to switch this feature off. + + * include/freetype/config/ftoption.h, devel/ftoption.h + (PCF_CONFIG_OPTION_LONG_FAMILY_NAMES): New option. + + * include/freetype/ftpcfdrv.h: New header file (only containing + comments currently, used for building the documentation). + + * include/freetype/config/ftheader.h (FT_PCF_DRIVER_H): New macro. + + * src/pcf/pcf.h (PCF_Driver): Add `no_long_family_names' field. + + * src/pcf/pcfdrivr.c: Include FT_SERVICE_PROPERTIES_H and + FT_PCF_DRIVER_H. + (pcf_property_set, pcf_property_get): New functions. + (pcf_service_properties): New service. + (pcf_services): Updated. + (pcf_driver_init) [PCF_CONFIG_OPTION_LONG_FAMILY_NAMES]: Handle + `no_long_family_names'. + + * src/pcf/pcfread.c (pcf_load_font): Handle `no_long_family_names' + and PCF_CONFIG_OPTION_LONG_FAMILY_NAMES. + + * docs/CHANGES: Updated. + +2017-01-09 Werner Lemberg + + [pcf] Introduce a driver structure. + + To be filled later on with something useful. + + * src/pcf/pcf.h (PCF_Driver): New structure. + + * src/pcf/pcfdrivr.c (pcf_driver_init, pcf_driver_done): New dummy + functions. + (pcf_driver_class): Updated. + +2017-01-08 Werner Lemberg + + [truetype] Again some GX code shuffling. + + We need this later on for MVAR also. + + * src/truetype/ttgxvar.c (tt_hadvance_adjust): Split off computing + an item store variation delta into... + (ft_var_get_item_delta): ...new function. + +2017-01-08 Werner Lemberg + + [truetype] Adjust font variation flags for MVAR. + + * include/freetype/internal/tttypes.h (TT_FACE_FLAG_VAR_XXX): + Remove all flags related to MVAR; replace it with... + (TT_FACE_FLAG_VAR_MVAR): ...this new macro. + (TT_Face): Remove `mvar_support' field (which was still unused). + +2017-01-06 Werner Lemberg + + [truetype] More GX code shuffling. + + We need this later on for MVAR also. + + * src/truetype/ttgxvar.c (tt_done_blend): Split off handling of item + variation store into... + (ft_var_done_item_variation_store): ...new function. + +2017-01-06 Werner Lemberg + + [truetype] More generalization of GX stuff. + + We need this later on for MVAR also. + + * src/truetype/ttgxvar.c (ft_var_load_delta_set_index_mapping): Add + parameters for delta-set index mapping and item variation store. + (ft_var_load_item_variation_store): Add parameter for item variation + store. + s/hvarData/varData/. + Move allocation of `hvar_table' to... + (ft_var_load_hvar): ...this function. + Updated. + +2017-01-06 Werner Lemberg + + [truetype] Some GX structure renames for generalization. + + We need this later on for MVAR also. + + * src/truetype/ttgxvar.h (GX_HVarData): Renamed to... + (GX_ItemVarData): ...this. + (GX_HVarRegion): Renamed to... + (GX_VarRegion): ...this. + (GX_HVStore): Renamed to... + (GX_ItemVarStore): ...this. + (GX_WidthMap): Renamed to... + (GX_DeltaSetIdxMap): ...this. + + (GX_HVarTable): Updated. + + * src/truetype/ttgxvar.c: Updated. + +2017-01-06 Werner Lemberg + + [truetype] Code shuffling. + + * src/truetype/ttgxvar.c (ft_var_load_hvar): Split off loading of + item variation store and delta set index mapping into... + (ft_var_load_item_variation_store, + ft_var_load_delta_set_index_mapping): ...new functions. + +2017-01-06 Werner Lemberg + + [truetype] Add HVAR access without advance width map. + + * src/truetype/ttgxvar.c (ft_var_load_hvar): Handle case where + `offsetToAdvanceWidthMapping' is zero. + (tt_hadvance_adjust): Implement direct deltaSet access by glyph + index. + +2017-01-06 Werner Lemberg + + [pcf] Revise driver. + + This commit improves tracing and handling of malformed fonts. In + particular, the changes to `pcf_get_properties' fix + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=379 + + * src/pcf/pcfread.c (tableNames): Use long names for better + readability. + (pcf_read_TOC): Allow at most 9 tables. + (pcf_get_properties): Allow at most 256 properties. + Limit strings array length to 256 * (65536 + 1) bytes. + Better tracing. + (pcf_get_metric): Trace metric data. + (pcf_get_metrics): Allow at most 65536 metrics. + Fix comparison of `metrics->ascent' and `metrics->descent' to avoid + potential overflow. + Better tracing. + (pcf_get_bitmaps): Allow at most 65536 bitmaps. + Better tracing. + (pcf_get_encodings, pcf_get_accel): Better tracing. + + * src/pcf/pcfdrivr.c (PCF_Glyph_Load): Don't trace `format' details. + These are now shown by `pcf_get_bitmaps'. + +2017-01-04 Werner Lemberg + + * src/pcf/pcfdrivr.c (PCF_Face_Init): Trace compression format. + +2017-01-04 Werner Lemberg + + [cff] More consistency checks for pure CFFs. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=378 + + * src/cff/cffload.c (cff_font_load): Check element number and size + of Name and Top DICT indices. + +2017-01-04 Werner Lemberg + + [cff, truetype] Minor tracing improvement. + + * src/cff/cffobjs.c (cff_face_init), src/truetype/ttobjs.c + (tt_face_init): Indent first tracing message from SFNT driver. + +2017-01-03 Werner Lemberg + + [truetype] Various minor fixes. + + * src/truetype/ttgload.c (TT_Load_Simple_Glyph): Check instruction + size only if we do native hinting. + (TT_Load_Glyph): Trace returned error code. + + * src/truetype/ttobjs.c (tt_size_run_fpgm, tt_size_run_prep): Trace + returned error code. + (tt_size_ready_bytecode): Don't run `prep' table if `fpgm' table is + invalid. + +2017-01-03 Werner Lemberg + + [sfnt] Don't fail if PCLT, EBLC (and similar tables) are invalid. + + These tables are optional. + + * src/sfnt/sfobjs.c (sfnt_load_face): Implement it. + +2017-01-03 Werner Lemberg + + * src/cff/cffparse.c (cff_parse_num): Simplify. + +2017-01-03 Werner Lemberg + + Various fixes for clang's undefined behaviour sanitizer. + + * src/cff/cffload.c (FT_fdot14ToFixed): Fix casting. + (cff_blend_doBlend): Don't left-shift negative numbers. + Handle 5-byte numbers byte by byte to avoid alignment issues. + + * src/cff/cffparse.c (cff_parse_num): Handle 5-byte numbers byte by + byte to avoid alignment issues. + + * src/cid/cidload (cid_read_subrs): Do nothing if we don't have any + subrs. + + * src/psaux/t1decode.c (t1_decode_parse_charstring): Fix tracing. + + * src/tools/glnames.py (main): Put `DEFINE_PSTABLES' guard around + definition of `ft_get_adobe_glyph_index'. + + * src/psnames/pstables.h: Regenerated. + + * src/psnames/psmodule.c: Include `pstables.h' twice to get both + declaration and definition. + + * src/truetype/ttgxvar.c (FT_fdot14ToFixed, FT_intToFixed): Fix + casting. + +2017-01-01 Werner Lemberg + + [cff] Handle multiple `blend' operators in a row correctly. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=368 + + * src/cff/cffload.c (cff_blend_doBlend): Adjust `parser->stack' + pointers into `subFont->blend_stack' after reallocation. + +2017-01-01 Werner Lemberg + + [sfnt] Return correct number of named instances for TTCs. + + Without this patch, requesting information for face index N returned + the data for face index N+1 (or index 0). + + * src/sfnt/sfobjs.c (sfnt_init_face): Correctly adjust `face_index' + for negative `face_instance_index' values. + +2016-12-31 Werner Lemberg + + */*: Use hex numbers for errors in tracing messages. + +2016-12-31 Werner Lemberg + + [truetype] Check axis count in HVAR table. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=362 + + * src/truetype/ttgxvar.c (ft_var_load_hvar): Check axis count. + (ft_var_load_avar): Fix tracing message. + + +---------------------------------------------------------------------------- + +Copyright 2016-2018 by +David Turner, Robert Wilhelm, and Werner Lemberg. + +This file is part of the FreeType project, and may only be used, modified, +and distributed under the terms of the FreeType project license, +LICENSE.TXT. By continuing to use, modify, or distribute this file you +indicate that you have read the license and understand and accept it +fully. + + +Local Variables: +version-control: never +coding: utf-8 +End: From 713d68ee9f47cc8df56e47fa2f54b191bb8c3186 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sat, 17 Feb 2018 18:35:15 +0100 Subject: [PATCH 425/470] [sfnt] Prefer `CBDT'/`CBLC' over `glyf' table (#53154). --- ChangeLog | 4 ++++ src/sfnt/sfobjs.c | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/ChangeLog b/ChangeLog index e060cbdf7..a8d3f71a4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2018-02-17 Werner Lemberg + + [sfnt] Prefer `CBDT'/`CBLC' over `glyf' table (#53154). + 2018-02-06 Werner Lemberg [truetype] Integer overflow issues. diff --git a/src/sfnt/sfobjs.c b/src/sfnt/sfobjs.c index 0c917030f..6ba8509f5 100644 --- a/src/sfnt/sfobjs.c +++ b/src/sfnt/sfobjs.c @@ -1144,6 +1144,8 @@ FT_Bool has_outline; FT_Bool is_apple_sbit; FT_Bool is_apple_sbix; + FT_Bool has_CBLC; + FT_Bool has_CBDT; FT_Bool ignore_typographic_family = FALSE; FT_Bool ignore_typographic_subfamily = FALSE; @@ -1224,6 +1226,13 @@ goto Exit; } + has_CBLC = !face->goto_table( face, TTAG_CBLC, stream, 0 ); + has_CBDT = !face->goto_table( face, TTAG_CBDT, stream, 0 ); + + /* Ignore outlines for CBLC/CBDT fonts. */ + if ( has_CBLC || has_CBDT ) + has_outline = FALSE; + /* OpenType 1.8.2 introduced limits to this value; */ /* however, they make sense for older SFNT fonts also */ if ( face->header.Units_Per_EM < 16 || From 020647915829dc03a694aed629bddabe42cb6ad0 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Thu, 1 Mar 2018 21:34:57 +0100 Subject: [PATCH 426/470] * builds/unix/configure.raw: Need HarfBuzz 1.3.0 or newer. Problem reported by Alan Coopersmith . --- ChangeLog | 6 ++++++ builds/unix/configure.raw | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index a8d3f71a4..5b9ee68e2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2018-02-23 Werner Lemberg + + * builds/unix/configure.raw: Need HarfBuzz 1.3.0 or newer. + + Problem reported by Alan Coopersmith . + 2018-02-17 Werner Lemberg [sfnt] Prefer `CBDT'/`CBLC' over `glyf' table (#53154). diff --git a/builds/unix/configure.raw b/builds/unix/configure.raw index 3d175834a..48e0f40d5 100644 --- a/builds/unix/configure.raw +++ b/builds/unix/configure.raw @@ -487,7 +487,7 @@ AC_ARG_WITH([harfbuzz], have_harfbuzz=no if test x"$with_harfbuzz" = xyes -o x"$with_harfbuzz" = xauto; then - harfbuzz_pkg="harfbuzz >= 0.9.21" + harfbuzz_pkg="harfbuzz >= 1.3.0" have_harfbuzz_pkg=no if test x"$HARFBUZZ_CFLAGS" = x -a x"$HARFBUZZ_LIBS" = x; then From efd13c5d1b313320a2026cf88aeded2544f3ca64 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Thu, 1 Mar 2018 22:17:54 +0100 Subject: [PATCH 427/470] * src/truetype/ttinterp.c (TT_RunIns): Fix tracing arguments. --- ChangeLog | 4 ++++ src/truetype/ttinterp.c | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5b9ee68e2..536ce7c23 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2018-03-01 Werner Lemberg + + * src/truetype/ttinterp.c (TT_RunIns): Fix tracing arguments. + 2018-02-23 Werner Lemberg * builds/unix/configure.raw: Need HarfBuzz 1.3.0 or newer. diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c index 5c8ff4f3d..240dae946 100644 --- a/src/truetype/ttinterp.c +++ b/src/truetype/ttinterp.c @@ -8521,8 +8521,8 @@ LNo_Error_: FT_TRACE4(( " %d instruction%s executed\n", - ins_counter == 1 ? "" : "s", - ins_counter )); + ins_counter, + ins_counter == 1 ? "" : "s" )); return FT_Err_Ok; LErrorCodeOverflow_: From 5955b77b1dee4363cdd047eb06a701b1cb8fd395 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sat, 3 Mar 2018 09:21:59 +0100 Subject: [PATCH 428/470] Minor documentation improvement. --- include/freetype/freetype.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h index 449172949..aeb951c97 100644 --- a/include/freetype/freetype.h +++ b/include/freetype/freetype.h @@ -2833,6 +2833,10 @@ FT_BEGIN_HEADER /* since its glyph indices are not listed in any of the font's */ /* charmaps. */ /* */ + /* If no active cmap is set up (i.e., `face->charmap' is zero), the */ + /* call to @FT_Get_Char_Index is omitted, and the function behaves */ + /* identically to @FT_Load_Glyph. */ + /* */ FT_EXPORT( FT_Error ) FT_Load_Char( FT_Face face, FT_ULong char_code, From f4a3531655cc6f9b8c1c8b5f4dc097111d672304 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Mon, 5 Mar 2018 20:45:12 +0100 Subject: [PATCH 429/470] Make `ftfntfmt.c' part of the `base' module. `ftobjs.c' needs `FT_Get_Font_Format'. Problem reported by duhuanpeng <548708880@qq.com>. * modules.cfg (BASE_EXTENSIONS): Don't include `ftfntfmt.c'. * src/base/ftbase.c: Include `ftfntfmt.c'. * src/base/rules.mk (BASE_SRC): Add `ftfntfmt.c'. * src/base/Jamfile (_sources): Adjusted. * docs/INSTALL.ANY: Updated. --- ChangeLog | 16 ++++++++++++++++ docs/INSTALL.ANY | 1 - modules.cfg | 5 ----- src/base/Jamfile | 2 +- src/base/ftbase.c | 1 + src/base/rules.mk | 1 + 6 files changed, 19 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 536ce7c23..17a658ad7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2018-03-05 Werner Lemberg + + Make `ftfntfmt.c' part of the `base' module. + + `ftobjs.c' needs `FT_Get_Font_Format'. + + Problem reported by duhuanpeng <548708880@qq.com>. + + * modules.cfg (BASE_EXTENSIONS): Don't include `ftfntfmt.c'. + + * src/base/ftbase.c: Include `ftfntfmt.c'. + * src/base/rules.mk (BASE_SRC): Add `ftfntfmt.c'. + * src/base/Jamfile (_sources): Adjusted. + + * docs/INSTALL.ANY: Updated. + 2018-03-01 Werner Lemberg * src/truetype/ttinterp.c (TT_RunIns): Fix tracing arguments. diff --git a/docs/INSTALL.ANY b/docs/INSTALL.ANY index 47d080f28..618b6341f 100644 --- a/docs/INSTALL.ANY +++ b/docs/INSTALL.ANY @@ -39,7 +39,6 @@ I. Standard procedure src/base/ftbdf.c -- optional, see src/base/ftbitmap.c -- optional, see src/base/ftcid.c -- optional, see - src/base/ftfntfmt.c -- optional, see src/base/ftfstype.c -- optional src/base/ftgasp.c -- optional, see src/base/ftgxval.c -- optional, see diff --git a/modules.cfg b/modules.cfg index 6ce0f3edb..25bf9ffa5 100644 --- a/modules.cfg +++ b/modules.cfg @@ -183,11 +183,6 @@ BASE_EXTENSIONS += ftbitmap.c # See include/freetype/ftcid.h for the API. BASE_EXTENSIONS += ftcid.c -# Support functions for font formats. -# -# See include/freetype/ftfntfmt.h for the API. -BASE_EXTENSIONS += ftfntfmt.c - # Access FSType information. Needs fttype1.c. # # See include/freetype/freetype.h for the API. diff --git a/src/base/Jamfile b/src/base/Jamfile index 2b47b8a24..ec1703339 100644 --- a/src/base/Jamfile +++ b/src/base/Jamfile @@ -21,6 +21,7 @@ SubDir FT2_TOP $(FT2_SRC_DIR) base ; ftadvanc ftcalc ftdbgmem + ftfntfmt ftgloadr fthash ftobjs @@ -51,7 +52,6 @@ SubDir FT2_TOP $(FT2_SRC_DIR) base ; ftbitmap ftcid ftdebug - ftfntfmt ftfstype ftgasp ftglyph diff --git a/src/base/ftbase.c b/src/base/ftbase.c index a1bdbaf6e..3e5bf221e 100644 --- a/src/base/ftbase.c +++ b/src/base/ftbase.c @@ -23,6 +23,7 @@ #include "ftadvanc.c" #include "ftcalc.c" #include "ftdbgmem.c" +#include "ftfntfmt.c" #include "ftgloadr.c" #include "fthash.c" #include "ftmac.c" diff --git a/src/base/rules.mk b/src/base/rules.mk index 6491f5d8a..0f47a7285 100644 --- a/src/base/rules.mk +++ b/src/base/rules.mk @@ -40,6 +40,7 @@ BASE_SRC := $(BASE_DIR)/basepic.c \ $(BASE_DIR)/ftadvanc.c \ $(BASE_DIR)/ftcalc.c \ $(BASE_DIR)/ftdbgmem.c \ + $(BASE_DIR)/ftfntfmt.c \ $(BASE_DIR)/ftgloadr.c \ $(BASE_DIR)/fthash.c \ $(BASE_DIR)/ftobjs.c \ From 733a21bdbc9516ccf47b9b20d3a39d069a4cdc82 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Mon, 5 Mar 2018 23:37:17 +0100 Subject: [PATCH 430/470] Make `ftlcdfil.c' part of the `base' module. `ftobjs.c' needs `ft_lcd_padding'. Problem reported by duhuanpeng <548708880@qq.com>. * modules.cfg (BASE_EXTENSIONS): Don't include `ftlcdfil.c'. * src/base/ftbase.c: Include `ftlcdfil.c'. * src/base/rules.mk (BASE_SRC): Add `ftlcdfil.c'. * src/base/Jamfile (_sources): Adjusted. * docs/INSTALL.ANY: Updated. --- ChangeLog | 16 ++++++++++++++++ docs/INSTALL.ANY | 1 - modules.cfg | 5 ----- src/base/Jamfile | 2 +- src/base/ftbase.c | 1 + src/base/rules.mk | 1 + 6 files changed, 19 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 17a658ad7..ee0732015 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2018-03-05 Werner Lemberg + + Make `ftlcdfil.c' part of the `base' module. + + `ftobjs.c' needs `ft_lcd_padding'. + + Problem reported by duhuanpeng <548708880@qq.com>. + + * modules.cfg (BASE_EXTENSIONS): Don't include `ftlcdfil.c'. + + * src/base/ftbase.c: Include `ftlcdfil.c'. + * src/base/rules.mk (BASE_SRC): Add `ftlcdfil.c'. + * src/base/Jamfile (_sources): Adjusted. + + * docs/INSTALL.ANY: Updated. + 2018-03-05 Werner Lemberg Make `ftfntfmt.c' part of the `base' module. diff --git a/docs/INSTALL.ANY b/docs/INSTALL.ANY index 618b6341f..fddac9ad2 100644 --- a/docs/INSTALL.ANY +++ b/docs/INSTALL.ANY @@ -42,7 +42,6 @@ I. Standard procedure src/base/ftfstype.c -- optional src/base/ftgasp.c -- optional, see src/base/ftgxval.c -- optional, see - src/base/ftlcdfil.c -- optional, see src/base/ftmm.c -- optional, see src/base/ftotval.c -- optional, see src/base/ftpatent.c -- optional diff --git a/modules.cfg b/modules.cfg index 25bf9ffa5..702cf9913 100644 --- a/modules.cfg +++ b/modules.cfg @@ -203,11 +203,6 @@ BASE_EXTENSIONS += ftglyph.c # See include/freetype/ftgxval.h for the API. BASE_EXTENSIONS += ftgxval.c -# Support for LCD color filtering of subpixel bitmaps. -# -# See include/freetype/ftlcdfil.h for the API. -BASE_EXTENSIONS += ftlcdfil.c - # Multiple Master font interface. # # See include/freetype/ftmm.h for the API. diff --git a/src/base/Jamfile b/src/base/Jamfile index ec1703339..4994c1b4c 100644 --- a/src/base/Jamfile +++ b/src/base/Jamfile @@ -24,6 +24,7 @@ SubDir FT2_TOP $(FT2_SRC_DIR) base ; ftfntfmt ftgloadr fthash + ftlcdfil ftobjs ftoutln ftpic @@ -57,7 +58,6 @@ SubDir FT2_TOP $(FT2_SRC_DIR) base ; ftglyph ftgxval ftinit - ftlcdfil ftmm ftotval ftpatent diff --git a/src/base/ftbase.c b/src/base/ftbase.c index 3e5bf221e..f914b9b24 100644 --- a/src/base/ftbase.c +++ b/src/base/ftbase.c @@ -26,6 +26,7 @@ #include "ftfntfmt.c" #include "ftgloadr.c" #include "fthash.c" +#include "ftlcdfil.c" #include "ftmac.c" #include "ftobjs.c" #include "ftoutln.c" diff --git a/src/base/rules.mk b/src/base/rules.mk index 0f47a7285..e9805bd06 100644 --- a/src/base/rules.mk +++ b/src/base/rules.mk @@ -43,6 +43,7 @@ BASE_SRC := $(BASE_DIR)/basepic.c \ $(BASE_DIR)/ftfntfmt.c \ $(BASE_DIR)/ftgloadr.c \ $(BASE_DIR)/fthash.c \ + $(BASE_DIR)/ftlcdfil.c \ $(BASE_DIR)/ftobjs.c \ $(BASE_DIR)/ftoutln.c \ $(BASE_DIR)/ftpic.c \ From ccec8892291f556a44cecba6efac568a03e4ff12 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Thu, 8 Mar 2018 06:09:17 +0100 Subject: [PATCH 431/470] Minor: Update `CHANGES' and improve documentation in `modules.cfg'. --- docs/CHANGES | 19 +++++++++++++++++++ modules.cfg | 17 +++++++++-------- 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/docs/CHANGES b/docs/CHANGES index ce41a20b7..4add2477d 100644 --- a/docs/CHANGES +++ b/docs/CHANGES @@ -1,3 +1,21 @@ +CHANGES BETWEEN 2.9 and 2.9.1 + + I. IMPORTANT BUG FIXES + + - Type 1 fonts containing flex features were not rendered + correctly (bug introduced in version 2.9). + + + II. MISCELLANEOUS + + - Bug fix: Multiple calls to `FT_Get_MM_Var' returned garbage. + + - The base extensions `ftlcdfil' and `ftfntfmt' are now part of + the base module (and thus no longer configurable in file + `modules.cfg'). + + +====================================================================== CHANGES BETWEEN 2.8.1 and 2.9 @@ -86,6 +104,7 @@ CHANGES BETWEEN 2.8.1 and 2.9 and switch between hexadecimal and decimal display of integers (key `I'). + ====================================================================== CHANGES BETWEEN 2.8 and 2.8.1 diff --git a/modules.cfg b/modules.cfg index 702cf9913..4bf344524 100644 --- a/modules.cfg +++ b/modules.cfg @@ -66,7 +66,7 @@ FONT_MODULES += type42 # No FT_CONFIG_OPTION_PIC support. FONT_MODULES += winfonts -# PCF font driver. +# PCF font driver. If debugging and tracing is enabled, needs `ftbitmap.c'. # No FT_CONFIG_OPTION_PIC support. FONT_MODULES += pcf @@ -113,11 +113,11 @@ RASTER_MODULES += smooth # FreeType's cache sub-system (quite stable but still in beta -- this means # that its public API is subject to change if necessary). See -# include/freetype/ftcache.h. Needs ftglyph.c. +# include/freetype/ftcache.h. Needs `ftglyph.c'. # No FT_CONFIG_OPTION_PIC support. AUX_MODULES += cache -# TrueType GX/AAT table validation. Needs ftgxval.c below. +# TrueType GX/AAT table validation. Needs `ftgxval.c' below. # # No FT_CONFIG_OPTION_PIC support. # AUX_MODULES += gxvalid @@ -140,7 +140,7 @@ AUX_MODULES += lzw # No FT_CONFIG_OPTION_PIC support. AUX_MODULES += bzip2 -# OpenType table validation. Needs ftotval.c below. +# OpenType table validation. Needs `ftotval.c' below. # # No FT_CONFIG_OPTION_PIC support. # AUX_MODULES += otvalid @@ -183,7 +183,7 @@ BASE_EXTENSIONS += ftbitmap.c # See include/freetype/ftcid.h for the API. BASE_EXTENSIONS += ftcid.c -# Access FSType information. Needs fttype1.c. +# Access FSType information. Needs `fttype1.c'. # # See include/freetype/freetype.h for the API. BASE_EXTENSIONS += ftfstype.c @@ -193,7 +193,7 @@ BASE_EXTENSIONS += ftfstype.c # See include/freetype/ftgasp.h for the API. BASE_EXTENSIONS += ftgasp.c -# Convenience functions to handle glyphs. Needs ftbitmap.c. +# Convenience functions to handle glyphs. Needs `ftbitmap.c'. # # See include/freetype/ftglyph.h for the API. BASE_EXTENSIONS += ftglyph.c @@ -223,12 +223,13 @@ BASE_EXTENSIONS += ftpatent.c # See include/freetype/ftpfr.h for the API. BASE_EXTENSIONS += ftpfr.c -# Path stroker. Needs ftglyph.c. +# Path stroker. Needs `ftglyph.c'. # # See include/freetype/ftstroke.h for the API. BASE_EXTENSIONS += ftstroke.c -# Support for synthetic emboldening and slanting of fonts. Needs ftbitmap.c. +# Support for synthetic emboldening and slanting of fonts. Needs +# `ftbitmap.c'. # # See include/freetype/ftsynth.h for the API. BASE_EXTENSIONS += ftsynth.c From a7833f26c4ac45cafe1dffdcd7f7dcfd6493161c Mon Sep 17 00:00:00 2001 From: Hugh McMaster Date: Wed, 7 Mar 2018 22:23:54 +1100 Subject: [PATCH 432/470] Make installation of `freetype-config' optional (#53093). Signed-off-by: Hugh McMaster --- ChangeLog | 9 +++++++++ builds/unix/configure.raw | 9 +++++++++ builds/unix/install.mk | 20 ++++++++++++-------- builds/unix/unix-def.in | 3 +++ 4 files changed, 33 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index ee0732015..1711e723a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2018-03-08 Hugh McMaster + + Make installation of `freetype-config' optional (#53093). + + * bulds/unix/configure.raw: Add option `--enable-freetype-config' + and set `INSTALL_FT2_CONFIG'. + * builds/unix/unix-def.in (INSTALL_FT2_CONFIG): Define. + * builds/unix/install.mk (install): Handle it. + 2018-03-05 Werner Lemberg Make `ftlcdfil.c' part of the `base' module. diff --git a/builds/unix/configure.raw b/builds/unix/configure.raw index 48e0f40d5..1b4aa2cad 100644 --- a/builds/unix/configure.raw +++ b/builds/unix/configure.raw @@ -177,6 +177,15 @@ fi CPPFLAGS="${orig_CPPFLAGS}" +AC_ARG_ENABLE([freetype-config], + AS_HELP_STRING([--enable-freetype-config], [install freetype-config]), + [case "${enableval}" in + yes) enable_freetype_config="TRUE" ;; + no) enable_freetype_config="FALSE" ;; + *) AC_MSG_ERROR([unknown value '${enableval}' passed with --enable-freetype-config]) ;; + esac], [enable_freetype_config="FALSE"]) + +AC_SUBST(INSTALL_FT2_CONFIG, [$enable_freetype_config]) # checks for library functions diff --git a/builds/unix/install.mk b/builds/unix/install.mk index d89064e44..89424514f 100644 --- a/builds/unix/install.mk +++ b/builds/unix/install.mk @@ -39,9 +39,11 @@ install: $(PROJECT_LIBRARY) $(MKINSTALLDIRS) $(DESTDIR)$(libdir) \ $(DESTDIR)$(libdir)/pkgconfig \ $(DESTDIR)$(includedir)/freetype2/freetype/config \ - $(DESTDIR)$(bindir) \ - $(DESTDIR)$(datadir)/aclocal \ + $(DESTDIR)$(datadir)/aclocal +ifeq ($(INSTALL_FT2_CONFIG),TRUE) + $(MKINSTALLDIRS) $(DESTDIR)$(bindir) \ $(DESTDIR)$(mandir)/man1 +endif $(LIBTOOL) --mode=install $(INSTALL) \ $(PROJECT_LIBRARY) $(DESTDIR)$(libdir) -for P in $(PUBLIC_H) ; do \ @@ -52,7 +54,7 @@ install: $(PROJECT_LIBRARY) $(INSTALL_DATA) \ $$P $(DESTDIR)$(includedir)/freetype2/freetype/config ; \ done - $(INSTALL_DATA) $(TOP_DIR)/include/ft2build.h \ + $(INSTALL_DATA) $(TOP_DIR)/include/ft2build.h \ $(DESTDIR)$(includedir)/freetype2/ft2build.h $(INSTALL_DATA) $(OBJ_BUILD)/ftconfig.h \ $(DESTDIR)$(includedir)/freetype2/freetype/config/ftconfig.h @@ -60,14 +62,16 @@ install: $(PROJECT_LIBRARY) $(DESTDIR)$(includedir)/freetype2/freetype/config/ftmodule.h $(INSTALL_DATA) $(OBJ_BUILD)/ftoption.h \ $(DESTDIR)$(includedir)/freetype2/freetype/config/ftoption.h - $(INSTALL_SCRIPT) -m 755 $(OBJ_BUILD)/freetype-config \ - $(DESTDIR)$(bindir)/freetype-config - $(INSTALL_SCRIPT) -m 644 $(BUILD_DIR)/freetype2.m4 \ + $(INSTALL_SCRIPT) -m 644 $(BUILD_DIR)/freetype2.m4 \ $(DESTDIR)$(datadir)/aclocal/freetype2.m4 - $(INSTALL_SCRIPT) -m 644 $(OBJ_BUILD)/freetype2.pc \ + $(INSTALL_SCRIPT) -m 644 $(OBJ_BUILD)/freetype2.pc \ $(DESTDIR)$(libdir)/pkgconfig/freetype2.pc - $(INSTALL_DATA) $(TOP_DIR)/docs/freetype-config.1 \ +ifeq ($(INSTALL_FT2_CONFIG),TRUE) + $(INSTALL_SCRIPT) -m 755 $(OBJ_BUILD)/freetype-config \ + $(DESTDIR)$(bindir)/freetype-config + $(INSTALL_DATA) $(TOP_DIR)/docs/freetype-config.1 \ $(DESTDIR)$(mandir)/man1/freetype-config.1 +endif uninstall: diff --git a/builds/unix/unix-def.in b/builds/unix/unix-def.in index 059a06159..6957053ab 100644 --- a/builds/unix/unix-def.in +++ b/builds/unix/unix-def.in @@ -145,6 +145,9 @@ $(OBJ_BUILD)/freetype2.pc: $(TOP_DIR)/builds/unix/freetype2.in chmod a-w $@.tmp mv $@.tmp $@ +# defines whether we should install `freetype-config' or not +INSTALL_FT2_CONFIG = @INSTALL_FT2_CONFIG@ + all install: $(OBJ_BUILD)/freetype-config \ $(OBJ_BUILD)/freetype2.pc From b0a93839b52818abbfe9b4c8755b4aa0f5232063 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Thu, 8 Mar 2018 06:36:47 +0100 Subject: [PATCH 433/470] CHANGES: Document `--enable-freetype-config'. --- docs/CHANGES | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/CHANGES b/docs/CHANGES index 4add2477d..4b525558e 100644 --- a/docs/CHANGES +++ b/docs/CHANGES @@ -14,6 +14,16 @@ CHANGES BETWEEN 2.9 and 2.9.1 the base module (and thus no longer configurable in file `modules.cfg'). + - Use of the `freetype-config' script to get compilation and + linking options is deprecated since it doesn't support + cross-compiling, among other deficiencies. Instead, you should + use the `pkg-config' interface. + + The `configure' script no longer installs `freetype-config' by + default. For backwards compatibility, a new configure option + `--enable-freetype-config' is provided that reverts this + decision. + ====================================================================== From e277267c5229beaa911e9fb8b16fb80530c83ead Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Thu, 8 Mar 2018 11:33:31 +0100 Subject: [PATCH 434/470] Typo. --- ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 1711e723a..3bef98b55 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,7 +2,7 @@ Make installation of `freetype-config' optional (#53093). - * bulds/unix/configure.raw: Add option `--enable-freetype-config' + * builds/unix/configure.raw: Add option `--enable-freetype-config' and set `INSTALL_FT2_CONFIG'. * builds/unix/unix-def.in (INSTALL_FT2_CONFIG): Define. * builds/unix/install.mk (install): Handle it. From 6f854692a86a778a1b88289fbad75666b6eec621 Mon Sep 17 00:00:00 2001 From: Chun-wei Fan Date: Mon, 5 Mar 2018 12:33:34 +0800 Subject: [PATCH 435/470] * CMakeLists.txt [win32]: Allow MSVC DLL builds (#53287). Do not limit DLL builds to MinGW, since we already have `__declspec(dllexport)' directives in `ftconfig.h'. Also suppress more warnings for POSIX functions. --- CMakeLists.txt | 5 +---- ChangeLog | 8 ++++++++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 83f26b94b..f335fec18 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -119,10 +119,6 @@ endif () project(freetype) -if (WIN32 AND NOT MINGW AND BUILD_SHARED_LIBS) - message(FATAL_ERROR "Building shared libraries on Windows needs MinGW") -endif () - # Disallow in-source builds if ("${PROJECT_BINARY_DIR}" STREQUAL "${PROJECT_SOURCE_DIR}") message(FATAL_ERROR @@ -164,6 +160,7 @@ set(SHARED_LIBRARY_VERSION ${VERSION_MAJOR}.${VERSION_MINOR}) add_definitions(-DFT2_BUILD_LIBRARY) if (WIN32) add_definitions(-D_CRT_SECURE_NO_WARNINGS) + add_definitions(-D_CRT_NONSTDC_NO_WARNINGS) endif () diff --git a/ChangeLog b/ChangeLog index 3bef98b55..155ba1817 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2018-03-09 Chun-wei Fan + + * CMakeLists.txt [win32]: Allow MSVC DLL builds (#53287). + + Do not limit DLL builds to MinGW, since we already have + `__declspec(dllexport)' directives in `ftconfig.h'. + Also suppress more warnings for POSIX functions. + 2018-03-08 Hugh McMaster Make installation of `freetype-config' optional (#53093). From 098dd70cb1845b8c325ef4801c5f2e09e476b1ed Mon Sep 17 00:00:00 2001 From: Nikolaus Waxweiler Date: Sat, 10 Mar 2018 14:51:17 +0100 Subject: [PATCH 436/470] * CMakeLists.txt (BASE_SRCS): Update to changes from 2018-03-05. --- CMakeLists.txt | 2 -- ChangeLog | 4 ++++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f335fec18..e4a41a4e7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -278,13 +278,11 @@ set(BASE_SRCS src/base/ftbdf.c src/base/ftbitmap.c src/base/ftcid.c - src/base/ftfntfmt.c src/base/ftfstype.c src/base/ftgasp.c src/base/ftglyph.c src/base/ftgxval.c src/base/ftinit.c - src/base/ftlcdfil.c src/base/ftmm.c src/base/ftotval.c src/base/ftpatent.c diff --git a/ChangeLog b/ChangeLog index 155ba1817..25639aeac 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2018-03-10 Nikolaus Waxweiler + + * CMakeLists.txt (BASE_SRCS): Update to changes from 2018-03-05. + 2018-03-09 Chun-wei Fan * CMakeLists.txt [win32]: Allow MSVC DLL builds (#53287). From 78cded2c5c687d06c5b74b308fb54af7f807dc0d Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Tue, 13 Mar 2018 11:09:44 +0100 Subject: [PATCH 437/470] Fix cmap format 2 handling (#53320). The patch introduced for #52646 was not correct. * src/sfnt/ttcmap.c (tt_cmap2_char_next): Adjust condition. --- ChangeLog | 8 ++++++++ src/sfnt/ttcmap.c | 15 +++++++-------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 25639aeac..65bc40956 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2018-03-13 Werner Lemberg + + Fix cmap format 2 handling (#53320). + + The patch introduced for #52646 was not correct. + + * src/sfnt/ttcmap.c (tt_cmap2_char_next): Adjust condition. + 2018-03-10 Nikolaus Waxweiler * CMakeLists.txt (BASE_SRCS): Update to changes from 2018-03-05. diff --git a/src/sfnt/ttcmap.c b/src/sfnt/ttcmap.c index 8cc70f759..58b49c94d 100644 --- a/src/sfnt/ttcmap.c +++ b/src/sfnt/ttcmap.c @@ -549,19 +549,18 @@ } } } + + /* if unsuccessful, avoid `charcode' leaving */ + /* the current 256-character block */ + if ( count ) + charcode--; } - /* If `charcode' is <= 0xFF, retry with `charcode + 1'. If */ - /* `charcode' is 0x100 after the loop, do nothing since we have */ - /* just reached the first sub-header for two-byte character codes. */ - /* */ - /* For all other cases, we jump to the next sub-header and adjust */ - /* `charcode' accordingly. */ + /* If `charcode' is <= 0xFF, retry with `charcode + 1'. */ + /* Otherwise jump to the next 256-character block and retry. */ Next_SubHeader: if ( charcode <= 0xFF ) charcode++; - else if ( charcode == 0x100 ) - ; else charcode = FT_PAD_FLOOR( charcode, 0x100 ) + 0x100; } From 5bd76524ef786d942b28dc52618aeda3aebfa3d6 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Tue, 13 Mar 2018 11:11:16 +0100 Subject: [PATCH 438/470] * src/sfnt/ttcmap.c (tt_cmap2_validate): Fix potential numeric overflow. --- ChangeLog | 5 +++++ src/sfnt/ttcmap.c | 21 +++++++++++---------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 65bc40956..d3ead8fc2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2018-03-13 Werner Lemberg + + * src/sfnt/ttcmap.c (tt_cmap2_validate): Fix potential numeric + overflow. + 2018-03-13 Werner Lemberg Fix cmap format 2 handling (#53320). diff --git a/src/sfnt/ttcmap.c b/src/sfnt/ttcmap.c index 58b49c94d..dcde8693e 100644 --- a/src/sfnt/ttcmap.c +++ b/src/sfnt/ttcmap.c @@ -222,10 +222,10 @@ /***** The following charmap lookup and iteration functions all *****/ /***** assume that the value `charcode' fulfills the following. *****/ /***** *****/ - /***** - For one byte characters, `charcode' is simply the *****/ + /***** - For one-byte characters, `charcode' is simply the *****/ /***** character code. *****/ /***** *****/ - /***** - For two byte characters, `charcode' is the 2-byte *****/ + /***** - For two-byte characters, `charcode' is the 2-byte *****/ /***** character code in big endian format. More precisely: *****/ /***** *****/ /***** (charcode >> 8) is the first byte value *****/ @@ -252,11 +252,11 @@ /* subs 518 SUBHEAD[NSUBS] sub-headers array */ /* glyph_ids 518+NSUB*8 USHORT[] glyph ID array */ /* */ - /* The `keys' table is used to map charcode high-bytes to sub-headers. */ + /* The `keys' table is used to map charcode high bytes to sub-headers. */ /* The value of `NSUBS' is the number of sub-headers defined in the */ /* table and is computed by finding the maximum of the `keys' table. */ /* */ - /* Note that for any n, `keys[n]' is a byte offset within the `subs' */ + /* Note that for any `n', `keys[n]' is a byte offset within the `subs' */ /* table, i.e., it is the corresponding sub-header index multiplied */ /* by 8. */ /* */ @@ -269,8 +269,8 @@ /* delta 4 SHORT see below */ /* offset 6 USHORT see below */ /* */ - /* A sub-header defines, for each high-byte, the range of valid */ - /* low-bytes within the charmap. Note that the range defined by `first' */ + /* A sub-header defines, for each high byte, the range of valid */ + /* low bytes within the charmap. Note that the range defined by `first' */ /* and `count' must be completely included in the interval [0..255] */ /* according to the specification. */ /* */ @@ -360,7 +360,7 @@ /* check range within 0..255 */ if ( valid->level >= FT_VALIDATE_PARANOID ) { - if ( first_code >= 256 || first_code + code_count > 256 ) + if ( first_code >= 256 || code_count > 256 - first_code ) FT_INVALID_DATA; } @@ -412,7 +412,7 @@ { FT_UInt char_lo = (FT_UInt)( char_code & 0xFF ); FT_UInt char_hi = (FT_UInt)( char_code >> 8 ); - FT_Byte* p = table + 6; /* keys table */ + FT_Byte* p = table + 6; /* keys table */ FT_Byte* subs = table + 518; /* subheaders table */ FT_Byte* sub; @@ -425,8 +425,8 @@ sub = subs; /* jump to first sub-header */ /* check that the sub-header for this byte is 0, which */ - /* indicates that it is really a valid one-byte value */ - /* Otherwise, return 0 */ + /* indicates that it is really a valid one-byte value; */ + /* otherwise, return 0 */ /* */ p += char_lo * 2; if ( TT_PEEK_USHORT( p ) != 0 ) @@ -445,6 +445,7 @@ if ( sub == subs ) goto Exit; } + result = sub; } From af89e445f8c44f133362e840553194a2144ab0d5 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Thu, 22 Mar 2018 06:00:55 +0100 Subject: [PATCH 439/470] Remove `ftlcdfil.c' and `ftfntfmt.c' from build files (#53415). builds/amiga/makefile, builds/amiga/makefile.os4, builds/amiga/smakefile, builds/mac/FreeType.m68k_cfm.make.txt, builds/mac/FreeType.m68k_far.make.txt, builds/mac/FreeType.ppc_carbon.make.txt, builds/mac/FreeType.ppc_classic.make.txt, builds/symbian/freetype.mmp, builds/wince/vc2005-ce/freetype.vcproj, builds/wince/vc2008-ce/freetype.vcproj, builds/windows/vc2005/freetype.vcproj, builds/windows/vc2008/freetype.vcproj, builds/windows/vc2010/freetype.vcxproj, builds/windows/vc2010/freetype.vcxproj.filters, builds/windows/visualc/freetype.dsp, builds/windows/visualc/freetype.vcproj, builds/windows/visualce/freetype.dsp, builds/windows/visualce/freetype.vcproj, vms_make.com: Do it. --- ChangeLog | 20 +++++++++++++++++++ builds/amiga/makefile | 10 ++-------- builds/amiga/makefile.os4 | 10 ++-------- builds/amiga/smakefile | 8 ++------ builds/mac/FreeType.m68k_cfm.make.txt | 3 --- builds/mac/FreeType.m68k_far.make.txt | 3 --- builds/mac/FreeType.ppc_carbon.make.txt | 3 --- builds/mac/FreeType.ppc_classic.make.txt | 3 --- builds/symbian/freetype.mmp | 2 -- builds/wince/vc2005-ce/freetype.vcproj | 4 ---- builds/wince/vc2008-ce/freetype.vcproj | 8 -------- builds/windows/vc2005/freetype.vcproj | 4 ---- builds/windows/vc2008/freetype.vcproj | 8 -------- builds/windows/vc2010/freetype.vcxproj | 2 -- .../windows/vc2010/freetype.vcxproj.filters | 6 ------ builds/windows/visualc/freetype.dsp | 8 -------- builds/windows/visualc/freetype.vcproj | 8 -------- builds/windows/visualce/freetype.dsp | 8 -------- builds/windows/visualce/freetype.vcproj | 8 -------- vms_make.com | 4 ++-- 20 files changed, 28 insertions(+), 102 deletions(-) diff --git a/ChangeLog b/ChangeLog index d3ead8fc2..8fd15fa9f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,23 @@ +2018-03-22 Werner Lemberg + + Remove `ftlcdfil.c' and `ftfntfmt.c' from build files (#53415). + + builds/amiga/makefile, builds/amiga/makefile.os4, + builds/amiga/smakefile, builds/mac/FreeType.m68k_cfm.make.txt, + builds/mac/FreeType.m68k_far.make.txt, + builds/mac/FreeType.ppc_carbon.make.txt, + builds/mac/FreeType.ppc_classic.make.txt, + builds/symbian/freetype.mmp, builds/wince/vc2005-ce/freetype.vcproj, + builds/wince/vc2008-ce/freetype.vcproj, + builds/windows/vc2005/freetype.vcproj, + builds/windows/vc2008/freetype.vcproj, + builds/windows/vc2010/freetype.vcxproj, + builds/windows/vc2010/freetype.vcxproj.filters, + builds/windows/visualc/freetype.dsp, + builds/windows/visualc/freetype.vcproj, + builds/windows/visualce/freetype.dsp, + builds/windows/visualce/freetype.vcproj, vms_make.com: Do it. + 2018-03-13 Werner Lemberg * src/sfnt/ttcmap.c (tt_cmap2_validate): Fix potential numeric diff --git a/builds/amiga/makefile b/builds/amiga/makefile index 636743860..6a7700af2 100644 --- a/builds/amiga/makefile +++ b/builds/amiga/makefile @@ -96,9 +96,6 @@ ftbitmap.ppc.o: $(FTSRC)/base/ftbitmap.c ftcid.ppc.o: $(FTSRC)/base/ftcid.c $(CC) -c $(CFLAGS) -o $@ $< -ftfntfmt.ppc.o: $(FTSRC)/base/ftfntfmt.c - $(CC) -c $(CFLAGS) -o $@ $< - ftfstype.ppc.o: $(FTSRC)/base/ftfstype.c $(CC) -c $(CFLAGS) -o $@ $< @@ -111,9 +108,6 @@ ftglyph.ppc.o: $(FTSRC)/base/ftglyph.c ftgxval.ppc.o: $(FTSRC)/base/ftgxval.c $(CC) -c $(CFLAGS) -o $@ $< -ftlcdfil.ppc.o: $(FTSRC)/base/ftlcdfil.c - $(CC) -c $(CFLAGS) -o $@ $< - ftmm.ppc.o: $(FTSRC)/base/ftmm.c $(CC) -c $(CFLAGS) -o $@ $< @@ -270,8 +264,8 @@ otvalid.ppc.o: $(FTSRC)/otvalid/otvalid.c $(CC) -c $(CFLAGS) -o $@ $< BASEPPC = ftbase.ppc.o ftbbox.ppc.o ftbdf.ppc.o ftbitmap.ppc.o ftcid.ppc.o \ - ftfntfmt.ppc.oftfstype.ppc.o ftgasp.ppc.o ftglyph.ppc.o \ - ftgxval.ppc.o ftlcdfil.ppc.o ftmm.ppc.o ftotval.ppc.o \ + oftfstype.ppc.o ftgasp.ppc.o ftglyph.ppc.o \ + ftgxval.ppc.o ftmm.ppc.o ftotval.ppc.o \ ftpatent.ppc.o ftpfr.ppc.o ftstroke.ppc.o ftsynth.ppc.o \ fttype1.ppc.o ftwinfnt.ppc.o diff --git a/builds/amiga/makefile.os4 b/builds/amiga/makefile.os4 index c07e18149..0d340cf19 100644 --- a/builds/amiga/makefile.os4 +++ b/builds/amiga/makefile.os4 @@ -99,9 +99,6 @@ ftdebug.ppc.o: FT:src/base/ftdebug.c ftdebugpure.ppc.o: src/base/ftdebug.c $(CC) -c $(CFLAGS) -o $@ src/base/ftdebug.c -ftfntfmt.ppc.o: FT:src/base/ftfntfmt.c - $(CC) -c $(CFLAGS) -o $@ /FT/src/base/ftfntfmt.c - ftfstype.ppc.o: FT:src/base/ftfstype.c $(CC) -c $(CFLAGS) -o $@ /FT/src/base/ftfstype.c @@ -114,9 +111,6 @@ ftglyph.ppc.o: FT:src/base/ftglyph.c ftgxval.ppc.o: FT:src/base/ftgxval.c $(CC) -c $(CFLAGS) -o $@ /FT/src/base/ftgxval.c -ftlcdfil.ppc.o: FT:src/base/ftlcdfil.c - $(CC) -c $(CFLAGS) -o $@ /FT/src/base/ftlcdfil.c - ftmm.ppc.o: FT:src/base/ftmm.c $(CC) -c $(CFLAGS) -o $@ /FT/src/base/ftmm.c @@ -274,8 +268,8 @@ otvalid.ppc.o: FT:src/otvalid/otvalid.c $(CC) -c $(CFLAGS) -o $@ /FT/src/otvalid/otvalid.c BASE = ftbase.ppc.o ftbbox.ppc.o ftbdf.ppc.o ftbitmap.ppc.o ftcid.ppc.o \ - ftfntfmt.ppc.o ftfstype.ppc.o ftgasp.ppc.o ftglyph.ppc.o \ - ftgxval.ppc.o ftlcdfil.ppc.o ftmm.ppc.o ftotval.ppc.o \ + ftfstype.ppc.o ftgasp.ppc.o ftglyph.ppc.o \ + ftgxval.ppc.o ftmm.ppc.o ftotval.ppc.o \ ftpatent.ppc.o ftpfr.ppc.o ftstroke.ppc.o ftsynth.ppc.o \ fttype1.ppc.o ftwinfnt.ppc.o diff --git a/builds/amiga/smakefile b/builds/amiga/smakefile index 29a31e47b..f5de3089a 100644 --- a/builds/amiga/smakefile +++ b/builds/amiga/smakefile @@ -42,8 +42,8 @@ # (and either ftdebug.o or ftdebugpure.o if you enabled FT_DEBUG_LEVEL_ERROR or # FT_DEBUG_LEVEL_TRACE in include/freetype/config/ftoption.h). -OBJBASE = ftbase.o ftbbox.o ftbdf.o ftbitmap.o ftcid.o ftfntfmt.o ftfstype.o \ - ftgasp.o ftglyph.o ftgxval.o ftlcdfil.o ftmm.o ftotval.o \ +OBJBASE = ftbase.o ftbbox.o ftbdf.o ftbitmap.o ftcid.o ftfstype.o \ + ftgasp.o ftglyph.o ftgxval.o ftmm.o ftotval.o \ ftpatent.o ftpfr.o ftstroke.o ftsynth.o fttype1.o ftwinfnt.o OBJSYSTEM = ftsystem.o ftsystempure.o @@ -133,8 +133,6 @@ ftbitmap.o: $(CORE)base/ftbitmap.c sc $(SCFLAGS) objname=$@ $< ftcid.o: $(CORE)base/ftcid.c sc $(SCFLAGS) objname=$@ $< -ftfntfmt.o: $(CORE)base/ftfntfmt.c - sc $(SCFLAGS) objname=$@ $< ftfstype.o: $(CORE)base/ftfstype.c sc $(SCFLAGS) objname=$@ $< ftgasp.o: $(CORE)base/ftgasp.c @@ -143,8 +141,6 @@ ftglyph.o: $(CORE)base/ftglyph.c sc $(SCFLAGS) objname=$@ $< ftgxval.o: $(CORE)base/ftgxval.c sc $(SCFLAGS) objname=$@ $< -ftlcdfil.o: $(CORE)base/ftlcdfil.c - sc $(SCFLAGS) objname=$@ $< ftmm.o: $(CORE)base/ftmm.c sc $(SCFLAGS) objname=$@ $< ftotval.o: $(CORE)base/ftotval.c diff --git a/builds/mac/FreeType.m68k_cfm.make.txt b/builds/mac/FreeType.m68k_cfm.make.txt index c0a55f510..b74565f10 100644 --- a/builds/mac/FreeType.m68k_cfm.make.txt +++ b/builds/mac/FreeType.m68k_cfm.make.txt @@ -38,7 +38,6 @@ SrcFiles = \xB6 :src:base:ftbdf.c \xB6 :src:base:ftbitmap.c \xB6 :src:base:ftdebug.c \xB6 - :src:base:ftfntfmt.c \xB6 :src:base:ftfstype.c \xB6 :src:base:ftglyph.c \xB6 :src:base:ftgxval.c \xB6 @@ -83,7 +82,6 @@ ObjFiles-68K = \xB6 "{ObjDir}ftbdf.c.o" \xB6 "{ObjDir}ftbitmap.c.o" \xB6 "{ObjDir}ftdebug.c.o" \xB6 - "{ObjDir}ftfntfmt.c.o" \xB6 "{ObjDir}ftfstype.c.o" \xB6 "{ObjDir}ftglyph.c.o" \xB6 "{ObjDir}ftgxval.c.o" \xB6 @@ -161,7 +159,6 @@ FreeType.m68k_cfm.o \xC4\xC4 {ObjFiles-68K} {LibFiles-68K} {\xA5MondoBuild\xA5 "{ObjDir}ftbdf.c.o" \xC4 :src:base:ftbdf.c "{ObjDir}ftbitmap.c.o" \xC4 :src:base:ftbitmap.c "{ObjDir}ftdebug.c.o" \xC4 :src:base:ftdebug.c -"{ObjDir}ftfntfmt.c.o" \xC4 :src:base:ftfntfmt.c "{ObjDir}ftfstype.c.o" \xC4 :src:base:ftfstype.c "{ObjDir}ftglyph.c.o" \xC4 :src:base:ftglyph.c "{ObjDir}ftgxval.c.o" \xC4 :src:base:ftgxval.c diff --git a/builds/mac/FreeType.m68k_far.make.txt b/builds/mac/FreeType.m68k_far.make.txt index e9b7f6f5f..d880ddbb7 100644 --- a/builds/mac/FreeType.m68k_far.make.txt +++ b/builds/mac/FreeType.m68k_far.make.txt @@ -37,7 +37,6 @@ SrcFiles = \xB6 :src:base:ftbdf.c \xB6 :src:base:ftbitmap.c \xB6 :src:base:ftdebug.c \xB6 - :src:base:ftfntfmt.c \xB6 :src:base:ftfstype.c \xB6 :src:base:ftglyph.c \xB6 :src:base:ftgxval.c \xB6 @@ -82,7 +81,6 @@ ObjFiles-68K = \xB6 "{ObjDir}ftbdf.c.o" \xB6 "{ObjDir}ftbitmap.c.o" \xB6 "{ObjDir}ftdebug.c.o" \xB6 - "{ObjDir}ftfntfmt.c.o" \xB6 "{ObjDir}ftfstype.c.o" \xB6 "{ObjDir}ftglyph.c.o" \xB6 "{ObjDir}ftgxval.c.o" \xB6 @@ -160,7 +158,6 @@ FreeType.m68k_far.o \xC4\xC4 {ObjFiles-68K} {LibFiles-68K} {\xA5MondoBuild\xA5 "{ObjDir}ftbdf.c.o" \xC4 :src:base:ftbdf.c "{ObjDir}ftbitmap.c.o" \xC4 :src:base:ftbitmap.c "{ObjDir}ftdebug.c.o" \xC4 :src:base:ftdebug.c -"{ObjDir}ftfntfmt.c.o" \xC4 :src:base:ftfntfmt.c "{ObjDir}ftfstype.c.o" \xC4 :src:base:ftfstype.c "{ObjDir}ftglyph.c.o" \xC4 :src:base:ftglyph.c "{ObjDir}ftgxval.c.o" \xC4 :src:base:ftgxval.c diff --git a/builds/mac/FreeType.ppc_carbon.make.txt b/builds/mac/FreeType.ppc_carbon.make.txt index 9eb1dac4e..1fa8c3076 100644 --- a/builds/mac/FreeType.ppc_carbon.make.txt +++ b/builds/mac/FreeType.ppc_carbon.make.txt @@ -38,7 +38,6 @@ SrcFiles = \xB6 :src:base:ftbdf.c \xB6 :src:base:ftbitmap.c \xB6 :src:base:ftdebug.c \xB6 - :src:base:ftfntfmt.c \xB6 :src:base:ftfstype.c \xB6 :src:base:ftglyph.c \xB6 :src:base:ftgxval.c \xB6 @@ -83,7 +82,6 @@ ObjFiles-PPC = \xB6 "{ObjDir}ftbdf.c.x" \xB6 "{ObjDir}ftbitmap.c.x" \xB6 "{ObjDir}ftdebug.c.x" \xB6 - "{ObjDir}ftfntfmt.c.x" \xB6 "{ObjDir}ftfstype.c.x" \xB6 "{ObjDir}ftglyph.c.x" \xB6 "{ObjDir}ftgxval.c.x" \xB6 @@ -164,7 +162,6 @@ FreeType.ppc_carbon.o \xC4\xC4 {ObjFiles-PPC} {LibFiles-PPC} {\xA5MondoBuild\x "{ObjDir}ftbdf.c.x" \xC4 :src:base:ftbdf.c "{ObjDir}ftbitmap.c.x" \xC4 :src:base:ftbitmap.c "{ObjDir}ftdebug.c.x" \xC4 :src:base:ftdebug.c -"{ObjDir}ftfntfmt.c.x" \xC4 :src:base:ftfntfmt.c "{ObjDir}ftfstype.c.x" \xC4 :src:base:ftfstype.c "{ObjDir}ftglyph.c.x" \xC4 :src:base:ftglyph.c "{ObjDir}ftgxval.c.x" \xC4 :src:base:ftgxval.c diff --git a/builds/mac/FreeType.ppc_classic.make.txt b/builds/mac/FreeType.ppc_classic.make.txt index 0627eeaa9..2550190cb 100644 --- a/builds/mac/FreeType.ppc_classic.make.txt +++ b/builds/mac/FreeType.ppc_classic.make.txt @@ -38,7 +38,6 @@ SrcFiles = \xB6 :src:base:ftbdf.c \xB6 :src:base:ftbitmap.c \xB6 :src:base:ftdebug.c \xB6 - :src:base:ftfntfmt.c \xB6 :src:base:ftfstype.c \xB6 :src:base:ftglyph.c \xB6 :src:base:ftgxval.c \xB6 @@ -83,7 +82,6 @@ ObjFiles-PPC = \xB6 "{ObjDir}ftbdf.c.x" \xB6 "{ObjDir}ftbitmap.c.x" \xB6 "{ObjDir}ftdebug.c.x" \xB6 - "{ObjDir}ftfntfmt.c.x" \xB6 "{ObjDir}ftfstype.c.x" \xB6 "{ObjDir}ftglyph.c.x" \xB6 "{ObjDir}ftgxval.c.x" \xB6 @@ -164,7 +162,6 @@ FreeType.ppc_classic.o \xC4\xC4 {ObjFiles-PPC} {LibFiles-PPC} {\xA5MondoBuild\ "{ObjDir}ftbdf.c.x" \xC4 :src:base:ftbdf.c "{ObjDir}ftbitmap.c.x" \xC4 :src:base:ftbitmap.c "{ObjDir}ftdebug.c.x" \xC4 :src:base:ftdebug.c -"{ObjDir}ftfntfmt.c.x" \xC4 :src:base:ftfntfmt.c "{ObjDir}ftfstype.c.x" \xC4 :src:base:ftfstype.c "{ObjDir}ftglyph.c.x" \xC4 :src:base:ftglyph.c "{ObjDir}ftgxval.c.x" \xC4 :src:base:ftgxval.c diff --git a/builds/symbian/freetype.mmp b/builds/symbian/freetype.mmp index d3b95efbb..4e4a041eb 100644 --- a/builds/symbian/freetype.mmp +++ b/builds/symbian/freetype.mmp @@ -28,13 +28,11 @@ source ftbbox.c source ftbdf.c source ftbitmap.c source ftcid.c -source ftfntfmt.c source ftfstype.c source ftgasp.c source ftglyph.c source ftgxval.c source ftinit.c -source ftlcdfil.c source ftmm.c source ftotval.c source ftpatent.c diff --git a/builds/wince/vc2005-ce/freetype.vcproj b/builds/wince/vc2005-ce/freetype.vcproj index 215028a68..09c1a419e 100644 --- a/builds/wince/vc2005-ce/freetype.vcproj +++ b/builds/wince/vc2005-ce/freetype.vcproj @@ -2135,12 +2135,8 @@ - - - - diff --git a/builds/wince/vc2008-ce/freetype.vcproj b/builds/wince/vc2008-ce/freetype.vcproj index 9be85885a..9ff9a3cec 100644 --- a/builds/wince/vc2008-ce/freetype.vcproj +++ b/builds/wince/vc2008-ce/freetype.vcproj @@ -7871,18 +7871,10 @@ RelativePath="..\..\..\src\base\ftcid.c" > - - - - diff --git a/builds/windows/vc2005/freetype.vcproj b/builds/windows/vc2005/freetype.vcproj index 386d79d07..4cc05526f 100644 --- a/builds/windows/vc2005/freetype.vcproj +++ b/builds/windows/vc2005/freetype.vcproj @@ -350,8 +350,6 @@ - - @@ -380,8 +378,6 @@ - - diff --git a/builds/windows/vc2008/freetype.vcproj b/builds/windows/vc2008/freetype.vcproj index f2d1fe7bb..24ec39bef 100644 --- a/builds/windows/vc2008/freetype.vcproj +++ b/builds/windows/vc2008/freetype.vcproj @@ -1244,10 +1244,6 @@ RelativePath="..\..\..\src\base\ftcid.c" > - - @@ -1331,10 +1327,6 @@ RelativePath="..\..\..\src\base\ftwinfnt.c" > - - diff --git a/builds/windows/vc2010/freetype.vcxproj b/builds/windows/vc2010/freetype.vcxproj index eaddcfde0..521e84722 100644 --- a/builds/windows/vc2010/freetype.vcxproj +++ b/builds/windows/vc2010/freetype.vcxproj @@ -398,13 +398,11 @@ - - diff --git a/builds/windows/vc2010/freetype.vcxproj.filters b/builds/windows/vc2010/freetype.vcxproj.filters index 0be176b57..8ba3673e6 100644 --- a/builds/windows/vc2010/freetype.vcxproj.filters +++ b/builds/windows/vc2010/freetype.vcxproj.filters @@ -95,9 +95,6 @@ Source Files\FT_MODULES - - Source Files\FT_MODULES - Source Files\FT_MODULES @@ -110,9 +107,6 @@ Source Files\FT_MODULES - - Source Files\FT_MODULES - Source Files\FT_MODULES diff --git a/builds/windows/visualc/freetype.dsp b/builds/windows/visualc/freetype.dsp index 76d6e9125..08ac4c980 100644 --- a/builds/windows/visualc/freetype.dsp +++ b/builds/windows/visualc/freetype.dsp @@ -230,14 +230,6 @@ SOURCE=..\..\..\src\base\ftcid.c # End Source File # Begin Source File -SOURCE=..\..\..\src\base\ftfntfmt.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\src\base\ftlcdfil.c -# End Source File -# Begin Source File - SOURCE=..\..\..\src\base\ftpatent.c # End Source File # Begin Source File diff --git a/builds/windows/visualc/freetype.vcproj b/builds/windows/visualc/freetype.vcproj index 6c0b7617d..fb472f3e5 100644 --- a/builds/windows/visualc/freetype.vcproj +++ b/builds/windows/visualc/freetype.vcproj @@ -1243,10 +1243,6 @@ RelativePath="..\..\..\src\base\ftcid.c" > - - @@ -1330,10 +1326,6 @@ RelativePath="..\..\..\src\base\ftwinfnt.c" > - - diff --git a/builds/windows/visualce/freetype.dsp b/builds/windows/visualce/freetype.dsp index 19d7c454f..cc750cb74 100644 --- a/builds/windows/visualce/freetype.dsp +++ b/builds/windows/visualce/freetype.dsp @@ -230,10 +230,6 @@ SOURCE=..\..\..\src\base\ftcid.c # End Source File # Begin Source File -SOURCE=..\..\..\src\base\ftfntfmt.c -# End Source File -# Begin Source File - SOURCE=..\..\..\src\base\ftfstype.c # End Source File # Begin Source File @@ -271,10 +267,6 @@ SOURCE=..\..\..\src\base\ftinit.c # End Source File # Begin Source File -SOURCE=..\..\..\src\base\ftlcdfil.c -# End Source File -# Begin Source File - SOURCE=..\..\..\src\lzw\ftlzw.c # End Source File # Begin Source File diff --git a/builds/windows/visualce/freetype.vcproj b/builds/windows/visualce/freetype.vcproj index d08cd8e44..c3283f012 100644 --- a/builds/windows/visualce/freetype.vcproj +++ b/builds/windows/visualce/freetype.vcproj @@ -8269,10 +8269,6 @@ RelativePath="..\..\..\src\base\ftcid.c" > - - @@ -8716,10 +8712,6 @@ RelativePath="..\..\..\src\base\ftwinfnt.c" > - - diff --git a/vms_make.com b/vms_make.com index 6222c5e8e..7b8a49b3b 100644 --- a/vms_make.com +++ b/vms_make.com @@ -356,8 +356,8 @@ $ deck CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.builds.vms],[--.include],[--.src.base]) OBJS=ftbase.obj,ftinit.obj,ftglyph.obj,ftdebug.obj,ftbdf.obj,ftmm.obj,\ - fttype1.obj,ftfntfmt.obj,ftpfr.obj,ftstroke.obj,ftwinfnt.obj,ftbbox.obj,\ - ftbitmap.obj,ftlcdfil.obj,ftgasp.obj + fttype1.obj,ftpfr.obj,ftstroke.obj,ftwinfnt.obj,ftbbox.obj,\ + ftbitmap.obj,ftgasp.obj all : $(OBJS) library [--.lib]freetype.olb $(OBJS) From 43d4852ec6cfa1df126635ba65d65b22f12d3603 Mon Sep 17 00:00:00 2001 From: Ben Wagner Date: Fri, 23 Mar 2018 06:07:24 +0100 Subject: [PATCH 440/470] [truetype] Fix advance of empty glyphs in bitmap fonts (#53393). * src/truetype/ttgload.c (TT_Load_Glyph): Apply scaling to metrics for empty bitmaps. --- ChangeLog | 7 +++++++ src/truetype/ttgload.c | 32 +++++++++++++++++++------------- 2 files changed, 26 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8fd15fa9f..5f415bf54 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2018-03-23 Ben Wagner + + [truetype] Fix advance of empty glyphs in bitmap fonts (#53393). + + * src/truetype/ttgload.c (TT_Load_Glyph): Apply scaling to metrics + for empty bitmaps. + 2018-03-22 Werner Lemberg Remove `ftlcdfil.c' and `ftfntfmt.c' from build files (#53415). diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c index df120fc09..39d9c3f73 100644 --- a/src/truetype/ttgload.c +++ b/src/truetype/ttgload.c @@ -2709,6 +2709,10 @@ ( load_flags & FT_LOAD_NO_BITMAP ) == 0 && IS_DEFAULT_INSTANCE ) { + FT_Fixed x_scale = size->root.metrics.x_scale; + FT_Fixed y_scale = size->root.metrics.y_scale; + + error = load_sbit_image( size, glyph, glyph_index, load_flags ); if ( FT_ERR_EQ( error, Missing_Bitmap ) ) { @@ -2716,9 +2720,13 @@ /* if we have a bitmap-only font, return an empty glyph */ if ( !FT_IS_SCALABLE( glyph->face ) ) { - TT_Face face = (TT_Face)glyph->face; - FT_Short left_bearing = 0, top_bearing = 0; - FT_UShort advance_width = 0, advance_height = 0; + TT_Face face = (TT_Face)glyph->face; + + FT_Short left_bearing = 0; + FT_Short top_bearing = 0; + + FT_UShort advance_width = 0; + FT_UShort advance_height = 0; /* to return an empty glyph, however, we need metrics data */ @@ -2744,13 +2752,13 @@ glyph->metrics.width = 0; glyph->metrics.height = 0; - glyph->metrics.horiBearingX = left_bearing; + glyph->metrics.horiBearingX = FT_MulFix( left_bearing, x_scale ); glyph->metrics.horiBearingY = 0; - glyph->metrics.horiAdvance = advance_width; + glyph->metrics.horiAdvance = FT_MulFix( advance_width, x_scale ); glyph->metrics.vertBearingX = 0; - glyph->metrics.vertBearingY = top_bearing; - glyph->metrics.vertAdvance = advance_height; + glyph->metrics.vertBearingY = FT_MulFix( top_bearing, y_scale ); + glyph->metrics.vertAdvance = FT_MulFix( advance_height, y_scale ); glyph->format = FT_GLYPH_FORMAT_BITMAP; glyph->bitmap.pixel_mode = FT_PIXEL_MODE_MONO; @@ -2781,13 +2789,11 @@ /* sanity checks: if `xxxAdvance' in the sbit metric */ /* structure isn't set, use `linearXXXAdvance' */ if ( !glyph->metrics.horiAdvance && glyph->linearHoriAdvance ) - glyph->metrics.horiAdvance = - FT_MulFix( glyph->linearHoriAdvance, - size->metrics->x_scale ); + glyph->metrics.horiAdvance = FT_MulFix( glyph->linearHoriAdvance, + x_scale ); if ( !glyph->metrics.vertAdvance && glyph->linearVertAdvance ) - glyph->metrics.vertAdvance = - FT_MulFix( glyph->linearVertAdvance, - size->metrics->y_scale ); + glyph->metrics.vertAdvance = FT_MulFix( glyph->linearVertAdvance, + y_scale ); } return FT_Err_Ok; From 34e467332b0b5ecb03641540e715202204616139 Mon Sep 17 00:00:00 2001 From: Ben Wagner Date: Fri, 23 Mar 2018 06:13:25 +0100 Subject: [PATCH 441/470] [sfnt] Correctly handle missing bitmaps in sbix format (#53404). * src/sfnt/ttfsbit.c (tt_face_load_sbix_image): Fix return value. --- ChangeLog | 6 ++++++ src/sfnt/ttsbit.c | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 5f415bf54..c6ed98daa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2018-03-23 Ben Wagner + + [sfnt] Correctly handle missing bitmaps in sbix format (#53404). + + * src/sfnt/ttfsbit.c (tt_face_load_sbix_image): Fix return value. + 2018-03-23 Ben Wagner [truetype] Fix advance of empty glyphs in bitmap fonts (#53393). diff --git a/src/sfnt/ttsbit.c b/src/sfnt/ttsbit.c index 53e61756d..33b8640bc 100644 --- a/src/sfnt/ttsbit.c +++ b/src/sfnt/ttsbit.c @@ -1514,7 +1514,7 @@ FT_FRAME_EXIT(); if ( glyph_start == glyph_end ) - return FT_THROW( Invalid_Argument ); + return FT_THROW( Missing_Bitmap ); if ( glyph_start > glyph_end || glyph_end - glyph_start < 8 || face->ebdt_size - strike_offset < glyph_end ) From e1122047ae72b376afc2462794ee89a4ba63b609 Mon Sep 17 00:00:00 2001 From: Kushal K S V S Date: Fri, 23 Mar 2018 13:12:07 +0530 Subject: [PATCH 442/470] Fixing cmake command format --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e4a41a4e7..32006d3c7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,11 +26,11 @@ # # For a dynamic library, use # -# cmake -D BUILD_SHARED_LIBS:BOOL=true +# cmake -D BUILD_SHARED_LIBS:BOOL=true # # For a framework on OS X, use # -# cmake -D BUILD_FRAMEWORK:BOOL=true -G Xcode +# cmake -D BUILD_FRAMEWORK:BOOL=true -G Xcode # # instead. # From 61ee69a66e73f33a955d263bcb4d40e62dfe6286 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sat, 24 Mar 2018 05:51:50 +0100 Subject: [PATCH 443/470] Typo. --- include/freetype/internal/ftobjs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/freetype/internal/ftobjs.h b/include/freetype/internal/ftobjs.h index 37c6baffe..1c3c6ad45 100644 --- a/include/freetype/internal/ftobjs.h +++ b/include/freetype/internal/ftobjs.h @@ -155,7 +155,7 @@ FT_BEGIN_HEADER } FT_CMapRec; - /* typecase any pointer to a charmap handle */ + /* typecast any pointer to a charmap handle */ #define FT_CMAP( x ) ( (FT_CMap)( x ) ) /* obvious macros */ From fa6da7bf6dcbcfa22d2464259ad1cccee3233189 Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Mon, 26 Mar 2018 21:40:18 -0400 Subject: [PATCH 444/470] Documentation improvement. --- include/freetype/freetype.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h index aeb951c97..77dd187ee 100644 --- a/include/freetype/freetype.h +++ b/include/freetype/freetype.h @@ -724,11 +724,12 @@ FT_BEGIN_HEADER /* Same as FT_ENCODING_JOHAB. Deprecated. */ /* */ /* */ - /* By default, FreeType automatically synthesizes a Unicode charmap */ - /* for PostScript fonts, using their glyph name dictionaries. */ - /* However, it also reports the encodings defined explicitly in the */ - /* font file, for the cases when they are needed, with the Adobe */ - /* values as well. */ + /* By default, FreeType enables a Unicode charmap and tags it with */ + /* FT_ENCODING_UNICODE when it is either provided or can be generated */ + /* from PostScript glyph name dictionaries in the font file. */ + /* All other encodings are considered legacy and tagged only if */ + /* explicitly defined in the font file. Otherwise, FT_ENCODING_NONE */ + /* is used. */ /* */ /* FT_ENCODING_NONE is set by the BDF and PCF drivers if the charmap */ /* is neither Unicode nor ISO-8859-1 (otherwise it is set to */ From 597cb3b44267325d6aa8ee32bf5b7712aa2b588f Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Fri, 30 Mar 2018 13:46:03 +0200 Subject: [PATCH 445/470] [truetype] Fix memory leak (only if tracing is on). * src/truetype/ttgxvar.c (TT_Get_MM_Var) [FT_DEBUG_LEVEL_TRACE}: Fix it. --- ChangeLog | 7 +++++++ src/truetype/ttgxvar.c | 3 +++ 2 files changed, 10 insertions(+) diff --git a/ChangeLog b/ChangeLog index c6ed98daa..cc2c7770e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2018-03-30 Werner Lemberg + + [truetype] Fix memory leak (only if tracing is on). + + * src/truetype/ttgxvar.c (TT_Get_MM_Var) [FT_DEBUG_LEVEL_TRACE}: Fix + it. + 2018-03-23 Ben Wagner [sfnt] Correctly handle missing bitmaps in sbix format (#53404). diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c index b3e9ec7d9..29ab2a4ef 100644 --- a/src/truetype/ttgxvar.c +++ b/src/truetype/ttgxvar.c @@ -2280,6 +2280,9 @@ psname ? "PS name: `" : "", psname ? psname : "no PS name", psname ? "'" : "" )); + + FT_FREE( strname ); + FT_FREE( psname ); } #endif /* FT_DEBUG_LEVEL_TRACE */ From 7109495c5e6cd79f9b97d6773f4111ed0aeff99b Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sun, 1 Apr 2018 13:24:59 +0200 Subject: [PATCH 446/470] * builds/toplevel.mk (work): Use $(SEP). This fixes the `make refdoc' using Cygwin: $(CAT) is `type' on this platform, and this program only understands backslashes in paths. Reported by Nikhil Ramakrishnan . --- ChangeLog | 9 +++++++++ builds/toplevel.mk | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index cc2c7770e..071ef02ac 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2018-04-01 Werner Lemberg + + * builds/toplevel.mk (work): Use $(SEP). + + This fixes the `make refdoc' using Cygwin: $(CAT) is `type' on this + platform, and this program only understands backslashes in paths. + + Reported by Nikhil Ramakrishnan . + 2018-03-30 Werner Lemberg [truetype] Fix memory leak (only if tracing is on). diff --git a/builds/toplevel.mk b/builds/toplevel.mk index f51ad16b9..7ce0ed8db 100644 --- a/builds/toplevel.mk +++ b/builds/toplevel.mk @@ -172,7 +172,8 @@ include $(TOP_DIR)/builds/modules.mk # get FreeType version string, using a # poor man's `sed' emulation with make's built-in string functions # -work := $(strip $(shell $(CAT) $(TOP_DIR)/include/freetype/freetype.h)) +work := $(strip $(shell $(CAT) \ + $(subst /,$(SEP),$(TOP_DIR)/include/freetype/freetype.h))) work := $(subst |,x,$(work)) work := $(subst $(space),|,$(work)) work := $(subst \#define|FREETYPE_MAJOR|,$(space),$(work)) From 578dafd6b4932d2c541cb4e2d446082800f3cf76 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Tue, 3 Apr 2018 11:31:22 +0200 Subject: [PATCH 447/470] Minor comment improvement. --- include/freetype/config/ftoption.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/freetype/config/ftoption.h b/include/freetype/config/ftoption.h index a5cb7fff2..4bcab2af5 100644 --- a/include/freetype/config/ftoption.h +++ b/include/freetype/config/ftoption.h @@ -82,6 +82,10 @@ FT_BEGIN_HEADER /* to control the various font drivers and modules. The controllable */ /* properties are listed in the section @properties. */ /* */ + /* You have to undefine this configuration option on platforms that lack */ + /* the concept of environment variables (and thus don't have the */ + /* `getenv' function), for example Windows CE. */ + /* */ /* `FREETYPE_PROPERTIES' has the following syntax form (broken here into */ /* multiple lines for better readability). */ /* */ From 26ad1acbcb4ca9e25163bd102971c8f0e1b56d87 Mon Sep 17 00:00:00 2001 From: suzuki toshiya Date: Wed, 4 Apr 2018 16:38:58 +0900 Subject: [PATCH 448/470] * src/truetype/ttobjs.c (trick_names): Add 3 tricky fonts (#53554), `DFHei-Md-HK-BF', `DFKaiShu-Md-HK-BF' and `DFMing-Bd-HK-BF'. (tt_check_trickyness_sfnt_ids): Add checksums for 3 tricky fonts in above. --- ChangeLog | 7 +++++++ src/truetype/ttobjs.c | 22 ++++++++++++++++++++-- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 071ef02ac..9133fecc2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2018-04-04 Ben Wagner + + * src/truetype/ttobjs.c (trick_names): Add 3 tricky fonts (#53554), + `DFHei-Md-HK-BF', `DFKaiShu-Md-HK-BF' and `DFMing-Bd-HK-BF'. + (tt_check_trickyness_sfnt_ids): Add checksums for 3 tricky fonts + in above. + 2018-04-01 Werner Lemberg * builds/toplevel.mk (work): Use $(SEP). diff --git a/src/truetype/ttobjs.c b/src/truetype/ttobjs.c index bc8086f25..6685dc819 100644 --- a/src/truetype/ttobjs.c +++ b/src/truetype/ttobjs.c @@ -147,7 +147,7 @@ { #define TRICK_NAMES_MAX_CHARACTERS 19 -#define TRICK_NAMES_COUNT 23 +#define TRICK_NAMES_COUNT 26 static const char trick_names[TRICK_NAMES_COUNT] [TRICK_NAMES_MAX_CHARACTERS + 1] = @@ -167,12 +167,15 @@ "DFGirl-W6-WIN-BF", /* dftt-h6.ttf; version 1.00, 1993 */ "DFGothic-EB", /* DynaLab Inc. 1992-1995 */ "DFGyoSho-Lt", /* DynaLab Inc. 1992-1995 */ + "DFHei-Md-HK-BF", /* maybe DynaLab Inc. */ "DFHSGothic-W5", /* DynaLab Inc. 1992-1995 */ "DFHSMincho-W3", /* DynaLab Inc. 1992-1995 */ "DFHSMincho-W7", /* DynaLab Inc. 1992-1995 */ "DFKaiSho-SB", /* dfkaisb.ttf */ "DFKaiShu", + "DFKaiShu-Md-HK-BF", /* maybe DynaLab Inc. */ "DFKai-SB", /* kaiu.ttf; version 3.00, 1998 [DFKaiShu-SB-Estd-BF] */ + "DFMing-Bd-HK-BF", /* maybe DynaLab Inc. */ "DLC", /* dftt-m7.ttf; version 1.00, 1993 [DLCMingBold] */ /* dftt-f5.ttf; version 1.00, 1993 [DLCFongSung] */ "DLCHayMedium", /* dftt-b5.ttf; version 1.00, 1993 */ @@ -270,7 +273,7 @@ tt_check_trickyness_sfnt_ids( TT_Face face ) { #define TRICK_SFNT_IDS_PER_FACE 3 -#define TRICK_SFNT_IDS_NUM_FACES 26 +#define TRICK_SFNT_IDS_NUM_FACES 29 static const tt_sfnt_id_rec sfnt_id[TRICK_SFNT_IDS_NUM_FACES] [TRICK_SFNT_IDS_PER_FACE] = { @@ -299,6 +302,11 @@ { 0xCE5956E9UL, 0x0000BC85UL }, /* fpgm */ { 0x8272F416UL, 0x00000045UL } /* prep */ }, + { /* DFHei-Md-HK-BF */ + { 0x1257EB46UL, 0x00000350UL }, /* cvt */ + { 0xF699D160UL, 0x0000715FUL }, /* fpgm */ + { 0xD222F568UL, 0x000003BCUL } /* prep */ + }, { /* DFHSGothic-W5 */ { 0x1262EB4EUL, 0x00000350UL }, /* cvt */ { 0xE86A5D64UL, 0x00007940UL }, /* fpgm */ @@ -324,6 +332,16 @@ { 0xA6E78C01UL, 0x00008998UL }, /* fpgm */ { 0x13A42602UL, 0x0000007EUL } /* prep */ }, + { /* DFKaiShu-Md-HK-BF */ + { 0x11E5EAD4UL, 0x00000360UL }, /* cvt */ + { 0x9DB282B2UL, 0x0000C06EUL }, /* fpgm */ + { 0x53E6D7CAUL, 0x00000082UL } /* prep */ + }, + { /* DFMing-Bd-HK-BF */ + { 0x1243EB18UL, 0x00000350UL }, /* cvt */ + { 0xBA0A8C30UL, 0x000074ADUL }, /* fpgm */ + { 0xF3D83409UL, 0x0000037BUL } /* prep */ + }, { /* DLCLiShu */ { 0x07DCF546UL, 0x00000308UL }, /* cvt */ { 0x40FE7C90UL, 0x00008E2AUL }, /* fpgm */ From 3b8f16803c8a28919966e5ddb5d64ae982556d63 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Wed, 4 Apr 2018 20:26:08 +0200 Subject: [PATCH 449/470] [cff, type1] Sanitize `BlueFuzz' and `BlueShift'. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=7371 * src/cff/cffload.c (cff_load_private_dict): Sanitize `priv->blue_shift' and `priv->blue_fuzz' to avoid overflows later on. * src/type1/t1load.c (T1_Open_Face): Ditto. --- ChangeLog | 14 ++++++++++++++ src/cff/cffload.c | 18 ++++++++++++++++++ src/pshinter/pshglob.c | 4 ++-- src/type1/t1load.c | 18 ++++++++++++++++++ 4 files changed, 52 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9133fecc2..8a8a04d5b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2018-04-04 Werner Lemberg + + [cff, type1] Sanitize `BlueFuzz' and `BlueShift'. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=7371 + + * src/cff/cffload.c (cff_load_private_dict): Sanitize + `priv->blue_shift' and `priv->blue_fuzz' to avoid overflows later + on. + + * src/type1/t1load.c (T1_Open_Face): Ditto. + 2018-04-04 Ben Wagner * src/truetype/ttobjs.c (trick_names): Add 3 tricky fonts (#53554), diff --git a/src/cff/cffload.c b/src/cff/cffload.c index ba49793dc..1c6fe5156 100644 --- a/src/cff/cffload.c +++ b/src/cff/cffload.c @@ -1933,6 +1933,24 @@ else if ( priv->initial_random_seed == 0 ) priv->initial_random_seed = 987654321; + /* some sanitizing to avoid overflows later on; */ + /* the upper limits are ad-hoc values */ + if ( priv->blue_shift > 1000 || priv->blue_shift < 0 ) + { + FT_TRACE2(( "cff_load_private_dict:" + " setting unlikely BlueShift value %d to default (7)\n", + priv->blue_shift )); + priv->blue_shift = 7; + } + + if ( priv->blue_fuzz > 1000 || priv->blue_fuzz < 0 ) + { + FT_TRACE2(( "cff_load_private_dict:" + " setting unlikely BlueFuzz value %d to default (1)\n", + priv->blue_fuzz )); + priv->blue_fuzz = 1; + } + Exit: /* clean up */ cff_blend_clear( subfont ); /* clear blend stack */ diff --git a/src/pshinter/pshglob.c b/src/pshinter/pshglob.c index 29f328d0e..accc04921 100644 --- a/src/pshinter/pshglob.c +++ b/src/pshinter/pshglob.c @@ -227,8 +227,8 @@ } - /* Re-read blue zones from the original fonts and store them into out */ - /* private structure. This function re-orders, sanitizes and */ + /* Re-read blue zones from the original fonts and store them into our */ + /* private structure. This function re-orders, sanitizes, and */ /* fuzz-expands the zones as well. */ static void psh_blues_set_zones( PSH_Blues target, diff --git a/src/type1/t1load.c b/src/type1/t1load.c index 2b8d4893c..9dfa637a6 100644 --- a/src/type1/t1load.c +++ b/src/type1/t1load.c @@ -2493,6 +2493,24 @@ type1->encoding.num_chars = loader.num_chars; } + /* some sanitizing to avoid overflows later on; */ + /* the upper limits are ad-hoc values */ + if ( priv->blue_shift > 1000 || priv->blue_shift < 0 ) + { + FT_TRACE2(( "T1_Open_Face:" + " setting unlikely BlueShift value %d to default (7)\n", + priv->blue_shift )); + priv->blue_shift = 7; + } + + if ( priv->blue_fuzz > 1000 || priv->blue_fuzz < 0 ) + { + FT_TRACE2(( "T1_Open_Face:" + " setting unlikely BlueFuzz value %d to default (1)\n", + priv->blue_fuzz )); + priv->blue_fuzz = 1; + } + Exit: t1_done_loader( &loader ); return error; From cdddeff02fff209e602d4dff97aa94fbbdab2904 Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Fri, 6 Apr 2018 21:01:50 -0400 Subject: [PATCH 450/470] [windows, wince] Clean up legacy project files. * builds/wince/vc2005-ce/freetype.vcproj, builds/wince/vc2008-ce/freetype.vcproj, builds/windows/vc2005/freetype.vcproj, builds/windows/vc2008/freetype.vcproj, builds/windows/visualce/freetype.vcproj, builds/windows/visualce/freetype.dsp, builds/windows/visualc/freetype.vcproj, builds/windows/visualc/freetype.dsp: Remove per-file compile flags. --- ChangeLog | 13 + builds/wince/vc2005-ce/freetype.vcproj | 2967 +------ builds/wince/vc2008-ce/freetype.vcproj | 10077 +-------------------- builds/windows/vc2005/freetype.vcproj | 435 +- builds/windows/vc2008/freetype.vcproj | 1514 +--- builds/windows/visualc/freetype.dsp | 21 - builds/windows/visualc/freetype.vcproj | 1514 +--- builds/windows/visualce/freetype.dsp | 21 - builds/windows/visualce/freetype.vcproj | 10286 +--------------------- 9 files changed, 119 insertions(+), 26729 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8a8a04d5b..57540b423 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2018-04-06 Alexei Podtelezhnikov + + [windows, wince] Clean up legacy project files. + + * builds/wince/vc2005-ce/freetype.vcproj, + builds/wince/vc2008-ce/freetype.vcproj, + builds/windows/vc2005/freetype.vcproj, + builds/windows/vc2008/freetype.vcproj, + builds/windows/visualce/freetype.vcproj, + builds/windows/visualce/freetype.dsp, + builds/windows/visualc/freetype.vcproj, + builds/windows/visualc/freetype.dsp: Remove per-file compile flags. + 2018-04-04 Werner Lemberg [cff, type1] Sanitize `BlueFuzz' and `BlueShift'. diff --git a/builds/wince/vc2005-ce/freetype.vcproj b/builds/wince/vc2005-ce/freetype.vcproj index 09c1a419e..012934bef 100644 --- a/builds/wince/vc2005-ce/freetype.vcproj +++ b/builds/wince/vc2005-ce/freetype.vcproj @@ -773,585 +773,18 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + @@ -1359,774 +792,18 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -2138,132 +815,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -2278,1540 +829,28 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -3832,4 +871,4 @@ - \ No newline at end of file + diff --git a/builds/wince/vc2008-ce/freetype.vcproj b/builds/wince/vc2008-ce/freetype.vcproj index 9ff9a3cec..d80cfde91 100644 --- a/builds/wince/vc2008-ce/freetype.vcproj +++ b/builds/wince/vc2008-ce/freetype.vcproj @@ -3313,4548 +3313,68 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + RelativePath="..\..\..\src\base\ftbase.c" + > + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/builds/windows/vc2005/freetype.vcproj b/builds/windows/vc2005/freetype.vcproj index 4cc05526f..383f07ea8 100644 --- a/builds/windows/vc2005/freetype.vcproj +++ b/builds/windows/vc2005/freetype.vcproj @@ -116,105 +116,18 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + @@ -222,126 +135,18 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -351,24 +156,6 @@ - - - - - - - - - - - - - - - - - - @@ -385,244 +172,28 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -643,4 +214,4 @@ - \ No newline at end of file + diff --git a/builds/windows/vc2008/freetype.vcproj b/builds/windows/vc2008/freetype.vcproj index 24ec39bef..c9e395120 100644 --- a/builds/windows/vc2008/freetype.vcproj +++ b/builds/windows/vc2008/freetype.vcproj @@ -473,203 +473,14 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - @@ -826,270 +511,18 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/builds/windows/visualc/freetype.dsp b/builds/windows/visualc/freetype.dsp index 08ac4c980..04b200d1d 100644 --- a/builds/windows/visualc/freetype.dsp +++ b/builds/windows/visualc/freetype.dsp @@ -200,17 +200,14 @@ SOURCE=..\..\..\src\autofit\autofit.c # Begin Source File SOURCE=..\..\..\src\bdf\bdf.c -# SUBTRACT CPP /Fr # End Source File # Begin Source File SOURCE=..\..\..\src\cff\cff.c -# SUBTRACT CPP /Fr # End Source File # Begin Source File SOURCE=..\..\..\src\base\ftbase.c -# SUBTRACT CPP /Fr # End Source File # Begin Source File @@ -243,18 +240,15 @@ SOURCE=..\..\..\src\base\ftgasp.c # Begin Source File SOURCE=..\..\..\src\cache\ftcache.c -# SUBTRACT CPP /Fr # End Source File # Begin Source File SOURCE=..\ftdebug.c # ADD CPP /Ze -# SUBTRACT CPP /Fr # End Source File # Begin Source File SOURCE=..\..\..\src\base\ftglyph.c -# SUBTRACT CPP /Fr # End Source File # Begin Source File @@ -267,7 +261,6 @@ SOURCE=..\..\..\src\gzip\ftgzip.c # Begin Source File SOURCE=..\..\..\src\base\ftinit.c -# SUBTRACT CPP /Fr # End Source File # Begin Source File @@ -276,7 +269,6 @@ SOURCE=..\..\..\src\lzw\ftlzw.c # Begin Source File SOURCE=..\..\..\src\base\ftmm.c -# SUBTRACT CPP /Fr # End Source File # Begin Source File @@ -297,7 +289,6 @@ SOURCE=..\..\..\src\base\ftsynth.c # Begin Source File SOURCE=..\..\..\src\base\ftsystem.c -# SUBTRACT CPP /Fr # End Source File # Begin Source File @@ -310,7 +301,6 @@ SOURCE=..\..\..\src\base\ftwinfnt.c # Begin Source File SOURCE=..\..\..\src\pcf\pcf.c -# SUBTRACT CPP /Fr # End Source File # Begin Source File @@ -319,57 +309,46 @@ SOURCE=..\..\..\src\pfr\pfr.c # Begin Source File SOURCE=..\..\..\src\psaux\psaux.c -# SUBTRACT CPP /Fr # End Source File # Begin Source File SOURCE=..\..\..\src\pshinter\pshinter.c -# SUBTRACT CPP /Fr # End Source File # Begin Source File SOURCE=..\..\..\src\psnames\psmodule.c -# SUBTRACT CPP /Fr # End Source File # Begin Source File SOURCE=..\..\..\src\raster\raster.c -# SUBTRACT CPP /Fr # End Source File # Begin Source File SOURCE=..\..\..\src\sfnt\sfnt.c -# SUBTRACT CPP /Fr # End Source File # Begin Source File SOURCE=..\..\..\src\smooth\smooth.c -# SUBTRACT CPP /Fr # End Source File # Begin Source File SOURCE=..\..\..\src\truetype\truetype.c -# SUBTRACT CPP /Fr # End Source File # Begin Source File SOURCE=..\..\..\src\type1\type1.c -# SUBTRACT CPP /Fr # End Source File # Begin Source File SOURCE=..\..\..\src\cid\type1cid.c -# SUBTRACT CPP /Fr # End Source File # Begin Source File SOURCE=..\..\..\src\type42\type42.c -# SUBTRACT CPP /Fr # End Source File # Begin Source File SOURCE=..\..\..\src\winfonts\winfnt.c -# SUBTRACT CPP /Fr # End Source File # End Group # Begin Group "Header Files" diff --git a/builds/windows/visualc/freetype.vcproj b/builds/windows/visualc/freetype.vcproj index fb472f3e5..7e6a46c47 100644 --- a/builds/windows/visualc/freetype.vcproj +++ b/builds/windows/visualc/freetype.vcproj @@ -472,203 +472,14 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - @@ -825,270 +510,18 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/builds/windows/visualce/freetype.dsp b/builds/windows/visualce/freetype.dsp index cc750cb74..d65714572 100644 --- a/builds/windows/visualce/freetype.dsp +++ b/builds/windows/visualce/freetype.dsp @@ -200,17 +200,14 @@ SOURCE=..\..\..\src\autofit\autofit.c # Begin Source File SOURCE=..\..\..\src\bdf\bdf.c -# SUBTRACT CPP /Fr # End Source File # Begin Source File SOURCE=..\..\..\src\cff\cff.c -# SUBTRACT CPP /Fr # End Source File # Begin Source File SOURCE=..\..\..\src\base\ftbase.c -# SUBTRACT CPP /Fr # End Source File # Begin Source File @@ -239,18 +236,15 @@ SOURCE=..\..\..\src\base\ftgasp.c # Begin Source File SOURCE=..\..\..\src\cache\ftcache.c -# SUBTRACT CPP /Fr # End Source File # Begin Source File SOURCE=..\ftdebug.c # ADD CPP /Ze -# SUBTRACT CPP /Fr # End Source File # Begin Source File SOURCE=..\..\..\src\base\ftglyph.c -# SUBTRACT CPP /Fr # End Source File # Begin Source File @@ -263,7 +257,6 @@ SOURCE=..\..\..\src\gzip\ftgzip.c # Begin Source File SOURCE=..\..\..\src\base\ftinit.c -# SUBTRACT CPP /Fr # End Source File # Begin Source File @@ -272,7 +265,6 @@ SOURCE=..\..\..\src\lzw\ftlzw.c # Begin Source File SOURCE=..\..\..\src\base\ftmm.c -# SUBTRACT CPP /Fr # End Source File # Begin Source File @@ -297,7 +289,6 @@ SOURCE=..\..\..\src\base\ftsynth.c # Begin Source File SOURCE=..\..\..\src\base\ftsystem.c -# SUBTRACT CPP /Fr # End Source File # Begin Source File @@ -310,7 +301,6 @@ SOURCE=..\..\..\src\base\ftwinfnt.c # Begin Source File SOURCE=..\..\..\src\pcf\pcf.c -# SUBTRACT CPP /Fr # End Source File # Begin Source File @@ -319,57 +309,46 @@ SOURCE=..\..\..\src\pfr\pfr.c # Begin Source File SOURCE=..\..\..\src\psaux\psaux.c -# SUBTRACT CPP /Fr # End Source File # Begin Source File SOURCE=..\..\..\src\pshinter\pshinter.c -# SUBTRACT CPP /Fr # End Source File # Begin Source File SOURCE=..\..\..\src\psnames\psmodule.c -# SUBTRACT CPP /Fr # End Source File # Begin Source File SOURCE=..\..\..\src\raster\raster.c -# SUBTRACT CPP /Fr # End Source File # Begin Source File SOURCE=..\..\..\src\sfnt\sfnt.c -# SUBTRACT CPP /Fr # End Source File # Begin Source File SOURCE=..\..\..\src\smooth\smooth.c -# SUBTRACT CPP /Fr # End Source File # Begin Source File SOURCE=..\..\..\src\truetype\truetype.c -# SUBTRACT CPP /Fr # End Source File # Begin Source File SOURCE=..\..\..\src\type1\type1.c -# SUBTRACT CPP /Fr # End Source File # Begin Source File SOURCE=..\..\..\src\cid\type1cid.c -# SUBTRACT CPP /Fr # End Source File # Begin Source File SOURCE=..\..\..\src\type42\type42.c -# SUBTRACT CPP /Fr # End Source File # Begin Source File SOURCE=..\..\..\src\winfonts\winfnt.c -# SUBTRACT CPP /Fr # End Source File # End Group # Begin Group "Header Files" diff --git a/builds/windows/visualce/freetype.vcproj b/builds/windows/visualce/freetype.vcproj index c3283f012..df1584829 100644 --- a/builds/windows/visualce/freetype.vcproj +++ b/builds/windows/visualce/freetype.vcproj @@ -3502,4757 +3502,68 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + RelativePath="..\..\..\src\base\ftbase.c" + > + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From bd9400bd464f6cd7c74f52ece1c1065fe2a87aab Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Mon, 9 Apr 2018 21:28:37 +0200 Subject: [PATCH 451/470] [truetype] Integer overflow issues. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=7453 * src/truetype/ttinterp.c (Round_Super, Round_Super_45): Use ADD_LONG and SUB_LONG. --- ChangeLog | 11 +++++++++++ src/truetype/ttinterp.c | 8 ++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 57540b423..01ed40e74 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2018-04-09 Werner Lemberg + + [truetype] Integer overflow issues. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=7453 + + * src/truetype/ttinterp.c (Round_Super, Round_Super_45): Use + ADD_LONG and SUB_LONG. + 2018-04-06 Alexei Podtelezhnikov [windows, wince] Clean up legacy project files. diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c index 240dae946..6a5b82314 100644 --- a/src/truetype/ttinterp.c +++ b/src/truetype/ttinterp.c @@ -2165,7 +2165,7 @@ val = ADD_LONG( distance, exc->threshold - exc->phase + compensation ) & -exc->period; - val += exc->phase; + val = ADD_LONG( val, exc->phase ); if ( val < 0 ) val = exc->phase; } @@ -2174,7 +2174,7 @@ val = NEG_LONG( SUB_LONG( exc->threshold - exc->phase + compensation, distance ) & -exc->period ); - val -= exc->phase; + val = SUB_LONG( val, exc->phase ); if ( val > 0 ) val = -exc->phase; } @@ -2216,7 +2216,7 @@ val = ( ADD_LONG( distance, exc->threshold - exc->phase + compensation ) / exc->period ) * exc->period; - val += exc->phase; + val = ADD_LONG( val, exc->phase ); if ( val < 0 ) val = exc->phase; } @@ -2225,7 +2225,7 @@ val = NEG_LONG( ( SUB_LONG( exc->threshold - exc->phase + compensation, distance ) / exc->period ) * exc->period ); - val -= exc->phase; + val = SUB_LONG( val, exc->phase ); if ( val > 0 ) val = -exc->phase; } From 029721d69c8073fa4b5c78d19f6fa051a7ae3459 Mon Sep 17 00:00:00 2001 From: Nikolaus Waxweiler Date: Sat, 7 Apr 2018 21:34:24 +0100 Subject: [PATCH 452/470] Modernize CMake build. * CMakeLists.txt, builds/cmake/FindHarfBuzz.cmake: Extensive modernization measures. * .gitignore: Add build/, as that's the example directory used in CMakeLists.txt. This brings up the minimum required CMake version to 2.8.12. The installation paths follow the GNU defaults now, e.g. installing on a 64 bit host will place binaries into the lib64/ folder on e.g. Fedora. Symbols are hidden by default (e.g. `-fvisibility=hidden' on GCC). CMake will no longer look for a C++ compiler. Library and .so version now match the Autotools build. Comments in the build file and informational messages now use platform agnostic example commands. ftoption.h and ftconfig.h are written directly without a redundant `-new' copy. External dependencies are expressed as option()s and will turn up as such in cmake-gui. Internal: Properties such as dependencies and include directories are now privately set on the freetype library instead of globally. The CPack definitions have been cleaned up, the `make dist' has been removed. Source packages generated with CPack don't contain Autotools files and aren't used by the maintainters anyway. On Windows, src/base/ftver.rc is compiled to decorate the library with version and copyright information. A pkg-config file is now generated and installed. --- .gitignore | 1 + CMakeLists.txt | 389 ++++++++++++++++++-------------- ChangeLog | 37 +++ builds/cmake/FindHarfBuzz.cmake | 57 +++-- 4 files changed, 288 insertions(+), 196 deletions(-) diff --git a/.gitignore b/.gitignore index b5db9d874..a47f568e6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ config.mk objs/vc2010/ +build diff --git a/CMakeLists.txt b/CMakeLists.txt index 32006d3c7..95daeb78d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,35 +12,40 @@ # fully. # # -# As a preliminary, create a compilation directory and change into it, for -# example +# The following will 1. create a build directory and 2. change into it and +# call cmake to configure the build with default parameters as a static +# library. # -# mkdir ~/freetype2.compiled -# cd ~/freetype2.compiled -# -# Now you can say -# -# cmake -# -# to create a Makefile that builds a static version of the library. +# cmake -E make_directory build +# cmake -E chdir build cmake .. # # For a dynamic library, use # -# cmake -D BUILD_SHARED_LIBS:BOOL=true +# cmake -E chdir build cmake -D BUILD_SHARED_LIBS:BOOL=true .. # # For a framework on OS X, use # -# cmake -D BUILD_FRAMEWORK:BOOL=true -G Xcode -# -# instead. +# cmake -E chdir build cmake -G Xcode -D BUILD_FRAMEWORK:BOOL=true .. # # For an iOS static library, use # -# cmake -D IOS_PLATFORM=OS -G Xcode +# cmake -E chdir build cmake -G Xcode -D IOS_PLATFORM=OS .. # # or # -# cmake -D IOS_PLATFORM=SIMULATOR -G Xcode +# cmake -E chdir build cmake -G Xcode -D IOS_PLATFORM=SIMULATOR .. +# +# Finally, build the project with: +# +# cmake --build build +# +# Install it with +# +# (sudo) cmake --build build --target install +# +# A binary distribution can be made with +# +# cmake --build build --config Release --target package # # Please refer to the cmake manual for further options, in particular, how # to modify compilation and linking parameters. @@ -59,28 +64,33 @@ # . `CMakeLists.txt' is provided as-is since it is normally not used by the # developer team. # -# . If you want to disable the automatic generation of the distribution -# targets, add the `-D FREETYPE_NO_DIST=true' command line argument. -# -# . Set the `WITH_ZLIB', `WITH_BZip2', `WITH_PNG', and `WITH_HarfBuzz' -# CMake variables to `ON' or `OFF' to force or skip using a dependency. +# . Set the `FT_WITH_ZLIB', `FT_WITH_BZIP2', `FT_WITH_PNG', and +# `FT_WITH_HARFBUZZ' CMake variables to `ON' to force using a dependency. # Leave a variable undefined (which is the default) to use the dependency -# only if it is available. Example: +# only if it is available. Set `CMAKE_DISABLE_FIND_PACKAGE_HarfBuzz=TRUE' to +# disable a dependency completely (CMake package name, so `BZip2' instead of +# `BZIP2'). Example: # -# cmake ... -DWITH_ZLIB=ON -DWITH_HarfBuzz=OFF ... +# cmake -DFT_WITH_ZLIB=ON -DCMAKE_DISABLE_FIND_PACKAGE_HarfBuzz=TRUE [...] # # . Installation of FreeType can be controlled with the CMake variables # `SKIP_INSTALL_HEADERS', `SKIP_INSTALL_LIBRARIES', and `SKIP_INSTALL_ALL' # (this is compatible with the same CMake variables in zlib's CMake # support). +# FreeType explicitly marks the API to be exported and relies on the compiler +# to hide all other symbols. CMake supports a C_VISBILITY_PRESET property +# starting with 2.8.12. +cmake_minimum_required(VERSION 2.8.12) -cmake_minimum_required(VERSION 2.6) - +if (NOT CMAKE_VERSION VERSION_LESS 3.3) + # Allow symbol visibility settings also on static libraries. CMake < 3.3 + # only sets the propery on a shared library build. + cmake_policy(SET CMP0063 NEW) +endif () include(CheckIncludeFile) - # CMAKE_TOOLCHAIN_FILE must be set before `project' is called, which # configures the base build environment and references the toolchain file if (APPLE) @@ -116,26 +126,47 @@ else () endif () -project(freetype) +project(freetype C) + +set(VERSION_MAJOR "2") +set(VERSION_MINOR "9") +set(VERSION_PATCH "0") + +# SOVERSION scheme: CURRENT.AGE.REVISION +# If there was an incompatible interface change: +# Increment CURRENT. Set AGE and REVISION to 0 +# If there was a compatible interface change: +# Increment AGE. Set REVISION to 0 +# If the source code was changed, but there were no interface changes: +# Increment REVISION. +set(LIBRARY_VERSION "6.16.0") +set(LIBRARY_SOVERSION "6") + +# These options mean "require x and complain if not found". They'll get +# optionally found anyway. Use `-DCMAKE_DISABLE_FIND_PACKAGE_x=TRUE` to disable +# searching for a packge entirely (x is the CMake package name, so "BZip2" +# instead of "BZIP2"). +option(FT_WITH_ZLIB "Use system zlib instead of internal library." OFF) +option(FT_WITH_BZIP2 "Support bzip2 compressed fonts." OFF) +option(FT_WITH_PNG "Support PNG compressed OpenType embedded bitmaps." OFF) +option(FT_WITH_HARFBUZZ "Improve auto-hinting of OpenType fonts." OFF) # Disallow in-source builds if ("${PROJECT_BINARY_DIR}" STREQUAL "${PROJECT_SOURCE_DIR}") message(FATAL_ERROR - " -In-source builds are not permitted! Make a separate folder for" - " building, e.g.," - " - mkdir build; cd build; cmake .." - " -Before that, remove the files created by this failed run with" - " - rm -rf CMakeCache.txt CMakeFiles") + "In-source builds are not permitted! Make a separate folder for" + " building, e.g.,\n" + " cmake -E make_directory build\n" + " cmake -E chdir build cmake ..\n" + "Before that, remove the files created by this failed run with\n" + " cmake -E remove CMakeCache.txt\n" + " cmake -E remove_directory CMakeFiles") endif () # Add local cmake modules -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/builds/cmake) +list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/builds/cmake) if (BUILD_FRAMEWORK) @@ -148,49 +179,32 @@ if (BUILD_FRAMEWORK) endif () -set(VERSION_MAJOR "2") -set(VERSION_MINOR "9") -set(VERSION_PATCH "0") - -set(PROJECT_VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}) -set(SHARED_LIBRARY_VERSION ${VERSION_MAJOR}.${VERSION_MINOR}) - - -# Compiler definitions for building the library -add_definitions(-DFT2_BUILD_LIBRARY) -if (WIN32) - add_definitions(-D_CRT_SECURE_NO_WARNINGS) - add_definitions(-D_CRT_NONSTDC_NO_WARNINGS) -endif () - - # Find dependencies -foreach (d ZLIB BZip2 PNG HarfBuzz) - string(TOUPPER "${d}" D) - - if (DEFINED WITH_${d} OR DEFINED WITH_${D}) - if (WITH_${d} OR WITH_${D}) - find_package(${d} QUIET REQUIRED) - endif () - else () - find_package(${d} QUIET) - endif () - - if (${d}_FOUND OR ${D}_FOUND) - message(STATUS "Building with ${d}") - endif () -endforeach () +if (FT_WITH_HARFBUZZ) + find_package(HarfBuzz 1.3.0 REQUIRED) +else () + find_package(HarfBuzz 1.3.0) +endif () +if (FT_WITH_PNG) + find_package(PNG REQUIRED) +else () + find_package(PNG) +endif () -message(STATUS - "Creating directory ${PROJECT_BINARY_DIR}/include/freetype/config") -file(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/include/freetype/config") +if (FT_WITH_ZLIB) + find_package(ZLIB REQUIRED) +else () + find_package(ZLIB) +endif () +if (FT_WITH_BZIP2) + find_package(BZip2 REQUIRED) +else () + find_package(BZip2) +endif () # Create the configuration file -message(STATUS - "Creating file ${PROJECT_BINARY_DIR}/include/freetype/config/ftconfig.h") - if (UNIX) check_include_file("unistd.h" HAVE_UNISTD_H) check_include_file("fcntl.h" HAVE_FCNTL_H) @@ -200,38 +214,27 @@ if (UNIX) FTCONFIG_H) if (HAVE_UNISTD_H) string(REGEX REPLACE - "#undef +(HAVE_UNISTD_H)" "#define \\1" + "#undef +(HAVE_UNISTD_H)" "#define \\1 1" FTCONFIG_H "${FTCONFIG_H}") endif () if (HAVE_FCNTL_H) string(REGEX REPLACE - "#undef +(HAVE_FCNTL_H)" "#define \\1" + "#undef +(HAVE_FCNTL_H)" "#define \\1 1" FTCONFIG_H "${FTCONFIG_H}") endif () if (HAVE_STDINT_H) string(REGEX REPLACE - "#undef +(HAVE_STDINT_H)" "#define \\1" + "#undef +(HAVE_STDINT_H)" "#define \\1 1" FTCONFIG_H "${FTCONFIG_H}") endif () string(REPLACE "/undef " "#undef " FTCONFIG_H "${FTCONFIG_H}") - file(WRITE "${PROJECT_BINARY_DIR}/include/freetype/config/ftconfig.h-new" - "${FTCONFIG_H}") -else () - file(READ "${PROJECT_SOURCE_DIR}/include/freetype/config/ftconfig.h" - FTCONFIG_H) - file(WRITE "${PROJECT_BINARY_DIR}/include/freetype/config/ftconfig.h-new" + file(WRITE "${PROJECT_BINARY_DIR}/include/freetype/config/ftconfig.h" "${FTCONFIG_H}") endif () -execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different - "${PROJECT_BINARY_DIR}/include/freetype/config/ftconfig.h-new" - "${PROJECT_BINARY_DIR}/include/freetype/config/ftconfig.h") # Create the options file -message(STATUS - "Creating file ${PROJECT_BINARY_DIR}/include/freetype/config/ftoption.h") - file(READ "${PROJECT_SOURCE_DIR}/include/freetype/config/ftoption.h" FTOPTION_H) if (ZLIB_FOUND) @@ -254,16 +257,8 @@ if (HARFBUZZ_FOUND) "/\\* +(#define +FT_CONFIG_OPTION_USE_HARFBUZZ) +\\*/" "\\1" FTOPTION_H "${FTOPTION_H}") endif () -file(WRITE "${PROJECT_BINARY_DIR}/include/freetype/config/ftoption.h-new" +file(WRITE "${PROJECT_BINARY_DIR}/include/freetype/config/ftoption.h" "${FTOPTION_H}") -execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different - "${PROJECT_BINARY_DIR}/include/freetype/config/ftoption.h-new" - "${PROJECT_BINARY_DIR}/include/freetype/config/ftoption.h") - - -# Specify library include directories -include_directories("${PROJECT_SOURCE_DIR}/include") -include_directories(BEFORE "${PROJECT_BINARY_DIR}/include") file(GLOB PUBLIC_HEADERS "include/ft2build.h" "include/freetype/*.h") @@ -314,25 +309,25 @@ set(BASE_SRCS ) if (WIN32) - set(BASE_SRCS ${BASE_SRCS} builds/windows/ftdebug.c) + enable_language(RC) + list(APPEND BASE_SRCS builds/windows/ftdebug.c + src/base/ftver.rc) elseif (WINCE) - set(BASE_SRCS ${BASE_SRCS} builds/wince/ftdebug.c) + list(APPEND BASE_SRCS builds/wince/ftdebug.c) else () - set(BASE_SRCS ${BASE_SRCS} src/base/ftdebug.c) + list(APPEND BASE_SRCS src/base/ftdebug.c) endif () - if (BUILD_FRAMEWORK) - set(BASE_SRCS - ${BASE_SRCS} - builds/mac/freetype-Info.plist - ) + list(APPEND BASE_SRCS builds/mac/freetype-Info.plist) endif () + if (NOT DISABLE_FORCE_DEBUG_POSTFIX) set(CMAKE_DEBUG_POSTFIX d) endif() + add_library(freetype ${PUBLIC_HEADERS} ${PUBLIC_CONFIG_HEADERS} @@ -340,15 +335,35 @@ add_library(freetype ${BASE_SRCS} ) +set_target_properties( + freetype PROPERTIES + C_VISIBILITY_PRESET hidden) + +target_compile_definitions( + freetype PRIVATE FT2_BUILD_LIBRARY) + +if (WIN32) + target_compile_definitions( + freetype PRIVATE _CRT_SECURE_NO_WARNINGS _CRT_NONSTDC_NO_WARNINGS) +endif () if (BUILD_SHARED_LIBS) set_target_properties(freetype PROPERTIES - VERSION ${PROJECT_VERSION} - SOVERSION ${SHARED_LIBRARY_VERSION} - COMPILE_DEFINITIONS freetype_EXPORTS - ) + VERSION ${LIBRARY_VERSION} + SOVERSION ${LIBRARY_SOVERSION}) endif () +target_include_directories( + freetype BEFORE # Pick up ftconfig.h and ftoption.h generated above. + PRIVATE "${PROJECT_BINARY_DIR}/include") + +target_include_directories( + freetype + PRIVATE "${PROJECT_SOURCE_DIR}/include") + +target_include_directories( + freetype + PUBLIC $) if (BUILD_FRAMEWORK) set_property(SOURCE ${PUBLIC_CONFIG_HEADERS} @@ -362,91 +377,121 @@ if (BUILD_FRAMEWORK) ) endif () -if (NOT CMAKE_VERSION VERSION_LESS 2.8.12) - target_include_directories(freetype - PUBLIC $) -endif () -if (CMAKE_VERSION VERSION_LESS 2.8.12) - set(MAYBE_PRIVATE "") -else () - set(MAYBE_PRIVATE "PRIVATE") -endif () +set(PKG_CONFIG_REQUIRED_PRIVATE "") if (ZLIB_FOUND) - target_link_libraries(freetype ${MAYBE_PRIVATE} ${ZLIB_LIBRARIES}) - include_directories(${ZLIB_INCLUDE_DIRS}) + target_link_libraries(freetype PRIVATE ${ZLIB_LIBRARIES}) + target_include_directories(freetype PRIVATE ${ZLIB_INCLUDE_DIRS}) + list(APPEND PKG_CONFIG_REQUIRED_PRIVATE zlib) endif () if (BZIP2_FOUND) - target_link_libraries(freetype ${MAYBE_PRIVATE} ${BZIP2_LIBRARIES}) - include_directories(${BZIP2_INCLUDE_DIR}) # not BZIP2_INCLUDE_DIRS + target_link_libraries(freetype PRIVATE ${BZIP2_LIBRARIES}) + target_include_directories(freetype PRIVATE ${BZIP2_INCLUDE_DIR}) # not BZIP2_INCLUDE_DIRS + list(APPEND PKG_CONFIG_REQUIRED_PRIVATE bzip2) endif () if (PNG_FOUND) - add_definitions(${PNG_DEFINITIONS}) - target_link_libraries(freetype ${MAYBE_PRIVATE} ${PNG_LIBRARIES}) - include_directories(${PNG_INCLUDE_DIRS}) + target_link_libraries(freetype PRIVATE ${PNG_LIBRARIES}) + target_compile_definitions(freetype PRIVATE ${PNG_DEFINITIONS}) + target_include_directories(freetype PRIVATE ${PNG_INCLUDE_DIRS}) + list(APPEND PKG_CONFIG_REQUIRED_PRIVATE libpng) endif () if (HARFBUZZ_FOUND) - target_link_libraries(freetype ${MAYBE_PRIVATE} ${HARFBUZZ_LIBRARIES}) - include_directories(${HARFBUZZ_INCLUDE_DIRS}) + target_link_libraries(freetype PRIVATE ${HARFBUZZ_LIBRARIES}) + target_include_directories(freetype PRIVATE ${HARFBUZZ_INCLUDE_DIRS}) + list(APPEND PKG_CONFIG_REQUIRED_PRIVATE harfbuzz) endif () -# Installations -# Note the trailing slash in the argument to the `DIRECTORY' directive +# Installation +include(GNUInstallDirs) + if (NOT SKIP_INSTALL_HEADERS AND NOT SKIP_INSTALL_ALL) - install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/ - DESTINATION include/freetype2 - PATTERN "internal" EXCLUDE - PATTERN "ftconfig.h" EXCLUDE - PATTERN "ftoption.h" EXCLUDE - ) - install(FILES - ${PROJECT_BINARY_DIR}/include/freetype/config/ftconfig.h - ${PROJECT_BINARY_DIR}/include/freetype/config/ftoption.h - DESTINATION include/freetype2/freetype/config - ) + install( + # Note the trailing slash in the argument to `DIRECTORY'! + DIRECTORY ${PROJECT_SOURCE_DIR}/include/ + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/freetype2 + COMPONENT headers + PATTERN "internal" EXCLUDE + PATTERN "ftconfig.h" EXCLUDE + PATTERN "ftoption.h" EXCLUDE) + install( + FILES ${PROJECT_BINARY_DIR}/include/freetype/config/ftconfig.h + ${PROJECT_BINARY_DIR}/include/freetype/config/ftoption.h + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/freetype2/freetype/config + COMPONENT headers) endif () if (NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL) - install(TARGETS freetype + # Generate the pkg-config file + if (UNIX) + file(READ ${PROJECT_SOURCE_DIR}/builds/unix/freetype2.in FREETYPE2_PC_IN) + + string(REPLACE ";" ", " PKG_CONFIG_REQUIRED_PRIVATE "${PKG_CONFIG_REQUIRED_PRIVATE}") + + string(REPLACE "%prefix%" ${CMAKE_INSTALL_PREFIX} + FREETYPE2_PC_IN ${FREETYPE2_PC_IN}) + string(REPLACE "%exec_prefix%" "\${prefix}" + FREETYPE2_PC_IN ${FREETYPE2_PC_IN}) + string(REPLACE "%libdir%" "\${prefix}/${CMAKE_INSTALL_LIBDIR}" + FREETYPE2_PC_IN ${FREETYPE2_PC_IN}) + string(REPLACE "%includedir%" "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}" + FREETYPE2_PC_IN ${FREETYPE2_PC_IN}) + string(REPLACE "%ft_version%" "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}" + FREETYPE2_PC_IN ${FREETYPE2_PC_IN}) + string(REPLACE "%REQUIRES_PRIVATE%" "${PKG_CONFIG_REQUIRED_PRIVATE}" + FREETYPE2_PC_IN ${FREETYPE2_PC_IN}) + string(REPLACE "%LIBS_PRIVATE%" "" # All libs support pkg-config + FREETYPE2_PC_IN ${FREETYPE2_PC_IN}) + + file(WRITE ${PROJECT_BINARY_DIR}/freetype2.pc ${FREETYPE2_PC_IN}) + + install( + FILES ${PROJECT_BINARY_DIR}/freetype2.pc + DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig + COMPONENT pkgconfig) + endif () + + install( + TARGETS freetype + EXPORT freetype-targets + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + FRAMEWORK DESTINATION Library/Frameworks + COMPONENT libraries) + install( EXPORT freetype-targets - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib - FRAMEWORK DESTINATION Library/Frameworks - ) - install(EXPORT freetype-targets - DESTINATION lib/cmake/freetype - FILE freetype-config.cmake - ) + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/freetype + FILE freetype-config.cmake + COMPONENT headers) endif () # Packaging -# CPack version numbers for release tarball name. +set(CPACK_PACKAGE_NAME ${CMAKE_PROJECT_NAME}) +set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "The FreeType font rendering library.") +set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README") +set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/docs/LICENSE.TXT") + set(CPACK_PACKAGE_VERSION_MAJOR ${VERSION_MAJOR}) set(CPACK_PACKAGE_VERSION_MINOR ${VERSION_MINOR}) -set(CPACK_PACKAGE_VERSION_PATCH ${VERSION_PATCH}}) -if (NOT DEFINED CPACK_PACKAGE_DESCRIPTION_SUMMARY) - set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${CMAKE_PROJECT_NAME}") -endif () -if (NOT DEFINED CPACK_SOURCE_PACKAGE_FILE_NAME) - set(CPACK_SOURCE_PACKAGE_FILE_NAME - "${CMAKE_PROJECT_NAME}-${PROJECT_VERSION}-r${PROJECT_REV}" - CACHE INTERNAL "tarball basename" - ) -endif () -set(CPACK_SOURCE_GENERATOR TGZ) -set(CPACK_SOURCE_IGNORE_FILES - "/CVS/;/.svn/;.swp$;.#;/#;/build/;/serial/;/ser/;/parallel/;/par/;~;/preconfig.out;/autom4te.cache/;/.config") -set(CPACK_GENERATOR TGZ) -include(CPack) +set(CPACK_PACKAGE_VERSION_PATCH ${VERSION_PATCH}) +set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}") +if (WIN32) + set(CPACK_GENERATOR ZIP) +else() + set(CPACK_GENERATOR TGZ) +endif() -# Add `make dist' target if FREETYPE_DIST is set (which is the default) -if (NOT DEFINED FREETYPE_NO_DIST) - add_custom_target(dist COMMAND ${CMAKE_MAKE_PROGRAM} package_source) -endif () +set(CPACK_COMPONENT_LIBRARIES_DISPLAY_NAME "Libraries") +set(CPACK_COMPONENT_HEADERS_DISPLAY_NAME "C/C++ Headers") +set(CPACK_COMPONENT_LIBRARIES_DESCRIPTION + "Library used to build programs which use FreeType") +set(CPACK_COMPONENT_HEADERS_DESCRIPTION + "C/C++ header files for use with FreeType") +set(CPACK_COMPONENT_HEADERS_DEPENDS libraries) +set(CPACK_COMPONENT_LIBRARIES_GROUP "Development") +set(CPACK_COMPONENT_HEADERS_GROUP "Development") -# eof +include(CPack) diff --git a/ChangeLog b/ChangeLog index 01ed40e74..8a108b954 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,40 @@ +2018-04-10 Nikolaus Waxweiler + + * CMakeLists.txt, builds/cmake/FindHarfBuzz.cmake: Extensive + modernization measures. + + This brings up the minimum required CMake version to 2.8.12. + + The installation paths follow the GNU defaults now, e.g. installing on a + 64 bit host will place binaries into the lib64/ folder on e.g. Fedora. + + Symbols are hidden by default (e.g. `-fvisibility=hidden' on GCC). + + CMake will no longer look for a C++ compiler. + + Library and .so version now match the Autotools build. + + Comments in the build file and informational messages now use platform + agnostic example commands. + + ftoption.h and ftconfig.h are written directly without a redundant `-new' + copy. + + External dependencies are expressed as option()s and will turn up as such + in cmake-gui. + + Internal: Properties such as dependencies and include directories are now + privately set on the freetype library instead of globally. + + The CPack definitions have been cleaned up, the `make dist' has been + removed. Source packages generated with CPack don't contain Autotools + files and aren't used by the maintainters anyway. + + On Windows, src/base/ftver.rc is compiled to decorate the library with + version and copyright information. + + A pkg-config file is now generated and installed. + 2018-04-09 Werner Lemberg [truetype] Integer overflow issues. diff --git a/builds/cmake/FindHarfBuzz.cmake b/builds/cmake/FindHarfBuzz.cmake index f394b82bf..ee0d52e36 100644 --- a/builds/cmake/FindHarfBuzz.cmake +++ b/builds/cmake/FindHarfBuzz.cmake @@ -31,42 +31,51 @@ # HARFBUZZ_LIBRARIES - containg the HarfBuzz library include(FindPkgConfig) +pkg_check_modules(PC_HARFBUZZ QUIET harfbuzz) -pkg_check_modules(PC_HARFBUZZ harfbuzz>=0.9.7) - -find_path(HARFBUZZ_INCLUDE_DIRS NAMES hb.h - HINTS ${PC_HARFBUZZ_INCLUDE_DIRS} ${PC_HARFBUZZ_INCLUDEDIR} +find_path(HARFBUZZ_INCLUDE_DIRS + NAMES hb.h + HINTS ${PC_HARFBUZZ_INCLUDEDIR} + ${PC_HARFBUZZ_INCLUDE_DIRS} + PATH_SUFFIXES harfbuzz ) find_library(HARFBUZZ_LIBRARIES NAMES harfbuzz - HINTS ${PC_HARFBUZZ_LIBRARY_DIRS} ${PC_HARFBUZZ_LIBDIR} + HINTS ${PC_HARFBUZZ_LIBDIR} + ${PC_HARFBUZZ_LIBRARY_DIRS} ) -# HarfBuzz 0.9.18 split ICU support into a separate harfbuzz-icu library. -if ("${PC_HARFBUZZ_VERSION}" VERSION_GREATER "0.9.17") - if (HarfBuzz_FIND_REQUIRED) - set(_HARFBUZZ_REQUIRED REQUIRED) - else () - set(_HARFBUZZ_REQUIRED "") - endif () - pkg_check_modules(PC_HARFBUZZ_ICU harfbuzz-icu>=0.9.18 ${_HARFBUZZ_REQUIRED}) - find_library(HARFBUZZ_ICU_LIBRARIES NAMES harfbuzz-icu - HINTS ${PC_HARFBUZZ_ICU_LIBRARY_DIRS} ${PC_HARFBUZZ_ICU_LIBDIR} - ) - if (HARFBUZZ_ICU_LIBRARIES) - list(APPEND HARFBUZZ_LIBRARIES "${HARFBUZZ_ICU_LIBRARIES}") +if (HARFBUZZ_INCLUDE_DIRS) + if (EXISTS "${HARFBUZZ_INCLUDE_DIRS}/hb-version.h") + file(READ "${HARFBUZZ_INCLUDE_DIRS}/hb-version.h" _harfbuzz_version_content) + + string(REGEX MATCH "#define +HB_VERSION_STRING +\"([0-9]+\\.[0-9]+\\.[0-9]+)\"" _dummy "${_harfbuzz_version_content}") + set(HARFBUZZ_VERSION "${CMAKE_MATCH_1}") endif () - set(_HARFBUZZ_EXTRA_REQUIRED_VAR "HARFBUZZ_ICU_LIBRARIES") -else () - set(_HARFBUZZ_EXTRA_REQUIRED_VAR "") +endif () + +if ("${harfbuzz_FIND_VERSION}" VERSION_GREATER "${HARFBUZZ_VERSION}") + message(FATAL_ERROR "Required version (" ${harfbuzz_FIND_VERSION} ") is higher than found version (" ${HARFBUZZ_VERSION} ")") endif () include(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(HarfBuzz DEFAULT_MSG HARFBUZZ_INCLUDE_DIRS - HARFBUZZ_LIBRARIES ${_HARFBUZZ_EXTRA_REQUIRED_VAR}) +FIND_PACKAGE_HANDLE_STANDARD_ARGS( + harfbuzz + REQUIRED_VARS HARFBUZZ_INCLUDE_DIRS HARFBUZZ_LIBRARIES + VERSION_VAR HARFBUZZ_VERSION) mark_as_advanced( - HARFBUZZ_ICU_LIBRARIES HARFBUZZ_INCLUDE_DIRS HARFBUZZ_LIBRARIES ) + +# Allows easy linking as in +# target_link_libraries(freetype PRIVATE Harfbuzz::Harfbuzz) +if (NOT CMAKE_VERSION VERSION_LESS 3.1) + if (HARFBUZZ_FOUND AND NOT TARGET Harfbuzz::Harfbuzz) + add_library(Harfbuzz::Harfbuzz INTERFACE IMPORTED) + set_target_properties( + Harfbuzz::Harfbuzz PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${HARFBUZZ_INCLUDE_DIRS}") + endif () +endif () From 576670b7794da946f35b247b314a61406c635cad Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sat, 14 Apr 2018 07:00:30 +0200 Subject: [PATCH 453/470] [autofit] Update to Unicode 11.0.0. But no support new scripts (volunteers welcomed). * src/autofit/afranges.c (af_arab_nonbase_uniranges, af_beng_nonbase_uniranges, af_cakm_nonbase_uniranges, af_deva_nonbase_uniranges, af_geor_uniranges, af_gujr_nonbase_uniranges, af_mlym_nonbase_uniranges, af_nkoo_nonbase_uniranges, af_telu_nonbase_uniranges, af_hani_uniranges): Add new data. --- ChangeLog | 13 +++++++++++++ src/autofit/afranges.c | 25 ++++++++++++++++--------- 2 files changed, 29 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8a108b954..1a338bb61 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2018-04-14 Werner Lemberg + + [autofit] Update to Unicode 11.0.0. + + But no support new scripts (volunteers welcomed). + + * src/autofit/afranges.c (af_arab_nonbase_uniranges, + af_beng_nonbase_uniranges, af_cakm_nonbase_uniranges, + af_deva_nonbase_uniranges, af_geor_uniranges, + af_gujr_nonbase_uniranges, af_mlym_nonbase_uniranges, + af_nkoo_nonbase_uniranges, af_telu_nonbase_uniranges, + af_hani_uniranges): Add new data. + 2018-04-10 Nikolaus Waxweiler * CMakeLists.txt, builds/cmake/FindHarfBuzz.cmake: Extensive diff --git a/src/autofit/afranges.c b/src/autofit/afranges.c index 1355c5e7c..cf67fafb1 100644 --- a/src/autofit/afranges.c +++ b/src/autofit/afranges.c @@ -91,7 +91,7 @@ AF_UNIRANGE_REC( 0x06E7, 0x06E8 ), AF_UNIRANGE_REC( 0x06EA, 0x06ED ), AF_UNIRANGE_REC( 0x08D4, 0x08E1 ), - AF_UNIRANGE_REC( 0x08E3, 0x08FF ), + AF_UNIRANGE_REC( 0x08D3, 0x08FF ), AF_UNIRANGE_REC( 0xFBB2, 0xFBC1 ), AF_UNIRANGE_REC( 0xFE70, 0xFE70 ), AF_UNIRANGE_REC( 0xFE72, 0xFE72 ), @@ -163,6 +163,7 @@ AF_UNIRANGE_REC( 0x09C1, 0x09C4 ), AF_UNIRANGE_REC( 0x09CD, 0x09CD ), AF_UNIRANGE_REC( 0x09E2, 0x09E3 ), + AF_UNIRANGE_REC( 0x09FE, 0x09FE ), AF_UNIRANGE_REC( 0, 0 ) }; @@ -190,6 +191,7 @@ { AF_UNIRANGE_REC( 0x11100, 0x11102 ), AF_UNIRANGE_REC( 0x11127, 0x11134 ), + AF_UNIRANGE_REC( 0x11146, 0x11146 ), AF_UNIRANGE_REC( 0, 0 ) }; @@ -304,6 +306,7 @@ AF_UNIRANGE_REC( 0x0953, 0x0957 ), AF_UNIRANGE_REC( 0x0962, 0x0963 ), AF_UNIRANGE_REC( 0xA8E0, 0xA8F1 ), + AF_UNIRANGE_REC( 0xA8FF, 0xA8FF ), AF_UNIRANGE_REC( 0, 0 ) }; @@ -338,11 +341,8 @@ const AF_Script_UniRangeRec af_geor_uniranges[] = { - AF_UNIRANGE_REC( 0x10D0, 0x10FF ), /* Georgian (Mkhedruli) */ -#if 0 - /* the following range is proposed for inclusion in Unicode */ - AF_UNIRANGE_REC( 0x1C90, 0x1CBF ), /* Georgian (Mtavruli) */ -#endif + AF_UNIRANGE_REC( 0x10D0, 0x10FF ), /* Georgian (Mkhedruli) */ + AF_UNIRANGE_REC( 0x1C90, 0x1CBF ), /* Georgian Extended (Mtavruli) */ AF_UNIRANGE_REC( 0, 0 ) }; @@ -355,8 +355,8 @@ const AF_Script_UniRangeRec af_geok_uniranges[] = { /* Khutsuri */ - AF_UNIRANGE_REC( 0x10A0, 0x10CD ), /* Georgian (Asomtavruli) */ - AF_UNIRANGE_REC( 0x2D00, 0x2D2D ), /* Georgian (Nuskhuri) */ + AF_UNIRANGE_REC( 0x10A0, 0x10CD ), /* Georgian (Asomtavruli) */ + AF_UNIRANGE_REC( 0x2D00, 0x2D2D ), /* Georgian Supplement (Nuskhuri) */ AF_UNIRANGE_REC( 0, 0 ) }; @@ -425,6 +425,7 @@ AF_UNIRANGE_REC( 0x0AC1, 0x0AC8 ), AF_UNIRANGE_REC( 0x0ACD, 0x0ACD ), AF_UNIRANGE_REC( 0x0AE2, 0x0AE3 ), + AF_UNIRANGE_REC( 0x0AFA, 0x0AFF ), AF_UNIRANGE_REC( 0, 0 ) }; @@ -655,7 +656,8 @@ const AF_Script_UniRangeRec af_mlym_nonbase_uniranges[] = { - AF_UNIRANGE_REC( 0x0D01, 0x0D01 ), + AF_UNIRANGE_REC( 0x0D00, 0x0D01 ), + AF_UNIRANGE_REC( 0x0D3B, 0x0D3C ), AF_UNIRANGE_REC( 0x0D4D, 0x0D4E ), AF_UNIRANGE_REC( 0x0D62, 0x0D63 ), AF_UNIRANGE_REC( 0, 0 ) @@ -697,6 +699,7 @@ const AF_Script_UniRangeRec af_nkoo_nonbase_uniranges[] = { AF_UNIRANGE_REC( 0x07EB, 0x07F5 ), + AF_UNIRANGE_REC( 0x07FD, 0x07FD ), AF_UNIRANGE_REC( 0, 0 ) }; @@ -856,6 +859,7 @@ const AF_Script_UniRangeRec af_telu_nonbase_uniranges[] = { AF_UNIRANGE_REC( 0x0C00, 0x0C00 ), + AF_UNIRANGE_REC( 0x0C04, 0x0C04 ), AF_UNIRANGE_REC( 0x0C3E, 0x0C40 ), AF_UNIRANGE_REC( 0x0C46, 0x0C56 ), AF_UNIRANGE_REC( 0x0C62, 0x0C63 ), @@ -1006,10 +1010,13 @@ AF_UNIRANGE_REC( 0xFE30, 0xFE4F ), /* CJK Compatibility Forms */ AF_UNIRANGE_REC( 0xFF00, 0xFFEF ), /* Halfwidth and Fullwidth Forms */ AF_UNIRANGE_REC( 0x1B000, 0x1B0FF ), /* Kana Supplement */ + AF_UNIRANGE_REC( 0x1B100, 0x1B12F ), /* Kana Extended-A */ AF_UNIRANGE_REC( 0x1D300, 0x1D35F ), /* Tai Xuan Hing Symbols */ AF_UNIRANGE_REC( 0x20000, 0x2A6DF ), /* CJK Unified Ideographs Extension B */ AF_UNIRANGE_REC( 0x2A700, 0x2B73F ), /* CJK Unified Ideographs Extension C */ AF_UNIRANGE_REC( 0x2B740, 0x2B81F ), /* CJK Unified Ideographs Extension D */ + AF_UNIRANGE_REC( 0x2B820, 0x2CEAF ), /* CJK Unified Ideographs Extension E */ + AF_UNIRANGE_REC( 0x2CEB0, 0x2EBEF ), /* CJK Unified Ideographs Extension F */ AF_UNIRANGE_REC( 0x2F800, 0x2FA1F ), /* CJK Compatibility Ideographs Supplement */ AF_UNIRANGE_REC( 0, 0 ) }; From 827ca3bcf25b9e4dc2edf31381c0774e1d227285 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sat, 14 Apr 2018 07:20:31 +0200 Subject: [PATCH 454/470] [truetype] Integer overflow issues. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=7652 * src/truetype/ttinterp.c (Ins_MDAP): Use SUB_LONG. --- ChangeLog | 10 ++++++++++ src/truetype/ttinterp.c | 18 ++++++++++-------- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1a338bb61..b92980121 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2018-04-14 Werner Lemberg + + [truetype] Integer overflow issues. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=7652 + + * src/truetype/ttinterp.c (Ins_MDAP): Use SUB_LONG. + 2018-04-14 Werner Lemberg [autofit] Update to Unicode 11.0.0. diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c index 6a5b82314..d9865d4af 100644 --- a/src/truetype/ttinterp.c +++ b/src/truetype/ttinterp.c @@ -5874,16 +5874,18 @@ if ( SUBPIXEL_HINTING_INFINALITY && exc->ignore_x_mode && exc->GS.freeVector.x != 0 ) - distance = Round_None( - exc, - cur_dist, - exc->tt_metrics.compensations[0] ) - cur_dist; + distance = SUB_LONG( + Round_None( exc, + cur_dist, + exc->tt_metrics.compensations[0] ), + cur_dist ); else #endif - distance = exc->func_round( - exc, - cur_dist, - exc->tt_metrics.compensations[0] ) - cur_dist; + distance = SUB_LONG( + exc->func_round( exc, + cur_dist, + exc->tt_metrics.compensations[0] ), + cur_dist ); } else distance = 0; From 235b1e2fe6ca325f449c5a73c75432d62d73f524 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sun, 15 Apr 2018 21:55:04 +0200 Subject: [PATCH 455/470] [truetype]: Limit `SLOOP' bytecode argument to 16 bits. This fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=7707 * src/truetype/ttinterp.c (Ins_SLOOP): Do it. --- ChangeLog | 10 ++++++++++ src/truetype/ttinterp.c | 5 ++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index b92980121..2f6bffcac 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2018-04-15 Werner Lemberg + + [truetype]: Limit `SLOOP' bytecode argument to 16 bits. + + This fixes + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=7707 + + * src/truetype/ttinterp.c (Ins_SLOOP): Do it. + 2018-04-14 Werner Lemberg [truetype] Integer overflow issues. diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c index d9865d4af..c66c69929 100644 --- a/src/truetype/ttinterp.c +++ b/src/truetype/ttinterp.c @@ -3289,7 +3289,10 @@ if ( args[0] < 0 ) exc->error = FT_THROW( Bad_Argument ); else - exc->GS.loop = args[0]; + { + /* we heuristically limit the number of loops to 16 bits */ + exc->GS.loop = args[0] > 0xFFFFL ? 0xFFFFL : args[0]; + } } From 843193b9d51a6c1acbf48b580160220e90110561 Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Sun, 15 Apr 2018 16:27:10 -0400 Subject: [PATCH 456/470] [build] Use `info' function of make 3.81. * configure, docs/INSTALL, docs/INSTALL.CROSS, docs/INSTALL.GNU, docs/INSTALL.UNIX, docs/MAKEPP: Bump make version requirements. * builds/detect.mk (std_setup): Replace `echo' with `info'. (dos_setup): Removed. * builds/unix/install.mk, builds/modules.mk, builds/dos/detect.mk, builds/windows/detect.mk, builds/os2/detect.mk: Updated. * builds/newline: No longer needed. --- ChangeLog | 15 ++++++++- builds/detect.mk | 67 ++++++++++++---------------------------- builds/dos/detect.mk | 2 +- builds/modules.mk | 4 +-- builds/newline | 1 - builds/os2/detect.mk | 2 +- builds/unix/install.mk | 2 +- builds/windows/detect.mk | 24 +++++++------- configure | 2 +- docs/INSTALL | 4 +-- docs/INSTALL.CROSS | 2 +- docs/INSTALL.GNU | 4 +-- docs/INSTALL.UNIX | 2 +- docs/MAKEPP | 2 +- 14 files changed, 58 insertions(+), 75 deletions(-) delete mode 100644 builds/newline diff --git a/ChangeLog b/ChangeLog index 2f6bffcac..0197dcb29 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2018-04-15 Alexei Podtelezhnikov + + [build] Use `info' function of make 3.81. + + * configure, docs/INSTALL, docs/INSTALL.CROSS, docs/INSTALL.GNU, + docs/INSTALL.UNIX, docs/MAKEPP: Bump make version requirements. + + * builds/detect.mk (std_setup): Replace `echo' with `info'. + (dos_setup): Removed. + * builds/unix/install.mk, builds/modules.mk, builds/dos/detect.mk, + builds/windows/detect.mk, builds/os2/detect.mk: Updated. + * builds/newline: No longer needed. + 2018-04-15 Werner Lemberg [truetype]: Limit `SLOOP' bytecode argument to 16 bits. @@ -33,7 +46,7 @@ 2018-04-10 Nikolaus Waxweiler - * CMakeLists.txt, builds/cmake/FindHarfBuzz.cmake: Extensive + * CMakeLists.txt, builds/cmake/FindHarfBuzz.cmake: Extensive modernization measures. This brings up the minimum required CMake version to 2.8.12. diff --git a/builds/detect.mk b/builds/detect.mk index 771fc31a8..eb7f79749 100644 --- a/builds/detect.mk +++ b/builds/detect.mk @@ -101,57 +101,28 @@ ifndef CONFIG_FILE .PHONY: setup endif -# The following targets are equivalent, with the exception that they use -# a slightly different syntax for the `echo' command. +# Flash out and copy rules. # -# std_setup: defined for most (i.e. Unix-like) platforms -# dos_setup: defined for Dos-ish platforms like Dos, Windows & OS/2 -# -.PHONY: std_setup dos_setup +.PHONY: std_setup std_setup: - @echo "" - @echo "$(PROJECT_TITLE) build system -- automatic system detection" - @echo "" - @echo "The following settings are used:" - @echo "" - @echo " platform $(PLATFORM)" - @echo " compiler $(CC)" - @echo " configuration directory $(BUILD_DIR)" - @echo " configuration rules $(CONFIG_RULES)" - @echo "" - @echo "If this does not correspond to your system or settings please remove the file" - @echo "\`$(CONFIG_MK)' from this directory then read the INSTALL file for help." - @echo "" - @echo "Otherwise, simply type \`$(MAKE)' again to build the library," - @echo "or \`$(MAKE) refdoc' to build the API reference (this needs python >= 2.6)." - @echo "" - @$(COPY) $(CONFIG_RULES) $(CONFIG_MK) - - -# Special case for Dos, Windows, OS/2, where echo "" doesn't work correctly! -# -# For `cmd.exe', we use 0xFF as a replacement character for a protected -# space. -# -dos_setup: - @type builds$(SEP)newline - @echo $(PROJECT_TITLE) build system -- automatic system detection - @type builds$(SEP)newline - @echo The following settings are used: - @type builds$(SEP)newline - @echo platform˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙$(PLATFORM) - @echo compiler˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙$(CC) - @echo configuration directory˙˙˙˙˙˙$(subst /,$(SEP),$(BUILD_DIR)) - @echo configuration rules˙˙˙˙˙˙˙˙˙˙$(subst /,$(SEP),$(CONFIG_RULES)) - @type builds$(SEP)newline - @echo If this does not correspond to your system or settings please remove the file - @echo '$(CONFIG_MK)' from this directory then read the INSTALL file for help. - @type builds$(SEP)newline - @echo Otherwise, simply type 'make' again to build the library. - @echo or 'make refdoc' to build the API reference (this needs at least python 2.6). - @type builds$(SEP)newline - @$(COPY) $(subst /,$(SEP),$(CONFIG_RULES) $(CONFIG_MK)) > nul + $(info ) + $(info $(PROJECT_TITLE) build system -- automatic system detection) + $(info ) + $(info The following settings are used:) + $(info ) + $(info $(empty) platform $(PLATFORM)) + $(info $(empty) compiler $(CC)) + $(info $(empty) configuration directory $(subst /,$(SEP),$(BUILD_DIR))) + $(info $(empty) configuration rules $(subst /,$(SEP),$(CONFIG_RULES))) + $(info ) + $(info If this does not correspond to your system or settings please remove the file) + $(info `$(CONFIG_MK)' from this directory then read the INSTALL file for help.) + $(info ) + $(info Otherwise, simply type `$(MAKE)' again to build the library,) + $(info or `$(MAKE) refdoc' to build the API reference (this needs python >= 2.6).) + $(info ) + @$(COPY) $(subst /,$(SEP),$(CONFIG_RULES) $(CONFIG_MK)) # EOF diff --git a/builds/dos/detect.mk b/builds/dos/detect.mk index 55b0e76ec..0201f7b46 100644 --- a/builds/dos/detect.mk +++ b/builds/dos/detect.mk @@ -133,7 +133,7 @@ ifeq ($(PLATFORM),dos) COPY := copy endif # test NT - setup: dos_setup + setup: std_setup endif endif # test PLATFORM dos diff --git a/builds/modules.mk b/builds/modules.mk index e1edb17b8..9a7a4a0aa 100644 --- a/builds/modules.mk +++ b/builds/modules.mk @@ -41,7 +41,7 @@ endif define FTMODULE_H_INIT $(REMOVE_MODULE) -@-echo Generating modules list in $(FTMODULE_H)... +$(info Generating modules list in $(FTMODULE_H)...) $(OPEN_MODULE)/* This is a generated file. */$(CLOSE_MODULE) endef @@ -56,7 +56,7 @@ endef define FTMODULE_H_DONE $(OPEN_MODULE)/* EOF */$(CLOSE_MODULE) -@echo done. +$(info done.) endef diff --git a/builds/newline b/builds/newline deleted file mode 100644 index 8b1378917..000000000 --- a/builds/newline +++ /dev/null @@ -1 +0,0 @@ - diff --git a/builds/os2/detect.mk b/builds/os2/detect.mk index 2edb8d4c1..aaf78488b 100644 --- a/builds/os2/detect.mk +++ b/builds/os2/detect.mk @@ -65,7 +65,7 @@ ifeq ($(PLATFORM),os2) .PHONY: devel endif - setup: dos_setup + setup: std_setup endif # test PLATFORM os2 diff --git a/builds/unix/install.mk b/builds/unix/install.mk index 89424514f..c08c3b756 100644 --- a/builds/unix/install.mk +++ b/builds/unix/install.mk @@ -84,7 +84,7 @@ uninstall: check: - @echo There is no validation suite for this package. + $(info There is no validation suite for this package.) .PHONY: clean_project_unix distclean_project_unix diff --git a/builds/windows/detect.mk b/builds/windows/detect.mk index b047e0215..dd5669ca5 100644 --- a/builds/windows/detect.mk +++ b/builds/windows/detect.mk @@ -95,22 +95,22 @@ ifeq ($(PLATFORM),windows) ifneq ($(findstring list,$(MAKECMDGOALS)),) # test for the "list" target dump_target_list: - @echo ˙ - @echo $(PROJECT_TITLE) build system -- supported compilers - @echo ˙ - @echo Several command-line compilers are supported on Win32: - @echo ˙ - @echo ˙˙make setup˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙gcc (with Mingw) - @echo ˙˙make setup visualc˙˙˙˙˙˙˙˙˙˙˙˙˙Microsoft Visual C++ - @echo ˙˙make setup bcc32˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙Borland C/C++ - @echo ˙˙make setup lcc˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙Win32-LCC - @echo ˙˙make setup intelc˙˙˙˙˙˙˙˙˙˙˙˙˙˙Intel C/C++ - @echo ˙ + $(info ) + $(info $(PROJECT_TITLE) build system -- supported compilers) + $(info ) + $(info Several command-line compilers are supported on Win32:) + $(info ) + $(info $(empty) make setup gcc (with Mingw)) + $(info $(empty) make setup visualc Microsoft Visual C++) + $(info $(empty) make setup bcc32 Borland C/C++) + $(info $(empty) make setup lcc Win32-LCC) + $(info $(empty) make setup intelc Intel C/C++) + $(info ) setup: dump_target_list .PHONY: dump_target_list list else - setup: dos_setup + setup: std_setup endif # additionally, we provide hooks for various other compilers diff --git a/configure b/configure index 8ee0d4029..f9d218667 100755 --- a/configure +++ b/configure @@ -29,7 +29,7 @@ else fi if test "x`$MAKE -v 2>/dev/null | egrep 'GNU|makepp'`" = x; then - echo "GNU make (>= 3.80) or makepp (>= 1.19) is required to build FreeType2." >&2 + echo "GNU make (>= 3.81) or makepp (>= 2.0) is required to build FreeType2." >&2 echo "Please try" >&2 echo >&2 echo " MAKE= $0" >&2 diff --git a/docs/INSTALL b/docs/INSTALL index fc24ea1aa..71d4a0553 100644 --- a/docs/INSTALL +++ b/docs/INSTALL @@ -14,7 +14,7 @@ I. Normal installation and upgrades compilation, since other make tools won't work (this includes BSD Make). - GNU Make VERSION 3.80 OR NEWER IS NEEDED! + GNU Make VERSION 3.81 OR NEWER IS NEEDED! [For `cmake' see below.] @@ -72,7 +72,7 @@ II. Custom builds of the library http://makepp.sourceforge.net - for more information; you need version 1.19 or newer, and you must + for more information; you need version 2.0 or newer, and you must pass option `--norc-substitution'. ---------------------------------------------------------------------- diff --git a/docs/INSTALL.CROSS b/docs/INSTALL.CROSS index e8977a12a..239e1a9b6 100644 --- a/docs/INSTALL.CROSS +++ b/docs/INSTALL.CROSS @@ -9,7 +9,7 @@ procedure. ----------------- For self-building the FreeType library on a Unix system, GNU Make - 3.80 or newer is required. `INSTALL.UNIX' contains hints how to + 3.81 or newer is required. `INSTALL.UNIX' contains hints how to check the installed `make'. The GNU C compiler to cross-build the target system is required. diff --git a/docs/INSTALL.GNU b/docs/INSTALL.GNU index 52645f1f7..e314ecfdd 100644 --- a/docs/INSTALL.GNU +++ b/docs/INSTALL.GNU @@ -25,7 +25,7 @@ instructions in the file `INSTALL.UNIX' instead. http://makepp.sourceforge.net - for more information; you need version 1.19 or newer, and you must + for more information; you need version 2.0 or newer, and you must pass option `--norc-substitution'. Make sure that you are invoking GNU Make from the command line, by @@ -35,7 +35,7 @@ instructions in the file `INSTALL.UNIX' instead. to display its version number. - VERSION 3.80 OR NEWER IS NEEDED! + VERSION 3.81 OR NEWER IS NEEDED! 2. Invoke `make' diff --git a/docs/INSTALL.UNIX b/docs/INSTALL.UNIX index bb57836a6..f92d828e6 100644 --- a/docs/INSTALL.UNIX +++ b/docs/INSTALL.UNIX @@ -19,7 +19,7 @@ or MSys on Win32: GNU Make Copyright (C) Free Software Foundation Inc. - Note that version 3.80 or higher is *required* or the build will + Note that version 3.81 or higher is *required* or the build will fail. It is also fine to have GNU Make under another name (e.g. 'gmake') diff --git a/docs/MAKEPP b/docs/MAKEPP index 58eaf551d..a4d44b78e 100644 --- a/docs/MAKEPP +++ b/docs/MAKEPP @@ -1,5 +1,5 @@ As a special exception, FreeType can also be built with the 'makepp' build tool, available from http://makepp.sourceforge.net. -Note, however. that you will need at least version 1.19 and pass the +Note, however, that you will need at least version 2.0 and pass the option --norc-substitution to have it work correctly. From 939bbee1c007d307f80c538b2a09ee2632f16655 Mon Sep 17 00:00:00 2001 From: Ankit Dhankhar Date: Sun, 15 Apr 2018 22:35:40 +0200 Subject: [PATCH 457/470] [docmaker] Make it work with python3. * src/tools/docmaker (*.py): Use parentheses around arguments of `print'. Remove unused imports. --- src/tools/docmaker/content.py | 12 ++-- src/tools/docmaker/docbeauty.py | 18 +++--- src/tools/docmaker/docmaker.py | 24 ++++---- src/tools/docmaker/sources.py | 10 ++-- src/tools/docmaker/tohtml.py | 100 ++++++++++++++++---------------- 5 files changed, 81 insertions(+), 83 deletions(-) diff --git a/src/tools/docmaker/content.py b/src/tools/docmaker/content.py index c9969dbe5..198780aee 100644 --- a/src/tools/docmaker/content.py +++ b/src/tools/docmaker/content.py @@ -109,7 +109,7 @@ class DocCode: def dump( self, prefix = "", width = 60 ): lines = self.dump_lines( 0, width ) for l in lines: - print prefix + l + print( prefix + l ) def dump_lines( self, margin = 0, width = 60 ): result = [] @@ -139,7 +139,7 @@ class DocPara: def dump( self, prefix = "", width = 60 ): lines = self.dump_lines( 0, width ) for l in lines: - print prefix + l + print( prefix + l ) def dump_lines( self, margin = 0, width = 60 ): cur = "" # current line @@ -243,13 +243,13 @@ class DocField: def dump( self, prefix = "" ): if self.field: - print prefix + self.field + " ::" + print( prefix + self.field + " ::" ) prefix = prefix + "----" first = 1 for p in self.items: if not first: - print "" + print( "" ) p.dump( prefix ) first = 0 @@ -330,10 +330,10 @@ class DocMarkup: return None def dump( self, margin ): - print " " * margin + "<" + self.tag + ">" + print( " " * margin + "<" + self.tag + ">" ) for f in self.fields: f.dump( " " ) - print " " * margin + "" + print( " " * margin + "" ) ################################################################ diff --git a/src/tools/docmaker/docbeauty.py b/src/tools/docmaker/docbeauty.py index 3ddf4a94a..0b021fa6c 100644 --- a/src/tools/docmaker/docbeauty.py +++ b/src/tools/docmaker/docbeauty.py @@ -10,9 +10,7 @@ from sources import * from content import * from utils import * -import utils - -import sys, os, time, string, getopt +import sys, os, string, getopt content_processor = ContentProcessor() @@ -40,13 +38,13 @@ def beautify_block( block ): def usage(): - print "\nDocBeauty 0.1 Usage information\n" - print " docbeauty [options] file1 [file2 ...]\n" - print "using the following options:\n" - print " -h : print this page" - print " -b : backup original files with the 'orig' extension" - print "" - print " --backup : same as -b" + print( "\nDocBeauty 0.1 Usage information\n" ) + print( " docbeauty [options] file1 [file2 ...]\n" ) + print( "using the following options:\n" ) + print( " -h : print this page" ) + print( " -b : backup original files with the 'orig' extension" ) + print( "" ) + print( " --backup : same as -b" ) def main( argv ): diff --git a/src/tools/docmaker/docmaker.py b/src/tools/docmaker/docmaker.py index 253a4d35a..eb49afb0a 100644 --- a/src/tools/docmaker/docmaker.py +++ b/src/tools/docmaker/docmaker.py @@ -31,21 +31,21 @@ from tohtml import * import utils -import sys, os, time, string, glob, getopt +import sys, glob, getopt def usage(): - print "\nDocMaker Usage information\n" - print " docmaker [options] file1 [file2 ...]\n" - print "using the following options:\n" - print " -h : print this page" - print " -t : set project title, as in '-t \"My Project\"'" - print " -o : set output directory, as in '-o mydir'" - print " -p : set documentation prefix, as in '-p ft2'" - print "" - print " --title : same as -t, as in '--title=\"My Project\"'" - print " --output : same as -o, as in '--output=mydir'" - print " --prefix : same as -p, as in '--prefix=ft2'" + print( "\nDocMaker Usage information\n" ) + print( " docmaker [options] file1 [file2 ...]\n" ) + print( "using the following options:\n" ) + print( " -h : print this page" ) + print( " -t : set project title, as in '-t \"My Project\"'" ) + print( " -o : set output directory, as in '-o mydir'" ) + print( " -p : set documentation prefix, as in '-p ft2'" ) + print( "" ) + print( " --title : same as -t, as in '--title=\"My Project\"'" ) + print( " --output : same as -o, as in '--output=mydir'" ) + print( " --prefix : same as -p, as in '--prefix=ft2'" ) def main( argv ): diff --git a/src/tools/docmaker/sources.py b/src/tools/docmaker/sources.py index 2cd5a3379..e3b95e0fa 100644 --- a/src/tools/docmaker/sources.py +++ b/src/tools/docmaker/sources.py @@ -29,7 +29,7 @@ # -import fileinput, re, sys, os, string +import fileinput, re, string ################################################################ @@ -296,10 +296,10 @@ class SourceBlock: # debugging only -- not used in normal operations def dump( self ): if self.content: - print "{{{content start---" + print( "{{{content start---" ) for l in self.content: - print l - print "---content end}}}" + print( l ) + print( "---content end}}}" ) return fmt = "" @@ -307,7 +307,7 @@ class SourceBlock: fmt = repr( self.format.id ) + " " for line in self.lines: - print line + print( line ) ################################################################ diff --git a/src/tools/docmaker/tohtml.py b/src/tools/docmaker/tohtml.py index 7f5ecda41..9f318a2a4 100644 --- a/src/tools/docmaker/tohtml.py +++ b/src/tools/docmaker/tohtml.py @@ -406,7 +406,7 @@ class HtmlFormatter( Formatter ): return string.join( lines, '\n' ) def print_html_items( self, items ): - print self.make_html_items( items ) + print( self.make_html_items( items ) ) def print_html_field( self, field ): if field.name: @@ -414,10 +414,10 @@ class HtmlFormatter( Formatter ): + field.name + "" ) - print self.make_html_items( field.items ) + print( self.make_html_items( field.items ) ) if field.name: - print "" + print( "" ) def html_source_quote( self, line, block_name = None ): result = "" @@ -468,14 +468,14 @@ class HtmlFormatter( Formatter ): return result def print_html_field_list( self, fields ): - print '' + print( '
    ' ) for field in fields: - print ( '" - print "
    ' - + field.name - + '' ) + print( '
    ' + + field.name + + '' ) self.print_html_items( field.items ) - print "
    " + print( "" ) + print( "" ) def print_html_markup( self, markup ): table_fields = [] @@ -499,7 +499,7 @@ class HtmlFormatter( Formatter ): # formatting the index # def index_enter( self ): - print self.html_index_header + print( self.html_index_header ) self.index_items = {} def index_name_enter( self, name ): @@ -512,7 +512,7 @@ class HtmlFormatter( Formatter ): count = len( self.block_index ) rows = ( count + self.columns - 1 ) // self.columns - print '' + print( '
    ' ) for r in range( rows ): line = "" for c in range( self.columns ): @@ -531,15 +531,15 @@ class HtmlFormatter( Formatter ): else: line = line + '' line = line + "" - print line + print( line ) - print "
    " + print( "" ) print( index_footer_start + self.file_prefix + "toc.html" + index_footer_end ) - print self.html_footer + print( self.html_footer ) self.index_items = {} @@ -553,25 +553,25 @@ class HtmlFormatter( Formatter ): # formatting the table of contents # def toc_enter( self ): - print self.html_toc_header - print "

    Table of Contents

    " + print( self.html_toc_header ) + print( "

    Table of Contents

    " ) def toc_chapter_enter( self, chapter ): - print chapter_header + string.join( chapter.title ) + chapter_inter - print '' + print( chapter_header + string.join( chapter.title ) + chapter_inter ) + print( '
    ' ) def toc_section_enter( self, section ): - print ( '" + print( "" ) def toc_chapter_exit( self, chapter ): - print "
    ' ) - print self.make_html_para( section.abstract ) + print( '
    ' ) + print( self.make_html_para( section.abstract ) ) def toc_section_exit( self, section ): - print "
    " - print chapter_footer + print( "" ) + print( chapter_footer ) def toc_index( self, index_filename ): print( chapter_header @@ -583,7 +583,7 @@ class HtmlFormatter( Formatter ): + self.file_prefix + "index.html" + toc_footer_end ) - print self.html_footer + print( self.html_footer ) def toc_dump( self, toc_filename = None, index_filename = None ): if toc_filename == None: @@ -598,11 +598,11 @@ class HtmlFormatter( Formatter ): # formatting sections # def section_enter( self, section ): - print self.html_header + print( self.html_header ) - print ( section_title_header1 + section.name + section_title_header2 - + section.title - + section_title_footer ) + print( section_title_header1 + section.name + section_title_header2 + + section.title + + section_title_footer ) maxwidth = 0 for b in section.blocks.values(): @@ -612,8 +612,8 @@ class HtmlFormatter( Formatter ): width = 70 # XXX magic number if maxwidth > 0: # print section synopsis - print section_synopsis_header - print '' + print( section_synopsis_header ) + print( '
    ' ) columns = width // maxwidth if columns < 1: @@ -650,17 +650,17 @@ class HtmlFormatter( Formatter ): line = line + '' line = line + "" - print line + print( line ) - print "
    " - print section_synopsis_footer + print( "" ) + print( section_synopsis_footer ) - print description_header - print self.make_html_items( section.description ) - print description_footer + print( description_header ) + print( self.make_html_items( section.description ) ) + print( description_footer ) def block_enter( self, block ): - print block_header + print( block_header ) # place html anchor if needed if block.name: @@ -686,28 +686,28 @@ class HtmlFormatter( Formatter ): # + " '" + block.source.filename + "'.\n" ) if header: - print ( header_location_header - + 'Defined in ' + header + '.' - + header_location_footer ) + print( header_location_header + + 'Defined in ' + header + '.' + + header_location_footer ) - print source_header + print( source_header ) for l in block.code: - print self.html_source_quote( l, block.name ) - print source_footer + print( self.html_source_quote( l, block.name ) ) + print( source_footer ) def markup_enter( self, markup, block ): if markup.tag == "description": - print description_header + print( description_header ) else: - print marker_header + markup.tag + marker_inter + print( marker_header + markup.tag + marker_inter ) self.print_html_markup( markup ) def markup_exit( self, markup, block ): if markup.tag == "description": - print description_footer + print( description_footer ) else: - print marker_footer + print( marker_footer ) def block_exit( self, block ): print( block_footer_start + self.file_prefix + "index.html" @@ -715,7 +715,7 @@ class HtmlFormatter( Formatter ): + block_footer_end ) def section_exit( self, section ): - print html_footer + print( html_footer ) def section_dump_all( self ): for section in self.sections: From 70ac167c47f5ca966fb578b1f215430f46915a49 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Mon, 16 Apr 2018 10:39:10 +0200 Subject: [PATCH 458/470] [truetype] Integer overflow issues. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=7718 * src/truetype/ttinterp.c (Ins_MIRP): Use ADD_LONG. --- ChangeLog | 14 ++++++++++++-- src/truetype/ttinterp.c | 2 +- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0197dcb29..316256098 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2018-04-16 Werner Lemberg + + [truetype] Integer overflow issues. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=7718 + + * src/truetype/ttinterp.c (Ins_MIRP): Use ADD_LONG. + 2018-04-15 Alexei Podtelezhnikov [build] Use `info' function of make 3.81. @@ -46,7 +56,7 @@ 2018-04-10 Nikolaus Waxweiler - * CMakeLists.txt, builds/cmake/FindHarfBuzz.cmake: Extensive + * CMakeLists.txt, builds/cmake/FindHarfBuzz.cmake: Extensive modernization measures. This brings up the minimum required CMake version to 2.8.12. @@ -102,7 +112,7 @@ builds/windows/vc2008/freetype.vcproj, builds/windows/visualce/freetype.vcproj, builds/windows/visualce/freetype.dsp, - builds/windows/visualc/freetype.vcproj, + builds/windows/visualc/freetype.vcproj, builds/windows/visualc/freetype.dsp: Remove per-file compile flags. 2018-04-04 Werner Lemberg diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c index c66c69929..336b46b42 100644 --- a/src/truetype/ttinterp.c +++ b/src/truetype/ttinterp.c @@ -6193,7 +6193,7 @@ minimum_distance = exc->GS.minimum_distance; control_value_cutin = exc->GS.control_value_cutin; point = (FT_UShort)args[0]; - cvtEntry = (FT_ULong)( args[1] + 1 ); + cvtEntry = (FT_ULong)( ADD_LONG( args[1], 1 ) ); #ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY if ( SUBPIXEL_HINTING_INFINALITY && From 632a11f91f0d932ac498e9e6ca022c9903ab05e9 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Mon, 16 Apr 2018 19:51:37 +0200 Subject: [PATCH 459/470] CHANGES: Mention CVE-2018-6942. --- docs/CHANGES | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/CHANGES b/docs/CHANGES index 4b525558e..99c9d481c 100644 --- a/docs/CHANGES +++ b/docs/CHANGES @@ -5,6 +5,11 @@ CHANGES BETWEEN 2.9 and 2.9.1 - Type 1 fonts containing flex features were not rendered correctly (bug introduced in version 2.9). + - CVE-2018-6942: Older FreeType versions can crash with certain + malformed variation fonts. + + http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-6942 + II. MISCELLANEOUS From 2a1597826a84275660e7410368200b37f85ffdaf Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Tue, 17 Apr 2018 12:25:17 +0200 Subject: [PATCH 460/470] [truetype] Integer overflow issues. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=7739 * src/truetype/ttinterp.c (Ins_CEILING): Use FT_PIX_CEIL_LONG. --- ChangeLog | 10 ++++++++++ src/truetype/ttinterp.c | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 316256098..c3788a9da 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2018-04-17 Werner Lemberg + + [truetype] Integer overflow issues. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=7739 + + * src/truetype/ttinterp.c (Ins_CEILING): Use FT_PIX_CEIL_LONG. + 2018-04-16 Werner Lemberg [truetype] Integer overflow issues. diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c index 336b46b42..da9b595ab 100644 --- a/src/truetype/ttinterp.c +++ b/src/truetype/ttinterp.c @@ -2954,7 +2954,7 @@ static void Ins_CEILING( FT_Long* args ) { - args[0] = FT_PIX_CEIL( args[0] ); + args[0] = FT_PIX_CEIL_LONG( args[0] ); } From 1655e00fced6d16187fe2b3494d562795b2addd7 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Thu, 19 Apr 2018 14:45:19 +0200 Subject: [PATCH 461/470] Fix handling of invalid format 2 cmaps. The problem was introduced after the last release. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=7828 * src/sfnt/ttcmap.c (tt_cmap2_char_next): Avoid endless loop. --- ChangeLog | 12 ++++++++++++ src/sfnt/ttcmap.c | 7 +++++++ 2 files changed, 19 insertions(+) diff --git a/ChangeLog b/ChangeLog index c3788a9da..99fca5d83 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2018-03-13 Werner Lemberg + + Fix handling of invalid format 2 cmaps. + + The problem was introduced after the last release. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=7828 + + * src/sfnt/ttcmap.c (tt_cmap2_char_next): Avoid endless loop. + 2018-04-17 Werner Lemberg [truetype] Integer overflow issues. diff --git a/src/sfnt/ttcmap.c b/src/sfnt/ttcmap.c index dcde8693e..71a3c1e34 100644 --- a/src/sfnt/ttcmap.c +++ b/src/sfnt/ttcmap.c @@ -518,6 +518,13 @@ FT_UInt pos, idx; + if ( char_lo > start + count ) + { + /* this happens only for a malformed cmap */ + charcode = 0x100; + continue; + } + if ( offset == 0 ) { if ( charcode == 0x100 ) From e4b6d8532673d0dab6138d98c33ed9ab8d23e05c Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Thu, 19 Apr 2018 17:43:03 +0200 Subject: [PATCH 462/470] [autofit] Add support for Georgian Mtavruli characters. This will be part of the forthcoming Unicode 11.0. * src/autofit/afblue.dat: Add blue zone data for Mtavruli. * src/autofit/afblue.c, src/autofit/afblue.h: Regenerated. * src/autofit/afscript.h: Add Mtavruli standard character. --- ChangeLog | 11 ++ src/autofit/afblue.c | 6 + src/autofit/afblue.dat | 8 +- src/autofit/afblue.h | 298 +++++++++++++++++++++-------------------- src/autofit/afscript.h | 2 +- 5 files changed, 175 insertions(+), 150 deletions(-) diff --git a/ChangeLog b/ChangeLog index 99fca5d83..57c617ee4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2018-04-19 Werner Lemberg Fix handling of invalid format 2 cmaps. diff --git a/src/autofit/afblue.c b/src/autofit/afblue.c index 61ab7957f..e4078fd04 100644 --- a/src/autofit/afblue.c +++ b/src/autofit/afblue.c @@ -166,6 +166,10 @@ '\0', '\xE2', '\xB4', '\x84', ' ', '\xE2', '\xB4', '\x85', ' ', '\xE2', '\xB4', '\x94', ' ', '\xE2', '\xB4', '\x95', ' ', '\xE2', '\xB4', '\x81', ' ', '\xE2', '\xB4', '\x82', ' ', '\xE2', '\xB4', '\x98', ' ', '\xE2', '\xB4', '\x9D', /* ⴄ ⴅ ⴔ ⴕ ⴁ ⴂ ⴘ ⴝ */ '\0', + '\xE1', '\xB2', '\x9C', ' ', '\xE1', '\xB2', '\x9F', ' ', '\xE1', '\xB2', '\xB3', ' ', '\xE1', '\xB2', '\xB8', ' ', '\xE1', '\xB2', '\x92', ' ', '\xE1', '\xB2', '\x94', ' ', '\xE1', '\xB2', '\x9D', ' ', '\xE1', '\xB2', '\xB4', /* Ნ Ჟ Ჳ Ჸ Გ Ე Ო Ჴ */ + '\0', + '\xE1', '\xB2', '\x98', ' ', '\xE1', '\xB2', '\xB2', ' ', '\xE1', '\xB2', '\x9D', ' ', '\xE1', '\xB2', '\xA9', ' ', '\xE1', '\xB2', '\x9B', ' ', '\xE1', '\xB2', '\xA8', ' ', '\xE1', '\xB2', '\xAF', ' ', '\xE1', '\xB2', '\xBD', /* Ი Ჲ Ო Ჩ Მ Შ Ჯ Ჽ */ + '\0', '\xE2', '\xB0', '\x85', ' ', '\xE2', '\xB0', '\x94', ' ', '\xE2', '\xB0', '\xAA', ' ', '\xE2', '\xB0', '\x84', ' ', '\xE2', '\xB0', '\x82', ' ', '\xE2', '\xB0', '\x8A', ' ', '\xE2', '\xB0', '\xAB', ' ', '\xE2', '\xB0', '\x8B', /* Ⰵ Ⱄ Ⱚ Ⰴ Ⰲ Ⰺ Ⱛ Ⰻ */ '\0', '\xE2', '\xB0', '\x85', ' ', '\xE2', '\xB0', '\x84', ' ', '\xE2', '\xB0', '\x82', ' ', '\xE2', '\xB0', '\xAA', ' ', '\xE2', '\xB0', '\x9E', ' ', '\xE2', '\xB0', '\xA1', ' ', '\xE2', '\xB0', '\x8A', ' ', '\xE2', '\xB0', '\x94', /* Ⰵ Ⰴ Ⰲ Ⱚ Ⱎ Ⱑ Ⰺ Ⱄ */ @@ -539,6 +543,8 @@ { AF_BLUE_STRING_GEORGIAN_MKHEDRULI_BOTTOM, 0 }, { AF_BLUE_STRING_GEORGIAN_MKHEDRULI_ASCENDER, AF_BLUE_PROPERTY_LATIN_TOP }, { AF_BLUE_STRING_GEORGIAN_MKHEDRULI_DESCENDER, 0 }, + { AF_BLUE_STRING_GEORGIAN_MTAVRULI_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_GEORGIAN_MTAVRULI_BOTTOM, 0 }, { AF_BLUE_STRING_MAX, 0 }, { AF_BLUE_STRING_GEORGIAN_ASOMTAVRULI_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, { AF_BLUE_STRING_GEORGIAN_ASOMTAVRULI_BOTTOM, 0 }, diff --git a/src/autofit/afblue.dat b/src/autofit/afblue.dat index d3cc4284b..bc2f0d275 100644 --- a/src/autofit/afblue.dat +++ b/src/autofit/afblue.dat @@ -242,6 +242,11 @@ AF_BLUE_STRING_ENUM AF_BLUE_STRINGS_ARRAY AF_BLUE_STRING_MAX_LEN: AF_BLUE_STRING_GEORGIAN_NUSKHURI_DESCENDER "ⴄ ⴅ ⴔ ⴕ ⴁ ⴂ ⴘ ⴝ" + AF_BLUE_STRING_GEORGIAN_MTAVRULI_TOP + "Ნ Ჟ Ჳ Ჸ Გ Ე Ო Ჴ" + AF_BLUE_STRING_GEORGIAN_MTAVRULI_BOTTOM + "Ი Ჲ Ო Ჩ Მ Შ Ჯ Ჽ" + AF_BLUE_STRING_GLAGOLITIC_CAPITAL_TOP "Ⰵ Ⱄ Ⱚ Ⰴ Ⰲ Ⰺ Ⱛ Ⰻ" AF_BLUE_STRING_GLAGOLITIC_CAPITAL_BOTTOM @@ -795,13 +800,14 @@ AF_BLUE_STRINGSET_ENUM AF_BLUE_STRINGSETS_ARRAY AF_BLUE_STRINGSET_MAX_LEN: { AF_BLUE_STRING_ETHIOPIC_BOTTOM, 0 } { AF_BLUE_STRING_MAX, 0 } - // blue zones for Mtavruli are missing (not yet defined in Unicode) AF_BLUE_STRINGSET_GEOR { AF_BLUE_STRING_GEORGIAN_MKHEDRULI_TOP, AF_BLUE_PROPERTY_LATIN_TOP | AF_BLUE_PROPERTY_LATIN_X_HEIGHT } { AF_BLUE_STRING_GEORGIAN_MKHEDRULI_BOTTOM, 0 } { AF_BLUE_STRING_GEORGIAN_MKHEDRULI_ASCENDER, AF_BLUE_PROPERTY_LATIN_TOP } { AF_BLUE_STRING_GEORGIAN_MKHEDRULI_DESCENDER, 0 } + { AF_BLUE_STRING_GEORGIAN_MTAVRULI_TOP, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_GEORGIAN_MTAVRULI_BOTTOM, 0 } { AF_BLUE_STRING_MAX, 0 } AF_BLUE_STRINGSET_GEOK diff --git a/src/autofit/afblue.h b/src/autofit/afblue.h index 56b591aa8..de31e259c 100644 --- a/src/autofit/afblue.h +++ b/src/autofit/afblue.h @@ -147,119 +147,121 @@ FT_BEGIN_HEADER AF_BLUE_STRING_GEORGIAN_NUSKHURI_BOTTOM = 1813, AF_BLUE_STRING_GEORGIAN_NUSKHURI_ASCENDER = 1845, AF_BLUE_STRING_GEORGIAN_NUSKHURI_DESCENDER = 1877, - AF_BLUE_STRING_GLAGOLITIC_CAPITAL_TOP = 1909, - AF_BLUE_STRING_GLAGOLITIC_CAPITAL_BOTTOM = 1941, - AF_BLUE_STRING_GLAGOLITIC_SMALL_TOP = 1973, - AF_BLUE_STRING_GLAGOLITIC_SMALL_BOTTOM = 2005, - AF_BLUE_STRING_GOTHIC_TOP = 2037, - AF_BLUE_STRING_GOTHIC_BOTTOM = 2077, - AF_BLUE_STRING_GREEK_CAPITAL_TOP = 2097, - AF_BLUE_STRING_GREEK_CAPITAL_BOTTOM = 2118, - AF_BLUE_STRING_GREEK_SMALL_BETA_TOP = 2136, - AF_BLUE_STRING_GREEK_SMALL = 2154, - AF_BLUE_STRING_GREEK_SMALL_DESCENDER = 2178, - AF_BLUE_STRING_GUJARATI_TOP = 2202, - AF_BLUE_STRING_GUJARATI_BOTTOM = 2234, - AF_BLUE_STRING_GUJARATI_ASCENDER = 2266, - AF_BLUE_STRING_GUJARATI_DESCENDER = 2316, - AF_BLUE_STRING_GUJARATI_DIGIT_TOP = 2349, - AF_BLUE_STRING_GURMUKHI_BASE = 2369, - AF_BLUE_STRING_GURMUKHI_HEAD = 2401, - AF_BLUE_STRING_GURMUKHI_TOP = 2433, - AF_BLUE_STRING_GURMUKHI_BOTTOM = 2465, - AF_BLUE_STRING_GURMUKHI_DIGIT_TOP = 2497, - AF_BLUE_STRING_HEBREW_TOP = 2517, - AF_BLUE_STRING_HEBREW_BOTTOM = 2541, - AF_BLUE_STRING_HEBREW_DESCENDER = 2559, - AF_BLUE_STRING_KANNADA_TOP = 2574, - AF_BLUE_STRING_KANNADA_BOTTOM = 2618, - AF_BLUE_STRING_KAYAH_LI_TOP = 2650, - AF_BLUE_STRING_KAYAH_LI_BOTTOM = 2674, - AF_BLUE_STRING_KAYAH_LI_ASCENDER = 2694, - AF_BLUE_STRING_KAYAH_LI_DESCENDER = 2702, - AF_BLUE_STRING_KAYAH_LI_LARGE_DESCENDER = 2714, - AF_BLUE_STRING_KHMER_TOP = 2735, - AF_BLUE_STRING_KHMER_SUBSCRIPT_TOP = 2759, - AF_BLUE_STRING_KHMER_BOTTOM = 2799, - AF_BLUE_STRING_KHMER_DESCENDER = 2831, - AF_BLUE_STRING_KHMER_LARGE_DESCENDER = 2865, - AF_BLUE_STRING_KHMER_SYMBOLS_WAXING_TOP = 2952, - AF_BLUE_STRING_KHMER_SYMBOLS_WANING_BOTTOM = 2960, - AF_BLUE_STRING_LAO_TOP = 2968, - AF_BLUE_STRING_LAO_BOTTOM = 3000, - AF_BLUE_STRING_LAO_ASCENDER = 3032, - AF_BLUE_STRING_LAO_LARGE_ASCENDER = 3048, - AF_BLUE_STRING_LAO_DESCENDER = 3060, - AF_BLUE_STRING_LATIN_CAPITAL_TOP = 3084, - AF_BLUE_STRING_LATIN_CAPITAL_BOTTOM = 3100, - AF_BLUE_STRING_LATIN_SMALL_F_TOP = 3116, - AF_BLUE_STRING_LATIN_SMALL_TOP = 3130, - AF_BLUE_STRING_LATIN_SMALL_BOTTOM = 3146, - AF_BLUE_STRING_LATIN_SMALL_DESCENDER = 3162, - AF_BLUE_STRING_LATIN_SUBS_CAPITAL_TOP = 3172, - AF_BLUE_STRING_LATIN_SUBS_CAPITAL_BOTTOM = 3192, - AF_BLUE_STRING_LATIN_SUBS_SMALL_F_TOP = 3212, - AF_BLUE_STRING_LATIN_SUBS_SMALL = 3232, - AF_BLUE_STRING_LATIN_SUBS_SMALL_DESCENDER = 3268, - AF_BLUE_STRING_LATIN_SUPS_CAPITAL_TOP = 3288, - AF_BLUE_STRING_LATIN_SUPS_CAPITAL_BOTTOM = 3319, - AF_BLUE_STRING_LATIN_SUPS_SMALL_F_TOP = 3348, - AF_BLUE_STRING_LATIN_SUPS_SMALL = 3374, - AF_BLUE_STRING_LATIN_SUPS_SMALL_DESCENDER = 3399, - AF_BLUE_STRING_LISU_TOP = 3410, - AF_BLUE_STRING_LISU_BOTTOM = 3442, - AF_BLUE_STRING_MALAYALAM_TOP = 3474, - AF_BLUE_STRING_MALAYALAM_BOTTOM = 3518, - AF_BLUE_STRING_MYANMAR_TOP = 3550, - AF_BLUE_STRING_MYANMAR_BOTTOM = 3582, - AF_BLUE_STRING_MYANMAR_ASCENDER = 3614, - AF_BLUE_STRING_MYANMAR_DESCENDER = 3642, - AF_BLUE_STRING_NKO_TOP = 3674, - AF_BLUE_STRING_NKO_BOTTOM = 3698, - AF_BLUE_STRING_NKO_SMALL_TOP = 3713, - AF_BLUE_STRING_NKO_SMALL_BOTTOM = 3722, - AF_BLUE_STRING_OL_CHIKI = 3734, - AF_BLUE_STRING_OLD_TURKIC_TOP = 3758, - AF_BLUE_STRING_OLD_TURKIC_BOTTOM = 3773, - AF_BLUE_STRING_OSAGE_CAPITAL_TOP = 3793, - AF_BLUE_STRING_OSAGE_CAPITAL_BOTTOM = 3833, - AF_BLUE_STRING_OSAGE_CAPITAL_DESCENDER = 3863, - AF_BLUE_STRING_OSAGE_SMALL_TOP = 3878, - AF_BLUE_STRING_OSAGE_SMALL_BOTTOM = 3918, - AF_BLUE_STRING_OSAGE_SMALL_ASCENDER = 3958, - AF_BLUE_STRING_OSAGE_SMALL_DESCENDER = 3983, - AF_BLUE_STRING_OSMANYA_TOP = 3998, - AF_BLUE_STRING_OSMANYA_BOTTOM = 4038, - AF_BLUE_STRING_SAURASHTRA_TOP = 4078, - AF_BLUE_STRING_SAURASHTRA_BOTTOM = 4110, - AF_BLUE_STRING_SHAVIAN_TOP = 4130, - AF_BLUE_STRING_SHAVIAN_BOTTOM = 4140, - AF_BLUE_STRING_SHAVIAN_DESCENDER = 4165, - AF_BLUE_STRING_SHAVIAN_SMALL_TOP = 4175, - AF_BLUE_STRING_SHAVIAN_SMALL_BOTTOM = 4210, - AF_BLUE_STRING_SINHALA_TOP = 4225, - AF_BLUE_STRING_SINHALA_BOTTOM = 4257, - AF_BLUE_STRING_SINHALA_DESCENDER = 4289, - AF_BLUE_STRING_SUNDANESE_TOP = 4333, - AF_BLUE_STRING_SUNDANESE_BOTTOM = 4357, - AF_BLUE_STRING_SUNDANESE_DESCENDER = 4389, - AF_BLUE_STRING_TAI_VIET_TOP = 4397, - AF_BLUE_STRING_TAI_VIET_BOTTOM = 4417, - AF_BLUE_STRING_TAMIL_TOP = 4429, - AF_BLUE_STRING_TAMIL_BOTTOM = 4461, - AF_BLUE_STRING_TELUGU_TOP = 4493, - AF_BLUE_STRING_TELUGU_BOTTOM = 4521, - AF_BLUE_STRING_THAI_TOP = 4549, - AF_BLUE_STRING_THAI_BOTTOM = 4573, - AF_BLUE_STRING_THAI_ASCENDER = 4601, - AF_BLUE_STRING_THAI_LARGE_ASCENDER = 4613, - AF_BLUE_STRING_THAI_DESCENDER = 4625, - AF_BLUE_STRING_THAI_LARGE_DESCENDER = 4641, - AF_BLUE_STRING_THAI_DIGIT_TOP = 4649, - AF_BLUE_STRING_TIFINAGH = 4661, - AF_BLUE_STRING_VAI_TOP = 4693, - AF_BLUE_STRING_VAI_BOTTOM = 4725, - af_blue_1_1 = 4756, + AF_BLUE_STRING_GEORGIAN_MTAVRULI_TOP = 1909, + AF_BLUE_STRING_GEORGIAN_MTAVRULI_BOTTOM = 1941, + AF_BLUE_STRING_GLAGOLITIC_CAPITAL_TOP = 1973, + AF_BLUE_STRING_GLAGOLITIC_CAPITAL_BOTTOM = 2005, + AF_BLUE_STRING_GLAGOLITIC_SMALL_TOP = 2037, + AF_BLUE_STRING_GLAGOLITIC_SMALL_BOTTOM = 2069, + AF_BLUE_STRING_GOTHIC_TOP = 2101, + AF_BLUE_STRING_GOTHIC_BOTTOM = 2141, + AF_BLUE_STRING_GREEK_CAPITAL_TOP = 2161, + AF_BLUE_STRING_GREEK_CAPITAL_BOTTOM = 2182, + AF_BLUE_STRING_GREEK_SMALL_BETA_TOP = 2200, + AF_BLUE_STRING_GREEK_SMALL = 2218, + AF_BLUE_STRING_GREEK_SMALL_DESCENDER = 2242, + AF_BLUE_STRING_GUJARATI_TOP = 2266, + AF_BLUE_STRING_GUJARATI_BOTTOM = 2298, + AF_BLUE_STRING_GUJARATI_ASCENDER = 2330, + AF_BLUE_STRING_GUJARATI_DESCENDER = 2380, + AF_BLUE_STRING_GUJARATI_DIGIT_TOP = 2413, + AF_BLUE_STRING_GURMUKHI_BASE = 2433, + AF_BLUE_STRING_GURMUKHI_HEAD = 2465, + AF_BLUE_STRING_GURMUKHI_TOP = 2497, + AF_BLUE_STRING_GURMUKHI_BOTTOM = 2529, + AF_BLUE_STRING_GURMUKHI_DIGIT_TOP = 2561, + AF_BLUE_STRING_HEBREW_TOP = 2581, + AF_BLUE_STRING_HEBREW_BOTTOM = 2605, + AF_BLUE_STRING_HEBREW_DESCENDER = 2623, + AF_BLUE_STRING_KANNADA_TOP = 2638, + AF_BLUE_STRING_KANNADA_BOTTOM = 2682, + AF_BLUE_STRING_KAYAH_LI_TOP = 2714, + AF_BLUE_STRING_KAYAH_LI_BOTTOM = 2738, + AF_BLUE_STRING_KAYAH_LI_ASCENDER = 2758, + AF_BLUE_STRING_KAYAH_LI_DESCENDER = 2766, + AF_BLUE_STRING_KAYAH_LI_LARGE_DESCENDER = 2778, + AF_BLUE_STRING_KHMER_TOP = 2799, + AF_BLUE_STRING_KHMER_SUBSCRIPT_TOP = 2823, + AF_BLUE_STRING_KHMER_BOTTOM = 2863, + AF_BLUE_STRING_KHMER_DESCENDER = 2895, + AF_BLUE_STRING_KHMER_LARGE_DESCENDER = 2929, + AF_BLUE_STRING_KHMER_SYMBOLS_WAXING_TOP = 3016, + AF_BLUE_STRING_KHMER_SYMBOLS_WANING_BOTTOM = 3024, + AF_BLUE_STRING_LAO_TOP = 3032, + AF_BLUE_STRING_LAO_BOTTOM = 3064, + AF_BLUE_STRING_LAO_ASCENDER = 3096, + AF_BLUE_STRING_LAO_LARGE_ASCENDER = 3112, + AF_BLUE_STRING_LAO_DESCENDER = 3124, + AF_BLUE_STRING_LATIN_CAPITAL_TOP = 3148, + AF_BLUE_STRING_LATIN_CAPITAL_BOTTOM = 3164, + AF_BLUE_STRING_LATIN_SMALL_F_TOP = 3180, + AF_BLUE_STRING_LATIN_SMALL_TOP = 3194, + AF_BLUE_STRING_LATIN_SMALL_BOTTOM = 3210, + AF_BLUE_STRING_LATIN_SMALL_DESCENDER = 3226, + AF_BLUE_STRING_LATIN_SUBS_CAPITAL_TOP = 3236, + AF_BLUE_STRING_LATIN_SUBS_CAPITAL_BOTTOM = 3256, + AF_BLUE_STRING_LATIN_SUBS_SMALL_F_TOP = 3276, + AF_BLUE_STRING_LATIN_SUBS_SMALL = 3296, + AF_BLUE_STRING_LATIN_SUBS_SMALL_DESCENDER = 3332, + AF_BLUE_STRING_LATIN_SUPS_CAPITAL_TOP = 3352, + AF_BLUE_STRING_LATIN_SUPS_CAPITAL_BOTTOM = 3383, + AF_BLUE_STRING_LATIN_SUPS_SMALL_F_TOP = 3412, + AF_BLUE_STRING_LATIN_SUPS_SMALL = 3438, + AF_BLUE_STRING_LATIN_SUPS_SMALL_DESCENDER = 3463, + AF_BLUE_STRING_LISU_TOP = 3474, + AF_BLUE_STRING_LISU_BOTTOM = 3506, + AF_BLUE_STRING_MALAYALAM_TOP = 3538, + AF_BLUE_STRING_MALAYALAM_BOTTOM = 3582, + AF_BLUE_STRING_MYANMAR_TOP = 3614, + AF_BLUE_STRING_MYANMAR_BOTTOM = 3646, + AF_BLUE_STRING_MYANMAR_ASCENDER = 3678, + AF_BLUE_STRING_MYANMAR_DESCENDER = 3706, + AF_BLUE_STRING_NKO_TOP = 3738, + AF_BLUE_STRING_NKO_BOTTOM = 3762, + AF_BLUE_STRING_NKO_SMALL_TOP = 3777, + AF_BLUE_STRING_NKO_SMALL_BOTTOM = 3786, + AF_BLUE_STRING_OL_CHIKI = 3798, + AF_BLUE_STRING_OLD_TURKIC_TOP = 3822, + AF_BLUE_STRING_OLD_TURKIC_BOTTOM = 3837, + AF_BLUE_STRING_OSAGE_CAPITAL_TOP = 3857, + AF_BLUE_STRING_OSAGE_CAPITAL_BOTTOM = 3897, + AF_BLUE_STRING_OSAGE_CAPITAL_DESCENDER = 3927, + AF_BLUE_STRING_OSAGE_SMALL_TOP = 3942, + AF_BLUE_STRING_OSAGE_SMALL_BOTTOM = 3982, + AF_BLUE_STRING_OSAGE_SMALL_ASCENDER = 4022, + AF_BLUE_STRING_OSAGE_SMALL_DESCENDER = 4047, + AF_BLUE_STRING_OSMANYA_TOP = 4062, + AF_BLUE_STRING_OSMANYA_BOTTOM = 4102, + AF_BLUE_STRING_SAURASHTRA_TOP = 4142, + AF_BLUE_STRING_SAURASHTRA_BOTTOM = 4174, + AF_BLUE_STRING_SHAVIAN_TOP = 4194, + AF_BLUE_STRING_SHAVIAN_BOTTOM = 4204, + AF_BLUE_STRING_SHAVIAN_DESCENDER = 4229, + AF_BLUE_STRING_SHAVIAN_SMALL_TOP = 4239, + AF_BLUE_STRING_SHAVIAN_SMALL_BOTTOM = 4274, + AF_BLUE_STRING_SINHALA_TOP = 4289, + AF_BLUE_STRING_SINHALA_BOTTOM = 4321, + AF_BLUE_STRING_SINHALA_DESCENDER = 4353, + AF_BLUE_STRING_SUNDANESE_TOP = 4397, + AF_BLUE_STRING_SUNDANESE_BOTTOM = 4421, + AF_BLUE_STRING_SUNDANESE_DESCENDER = 4453, + AF_BLUE_STRING_TAI_VIET_TOP = 4461, + AF_BLUE_STRING_TAI_VIET_BOTTOM = 4481, + AF_BLUE_STRING_TAMIL_TOP = 4493, + AF_BLUE_STRING_TAMIL_BOTTOM = 4525, + AF_BLUE_STRING_TELUGU_TOP = 4557, + AF_BLUE_STRING_TELUGU_BOTTOM = 4585, + AF_BLUE_STRING_THAI_TOP = 4613, + AF_BLUE_STRING_THAI_BOTTOM = 4637, + AF_BLUE_STRING_THAI_ASCENDER = 4665, + AF_BLUE_STRING_THAI_LARGE_ASCENDER = 4677, + AF_BLUE_STRING_THAI_DESCENDER = 4689, + AF_BLUE_STRING_THAI_LARGE_DESCENDER = 4705, + AF_BLUE_STRING_THAI_DIGIT_TOP = 4713, + AF_BLUE_STRING_TIFINAGH = 4725, + AF_BLUE_STRING_VAI_TOP = 4757, + AF_BLUE_STRING_VAI_BOTTOM = 4789, + af_blue_1_1 = 4820, #ifdef AF_CONFIG_OPTION_CJK AF_BLUE_STRING_CJK_TOP = af_blue_1_1 + 1, AF_BLUE_STRING_CJK_BOTTOM = af_blue_1_1 + 203, @@ -336,41 +338,41 @@ FT_BEGIN_HEADER AF_BLUE_STRINGSET_DSRT = 75, AF_BLUE_STRINGSET_ETHI = 80, AF_BLUE_STRINGSET_GEOR = 83, - AF_BLUE_STRINGSET_GEOK = 88, - AF_BLUE_STRINGSET_GLAG = 95, - AF_BLUE_STRINGSET_GOTH = 100, - AF_BLUE_STRINGSET_GREK = 103, - AF_BLUE_STRINGSET_GUJR = 110, - AF_BLUE_STRINGSET_GURU = 116, - AF_BLUE_STRINGSET_HEBR = 122, - AF_BLUE_STRINGSET_KALI = 126, - AF_BLUE_STRINGSET_KHMR = 132, - AF_BLUE_STRINGSET_KHMS = 138, - AF_BLUE_STRINGSET_KNDA = 141, - AF_BLUE_STRINGSET_LAO = 144, - AF_BLUE_STRINGSET_LATN = 150, - AF_BLUE_STRINGSET_LATB = 157, - AF_BLUE_STRINGSET_LATP = 164, - AF_BLUE_STRINGSET_LISU = 171, - AF_BLUE_STRINGSET_MLYM = 174, - AF_BLUE_STRINGSET_MYMR = 177, - AF_BLUE_STRINGSET_NKOO = 182, - AF_BLUE_STRINGSET_NONE = 187, - AF_BLUE_STRINGSET_OLCK = 188, - AF_BLUE_STRINGSET_ORKH = 191, - AF_BLUE_STRINGSET_OSGE = 194, - AF_BLUE_STRINGSET_OSMA = 202, - AF_BLUE_STRINGSET_SAUR = 205, - AF_BLUE_STRINGSET_SHAW = 208, - AF_BLUE_STRINGSET_SINH = 214, - AF_BLUE_STRINGSET_SUND = 218, - AF_BLUE_STRINGSET_TAML = 222, - AF_BLUE_STRINGSET_TAVT = 225, - AF_BLUE_STRINGSET_TELU = 228, - AF_BLUE_STRINGSET_TFNG = 231, - AF_BLUE_STRINGSET_THAI = 234, - AF_BLUE_STRINGSET_VAII = 242, - af_blue_2_1 = 245, + AF_BLUE_STRINGSET_GEOK = 90, + AF_BLUE_STRINGSET_GLAG = 97, + AF_BLUE_STRINGSET_GOTH = 102, + AF_BLUE_STRINGSET_GREK = 105, + AF_BLUE_STRINGSET_GUJR = 112, + AF_BLUE_STRINGSET_GURU = 118, + AF_BLUE_STRINGSET_HEBR = 124, + AF_BLUE_STRINGSET_KALI = 128, + AF_BLUE_STRINGSET_KHMR = 134, + AF_BLUE_STRINGSET_KHMS = 140, + AF_BLUE_STRINGSET_KNDA = 143, + AF_BLUE_STRINGSET_LAO = 146, + AF_BLUE_STRINGSET_LATN = 152, + AF_BLUE_STRINGSET_LATB = 159, + AF_BLUE_STRINGSET_LATP = 166, + AF_BLUE_STRINGSET_LISU = 173, + AF_BLUE_STRINGSET_MLYM = 176, + AF_BLUE_STRINGSET_MYMR = 179, + AF_BLUE_STRINGSET_NKOO = 184, + AF_BLUE_STRINGSET_NONE = 189, + AF_BLUE_STRINGSET_OLCK = 190, + AF_BLUE_STRINGSET_ORKH = 193, + AF_BLUE_STRINGSET_OSGE = 196, + AF_BLUE_STRINGSET_OSMA = 204, + AF_BLUE_STRINGSET_SAUR = 207, + AF_BLUE_STRINGSET_SHAW = 210, + AF_BLUE_STRINGSET_SINH = 216, + AF_BLUE_STRINGSET_SUND = 220, + AF_BLUE_STRINGSET_TAML = 224, + AF_BLUE_STRINGSET_TAVT = 227, + AF_BLUE_STRINGSET_TELU = 230, + AF_BLUE_STRINGSET_TFNG = 233, + AF_BLUE_STRINGSET_THAI = 236, + AF_BLUE_STRINGSET_VAII = 244, + af_blue_2_1 = 247, #ifdef AF_CONFIG_OPTION_CJK AF_BLUE_STRINGSET_HANI = af_blue_2_1 + 0, af_blue_2_1_1 = af_blue_2_1 + 2, diff --git a/src/autofit/afscript.h b/src/autofit/afscript.h index 6ac193f6a..623a1734a 100644 --- a/src/autofit/afscript.h +++ b/src/autofit/afscript.h @@ -137,7 +137,7 @@ "Georgian (Mkhedruli)", HB_SCRIPT_GEORGIAN, HINTING_BOTTOM_TO_TOP, - "\xE1\x83\x98 \xE1\x83\x94 \xE1\x83\x90" ) /* ი ე ა */ + "\xE1\x83\x98 \xE1\x83\x94 \xE1\x83\x90 \xE1\xB2\xBF" ) /* ი ე ა Ი */ SCRIPT( geok, GEOK, "Georgian (Khutsuri)", From 92e4662ba6a5f7d364f2138fb398d90b210b65e7 Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Thu, 19 Apr 2018 17:57:42 -0400 Subject: [PATCH 463/470] Documentation tweaks. --- include/freetype/freetype.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h index 77dd187ee..008335cfa 100644 --- a/include/freetype/freetype.h +++ b/include/freetype/freetype.h @@ -1176,7 +1176,7 @@ FT_BEGIN_HEADER /* interpolating between them. Supported formats are Adobe MM, */ /* TrueType GX, and OpenType variation fonts. */ /* */ - /* See the multiple-masters specific API for details. */ + /* See section @multiple_masters for API details. */ /* */ /* FT_FACE_FLAG_GLYPH_NAMES :: */ /* The face contains glyph names, which can be retrieved using */ @@ -2063,8 +2063,8 @@ FT_BEGIN_HEADER /* data :: A pointer to the parameter data. */ /* */ /* */ - /* The ID and function of parameters are driver-specific. See the */ - /* various FT_PARAM_TAG_XXX flags for more information. */ + /* The ID and function of parameters are driver-specific. See */ + /* section @parameter_tags for more information. */ /* */ typedef struct FT_Parameter_ { From 38ecc949ce1bfe4ceb567df7d8c7daf1d620fd3a Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sun, 22 Apr 2018 10:14:03 +0200 Subject: [PATCH 464/470] Another fix for handling invalid format 2 cmaps. The previous commit was incomplete. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=7928 * src/sfnt/ttcmap.c (tt_cmap2_char_next): Adjust condition to avoid an endless loop. --- ChangeLog | 15 ++++++++++++++- src/sfnt/ttcmap.c | 2 +- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 57c617ee4..4dc8c552a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2018-04-22 Werner Lemberg + + Another fix for handling invalid format 2 cmaps. + + The previous commit was incomplete. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=7928 + + * src/sfnt/ttcmap.c (tt_cmap2_char_next): Adjust condition to avoid + an endless loop. + 2018-04-19 Werner Lemberg +2018-04-18 Werner Lemberg Fix handling of invalid format 2 cmaps. diff --git a/src/sfnt/ttcmap.c b/src/sfnt/ttcmap.c index 71a3c1e34..07075cbc0 100644 --- a/src/sfnt/ttcmap.c +++ b/src/sfnt/ttcmap.c @@ -518,7 +518,7 @@ FT_UInt pos, idx; - if ( char_lo > start + count ) + if ( char_lo > start + count && charcode <= 0xFF ) { /* this happens only for a malformed cmap */ charcode = 0x100; From c0f1adedcfaad4f7d2fe912ff4b2933845d61d93 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sun, 22 Apr 2018 11:44:24 +0200 Subject: [PATCH 465/470] [base] Fix bitmap copying where the new pitch is smaller. * src/base/ftbitmap.c (ft_bitmap_assure_buffer): Handle it. --- ChangeLog | 6 +++++ src/base/ftbitmap.c | 58 ++++++++++++++++++++++++++++++++++----------- 2 files changed, 50 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4dc8c552a..5cdf5be14 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2018-04-22 Werner Lemberg + + [base] Fix bitmap copying where the new pitch is smaller. + + * src/base/ftbitmap.c (ft_bitmap_assure_buffer): Handle it. + 2018-04-22 Werner Lemberg Another fix for handling invalid format 2 cmaps. diff --git a/src/base/ftbitmap.c b/src/base/ftbitmap.c index 93efb0944..4f5ca5a59 100644 --- a/src/base/ftbitmap.c +++ b/src/base/ftbitmap.c @@ -237,20 +237,35 @@ unsigned char* out = buffer; unsigned char* limit = bitmap->buffer + pitch * bitmap->rows; - unsigned int delta = new_pitch - pitch; FT_MEM_ZERO( out, new_pitch * ypixels ); out += new_pitch * ypixels; - while ( in < limit ) + if ( new_pitch > pitch ) { - FT_MEM_COPY( out, in, len ); - in += pitch; - out += pitch; + unsigned int delta = new_pitch - pitch; - FT_MEM_ZERO( out, delta ); - out += delta; + + while ( in < limit ) + { + FT_MEM_COPY( out, in, len ); + in += pitch; + out += pitch; + + /* we have to zero out the new (unused) pitch bytes */ + FT_MEM_ZERO( out, delta ); + out += delta; + } + } + else + { + while ( in < limit ) + { + FT_MEM_COPY( out, in, len ); + in += pitch; + out += new_pitch; + } } } else @@ -261,17 +276,32 @@ unsigned char* out = buffer; unsigned char* limit = bitmap->buffer + pitch * bitmap->rows; - unsigned int delta = new_pitch - pitch; - while ( in < limit ) + if ( new_pitch > pitch ) { - FT_MEM_COPY( out, in, len ); - in += pitch; - out += pitch; + unsigned int delta = new_pitch - pitch; - FT_MEM_ZERO( out, delta ); - out += delta; + + while ( in < limit ) + { + FT_MEM_COPY( out, in, len ); + in += pitch; + out += pitch; + + /* we have to zero out the new (unused) pitch bytes */ + FT_MEM_ZERO( out, delta ); + out += delta; + } + } + else + { + while ( in < limit ) + { + FT_MEM_COPY( out, in, len ); + in += pitch; + out += new_pitch; + } } FT_MEM_ZERO( out, new_pitch * ypixels ); From c2e2a8e5d9dbc1d06064b93fbdcae6737ddc2f5b Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sun, 22 Apr 2018 17:13:50 +0200 Subject: [PATCH 466/470] Revert "[base] Fix bitmap copying where the new pitch is smaller." This reverts commit c0f1adedcfaad4f7d2fe912ff4b2933845d61d93. --- ChangeLog | 6 ----- src/base/ftbitmap.c | 58 +++++++++++---------------------------------- 2 files changed, 14 insertions(+), 50 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5cdf5be14..4dc8c552a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,9 +1,3 @@ -2018-04-22 Werner Lemberg - - [base] Fix bitmap copying where the new pitch is smaller. - - * src/base/ftbitmap.c (ft_bitmap_assure_buffer): Handle it. - 2018-04-22 Werner Lemberg Another fix for handling invalid format 2 cmaps. diff --git a/src/base/ftbitmap.c b/src/base/ftbitmap.c index 4f5ca5a59..93efb0944 100644 --- a/src/base/ftbitmap.c +++ b/src/base/ftbitmap.c @@ -237,35 +237,20 @@ unsigned char* out = buffer; unsigned char* limit = bitmap->buffer + pitch * bitmap->rows; + unsigned int delta = new_pitch - pitch; FT_MEM_ZERO( out, new_pitch * ypixels ); out += new_pitch * ypixels; - if ( new_pitch > pitch ) + while ( in < limit ) { - unsigned int delta = new_pitch - pitch; + FT_MEM_COPY( out, in, len ); + in += pitch; + out += pitch; - - while ( in < limit ) - { - FT_MEM_COPY( out, in, len ); - in += pitch; - out += pitch; - - /* we have to zero out the new (unused) pitch bytes */ - FT_MEM_ZERO( out, delta ); - out += delta; - } - } - else - { - while ( in < limit ) - { - FT_MEM_COPY( out, in, len ); - in += pitch; - out += new_pitch; - } + FT_MEM_ZERO( out, delta ); + out += delta; } } else @@ -276,32 +261,17 @@ unsigned char* out = buffer; unsigned char* limit = bitmap->buffer + pitch * bitmap->rows; + unsigned int delta = new_pitch - pitch; - if ( new_pitch > pitch ) + while ( in < limit ) { - unsigned int delta = new_pitch - pitch; + FT_MEM_COPY( out, in, len ); + in += pitch; + out += pitch; - - while ( in < limit ) - { - FT_MEM_COPY( out, in, len ); - in += pitch; - out += pitch; - - /* we have to zero out the new (unused) pitch bytes */ - FT_MEM_ZERO( out, delta ); - out += delta; - } - } - else - { - while ( in < limit ) - { - FT_MEM_COPY( out, in, len ); - in += pitch; - out += new_pitch; - } + FT_MEM_ZERO( out, delta ); + out += delta; } FT_MEM_ZERO( out, new_pitch * ypixels ); From 3b88576ba0807f5203310c22d5dbfff803c4abd9 Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Sun, 22 Apr 2018 17:22:35 +0200 Subject: [PATCH 467/470] [base] Fix bitmap emboldening. Bug introduced after release 2.8. * src/base/ftbitmap.c (ft_bitmap_assure_buffer): We use `FT_QALLOC_MULT', which doesn't zero out the buffer. Adjust the bitmap copying code to take care of this fact. --- ChangeLog | 10 ++++++++++ src/base/ftbitmap.c | 10 ++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4dc8c552a..24acb8f31 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2018-04-22 Alexei Podtelezhnikov + + [base] Fix bitmap emboldening. + + Bug introduced after release 2.8. + + * src/base/ftbitmap.c (ft_bitmap_assure_buffer): We use + `FT_QALLOC_MULT', which doesn't zero out the buffer. Adjust the + bitmap copying code to take care of this fact. + 2018-04-22 Werner Lemberg Another fix for handling invalid format 2 cmaps. diff --git a/src/base/ftbitmap.c b/src/base/ftbitmap.c index 93efb0944..a9746663f 100644 --- a/src/base/ftbitmap.c +++ b/src/base/ftbitmap.c @@ -237,7 +237,7 @@ unsigned char* out = buffer; unsigned char* limit = bitmap->buffer + pitch * bitmap->rows; - unsigned int delta = new_pitch - pitch; + unsigned int delta = new_pitch - len; FT_MEM_ZERO( out, new_pitch * ypixels ); @@ -247,8 +247,10 @@ { FT_MEM_COPY( out, in, len ); in += pitch; - out += pitch; + out += len; + /* we use FT_QALLOC_MULT, which doesn't zero out the buffer; */ + /* consequently, we have to manually zero out the remaining bytes */ FT_MEM_ZERO( out, delta ); out += delta; } @@ -261,14 +263,14 @@ unsigned char* out = buffer; unsigned char* limit = bitmap->buffer + pitch * bitmap->rows; - unsigned int delta = new_pitch - pitch; + unsigned int delta = new_pitch - len; while ( in < limit ) { FT_MEM_COPY( out, in, len ); in += pitch; - out += pitch; + out += len; FT_MEM_ZERO( out, delta ); out += delta; From 67697d0076cbd2e59ee22c665b2ee792ef5b54ae Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sun, 22 Apr 2018 21:15:10 +0200 Subject: [PATCH 468/470] * src/base/ftoutln.c (FT_Outline_Decompose): Improve error tracing. --- ChangeLog | 4 ++++ src/base/ftoutln.c | 7 ++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 24acb8f31..690d07426 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2018-04-22 Werner Lemberg + + * src/base/ftoutln.c (FT_Outline_Decompose): Improve error tracing. + 2018-04-22 Alexei Podtelezhnikov [base] Fix bitmap emboldening. diff --git a/src/base/ftoutln.c b/src/base/ftoutln.c index 9c29ade92..cb91321de 100644 --- a/src/base/ftoutln.c +++ b/src/base/ftoutln.c @@ -286,12 +286,13 @@ FT_TRACE5(( "FT_Outline_Decompose: Done\n", n )); return FT_Err_Ok; + Invalid_Outline: + error = FT_THROW( Invalid_Outline ); + /* fall through */ + Exit: FT_TRACE5(( "FT_Outline_Decompose: Error 0x%x\n", error )); return error; - - Invalid_Outline: - return FT_THROW( Invalid_Outline ); } From 2157d8fa6f7e12063ca166476ed2223d24234db7 Mon Sep 17 00:00:00 2001 From: Ben Wagner Date: Tue, 24 Apr 2018 10:29:19 +0200 Subject: [PATCH 469/470] [base] Avoid undefined behaviour in lcd filtering code (#53727). * src/base/ftlcdfil.c (ft_lcd_filter_fir, _ft_lcd_filter_legacy): Ensure `height > 0'. --- ChangeLog | 7 +++++++ src/base/ftlcdfil.c | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 690d07426..cd8b1538a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2018-04-24 Ben Wagner + + [base] Avoid undefined behaviour in lcd filtering code (#53727). + + * src/base/ftlcdfil.c (ft_lcd_filter_fir, _ft_lcd_filter_legacy): + Ensure `height > 0'. + 2018-04-22 Werner Lemberg * src/base/ftoutln.c (FT_Outline_Decompose): Improve error tracing. diff --git a/src/base/ftlcdfil.c b/src/base/ftlcdfil.c index 5c38911a9..8d314df08 100644 --- a/src/base/ftlcdfil.c +++ b/src/base/ftlcdfil.c @@ -77,7 +77,7 @@ /* take care of bitmap flow */ - if ( pitch > 0 ) + if ( pitch > 0 && height > 0 ) origin += pitch * (FT_Int)( height - 1 ); /* horizontal in-place FIR filter */ @@ -192,7 +192,7 @@ /* take care of bitmap flow */ - if ( pitch > 0 ) + if ( pitch > 0 && height > 0 ) origin += pitch * (FT_Int)( height - 1 ); /* horizontal in-place intra-pixel filter */ From ac97a29653e2a551064705891bc578c53ecf056d Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Thu, 26 Apr 2018 09:04:39 +0200 Subject: [PATCH 470/470] Another fix for handling invalid format 2 cmaps. Sigh. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=8003 * src/sfnt/ttcmap.c (tt_cmap2_char_next): Adjust condition to avoid an endless loop. --- ChangeLog | 13 +++++++++++++ src/sfnt/ttcmap.c | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index cd8b1538a..1b86d6025 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2018-04-26 Werner Lemberg + + Another fix for handling invalid format 2 cmaps. + + Sigh. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=8003 + + * src/sfnt/ttcmap.c (tt_cmap2_char_next): Adjust condition to avoid + an endless loop. + 2018-04-24 Ben Wagner [base] Avoid undefined behaviour in lcd filtering code (#53727). diff --git a/src/sfnt/ttcmap.c b/src/sfnt/ttcmap.c index 07075cbc0..996e66485 100644 --- a/src/sfnt/ttcmap.c +++ b/src/sfnt/ttcmap.c @@ -518,7 +518,7 @@ FT_UInt pos, idx; - if ( char_lo > start + count && charcode <= 0xFF ) + if ( char_lo >= start + count && charcode <= 0xFF ) { /* this happens only for a malformed cmap */ charcode = 0x100;